@dinofront/design_system 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useEscapeKey.d.ts +4 -0
- package/dist/hooks/useFormContext.d.ts +6 -0
- package/dist/hooks/useFormProps.d.ts +9 -0
- package/dist/hooks/useHideBodyScroll.d.ts +6 -0
- package/dist/hooks/useIsMobile.d.ts +9 -0
- package/dist/hooks/useOnOutsideClick.d.ts +6 -0
- package/dist/index.js +1975 -1733
- package/dist/index.js.map +1 -1
- package/package.json +1 -5
- package/dist/FormField-CwRAOtTN.js +0 -170
- package/dist/FormField-CwRAOtTN.js.map +0 -1
- package/dist/form/index.d.ts +0 -2
- package/dist/form.d.ts +0 -2
- package/dist/form.js +0 -2
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export { useStepper } from './useStepper';
|
|
2
2
|
export type { UseStepperOptions, UseStepperResult } from './useStepper';
|
|
3
|
+
export { useOnOutsideClick } from './useOnOutsideClick';
|
|
4
|
+
export { useEscapeKey } from './useEscapeKey';
|
|
5
|
+
export { useHideBodyScroll } from './useHideBodyScroll';
|
|
6
|
+
export { useIsMobile } from './useIsMobile';
|
|
7
|
+
export { useFormContext } from './useFormContext';
|
|
8
|
+
export { useFormProps } from './useFormProps';
|
|
9
|
+
export type { FormContextValue } from '../lib/FormContext';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Fires `onEscape` when the user presses `Escape`, anywhere in the
|
|
2
|
+
* document — not scoped to a container, matching how dismissible
|
|
3
|
+
* overlays (menus, drawers, popovers) listen for it today. */
|
|
4
|
+
export declare function useEscapeKey(onEscape: () => void, enabled?: boolean): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormContextValue } from '../lib/FormContext';
|
|
2
|
+
/** Reads the ambient form state provided by the nearest `FormContainer`.
|
|
3
|
+
* Throws outside one, matching `FormField`'s existing null-check — the
|
|
4
|
+
* same failure whether a consumer uses `FormField` or this hook
|
|
5
|
+
* directly. */
|
|
6
|
+
export declare function useFormContext(): FormContextValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormContextValue } from '../lib/FormContext';
|
|
2
|
+
/** Reads the ambient form state provided by the nearest `FormContainer` —
|
|
3
|
+
* the same context `useFormContext` reads — but never throws outside
|
|
4
|
+
* one. Returns an inert default context instead, so call sites migrated
|
|
5
|
+
* from an existing `useFormProps()` (e.g. an app's own hrm_ui_lib-shaped
|
|
6
|
+
* shim) keep working without adding a null check. Prefer
|
|
7
|
+
* `useFormContext` in new code, where a missing `FormContainer` is
|
|
8
|
+
* usually a programmer error you want to surface immediately. */
|
|
9
|
+
export declare function useFormProps(): FormContextValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Locks `document.body` scrolling while `active`, restoring whatever
|
|
2
|
+
* `overflow` value was set before the first lock once the last active
|
|
3
|
+
* caller deactivates. Reference-counted across concurrent callers (e.g.
|
|
4
|
+
* a drawer opened from within a modal) so one overlay closing early
|
|
5
|
+
* never clobbers another's lock. */
|
|
6
|
+
export declare function useHideBodyScroll(active: boolean): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** True when the viewport is at or below `breakpoint` (default 768px).
|
|
2
|
+
* Returns `false` during SSR and during the very first client render —
|
|
3
|
+
* the effect computes and syncs the real value right after mount, so
|
|
4
|
+
* the server-rendered markup and the client's first render always
|
|
5
|
+
* agree (no hydration mismatch), at the cost of one extra render after
|
|
6
|
+
* mount when the viewport actually is narrow. Subscribes to the media
|
|
7
|
+
* query's `change` event rather than `window.resize`, so it only
|
|
8
|
+
* re-renders when the mobile/desktop boundary is actually crossed. */
|
|
9
|
+
export declare function useIsMobile(breakpoint?: number): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/** Fires `handler` on any `mousedown`/`touchstart` outside `ref.current`.
|
|
3
|
+
* No effect while `ref.current` is null or `enabled` is false — callers
|
|
4
|
+
* don't need to guard call sites where the ref isn't attached yet (e.g.
|
|
5
|
+
* before a portal mounts). */
|
|
6
|
+
export declare function useOnOutsideClick(ref: RefObject<HTMLElement | null> | null | undefined, handler: (event: MouseEvent | TouchEvent) => void, enabled?: boolean): void;
|