@koine/react 1.1.10 → 1.1.12
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/Alert/Alert.js +12 -8
- package/Alert/Alert.mjs +10 -0
- package/Alert/index.js +4 -1
- package/Alert/index.mjs +1 -0
- package/Alert/package.json +2 -2
- package/Animations/Reveal.js +18 -14
- package/Animations/Reveal.mjs +17 -0
- package/Animations/Underline.js +7 -4
- package/Animations/Underline.mjs +5 -0
- package/Animations/index.js +6 -3
- package/Animations/index.mjs +3 -0
- package/Animations/package.json +2 -2
- package/Animations/useReveal.js +11 -7
- package/{node/Animations/useReveal.js → Animations/useReveal.mjs} +7 -11
- package/Autocomplete/AutocompleteDownshift.js +4 -1
- package/{node/Autocomplete/AutocompleteDownshift.js → Autocomplete/AutocompleteDownshift.mjs} +1 -4
- package/Autocomplete/AutocompleteDownshiftMultiselect.js +4 -1
- package/{node/Autocomplete/AutocompleteDownshiftMultiselect.js → Autocomplete/AutocompleteDownshiftMultiselect.mjs} +1 -4
- package/Autocomplete/AutocompleteMui.js +33 -35
- package/{node/Autocomplete/AutocompleteMui.js → Autocomplete/AutocompleteMui.mjs} +35 -33
- package/Autocomplete/AutocompleteReach.js +4 -1
- package/{node/Autocomplete/AutocompleteReach.js → Autocomplete/AutocompleteReach.mjs} +1 -4
- package/Autocomplete/components.js +25 -22
- package/Autocomplete/components.mjs +34 -0
- package/Autocomplete/helpers.js +11 -6
- package/{node/Autocomplete/helpers.js → Autocomplete/helpers.mjs} +6 -11
- package/Autocomplete/index.js +5 -1
- package/Autocomplete/index.mjs +3 -0
- package/Autocomplete/package.json +2 -2
- package/Bg/BgColor.js +14 -10
- package/Bg/BgColor.mjs +21 -0
- package/Bg/BgPhoto.js +13 -9
- package/Bg/BgPhoto.mjs +16 -0
- package/Bg/BgSvg.js +10 -6
- package/Bg/BgSvg.mjs +12 -0
- package/Bg/index.js +6 -3
- package/Bg/index.mjs +3 -0
- package/Bg/package.json +2 -2
- package/Breadcrumbs/Breadcrumbs.js +22 -18
- package/Breadcrumbs/Breadcrumbs.mjs +27 -0
- package/Breadcrumbs/index.js +4 -1
- package/Breadcrumbs/index.mjs +1 -0
- package/Breadcrumbs/package.json +2 -2
- package/Buttons/Button.js +12 -9
- package/Buttons/Button.mjs +14 -0
- package/Buttons/ButtonComposite.js +20 -16
- package/Buttons/ButtonComposite.mjs +28 -0
- package/Buttons/ButtonFab.js +8 -5
- package/Buttons/ButtonFab.mjs +6 -0
- package/Buttons/ButtonLink.js +12 -8
- package/Buttons/ButtonLink.mjs +11 -0
- package/Buttons/IconButton.js +9 -6
- package/Buttons/IconButton.mjs +7 -0
- package/Buttons/index.js +8 -5
- package/Buttons/index.mjs +5 -0
- package/Buttons/package.json +2 -2
- package/Calendar/CalendarDaygridCell.js +16 -12
- package/{node/Calendar/CalendarDaygridCell.js → Calendar/CalendarDaygridCell.mjs} +12 -16
- package/Calendar/CalendarDaygridNav.js +14 -9
- package/Calendar/CalendarDaygridNav.mjs +23 -0
- package/Calendar/CalendarDaygridTable.js +23 -19
- package/{node/Calendar/CalendarDaygridTable.js → Calendar/CalendarDaygridTable.mjs} +19 -23
- package/Calendar/CalendarLegend.js +9 -5
- package/Calendar/CalendarLegend.mjs +16 -0
- package/Calendar/calendar-api-google.js +27 -23
- package/{node/Calendar/calendar-api-google.js → Calendar/calendar-api-google.mjs} +23 -27
- package/Calendar/index.js +9 -6
- package/Calendar/index.mjs +6 -0
- package/Calendar/package.json +2 -2
- package/Calendar/types.js +2 -1
- package/Calendar/types.mjs +1 -0
- package/Calendar/useCalendar.js +43 -39
- package/{node/Calendar/useCalendar.js → Calendar/useCalendar.mjs} +39 -43
- package/Calendar/utils.js +44 -31
- package/{node/Calendar/utils.js → Calendar/utils.mjs} +31 -44
- package/Carousel/Carousel.js +4 -1
- package/{node/Carousel/Carousel.js → Carousel/Carousel.mjs} +1 -4
- package/Carousel/CarouselCss.d.ts +6 -1
- package/Carousel/CarouselCss.js +17 -13
- package/Carousel/CarouselCss.mjs +22 -0
- package/Carousel/index.js +4 -1
- package/Carousel/index.mjs +1 -0
- package/Carousel/package.json +2 -2
- package/Collapsable/Collapsable.js +4 -1
- package/Collapsable/Collapsable.mjs +1 -0
- package/{node/Collapsable/CollapsableReach.js → Collapsable/CollapsableReach.mjs} +0 -0
- package/Collapsable/index.js +4 -1
- package/Collapsable/index.mjs +2 -0
- package/Collapsable/package.json +2 -2
- package/Debug/Debug.js +10 -6
- package/Debug/Debug.mjs +9 -0
- package/Debug/index.js +4 -1
- package/Debug/index.mjs +1 -0
- package/Debug/package.json +2 -2
- package/Details/Details.d.ts +298 -13
- package/Details/Details.js +30 -27
- package/Details/Details.mjs +63 -0
- package/Details/index.js +4 -1
- package/Details/index.mjs +1 -0
- package/Details/package.json +2 -2
- package/Dialog/DialogMui.d.ts +328 -19
- package/Dialog/DialogMui.js +28 -25
- package/{node/Dialog/DialogMui.js → Dialog/DialogMui.mjs} +25 -28
- package/Dialog/css/bare.d.ts +352 -43
- package/Dialog/css/bare.js +21 -18
- package/Dialog/css/bare.mjs +21 -0
- package/Dialog/index.js +5 -1
- package/Dialog/index.mjs +1 -0
- package/Dialog/m/bare.d.ts +322 -13
- package/Dialog/m/bare.js +26 -23
- package/Dialog/m/bare.mjs +52 -0
- package/Dialog/m/basic.js +7 -3
- package/{node/Dialog/m/basic.js → Dialog/m/basic.mjs} +3 -7
- package/Dialog/m/index.js +7 -3
- package/Dialog/m/index.mjs +4 -0
- package/Dialog/m/package.json +2 -2
- package/Dialog/package.json +2 -2
- package/Dialog/sc/bare.d.ts +325 -17
- package/Dialog/sc/bare.js +24 -21
- package/Dialog/sc/bare.mjs +43 -0
- package/Dialog/sc/framer.d.ts +316 -7
- package/Dialog/sc/framer.js +18 -15
- package/Dialog/sc/framer.mjs +16 -0
- package/Dialog/sc/framerMaterial.d.ts +316 -7
- package/Dialog/sc/framerMaterial.js +18 -15
- package/Dialog/sc/framerMaterial.mjs +16 -0
- package/Dialog/sc/material.d.ts +325 -16
- package/Dialog/sc/material.js +22 -19
- package/Dialog/sc/material.mjs +21 -0
- package/Dialog/tw/bare.d.ts +358 -49
- package/Dialog/tw/bare.js +21 -18
- package/Dialog/tw/bare.mjs +42 -0
- package/Dialog/tw/elegant.d.ts +379 -70
- package/Dialog/tw/elegant.js +21 -18
- package/Dialog/tw/elegant.mjs +20 -0
- package/Dialog/tw/framer.d.ts +340 -31
- package/Dialog/tw/framer.js +18 -15
- package/Dialog/tw/framer.mjs +16 -0
- package/Dialog/tw/framerMaterial.d.ts +356 -47
- package/Dialog/tw/framerMaterial.js +18 -15
- package/Dialog/tw/framerMaterial.mjs +16 -0
- package/Dialog/tw/material.d.ts +379 -70
- package/Dialog/tw/material.js +21 -18
- package/Dialog/tw/material.mjs +20 -0
- package/Editor/Editor--tiptap.js +20 -15
- package/Editor/Editor--tiptap.mjs +26 -0
- package/Editor/components.js +14 -9
- package/Editor/components.mjs +10 -0
- package/Editor/index.js +4 -1
- package/Editor/index.mjs +1 -0
- package/Editor/package.json +2 -2
- package/FaviconTags/FaviconTags.js +8 -4
- package/FaviconTags/FaviconTags.mjs +16 -0
- package/FaviconTags/index.js +7 -2
- package/FaviconTags/index.mjs +2 -0
- package/FaviconTags/package.json +2 -2
- package/Form/Form.d.ts +45 -19
- package/Form/Form.js +27 -23
- package/Form/Form.mjs +61 -0
- package/Form/index.js +4 -1
- package/Form/index.mjs +1 -0
- package/Form/package.json +2 -2
- package/Form/sc/bare.d.ts +33 -8
- package/Form/sc/bare.js +21 -18
- package/Form/sc/bare.mjs +20 -0
- package/Forms/Checkbox/Checkbox.d.ts +1 -1
- package/Forms/Checkbox/Checkbox.js +16 -13
- package/Forms/Checkbox/Checkbox.mjs +18 -0
- package/Forms/Checkbox/index.js +4 -1
- package/Forms/Checkbox/index.mjs +1 -0
- package/Forms/Checkbox/package.json +2 -2
- package/Forms/Feedback/Feedback.js +10 -6
- package/Forms/Feedback/Feedback.mjs +9 -0
- package/Forms/Feedback/index.js +4 -1
- package/Forms/Feedback/index.mjs +1 -0
- package/Forms/Feedback/package.json +2 -2
- package/Forms/Field/Field.js +14 -10
- package/Forms/Field/Field.mjs +31 -0
- package/Forms/Field/FieldControl.js +18 -14
- package/Forms/Field/FieldControl.mjs +47 -0
- package/Forms/Field/FieldHint.js +6 -3
- package/Forms/Field/FieldHint.mjs +4 -0
- package/Forms/Field/index.js +5 -2
- package/Forms/Field/index.mjs +2 -0
- package/Forms/Field/package.json +2 -2
- package/Forms/Input/Input.d.ts +1 -1
- package/Forms/Input/Input.js +17 -14
- package/Forms/Input/Input.mjs +17 -0
- package/Forms/Input/index.js +4 -1
- package/Forms/Input/index.mjs +1 -0
- package/Forms/Input/package.json +2 -2
- package/Forms/InputGroup/InputGroup.js +17 -13
- package/Forms/InputGroup/InputGroup.mjs +15 -0
- package/Forms/InputGroup/index.js +4 -1
- package/Forms/InputGroup/index.mjs +1 -0
- package/Forms/InputGroup/package.json +2 -2
- package/Forms/Label/Label.js +8 -5
- package/Forms/Label/Label.mjs +6 -0
- package/Forms/Label/index.js +4 -1
- package/Forms/Label/index.mjs +1 -0
- package/Forms/Label/package.json +2 -2
- package/Forms/Password/Password.d.ts +1 -1
- package/Forms/Password/Password.js +17 -14
- package/Forms/Password/Password.mjs +17 -0
- package/Forms/Password/index.js +4 -1
- package/Forms/Password/index.mjs +1 -0
- package/Forms/Password/package.json +2 -2
- package/Forms/Radio/Radio.d.ts +1 -1
- package/Forms/Radio/Radio.js +22 -19
- package/Forms/Radio/Radio.mjs +25 -0
- package/Forms/Radio/index.js +4 -1
- package/Forms/Radio/index.mjs +1 -0
- package/Forms/Radio/package.json +2 -2
- package/Forms/Switch/Switch.d.ts +1 -1
- package/Forms/Switch/Switch.js +16 -13
- package/Forms/Switch/Switch.mjs +20 -0
- package/Forms/Switch/index.js +4 -1
- package/Forms/Switch/index.mjs +1 -0
- package/Forms/Switch/package.json +2 -2
- package/Forms/Textarea/Textarea.d.ts +1 -1
- package/Forms/Textarea/Textarea.js +13 -10
- package/Forms/Textarea/Textarea.mjs +12 -0
- package/Forms/Textarea/TextareaRich.d.ts +1 -1
- package/Forms/Textarea/TextareaRich.js +15 -12
- package/Forms/Textarea/TextareaRich.mjs +28 -0
- package/Forms/Textarea/index.js +5 -2
- package/Forms/Textarea/index.mjs +2 -0
- package/Forms/Textarea/package.json +2 -2
- package/{node/Forms/Toggle/Toggle-tailwind.js → Forms/Toggle/Toggle-tailwind.mjs} +0 -0
- package/Forms/Toggle/Toggle.js +26 -21
- package/Forms/Toggle/Toggle.mjs +31 -0
- package/Forms/Toggle/index.js +4 -1
- package/Forms/Toggle/index.mjs +1 -0
- package/Forms/Toggle/package.json +2 -2
- package/{node/Forms/Toggle/useToggle-tailwind.js → Forms/Toggle/useToggle-tailwind.mjs} +0 -0
- package/Forms/Toggle/useToggle.js +19 -15
- package/{node/Forms/Toggle/useToggle.js → Forms/Toggle/useToggle.mjs} +15 -19
- package/Forms/antispam.js +16 -10
- package/{node/Forms/antispam.js → Forms/antispam.mjs} +10 -16
- package/Forms/helpers.js +16 -8
- package/{node/Forms/helpers.js → Forms/helpers.mjs} +8 -16
- package/Forms/index.js +18 -15
- package/Forms/index.mjs +16 -0
- package/Forms/package.json +2 -2
- package/Forms/styles.js +19 -16
- package/Forms/styles.mjs +29 -0
- package/Gauge/Gauge.js +5 -1
- package/{node/Gauge/Gauge.js → Gauge/Gauge.mjs} +1 -5
- package/Grid/Grid.js +13 -10
- package/Grid/Grid.mjs +53 -0
- package/Grid/index.js +4 -1
- package/Grid/index.mjs +1 -0
- package/Grid/package.json +2 -2
- package/Hamburger/Hamburger.js +11 -7
- package/Hamburger/Hamburger.mjs +52 -0
- package/Hamburger/index.js +4 -1
- package/Hamburger/index.mjs +1 -0
- package/Hamburger/package.json +2 -2
- package/Header/index.js +4 -1
- package/Header/index.mjs +1 -0
- package/Header/package.json +2 -2
- package/Header/useHeader.js +18 -14
- package/Header/useHeader.mjs +31 -0
- package/Hidden/Hidden.js +6 -3
- package/Hidden/Hidden.mjs +10 -0
- package/Hidden/index.js +4 -1
- package/Hidden/index.mjs +1 -0
- package/Hidden/package.json +2 -2
- package/Img/index.js +4 -1
- package/Img/index.mjs +1 -0
- package/Img/package.json +2 -2
- package/Img/sc/bare.js +6 -3
- package/{node/Img/sc/bare.js → Img/sc/bare.mjs} +3 -6
- package/Img/types.js +2 -1
- package/Img/types.mjs +1 -0
- package/Link/Link.d.ts +1 -1
- package/Link/Link.js +6 -3
- package/Link/Link.mjs +4 -0
- package/Link/LinkBlank.js +15 -11
- package/Link/LinkBlank.mjs +17 -0
- package/Link/index.js +5 -2
- package/Link/index.mjs +2 -0
- package/Link/package.json +2 -2
- package/Menu/Menu.js +6 -3
- package/Menu/Menu.mjs +4 -0
- package/Menu/MenuMui.d.ts +0 -35
- package/Menu/MenuMui.js +165 -75
- package/Menu/MenuMui.mjs +165 -0
- package/Menu/index.js +4 -1
- package/Menu/index.mjs +1 -0
- package/Menu/package.json +2 -2
- package/MenuItem/MenuItem.js +6 -3
- package/MenuItem/MenuItem.mjs +4 -0
- package/MenuItem/MenuItemMui.d.ts +0 -6
- package/MenuItem/MenuItemMui.js +32 -15
- package/MenuItem/MenuItemMui.mjs +32 -0
- package/MenuItem/index.js +4 -1
- package/MenuItem/index.mjs +1 -0
- package/MenuItem/package.json +2 -2
- package/MenuItem/useMenuItem.js +20 -16
- package/{node/MenuItem/useMenuItem.js → MenuItem/useMenuItem.mjs} +16 -20
- package/Meta/Meta.js +8 -4
- package/Meta/Meta.mjs +6 -0
- package/Meta/index.js +7 -2
- package/Meta/index.mjs +2 -0
- package/Meta/package.json +2 -2
- package/NoJs/NoJs.js +8 -4
- package/NoJs/NoJs.mjs +7 -0
- package/NoJs/index.js +7 -2
- package/NoJs/index.mjs +2 -0
- package/NoJs/package.json +2 -2
- package/Pagination/PaginationNav.js +22 -18
- package/Pagination/PaginationNav.mjs +61 -0
- package/Pagination/PaginationResults.js +12 -8
- package/Pagination/PaginationResults.mjs +11 -0
- package/Pagination/index.js +5 -2
- package/Pagination/index.mjs +2 -0
- package/Pagination/package.json +2 -2
- package/Pill/Pill.js +9 -6
- package/Pill/Pill.mjs +7 -0
- package/Pill/index.js +4 -1
- package/Pill/index.mjs +1 -0
- package/Pill/package.json +2 -2
- package/Progress/ProgressCircular.js +14 -10
- package/Progress/ProgressCircular.mjs +15 -0
- package/Progress/ProgressLinear.js +13 -9
- package/Progress/ProgressLinear.mjs +24 -0
- package/Progress/ProgressOverlay.js +20 -16
- package/Progress/ProgressOverlay.mjs +24 -0
- package/Progress/index.js +6 -3
- package/Progress/index.mjs +3 -0
- package/Progress/package.json +2 -2
- package/Rating/Rating.js +26 -21
- package/Rating/Rating.mjs +70 -0
- package/Rating/index.js +13 -5
- package/{node/Rating/index.js → Rating/index.mjs} +5 -13
- package/Rating/package.json +2 -2
- package/Select/SelectDownshift.js +4 -1
- package/{node/Select/SelectDownshift.js → Select/SelectDownshift.mjs} +1 -4
- package/Select/components.js +13 -10
- package/Select/components.mjs +12 -0
- package/Select/index.js +5 -1
- package/Select/index.mjs +3 -0
- package/Select/package.json +2 -2
- package/Sidebar/Sidebar.js +21 -17
- package/Sidebar/Sidebar.mjs +23 -0
- package/Sidebar/index.js +4 -1
- package/Sidebar/index.mjs +1 -0
- package/Sidebar/package.json +2 -2
- package/Spacing/Spacing.js +15 -11
- package/Spacing/Spacing.mjs +45 -0
- package/Spacing/index.js +4 -1
- package/Spacing/index.mjs +1 -0
- package/Spacing/package.json +2 -2
- package/Sticky/Sticky.js +4 -1
- package/{node/Sticky/Sticky.js → Sticky/Sticky.mjs} +1 -4
- package/Sticky/StickyCss.js +9 -5
- package/Sticky/StickyCss.mjs +6 -0
- package/Sticky/index.js +4 -1
- package/Sticky/index.mjs +1 -0
- package/Sticky/package.json +2 -2
- package/Tabs/TabsMui.d.ts +287 -55
- package/Tabs/TabsMui.js +28 -25
- package/Tabs/TabsMui.mjs +46 -0
- package/Tabs/index.js +4 -1
- package/Tabs/index.mjs +1 -0
- package/Tabs/package.json +2 -2
- package/{node/Tabs/sc/bare.js → Tabs/sc/bare.mjs} +0 -0
- package/Tabs/tw/bare.d.ts +311 -80
- package/Tabs/tw/bare.js +17 -14
- package/Tabs/tw/bare.mjs +17 -0
- package/Tabs/tw/material.d.ts +326 -136
- package/Tabs/tw/material.js +17 -14
- package/Tabs/tw/material.mjs +18 -0
- package/Tabs/useTabs.js +12 -8
- package/{node/Tabs/useTabs.js → Tabs/useTabs.mjs} +8 -12
- package/Typography/CopyPasteVisible.js +6 -3
- package/Typography/CopyPasteVisible.mjs +4 -0
- package/Typography/Native.js +16 -13
- package/Typography/Native.mjs +14 -0
- package/Typography/ReadMore.js +28 -24
- package/Typography/ReadMore.mjs +43 -0
- package/Typography/TextLoop.js +21 -16
- package/{node/Typography/TextLoop.js → Typography/TextLoop.mjs} +16 -21
- package/Typography/TypeStairs.js +11 -8
- package/{node/Typography/TypeStairs.js → Typography/TypeStairs.mjs} +8 -11
- package/Typography/index.js +8 -5
- package/Typography/index.mjs +5 -0
- package/Typography/package.json +2 -2
- package/css/index.js +7 -2
- package/{node/tw/index.js → css/index.mjs} +2 -7
- package/css/package.json +2 -2
- package/helpers/classed.js +10 -6
- package/{node/helpers/classed.js → helpers/classed.mjs} +6 -10
- package/helpers/createUseMediaQueryWidth.js +16 -11
- package/{node/helpers/createUseMediaQueryWidth.js → helpers/createUseMediaQueryWidth.mjs} +11 -16
- package/helpers/extend-component.js +10 -6
- package/helpers/extend-component.mjs +13 -0
- package/helpers/index.js +7 -4
- package/helpers/index.mjs +4 -0
- package/helpers/mergeRefs.js +6 -2
- package/{node/helpers/mergeRefs.js → helpers/mergeRefs.mjs} +2 -6
- package/helpers/package.json +2 -2
- package/hooks/index.js +24 -21
- package/hooks/index.mjs +22 -0
- package/hooks/package.json +2 -2
- package/hooks/types.js +2 -1
- package/hooks/types.mjs +1 -0
- package/hooks/useAsyncFn.js +14 -10
- package/{node/hooks/useAsyncFn.js → hooks/useAsyncFn.mjs} +10 -14
- package/hooks/useDateLocale.js +14 -12
- package/{node/hooks/useDateLocale.js → hooks/useDateLocale.mjs} +10 -17
- package/hooks/useEffectOnce.js +8 -4
- package/hooks/useEffectOnce.mjs +9 -0
- package/hooks/useFirstMountState.js +8 -4
- package/hooks/useFirstMountState.mjs +13 -0
- package/hooks/useFixedOffset.js +21 -16
- package/hooks/useFixedOffset.mjs +57 -0
- package/hooks/useFocus.js +8 -4
- package/hooks/useFocus.mjs +12 -0
- package/hooks/useInterval.js +14 -10
- package/{node/hooks/useInterval.js → hooks/useInterval.mjs} +10 -14
- package/hooks/useIsomorphicLayoutEffect.js +10 -6
- package/hooks/useIsomorphicLayoutEffect.mjs +9 -0
- package/hooks/useKeyUp.js +12 -8
- package/{node/hooks/useKeyUp.js → hooks/useKeyUp.mjs} +8 -12
- package/hooks/useMeasure.js +30 -26
- package/{node/hooks/useMeasure.js → hooks/useMeasure.mjs} +26 -30
- package/hooks/useMount.js +8 -4
- package/hooks/useMount.mjs +10 -0
- package/hooks/useMountedState.js +10 -6
- package/hooks/useMountedState.mjs +16 -0
- package/hooks/useNavigateAway.js +13 -8
- package/{node/hooks/useNavigateAway.js → hooks/useNavigateAway.mjs} +8 -13
- package/hooks/usePrevious.js +8 -4
- package/hooks/usePrevious.mjs +12 -0
- package/hooks/usePreviousRef.js +9 -5
- package/hooks/usePreviousRef.mjs +9 -0
- package/hooks/useScrollPosition.js +16 -11
- package/{node/hooks/useScrollPosition.js → hooks/useScrollPosition.mjs} +11 -16
- package/hooks/useScrollThreshold.js +15 -10
- package/hooks/useScrollThreshold.mjs +28 -0
- package/hooks/useScrollTo.js +11 -6
- package/hooks/useScrollTo.mjs +22 -0
- package/hooks/useSmoothScroll.js +18 -13
- package/hooks/useSmoothScroll.mjs +39 -0
- package/hooks/useTraceUpdate.js +9 -5
- package/{node/hooks/useTraceUpdate.js → hooks/useTraceUpdate.mjs} +5 -9
- package/hooks/useUpdateEffect.js +10 -6
- package/hooks/useUpdateEffect.mjs +15 -0
- package/hooks/useWindowSize.js +15 -10
- package/hooks/useWindowSize.mjs +29 -0
- package/index.js +4 -1
- package/{node/index.js → index.mjs} +1 -4
- package/m/MotionProvider.js +10 -6
- package/{node/m/MotionProvider.js → m/MotionProvider.mjs} +6 -10
- package/m/index.js +4 -1
- package/m/index.mjs +6 -0
- package/m/lite.js +4 -2
- package/m/lite.mjs +2 -0
- package/m/max.js +4 -2
- package/m/max.mjs +2 -0
- package/m/package.json +2 -2
- package/package.json +26 -22
- package/sc/index.js +36 -30
- package/sc/index.mjs +31 -0
- package/sc/package.json +2 -2
- package/scm/index.js +34 -29
- package/scm/index.mjs +31 -0
- package/scm/package.json +2 -2
- package/shared/index.js +11 -8
- package/shared/index.mjs +8 -0
- package/shared/package.json +2 -2
- package/styles/Body.js +7 -4
- package/styles/Body.mjs +13 -0
- package/styles/Global.js +7 -4
- package/styles/Global.mjs +18 -0
- package/styles/index.js +10 -7
- package/styles/index.mjs +7 -0
- package/styles/media.js +13 -8
- package/{node/styles/media.js → styles/media.mjs} +8 -13
- package/styles/package.json +2 -2
- package/styles/spacing.js +11 -4
- package/{node/styles/spacing.js → styles/spacing.mjs} +4 -11
- package/styles/styled.js +11 -7
- package/styles/styled.mjs +13 -0
- package/styles/theme--vanilla.js +32 -26
- package/styles/theme--vanilla.mjs +58 -0
- package/styles/theme.js +12 -8
- package/{node/styles/theme.js → styles/theme.mjs} +8 -12
- package/tw/index.js +7 -2
- package/{node/css/index.js → tw/index.mjs} +2 -7
- package/tw/package.json +2 -2
- package/twm/index.js +7 -2
- package/{node/twm/index.js → twm/index.mjs} +2 -7
- package/twm/package.json +2 -2
- package/types.js +2 -1
- package/types.mjs +1 -0
- package/node/Alert/Alert.js +0 -14
- package/node/Alert/index.js +0 -4
- package/node/Animations/Reveal.js +0 -21
- package/node/Animations/Underline.js +0 -8
- package/node/Animations/index.js +0 -6
- package/node/Autocomplete/components.js +0 -37
- package/node/Autocomplete/index.js +0 -7
- package/node/Bg/BgColor.js +0 -25
- package/node/Bg/BgPhoto.js +0 -20
- package/node/Bg/BgSvg.js +0 -16
- package/node/Bg/index.js +0 -6
- package/node/Breadcrumbs/Breadcrumbs.js +0 -31
- package/node/Breadcrumbs/index.js +0 -4
- package/node/Buttons/Button.js +0 -17
- package/node/Buttons/ButtonComposite.js +0 -32
- package/node/Buttons/ButtonFab.js +0 -9
- package/node/Buttons/ButtonLink.js +0 -15
- package/node/Buttons/IconButton.js +0 -10
- package/node/Buttons/index.js +0 -8
- package/node/Calendar/CalendarDaygridNav.js +0 -28
- package/node/Calendar/CalendarLegend.js +0 -20
- package/node/Calendar/index.js +0 -9
- package/node/Calendar/types.js +0 -2
- package/node/Carousel/CarouselCss.js +0 -26
- package/node/Carousel/index.js +0 -4
- package/node/Collapsable/Collapsable.js +0 -4
- package/node/Collapsable/index.js +0 -5
- package/node/Debug/Debug.js +0 -13
- package/node/Debug/index.js +0 -4
- package/node/Details/Details.js +0 -66
- package/node/Details/index.js +0 -4
- package/node/Dialog/css/bare.js +0 -24
- package/node/Dialog/index.js +0 -5
- package/node/Dialog/m/bare.js +0 -55
- package/node/Dialog/m/index.js +0 -8
- package/node/Dialog/sc/bare.js +0 -46
- package/node/Dialog/sc/framer.js +0 -19
- package/node/Dialog/sc/framerMaterial.js +0 -19
- package/node/Dialog/sc/material.js +0 -24
- package/node/Dialog/tw/bare.js +0 -45
- package/node/Dialog/tw/elegant.js +0 -23
- package/node/Dialog/tw/framer.js +0 -19
- package/node/Dialog/tw/framerMaterial.js +0 -19
- package/node/Dialog/tw/material.js +0 -23
- package/node/Editor/Editor--tiptap.js +0 -31
- package/node/Editor/components.js +0 -15
- package/node/Editor/index.js +0 -4
- package/node/FaviconTags/FaviconTags.js +0 -20
- package/node/FaviconTags/index.js +0 -7
- package/node/Form/Form.js +0 -65
- package/node/Form/index.js +0 -4
- package/node/Form/sc/bare.js +0 -23
- package/node/Forms/Checkbox/Checkbox.js +0 -21
- package/node/Forms/Checkbox/index.js +0 -4
- package/node/Forms/Feedback/Feedback.js +0 -13
- package/node/Forms/Feedback/index.js +0 -4
- package/node/Forms/Field/Field.js +0 -35
- package/node/Forms/Field/FieldControl.js +0 -51
- package/node/Forms/Field/FieldHint.js +0 -7
- package/node/Forms/Field/index.js +0 -5
- package/node/Forms/Input/Input.js +0 -20
- package/node/Forms/Input/index.js +0 -4
- package/node/Forms/InputGroup/InputGroup.js +0 -19
- package/node/Forms/InputGroup/index.js +0 -4
- package/node/Forms/Label/Label.js +0 -9
- package/node/Forms/Label/index.js +0 -4
- package/node/Forms/Password/Password.js +0 -20
- package/node/Forms/Password/index.js +0 -4
- package/node/Forms/Radio/Radio.js +0 -28
- package/node/Forms/Radio/index.js +0 -4
- package/node/Forms/Switch/Switch.js +0 -23
- package/node/Forms/Switch/index.js +0 -4
- package/node/Forms/Textarea/Textarea.js +0 -15
- package/node/Forms/Textarea/TextareaRich.js +0 -31
- package/node/Forms/Textarea/index.js +0 -5
- package/node/Forms/Toggle/Toggle.js +0 -36
- package/node/Forms/Toggle/index.js +0 -4
- package/node/Forms/index.js +0 -19
- package/node/Forms/styles.js +0 -32
- package/node/Grid/Grid.js +0 -56
- package/node/Grid/index.js +0 -4
- package/node/Hamburger/Hamburger.js +0 -56
- package/node/Hamburger/index.js +0 -4
- package/node/Header/index.js +0 -4
- package/node/Header/useHeader.js +0 -35
- package/node/Hidden/Hidden.js +0 -13
- package/node/Hidden/index.js +0 -4
- package/node/Img/index.js +0 -4
- package/node/Img/types.js +0 -2
- package/node/Link/Link.js +0 -7
- package/node/Link/LinkBlank.js +0 -21
- package/node/Link/index.js +0 -5
- package/node/Menu/Menu.js +0 -7
- package/node/Menu/MenuMui.js +0 -78
- package/node/Menu/index.js +0 -4
- package/node/MenuItem/MenuItem.js +0 -7
- package/node/MenuItem/MenuItemMui.js +0 -18
- package/node/MenuItem/index.js +0 -4
- package/node/Meta/Meta.js +0 -10
- package/node/Meta/index.js +0 -7
- package/node/NoJs/NoJs.js +0 -11
- package/node/NoJs/index.js +0 -7
- package/node/Pagination/PaginationNav.js +0 -65
- package/node/Pagination/PaginationResults.js +0 -15
- package/node/Pagination/index.js +0 -5
- package/node/Pill/Pill.js +0 -10
- package/node/Pill/index.js +0 -4
- package/node/Progress/ProgressCircular.js +0 -19
- package/node/Progress/ProgressLinear.js +0 -28
- package/node/Progress/ProgressOverlay.js +0 -28
- package/node/Progress/index.js +0 -6
- package/node/Rating/Rating.js +0 -75
- package/node/Select/components.js +0 -15
- package/node/Select/index.js +0 -7
- package/node/Sidebar/Sidebar.js +0 -27
- package/node/Sidebar/index.js +0 -4
- package/node/Spacing/Spacing.js +0 -49
- package/node/Spacing/index.js +0 -4
- package/node/Sticky/StickyCss.js +0 -10
- package/node/Sticky/index.js +0 -4
- package/node/Tabs/TabsMui.js +0 -49
- package/node/Tabs/index.js +0 -4
- package/node/Tabs/tw/bare.js +0 -20
- package/node/Tabs/tw/material.js +0 -21
- package/node/Typography/CopyPasteVisible.js +0 -7
- package/node/Typography/Native.js +0 -17
- package/node/Typography/ReadMore.js +0 -47
- package/node/Typography/index.js +0 -8
- package/node/helpers/extend-component.js +0 -17
- package/node/helpers/index.js +0 -7
- package/node/hooks/index.js +0 -25
- package/node/hooks/types.js +0 -2
- package/node/hooks/useEffectOnce.js +0 -13
- package/node/hooks/useFirstMountState.js +0 -17
- package/node/hooks/useFixedOffset.js +0 -62
- package/node/hooks/useFocus.js +0 -16
- package/node/hooks/useIsomorphicLayoutEffect.js +0 -13
- package/node/hooks/useMount.js +0 -14
- package/node/hooks/useMountedState.js +0 -20
- package/node/hooks/usePrevious.js +0 -16
- package/node/hooks/usePreviousRef.js +0 -13
- package/node/hooks/useScrollThreshold.js +0 -33
- package/node/hooks/useScrollTo.js +0 -27
- package/node/hooks/useSmoothScroll.js +0 -44
- package/node/hooks/useUpdateEffect.js +0 -19
- package/node/hooks/useWindowSize.js +0 -34
- package/node/m/index.js +0 -9
- package/node/m/lite.js +0 -4
- package/node/m/max.js +0 -4
- package/node/sc/index.js +0 -37
- package/node/scm/index.js +0 -36
- package/node/shared/index.js +0 -11
- package/node/styles/Body.js +0 -16
- package/node/styles/Global.js +0 -21
- package/node/styles/index.js +0 -10
- package/node/styles/styled.js +0 -17
- package/node/styles/theme--vanilla.js +0 -64
- package/node/types.js +0 -2
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var listenScrollDebounced_1 = tslib_1.__importDefault(require("@koine/dom/listenScrollDebounced"));
|
|
10
|
-
var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
11
|
-
var off_1 = tslib_1.__importDefault(require("@koine/dom/off"));
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
|
+
import { useEffect, useState, useRef, useMemo } from "react";
|
|
3
|
+
import debounce from "@koine/utils/debounce";
|
|
4
|
+
import noop from "@koine/utils/noop";
|
|
5
|
+
import listenResizeDebounced from "@koine/dom/listenResizeDebounced";
|
|
6
|
+
import listenScrollDebounced from "@koine/dom/listenScrollDebounced";
|
|
7
|
+
import on from "@koine/dom/on";
|
|
8
|
+
import off from "@koine/dom/off";
|
|
12
9
|
var observer;
|
|
13
10
|
// Returns a list of scroll offsets
|
|
14
11
|
function findScrollContainers(element) {
|
|
@@ -18,7 +15,7 @@ function findScrollContainers(element) {
|
|
|
18
15
|
var _a = window.getComputedStyle(element), overflow = _a.overflow, overflowX = _a.overflowX, overflowY = _a.overflowY;
|
|
19
16
|
if ([overflow, overflowX, overflowY].some(function (prop) { return prop === "auto" || prop === "scroll"; }))
|
|
20
17
|
result.push(element);
|
|
21
|
-
return
|
|
18
|
+
return __spreadArray(__spreadArray([], result, true), findScrollContainers(element.parentElement), true);
|
|
22
19
|
}
|
|
23
20
|
var keys = [
|
|
24
21
|
"x",
|
|
@@ -38,9 +35,9 @@ var areBoundsEqual = function (a, b) {
|
|
|
38
35
|
*
|
|
39
36
|
* @borrows [pmndrs/react-use-measure](https://github.com/pmndrs/react-use-measure)
|
|
40
37
|
*/
|
|
41
|
-
function useMeasure(options) {
|
|
38
|
+
export function useMeasure(options) {
|
|
42
39
|
var _a = (options || {}).scroll /* offsetSize = false */, scroll = _a === void 0 ? false : _a /* offsetSize = false */;
|
|
43
|
-
var _b =
|
|
40
|
+
var _b = useState({
|
|
44
41
|
left: 0,
|
|
45
42
|
top: 0,
|
|
46
43
|
width: 0,
|
|
@@ -51,7 +48,7 @@ function useMeasure(options) {
|
|
|
51
48
|
y: 0,
|
|
52
49
|
}), bounds = _b[0], setBounds = _b[1];
|
|
53
50
|
// keep all state in a ref
|
|
54
|
-
var state =
|
|
51
|
+
var state = useRef([
|
|
55
52
|
// element
|
|
56
53
|
null,
|
|
57
54
|
// scrollContainers
|
|
@@ -62,13 +59,13 @@ function useMeasure(options) {
|
|
|
62
59
|
bounds,
|
|
63
60
|
]);
|
|
64
61
|
// make sure to update state only as long as the component is truly mounted
|
|
65
|
-
var mounted =
|
|
66
|
-
|
|
62
|
+
var mounted = useRef(false);
|
|
63
|
+
useEffect(function () {
|
|
67
64
|
mounted.current = true;
|
|
68
65
|
return function () { return void (mounted.current = false); };
|
|
69
66
|
}, []);
|
|
70
67
|
// memoize handlers, so event-listeners know when they should update
|
|
71
|
-
var _c =
|
|
68
|
+
var _c = useMemo(function () {
|
|
72
69
|
var callback = function () {
|
|
73
70
|
var _args = [];
|
|
74
71
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -88,7 +85,7 @@ function useMeasure(options) {
|
|
|
88
85
|
setBounds(size);
|
|
89
86
|
}
|
|
90
87
|
};
|
|
91
|
-
var debouncedCallback = (
|
|
88
|
+
var debouncedCallback = debounce(callback);
|
|
92
89
|
return [callback, debouncedCallback, debouncedCallback];
|
|
93
90
|
}, [setBounds /* , offsetSize */]), forceRefresh = _c[0] /* resizeChange */, scrollChange = _c[2];
|
|
94
91
|
// cleanup current scroll-listeners / observers
|
|
@@ -96,7 +93,7 @@ function useMeasure(options) {
|
|
|
96
93
|
var _a = state.current, scrollContainers = _a[1], resizeObserver = _a[2];
|
|
97
94
|
if (scrollContainers) {
|
|
98
95
|
scrollContainers.forEach(function (element) {
|
|
99
|
-
return (
|
|
96
|
+
return off(element, "scroll", scrollChange);
|
|
100
97
|
});
|
|
101
98
|
state.current[1] = null;
|
|
102
99
|
}
|
|
@@ -116,7 +113,7 @@ function useMeasure(options) {
|
|
|
116
113
|
observer.observe(element);
|
|
117
114
|
if (scroll && scrollContainers) {
|
|
118
115
|
scrollContainers.forEach(function (scrollContainer) {
|
|
119
|
-
return (
|
|
116
|
+
return on(scrollContainer, "scroll", scrollChange, {
|
|
120
117
|
capture: true,
|
|
121
118
|
passive: true,
|
|
122
119
|
});
|
|
@@ -139,26 +136,26 @@ function useMeasure(options) {
|
|
|
139
136
|
// debugger;
|
|
140
137
|
// forceRefresh();
|
|
141
138
|
// });
|
|
142
|
-
|
|
139
|
+
useEffect(function () {
|
|
143
140
|
if (scroll) {
|
|
144
|
-
var listener = (0,
|
|
141
|
+
var listener = listenScrollDebounced(0, forceRefresh, 100);
|
|
145
142
|
return listener;
|
|
146
143
|
}
|
|
147
|
-
return
|
|
144
|
+
return noop;
|
|
148
145
|
}, [scroll, forceRefresh]);
|
|
149
|
-
|
|
146
|
+
useEffect(function () {
|
|
150
147
|
// const listener = listenResizeDebounced(onWindowResize);
|
|
151
148
|
// return listener;
|
|
152
|
-
var listener = (0,
|
|
149
|
+
var listener = listenResizeDebounced(0, forceRefresh, 100);
|
|
153
150
|
return listener;
|
|
154
151
|
}, [forceRefresh]);
|
|
155
152
|
// respond to changes that are relevant for the listeners
|
|
156
|
-
|
|
153
|
+
useEffect(function () {
|
|
157
154
|
removeListeners();
|
|
158
155
|
addListeners();
|
|
159
156
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
157
|
}, [scroll /* , scrollChange, resizeChange */]);
|
|
161
|
-
|
|
158
|
+
useEffect(function () {
|
|
162
159
|
// operate on mount, @kuus on the original version there is no call on mount?
|
|
163
160
|
forceRefresh();
|
|
164
161
|
// remove all listeners when the components unmounts
|
|
@@ -167,5 +164,4 @@ function useMeasure(options) {
|
|
|
167
164
|
}, []);
|
|
168
165
|
return [ref, bounds, forceRefresh];
|
|
169
166
|
}
|
|
170
|
-
|
|
171
|
-
exports.default = useMeasure;
|
|
167
|
+
export default useMeasure;
|
package/hooks/useMount.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMount = void 0;
|
|
4
|
+
var useEffectOnce_1 = require("./useEffectOnce");
|
|
2
5
|
/**
|
|
3
6
|
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMount.ts)
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
useEffectOnce(function () {
|
|
8
|
+
var useMount = function (fn) {
|
|
9
|
+
(0, useEffectOnce_1.useEffectOnce)(function () {
|
|
7
10
|
fn();
|
|
8
11
|
});
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
exports.useMount = useMount;
|
|
14
|
+
exports.default = exports.useMount;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useEffectOnce } from "./useEffectOnce";
|
|
2
|
+
/**
|
|
3
|
+
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMount.ts)
|
|
4
|
+
*/
|
|
5
|
+
export var useMount = function (fn) {
|
|
6
|
+
useEffectOnce(function () {
|
|
7
|
+
fn();
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export default useMount;
|
package/hooks/useMountedState.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMountedState = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
2
5
|
/**
|
|
3
6
|
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMountedState.ts)
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
var mountedRef = useRef(false);
|
|
7
|
-
var get = useCallback(function () { return mountedRef.current; }, []);
|
|
8
|
-
useEffect(function () {
|
|
8
|
+
function useMountedState() {
|
|
9
|
+
var mountedRef = (0, react_1.useRef)(false);
|
|
10
|
+
var get = (0, react_1.useCallback)(function () { return mountedRef.current; }, []);
|
|
11
|
+
(0, react_1.useEffect)(function () {
|
|
9
12
|
mountedRef.current = true;
|
|
10
13
|
return function () {
|
|
11
14
|
mountedRef.current = false;
|
|
@@ -13,4 +16,5 @@ export function useMountedState() {
|
|
|
13
16
|
}, []);
|
|
14
17
|
return get;
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
exports.useMountedState = useMountedState;
|
|
20
|
+
exports.default = useMountedState;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMountedState.ts)
|
|
4
|
+
*/
|
|
5
|
+
export function useMountedState() {
|
|
6
|
+
var mountedRef = useRef(false);
|
|
7
|
+
var get = useCallback(function () { return mountedRef.current; }, []);
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
mountedRef.current = true;
|
|
10
|
+
return function () {
|
|
11
|
+
mountedRef.current = false;
|
|
12
|
+
};
|
|
13
|
+
}, []);
|
|
14
|
+
return get;
|
|
15
|
+
}
|
|
16
|
+
export default useMountedState;
|
package/hooks/useNavigateAway.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNavigateAway = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
3
7
|
// type UseNavigateAwayPagehideHandler = (event: PageTransitionEvent) => unknown;
|
|
4
8
|
/**
|
|
5
9
|
* @resources
|
|
@@ -20,10 +24,10 @@ import on from "@koine/dom/on";
|
|
|
20
24
|
* For the callback technique see:
|
|
21
25
|
* - https://stackoverflow.com/a/11835394/1938970
|
|
22
26
|
*/
|
|
23
|
-
|
|
24
|
-
var beforeUnloadHandlerRef = useRef();
|
|
27
|
+
var useNavigateAway = function (handler) {
|
|
28
|
+
var beforeUnloadHandlerRef = (0, react_1.useRef)();
|
|
25
29
|
// const pagehideHandlerRef = useRef<UseNavigateAwayPagehideHandler | undefined>();
|
|
26
|
-
useEffect(function () {
|
|
30
|
+
(0, react_1.useEffect)(function () {
|
|
27
31
|
beforeUnloadHandlerRef.current = function (event) {
|
|
28
32
|
var customMessageOrCondition = handler(event);
|
|
29
33
|
if (customMessageOrCondition) {
|
|
@@ -53,8 +57,8 @@ export var useNavigateAway = function (handler) {
|
|
|
53
57
|
// }
|
|
54
58
|
// };
|
|
55
59
|
}, [handler]);
|
|
56
|
-
useEffect(function () {
|
|
57
|
-
var listenerBeforeunload =
|
|
60
|
+
(0, react_1.useEffect)(function () {
|
|
61
|
+
var listenerBeforeunload = (0, on_1.default)(window, "beforeunload", function (event) { var _a; return (_a = beforeUnloadHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(beforeUnloadHandlerRef, event); });
|
|
58
62
|
// const listenerPagehide = on(window, "pagehide", (event) =>
|
|
59
63
|
// pagehideHandlerRef.current?.(event)
|
|
60
64
|
// );
|
|
@@ -65,4 +69,5 @@ export var useNavigateAway = function (handler) {
|
|
|
65
69
|
// };
|
|
66
70
|
}, []);
|
|
67
71
|
};
|
|
68
|
-
|
|
72
|
+
exports.useNavigateAway = useNavigateAway;
|
|
73
|
+
exports.default = exports.useNavigateAway;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useNavigateAway = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import on from "@koine/dom/on";
|
|
7
3
|
// type UseNavigateAwayPagehideHandler = (event: PageTransitionEvent) => unknown;
|
|
8
4
|
/**
|
|
9
5
|
* @resources
|
|
@@ -24,10 +20,10 @@ var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
|
24
20
|
* For the callback technique see:
|
|
25
21
|
* - https://stackoverflow.com/a/11835394/1938970
|
|
26
22
|
*/
|
|
27
|
-
var useNavigateAway = function (handler) {
|
|
28
|
-
var beforeUnloadHandlerRef =
|
|
23
|
+
export var useNavigateAway = function (handler) {
|
|
24
|
+
var beforeUnloadHandlerRef = useRef();
|
|
29
25
|
// const pagehideHandlerRef = useRef<UseNavigateAwayPagehideHandler | undefined>();
|
|
30
|
-
|
|
26
|
+
useEffect(function () {
|
|
31
27
|
beforeUnloadHandlerRef.current = function (event) {
|
|
32
28
|
var customMessageOrCondition = handler(event);
|
|
33
29
|
if (customMessageOrCondition) {
|
|
@@ -57,8 +53,8 @@ var useNavigateAway = function (handler) {
|
|
|
57
53
|
// }
|
|
58
54
|
// };
|
|
59
55
|
}, [handler]);
|
|
60
|
-
|
|
61
|
-
var listenerBeforeunload = (
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
var listenerBeforeunload = on(window, "beforeunload", function (event) { var _a; return (_a = beforeUnloadHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(beforeUnloadHandlerRef, event); });
|
|
62
58
|
// const listenerPagehide = on(window, "pagehide", (event) =>
|
|
63
59
|
// pagehideHandlerRef.current?.(event)
|
|
64
60
|
// );
|
|
@@ -69,5 +65,4 @@ var useNavigateAway = function (handler) {
|
|
|
69
65
|
// };
|
|
70
66
|
}, []);
|
|
71
67
|
};
|
|
72
|
-
|
|
73
|
-
exports.default = exports.useNavigateAway;
|
|
68
|
+
export default useNavigateAway;
|
package/hooks/usePrevious.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePrevious = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
2
5
|
/**
|
|
3
6
|
* @borrows [samselikoff/animated-carousel](https://github.com/samselikoff/2022-06-02-animated-carousel/blob/main/pages/final.jsx)
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
var _a = useState([state, defaulValue]), tuple = _a[0], setTuple = _a[1];
|
|
8
|
+
function usePrevious(state, defaulValue) {
|
|
9
|
+
var _a = (0, react_1.useState)([state, defaulValue]), tuple = _a[0], setTuple = _a[1];
|
|
7
10
|
if (tuple[1] !== state) {
|
|
8
11
|
setTuple([tuple[1], state]);
|
|
9
12
|
}
|
|
10
13
|
return tuple[0];
|
|
11
14
|
}
|
|
12
|
-
|
|
15
|
+
exports.usePrevious = usePrevious;
|
|
16
|
+
exports.default = usePrevious;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @borrows [samselikoff/animated-carousel](https://github.com/samselikoff/2022-06-02-animated-carousel/blob/main/pages/final.jsx)
|
|
4
|
+
*/
|
|
5
|
+
export function usePrevious(state, defaulValue) {
|
|
6
|
+
var _a = useState([state, defaulValue]), tuple = _a[0], setTuple = _a[1];
|
|
7
|
+
if (tuple[1] !== state) {
|
|
8
|
+
setTuple([tuple[1], state]);
|
|
9
|
+
}
|
|
10
|
+
return tuple[0];
|
|
11
|
+
}
|
|
12
|
+
export default usePrevious;
|
package/hooks/usePreviousRef.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePreviousRef = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
function usePreviousRef(value) {
|
|
6
|
+
var ref = (0, react_1.useRef)();
|
|
7
|
+
(0, react_1.useEffect)(function () {
|
|
5
8
|
ref.current = value;
|
|
6
9
|
});
|
|
7
10
|
return ref.current;
|
|
8
11
|
}
|
|
9
|
-
|
|
12
|
+
exports.usePreviousRef = usePreviousRef;
|
|
13
|
+
exports.default = usePreviousRef;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useScrollPosition = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var isBrowser_1 = tslib_1.__importDefault(require("@koine/utils/isBrowser"));
|
|
7
|
+
var listenScroll_1 = tslib_1.__importDefault(require("@koine/dom/listenScroll"));
|
|
8
|
+
var useIsomorphicLayoutEffect_1 = tslib_1.__importDefault(require("./useIsomorphicLayoutEffect"));
|
|
5
9
|
var zeroPosition = { x: 0, y: 0 };
|
|
6
10
|
var getClientRect = function (element) {
|
|
7
11
|
return element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
|
|
8
12
|
};
|
|
9
13
|
var getScrollPosition = function (element, boundingElement) {
|
|
10
|
-
if (!
|
|
14
|
+
if (!isBrowser_1.default) {
|
|
11
15
|
return zeroPosition;
|
|
12
16
|
}
|
|
13
17
|
if (!boundingElement) {
|
|
@@ -32,9 +36,9 @@ var getScrollPosition = function (element, boundingElement) {
|
|
|
32
36
|
* - reused internal helper functions
|
|
33
37
|
* - compacted object arguments in functions as plain argument list to improve compression
|
|
34
38
|
*/
|
|
35
|
-
|
|
39
|
+
var useScrollPosition = function (effect, deps, element, boundingElement, wait) {
|
|
36
40
|
if (deps === void 0) { deps = []; }
|
|
37
|
-
var position = useRef(getScrollPosition(null, boundingElement));
|
|
41
|
+
var position = (0, react_1.useRef)(getScrollPosition(null, boundingElement));
|
|
38
42
|
var throttleTimeout = null;
|
|
39
43
|
var callBack = function () {
|
|
40
44
|
var current = getScrollPosition(element, boundingElement);
|
|
@@ -42,8 +46,8 @@ export var useScrollPosition = function (effect, deps, element, boundingElement,
|
|
|
42
46
|
position.current = current;
|
|
43
47
|
throttleTimeout = null;
|
|
44
48
|
};
|
|
45
|
-
|
|
46
|
-
if (!
|
|
49
|
+
(0, useIsomorphicLayoutEffect_1.default)(function () {
|
|
50
|
+
if (!isBrowser_1.default) {
|
|
47
51
|
return undefined;
|
|
48
52
|
}
|
|
49
53
|
var handleScroll = function () {
|
|
@@ -56,7 +60,7 @@ export var useScrollPosition = function (effect, deps, element, boundingElement,
|
|
|
56
60
|
callBack();
|
|
57
61
|
}
|
|
58
62
|
};
|
|
59
|
-
var listener =
|
|
63
|
+
var listener = (0, listenScroll_1.default)(handleScroll, boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
|
|
60
64
|
return function () {
|
|
61
65
|
listener();
|
|
62
66
|
if (throttleTimeout) {
|
|
@@ -65,4 +69,5 @@ export var useScrollPosition = function (effect, deps, element, boundingElement,
|
|
|
65
69
|
};
|
|
66
70
|
}, deps);
|
|
67
71
|
};
|
|
68
|
-
|
|
72
|
+
exports.useScrollPosition = useScrollPosition;
|
|
73
|
+
exports.default = exports.useScrollPosition;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var isBrowser_1 = tslib_1.__importDefault(require("@koine/utils/isBrowser"));
|
|
7
|
-
var listenScroll_1 = tslib_1.__importDefault(require("@koine/dom/listenScroll"));
|
|
8
|
-
var useIsomorphicLayoutEffect_1 = tslib_1.__importDefault(require("./useIsomorphicLayoutEffect"));
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import isBrowser from "@koine/utils/isBrowser";
|
|
3
|
+
import listenScroll from "@koine/dom/listenScroll";
|
|
4
|
+
import useIsomorphicLayoutEffect from "./useIsomorphicLayoutEffect";
|
|
9
5
|
var zeroPosition = { x: 0, y: 0 };
|
|
10
6
|
var getClientRect = function (element) {
|
|
11
7
|
return element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
|
|
12
8
|
};
|
|
13
9
|
var getScrollPosition = function (element, boundingElement) {
|
|
14
|
-
if (!
|
|
10
|
+
if (!isBrowser) {
|
|
15
11
|
return zeroPosition;
|
|
16
12
|
}
|
|
17
13
|
if (!boundingElement) {
|
|
@@ -36,9 +32,9 @@ var getScrollPosition = function (element, boundingElement) {
|
|
|
36
32
|
* - reused internal helper functions
|
|
37
33
|
* - compacted object arguments in functions as plain argument list to improve compression
|
|
38
34
|
*/
|
|
39
|
-
var useScrollPosition = function (effect, deps, element, boundingElement, wait) {
|
|
35
|
+
export var useScrollPosition = function (effect, deps, element, boundingElement, wait) {
|
|
40
36
|
if (deps === void 0) { deps = []; }
|
|
41
|
-
var position =
|
|
37
|
+
var position = useRef(getScrollPosition(null, boundingElement));
|
|
42
38
|
var throttleTimeout = null;
|
|
43
39
|
var callBack = function () {
|
|
44
40
|
var current = getScrollPosition(element, boundingElement);
|
|
@@ -46,8 +42,8 @@ var useScrollPosition = function (effect, deps, element, boundingElement, wait)
|
|
|
46
42
|
position.current = current;
|
|
47
43
|
throttleTimeout = null;
|
|
48
44
|
};
|
|
49
|
-
(
|
|
50
|
-
if (!
|
|
45
|
+
useIsomorphicLayoutEffect(function () {
|
|
46
|
+
if (!isBrowser) {
|
|
51
47
|
return undefined;
|
|
52
48
|
}
|
|
53
49
|
var handleScroll = function () {
|
|
@@ -60,7 +56,7 @@ var useScrollPosition = function (effect, deps, element, boundingElement, wait)
|
|
|
60
56
|
callBack();
|
|
61
57
|
}
|
|
62
58
|
};
|
|
63
|
-
var listener = (
|
|
59
|
+
var listener = listenScroll(handleScroll, boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
|
|
64
60
|
return function () {
|
|
65
61
|
listener();
|
|
66
62
|
if (throttleTimeout) {
|
|
@@ -69,5 +65,4 @@ var useScrollPosition = function (effect, deps, element, boundingElement, wait)
|
|
|
69
65
|
};
|
|
70
66
|
}, deps);
|
|
71
67
|
};
|
|
72
|
-
|
|
73
|
-
exports.default = exports.useScrollPosition;
|
|
68
|
+
export default useScrollPosition;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useScrollThreshold = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var noop_1 = tslib_1.__importDefault(require("@koine/utils/noop"));
|
|
7
|
+
var listenScroll_1 = tslib_1.__importDefault(require("@koine/dom/listenScroll"));
|
|
8
|
+
var useScrollThreshold = function (threshold, callback) {
|
|
9
|
+
var _a = (0, react_1.useState)(false), isBelow = _a[0], setIsBelow = _a[1];
|
|
10
|
+
var handler = (0, react_1.useCallback)(function () {
|
|
7
11
|
if (threshold) {
|
|
8
12
|
var posY = window.scrollY; // * -1;
|
|
9
13
|
var isAbove = posY < threshold;
|
|
@@ -14,15 +18,16 @@ export var useScrollThreshold = function (threshold, callback) {
|
|
|
14
18
|
callback(isAbove, isBelow_1);
|
|
15
19
|
}
|
|
16
20
|
}, [threshold, callback]);
|
|
17
|
-
useEffect(function () {
|
|
21
|
+
(0, react_1.useEffect)(function () {
|
|
18
22
|
if (threshold) {
|
|
19
23
|
// const listener = listenScrollThrottled(0, handler, 50);
|
|
20
|
-
var listener =
|
|
24
|
+
var listener = (0, listenScroll_1.default)(handler);
|
|
21
25
|
handler();
|
|
22
26
|
return listener;
|
|
23
27
|
}
|
|
24
|
-
return
|
|
28
|
+
return noop_1.default;
|
|
25
29
|
}, [threshold, handler]);
|
|
26
30
|
return isBelow;
|
|
27
31
|
};
|
|
28
|
-
|
|
32
|
+
exports.useScrollThreshold = useScrollThreshold;
|
|
33
|
+
exports.default = exports.useScrollThreshold;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import noop from "@koine/utils/noop";
|
|
3
|
+
import listenScroll from "@koine/dom/listenScroll";
|
|
4
|
+
export var useScrollThreshold = function (threshold, callback) {
|
|
5
|
+
var _a = useState(false), isBelow = _a[0], setIsBelow = _a[1];
|
|
6
|
+
var handler = useCallback(function () {
|
|
7
|
+
if (threshold) {
|
|
8
|
+
var posY = window.scrollY; // * -1;
|
|
9
|
+
var isAbove = posY < threshold;
|
|
10
|
+
var isBelow_1 = posY > threshold;
|
|
11
|
+
// console.log("useScrollThreshold setIsBelow", isBelow, posY, threshold);
|
|
12
|
+
setIsBelow(isBelow_1);
|
|
13
|
+
if (callback)
|
|
14
|
+
callback(isAbove, isBelow_1);
|
|
15
|
+
}
|
|
16
|
+
}, [threshold, callback]);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
if (threshold) {
|
|
19
|
+
// const listener = listenScrollThrottled(0, handler, 50);
|
|
20
|
+
var listener = listenScroll(handler);
|
|
21
|
+
handler();
|
|
22
|
+
return listener;
|
|
23
|
+
}
|
|
24
|
+
return noop;
|
|
25
|
+
}, [threshold, handler]);
|
|
26
|
+
return isBelow;
|
|
27
|
+
};
|
|
28
|
+
export default useScrollThreshold;
|
package/hooks/useScrollTo.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useScrollTo = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("@koine/utils/isBrowser"));
|
|
6
|
+
var useHeader_1 = tslib_1.__importDefault(require("../Header/useHeader"));
|
|
7
|
+
function useScrollTo(id, offset) {
|
|
4
8
|
if (id === void 0) { id = ""; }
|
|
5
9
|
if (offset === void 0) { offset = 0; }
|
|
6
|
-
var _a =
|
|
7
|
-
if (!
|
|
10
|
+
var _a = (0, useHeader_1.default)(), headerHeight = _a[2];
|
|
11
|
+
if (!isBrowser_1.default) {
|
|
8
12
|
return;
|
|
9
13
|
}
|
|
10
14
|
var headerOffset = headerHeight || 0;
|
|
@@ -19,4 +23,5 @@ export function useScrollTo(id, offset) {
|
|
|
19
23
|
top -= headerOffset;
|
|
20
24
|
window.scroll(0, top);
|
|
21
25
|
}
|
|
22
|
-
|
|
26
|
+
exports.useScrollTo = useScrollTo;
|
|
27
|
+
exports.default = useScrollTo;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import isBrowser from "@koine/utils/isBrowser";
|
|
2
|
+
import useHeader from "../Header/useHeader";
|
|
3
|
+
export function useScrollTo(id, offset) {
|
|
4
|
+
if (id === void 0) { id = ""; }
|
|
5
|
+
if (offset === void 0) { offset = 0; }
|
|
6
|
+
var _a = useHeader(), headerHeight = _a[2];
|
|
7
|
+
if (!isBrowser) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
var headerOffset = headerHeight || 0;
|
|
11
|
+
var element = document.getElementById(id);
|
|
12
|
+
var top = 0;
|
|
13
|
+
if (element && element.offsetParent) {
|
|
14
|
+
do {
|
|
15
|
+
top += element.offsetTop;
|
|
16
|
+
} while ((element = element.offsetParent));
|
|
17
|
+
}
|
|
18
|
+
top -= offset;
|
|
19
|
+
top -= headerOffset;
|
|
20
|
+
window.scroll(0, top);
|
|
21
|
+
}
|
|
22
|
+
export default useScrollTo;
|