Skip to content

Releases: atomicojs/hooks

useClickCoordinates

02 Oct 03:55

Choose a tag to compare

This hook captures the click event coordinates (Touch) and gives a callback in the following format:

interface Point {
  x: number;
  y: number;
  offset: {
    x: number;
    y: number;
  };
}

Where :

  • x: MouseEvent.clientX
  • y: MouseEvent.clientY
  • offset.x : MouseEvent.offsetX
  • offset.Y : MouseEvent.offsetY

Module

import { useClickCoordinates } from "@atomico/hooks/use-click-coordinates";

Syntax

useClickCoordinates(ref, handlerClick);

fix use-debounce-state

01 Oct 17:39

Choose a tag to compare

fixed status updater

fix use-css-light-dom

01 Oct 16:01

Choose a tag to compare

Remove the reading of locaName to build the selector

Add the hook useDisabled and useCss

28 Sep 21:06

Choose a tag to compare

useDisabled

Inherit the disabled status of a fieldset tag, under certain rules:

  1. the tag must be in the lightDOM
  2. the component that uses this hook must declare the prop disabled

Import

import { useDisabled } from "@atomico/hooks/use-disabled";

Syntax

const disabled:boolean = useDisabled();

useCss

Inject in tag style in shadowRoot with content given as parameter to useCss

Import

import { useCss } from "@atomico/hooks/use-css";

Syntax

useCss(cssText: string);

the hook useParentPath is added

28 Sep 02:52

Choose a tag to compare

This hook creates a list with the parents of the component in ascending order:

Import

import { useParentPath } from "@atomico/hooks/use-parent";

Syntax

const path = useParentPath(composed?: boolean);

check if the reference for current has been defined

03 Sep 19:06

Choose a tag to compare

This avoids errors by not relating the reference

Change the behavior of useFormValue

01 Sep 06:26

Choose a tag to compare

useFormValue

Improves the experience of forms with webcomponents in lightDOM and ShadowDOM situations

const [value, setValue] = useFormValue();

Where:

  1. value : represents the inherited value of the form
  2. setValue: create a hidden input layers to define a value in the form

fix argument for using FormData

01 Sep 00:22

Choose a tag to compare

3.12.5

fix useFormData target

use formData for form capture

01 Sep 00:18

Choose a tag to compare

3.12.4

use formData for form capture

Improves value capture for useFormValue

31 Aug 23:03

Choose a tag to compare

3.12.3

improves value capture for useFormValue