lecom-ui 5.4.34 → 5.4.36
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/dist/_virtual/_commonjsHelpers.js +5 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/components/Collapse/Collapse.js +128 -0
- package/dist/components/CustomIcon/Icons/CadastroFacil.js +23 -0
- package/dist/components/CustomIcon/Icons/LogoLecom.js +30 -0
- package/dist/components/CustomIcon/Icons/LogoLecomBrand.js +23 -0
- package/dist/components/CustomIcon/Icons/ModoTeste.js +23 -0
- package/dist/components/CustomIcon/Icons/Rpa.js +23 -0
- package/dist/components/CustomIcon/Icons/SairModoTeste.js +31 -0
- package/dist/components/MaskedInput/MaskedInput.js +41 -0
- package/dist/components/MaskedInput/presets.js +64 -0
- package/dist/components/MultiSelect/MultiSelect.js +55 -57
- package/dist/components/Table/Table.js +80 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/index.d.ts +114 -8
- package/dist/index.js +2 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +806 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +726 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +154 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +136 -0
- package/dist/node_modules/@radix-ui/number/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +303 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-collapsible/dist/index.js +144 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-primitive/dist/index.js +38 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +157 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-primitive/dist/index.js +38 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +144 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +79 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +319 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.js +79 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +265 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-menu/dist/index.js +831 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-roving-focus/dist/index.js +220 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +831 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +296 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/@radix-ui/react-popover/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +267 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-primitive/dist/index.js +38 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-roving-focus/dist/index.js +220 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +220 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/dist/index.js +718 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-primitive/dist/index.js +38 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +1143 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-visually-hidden/dist/index.js +34 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/@radix-ui/react-select/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/node_modules/@radix-ui/react-separator/dist/index.js +30 -0
- package/dist/node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-primitive/dist/index.js +38 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +81 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +137 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-primitive/dist/index.js +38 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +484 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +74 -0
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +3023 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +136 -0
- package/dist/node_modules/class-variance-authority/dist/index.js +44 -0
- package/dist/node_modules/clsx/dist/clsx.js +3 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/hex-color-opacity/lib/index.js +22 -0
- package/dist/node_modules/i18next/dist/esm/i18next.js +2228 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +44 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +26 -0
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-first.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-last.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-alert.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-help.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/info.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/menu.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/minus.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/panel-left.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/triangle-alert.js +23 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/user.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +13 -0
- package/dist/node_modules/react-i18next/dist/es/Translation.js +15 -0
- package/dist/node_modules/react-i18next/dist/es/context.js +18 -0
- package/dist/node_modules/react-i18next/dist/es/defaults.js +21 -0
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +7 -0
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +12 -0
- package/dist/node_modules/react-i18next/dist/es/unescape.js +27 -0
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +112 -0
- package/dist/node_modules/react-i18next/dist/es/utils.js +63 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2493 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/use-color-luminance/index.es.js +105 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/plugin/extend.ts +78 -0
- package/dist/plugin/fontFaces.ts +172 -0
- package/dist/plugin/general.ts +12 -0
- package/dist/plugin/plugin.cjs +7 -0
- package/dist/plugin/pluginNext.cjs +5 -5
- package/dist/plugin/pluginVite.cjs +5 -5
- package/dist/plugin/template.ts +31 -0
- package/dist/plugin/typographies.ts +152 -0
- package/dist/plugin/varsTheme.ts +79 -0
- package/dist/style.min.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useContext, useCallback, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { I18nContext, ReportNamespaces } from './context.js';
|
|
3
|
+
import { warnOnce, hasLoadedNamespace, loadLanguages, loadNamespaces, isString, isObject } from './utils.js';
|
|
4
|
+
import { getI18n } from './i18nInstance.js';
|
|
5
|
+
import { getDefaults } from './defaults.js';
|
|
6
|
+
|
|
7
|
+
const usePrevious = (value, ignore) => {
|
|
8
|
+
const ref = useRef();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
ref.current = value;
|
|
11
|
+
}, [value, ignore]);
|
|
12
|
+
return ref.current;
|
|
13
|
+
};
|
|
14
|
+
const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
15
|
+
const useMemoizedT = (i18n, language, namespace, keyPrefix) => useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
16
|
+
const useTranslation = (ns, props = {}) => {
|
|
17
|
+
const {
|
|
18
|
+
i18n: i18nFromProps
|
|
19
|
+
} = props;
|
|
20
|
+
const {
|
|
21
|
+
i18n: i18nFromContext,
|
|
22
|
+
defaultNS: defaultNSFromContext
|
|
23
|
+
} = useContext(I18nContext) || {};
|
|
24
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
25
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
26
|
+
if (!i18n) {
|
|
27
|
+
warnOnce(i18n, 'NO_I18NEXT_INSTANCE', 'useTranslation: You will need to pass in an i18next instance by using initReactI18next');
|
|
28
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
29
|
+
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
30
|
+
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
31
|
+
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
32
|
+
};
|
|
33
|
+
const retNotReady = [notReadyT, {}, false];
|
|
34
|
+
retNotReady.t = notReadyT;
|
|
35
|
+
retNotReady.i18n = {};
|
|
36
|
+
retNotReady.ready = false;
|
|
37
|
+
return retNotReady;
|
|
38
|
+
}
|
|
39
|
+
if (i18n.options.react?.wait) warnOnce(i18n, 'DEPRECATED_OPTION', 'useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
|
|
40
|
+
const i18nOptions = {
|
|
41
|
+
...getDefaults(),
|
|
42
|
+
...i18n.options.react,
|
|
43
|
+
...props
|
|
44
|
+
};
|
|
45
|
+
const {
|
|
46
|
+
useSuspense,
|
|
47
|
+
keyPrefix
|
|
48
|
+
} = i18nOptions;
|
|
49
|
+
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
50
|
+
namespaces = isString(namespaces) ? [namespaces] : namespaces || ['translation'];
|
|
51
|
+
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
52
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
53
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
54
|
+
const getT = () => memoGetT;
|
|
55
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
56
|
+
const [t, setT] = useState(getT);
|
|
57
|
+
let joinedNS = namespaces.join();
|
|
58
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
59
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
60
|
+
const isMounted = useRef(true);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const {
|
|
63
|
+
bindI18n,
|
|
64
|
+
bindI18nStore
|
|
65
|
+
} = i18nOptions;
|
|
66
|
+
isMounted.current = true;
|
|
67
|
+
if (!ready && !useSuspense) {
|
|
68
|
+
if (props.lng) {
|
|
69
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
70
|
+
if (isMounted.current) setT(getNewT);
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
74
|
+
if (isMounted.current) setT(getNewT);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
79
|
+
setT(getNewT);
|
|
80
|
+
}
|
|
81
|
+
const boundReset = () => {
|
|
82
|
+
if (isMounted.current) setT(getNewT);
|
|
83
|
+
};
|
|
84
|
+
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
85
|
+
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
86
|
+
return () => {
|
|
87
|
+
isMounted.current = false;
|
|
88
|
+
if (i18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset));
|
|
89
|
+
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
|
|
90
|
+
};
|
|
91
|
+
}, [i18n, joinedNS]);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (isMounted.current && ready) {
|
|
94
|
+
setT(getT);
|
|
95
|
+
}
|
|
96
|
+
}, [i18n, keyPrefix, ready]);
|
|
97
|
+
const ret = [t, i18n, ready];
|
|
98
|
+
ret.t = t;
|
|
99
|
+
ret.i18n = i18n;
|
|
100
|
+
ret.ready = ready;
|
|
101
|
+
if (ready) return ret;
|
|
102
|
+
if (!ready && !useSuspense) return ret;
|
|
103
|
+
throw new Promise(resolve => {
|
|
104
|
+
if (props.lng) {
|
|
105
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
106
|
+
} else {
|
|
107
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export { useTranslation };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const warn = (i18n, code, msg, rest) => {
|
|
2
|
+
const args = [msg, {
|
|
3
|
+
code,
|
|
4
|
+
...(rest || {})
|
|
5
|
+
}];
|
|
6
|
+
if (i18n?.services?.logger?.forward) {
|
|
7
|
+
return i18n.services.logger.forward(args, 'warn', 'react-i18next::', true);
|
|
8
|
+
}
|
|
9
|
+
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
10
|
+
if (i18n?.services?.logger?.warn) {
|
|
11
|
+
i18n.services.logger.warn(...args);
|
|
12
|
+
} else if (console?.warn) {
|
|
13
|
+
console.warn(...args);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const alreadyWarned = {};
|
|
17
|
+
const warnOnce = (i18n, code, msg, rest) => {
|
|
18
|
+
if (isString(msg) && alreadyWarned[msg]) return;
|
|
19
|
+
if (isString(msg)) alreadyWarned[msg] = new Date();
|
|
20
|
+
warn(i18n, code, msg, rest);
|
|
21
|
+
};
|
|
22
|
+
const loadedClb = (i18n, cb) => () => {
|
|
23
|
+
if (i18n.isInitialized) {
|
|
24
|
+
cb();
|
|
25
|
+
} else {
|
|
26
|
+
const initialized = () => {
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
i18n.off('initialized', initialized);
|
|
29
|
+
}, 0);
|
|
30
|
+
cb();
|
|
31
|
+
};
|
|
32
|
+
i18n.on('initialized', initialized);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const loadNamespaces = (i18n, ns, cb) => {
|
|
36
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
37
|
+
};
|
|
38
|
+
const loadLanguages = (i18n, lng, ns, cb) => {
|
|
39
|
+
if (isString(ns)) ns = [ns];
|
|
40
|
+
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
41
|
+
ns.forEach(n => {
|
|
42
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
43
|
+
});
|
|
44
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
45
|
+
};
|
|
46
|
+
const hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
47
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
48
|
+
warnOnce(i18n, 'NO_LANGUAGES', 'i18n.languages were undefined or empty', {
|
|
49
|
+
languages: i18n.languages
|
|
50
|
+
});
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
54
|
+
lng: options.lng,
|
|
55
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
56
|
+
if (options.bindI18n?.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const isString = obj => typeof obj === 'string';
|
|
61
|
+
const isObject = obj => typeof obj === 'object' && obj !== null;
|
|
62
|
+
|
|
63
|
+
export { hasLoadedNamespace, isObject, isString, loadLanguages, loadNamespaces, warn, warnOnce };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { __assign } from '../../../tslib/tslib.es6.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { RemoveScroll } from './UI.js';
|
|
4
|
+
import SideCar from './sidecar.js';
|
|
5
|
+
|
|
6
|
+
var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
7
|
+
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
8
|
+
|
|
9
|
+
export { ReactRemoveScroll as default };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { __spreadArray } from '../../../tslib/tslib.es6.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { RemoveScrollBar } from '../../../react-remove-scroll-bar/dist/es2015/component.js';
|
|
4
|
+
import { styleSingleton } from '../../../react-style-singleton/dist/es2015/component.js';
|
|
5
|
+
import { nonPassive } from './aggresiveCapture.js';
|
|
6
|
+
import { locationCouldBeScrolled, handleScroll } from './handleScroll.js';
|
|
7
|
+
|
|
8
|
+
var getTouchXY = function (event) {
|
|
9
|
+
return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
10
|
+
};
|
|
11
|
+
var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
|
|
12
|
+
var extractRef = function (ref) {
|
|
13
|
+
return ref && 'current' in ref ? ref.current : ref;
|
|
14
|
+
};
|
|
15
|
+
var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
|
|
16
|
+
var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
|
|
17
|
+
var idCounter = 0;
|
|
18
|
+
var lockStack = [];
|
|
19
|
+
function RemoveScrollSideCar(props) {
|
|
20
|
+
var shouldPreventQueue = React.useRef([]);
|
|
21
|
+
var touchStartRef = React.useRef([0, 0]);
|
|
22
|
+
var activeAxis = React.useRef();
|
|
23
|
+
var id = React.useState(idCounter++)[0];
|
|
24
|
+
var Style = React.useState(styleSingleton)[0];
|
|
25
|
+
var lastProps = React.useRef(props);
|
|
26
|
+
React.useEffect(function () {
|
|
27
|
+
lastProps.current = props;
|
|
28
|
+
}, [props]);
|
|
29
|
+
React.useEffect(function () {
|
|
30
|
+
if (props.inert) {
|
|
31
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
32
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
33
|
+
allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
|
|
34
|
+
return function () {
|
|
35
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
36
|
+
allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
41
|
+
var shouldCancelEvent = React.useCallback(function (event, parent) {
|
|
42
|
+
if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {
|
|
43
|
+
return !lastProps.current.allowPinchZoom;
|
|
44
|
+
}
|
|
45
|
+
var touch = getTouchXY(event);
|
|
46
|
+
var touchStart = touchStartRef.current;
|
|
47
|
+
var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
|
|
48
|
+
var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
|
|
49
|
+
var currentAxis;
|
|
50
|
+
var target = event.target;
|
|
51
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
|
|
52
|
+
// allow horizontal touch move on Range inputs. They will not cause any scroll
|
|
53
|
+
if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
57
|
+
if (!canBeScrolledInMainDirection) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (canBeScrolledInMainDirection) {
|
|
61
|
+
currentAxis = moveDirection;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
currentAxis = moveDirection === 'v' ? 'h' : 'v';
|
|
65
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
66
|
+
// other axis might be not scrollable
|
|
67
|
+
}
|
|
68
|
+
if (!canBeScrolledInMainDirection) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
|
|
72
|
+
activeAxis.current = currentAxis;
|
|
73
|
+
}
|
|
74
|
+
if (!currentAxis) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
78
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY);
|
|
79
|
+
}, []);
|
|
80
|
+
var shouldPrevent = React.useCallback(function (_event) {
|
|
81
|
+
var event = _event;
|
|
82
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
|
|
83
|
+
// not the last active
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
|
|
87
|
+
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];
|
|
88
|
+
// self event, and should be canceled
|
|
89
|
+
if (sourceEvent && sourceEvent.should) {
|
|
90
|
+
if (event.cancelable) {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// outside or shard event
|
|
96
|
+
if (!sourceEvent) {
|
|
97
|
+
var shardNodes = (lastProps.current.shards || [])
|
|
98
|
+
.map(extractRef)
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
.filter(function (node) { return node.contains(event.target); });
|
|
101
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
102
|
+
if (shouldStop) {
|
|
103
|
+
if (event.cancelable) {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, []);
|
|
109
|
+
var shouldCancel = React.useCallback(function (name, delta, target, should) {
|
|
110
|
+
var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };
|
|
111
|
+
shouldPreventQueue.current.push(event);
|
|
112
|
+
setTimeout(function () {
|
|
113
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
|
|
114
|
+
}, 1);
|
|
115
|
+
}, []);
|
|
116
|
+
var scrollTouchStart = React.useCallback(function (event) {
|
|
117
|
+
touchStartRef.current = getTouchXY(event);
|
|
118
|
+
activeAxis.current = undefined;
|
|
119
|
+
}, []);
|
|
120
|
+
var scrollWheel = React.useCallback(function (event) {
|
|
121
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
122
|
+
}, []);
|
|
123
|
+
var scrollTouchMove = React.useCallback(function (event) {
|
|
124
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
125
|
+
}, []);
|
|
126
|
+
React.useEffect(function () {
|
|
127
|
+
lockStack.push(Style);
|
|
128
|
+
props.setCallbacks({
|
|
129
|
+
onScrollCapture: scrollWheel,
|
|
130
|
+
onWheelCapture: scrollWheel,
|
|
131
|
+
onTouchMoveCapture: scrollTouchMove,
|
|
132
|
+
});
|
|
133
|
+
document.addEventListener('wheel', shouldPrevent, nonPassive);
|
|
134
|
+
document.addEventListener('touchmove', shouldPrevent, nonPassive);
|
|
135
|
+
document.addEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
136
|
+
return function () {
|
|
137
|
+
lockStack = lockStack.filter(function (inst) { return inst !== Style; });
|
|
138
|
+
document.removeEventListener('wheel', shouldPrevent, nonPassive);
|
|
139
|
+
document.removeEventListener('touchmove', shouldPrevent, nonPassive);
|
|
140
|
+
document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
141
|
+
};
|
|
142
|
+
}, []);
|
|
143
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
144
|
+
return (React.createElement(React.Fragment, null,
|
|
145
|
+
inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
|
|
146
|
+
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null));
|
|
147
|
+
}
|
|
148
|
+
function getOutermostShadowParent(node) {
|
|
149
|
+
var shadowParent = null;
|
|
150
|
+
while (node !== null) {
|
|
151
|
+
if (node instanceof ShadowRoot) {
|
|
152
|
+
shadowParent = node.host;
|
|
153
|
+
node = node.host;
|
|
154
|
+
}
|
|
155
|
+
node = node.parentNode;
|
|
156
|
+
}
|
|
157
|
+
return shadowParent;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export { RemoveScrollSideCar, getDeltaXY, getTouchXY };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __rest, __assign } from '../../../tslib/tslib.es6.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { zeroRightClassName, fullWidthClassName } from '../../../react-remove-scroll-bar/dist/es2015/constants.js';
|
|
4
|
+
import { effectCar } from './medium.js';
|
|
5
|
+
import { useMergeRefs } from '../../../use-callback-ref/dist/es2015/useMergeRef.js';
|
|
6
|
+
|
|
7
|
+
var nothing = function () {
|
|
8
|
+
return;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Removes scrollbar from the page and contain the scroll within the Lock
|
|
12
|
+
*/
|
|
13
|
+
var RemoveScroll = React.forwardRef(function (props, parentRef) {
|
|
14
|
+
var ref = React.useRef(null);
|
|
15
|
+
var _a = React.useState({
|
|
16
|
+
onScrollCapture: nothing,
|
|
17
|
+
onWheelCapture: nothing,
|
|
18
|
+
onTouchMoveCapture: nothing,
|
|
19
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
20
|
+
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
21
|
+
var SideCar = sideCar;
|
|
22
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
23
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
24
|
+
return (React.createElement(React.Fragment, null,
|
|
25
|
+
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
|
|
26
|
+
forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
|
|
27
|
+
});
|
|
28
|
+
RemoveScroll.defaultProps = {
|
|
29
|
+
enabled: true,
|
|
30
|
+
removeScrollBar: true,
|
|
31
|
+
inert: false,
|
|
32
|
+
};
|
|
33
|
+
RemoveScroll.classNames = {
|
|
34
|
+
fullWidth: fullWidthClassName,
|
|
35
|
+
zeroRight: zeroRightClassName,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { RemoveScroll };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var passiveSupported = false;
|
|
2
|
+
if (typeof window !== 'undefined') {
|
|
3
|
+
try {
|
|
4
|
+
var options = Object.defineProperty({}, 'passive', {
|
|
5
|
+
get: function () {
|
|
6
|
+
passiveSupported = true;
|
|
7
|
+
return true;
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
window.addEventListener('test', options, options);
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
window.removeEventListener('test', options, options);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
passiveSupported = false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
20
|
+
|
|
21
|
+
export { nonPassive };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var alwaysContainsScroll = function (node) {
|
|
2
|
+
// textarea will always _contain_ scroll inside self. It only can be hidden
|
|
3
|
+
return node.tagName === 'TEXTAREA';
|
|
4
|
+
};
|
|
5
|
+
var elementCanBeScrolled = function (node, overflow) {
|
|
6
|
+
if (!(node instanceof Element)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
var styles = window.getComputedStyle(node);
|
|
10
|
+
return (
|
|
11
|
+
// not-not-scrollable
|
|
12
|
+
styles[overflow] !== 'hidden' &&
|
|
13
|
+
// contains scroll inside self
|
|
14
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
|
|
15
|
+
};
|
|
16
|
+
var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
|
|
17
|
+
var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
|
|
18
|
+
var locationCouldBeScrolled = function (axis, node) {
|
|
19
|
+
var ownerDocument = node.ownerDocument;
|
|
20
|
+
var current = node;
|
|
21
|
+
do {
|
|
22
|
+
// Skip over shadow root
|
|
23
|
+
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
|
|
24
|
+
current = current.host;
|
|
25
|
+
}
|
|
26
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
27
|
+
if (isScrollable) {
|
|
28
|
+
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
29
|
+
if (scrollHeight > clientHeight) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
current = current.parentNode;
|
|
34
|
+
} while (current && current !== ownerDocument.body);
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
37
|
+
var getVScrollVariables = function (_a) {
|
|
38
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
39
|
+
return [
|
|
40
|
+
scrollTop,
|
|
41
|
+
scrollHeight,
|
|
42
|
+
clientHeight,
|
|
43
|
+
];
|
|
44
|
+
};
|
|
45
|
+
var getHScrollVariables = function (_a) {
|
|
46
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
47
|
+
return [
|
|
48
|
+
scrollLeft,
|
|
49
|
+
scrollWidth,
|
|
50
|
+
clientWidth,
|
|
51
|
+
];
|
|
52
|
+
};
|
|
53
|
+
var elementCouldBeScrolled = function (axis, node) {
|
|
54
|
+
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
55
|
+
};
|
|
56
|
+
var getScrollVariables = function (axis, node) {
|
|
57
|
+
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
58
|
+
};
|
|
59
|
+
var getDirectionFactor = function (axis, direction) {
|
|
60
|
+
/**
|
|
61
|
+
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
|
|
62
|
+
* and then increasingly negative as you scroll towards the end of the content.
|
|
63
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
|
|
64
|
+
*/
|
|
65
|
+
return axis === 'h' && direction === 'rtl' ? -1 : 1;
|
|
66
|
+
};
|
|
67
|
+
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
68
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
69
|
+
var delta = directionFactor * sourceDelta;
|
|
70
|
+
// find scrollable target
|
|
71
|
+
var target = event.target;
|
|
72
|
+
var targetInLock = endTarget.contains(target);
|
|
73
|
+
var shouldCancelScroll = false;
|
|
74
|
+
var isDeltaPositive = delta > 0;
|
|
75
|
+
var availableScroll = 0;
|
|
76
|
+
var availableScrollTop = 0;
|
|
77
|
+
do {
|
|
78
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
79
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
80
|
+
if (position || elementScroll) {
|
|
81
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
82
|
+
availableScroll += elementScroll;
|
|
83
|
+
availableScrollTop += position;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (target instanceof ShadowRoot) {
|
|
87
|
+
target = target.host;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
target = target.parentNode;
|
|
91
|
+
}
|
|
92
|
+
} while (
|
|
93
|
+
// portaled content
|
|
94
|
+
(!targetInLock && target !== document.body) ||
|
|
95
|
+
// self content
|
|
96
|
+
(targetInLock && (endTarget.contains(target) || endTarget === target)));
|
|
97
|
+
// handle epsilon around 0 (non standard zoom levels)
|
|
98
|
+
if (isDeltaPositive &&
|
|
99
|
+
((Math.abs(availableScroll) < 1) || (false))) {
|
|
100
|
+
shouldCancelScroll = true;
|
|
101
|
+
}
|
|
102
|
+
else if (!isDeltaPositive &&
|
|
103
|
+
((Math.abs(availableScrollTop) < 1) || (false))) {
|
|
104
|
+
shouldCancelScroll = true;
|
|
105
|
+
}
|
|
106
|
+
return shouldCancelScroll;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export { handleScroll, locationCouldBeScrolled };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RemoveScrollSideCar } from './SideEffect.js';
|
|
2
|
+
import { effectCar } from './medium.js';
|
|
3
|
+
import { exportSidecar } from '../../../use-sidecar/dist/es2015/exports.js';
|
|
4
|
+
|
|
5
|
+
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
6
|
+
|
|
7
|
+
export { SideCar as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { styleSingleton } from '../../../react-style-singleton/dist/es2015/component.js';
|
|
3
|
+
import { noScrollbarsClassName, zeroRightClassName, fullWidthClassName, removedBarSizeVariable } from './constants.js';
|
|
4
|
+
import { getGapWidth } from './utils.js';
|
|
5
|
+
|
|
6
|
+
var Style = styleSingleton();
|
|
7
|
+
var lockAttribute = 'data-scroll-locked';
|
|
8
|
+
// important tip - once we measure scrollBar width and remove them
|
|
9
|
+
// we could not repeat this operation
|
|
10
|
+
// thus we are using style-singleton - only the first "yet correct" style will be applied.
|
|
11
|
+
var getStyles = function (_a, allowRelative, gapMode, important) {
|
|
12
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
13
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
14
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
15
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
16
|
+
gapMode === 'margin' &&
|
|
17
|
+
"\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
18
|
+
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
|
|
19
|
+
]
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
22
|
+
};
|
|
23
|
+
var getCurrentUseCounter = function () {
|
|
24
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);
|
|
25
|
+
return isFinite(counter) ? counter : 0;
|
|
26
|
+
};
|
|
27
|
+
var useLockAttribute = function () {
|
|
28
|
+
React.useEffect(function () {
|
|
29
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
30
|
+
return function () {
|
|
31
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
32
|
+
if (newCounter <= 0) {
|
|
33
|
+
document.body.removeAttribute(lockAttribute);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Removes page scrollbar and blocks page scroll when mounted
|
|
43
|
+
*/
|
|
44
|
+
var RemoveScrollBar = function (_a) {
|
|
45
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;
|
|
46
|
+
useLockAttribute();
|
|
47
|
+
/*
|
|
48
|
+
gap will be measured on every component mount
|
|
49
|
+
however it will be used only by the "first" invocation
|
|
50
|
+
due to singleton nature of <Style
|
|
51
|
+
*/
|
|
52
|
+
var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
|
|
53
|
+
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { RemoveScrollBar, lockAttribute, useLockAttribute };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var zeroRightClassName = 'right-scroll-bar-position';
|
|
2
|
+
var fullWidthClassName = 'width-before-scroll-bar';
|
|
3
|
+
var noScrollbarsClassName = 'with-scroll-bars-hidden';
|
|
4
|
+
/**
|
|
5
|
+
* Name of a CSS variable containing the amount of "hidden" scrollbar
|
|
6
|
+
* ! might be undefined ! use will fallback!
|
|
7
|
+
*/
|
|
8
|
+
var removedBarSizeVariable = '--removed-body-scroll-bar-size';
|
|
9
|
+
|
|
10
|
+
export { fullWidthClassName, noScrollbarsClassName, removedBarSizeVariable, zeroRightClassName };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var zeroGap = {
|
|
2
|
+
left: 0,
|
|
3
|
+
top: 0,
|
|
4
|
+
right: 0,
|
|
5
|
+
gap: 0,
|
|
6
|
+
};
|
|
7
|
+
var parse = function (x) { return parseInt(x || '', 10) || 0; };
|
|
8
|
+
var getOffset = function (gapMode) {
|
|
9
|
+
var cs = window.getComputedStyle(document.body);
|
|
10
|
+
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
11
|
+
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
12
|
+
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
13
|
+
return [parse(left), parse(top), parse(right)];
|
|
14
|
+
};
|
|
15
|
+
var getGapWidth = function (gapMode) {
|
|
16
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
17
|
+
if (typeof window === 'undefined') {
|
|
18
|
+
return zeroGap;
|
|
19
|
+
}
|
|
20
|
+
var offsets = getOffset(gapMode);
|
|
21
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
22
|
+
var windowWidth = window.innerWidth;
|
|
23
|
+
return {
|
|
24
|
+
left: offsets[0],
|
|
25
|
+
top: offsets[1],
|
|
26
|
+
right: offsets[2],
|
|
27
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { getGapWidth, zeroGap };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { styleHookSingleton } from './hook.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* create a Component to add styles on demand
|
|
5
|
+
* - styles are added when first instance is mounted
|
|
6
|
+
* - styles are removed when the last instance is unmounted
|
|
7
|
+
* - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
|
|
8
|
+
*/
|
|
9
|
+
var styleSingleton = function () {
|
|
10
|
+
var useStyle = styleHookSingleton();
|
|
11
|
+
var Sheet = function (_a) {
|
|
12
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
13
|
+
useStyle(styles, dynamic);
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
16
|
+
return Sheet;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { styleSingleton };
|