2.0.4 • Published 18 days ago

@zohodesk/hooks v2.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
18 days ago

#UNIFIED COMPONENTS LIBRARY - Hooks

In this package, We provide below react hooks for components development.

  • useAccordion
  • useAccordionHeight
  • useAvatar
  • useDateTime
  • useCalendar
  • useTime
  • useEventListener
  • useFileUpload
  • useFloating
  • useMediaViewer
  • useModal
  • useMultiselect
  • useMultiselectCategory
  • useNotificationBadge
  • usePagination
  • usePopup
  • useAdvancedPopup
  • useRadio
  • useSelect
  • useSelectSearch
  • useSelectControl
  • useSwitch
  • useSelectTab
  • useTextArea
  • useTextBox
  • useClickOutside
  • useCommonReducer
  • useContainerQuery
  • useEffectCallOnlyAfterState
  • useElementResize
  • useEscape
  • useEscapeEffect
  • useEvent
  • useId
  • useMediaQuery
  • useMergeState
  • useMergeStyle
  • usePrevious
  • useIntersectionObserver
  • useResizeObserver
  • useScrollEnd
  • useScrollParents
  • useScrollStopper
  • useTimeout
  • useWindowResize

2.0.4

  • useEventListener - New hook added

2.0.3

  • useMergeState - New hook added

2.0.2

  • useEffectCallOnlyAfterState - Cleanup option provided as third argument
  • useIntersectionObserver - Changing isStartIntersecting will reinitiate the observer
  • useIntersectionObserverGroup - New hook added

2.0.1

  • useResizeObserver issue fix
  • useList deprecated
  • useMultiselectCatogory arguments and return values has been updated
// Before
const { selectedValues, searchStr, ...otherData } = useMultiselectCatogory({
    options: [],
    selectedValues: [],
    selectedGroup: ''
});

// After
const { selectedOptions, searchString, ...otherData } = useMultiselectCatogory({
    options: [],
    selectedOptions: [],
    selectedGroup: ''
});
  • useFileUpload "getRef" argument removed. handleFocus method added.
  • useElementResize will not return "width". Introduced "resizeType" and "needContainerSizeChange" props.
// Before
const { setContainerRef, setBarRef, width } = useElementResize({
    minWidth: 300,
    handleResizeCallback: () => {}
});

// After
const { setContainerRef, setBarRef } = useElementResize({
    minHeight: 100,
    maxHeight: 500,
    minWidth: 100,
    maxWidth: 500,
    resizeType: 'both' || 'height' || 'width',
    handleResizeCallback: () => {},
    needContainerSizeChange: true || false
});

2.0.0

Newly Introduced

  • useAdvancedPopup
  • useSelectSearch
  • useIntersectionObserver

Removed

  • useGlobalEscape
  • EscapeContext
  • EscapeProvider
  • ResizeObserverProvider
  • useVisibleOnPage

Updated

  • useEscape arguments structure has been updated. And No provider is needed to use the escape functionalities with the order.
// Before
useEscape(callback, isRegister);

// After
useEscape({
    callback: () => {},
    isRegister: true
});
  • useFloating arguments is updated. Now you have to give a function which should return element ref.
  • useFloating return value is also updated. Now, this returns a function that will returns the popup position related data.
// Before
const { ...floatingData, handlePosition } = useFloating(containerEleRef, floatingEleRef, options);

// After
const getFloating = useFloating(() => containerEleRef, () => floatingEleRef, options);

const { view, views, viewsOffset, targetOffset, popupOffset, relativeOffset, relativePosition, popupPosition } = getFloating();
  • useClickOutside arguments structure has been updated
// Before
useClickOutside({
    element: elementRef,
    callback: () => {}
});

// After
useClickOutside({
    getElements: () => [element1_Ref, element2_Ref],
    callback: () => {},
    isRegister: true
});
  • useScrollStopper arguments has been updated.
// Before
useScrollStopper({
    element: elementRef,
    excludeElement: excludeElementRef,
    isStop: false
});

// After
useScrollStopper({
    element: elementRef,
    getExcludeElements: () => [excludeElement1_Ref, excludeElement2_Ref],
    isStop: false
});
  • useContainerQuery arguments is updated. Now you have to give a function which should return element ref.
  • useContainerQuery return value is also updated. Now, this returns only the matched query object.
// Before
const [elementRef, matchedQuery] = useContainerQuery(query, options);

// After
const matchedQuery = useContainerQuery(() => elementRef, query, options);
  • useResizeObserver arguments is updated
// Before
useResizeObserver({
    element: elementRef
    callback: () => {}
});

// After
useResizeObserver({
    getElement: () => elementRef,
    callback: () => {},
    isObserve: true
});
  • useWindowResize - Removed the resize handler from useEffect dependency
2.0.4

18 days ago

2.0.3

3 months ago

2.0.2

7 months ago

2.0.1

10 months ago

2.0.0

11 months ago

1.3.15

1 year ago

1.3.13

1 year ago

1.3.12

1 year ago

1.3.11

1 year ago

1.3.10

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.3.5

1 year ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.38

2 years ago

1.0.36

2 years ago

1.0.34

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.19

2 years ago

1.0.17

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.3-alpha.2

2 years ago

1.0.3-alpha.1

2 years ago

1.0.3-alpha.0

2 years ago

1.0.2-alpha.6

2 years ago

1.0.2-alpha.5

2 years ago

1.0.2-alpha.4

2 years ago

1.0.2-alpha.3

2 years ago

1.0.2-alpha.2

2 years ago

1.0.2-alpha.1

2 years ago

1.0.2-alpha.2065

2 years ago

1.0.2-alpha.0

2 years ago

1.0.1-alpha.2060

2 years ago

1.0.1-alpha.2059

2 years ago

1.0.1-alpha.2058

2 years ago