@jenesei-software/jenesei-kit-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/build/area-9NUxwBGc.cjs +2 -0
- package/build/area-9NUxwBGc.cjs.map +1 -0
- package/build/area-BnAddPtl.js +114 -0
- package/build/area-BnAddPtl.js.map +1 -0
- package/build/area-C2sWYH-e.js +47 -0
- package/build/area-C2sWYH-e.js.map +1 -0
- package/build/area-CD10k19W.cjs +27 -0
- package/build/area-CD10k19W.cjs.map +1 -0
- package/build/area-ClrrGVJG.cjs +40 -0
- package/build/area-ClrrGVJG.cjs.map +1 -0
- package/build/area-D7906bXA.cjs +2 -0
- package/build/area-D7906bXA.cjs.map +1 -0
- package/build/area-DRqAofd0.js +35 -0
- package/build/area-DRqAofd0.js.map +1 -0
- package/build/area-DfCAwCiZ.js +69 -0
- package/build/area-DfCAwCiZ.js.map +1 -0
- package/build/area-outside.cjs.js +2 -0
- package/build/area-outside.cjs.js.map +1 -0
- package/build/area-outside.d.ts +28 -0
- package/build/area-outside.es.js +5 -0
- package/build/area-outside.es.js.map +1 -0
- package/build/area-preview.cjs.js +2 -0
- package/build/area-preview.cjs.js.map +1 -0
- package/build/area-preview.d.ts +48 -0
- package/build/area-preview.es.js +7 -0
- package/build/area-preview.es.js.map +1 -0
- package/build/area-scroll.cjs.js +2 -0
- package/build/area-scroll.cjs.js.map +1 -0
- package/build/area-scroll.d.ts +58 -0
- package/build/area-scroll.es.js +6 -0
- package/build/area-scroll.es.js.map +1 -0
- package/build/area-skeleton.cjs.js +2 -0
- package/build/area-skeleton.cjs.js.map +1 -0
- package/build/area-skeleton.d.ts +64 -0
- package/build/area-skeleton.es.js +6 -0
- package/build/area-skeleton.es.js.map +1 -0
- package/build/area-smooth.cjs.js +2 -0
- package/build/area-smooth.cjs.js.map +1 -0
- package/build/area-smooth.d.ts +37 -0
- package/build/area-smooth.es.js +5 -0
- package/build/area-smooth.es.js.map +1 -0
- package/build/area.hooks-Bk04M7mk.js +26 -0
- package/build/area.hooks-Bk04M7mk.js.map +1 -0
- package/build/area.hooks-C_UKZzcb.cjs +2 -0
- package/build/area.hooks-C_UKZzcb.cjs.map +1 -0
- package/build/build-info.txt +3 -0
- package/build/component--Oo5_3xq.cjs +2 -0
- package/build/component--Oo5_3xq.cjs.map +1 -0
- package/build/component-BV_7tGiu.cjs +28 -0
- package/build/component-BV_7tGiu.cjs.map +1 -0
- package/build/component-BcHiCCC9.js +23 -0
- package/build/component-BcHiCCC9.js.map +1 -0
- package/build/component-BnI7BIp-.cjs +2 -0
- package/build/component-BnI7BIp-.cjs.map +1 -0
- package/build/component-ByY_9Ryc.js +65 -0
- package/build/component-ByY_9Ryc.js.map +1 -0
- package/build/component-C2JFFh-k.js +2372 -0
- package/build/component-C2JFFh-k.js.map +1 -0
- package/build/component-C52VCES6.cjs +247 -0
- package/build/component-C52VCES6.cjs.map +1 -0
- package/build/component-CBshLNEf.js +50 -0
- package/build/component-CBshLNEf.js.map +1 -0
- package/build/component-CFMlaYj1.js +66 -0
- package/build/component-CFMlaYj1.js.map +1 -0
- package/build/component-CuiUpH8H.js +207 -0
- package/build/component-CuiUpH8H.js.map +1 -0
- package/build/component-D1NPhRuV.cjs +90 -0
- package/build/component-D1NPhRuV.cjs.map +1 -0
- package/build/component-DZxbW_Jz.js +237 -0
- package/build/component-DZxbW_Jz.js.map +1 -0
- package/build/component-UW1VzyvB.cjs +52 -0
- package/build/component-UW1VzyvB.cjs.map +1 -0
- package/build/component-accordion.cjs.js +2 -0
- package/build/component-accordion.cjs.js.map +1 -0
- package/build/component-accordion.d.ts +94 -0
- package/build/component-accordion.es.js +10 -0
- package/build/component-accordion.es.js.map +1 -0
- package/build/component-button-group.cjs.js +2 -0
- package/build/component-button-group.cjs.js.map +1 -0
- package/build/component-button-group.d.ts +320 -0
- package/build/component-button-group.es.js +6 -0
- package/build/component-button-group.es.js.map +1 -0
- package/build/component-button.cjs.js +2 -0
- package/build/component-button.cjs.js.map +1 -0
- package/build/component-button.d.ts +347 -0
- package/build/component-button.es.js +9 -0
- package/build/component-button.es.js.map +1 -0
- package/build/component-checkbox-group.cjs.js +2 -0
- package/build/component-checkbox-group.cjs.js.map +1 -0
- package/build/component-checkbox-group.d.ts +337 -0
- package/build/component-checkbox-group.es.js +11 -0
- package/build/component-checkbox-group.es.js.map +1 -0
- package/build/component-checkbox.cjs.js +2 -0
- package/build/component-checkbox.cjs.js.map +1 -0
- package/build/component-checkbox.d.ts +342 -0
- package/build/component-checkbox.es.js +10 -0
- package/build/component-checkbox.es.js.map +1 -0
- package/build/component-date-picker.cjs.js +2 -0
- package/build/component-date-picker.cjs.js.map +1 -0
- package/build/component-date-picker.d.ts +415 -0
- package/build/component-date-picker.es.js +17 -0
- package/build/component-date-picker.es.js.map +1 -0
- package/build/component-icon.cjs.js +2 -0
- package/build/component-icon.cjs.js.map +1 -0
- package/build/component-icon.d.ts +198 -0
- package/build/component-icon.es.js +12 -0
- package/build/component-icon.es.js.map +1 -0
- package/build/component-image-button.cjs.js +2 -0
- package/build/component-image-button.cjs.js.map +1 -0
- package/build/component-image-button.d.ts +340 -0
- package/build/component-image-button.es.js +5 -0
- package/build/component-image-button.es.js.map +1 -0
- package/build/component-image-select.cjs.js +2 -0
- package/build/component-image-select.cjs.js.map +1 -0
- package/build/component-image-select.d.ts +436 -0
- package/build/component-image-select.es.js +11 -0
- package/build/component-image-select.es.js.map +1 -0
- package/build/component-image-slider.cjs.js +2 -0
- package/build/component-image-slider.cjs.js.map +1 -0
- package/build/component-image-slider.d.ts +108 -0
- package/build/component-image-slider.es.js +8 -0
- package/build/component-image-slider.es.js.map +1 -0
- package/build/component-image.cjs.js +2 -0
- package/build/component-image.cjs.js.map +1 -0
- package/build/component-image.d.ts +51 -0
- package/build/component-image.es.js +6 -0
- package/build/component-image.es.js.map +1 -0
- package/build/component-input-otp.cjs.js +2 -0
- package/build/component-input-otp.cjs.js.map +1 -0
- package/build/component-input-otp.d.ts +150 -0
- package/build/component-input-otp.es.js +8 -0
- package/build/component-input-otp.es.js.map +1 -0
- package/build/component-input.cjs.js +2 -0
- package/build/component-input.cjs.js.map +1 -0
- package/build/component-input.d.ts +226 -0
- package/build/component-input.es.js +20 -0
- package/build/component-input.es.js.map +1 -0
- package/build/component-jPZYT5iL.js +76 -0
- package/build/component-jPZYT5iL.js.map +1 -0
- package/build/component-map.cjs.js +2 -0
- package/build/component-map.cjs.js.map +1 -0
- package/build/component-map.d.ts +97 -0
- package/build/component-map.es.js +18 -0
- package/build/component-map.es.js.map +1 -0
- package/build/component-nFn_uOy_.cjs +2 -0
- package/build/component-nFn_uOy_.cjs.map +1 -0
- package/build/component-pagination.cjs.js +2 -0
- package/build/component-pagination.cjs.js.map +1 -0
- package/build/component-pagination.d.ts +321 -0
- package/build/component-pagination.es.js +6 -0
- package/build/component-pagination.es.js.map +1 -0
- package/build/component-range.cjs.js +2 -0
- package/build/component-range.cjs.js.map +1 -0
- package/build/component-range.d.ts +153 -0
- package/build/component-range.es.js +8 -0
- package/build/component-range.es.js.map +1 -0
- package/build/component-ripple.cjs.js +2 -0
- package/build/component-ripple.cjs.js.map +1 -0
- package/build/component-ripple.d.ts +45 -0
- package/build/component-ripple.es.js +12 -0
- package/build/component-ripple.es.js.map +1 -0
- package/build/component-select.cjs.js +2 -0
- package/build/component-select.cjs.js.map +1 -0
- package/build/component-select.d.ts +406 -0
- package/build/component-select.es.js +25 -0
- package/build/component-select.es.js.map +1 -0
- package/build/component-separator.cjs.js +2 -0
- package/build/component-separator.cjs.js.map +1 -0
- package/build/component-separator.d.ts +46 -0
- package/build/component-separator.es.js +6 -0
- package/build/component-separator.es.js.map +1 -0
- package/build/component-stack.cjs.js +2 -0
- package/build/component-stack.cjs.js.map +1 -0
- package/build/component-stack.d.ts +72 -0
- package/build/component-stack.es.js +8 -0
- package/build/component-stack.es.js.map +1 -0
- package/build/component-textarea.cjs.js +2 -0
- package/build/component-textarea.cjs.js.map +1 -0
- package/build/component-textarea.d.ts +131 -0
- package/build/component-textarea.es.js +12 -0
- package/build/component-textarea.es.js.map +1 -0
- package/build/component-toggle.cjs.js +2 -0
- package/build/component-toggle.cjs.js.map +1 -0
- package/build/component-toggle.d.ts +101 -0
- package/build/component-toggle.es.js +7 -0
- package/build/component-toggle.es.js.map +1 -0
- package/build/component-tooltip.cjs.js +2 -0
- package/build/component-tooltip.cjs.js.map +1 -0
- package/build/component-tooltip.d.ts +170 -0
- package/build/component-tooltip.es.js +12 -0
- package/build/component-tooltip.es.js.map +1 -0
- package/build/component-typography.cjs.js +2 -0
- package/build/component-typography.cjs.js.map +1 -0
- package/build/component-typography.d.ts +183 -0
- package/build/component-typography.es.js +10 -0
- package/build/component-typography.es.js.map +1 -0
- package/build/component-xnEaYd4a.cjs +2 -0
- package/build/component-xnEaYd4a.cjs.map +1 -0
- package/build/component.components-BAAT5GTH.js +363 -0
- package/build/component.components-BAAT5GTH.js.map +1 -0
- package/build/component.components-CaR5gfQW.cjs +16 -0
- package/build/component.components-CaR5gfQW.cjs.map +1 -0
- package/build/component.constants-BeWW8Ijx.cjs +2 -0
- package/build/component.constants-BeWW8Ijx.cjs.map +1 -0
- package/build/component.constants-D9wVZ3zy.cjs +22 -0
- package/build/component.constants-D9wVZ3zy.cjs.map +1 -0
- package/build/component.constants-DRvp5Bez.js +142 -0
- package/build/component.constants-DRvp5Bez.js.map +1 -0
- package/build/component.constants-DbNhxh0k.js +759 -0
- package/build/component.constants-DbNhxh0k.js.map +1 -0
- package/build/component.styles-B0L4jbOO.js +59 -0
- package/build/component.styles-B0L4jbOO.js.map +1 -0
- package/build/component.styles-B1DIataj.cjs +10 -0
- package/build/component.styles-B1DIataj.cjs.map +1 -0
- package/build/component.styles-BFwkFWkd.cjs +39 -0
- package/build/component.styles-BFwkFWkd.cjs.map +1 -0
- package/build/component.styles-BSEA2Dqn.cjs +8 -0
- package/build/component.styles-BSEA2Dqn.cjs.map +1 -0
- package/build/component.styles-BapdQNhL.js +2166 -0
- package/build/component.styles-BapdQNhL.js.map +1 -0
- package/build/component.styles-BfvB83xM.cjs +22 -0
- package/build/component.styles-BfvB83xM.cjs.map +1 -0
- package/build/component.styles-Bn6ylF83.js +859 -0
- package/build/component.styles-Bn6ylF83.js.map +1 -0
- package/build/component.styles-BsZIuwWJ.cjs +140 -0
- package/build/component.styles-BsZIuwWJ.cjs.map +1 -0
- package/build/component.styles-C6LohBfF.js +81 -0
- package/build/component.styles-C6LohBfF.js.map +1 -0
- package/build/component.styles-CEBh8X5q.js +20 -0
- package/build/component.styles-CEBh8X5q.js.map +1 -0
- package/build/component.styles-CPsxMKVK.cjs +73 -0
- package/build/component.styles-CPsxMKVK.cjs.map +1 -0
- package/build/component.styles-CTo5NC52.js +71 -0
- package/build/component.styles-CTo5NC52.js.map +1 -0
- package/build/component.styles-CV7jTFCg.js +758 -0
- package/build/component.styles-CV7jTFCg.js.map +1 -0
- package/build/component.styles-CVBpx4fw.js +474 -0
- package/build/component.styles-CVBpx4fw.js.map +1 -0
- package/build/component.styles-CZu2m0O4.cjs +21 -0
- package/build/component.styles-CZu2m0O4.cjs.map +1 -0
- package/build/component.styles-CmBcHREH.cjs +13 -0
- package/build/component.styles-CmBcHREH.cjs.map +1 -0
- package/build/component.styles-CmEFZfA5.js +120 -0
- package/build/component.styles-CmEFZfA5.js.map +1 -0
- package/build/component.styles-DHIw8p8e.cjs +158 -0
- package/build/component.styles-DHIw8p8e.cjs.map +1 -0
- package/build/component.styles-DOPCUXcr.js +158 -0
- package/build/component.styles-DOPCUXcr.js.map +1 -0
- package/build/component.styles-Dj3h7jd9.cjs +165 -0
- package/build/component.styles-Dj3h7jd9.cjs.map +1 -0
- package/build/component.styles-Do1NYZEO.js +86 -0
- package/build/component.styles-Do1NYZEO.js.map +1 -0
- package/build/component.styles-Dok17vPl.js +126 -0
- package/build/component.styles-Dok17vPl.js.map +1 -0
- package/build/component.styles-Dpg-__rn.cjs +43 -0
- package/build/component.styles-Dpg-__rn.cjs.map +1 -0
- package/build/component.styles-DpkFoWEh.cjs +81 -0
- package/build/component.styles-DpkFoWEh.cjs.map +1 -0
- package/build/component.styles-DqsBDAEo.js +202 -0
- package/build/component.styles-DqsBDAEo.js.map +1 -0
- package/build/component.styles-Du2y0R4W.js +177 -0
- package/build/component.styles-Du2y0R4W.js.map +1 -0
- package/build/component.styles-DxeG9Opm.cjs +47 -0
- package/build/component.styles-DxeG9Opm.cjs.map +1 -0
- package/build/component.styles-DyGfo9t0.cjs +32 -0
- package/build/component.styles-DyGfo9t0.cjs.map +1 -0
- package/build/component.styles-RkQwTlwG.js +170 -0
- package/build/component.styles-RkQwTlwG.js.map +1 -0
- package/build/component.styles-ZtwHuL4x.cjs +75 -0
- package/build/component.styles-ZtwHuL4x.cjs.map +1 -0
- package/build/component.types-D05KdxnZ.js +132 -0
- package/build/component.types-D05KdxnZ.js.map +1 -0
- package/build/component.types-gy5Q9qHX.cjs +2 -0
- package/build/component.types-gy5Q9qHX.cjs.map +1 -0
- package/build/consts.cjs.js +2 -0
- package/build/consts.cjs.js.map +1 -0
- package/build/consts.d.ts +86 -0
- package/build/consts.es.js +177 -0
- package/build/consts.es.js.map +1 -0
- package/build/context-app.cjs.js +2 -0
- package/build/context-app.cjs.js.map +1 -0
- package/build/context-app.d.ts +223 -0
- package/build/context-app.es.js +20 -0
- package/build/context-app.es.js.map +1 -0
- package/build/context-cookie.cjs.js +2 -0
- package/build/context-cookie.cjs.js.map +1 -0
- package/build/context-cookie.d.ts +67 -0
- package/build/context-cookie.es.js +9 -0
- package/build/context-cookie.es.js.map +1 -0
- package/build/context-dialog.cjs.js +2 -0
- package/build/context-dialog.cjs.js.map +1 -0
- package/build/context-dialog.d.ts +92 -0
- package/build/context-dialog.es.js +18 -0
- package/build/context-dialog.es.js.map +1 -0
- package/build/context-geolocation.cjs.js +2 -0
- package/build/context-geolocation.cjs.js.map +1 -0
- package/build/context-geolocation.d.ts +22 -0
- package/build/context-geolocation.es.js +7 -0
- package/build/context-geolocation.es.js.map +1 -0
- package/build/context-local-storage.cjs.js +2 -0
- package/build/context-local-storage.cjs.js.map +1 -0
- package/build/context-local-storage.d.ts +54 -0
- package/build/context-local-storage.es.js +9 -0
- package/build/context-local-storage.es.js.map +1 -0
- package/build/context-permission.cjs.js +2 -0
- package/build/context-permission.cjs.js.map +1 -0
- package/build/context-permission.d.ts +28 -0
- package/build/context-permission.es.js +9 -0
- package/build/context-permission.es.js.map +1 -0
- package/build/context-screen-width.cjs.js +2 -0
- package/build/context-screen-width.cjs.js.map +1 -0
- package/build/context-screen-width.d.ts +34 -0
- package/build/context-screen-width.es.js +7 -0
- package/build/context-screen-width.es.js.map +1 -0
- package/build/context-sonner.cjs.js +2 -0
- package/build/context-sonner.cjs.js.map +1 -0
- package/build/context-sonner.d.ts +449 -0
- package/build/context-sonner.es.js +21 -0
- package/build/context-sonner.es.js.map +1 -0
- package/build/context.constants-B29-_8v3.cjs +32 -0
- package/build/context.constants-B29-_8v3.cjs.map +1 -0
- package/build/context.constants-BaD7xj_m.cjs +100 -0
- package/build/context.constants-BaD7xj_m.cjs.map +1 -0
- package/build/context.constants-CsZRZ7gH.js +228 -0
- package/build/context.constants-CsZRZ7gH.js.map +1 -0
- package/build/context.constants-DqYjo5m4.js +375 -0
- package/build/context.constants-DqYjo5m4.js.map +1 -0
- package/build/context.functions-80N-5MqM.cjs +2 -0
- package/build/context.functions-80N-5MqM.cjs.map +1 -0
- package/build/context.functions-B8FDl7nJ.js +14 -0
- package/build/context.functions-B8FDl7nJ.js.map +1 -0
- package/build/context.functions-BD15C8_y.js +128 -0
- package/build/context.functions-BD15C8_y.js.map +1 -0
- package/build/context.functions-CQ9GerPb.js +147 -0
- package/build/context.functions-CQ9GerPb.js.map +1 -0
- package/build/context.functions-ar41xFVo.cjs +2 -0
- package/build/context.functions-ar41xFVo.cjs.map +1 -0
- package/build/context.functions-ohI9H54j.cjs +2 -0
- package/build/context.functions-ohI9H54j.cjs.map +1 -0
- package/build/context.hooks-7ydA7mGj.js +117 -0
- package/build/context.hooks-7ydA7mGj.js.map +1 -0
- package/build/context.hooks-BIsapq-0.cjs +2 -0
- package/build/context.hooks-BIsapq-0.cjs.map +1 -0
- package/build/context.hooks-BmwyZ1p3.js +68 -0
- package/build/context.hooks-BmwyZ1p3.js.map +1 -0
- package/build/context.hooks-BzMTkJNv.js +52 -0
- package/build/context.hooks-BzMTkJNv.js.map +1 -0
- package/build/context.hooks-CTi-CVKx.cjs +72 -0
- package/build/context.hooks-CTi-CVKx.cjs.map +1 -0
- package/build/context.hooks-D13tbrva.cjs +2 -0
- package/build/context.hooks-D13tbrva.cjs.map +1 -0
- package/build/context.hooks-gyzZSaVi.js +527 -0
- package/build/context.hooks-gyzZSaVi.js.map +1 -0
- package/build/context.hooks-u408Pxw8.cjs +2 -0
- package/build/context.hooks-u408Pxw8.cjs.map +1 -0
- package/build/functions.cjs.js +2 -0
- package/build/functions.cjs.js.map +1 -0
- package/build/functions.d.ts +22 -0
- package/build/functions.es.js +47 -0
- package/build/functions.es.js.map +1 -0
- package/build/hooks-use-debounced-callback.cjs.js +2 -0
- package/build/hooks-use-debounced-callback.cjs.js.map +1 -0
- package/build/hooks-use-debounced-callback.d.ts +3 -0
- package/build/hooks-use-debounced-callback.es.js +5 -0
- package/build/hooks-use-debounced-callback.es.js.map +1 -0
- package/build/hooks-use-deep-compare-memoize.cjs.js +2 -0
- package/build/hooks-use-deep-compare-memoize.cjs.js.map +1 -0
- package/build/hooks-use-deep-compare-memoize.d.ts +3 -0
- package/build/hooks-use-deep-compare-memoize.es.js +5 -0
- package/build/hooks-use-deep-compare-memoize.es.js.map +1 -0
- package/build/index.cjs.js +2 -0
- package/build/index.cjs.js.map +1 -0
- package/build/index.d.ts +2540 -0
- package/build/index.es.js +329 -0
- package/build/index.es.js.map +1 -0
- package/build/jsx-runtime-BcGej2Kr.cjs +11 -0
- package/build/jsx-runtime-BcGej2Kr.cjs.map +1 -0
- package/build/jsx-runtime-BrDlu8eK.js +320 -0
- package/build/jsx-runtime-BrDlu8eK.js.map +1 -0
- package/build/motion-CIQfrLky.js +85 -0
- package/build/motion-CIQfrLky.js.map +1 -0
- package/build/motion-DgB7M2Hn.cjs +2 -0
- package/build/motion-DgB7M2Hn.cjs.map +1 -0
- package/build/style-CEGJOjRW.js +107 -0
- package/build/style-CEGJOjRW.js.map +1 -0
- package/build/style-CtGd1JVB.cjs +32 -0
- package/build/style-CtGd1JVB.cjs.map +1 -0
- package/build/style-DeAgDHyI.js +52 -0
- package/build/style-DeAgDHyI.js.map +1 -0
- package/build/style-Dm74EPGE.cjs +87 -0
- package/build/style-Dm74EPGE.cjs.map +1 -0
- package/build/style-add.cjs.js +2 -0
- package/build/style-add.cjs.js.map +1 -0
- package/build/style-add.d.ts +21 -0
- package/build/style-add.es.js +13 -0
- package/build/style-add.es.js.map +1 -0
- package/build/style-error.cjs.js +2 -0
- package/build/style-error.cjs.js.map +1 -0
- package/build/style-error.d.ts +56 -0
- package/build/style-error.es.js +7 -0
- package/build/style-error.es.js.map +1 -0
- package/build/style-fRZ6xrVp.cjs +10 -0
- package/build/style-fRZ6xrVp.cjs.map +1 -0
- package/build/style-motion.cjs.js +2 -0
- package/build/style-motion.cjs.js.map +1 -0
- package/build/style-motion.d.ts +20 -0
- package/build/style-motion.es.js +8 -0
- package/build/style-motion.es.js.map +1 -0
- package/build/style-plT9Ah7t.js +33 -0
- package/build/style-plT9Ah7t.js.map +1 -0
- package/build/style-sx.cjs.js +2 -0
- package/build/style-sx.cjs.js.map +1 -0
- package/build/style-sx.d.ts +31 -0
- package/build/style-sx.es.js +5 -0
- package/build/style-sx.es.js.map +1 -0
- package/build/style-theme.cjs.js +2 -0
- package/build/style-theme.cjs.js.map +1 -0
- package/build/style-theme.d.ts +263 -0
- package/build/style-theme.es.js +10 -0
- package/build/style-theme.es.js.map +1 -0
- package/build/style.css +1 -0
- package/build/theme.global-D6XU05Et.cjs +169 -0
- package/build/theme.global-D6XU05Et.cjs.map +1 -0
- package/build/theme.global-bN9HlSWE.js +1080 -0
- package/build/theme.global-bN9HlSWE.js.map +1 -0
- package/build/types.cjs.js +2 -0
- package/build/types.cjs.js.map +1 -0
- package/build/types.d.ts +27 -0
- package/build/types.es.js +2 -0
- package/build/types.es.js.map +1 -0
- package/build/use-BVj4dgbW.js +1547 -0
- package/build/use-BVj4dgbW.js.map +1 -0
- package/build/use-BhofoOgk.cjs +16 -0
- package/build/use-BhofoOgk.cjs.map +1 -0
- package/build/use-Bp8UVw4Y.js +16 -0
- package/build/use-Bp8UVw4Y.js.map +1 -0
- package/build/use-C1l0O0Qo.cjs +2 -0
- package/build/use-C1l0O0Qo.cjs.map +1 -0
- package/build/use-DT0XgvJT.js +25 -0
- package/build/use-DT0XgvJT.js.map +1 -0
- package/build/use-IhzeVumv.cjs +2 -0
- package/build/use-IhzeVumv.cjs.map +1 -0
- package/package.json +360 -0
|
@@ -0,0 +1,2372 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "./jsx-runtime-BrDlu8eK.js";
|
|
2
|
+
import { createLink } from "@tanstack/react-router";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useLayoutEffect, useState, useRef, useMemo, useEffect, useCallback, memo } from "react";
|
|
5
|
+
import { u as useScreenWidth } from "./context.hooks-BmwyZ1p3.js";
|
|
6
|
+
import styled, { css, keyframes } from "styled-components";
|
|
7
|
+
import { a as addSX } from "./style-plT9Ah7t.js";
|
|
8
|
+
import { J as JeneseiPalette, K as KEY_SIZE_DATA } from "./theme.global-bN9HlSWE.js";
|
|
9
|
+
import * as ReactDOM from "react-dom";
|
|
10
|
+
import ReactDOM__default from "react-dom";
|
|
11
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
12
|
+
import { f as addOutline } from "./style-CEGJOjRW.js";
|
|
13
|
+
import { b as Stack } from "./component-jPZYT5iL.js";
|
|
14
|
+
const getFontSizeStyles = (size, weight, family, height) => css`
|
|
15
|
+
font-family: ${family ? family : "inherit"};
|
|
16
|
+
font-style: normal;
|
|
17
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
18
|
+
font-size: ${size}px;
|
|
19
|
+
font-weight: ${weight};
|
|
20
|
+
${height && css`
|
|
21
|
+
line-height: ${height};
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
const shadowPulse = keyframes`
|
|
25
|
+
0% {
|
|
26
|
+
text-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
|
27
|
+
}
|
|
28
|
+
50% {
|
|
29
|
+
text-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
|
|
30
|
+
}
|
|
31
|
+
100% {
|
|
32
|
+
text-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
function toStyledCSS(value) {
|
|
36
|
+
return css`
|
|
37
|
+
${value.shadow && value.shadow === "shadowPulse" && css`
|
|
38
|
+
animation: ${shadowPulse} 2s infinite;
|
|
39
|
+
`};
|
|
40
|
+
${value.letterSpacing && css`
|
|
41
|
+
letter-spacing: ${value.letterSpacing};
|
|
42
|
+
`};
|
|
43
|
+
${value.flex && css`
|
|
44
|
+
flex: ${value.flex};
|
|
45
|
+
`};
|
|
46
|
+
${value.cursor && css`
|
|
47
|
+
cursor: ${value.cursor};
|
|
48
|
+
`};
|
|
49
|
+
${value.overflow && css`
|
|
50
|
+
overflow: ${value.overflow};
|
|
51
|
+
`};
|
|
52
|
+
${value.line !== void 0 ? value.line === 1 ? css`
|
|
53
|
+
text-overflow: ellipsis;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
width: -webkit-fill-available;
|
|
57
|
+
max-width: fit-content;
|
|
58
|
+
` : css`
|
|
59
|
+
word-break: break-word;
|
|
60
|
+
white-space: normal;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
display: -webkit-box;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
-webkit-box-orient: vertical;
|
|
65
|
+
-webkit-line-clamp: ${value.line};
|
|
66
|
+
width: fit-content;
|
|
67
|
+
overflow-wrap: anywhere;
|
|
68
|
+
` : css``};
|
|
69
|
+
${value.family && css`
|
|
70
|
+
font-family: ${value.family};
|
|
71
|
+
`};
|
|
72
|
+
${value.weight && css`
|
|
73
|
+
font-weight: ${value.weight};
|
|
74
|
+
`};
|
|
75
|
+
${value.height && css`
|
|
76
|
+
line-height: ${value.height}px;
|
|
77
|
+
`};
|
|
78
|
+
${value.color && css`
|
|
79
|
+
color: ${JeneseiPalette[value.color]};
|
|
80
|
+
`};
|
|
81
|
+
${value.align && css`
|
|
82
|
+
text-align: ${value.align};
|
|
83
|
+
`};
|
|
84
|
+
${value.wrap && css`
|
|
85
|
+
text-wrap: ${value.wrap};
|
|
86
|
+
`};
|
|
87
|
+
${value.decoration && css`
|
|
88
|
+
text-decoration: ${value.decoration};
|
|
89
|
+
`};
|
|
90
|
+
${value.transform && css`
|
|
91
|
+
text-transform: ${value.transform};
|
|
92
|
+
`};
|
|
93
|
+
${value.isHoverUnderlining && css`
|
|
94
|
+
&:hover {
|
|
95
|
+
text-decoration: underline;
|
|
96
|
+
}
|
|
97
|
+
`};
|
|
98
|
+
${"size" in value && value.size && css`
|
|
99
|
+
font-size: ${value.size}px;
|
|
100
|
+
`};
|
|
101
|
+
${"variant" in value && value.variant ? value.variant === "h1" ? css`
|
|
102
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h1 * props.theme.font.sizeDefault.default}px;
|
|
103
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
104
|
+
margin: 0;
|
|
105
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
106
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h1 * props.theme.font.sizeDefault.tablet}px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
110
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h1 * props.theme.font.sizeDefault.mobile}px;
|
|
111
|
+
}
|
|
112
|
+
` : value.variant === "h2" ? css`
|
|
113
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h2 * props.theme.font.sizeDefault.default}px;
|
|
114
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
115
|
+
margin: 0;
|
|
116
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
117
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h2 * props.theme.font.sizeDefault.tablet}px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
121
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h2 * props.theme.font.sizeDefault.mobile}px;
|
|
122
|
+
}
|
|
123
|
+
` : value.variant === "h3" ? css`
|
|
124
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h3 * props.theme.font.sizeDefault.default}px;
|
|
125
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
126
|
+
margin: 0;
|
|
127
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
128
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h3 * props.theme.font.sizeDefault.tablet}px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
132
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h3 * props.theme.font.sizeDefault.mobile}px;
|
|
133
|
+
}
|
|
134
|
+
` : value.variant === "h4" ? css`
|
|
135
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h4 * props.theme.font.sizeDefault.default}px;
|
|
136
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
137
|
+
margin: 0;
|
|
138
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
139
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h4 * props.theme.font.sizeDefault.tablet}px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
143
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h4 * props.theme.font.sizeDefault.mobile}px;
|
|
144
|
+
}
|
|
145
|
+
` : value.variant === "h5" ? css`
|
|
146
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h5 * props.theme.font.sizeDefault.default}px;
|
|
147
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
148
|
+
margin: 0;
|
|
149
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
150
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h5 * props.theme.font.sizeDefault.tablet}px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
154
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h5 * props.theme.font.sizeDefault.mobile}px;
|
|
155
|
+
}
|
|
156
|
+
` : value.variant === "h6" ? css`
|
|
157
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h6 * props.theme.font.sizeDefault.default}px;
|
|
158
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
159
|
+
margin: 0;
|
|
160
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
161
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h6 * props.theme.font.sizeDefault.tablet}px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
165
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h6 * props.theme.font.sizeDefault.mobile}px;
|
|
166
|
+
}
|
|
167
|
+
` : value.variant === "h7" ? css`
|
|
168
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h7 * props.theme.font.sizeDefault.default}px;
|
|
169
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
170
|
+
margin: 0;
|
|
171
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
172
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h7 * props.theme.font.sizeDefault.tablet}px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
176
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h7 * props.theme.font.sizeDefault.mobile}px;
|
|
177
|
+
}
|
|
178
|
+
` : value.variant === "h8" ? css`
|
|
179
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h8 * props.theme.font.sizeDefault.default}px;
|
|
180
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
181
|
+
margin: 0;
|
|
182
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
183
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h8 * props.theme.font.sizeDefault.tablet}px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
187
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h8 * props.theme.font.sizeDefault.mobile}px;
|
|
188
|
+
}
|
|
189
|
+
` : value.variant === "h9" ? css`
|
|
190
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h9 * props.theme.font.sizeDefault.default}px;
|
|
191
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
192
|
+
margin: 0;
|
|
193
|
+
@media (max-width: ${(props) => props.theme.screens.tablet.width}px) {
|
|
194
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h9 * props.theme.font.sizeDefault.tablet}px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@media (max-width: ${(props) => props.theme.screens.mobile.width}px) {
|
|
198
|
+
font-size: ${(props) => props.theme.font.sizeHeading.h9 * props.theme.font.sizeDefault.mobile}px;
|
|
199
|
+
}
|
|
200
|
+
` : null : null};
|
|
201
|
+
`;
|
|
202
|
+
}
|
|
203
|
+
const addSXTypography = css`
|
|
204
|
+
${(props) => {
|
|
205
|
+
const rawSX = props.$sxTypography;
|
|
206
|
+
if (!rawSX) return null;
|
|
207
|
+
return toStyledCSS(rawSX.default);
|
|
208
|
+
}}
|
|
209
|
+
|
|
210
|
+
${(props) => {
|
|
211
|
+
const rawSX = props.$sxTypography;
|
|
212
|
+
if (!rawSX) return null;
|
|
213
|
+
return Object.entries(rawSX).filter(([key]) => key !== "default").map(([deviceKey, value]) => {
|
|
214
|
+
var _a;
|
|
215
|
+
const screenWidth = (_a = props.theme.screens[deviceKey]) == null ? void 0 : _a.width;
|
|
216
|
+
if (!screenWidth) return null;
|
|
217
|
+
return css`
|
|
218
|
+
@media (max-width: ${screenWidth}px) {
|
|
219
|
+
${toStyledCSS(value)}
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
});
|
|
223
|
+
}}
|
|
224
|
+
`;
|
|
225
|
+
const TypographyCSS = css`
|
|
226
|
+
font-style: normal;
|
|
227
|
+
position: relative;
|
|
228
|
+
overflow: visible;
|
|
229
|
+
text-overflow: ellipsis;
|
|
230
|
+
overflow-wrap: anywhere;
|
|
231
|
+
line-height: ${(props) => props.theme.font.lineHeight};
|
|
232
|
+
${addSXTypography};
|
|
233
|
+
${addSX}
|
|
234
|
+
`;
|
|
235
|
+
const Title = styled.span`
|
|
236
|
+
${TypographyCSS}
|
|
237
|
+
`;
|
|
238
|
+
function hasWindow() {
|
|
239
|
+
return typeof window !== "undefined";
|
|
240
|
+
}
|
|
241
|
+
function getNodeName(node) {
|
|
242
|
+
if (isNode(node)) {
|
|
243
|
+
return (node.nodeName || "").toLowerCase();
|
|
244
|
+
}
|
|
245
|
+
return "#document";
|
|
246
|
+
}
|
|
247
|
+
function getWindow(node) {
|
|
248
|
+
var _node$ownerDocument;
|
|
249
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
250
|
+
}
|
|
251
|
+
function getDocumentElement(node) {
|
|
252
|
+
var _ref;
|
|
253
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
254
|
+
}
|
|
255
|
+
function isNode(value) {
|
|
256
|
+
if (!hasWindow()) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
260
|
+
}
|
|
261
|
+
function isElement(value) {
|
|
262
|
+
if (!hasWindow()) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
266
|
+
}
|
|
267
|
+
function isHTMLElement(value) {
|
|
268
|
+
if (!hasWindow()) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
272
|
+
}
|
|
273
|
+
function isShadowRoot(value) {
|
|
274
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
278
|
+
}
|
|
279
|
+
function isOverflowElement(element) {
|
|
280
|
+
const {
|
|
281
|
+
overflow,
|
|
282
|
+
overflowX,
|
|
283
|
+
overflowY,
|
|
284
|
+
display
|
|
285
|
+
} = getComputedStyle(element);
|
|
286
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
287
|
+
}
|
|
288
|
+
function isTableElement(element) {
|
|
289
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
290
|
+
}
|
|
291
|
+
function isTopLayer(element) {
|
|
292
|
+
return [":popover-open", ":modal"].some((selector) => {
|
|
293
|
+
try {
|
|
294
|
+
return element.matches(selector);
|
|
295
|
+
} catch (e) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
function isContainingBlock(elementOrCss) {
|
|
301
|
+
const webkit = isWebKit();
|
|
302
|
+
const css2 = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
303
|
+
return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css2[value] ? css2[value] !== "none" : false) || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
|
|
304
|
+
}
|
|
305
|
+
function getContainingBlock(element) {
|
|
306
|
+
let currentNode = getParentNode(element);
|
|
307
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
308
|
+
if (isContainingBlock(currentNode)) {
|
|
309
|
+
return currentNode;
|
|
310
|
+
} else if (isTopLayer(currentNode)) {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
currentNode = getParentNode(currentNode);
|
|
314
|
+
}
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
function isWebKit() {
|
|
318
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
319
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
320
|
+
}
|
|
321
|
+
function isLastTraversableNode(node) {
|
|
322
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
323
|
+
}
|
|
324
|
+
function getComputedStyle(element) {
|
|
325
|
+
return getWindow(element).getComputedStyle(element);
|
|
326
|
+
}
|
|
327
|
+
function getNodeScroll(element) {
|
|
328
|
+
if (isElement(element)) {
|
|
329
|
+
return {
|
|
330
|
+
scrollLeft: element.scrollLeft,
|
|
331
|
+
scrollTop: element.scrollTop
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
scrollLeft: element.scrollX,
|
|
336
|
+
scrollTop: element.scrollY
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function getParentNode(node) {
|
|
340
|
+
if (getNodeName(node) === "html") {
|
|
341
|
+
return node;
|
|
342
|
+
}
|
|
343
|
+
const result = (
|
|
344
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
345
|
+
node.assignedSlot || // DOM Element detected.
|
|
346
|
+
node.parentNode || // ShadowRoot detected.
|
|
347
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
348
|
+
getDocumentElement(node)
|
|
349
|
+
);
|
|
350
|
+
return isShadowRoot(result) ? result.host : result;
|
|
351
|
+
}
|
|
352
|
+
function getNearestOverflowAncestor(node) {
|
|
353
|
+
const parentNode = getParentNode(node);
|
|
354
|
+
if (isLastTraversableNode(parentNode)) {
|
|
355
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
356
|
+
}
|
|
357
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
358
|
+
return parentNode;
|
|
359
|
+
}
|
|
360
|
+
return getNearestOverflowAncestor(parentNode);
|
|
361
|
+
}
|
|
362
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
363
|
+
var _node$ownerDocument2;
|
|
364
|
+
if (list === void 0) {
|
|
365
|
+
list = [];
|
|
366
|
+
}
|
|
367
|
+
if (traverseIframes === void 0) {
|
|
368
|
+
traverseIframes = true;
|
|
369
|
+
}
|
|
370
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
371
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
372
|
+
const win = getWindow(scrollableAncestor);
|
|
373
|
+
if (isBody) {
|
|
374
|
+
const frameElement = getFrameElement(win);
|
|
375
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
376
|
+
}
|
|
377
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
378
|
+
}
|
|
379
|
+
function getFrameElement(win) {
|
|
380
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
381
|
+
}
|
|
382
|
+
const min = Math.min;
|
|
383
|
+
const max = Math.max;
|
|
384
|
+
const round = Math.round;
|
|
385
|
+
const floor = Math.floor;
|
|
386
|
+
const createCoords = (v) => ({
|
|
387
|
+
x: v,
|
|
388
|
+
y: v
|
|
389
|
+
});
|
|
390
|
+
const oppositeSideMap = {
|
|
391
|
+
left: "right",
|
|
392
|
+
right: "left",
|
|
393
|
+
bottom: "top",
|
|
394
|
+
top: "bottom"
|
|
395
|
+
};
|
|
396
|
+
const oppositeAlignmentMap = {
|
|
397
|
+
start: "end",
|
|
398
|
+
end: "start"
|
|
399
|
+
};
|
|
400
|
+
function clamp(start, value, end) {
|
|
401
|
+
return max(start, min(value, end));
|
|
402
|
+
}
|
|
403
|
+
function evaluate(value, param) {
|
|
404
|
+
return typeof value === "function" ? value(param) : value;
|
|
405
|
+
}
|
|
406
|
+
function getSide(placement) {
|
|
407
|
+
return placement.split("-")[0];
|
|
408
|
+
}
|
|
409
|
+
function getAlignment(placement) {
|
|
410
|
+
return placement.split("-")[1];
|
|
411
|
+
}
|
|
412
|
+
function getOppositeAxis(axis) {
|
|
413
|
+
return axis === "x" ? "y" : "x";
|
|
414
|
+
}
|
|
415
|
+
function getAxisLength(axis) {
|
|
416
|
+
return axis === "y" ? "height" : "width";
|
|
417
|
+
}
|
|
418
|
+
function getSideAxis(placement) {
|
|
419
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
420
|
+
}
|
|
421
|
+
function getAlignmentAxis(placement) {
|
|
422
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
423
|
+
}
|
|
424
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
425
|
+
if (rtl === void 0) {
|
|
426
|
+
rtl = false;
|
|
427
|
+
}
|
|
428
|
+
const alignment = getAlignment(placement);
|
|
429
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
430
|
+
const length = getAxisLength(alignmentAxis);
|
|
431
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
432
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
433
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
434
|
+
}
|
|
435
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
436
|
+
}
|
|
437
|
+
function getExpandedPlacements(placement) {
|
|
438
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
439
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
440
|
+
}
|
|
441
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
442
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
443
|
+
}
|
|
444
|
+
function getSideList(side, isStart, rtl) {
|
|
445
|
+
const lr = ["left", "right"];
|
|
446
|
+
const rl = ["right", "left"];
|
|
447
|
+
const tb = ["top", "bottom"];
|
|
448
|
+
const bt = ["bottom", "top"];
|
|
449
|
+
switch (side) {
|
|
450
|
+
case "top":
|
|
451
|
+
case "bottom":
|
|
452
|
+
if (rtl) return isStart ? rl : lr;
|
|
453
|
+
return isStart ? lr : rl;
|
|
454
|
+
case "left":
|
|
455
|
+
case "right":
|
|
456
|
+
return isStart ? tb : bt;
|
|
457
|
+
default:
|
|
458
|
+
return [];
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
462
|
+
const alignment = getAlignment(placement);
|
|
463
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
464
|
+
if (alignment) {
|
|
465
|
+
list = list.map((side) => side + "-" + alignment);
|
|
466
|
+
if (flipAlignment) {
|
|
467
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return list;
|
|
471
|
+
}
|
|
472
|
+
function getOppositePlacement(placement) {
|
|
473
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
474
|
+
}
|
|
475
|
+
function expandPaddingObject(padding) {
|
|
476
|
+
return {
|
|
477
|
+
top: 0,
|
|
478
|
+
right: 0,
|
|
479
|
+
bottom: 0,
|
|
480
|
+
left: 0,
|
|
481
|
+
...padding
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
function getPaddingObject(padding) {
|
|
485
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
486
|
+
top: padding,
|
|
487
|
+
right: padding,
|
|
488
|
+
bottom: padding,
|
|
489
|
+
left: padding
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function rectToClientRect(rect) {
|
|
493
|
+
const {
|
|
494
|
+
x,
|
|
495
|
+
y,
|
|
496
|
+
width,
|
|
497
|
+
height
|
|
498
|
+
} = rect;
|
|
499
|
+
return {
|
|
500
|
+
width,
|
|
501
|
+
height,
|
|
502
|
+
top: y,
|
|
503
|
+
left: x,
|
|
504
|
+
right: x + width,
|
|
505
|
+
bottom: y + height,
|
|
506
|
+
x,
|
|
507
|
+
y
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
var isClient$1 = typeof document !== "undefined";
|
|
511
|
+
var noop$1 = function noop() {
|
|
512
|
+
};
|
|
513
|
+
var index$1 = isClient$1 ? useLayoutEffect : noop$1;
|
|
514
|
+
const SafeReact$1 = {
|
|
515
|
+
...React
|
|
516
|
+
};
|
|
517
|
+
const useInsertionEffect = SafeReact$1.useInsertionEffect;
|
|
518
|
+
const useSafeInsertionEffect = useInsertionEffect || ((fn) => fn());
|
|
519
|
+
function useEffectEvent(callback) {
|
|
520
|
+
const ref = React.useRef(() => {
|
|
521
|
+
if (process.env.NODE_ENV !== "production") {
|
|
522
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
useSafeInsertionEffect(() => {
|
|
526
|
+
ref.current = callback;
|
|
527
|
+
});
|
|
528
|
+
return React.useCallback(function() {
|
|
529
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
530
|
+
args[_key] = arguments[_key];
|
|
531
|
+
}
|
|
532
|
+
return ref.current == null ? void 0 : ref.current(...args);
|
|
533
|
+
}, []);
|
|
534
|
+
}
|
|
535
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
536
|
+
let {
|
|
537
|
+
reference,
|
|
538
|
+
floating
|
|
539
|
+
} = _ref;
|
|
540
|
+
const sideAxis = getSideAxis(placement);
|
|
541
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
542
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
543
|
+
const side = getSide(placement);
|
|
544
|
+
const isVertical = sideAxis === "y";
|
|
545
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
546
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
547
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
548
|
+
let coords;
|
|
549
|
+
switch (side) {
|
|
550
|
+
case "top":
|
|
551
|
+
coords = {
|
|
552
|
+
x: commonX,
|
|
553
|
+
y: reference.y - floating.height
|
|
554
|
+
};
|
|
555
|
+
break;
|
|
556
|
+
case "bottom":
|
|
557
|
+
coords = {
|
|
558
|
+
x: commonX,
|
|
559
|
+
y: reference.y + reference.height
|
|
560
|
+
};
|
|
561
|
+
break;
|
|
562
|
+
case "right":
|
|
563
|
+
coords = {
|
|
564
|
+
x: reference.x + reference.width,
|
|
565
|
+
y: commonY
|
|
566
|
+
};
|
|
567
|
+
break;
|
|
568
|
+
case "left":
|
|
569
|
+
coords = {
|
|
570
|
+
x: reference.x - floating.width,
|
|
571
|
+
y: commonY
|
|
572
|
+
};
|
|
573
|
+
break;
|
|
574
|
+
default:
|
|
575
|
+
coords = {
|
|
576
|
+
x: reference.x,
|
|
577
|
+
y: reference.y
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
switch (getAlignment(placement)) {
|
|
581
|
+
case "start":
|
|
582
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
583
|
+
break;
|
|
584
|
+
case "end":
|
|
585
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
return coords;
|
|
589
|
+
}
|
|
590
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
591
|
+
const {
|
|
592
|
+
placement = "bottom",
|
|
593
|
+
strategy = "absolute",
|
|
594
|
+
middleware = [],
|
|
595
|
+
platform: platform2
|
|
596
|
+
} = config;
|
|
597
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
598
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
599
|
+
let rects = await platform2.getElementRects({
|
|
600
|
+
reference,
|
|
601
|
+
floating,
|
|
602
|
+
strategy
|
|
603
|
+
});
|
|
604
|
+
let {
|
|
605
|
+
x,
|
|
606
|
+
y
|
|
607
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
608
|
+
let statefulPlacement = placement;
|
|
609
|
+
let middlewareData = {};
|
|
610
|
+
let resetCount = 0;
|
|
611
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
612
|
+
const {
|
|
613
|
+
name,
|
|
614
|
+
fn
|
|
615
|
+
} = validMiddleware[i];
|
|
616
|
+
const {
|
|
617
|
+
x: nextX,
|
|
618
|
+
y: nextY,
|
|
619
|
+
data,
|
|
620
|
+
reset
|
|
621
|
+
} = await fn({
|
|
622
|
+
x,
|
|
623
|
+
y,
|
|
624
|
+
initialPlacement: placement,
|
|
625
|
+
placement: statefulPlacement,
|
|
626
|
+
strategy,
|
|
627
|
+
middlewareData,
|
|
628
|
+
rects,
|
|
629
|
+
platform: platform2,
|
|
630
|
+
elements: {
|
|
631
|
+
reference,
|
|
632
|
+
floating
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
x = nextX != null ? nextX : x;
|
|
636
|
+
y = nextY != null ? nextY : y;
|
|
637
|
+
middlewareData = {
|
|
638
|
+
...middlewareData,
|
|
639
|
+
[name]: {
|
|
640
|
+
...middlewareData[name],
|
|
641
|
+
...data
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
if (reset && resetCount <= 50) {
|
|
645
|
+
resetCount++;
|
|
646
|
+
if (typeof reset === "object") {
|
|
647
|
+
if (reset.placement) {
|
|
648
|
+
statefulPlacement = reset.placement;
|
|
649
|
+
}
|
|
650
|
+
if (reset.rects) {
|
|
651
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
652
|
+
reference,
|
|
653
|
+
floating,
|
|
654
|
+
strategy
|
|
655
|
+
}) : reset.rects;
|
|
656
|
+
}
|
|
657
|
+
({
|
|
658
|
+
x,
|
|
659
|
+
y
|
|
660
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
661
|
+
}
|
|
662
|
+
i = -1;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
x,
|
|
667
|
+
y,
|
|
668
|
+
placement: statefulPlacement,
|
|
669
|
+
strategy,
|
|
670
|
+
middlewareData
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
async function detectOverflow(state, options) {
|
|
674
|
+
var _await$platform$isEle;
|
|
675
|
+
if (options === void 0) {
|
|
676
|
+
options = {};
|
|
677
|
+
}
|
|
678
|
+
const {
|
|
679
|
+
x,
|
|
680
|
+
y,
|
|
681
|
+
platform: platform2,
|
|
682
|
+
rects,
|
|
683
|
+
elements,
|
|
684
|
+
strategy
|
|
685
|
+
} = state;
|
|
686
|
+
const {
|
|
687
|
+
boundary = "clippingAncestors",
|
|
688
|
+
rootBoundary = "viewport",
|
|
689
|
+
elementContext = "floating",
|
|
690
|
+
altBoundary = false,
|
|
691
|
+
padding = 0
|
|
692
|
+
} = evaluate(options, state);
|
|
693
|
+
const paddingObject = getPaddingObject(padding);
|
|
694
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
695
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
696
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
697
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
698
|
+
boundary,
|
|
699
|
+
rootBoundary,
|
|
700
|
+
strategy
|
|
701
|
+
}));
|
|
702
|
+
const rect = elementContext === "floating" ? {
|
|
703
|
+
x,
|
|
704
|
+
y,
|
|
705
|
+
width: rects.floating.width,
|
|
706
|
+
height: rects.floating.height
|
|
707
|
+
} : rects.reference;
|
|
708
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
709
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
710
|
+
x: 1,
|
|
711
|
+
y: 1
|
|
712
|
+
} : {
|
|
713
|
+
x: 1,
|
|
714
|
+
y: 1
|
|
715
|
+
};
|
|
716
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
717
|
+
elements,
|
|
718
|
+
rect,
|
|
719
|
+
offsetParent,
|
|
720
|
+
strategy
|
|
721
|
+
}) : rect);
|
|
722
|
+
return {
|
|
723
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
724
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
725
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
726
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
const flip$2 = function(options) {
|
|
730
|
+
if (options === void 0) {
|
|
731
|
+
options = {};
|
|
732
|
+
}
|
|
733
|
+
return {
|
|
734
|
+
name: "flip",
|
|
735
|
+
options,
|
|
736
|
+
async fn(state) {
|
|
737
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
738
|
+
const {
|
|
739
|
+
placement,
|
|
740
|
+
middlewareData,
|
|
741
|
+
rects,
|
|
742
|
+
initialPlacement,
|
|
743
|
+
platform: platform2,
|
|
744
|
+
elements
|
|
745
|
+
} = state;
|
|
746
|
+
const {
|
|
747
|
+
mainAxis: checkMainAxis = true,
|
|
748
|
+
crossAxis: checkCrossAxis = true,
|
|
749
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
750
|
+
fallbackStrategy = "bestFit",
|
|
751
|
+
fallbackAxisSideDirection = "none",
|
|
752
|
+
flipAlignment = true,
|
|
753
|
+
...detectOverflowOptions
|
|
754
|
+
} = evaluate(options, state);
|
|
755
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
756
|
+
return {};
|
|
757
|
+
}
|
|
758
|
+
const side = getSide(placement);
|
|
759
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
760
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
761
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
762
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
763
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
764
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
765
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
766
|
+
}
|
|
767
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
768
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
769
|
+
const overflows = [];
|
|
770
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
771
|
+
if (checkMainAxis) {
|
|
772
|
+
overflows.push(overflow[side]);
|
|
773
|
+
}
|
|
774
|
+
if (checkCrossAxis) {
|
|
775
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
776
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
777
|
+
}
|
|
778
|
+
overflowsData = [...overflowsData, {
|
|
779
|
+
placement,
|
|
780
|
+
overflows
|
|
781
|
+
}];
|
|
782
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
783
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
784
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
785
|
+
const nextPlacement = placements[nextIndex];
|
|
786
|
+
if (nextPlacement) {
|
|
787
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
788
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
789
|
+
// overflows the main axis.
|
|
790
|
+
overflowsData.every((d) => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
|
|
791
|
+
return {
|
|
792
|
+
data: {
|
|
793
|
+
index: nextIndex,
|
|
794
|
+
overflows: overflowsData
|
|
795
|
+
},
|
|
796
|
+
reset: {
|
|
797
|
+
placement: nextPlacement
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
803
|
+
if (!resetPlacement) {
|
|
804
|
+
switch (fallbackStrategy) {
|
|
805
|
+
case "bestFit": {
|
|
806
|
+
var _overflowsData$filter2;
|
|
807
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
808
|
+
if (hasFallbackAxisSideDirection) {
|
|
809
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
810
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
811
|
+
// reading directions favoring greater width.
|
|
812
|
+
currentSideAxis === "y";
|
|
813
|
+
}
|
|
814
|
+
return true;
|
|
815
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
816
|
+
if (placement2) {
|
|
817
|
+
resetPlacement = placement2;
|
|
818
|
+
}
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
case "initialPlacement":
|
|
822
|
+
resetPlacement = initialPlacement;
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if (placement !== resetPlacement) {
|
|
827
|
+
return {
|
|
828
|
+
reset: {
|
|
829
|
+
placement: resetPlacement
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
return {};
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
};
|
|
838
|
+
async function convertValueToCoords(state, options) {
|
|
839
|
+
const {
|
|
840
|
+
placement,
|
|
841
|
+
platform: platform2,
|
|
842
|
+
elements
|
|
843
|
+
} = state;
|
|
844
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
845
|
+
const side = getSide(placement);
|
|
846
|
+
const alignment = getAlignment(placement);
|
|
847
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
848
|
+
const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
|
|
849
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
850
|
+
const rawValue = evaluate(options, state);
|
|
851
|
+
let {
|
|
852
|
+
mainAxis,
|
|
853
|
+
crossAxis,
|
|
854
|
+
alignmentAxis
|
|
855
|
+
} = typeof rawValue === "number" ? {
|
|
856
|
+
mainAxis: rawValue,
|
|
857
|
+
crossAxis: 0,
|
|
858
|
+
alignmentAxis: null
|
|
859
|
+
} : {
|
|
860
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
861
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
862
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
863
|
+
};
|
|
864
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
865
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
866
|
+
}
|
|
867
|
+
return isVertical ? {
|
|
868
|
+
x: crossAxis * crossAxisMulti,
|
|
869
|
+
y: mainAxis * mainAxisMulti
|
|
870
|
+
} : {
|
|
871
|
+
x: mainAxis * mainAxisMulti,
|
|
872
|
+
y: crossAxis * crossAxisMulti
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
const offset$2 = function(options) {
|
|
876
|
+
if (options === void 0) {
|
|
877
|
+
options = 0;
|
|
878
|
+
}
|
|
879
|
+
return {
|
|
880
|
+
name: "offset",
|
|
881
|
+
options,
|
|
882
|
+
async fn(state) {
|
|
883
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
884
|
+
const {
|
|
885
|
+
x,
|
|
886
|
+
y,
|
|
887
|
+
placement,
|
|
888
|
+
middlewareData
|
|
889
|
+
} = state;
|
|
890
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
891
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
892
|
+
return {};
|
|
893
|
+
}
|
|
894
|
+
return {
|
|
895
|
+
x: x + diffCoords.x,
|
|
896
|
+
y: y + diffCoords.y,
|
|
897
|
+
data: {
|
|
898
|
+
...diffCoords,
|
|
899
|
+
placement
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
const shift$2 = function(options) {
|
|
906
|
+
if (options === void 0) {
|
|
907
|
+
options = {};
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
name: "shift",
|
|
911
|
+
options,
|
|
912
|
+
async fn(state) {
|
|
913
|
+
const {
|
|
914
|
+
x,
|
|
915
|
+
y,
|
|
916
|
+
placement
|
|
917
|
+
} = state;
|
|
918
|
+
const {
|
|
919
|
+
mainAxis: checkMainAxis = true,
|
|
920
|
+
crossAxis: checkCrossAxis = false,
|
|
921
|
+
limiter = {
|
|
922
|
+
fn: (_ref) => {
|
|
923
|
+
let {
|
|
924
|
+
x: x2,
|
|
925
|
+
y: y2
|
|
926
|
+
} = _ref;
|
|
927
|
+
return {
|
|
928
|
+
x: x2,
|
|
929
|
+
y: y2
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
},
|
|
933
|
+
...detectOverflowOptions
|
|
934
|
+
} = evaluate(options, state);
|
|
935
|
+
const coords = {
|
|
936
|
+
x,
|
|
937
|
+
y
|
|
938
|
+
};
|
|
939
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
940
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
941
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
942
|
+
let mainAxisCoord = coords[mainAxis];
|
|
943
|
+
let crossAxisCoord = coords[crossAxis];
|
|
944
|
+
if (checkMainAxis) {
|
|
945
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
946
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
947
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
948
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
949
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
950
|
+
}
|
|
951
|
+
if (checkCrossAxis) {
|
|
952
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
953
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
954
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
955
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
956
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
957
|
+
}
|
|
958
|
+
const limitedCoords = limiter.fn({
|
|
959
|
+
...state,
|
|
960
|
+
[mainAxis]: mainAxisCoord,
|
|
961
|
+
[crossAxis]: crossAxisCoord
|
|
962
|
+
});
|
|
963
|
+
return {
|
|
964
|
+
...limitedCoords,
|
|
965
|
+
data: {
|
|
966
|
+
x: limitedCoords.x - x,
|
|
967
|
+
y: limitedCoords.y - y,
|
|
968
|
+
enabled: {
|
|
969
|
+
[mainAxis]: checkMainAxis,
|
|
970
|
+
[crossAxis]: checkCrossAxis
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
function getCssDimensions(element) {
|
|
978
|
+
const css2 = getComputedStyle(element);
|
|
979
|
+
let width = parseFloat(css2.width) || 0;
|
|
980
|
+
let height = parseFloat(css2.height) || 0;
|
|
981
|
+
const hasOffset = isHTMLElement(element);
|
|
982
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
983
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
984
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
985
|
+
if (shouldFallback) {
|
|
986
|
+
width = offsetWidth;
|
|
987
|
+
height = offsetHeight;
|
|
988
|
+
}
|
|
989
|
+
return {
|
|
990
|
+
width,
|
|
991
|
+
height,
|
|
992
|
+
$: shouldFallback
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function unwrapElement(element) {
|
|
996
|
+
return !isElement(element) ? element.contextElement : element;
|
|
997
|
+
}
|
|
998
|
+
function getScale(element) {
|
|
999
|
+
const domElement = unwrapElement(element);
|
|
1000
|
+
if (!isHTMLElement(domElement)) {
|
|
1001
|
+
return createCoords(1);
|
|
1002
|
+
}
|
|
1003
|
+
const rect = domElement.getBoundingClientRect();
|
|
1004
|
+
const {
|
|
1005
|
+
width,
|
|
1006
|
+
height,
|
|
1007
|
+
$
|
|
1008
|
+
} = getCssDimensions(domElement);
|
|
1009
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1010
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1011
|
+
if (!x || !Number.isFinite(x)) {
|
|
1012
|
+
x = 1;
|
|
1013
|
+
}
|
|
1014
|
+
if (!y || !Number.isFinite(y)) {
|
|
1015
|
+
y = 1;
|
|
1016
|
+
}
|
|
1017
|
+
return {
|
|
1018
|
+
x,
|
|
1019
|
+
y
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
1023
|
+
function getVisualOffsets(element) {
|
|
1024
|
+
const win = getWindow(element);
|
|
1025
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
1026
|
+
return noOffsets;
|
|
1027
|
+
}
|
|
1028
|
+
return {
|
|
1029
|
+
x: win.visualViewport.offsetLeft,
|
|
1030
|
+
y: win.visualViewport.offsetTop
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1034
|
+
if (isFixed === void 0) {
|
|
1035
|
+
isFixed = false;
|
|
1036
|
+
}
|
|
1037
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
return isFixed;
|
|
1041
|
+
}
|
|
1042
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1043
|
+
if (includeScale === void 0) {
|
|
1044
|
+
includeScale = false;
|
|
1045
|
+
}
|
|
1046
|
+
if (isFixedStrategy === void 0) {
|
|
1047
|
+
isFixedStrategy = false;
|
|
1048
|
+
}
|
|
1049
|
+
const clientRect = element.getBoundingClientRect();
|
|
1050
|
+
const domElement = unwrapElement(element);
|
|
1051
|
+
let scale = createCoords(1);
|
|
1052
|
+
if (includeScale) {
|
|
1053
|
+
if (offsetParent) {
|
|
1054
|
+
if (isElement(offsetParent)) {
|
|
1055
|
+
scale = getScale(offsetParent);
|
|
1056
|
+
}
|
|
1057
|
+
} else {
|
|
1058
|
+
scale = getScale(element);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1062
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1063
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1064
|
+
let width = clientRect.width / scale.x;
|
|
1065
|
+
let height = clientRect.height / scale.y;
|
|
1066
|
+
if (domElement) {
|
|
1067
|
+
const win = getWindow(domElement);
|
|
1068
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1069
|
+
let currentWin = win;
|
|
1070
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1071
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1072
|
+
const iframeScale = getScale(currentIFrame);
|
|
1073
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1074
|
+
const css2 = getComputedStyle(currentIFrame);
|
|
1075
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x;
|
|
1076
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
|
|
1077
|
+
x *= iframeScale.x;
|
|
1078
|
+
y *= iframeScale.y;
|
|
1079
|
+
width *= iframeScale.x;
|
|
1080
|
+
height *= iframeScale.y;
|
|
1081
|
+
x += left;
|
|
1082
|
+
y += top;
|
|
1083
|
+
currentWin = getWindow(currentIFrame);
|
|
1084
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return rectToClientRect({
|
|
1088
|
+
width,
|
|
1089
|
+
height,
|
|
1090
|
+
x,
|
|
1091
|
+
y
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
function getWindowScrollBarX(element, rect) {
|
|
1095
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1096
|
+
if (!rect) {
|
|
1097
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1098
|
+
}
|
|
1099
|
+
return rect.left + leftScroll;
|
|
1100
|
+
}
|
|
1101
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
1102
|
+
if (ignoreScrollbarX === void 0) {
|
|
1103
|
+
ignoreScrollbarX = false;
|
|
1104
|
+
}
|
|
1105
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1106
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
|
|
1107
|
+
// RTL <body> scrollbar.
|
|
1108
|
+
getWindowScrollBarX(documentElement, htmlRect)
|
|
1109
|
+
));
|
|
1110
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1111
|
+
return {
|
|
1112
|
+
x,
|
|
1113
|
+
y
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1117
|
+
let {
|
|
1118
|
+
elements,
|
|
1119
|
+
rect,
|
|
1120
|
+
offsetParent,
|
|
1121
|
+
strategy
|
|
1122
|
+
} = _ref;
|
|
1123
|
+
const isFixed = strategy === "fixed";
|
|
1124
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1125
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1126
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1127
|
+
return rect;
|
|
1128
|
+
}
|
|
1129
|
+
let scroll = {
|
|
1130
|
+
scrollLeft: 0,
|
|
1131
|
+
scrollTop: 0
|
|
1132
|
+
};
|
|
1133
|
+
let scale = createCoords(1);
|
|
1134
|
+
const offsets = createCoords(0);
|
|
1135
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1136
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1137
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1138
|
+
scroll = getNodeScroll(offsetParent);
|
|
1139
|
+
}
|
|
1140
|
+
if (isHTMLElement(offsetParent)) {
|
|
1141
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1142
|
+
scale = getScale(offsetParent);
|
|
1143
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1144
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
1148
|
+
return {
|
|
1149
|
+
width: rect.width * scale.x,
|
|
1150
|
+
height: rect.height * scale.y,
|
|
1151
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1152
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
function getClientRects(element) {
|
|
1156
|
+
return Array.from(element.getClientRects());
|
|
1157
|
+
}
|
|
1158
|
+
function getDocumentRect(element) {
|
|
1159
|
+
const html = getDocumentElement(element);
|
|
1160
|
+
const scroll = getNodeScroll(element);
|
|
1161
|
+
const body = element.ownerDocument.body;
|
|
1162
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1163
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1164
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1165
|
+
const y = -scroll.scrollTop;
|
|
1166
|
+
if (getComputedStyle(body).direction === "rtl") {
|
|
1167
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1168
|
+
}
|
|
1169
|
+
return {
|
|
1170
|
+
width,
|
|
1171
|
+
height,
|
|
1172
|
+
x,
|
|
1173
|
+
y
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
function getViewportRect(element, strategy) {
|
|
1177
|
+
const win = getWindow(element);
|
|
1178
|
+
const html = getDocumentElement(element);
|
|
1179
|
+
const visualViewport = win.visualViewport;
|
|
1180
|
+
let width = html.clientWidth;
|
|
1181
|
+
let height = html.clientHeight;
|
|
1182
|
+
let x = 0;
|
|
1183
|
+
let y = 0;
|
|
1184
|
+
if (visualViewport) {
|
|
1185
|
+
width = visualViewport.width;
|
|
1186
|
+
height = visualViewport.height;
|
|
1187
|
+
const visualViewportBased = isWebKit();
|
|
1188
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1189
|
+
x = visualViewport.offsetLeft;
|
|
1190
|
+
y = visualViewport.offsetTop;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
return {
|
|
1194
|
+
width,
|
|
1195
|
+
height,
|
|
1196
|
+
x,
|
|
1197
|
+
y
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1201
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1202
|
+
const top = clientRect.top + element.clientTop;
|
|
1203
|
+
const left = clientRect.left + element.clientLeft;
|
|
1204
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1205
|
+
const width = element.clientWidth * scale.x;
|
|
1206
|
+
const height = element.clientHeight * scale.y;
|
|
1207
|
+
const x = left * scale.x;
|
|
1208
|
+
const y = top * scale.y;
|
|
1209
|
+
return {
|
|
1210
|
+
width,
|
|
1211
|
+
height,
|
|
1212
|
+
x,
|
|
1213
|
+
y
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1217
|
+
let rect;
|
|
1218
|
+
if (clippingAncestor === "viewport") {
|
|
1219
|
+
rect = getViewportRect(element, strategy);
|
|
1220
|
+
} else if (clippingAncestor === "document") {
|
|
1221
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1222
|
+
} else if (isElement(clippingAncestor)) {
|
|
1223
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1224
|
+
} else {
|
|
1225
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1226
|
+
rect = {
|
|
1227
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1228
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1229
|
+
width: clippingAncestor.width,
|
|
1230
|
+
height: clippingAncestor.height
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
return rectToClientRect(rect);
|
|
1234
|
+
}
|
|
1235
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1236
|
+
const parentNode = getParentNode(element);
|
|
1237
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1238
|
+
return false;
|
|
1239
|
+
}
|
|
1240
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1241
|
+
}
|
|
1242
|
+
function getClippingElementAncestors(element, cache) {
|
|
1243
|
+
const cachedResult = cache.get(element);
|
|
1244
|
+
if (cachedResult) {
|
|
1245
|
+
return cachedResult;
|
|
1246
|
+
}
|
|
1247
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1248
|
+
let currentContainingBlockComputedStyle = null;
|
|
1249
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
1250
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1251
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1252
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
1253
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1254
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1255
|
+
currentContainingBlockComputedStyle = null;
|
|
1256
|
+
}
|
|
1257
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1258
|
+
if (shouldDropCurrentNode) {
|
|
1259
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1260
|
+
} else {
|
|
1261
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1262
|
+
}
|
|
1263
|
+
currentNode = getParentNode(currentNode);
|
|
1264
|
+
}
|
|
1265
|
+
cache.set(element, result);
|
|
1266
|
+
return result;
|
|
1267
|
+
}
|
|
1268
|
+
function getClippingRect(_ref) {
|
|
1269
|
+
let {
|
|
1270
|
+
element,
|
|
1271
|
+
boundary,
|
|
1272
|
+
rootBoundary,
|
|
1273
|
+
strategy
|
|
1274
|
+
} = _ref;
|
|
1275
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1276
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1277
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
1278
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1279
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1280
|
+
accRect.top = max(rect.top, accRect.top);
|
|
1281
|
+
accRect.right = min(rect.right, accRect.right);
|
|
1282
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1283
|
+
accRect.left = max(rect.left, accRect.left);
|
|
1284
|
+
return accRect;
|
|
1285
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1286
|
+
return {
|
|
1287
|
+
width: clippingRect.right - clippingRect.left,
|
|
1288
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
1289
|
+
x: clippingRect.left,
|
|
1290
|
+
y: clippingRect.top
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
function getDimensions(element) {
|
|
1294
|
+
const {
|
|
1295
|
+
width,
|
|
1296
|
+
height
|
|
1297
|
+
} = getCssDimensions(element);
|
|
1298
|
+
return {
|
|
1299
|
+
width,
|
|
1300
|
+
height
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1304
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1305
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1306
|
+
const isFixed = strategy === "fixed";
|
|
1307
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1308
|
+
let scroll = {
|
|
1309
|
+
scrollLeft: 0,
|
|
1310
|
+
scrollTop: 0
|
|
1311
|
+
};
|
|
1312
|
+
const offsets = createCoords(0);
|
|
1313
|
+
function setLeftRTLScrollbarOffset() {
|
|
1314
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1315
|
+
}
|
|
1316
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1317
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1318
|
+
scroll = getNodeScroll(offsetParent);
|
|
1319
|
+
}
|
|
1320
|
+
if (isOffsetParentAnElement) {
|
|
1321
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1322
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1323
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1324
|
+
} else if (documentElement) {
|
|
1325
|
+
setLeftRTLScrollbarOffset();
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1329
|
+
setLeftRTLScrollbarOffset();
|
|
1330
|
+
}
|
|
1331
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1332
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1333
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1334
|
+
return {
|
|
1335
|
+
x,
|
|
1336
|
+
y,
|
|
1337
|
+
width: rect.width,
|
|
1338
|
+
height: rect.height
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
function isStaticPositioned(element) {
|
|
1342
|
+
return getComputedStyle(element).position === "static";
|
|
1343
|
+
}
|
|
1344
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1345
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
1346
|
+
return null;
|
|
1347
|
+
}
|
|
1348
|
+
if (polyfill) {
|
|
1349
|
+
return polyfill(element);
|
|
1350
|
+
}
|
|
1351
|
+
let rawOffsetParent = element.offsetParent;
|
|
1352
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1353
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1354
|
+
}
|
|
1355
|
+
return rawOffsetParent;
|
|
1356
|
+
}
|
|
1357
|
+
function getOffsetParent(element, polyfill) {
|
|
1358
|
+
const win = getWindow(element);
|
|
1359
|
+
if (isTopLayer(element)) {
|
|
1360
|
+
return win;
|
|
1361
|
+
}
|
|
1362
|
+
if (!isHTMLElement(element)) {
|
|
1363
|
+
let svgOffsetParent = getParentNode(element);
|
|
1364
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1365
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1366
|
+
return svgOffsetParent;
|
|
1367
|
+
}
|
|
1368
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1369
|
+
}
|
|
1370
|
+
return win;
|
|
1371
|
+
}
|
|
1372
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1373
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1374
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1375
|
+
}
|
|
1376
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1377
|
+
return win;
|
|
1378
|
+
}
|
|
1379
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1380
|
+
}
|
|
1381
|
+
const getElementRects = async function(data) {
|
|
1382
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1383
|
+
const getDimensionsFn = this.getDimensions;
|
|
1384
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1385
|
+
return {
|
|
1386
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1387
|
+
floating: {
|
|
1388
|
+
x: 0,
|
|
1389
|
+
y: 0,
|
|
1390
|
+
width: floatingDimensions.width,
|
|
1391
|
+
height: floatingDimensions.height
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
};
|
|
1395
|
+
function isRTL(element) {
|
|
1396
|
+
return getComputedStyle(element).direction === "rtl";
|
|
1397
|
+
}
|
|
1398
|
+
const platform = {
|
|
1399
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1400
|
+
getDocumentElement,
|
|
1401
|
+
getClippingRect,
|
|
1402
|
+
getOffsetParent,
|
|
1403
|
+
getElementRects,
|
|
1404
|
+
getClientRects,
|
|
1405
|
+
getDimensions,
|
|
1406
|
+
getScale,
|
|
1407
|
+
isElement,
|
|
1408
|
+
isRTL
|
|
1409
|
+
};
|
|
1410
|
+
function rectsAreEqual(a, b) {
|
|
1411
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1412
|
+
}
|
|
1413
|
+
function observeMove(element, onMove) {
|
|
1414
|
+
let io = null;
|
|
1415
|
+
let timeoutId;
|
|
1416
|
+
const root = getDocumentElement(element);
|
|
1417
|
+
function cleanup() {
|
|
1418
|
+
var _io;
|
|
1419
|
+
clearTimeout(timeoutId);
|
|
1420
|
+
(_io = io) == null || _io.disconnect();
|
|
1421
|
+
io = null;
|
|
1422
|
+
}
|
|
1423
|
+
function refresh(skip, threshold) {
|
|
1424
|
+
if (skip === void 0) {
|
|
1425
|
+
skip = false;
|
|
1426
|
+
}
|
|
1427
|
+
if (threshold === void 0) {
|
|
1428
|
+
threshold = 1;
|
|
1429
|
+
}
|
|
1430
|
+
cleanup();
|
|
1431
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1432
|
+
const {
|
|
1433
|
+
left,
|
|
1434
|
+
top,
|
|
1435
|
+
width,
|
|
1436
|
+
height
|
|
1437
|
+
} = elementRectForRootMargin;
|
|
1438
|
+
if (!skip) {
|
|
1439
|
+
onMove();
|
|
1440
|
+
}
|
|
1441
|
+
if (!width || !height) {
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
const insetTop = floor(top);
|
|
1445
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
1446
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1447
|
+
const insetLeft = floor(left);
|
|
1448
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1449
|
+
const options = {
|
|
1450
|
+
rootMargin,
|
|
1451
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
1452
|
+
};
|
|
1453
|
+
let isFirstUpdate = true;
|
|
1454
|
+
function handleObserve(entries) {
|
|
1455
|
+
const ratio = entries[0].intersectionRatio;
|
|
1456
|
+
if (ratio !== threshold) {
|
|
1457
|
+
if (!isFirstUpdate) {
|
|
1458
|
+
return refresh();
|
|
1459
|
+
}
|
|
1460
|
+
if (!ratio) {
|
|
1461
|
+
timeoutId = setTimeout(() => {
|
|
1462
|
+
refresh(false, 1e-7);
|
|
1463
|
+
}, 1e3);
|
|
1464
|
+
} else {
|
|
1465
|
+
refresh(false, ratio);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
1469
|
+
refresh();
|
|
1470
|
+
}
|
|
1471
|
+
isFirstUpdate = false;
|
|
1472
|
+
}
|
|
1473
|
+
try {
|
|
1474
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1475
|
+
...options,
|
|
1476
|
+
// Handle <iframe>s
|
|
1477
|
+
root: root.ownerDocument
|
|
1478
|
+
});
|
|
1479
|
+
} catch (_e) {
|
|
1480
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1481
|
+
}
|
|
1482
|
+
io.observe(element);
|
|
1483
|
+
}
|
|
1484
|
+
refresh(true);
|
|
1485
|
+
return cleanup;
|
|
1486
|
+
}
|
|
1487
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1488
|
+
if (options === void 0) {
|
|
1489
|
+
options = {};
|
|
1490
|
+
}
|
|
1491
|
+
const {
|
|
1492
|
+
ancestorScroll = true,
|
|
1493
|
+
ancestorResize = true,
|
|
1494
|
+
elementResize = typeof ResizeObserver === "function",
|
|
1495
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
1496
|
+
animationFrame = false
|
|
1497
|
+
} = options;
|
|
1498
|
+
const referenceEl = unwrapElement(reference);
|
|
1499
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
1500
|
+
ancestors.forEach((ancestor) => {
|
|
1501
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
1502
|
+
passive: true
|
|
1503
|
+
});
|
|
1504
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1505
|
+
});
|
|
1506
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1507
|
+
let reobserveFrame = -1;
|
|
1508
|
+
let resizeObserver = null;
|
|
1509
|
+
if (elementResize) {
|
|
1510
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
1511
|
+
let [firstEntry] = _ref;
|
|
1512
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
1513
|
+
resizeObserver.unobserve(floating);
|
|
1514
|
+
cancelAnimationFrame(reobserveFrame);
|
|
1515
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
1516
|
+
var _resizeObserver;
|
|
1517
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
update();
|
|
1521
|
+
});
|
|
1522
|
+
if (referenceEl && !animationFrame) {
|
|
1523
|
+
resizeObserver.observe(referenceEl);
|
|
1524
|
+
}
|
|
1525
|
+
resizeObserver.observe(floating);
|
|
1526
|
+
}
|
|
1527
|
+
let frameId;
|
|
1528
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1529
|
+
if (animationFrame) {
|
|
1530
|
+
frameLoop();
|
|
1531
|
+
}
|
|
1532
|
+
function frameLoop() {
|
|
1533
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1534
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1535
|
+
update();
|
|
1536
|
+
}
|
|
1537
|
+
prevRefRect = nextRefRect;
|
|
1538
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1539
|
+
}
|
|
1540
|
+
update();
|
|
1541
|
+
return () => {
|
|
1542
|
+
var _resizeObserver2;
|
|
1543
|
+
ancestors.forEach((ancestor) => {
|
|
1544
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
1545
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
1546
|
+
});
|
|
1547
|
+
cleanupIo == null || cleanupIo();
|
|
1548
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1549
|
+
resizeObserver = null;
|
|
1550
|
+
if (animationFrame) {
|
|
1551
|
+
cancelAnimationFrame(frameId);
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
const offset$1 = offset$2;
|
|
1556
|
+
const shift$1 = shift$2;
|
|
1557
|
+
const flip$1 = flip$2;
|
|
1558
|
+
const computePosition = (reference, floating, options) => {
|
|
1559
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1560
|
+
const mergedOptions = {
|
|
1561
|
+
platform,
|
|
1562
|
+
...options
|
|
1563
|
+
};
|
|
1564
|
+
const platformWithCache = {
|
|
1565
|
+
...mergedOptions.platform,
|
|
1566
|
+
_c: cache
|
|
1567
|
+
};
|
|
1568
|
+
return computePosition$1(reference, floating, {
|
|
1569
|
+
...mergedOptions,
|
|
1570
|
+
platform: platformWithCache
|
|
1571
|
+
});
|
|
1572
|
+
};
|
|
1573
|
+
var isClient = typeof document !== "undefined";
|
|
1574
|
+
var noop2 = function noop3() {
|
|
1575
|
+
};
|
|
1576
|
+
var index = isClient ? useLayoutEffect : noop2;
|
|
1577
|
+
function deepEqual(a, b) {
|
|
1578
|
+
if (a === b) {
|
|
1579
|
+
return true;
|
|
1580
|
+
}
|
|
1581
|
+
if (typeof a !== typeof b) {
|
|
1582
|
+
return false;
|
|
1583
|
+
}
|
|
1584
|
+
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
1585
|
+
return true;
|
|
1586
|
+
}
|
|
1587
|
+
let length;
|
|
1588
|
+
let i;
|
|
1589
|
+
let keys;
|
|
1590
|
+
if (a && b && typeof a === "object") {
|
|
1591
|
+
if (Array.isArray(a)) {
|
|
1592
|
+
length = a.length;
|
|
1593
|
+
if (length !== b.length) return false;
|
|
1594
|
+
for (i = length; i-- !== 0; ) {
|
|
1595
|
+
if (!deepEqual(a[i], b[i])) {
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return true;
|
|
1600
|
+
}
|
|
1601
|
+
keys = Object.keys(a);
|
|
1602
|
+
length = keys.length;
|
|
1603
|
+
if (length !== Object.keys(b).length) {
|
|
1604
|
+
return false;
|
|
1605
|
+
}
|
|
1606
|
+
for (i = length; i-- !== 0; ) {
|
|
1607
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
1608
|
+
return false;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
for (i = length; i-- !== 0; ) {
|
|
1612
|
+
const key = keys[i];
|
|
1613
|
+
if (key === "_owner" && a.$$typeof) {
|
|
1614
|
+
continue;
|
|
1615
|
+
}
|
|
1616
|
+
if (!deepEqual(a[key], b[key])) {
|
|
1617
|
+
return false;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
return true;
|
|
1621
|
+
}
|
|
1622
|
+
return a !== a && b !== b;
|
|
1623
|
+
}
|
|
1624
|
+
function getDPR(element) {
|
|
1625
|
+
if (typeof window === "undefined") {
|
|
1626
|
+
return 1;
|
|
1627
|
+
}
|
|
1628
|
+
const win = element.ownerDocument.defaultView || window;
|
|
1629
|
+
return win.devicePixelRatio || 1;
|
|
1630
|
+
}
|
|
1631
|
+
function roundByDPR(element, value) {
|
|
1632
|
+
const dpr = getDPR(element);
|
|
1633
|
+
return Math.round(value * dpr) / dpr;
|
|
1634
|
+
}
|
|
1635
|
+
function useLatestRef(value) {
|
|
1636
|
+
const ref = React.useRef(value);
|
|
1637
|
+
index(() => {
|
|
1638
|
+
ref.current = value;
|
|
1639
|
+
});
|
|
1640
|
+
return ref;
|
|
1641
|
+
}
|
|
1642
|
+
function useFloating$1(options) {
|
|
1643
|
+
if (options === void 0) {
|
|
1644
|
+
options = {};
|
|
1645
|
+
}
|
|
1646
|
+
const {
|
|
1647
|
+
placement = "bottom",
|
|
1648
|
+
strategy = "absolute",
|
|
1649
|
+
middleware = [],
|
|
1650
|
+
platform: platform2,
|
|
1651
|
+
elements: {
|
|
1652
|
+
reference: externalReference,
|
|
1653
|
+
floating: externalFloating
|
|
1654
|
+
} = {},
|
|
1655
|
+
transform = true,
|
|
1656
|
+
whileElementsMounted,
|
|
1657
|
+
open
|
|
1658
|
+
} = options;
|
|
1659
|
+
const [data, setData] = React.useState({
|
|
1660
|
+
x: 0,
|
|
1661
|
+
y: 0,
|
|
1662
|
+
strategy,
|
|
1663
|
+
placement,
|
|
1664
|
+
middlewareData: {},
|
|
1665
|
+
isPositioned: false
|
|
1666
|
+
});
|
|
1667
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
1668
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
1669
|
+
setLatestMiddleware(middleware);
|
|
1670
|
+
}
|
|
1671
|
+
const [_reference, _setReference] = React.useState(null);
|
|
1672
|
+
const [_floating, _setFloating] = React.useState(null);
|
|
1673
|
+
const setReference = React.useCallback((node) => {
|
|
1674
|
+
if (node !== referenceRef.current) {
|
|
1675
|
+
referenceRef.current = node;
|
|
1676
|
+
_setReference(node);
|
|
1677
|
+
}
|
|
1678
|
+
}, []);
|
|
1679
|
+
const setFloating = React.useCallback((node) => {
|
|
1680
|
+
if (node !== floatingRef.current) {
|
|
1681
|
+
floatingRef.current = node;
|
|
1682
|
+
_setFloating(node);
|
|
1683
|
+
}
|
|
1684
|
+
}, []);
|
|
1685
|
+
const referenceEl = externalReference || _reference;
|
|
1686
|
+
const floatingEl = externalFloating || _floating;
|
|
1687
|
+
const referenceRef = React.useRef(null);
|
|
1688
|
+
const floatingRef = React.useRef(null);
|
|
1689
|
+
const dataRef = React.useRef(data);
|
|
1690
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
1691
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
1692
|
+
const platformRef = useLatestRef(platform2);
|
|
1693
|
+
const openRef = useLatestRef(open);
|
|
1694
|
+
const update = React.useCallback(() => {
|
|
1695
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
const config = {
|
|
1699
|
+
placement,
|
|
1700
|
+
strategy,
|
|
1701
|
+
middleware: latestMiddleware
|
|
1702
|
+
};
|
|
1703
|
+
if (platformRef.current) {
|
|
1704
|
+
config.platform = platformRef.current;
|
|
1705
|
+
}
|
|
1706
|
+
computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
1707
|
+
const fullData = {
|
|
1708
|
+
...data2,
|
|
1709
|
+
// The floating element's position may be recomputed while it's closed
|
|
1710
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
1711
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
1712
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
1713
|
+
isPositioned: openRef.current !== false
|
|
1714
|
+
};
|
|
1715
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
1716
|
+
dataRef.current = fullData;
|
|
1717
|
+
ReactDOM.flushSync(() => {
|
|
1718
|
+
setData(fullData);
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
1723
|
+
index(() => {
|
|
1724
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
1725
|
+
dataRef.current.isPositioned = false;
|
|
1726
|
+
setData((data2) => ({
|
|
1727
|
+
...data2,
|
|
1728
|
+
isPositioned: false
|
|
1729
|
+
}));
|
|
1730
|
+
}
|
|
1731
|
+
}, [open]);
|
|
1732
|
+
const isMountedRef = React.useRef(false);
|
|
1733
|
+
index(() => {
|
|
1734
|
+
isMountedRef.current = true;
|
|
1735
|
+
return () => {
|
|
1736
|
+
isMountedRef.current = false;
|
|
1737
|
+
};
|
|
1738
|
+
}, []);
|
|
1739
|
+
index(() => {
|
|
1740
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
1741
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
1742
|
+
if (referenceEl && floatingEl) {
|
|
1743
|
+
if (whileElementsMountedRef.current) {
|
|
1744
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
1745
|
+
}
|
|
1746
|
+
update();
|
|
1747
|
+
}
|
|
1748
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
1749
|
+
const refs = React.useMemo(() => ({
|
|
1750
|
+
reference: referenceRef,
|
|
1751
|
+
floating: floatingRef,
|
|
1752
|
+
setReference,
|
|
1753
|
+
setFloating
|
|
1754
|
+
}), [setReference, setFloating]);
|
|
1755
|
+
const elements = React.useMemo(() => ({
|
|
1756
|
+
reference: referenceEl,
|
|
1757
|
+
floating: floatingEl
|
|
1758
|
+
}), [referenceEl, floatingEl]);
|
|
1759
|
+
const floatingStyles = React.useMemo(() => {
|
|
1760
|
+
const initialStyles = {
|
|
1761
|
+
position: strategy,
|
|
1762
|
+
left: 0,
|
|
1763
|
+
top: 0
|
|
1764
|
+
};
|
|
1765
|
+
if (!elements.floating) {
|
|
1766
|
+
return initialStyles;
|
|
1767
|
+
}
|
|
1768
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
1769
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
1770
|
+
if (transform) {
|
|
1771
|
+
return {
|
|
1772
|
+
...initialStyles,
|
|
1773
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
1774
|
+
...getDPR(elements.floating) >= 1.5 && {
|
|
1775
|
+
willChange: "transform"
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
return {
|
|
1780
|
+
position: strategy,
|
|
1781
|
+
left: x,
|
|
1782
|
+
top: y
|
|
1783
|
+
};
|
|
1784
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
1785
|
+
return React.useMemo(() => ({
|
|
1786
|
+
...data,
|
|
1787
|
+
update,
|
|
1788
|
+
refs,
|
|
1789
|
+
elements,
|
|
1790
|
+
floatingStyles
|
|
1791
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
1792
|
+
}
|
|
1793
|
+
const offset = (options, deps) => ({
|
|
1794
|
+
...offset$1(options),
|
|
1795
|
+
options: [options, deps]
|
|
1796
|
+
});
|
|
1797
|
+
const shift = (options, deps) => ({
|
|
1798
|
+
...shift$1(options),
|
|
1799
|
+
options: [options, deps]
|
|
1800
|
+
});
|
|
1801
|
+
const flip = (options, deps) => ({
|
|
1802
|
+
...flip$1(options),
|
|
1803
|
+
options: [options, deps]
|
|
1804
|
+
});
|
|
1805
|
+
const SafeReact = {
|
|
1806
|
+
...React
|
|
1807
|
+
};
|
|
1808
|
+
let serverHandoffComplete = false;
|
|
1809
|
+
let count = 0;
|
|
1810
|
+
const genId = () => (
|
|
1811
|
+
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
1812
|
+
// on <React 18
|
|
1813
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
|
|
1814
|
+
);
|
|
1815
|
+
function useFloatingId() {
|
|
1816
|
+
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : void 0);
|
|
1817
|
+
index$1(() => {
|
|
1818
|
+
if (id == null) {
|
|
1819
|
+
setId(genId());
|
|
1820
|
+
}
|
|
1821
|
+
}, []);
|
|
1822
|
+
React.useEffect(() => {
|
|
1823
|
+
serverHandoffComplete = true;
|
|
1824
|
+
}, []);
|
|
1825
|
+
return id;
|
|
1826
|
+
}
|
|
1827
|
+
const useReactId = SafeReact.useId;
|
|
1828
|
+
const useId = useReactId || useFloatingId;
|
|
1829
|
+
let devMessageSet;
|
|
1830
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1831
|
+
devMessageSet = /* @__PURE__ */ new Set();
|
|
1832
|
+
}
|
|
1833
|
+
function error() {
|
|
1834
|
+
var _devMessageSet3;
|
|
1835
|
+
for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1836
|
+
messages[_key2] = arguments[_key2];
|
|
1837
|
+
}
|
|
1838
|
+
const message = "Floating UI: " + messages.join(" ");
|
|
1839
|
+
if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
|
|
1840
|
+
var _devMessageSet4;
|
|
1841
|
+
(_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
|
|
1842
|
+
console.error(message);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
function createEventEmitter() {
|
|
1846
|
+
const map = /* @__PURE__ */ new Map();
|
|
1847
|
+
return {
|
|
1848
|
+
emit(event, data) {
|
|
1849
|
+
var _map$get;
|
|
1850
|
+
(_map$get = map.get(event)) == null || _map$get.forEach((listener) => listener(data));
|
|
1851
|
+
},
|
|
1852
|
+
on(event, listener) {
|
|
1853
|
+
if (!map.has(event)) {
|
|
1854
|
+
map.set(event, /* @__PURE__ */ new Set());
|
|
1855
|
+
}
|
|
1856
|
+
map.get(event).add(listener);
|
|
1857
|
+
},
|
|
1858
|
+
off(event, listener) {
|
|
1859
|
+
var _map$get2;
|
|
1860
|
+
(_map$get2 = map.get(event)) == null || _map$get2.delete(listener);
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
const FloatingNodeContext = /* @__PURE__ */ React.createContext(null);
|
|
1865
|
+
const FloatingTreeContext = /* @__PURE__ */ React.createContext(null);
|
|
1866
|
+
const useFloatingParentNodeId = () => {
|
|
1867
|
+
var _React$useContext;
|
|
1868
|
+
return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
|
|
1869
|
+
};
|
|
1870
|
+
const useFloatingTree = () => React.useContext(FloatingTreeContext);
|
|
1871
|
+
function useFloatingRootContext(options) {
|
|
1872
|
+
const {
|
|
1873
|
+
open = false,
|
|
1874
|
+
onOpenChange: onOpenChangeProp,
|
|
1875
|
+
elements: elementsProp
|
|
1876
|
+
} = options;
|
|
1877
|
+
const floatingId = useId();
|
|
1878
|
+
const dataRef = React.useRef({});
|
|
1879
|
+
const [events] = React.useState(() => createEventEmitter());
|
|
1880
|
+
const nested = useFloatingParentNodeId() != null;
|
|
1881
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1882
|
+
const optionDomReference = elementsProp.reference;
|
|
1883
|
+
if (optionDomReference && !isElement(optionDomReference)) {
|
|
1884
|
+
error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
const [positionReference, setPositionReference] = React.useState(elementsProp.reference);
|
|
1888
|
+
const onOpenChange = useEffectEvent((open2, event, reason) => {
|
|
1889
|
+
dataRef.current.openEvent = open2 ? event : void 0;
|
|
1890
|
+
events.emit("openchange", {
|
|
1891
|
+
open: open2,
|
|
1892
|
+
event,
|
|
1893
|
+
reason,
|
|
1894
|
+
nested
|
|
1895
|
+
});
|
|
1896
|
+
onOpenChangeProp == null || onOpenChangeProp(open2, event, reason);
|
|
1897
|
+
});
|
|
1898
|
+
const refs = React.useMemo(() => ({
|
|
1899
|
+
setPositionReference
|
|
1900
|
+
}), []);
|
|
1901
|
+
const elements = React.useMemo(() => ({
|
|
1902
|
+
reference: positionReference || elementsProp.reference || null,
|
|
1903
|
+
floating: elementsProp.floating || null,
|
|
1904
|
+
domReference: elementsProp.reference
|
|
1905
|
+
}), [positionReference, elementsProp.reference, elementsProp.floating]);
|
|
1906
|
+
return React.useMemo(() => ({
|
|
1907
|
+
dataRef,
|
|
1908
|
+
open,
|
|
1909
|
+
onOpenChange,
|
|
1910
|
+
elements,
|
|
1911
|
+
events,
|
|
1912
|
+
floatingId,
|
|
1913
|
+
refs
|
|
1914
|
+
}), [open, onOpenChange, elements, events, floatingId, refs]);
|
|
1915
|
+
}
|
|
1916
|
+
function useFloating(options) {
|
|
1917
|
+
if (options === void 0) {
|
|
1918
|
+
options = {};
|
|
1919
|
+
}
|
|
1920
|
+
const {
|
|
1921
|
+
nodeId
|
|
1922
|
+
} = options;
|
|
1923
|
+
const internalRootContext = useFloatingRootContext({
|
|
1924
|
+
...options,
|
|
1925
|
+
elements: {
|
|
1926
|
+
reference: null,
|
|
1927
|
+
floating: null,
|
|
1928
|
+
...options.elements
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
const rootContext = options.rootContext || internalRootContext;
|
|
1932
|
+
const computedElements = rootContext.elements;
|
|
1933
|
+
const [_domReference, setDomReference] = React.useState(null);
|
|
1934
|
+
const [positionReference, _setPositionReference] = React.useState(null);
|
|
1935
|
+
const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;
|
|
1936
|
+
const domReference = optionDomReference || _domReference;
|
|
1937
|
+
const domReferenceRef = React.useRef(null);
|
|
1938
|
+
const tree = useFloatingTree();
|
|
1939
|
+
index$1(() => {
|
|
1940
|
+
if (domReference) {
|
|
1941
|
+
domReferenceRef.current = domReference;
|
|
1942
|
+
}
|
|
1943
|
+
}, [domReference]);
|
|
1944
|
+
const position = useFloating$1({
|
|
1945
|
+
...options,
|
|
1946
|
+
elements: {
|
|
1947
|
+
...computedElements,
|
|
1948
|
+
...positionReference && {
|
|
1949
|
+
reference: positionReference
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
const setPositionReference = React.useCallback((node) => {
|
|
1954
|
+
const computedPositionReference = isElement(node) ? {
|
|
1955
|
+
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
1956
|
+
getClientRects: () => node.getClientRects(),
|
|
1957
|
+
contextElement: node
|
|
1958
|
+
} : node;
|
|
1959
|
+
_setPositionReference(computedPositionReference);
|
|
1960
|
+
position.refs.setReference(computedPositionReference);
|
|
1961
|
+
}, [position.refs]);
|
|
1962
|
+
const setReference = React.useCallback((node) => {
|
|
1963
|
+
if (isElement(node) || node === null) {
|
|
1964
|
+
domReferenceRef.current = node;
|
|
1965
|
+
setDomReference(node);
|
|
1966
|
+
}
|
|
1967
|
+
if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
1968
|
+
// `null` to support `positionReference` + an unstable `reference`
|
|
1969
|
+
// callback ref.
|
|
1970
|
+
node !== null && !isElement(node)) {
|
|
1971
|
+
position.refs.setReference(node);
|
|
1972
|
+
}
|
|
1973
|
+
}, [position.refs]);
|
|
1974
|
+
const refs = React.useMemo(() => ({
|
|
1975
|
+
...position.refs,
|
|
1976
|
+
setReference,
|
|
1977
|
+
setPositionReference,
|
|
1978
|
+
domReference: domReferenceRef
|
|
1979
|
+
}), [position.refs, setReference, setPositionReference]);
|
|
1980
|
+
const elements = React.useMemo(() => ({
|
|
1981
|
+
...position.elements,
|
|
1982
|
+
domReference
|
|
1983
|
+
}), [position.elements, domReference]);
|
|
1984
|
+
const context = React.useMemo(() => ({
|
|
1985
|
+
...position,
|
|
1986
|
+
...rootContext,
|
|
1987
|
+
refs,
|
|
1988
|
+
elements,
|
|
1989
|
+
nodeId
|
|
1990
|
+
}), [position, refs, elements, nodeId, rootContext]);
|
|
1991
|
+
index$1(() => {
|
|
1992
|
+
rootContext.dataRef.current.floatingContext = context;
|
|
1993
|
+
const node = tree == null ? void 0 : tree.nodesRef.current.find((node2) => node2.id === nodeId);
|
|
1994
|
+
if (node) {
|
|
1995
|
+
node.context = context;
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
return React.useMemo(() => ({
|
|
1999
|
+
...position,
|
|
2000
|
+
context,
|
|
2001
|
+
refs,
|
|
2002
|
+
elements
|
|
2003
|
+
}), [position, refs, elements, context]);
|
|
2004
|
+
}
|
|
2005
|
+
const Popover = (props) => {
|
|
2006
|
+
return ReactDOM__default.createPortal(
|
|
2007
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: props.isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2008
|
+
"div",
|
|
2009
|
+
{
|
|
2010
|
+
ref: props.ref,
|
|
2011
|
+
style: {
|
|
2012
|
+
position: "absolute",
|
|
2013
|
+
top: 0,
|
|
2014
|
+
left: 0,
|
|
2015
|
+
...props.floatingStyles,
|
|
2016
|
+
transform: props.floatingStyles.transform,
|
|
2017
|
+
zIndex: 9999
|
|
2018
|
+
},
|
|
2019
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2020
|
+
PopoverWrapper,
|
|
2021
|
+
{
|
|
2022
|
+
$genre: props.genre ?? "black",
|
|
2023
|
+
className: props.className,
|
|
2024
|
+
tabIndex: 0,
|
|
2025
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
2026
|
+
animate: { opacity: 1, scale: 1 },
|
|
2027
|
+
exit: { opacity: 0, scale: 0.95 },
|
|
2028
|
+
transition: { duration: 0.2 },
|
|
2029
|
+
$sx: props.sx,
|
|
2030
|
+
$size: props.size,
|
|
2031
|
+
$sxTypography: props.sxTypography,
|
|
2032
|
+
$maxHeight: props.maxHeight,
|
|
2033
|
+
$maxWidth: props.maxWidth,
|
|
2034
|
+
children: props.children
|
|
2035
|
+
}
|
|
2036
|
+
)
|
|
2037
|
+
}
|
|
2038
|
+
) }),
|
|
2039
|
+
document.body
|
|
2040
|
+
);
|
|
2041
|
+
};
|
|
2042
|
+
const usePopover = (props) => {
|
|
2043
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
2044
|
+
const [minWidth, setMinWidth] = useState(void 0);
|
|
2045
|
+
const {
|
|
2046
|
+
refs,
|
|
2047
|
+
floatingStyles,
|
|
2048
|
+
update,
|
|
2049
|
+
placement: actualPlacement
|
|
2050
|
+
} = useFloating({
|
|
2051
|
+
open: isOpen,
|
|
2052
|
+
placement: props.placement,
|
|
2053
|
+
middleware: [offset(props.offset ?? 8), flip(), shift()],
|
|
2054
|
+
whileElementsMounted: autoUpdate
|
|
2055
|
+
});
|
|
2056
|
+
const clickOutsideHandler = useRef(null);
|
|
2057
|
+
const hoverCloseTimeout = useRef(null);
|
|
2058
|
+
const hoverOffset = useMemo(
|
|
2059
|
+
() => props.hoverOffset ?? props.offset ?? DEFAULT_POPOVER_OFFSET,
|
|
2060
|
+
[props.hoverOffset, props.offset]
|
|
2061
|
+
);
|
|
2062
|
+
const hoverCloseDelay = useMemo(() => props.hoverCloseDelay ?? DEFAULT_POPOVER_CLOSE_DELAY, [props.hoverCloseDelay]);
|
|
2063
|
+
useEffect(() => {
|
|
2064
|
+
const refEl = refs.reference.current;
|
|
2065
|
+
if (!refEl) return;
|
|
2066
|
+
if ((props.mode === "click" || props.mode === "clickOpen") && refEl instanceof HTMLElement) {
|
|
2067
|
+
const handleClick = () => {
|
|
2068
|
+
if (props.mode === "click") {
|
|
2069
|
+
setIsOpen((prev) => !prev);
|
|
2070
|
+
} else if (props.mode === "clickOpen") {
|
|
2071
|
+
setIsOpen(true);
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
refEl.addEventListener("click", handleClick);
|
|
2075
|
+
return () => {
|
|
2076
|
+
refEl.removeEventListener("click", handleClick);
|
|
2077
|
+
};
|
|
2078
|
+
} else if (props.mode === "hover" && refEl instanceof HTMLElement) {
|
|
2079
|
+
const handleMouseEnter = () => {
|
|
2080
|
+
setIsOpen(true);
|
|
2081
|
+
};
|
|
2082
|
+
const handleMouseLeave = () => {
|
|
2083
|
+
if (hoverCloseTimeout.current) clearTimeout(hoverCloseTimeout.current);
|
|
2084
|
+
hoverCloseTimeout.current = setTimeout(() => setIsOpen(false), hoverCloseDelay);
|
|
2085
|
+
};
|
|
2086
|
+
refEl.addEventListener("mouseenter", handleMouseEnter);
|
|
2087
|
+
refEl.addEventListener("mouseleave", handleMouseLeave);
|
|
2088
|
+
return () => {
|
|
2089
|
+
refEl.removeEventListener("mouseenter", handleMouseEnter);
|
|
2090
|
+
refEl.removeEventListener("mouseleave", handleMouseLeave);
|
|
2091
|
+
if (hoverCloseTimeout.current) clearTimeout(hoverCloseTimeout.current);
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
}, [props.mode, refs.reference, hoverCloseDelay]);
|
|
2095
|
+
useEffect(() => {
|
|
2096
|
+
if (!isOpen || !refs.reference.current || !refs.floating.current) return;
|
|
2097
|
+
const cleanup = autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
2098
|
+
if (props.isClickOutside) {
|
|
2099
|
+
clickOutsideHandler.current = (e) => {
|
|
2100
|
+
const refEl = refs.reference.current;
|
|
2101
|
+
const floatingEl = refs.floating.current;
|
|
2102
|
+
if (refEl instanceof HTMLElement && floatingEl instanceof HTMLElement && !refEl.contains(e.target) && !floatingEl.contains(e.target)) {
|
|
2103
|
+
setIsOpen(false);
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
document.addEventListener("mousedown", clickOutsideHandler.current);
|
|
2107
|
+
}
|
|
2108
|
+
return () => {
|
|
2109
|
+
cleanup();
|
|
2110
|
+
if (clickOutsideHandler.current) {
|
|
2111
|
+
document.removeEventListener("mousedown", clickOutsideHandler.current);
|
|
2112
|
+
clickOutsideHandler.current = null;
|
|
2113
|
+
}
|
|
2114
|
+
if (hoverCloseTimeout.current) {
|
|
2115
|
+
clearTimeout(hoverCloseTimeout.current);
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
}, [isOpen, refs.reference, refs.floating, update, props.isClickOutside]);
|
|
2119
|
+
useEffect(() => {
|
|
2120
|
+
if (!isOpen || !props.isFloatingHover || !refs.reference.current || !refs.floating.current) return;
|
|
2121
|
+
const refEl = refs.reference.current;
|
|
2122
|
+
const floatingEl = refs.floating.current;
|
|
2123
|
+
const handleMouseMove = (e) => {
|
|
2124
|
+
const mouseX = e.clientX;
|
|
2125
|
+
const mouseY = e.clientY;
|
|
2126
|
+
const refRect = refEl.getBoundingClientRect();
|
|
2127
|
+
const floatingRect = floatingEl.getBoundingClientRect();
|
|
2128
|
+
const isInsideRef = mouseX >= refRect.left - hoverOffset && mouseX <= refRect.right + hoverOffset && mouseY >= refRect.top - hoverOffset && mouseY <= refRect.bottom + hoverOffset;
|
|
2129
|
+
const isInsideFloating = mouseX >= floatingRect.left - hoverOffset && mouseX <= floatingRect.right + hoverOffset && mouseY >= floatingRect.top - hoverOffset && mouseY <= floatingRect.bottom + hoverOffset;
|
|
2130
|
+
if (isInsideRef || isInsideFloating) {
|
|
2131
|
+
if (hoverCloseTimeout.current) {
|
|
2132
|
+
clearTimeout(hoverCloseTimeout.current);
|
|
2133
|
+
hoverCloseTimeout.current = null;
|
|
2134
|
+
}
|
|
2135
|
+
} else {
|
|
2136
|
+
if (hoverCloseTimeout.current) clearTimeout(hoverCloseTimeout.current);
|
|
2137
|
+
hoverCloseTimeout.current = setTimeout(() => setIsOpen(false), hoverCloseDelay);
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
2141
|
+
return () => {
|
|
2142
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2143
|
+
if (hoverCloseTimeout.current) {
|
|
2144
|
+
clearTimeout(hoverCloseTimeout.current);
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
}, [isOpen, props.isFloatingHover, refs.reference, refs.floating, hoverOffset, hoverCloseDelay]);
|
|
2148
|
+
useLayoutEffect(() => {
|
|
2149
|
+
if (!isOpen || !props.isWidthAsContent || !refs.reference.current) return;
|
|
2150
|
+
const rect = refs.reference.current.getBoundingClientRect();
|
|
2151
|
+
setMinWidth(rect.width);
|
|
2152
|
+
}, [isOpen, props.isWidthAsContent, refs.reference]);
|
|
2153
|
+
const open = useCallback(() => setIsOpen(true), []);
|
|
2154
|
+
const close = useCallback(() => setIsOpen(false), []);
|
|
2155
|
+
const toggle = useCallback(() => setIsOpen((prev) => !prev), []);
|
|
2156
|
+
const combinedStyles = useMemo(() => {
|
|
2157
|
+
return {
|
|
2158
|
+
...floatingStyles,
|
|
2159
|
+
minWidth: props.isWidthAsContent && minWidth ? `${minWidth}px` : void 0,
|
|
2160
|
+
maxWidth: props.isWidthAsContent && minWidth ? `${minWidth}px` : void 0
|
|
2161
|
+
};
|
|
2162
|
+
}, [floatingStyles, props.isWidthAsContent, minWidth]);
|
|
2163
|
+
return {
|
|
2164
|
+
isOpen,
|
|
2165
|
+
setIsOpen,
|
|
2166
|
+
open,
|
|
2167
|
+
close,
|
|
2168
|
+
toggle,
|
|
2169
|
+
reference: refs.setReference,
|
|
2170
|
+
floating: refs.setFloating,
|
|
2171
|
+
floatingStyles: combinedStyles,
|
|
2172
|
+
placement: actualPlacement
|
|
2173
|
+
};
|
|
2174
|
+
};
|
|
2175
|
+
const addPopoverGenre = css`
|
|
2176
|
+
${(props) => css`
|
|
2177
|
+
background: ${props.theme.colors.button[props.$genre].background.rest};
|
|
2178
|
+
border-color: ${props.theme.colors.button[props.$genre].border.rest};
|
|
2179
|
+
color: ${props.theme.colors.button[props.$genre].color.rest};
|
|
2180
|
+
/* box-shadow: ${props.theme.effects.button}; */
|
|
2181
|
+
`};
|
|
2182
|
+
`;
|
|
2183
|
+
const addPopoverSize = css`
|
|
2184
|
+
${(props) => addPopoverSizeConstructor({
|
|
2185
|
+
...KEY_SIZE_DATA[props.$size ?? "medium"]
|
|
2186
|
+
})};
|
|
2187
|
+
`;
|
|
2188
|
+
const addPopoverSizeConstructor = (props) => css`
|
|
2189
|
+
display: flex;
|
|
2190
|
+
border-radius: ${props.radius}px;
|
|
2191
|
+
padding: ${props.padding}px;
|
|
2192
|
+
gap: ${props.padding - 2}px;
|
|
2193
|
+
${(params) => getFontSizeStyles(props.font, 500, params.theme.font.family)};
|
|
2194
|
+
`;
|
|
2195
|
+
const PopoverWrapper = styled(motion.div)`
|
|
2196
|
+
max-width: ${(props) => props.$maxWidth || "100%"};
|
|
2197
|
+
max-height: ${(props) => props.$maxHeight || "100%"};
|
|
2198
|
+
overflow: auto;
|
|
2199
|
+
flex-direction: column;
|
|
2200
|
+
${addPopoverSize};
|
|
2201
|
+
${addOutline};
|
|
2202
|
+
${addSXTypography};
|
|
2203
|
+
${addPopoverGenre};
|
|
2204
|
+
${addSX};
|
|
2205
|
+
`;
|
|
2206
|
+
const DEFAULT_POPOVER_OFFSET = 8;
|
|
2207
|
+
const DEFAULT_POPOVER_CLOSE_DELAY = 100;
|
|
2208
|
+
const TooltipContainer = styled(Stack)`
|
|
2209
|
+
display: flex;
|
|
2210
|
+
width: fit-content;
|
|
2211
|
+
height: fit-content;
|
|
2212
|
+
`;
|
|
2213
|
+
const addTooltipBoxSize = css`
|
|
2214
|
+
${(props) => addTooltipBoxSizeConstructor({
|
|
2215
|
+
...KEY_SIZE_DATA[props.size ?? "medium"]
|
|
2216
|
+
})};
|
|
2217
|
+
`;
|
|
2218
|
+
const addTooltipBoxSizeConstructor = (props) => css`
|
|
2219
|
+
gap: 0px;
|
|
2220
|
+
padding: ${props.padding}px ${props.padding}px 0px ${props.padding}px;
|
|
2221
|
+
:after {
|
|
2222
|
+
content: '';
|
|
2223
|
+
display: block;
|
|
2224
|
+
height: ${props.padding}px;
|
|
2225
|
+
width: 100%;
|
|
2226
|
+
}
|
|
2227
|
+
`;
|
|
2228
|
+
const TooltipBox = styled(Popover)`
|
|
2229
|
+
${addTooltipBoxSize};
|
|
2230
|
+
`;
|
|
2231
|
+
const Tooltip = memo((props) => {
|
|
2232
|
+
if (props.isDisabled) return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props.children });
|
|
2233
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { ...props });
|
|
2234
|
+
});
|
|
2235
|
+
const TooltipContent = (props) => {
|
|
2236
|
+
const { isOpen, reference, floating, floatingStyles } = usePopover({
|
|
2237
|
+
placement: props.placement ?? DEFAULT_TOOLTIP_PLACEMENT_FALLBACK,
|
|
2238
|
+
offset: props.offset ?? DEFAULT_TOOLTIP_OFFSET_FALLBACK,
|
|
2239
|
+
mode: props.mode ?? "hover",
|
|
2240
|
+
isClickOutside: props.isClickOutside ?? true,
|
|
2241
|
+
isFloatingHover: props.isFloatingHover ?? true,
|
|
2242
|
+
isWidthAsContent: props.isWidthAsContent ?? false,
|
|
2243
|
+
hoverCloseDelay: props.hoverCloseDelay ?? void 0,
|
|
2244
|
+
hoverOffset: props.hoverOffset ?? void 0
|
|
2245
|
+
});
|
|
2246
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
2247
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContainer, { sx: props.sx, ref: reference, children: props.children }),
|
|
2248
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2249
|
+
TooltipBox,
|
|
2250
|
+
{
|
|
2251
|
+
size: props.size,
|
|
2252
|
+
isOpen,
|
|
2253
|
+
genre: props.genre,
|
|
2254
|
+
floatingStyles,
|
|
2255
|
+
ref: floating,
|
|
2256
|
+
maxHeight: props.maxHeight,
|
|
2257
|
+
maxWidth: props.maxWidth,
|
|
2258
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2259
|
+
Typography,
|
|
2260
|
+
{
|
|
2261
|
+
sx: props.sxTypography ?? {
|
|
2262
|
+
default: {
|
|
2263
|
+
size: 14
|
|
2264
|
+
}
|
|
2265
|
+
},
|
|
2266
|
+
children: props.content
|
|
2267
|
+
}
|
|
2268
|
+
)
|
|
2269
|
+
}
|
|
2270
|
+
)
|
|
2271
|
+
] });
|
|
2272
|
+
};
|
|
2273
|
+
Tooltip.displayName = "Tooltip";
|
|
2274
|
+
const DEFAULT_TOOLTIP_PLACEMENT_FALLBACK = "bottom-start";
|
|
2275
|
+
const DEFAULT_TOOLTIP_OFFSET_FALLBACK = 8;
|
|
2276
|
+
const TypographyWithRef = (props) => {
|
|
2277
|
+
const { screenActual } = useScreenWidth();
|
|
2278
|
+
const cssProps = useMemo(
|
|
2279
|
+
() => ({
|
|
2280
|
+
$sxTypography: props.sx,
|
|
2281
|
+
style: props.style,
|
|
2282
|
+
className: props.className,
|
|
2283
|
+
$sx: props.sxStandard,
|
|
2284
|
+
onClick: props.onClick ? props.onClick : () => {
|
|
2285
|
+
}
|
|
2286
|
+
}),
|
|
2287
|
+
[props.sx, props.style, props.className, props.sxStandard, props.onClick]
|
|
2288
|
+
);
|
|
2289
|
+
const screenSX = useMemo(() => {
|
|
2290
|
+
var _a, _b;
|
|
2291
|
+
return ((_a = props.sx) == null ? void 0 : _a[screenActual]) ?? ((_b = props.sx) == null ? void 0 : _b.default);
|
|
2292
|
+
}, [props.sx, screenActual]);
|
|
2293
|
+
if (screenSX && "variant" in screenSX) {
|
|
2294
|
+
if (screenSX.variant === "h7" || screenSX.variant === "h8" || screenSX.variant === "h9") {
|
|
2295
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2296
|
+
Title,
|
|
2297
|
+
{
|
|
2298
|
+
ref: props.ref,
|
|
2299
|
+
as: props.isAnchor ? "a" : props.isParagraph ? "p" : props.isSpan ? "span" : "span",
|
|
2300
|
+
href: props.href,
|
|
2301
|
+
...cssProps,
|
|
2302
|
+
children: props.children
|
|
2303
|
+
}
|
|
2304
|
+
);
|
|
2305
|
+
} else {
|
|
2306
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2307
|
+
Title,
|
|
2308
|
+
{
|
|
2309
|
+
ref: props.ref,
|
|
2310
|
+
as: props.isAnchor ? "a" : props.isParagraph ? "p" : props.isSpan ? "span" : screenSX.variant,
|
|
2311
|
+
href: props.href,
|
|
2312
|
+
...cssProps,
|
|
2313
|
+
children: props.children
|
|
2314
|
+
}
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2319
|
+
Title,
|
|
2320
|
+
{
|
|
2321
|
+
ref: props.ref,
|
|
2322
|
+
as: props.isAnchor ? "a" : props.isParagraph ? "p" : props.isSpan ? "span" : "span",
|
|
2323
|
+
href: props.href,
|
|
2324
|
+
...cssProps,
|
|
2325
|
+
children: props.children
|
|
2326
|
+
}
|
|
2327
|
+
);
|
|
2328
|
+
};
|
|
2329
|
+
const Typography = (props) => {
|
|
2330
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TypographyWithRef, { ...props });
|
|
2331
|
+
};
|
|
2332
|
+
const TypographySizeIsAnchor = (props) => {
|
|
2333
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TypographyWithRef, { isAnchor: true, ...props, ref: props.ref, href: props.href });
|
|
2334
|
+
};
|
|
2335
|
+
const TypographyLink = createLink(TypographySizeIsAnchor);
|
|
2336
|
+
const TypographyTooltip = memo((props) => {
|
|
2337
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
2338
|
+
const contentRef = useRef(null);
|
|
2339
|
+
useEffect(() => {
|
|
2340
|
+
const checkOverflow = () => {
|
|
2341
|
+
if (contentRef.current) {
|
|
2342
|
+
setIsOverflowing(contentRef.current.scrollWidth > contentRef.current.clientWidth);
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
checkOverflow();
|
|
2346
|
+
window.addEventListener("resize", checkOverflow);
|
|
2347
|
+
return () => window.removeEventListener("resize", checkOverflow);
|
|
2348
|
+
}, [props.children]);
|
|
2349
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { isDisabled: !isOverflowing, content: props.children, ...props.tooltip, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypographyWithRef, { ref: contentRef, ...props.typography, style: { position: "relative" }, children: props.children }) });
|
|
2350
|
+
});
|
|
2351
|
+
TypographyTooltip.displayName = "TypographyTooltip";
|
|
2352
|
+
TypographyWithRef.displayName = "TypographyWithRef";
|
|
2353
|
+
TypographySizeIsAnchor.displayName = "TypographySizeIsAnchor";
|
|
2354
|
+
export {
|
|
2355
|
+
DEFAULT_TOOLTIP_PLACEMENT_FALLBACK as D,
|
|
2356
|
+
Popover as P,
|
|
2357
|
+
TooltipContainer as T,
|
|
2358
|
+
addTooltipBoxSize as a,
|
|
2359
|
+
addTooltipBoxSizeConstructor as b,
|
|
2360
|
+
TooltipBox as c,
|
|
2361
|
+
Tooltip as d,
|
|
2362
|
+
TooltipContent as e,
|
|
2363
|
+
DEFAULT_TOOLTIP_OFFSET_FALLBACK as f,
|
|
2364
|
+
getFontSizeStyles as g,
|
|
2365
|
+
addSXTypography as h,
|
|
2366
|
+
Title as i,
|
|
2367
|
+
Typography as j,
|
|
2368
|
+
TypographyLink as k,
|
|
2369
|
+
TypographyTooltip as l,
|
|
2370
|
+
usePopover as u
|
|
2371
|
+
};
|
|
2372
|
+
//# sourceMappingURL=component-C2JFFh-k.js.map
|