neatkit 0.1.0 → 0.3.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/LICENSE.md +373 -674
- package/README.md +9 -32
- package/dist/components/Alert/Alert.d.ts +29 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.d.ts +28 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Badge/Badge.d.ts +32 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +58 -8
- package/dist/components/Button/index.d.ts +2 -3
- package/dist/components/Card/Card.d.ts +40 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +35 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +62 -0
- package/dist/components/CheckboxGroup/contexts/CheckboxGroupContext.d.ts +22 -0
- package/dist/components/CheckboxGroup/hooks/useCheckboxGroup.d.ts +7 -0
- package/dist/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/components/Content/Content.d.ts +58 -0
- package/dist/components/Content/hooks/useContentLayout.d.ts +18 -0
- package/dist/components/Content/index.d.ts +2 -0
- package/dist/components/Content/utils/layout.d.ts +11 -0
- package/dist/components/Divider/Divider.d.ts +30 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Field/Field.d.ts +61 -0
- package/dist/components/Field/index.d.ts +2 -0
- package/dist/components/Field/utils/field-control.d.ts +23 -0
- package/dist/components/Icon/Icon.d.ts +21 -0
- package/dist/components/Icon/icons/ArrowLeftIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ArrowRightIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ArticlesIcon.d.ts +11 -0
- package/dist/components/Icon/icons/AudioIcon.d.ts +11 -0
- package/dist/components/Icon/icons/BranchIcon.d.ts +11 -0
- package/dist/components/Icon/icons/BurgerIcon.d.ts +11 -0
- package/dist/components/Icon/icons/CameraIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChatIcon.d.ts +11 -0
- package/dist/components/Icon/icons/CheckmarkIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChevronDownIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChevronLeftIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChevronRightIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChevronUpIcon.d.ts +11 -0
- package/dist/components/Icon/icons/CommitIcon.d.ts +11 -0
- package/dist/components/Icon/icons/CrossIcon.d.ts +11 -0
- package/dist/components/Icon/icons/DownloadIcon.d.ts +11 -0
- package/dist/components/Icon/icons/DuplicateIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ExitIcon.d.ts +11 -0
- package/dist/components/Icon/icons/EyeIcon.d.ts +11 -0
- package/dist/components/Icon/icons/EyeOffIcon.d.ts +11 -0
- package/dist/components/Icon/icons/FileIcon.d.ts +11 -0
- package/dist/components/Icon/icons/FolderIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GitIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GithubIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GlobeIcon.d.ts +11 -0
- package/dist/components/Icon/icons/HardwareIcon.d.ts +11 -0
- package/dist/components/Icon/icons/HomeIcon.d.ts +11 -0
- package/dist/components/Icon/icons/InfoIcon.d.ts +11 -0
- package/dist/components/Icon/icons/KeyIcon.d.ts +11 -0
- package/dist/components/Icon/icons/LinkedInIcon.d.ts +11 -0
- package/dist/components/Icon/icons/MailIcon.d.ts +11 -0
- package/dist/components/Icon/icons/MinusIcon.d.ts +11 -0
- package/dist/components/Icon/icons/PencilIcon.d.ts +11 -0
- package/dist/components/Icon/icons/PlusIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ProjectsIcon.d.ts +11 -0
- package/dist/components/Icon/icons/QRCodeIcon.d.ts +11 -0
- package/dist/components/Icon/icons/RedditIcon.d.ts +11 -0
- package/dist/components/Icon/icons/RepositoryIcon.d.ts +11 -0
- package/dist/components/Icon/icons/SaveIcon.d.ts +11 -0
- package/dist/components/Icon/icons/SignalIcon.d.ts +11 -0
- package/dist/components/Icon/icons/TagIcon.d.ts +11 -0
- package/dist/components/Icon/icons/UserIcon.d.ts +11 -0
- package/dist/components/Icon/icons/WarningIcon.d.ts +11 -0
- package/dist/components/Icon/icons/WindowIcon.d.ts +11 -0
- package/dist/components/Icon/icons/types.d.ts +3 -0
- package/dist/components/Icon/index.d.ts +36 -0
- package/dist/components/Icon/utils/registry.d.ts +49 -0
- package/dist/components/Input/Input.d.ts +50 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts +62 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/PinInput/PinInput.d.ts +76 -0
- package/dist/components/PinInput/hooks/usePinInput.d.ts +65 -0
- package/dist/components/PinInput/index.d.ts +2 -0
- package/dist/components/Popover/Popover.d.ts +93 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Portal/Portal.d.ts +19 -0
- package/dist/components/Portal/contexts/FocusScopeContext.d.ts +7 -0
- package/dist/components/Portal/hooks/useDismissableLayer.d.ts +31 -0
- package/dist/components/Portal/hooks/useFloatingPosition.d.ts +12 -0
- package/dist/components/Portal/hooks/useFocusTrap.d.ts +24 -0
- package/dist/components/Portal/hooks/usePresence.d.ts +19 -0
- package/dist/components/Portal/hooks/useScrollLock.d.ts +7 -0
- package/dist/components/Portal/utils/floating-position.d.ts +26 -0
- package/dist/components/Portal/utils/overlay-stack.d.ts +45 -0
- package/dist/components/Radio/Radio.d.ts +32 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +54 -0
- package/dist/components/RadioGroup/contexts/RadioGroupContext.d.ts +18 -0
- package/dist/components/RadioGroup/hooks/useRadioGroup.d.ts +7 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +97 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +30 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Spinner/Spinner.d.ts +24 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Surface/Surface.d.ts +15 -0
- package/dist/components/Switch/Switch.d.ts +27 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +41 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.d.ts +40 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +54 -0
- package/dist/components/Tooltip/TooltipProvider.d.ts +24 -0
- package/dist/components/Tooltip/index.d.ts +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +27 -3
- package/dist/index.js +3920 -12
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +84 -0
- package/dist/utils/aria.d.ts +18 -0
- package/dist/utils/reference.d.ts +16 -0
- package/dist/utils/units.d.ts +33 -0
- package/package.json +20 -4
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { default as Icon } from "./Icon";
|
|
2
|
+
export type { IconProps } from "./Icon";
|
|
3
|
+
export type { IconType } from "./utils/registry";
|
|
4
|
+
export { default as ChatIcon } from "./icons/ChatIcon";
|
|
5
|
+
export { default as ProjectsIcon } from "./icons/ProjectsIcon";
|
|
6
|
+
export { default as ArticlesIcon } from "./icons/ArticlesIcon";
|
|
7
|
+
export { default as MailIcon } from "./icons/MailIcon";
|
|
8
|
+
export { default as GithubIcon } from "./icons/GithubIcon";
|
|
9
|
+
export { default as GlobeIcon } from "./icons/GlobeIcon";
|
|
10
|
+
export { default as LinkedInIcon } from "./icons/LinkedInIcon";
|
|
11
|
+
export { default as RedditIcon } from "./icons/RedditIcon";
|
|
12
|
+
export { default as ExitIcon } from "./icons/ExitIcon";
|
|
13
|
+
export { default as CameraIcon } from "./icons/CameraIcon";
|
|
14
|
+
export { default as QRCodeIcon } from "./icons/QRCodeIcon";
|
|
15
|
+
export { default as DownloadIcon } from "./icons/DownloadIcon";
|
|
16
|
+
export { default as SaveIcon } from "./icons/SaveIcon";
|
|
17
|
+
export { default as PencilIcon } from "./icons/PencilIcon";
|
|
18
|
+
export { default as ArrowLeftIcon } from "./icons/ArrowLeftIcon";
|
|
19
|
+
export { default as ArrowRightIcon } from "./icons/ArrowRightIcon";
|
|
20
|
+
export { default as CrossIcon } from "./icons/CrossIcon";
|
|
21
|
+
export { default as CheckmarkIcon } from "./icons/CheckmarkIcon";
|
|
22
|
+
export { default as PlusIcon } from "./icons/PlusIcon";
|
|
23
|
+
export { default as MinusIcon } from "./icons/MinusIcon";
|
|
24
|
+
export { default as WindowIcon } from "./icons/WindowIcon";
|
|
25
|
+
export { default as UserIcon } from "./icons/UserIcon";
|
|
26
|
+
export { default as DuplicateIcon } from "./icons/DuplicateIcon";
|
|
27
|
+
export { default as EyeIcon } from "./icons/EyeIcon";
|
|
28
|
+
export { default as EyeOffIcon } from "./icons/EyeOffIcon";
|
|
29
|
+
export { default as SignalIcon } from "./icons/SignalIcon";
|
|
30
|
+
export { default as AudioIcon } from "./icons/AudioIcon";
|
|
31
|
+
export { default as HardwareIcon } from "./icons/HardwareIcon";
|
|
32
|
+
export { default as BurgerIcon } from "./icons/BurgerIcon";
|
|
33
|
+
export { default as RepositoryIcon } from "./icons/RepositoryIcon";
|
|
34
|
+
export { default as KeyIcon } from "./icons/KeyIcon";
|
|
35
|
+
export { default as InfoIcon } from "./icons/InfoIcon";
|
|
36
|
+
export { default as WarningIcon } from "./icons/WarningIcon";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** The icon graphics indexed by their public names. */
|
|
2
|
+
export declare const iconGraphics: {
|
|
3
|
+
readonly projects: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
4
|
+
readonly chat: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
5
|
+
readonly articles: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
6
|
+
readonly mail: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
7
|
+
readonly github: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
8
|
+
readonly globe: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
9
|
+
readonly linkedin: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
10
|
+
readonly reddit: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
11
|
+
readonly exit: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
12
|
+
readonly camera: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
13
|
+
readonly "qr-code": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
14
|
+
readonly download: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
15
|
+
readonly save: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
16
|
+
readonly pencil: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
17
|
+
readonly "arrow-left": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
18
|
+
readonly "arrow-right": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
19
|
+
readonly cross: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
20
|
+
readonly checkmark: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
21
|
+
readonly plus: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
22
|
+
readonly minus: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
23
|
+
readonly window: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
24
|
+
readonly user: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
25
|
+
readonly duplicate: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
26
|
+
readonly eye: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
27
|
+
readonly "eye-off": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
28
|
+
readonly signal: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
29
|
+
readonly audio: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
30
|
+
readonly hardware: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
31
|
+
readonly burger: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
32
|
+
readonly repository: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
33
|
+
readonly "chevron-down": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
34
|
+
readonly "chevron-up": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
35
|
+
readonly "chevron-left": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
36
|
+
readonly "chevron-right": import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
37
|
+
readonly branch: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
38
|
+
readonly commit: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
39
|
+
readonly folder: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
40
|
+
readonly file: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
41
|
+
readonly tag: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
42
|
+
readonly key: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
43
|
+
readonly git: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
44
|
+
readonly home: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
45
|
+
readonly info: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
46
|
+
readonly warning: import("react").ForwardRefExoticComponent<Omit<import("../icons/types").IconGraphicProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
47
|
+
};
|
|
48
|
+
/** A type representing the icons available through the Icon component. */
|
|
49
|
+
export type IconType = keyof typeof iconGraphics;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import "./styles/input.css";
|
|
3
|
+
/** A type representing the supported native single-line input types. */
|
|
4
|
+
export type InputType = "email" | "number" | "password" | "search" | "tel" | "text" | "url";
|
|
5
|
+
/** A type representing properties for the Input component. */
|
|
6
|
+
export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "children" | "className" | "style" | "type"> & {
|
|
7
|
+
/** The additional class name applied to the composite Input root. */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Whether the Input provides a built-in clear action. */
|
|
10
|
+
clearable?: boolean;
|
|
11
|
+
/** Whether the Input exposes an invalid semantic and visual state. */
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
/** The content displayed before the editable value. */
|
|
14
|
+
leading?: ReactNode;
|
|
15
|
+
/** Whether the Input displays a loading indicator and blocks editing. */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** The content displayed after the editable value. */
|
|
18
|
+
trailing?: ReactNode;
|
|
19
|
+
/** The inline styles applied to the composite Input root. */
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
/** The supported native behavior applied to the single-line control. */
|
|
22
|
+
type?: InputType;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Renders a themed native single-line input with optional adornments.
|
|
26
|
+
*
|
|
27
|
+
* @param props - The properties that configure the Input.
|
|
28
|
+
* @param forwardedReference - The reference assigned to the native input.
|
|
29
|
+
*
|
|
30
|
+
* @returns The rendered Input control.
|
|
31
|
+
*/
|
|
32
|
+
declare const Input: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "className" | "style" | "children" | "type"> & {
|
|
33
|
+
/** The additional class name applied to the composite Input root. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Whether the Input provides a built-in clear action. */
|
|
36
|
+
clearable?: boolean;
|
|
37
|
+
/** Whether the Input exposes an invalid semantic and visual state. */
|
|
38
|
+
invalid?: boolean;
|
|
39
|
+
/** The content displayed before the editable value. */
|
|
40
|
+
leading?: ReactNode;
|
|
41
|
+
/** Whether the Input displays a loading indicator and blocks editing. */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/** The content displayed after the editable value. */
|
|
44
|
+
trailing?: ReactNode;
|
|
45
|
+
/** The inline styles applied to the composite Input root. */
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
/** The supported native behavior applied to the single-line control. */
|
|
48
|
+
type?: InputType;
|
|
49
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
50
|
+
export default Input;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode, type RefObject } from "react";
|
|
2
|
+
import "./styles/modal.css";
|
|
3
|
+
/** A type representing an interaction that requests Modal closure. */
|
|
4
|
+
export type ModalCloseReason = "close-button" | "escape" | "outside";
|
|
5
|
+
/** A type representing properties for the Modal component. */
|
|
6
|
+
export type ModalProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onClose" | "title"> & {
|
|
7
|
+
/** The content displayed inside the Modal panel. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** The accessible label announced by the close button. */
|
|
10
|
+
closeButtonLabel?: string;
|
|
11
|
+
/** Whether the Modal exposes user-operated closing interactions. */
|
|
12
|
+
exitable?: boolean;
|
|
13
|
+
/** The preferred element focused when the Modal opens. */
|
|
14
|
+
initialFocusReference?: RefObject<HTMLElement | null>;
|
|
15
|
+
/** Whether document scrolling is locked while the Modal is open. */
|
|
16
|
+
lockScroll?: boolean;
|
|
17
|
+
/** The callback invoked when an allowed interaction requests closure. */
|
|
18
|
+
onClose?: (reason: ModalCloseReason) => void;
|
|
19
|
+
/** Whether the Modal is currently open. */
|
|
20
|
+
open: boolean;
|
|
21
|
+
/** The optional element receiving the Modal portal. */
|
|
22
|
+
portalContainer?: Element | null;
|
|
23
|
+
/** Whether focus returns to its prior owner when the Modal closes. */
|
|
24
|
+
restoreFocus?: boolean;
|
|
25
|
+
/** Whether keyboard and programmatic focus remain inside the Modal. */
|
|
26
|
+
trapFocus?: boolean;
|
|
27
|
+
/** The fixed-style heading displayed beside the optional close button. */
|
|
28
|
+
title?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Renders a portal-backed modal dialog and its presentational backdrop.
|
|
32
|
+
*
|
|
33
|
+
* @param props - The properties that configure the Modal.
|
|
34
|
+
* @param forwardedReference - The reference assigned to the Modal panel.
|
|
35
|
+
*
|
|
36
|
+
* @returns The open, exiting, or unmounted Modal content.
|
|
37
|
+
*/
|
|
38
|
+
declare const Modal: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "children" | "onClose"> & {
|
|
39
|
+
/** The content displayed inside the Modal panel. */
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
/** The accessible label announced by the close button. */
|
|
42
|
+
closeButtonLabel?: string;
|
|
43
|
+
/** Whether the Modal exposes user-operated closing interactions. */
|
|
44
|
+
exitable?: boolean;
|
|
45
|
+
/** The preferred element focused when the Modal opens. */
|
|
46
|
+
initialFocusReference?: RefObject<HTMLElement | null>;
|
|
47
|
+
/** Whether document scrolling is locked while the Modal is open. */
|
|
48
|
+
lockScroll?: boolean;
|
|
49
|
+
/** The callback invoked when an allowed interaction requests closure. */
|
|
50
|
+
onClose?: (reason: ModalCloseReason) => void;
|
|
51
|
+
/** Whether the Modal is currently open. */
|
|
52
|
+
open: boolean;
|
|
53
|
+
/** The optional element receiving the Modal portal. */
|
|
54
|
+
portalContainer?: Element | null;
|
|
55
|
+
/** Whether focus returns to its prior owner when the Modal closes. */
|
|
56
|
+
restoreFocus?: boolean;
|
|
57
|
+
/** Whether keyboard and programmatic focus remain inside the Modal. */
|
|
58
|
+
trapFocus?: boolean;
|
|
59
|
+
/** The fixed-style heading displayed beside the optional close button. */
|
|
60
|
+
title?: string;
|
|
61
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
62
|
+
export default Modal;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type CSSProperties, type InputHTMLAttributes } from "react";
|
|
2
|
+
import "./styles/pin-input.css";
|
|
3
|
+
/** A type representing the characters accepted by PinInput. */
|
|
4
|
+
export type PinInputMode = "alphanumeric" | "numeric";
|
|
5
|
+
/** A type representing internal PinInput layout custom properties. */
|
|
6
|
+
type PinInputCustomProperties = {
|
|
7
|
+
/** The number of visual slots displayed in each wrapped row. */
|
|
8
|
+
"--nk-pin-input-columns"?: number;
|
|
9
|
+
};
|
|
10
|
+
/** A type representing PinInput root styles and layout custom properties. */
|
|
11
|
+
type PinInputStyle = CSSProperties & PinInputCustomProperties;
|
|
12
|
+
/** A type representing properties for the PinInput component. */
|
|
13
|
+
export type PinInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "children" | "className" | "defaultValue" | "inputMode" | "maxLength" | "minLength" | "onChange" | "onPaste" | "pattern" | "size" | "style" | "type" | "value"> & {
|
|
14
|
+
/** The additional class name applied to the composite PinInput root. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Whether entered characters are visually replaced with centered dots. */
|
|
17
|
+
censored?: boolean;
|
|
18
|
+
/** The initial value used by an uncontrolled PinInput. */
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
/** Whether the PinInput exposes an invalid semantic and visual state. */
|
|
21
|
+
invalid?: boolean;
|
|
22
|
+
/** The character count, constrained to a whole number from three to nine. */
|
|
23
|
+
length?: number;
|
|
24
|
+
/** The character set accepted by the native input. */
|
|
25
|
+
mode?: PinInputMode;
|
|
26
|
+
/** The native change callback receiving the normalized value. */
|
|
27
|
+
onChange?: InputHTMLAttributes<HTMLInputElement>["onChange"];
|
|
28
|
+
/** The callback invoked when every configured character has been entered. */
|
|
29
|
+
onComplete?: (value: string) => void;
|
|
30
|
+
/** The native paste callback invoked before built-in paste behavior. */
|
|
31
|
+
onPaste?: InputHTMLAttributes<HTMLInputElement>["onPaste"];
|
|
32
|
+
/** The inline styles applied to the composite PinInput root. */
|
|
33
|
+
style?: PinInputStyle;
|
|
34
|
+
/** The value used by a controlled PinInput. */
|
|
35
|
+
value?: string;
|
|
36
|
+
/** Whether visual slots wrap into two balanced rows. */
|
|
37
|
+
wrap?: boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Renders one accessible native input as a segmented one-time-code control.
|
|
41
|
+
*
|
|
42
|
+
* PinInput uses a single form value and accessible name while presenting each
|
|
43
|
+
* character in a separate visual slot.
|
|
44
|
+
*
|
|
45
|
+
* @param props - The properties that configure the PinInput.
|
|
46
|
+
* @param forwardedReference - The reference assigned to the native input.
|
|
47
|
+
*
|
|
48
|
+
* @returns The rendered PinInput control.
|
|
49
|
+
*/
|
|
50
|
+
declare const PinInput: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "className" | "style" | "inputMode" | "children" | "onPaste" | "onChange" | "size" | "type" | "pattern" | "value" | "maxLength" | "minLength"> & {
|
|
51
|
+
/** The additional class name applied to the composite PinInput root. */
|
|
52
|
+
className?: string;
|
|
53
|
+
/** Whether entered characters are visually replaced with centered dots. */
|
|
54
|
+
censored?: boolean;
|
|
55
|
+
/** The initial value used by an uncontrolled PinInput. */
|
|
56
|
+
defaultValue?: string;
|
|
57
|
+
/** Whether the PinInput exposes an invalid semantic and visual state. */
|
|
58
|
+
invalid?: boolean;
|
|
59
|
+
/** The character count, constrained to a whole number from three to nine. */
|
|
60
|
+
length?: number;
|
|
61
|
+
/** The character set accepted by the native input. */
|
|
62
|
+
mode?: PinInputMode;
|
|
63
|
+
/** The native change callback receiving the normalized value. */
|
|
64
|
+
onChange?: InputHTMLAttributes<HTMLInputElement>["onChange"];
|
|
65
|
+
/** The callback invoked when every configured character has been entered. */
|
|
66
|
+
onComplete?: (value: string) => void;
|
|
67
|
+
/** The native paste callback invoked before built-in paste behavior. */
|
|
68
|
+
onPaste?: InputHTMLAttributes<HTMLInputElement>["onPaste"];
|
|
69
|
+
/** The inline styles applied to the composite PinInput root. */
|
|
70
|
+
style?: PinInputStyle;
|
|
71
|
+
/** The value used by a controlled PinInput. */
|
|
72
|
+
value?: string;
|
|
73
|
+
/** Whether visual slots wrap into two balanced rows. */
|
|
74
|
+
wrap?: boolean;
|
|
75
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
76
|
+
export default PinInput;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ChangeEvent, type ClipboardEvent, type FocusEvent, type ForwardedRef, type KeyboardEvent, type PointerEvent, type SyntheticEvent } from "react";
|
|
2
|
+
import type { PinInputMode } from "../PinInput";
|
|
3
|
+
/** A type representing the options used by PinInput behavior. */
|
|
4
|
+
type UsePinInputOptions = {
|
|
5
|
+
/** The initial value used by an uncontrolled PinInput. */
|
|
6
|
+
defaultValue: string;
|
|
7
|
+
/** Whether the native input blocks editing and focus. */
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
/** The native input reference supplied by the consumer. */
|
|
10
|
+
forwardedReference: ForwardedRef<HTMLInputElement>;
|
|
11
|
+
/** The requested visual character count. */
|
|
12
|
+
length: number;
|
|
13
|
+
/** The character set accepted by the native input. */
|
|
14
|
+
mode: PinInputMode;
|
|
15
|
+
/** The native change callback receiving normalized content. */
|
|
16
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
/** The callback invoked when every character has been entered. */
|
|
18
|
+
onComplete?: (value: string) => void;
|
|
19
|
+
/** The native focus callback forwarded after internal focus behavior. */
|
|
20
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
21
|
+
/** The native key callback invoked before built-in arrow behavior. */
|
|
22
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
23
|
+
/** The native paste callback invoked before built-in paste behavior. */
|
|
24
|
+
onPaste?: (event: ClipboardEvent<HTMLInputElement>) => void;
|
|
25
|
+
/** The native selection callback forwarded after internal selection. */
|
|
26
|
+
onSelect?: (event: SyntheticEvent<HTMLInputElement>) => void;
|
|
27
|
+
/** Whether the native input prevents value editing. */
|
|
28
|
+
readOnly: boolean;
|
|
29
|
+
/** The value used by a controlled PinInput. */
|
|
30
|
+
value?: string;
|
|
31
|
+
};
|
|
32
|
+
/** A type representing state and behavior returned to PinInput. */
|
|
33
|
+
type UsePinInputResult = {
|
|
34
|
+
/** The visual slot represented by the native selection. */
|
|
35
|
+
activeIndex: number;
|
|
36
|
+
/** Handles normalized native editing. */
|
|
37
|
+
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
38
|
+
/** Places initial focus at the first incomplete slot. */
|
|
39
|
+
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
40
|
+
/** Moves native selection through visual slots. */
|
|
41
|
+
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
42
|
+
/** Distributes clipboard content through the native input. */
|
|
43
|
+
handlePaste: (event: ClipboardEvent<HTMLInputElement>) => void;
|
|
44
|
+
/** Synchronizes visual and native selection state. */
|
|
45
|
+
handleSelect: (event: SyntheticEvent<HTMLInputElement>) => void;
|
|
46
|
+
/** Focuses the visual slot selected with a pointer. */
|
|
47
|
+
handleSlotPointerDown: (event: PointerEvent<HTMLSpanElement>, index: number) => void;
|
|
48
|
+
/** The stable callback assigning the native input reference. */
|
|
49
|
+
inputCallbackReference: (element: HTMLInputElement | null) => void;
|
|
50
|
+
/** The normalized supported character count. */
|
|
51
|
+
length: number;
|
|
52
|
+
/** The normalized value displayed by the control. */
|
|
53
|
+
renderedValue: string;
|
|
54
|
+
};
|
|
55
|
+
/** The default PinInput character count. */
|
|
56
|
+
export declare const DEFAULT_PIN_LENGTH = 4;
|
|
57
|
+
/**
|
|
58
|
+
* Manages native PinInput state, selection, paste, and form behavior.
|
|
59
|
+
*
|
|
60
|
+
* @param options - The controlled state and native callbacks to coordinate.
|
|
61
|
+
*
|
|
62
|
+
* @returns The normalized value and handlers rendered by PinInput.
|
|
63
|
+
*/
|
|
64
|
+
export declare function usePinInput(options: UsePinInputOptions): UsePinInputResult;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode, type RefObject } from "react";
|
|
2
|
+
import type { FloatingPlacement } from "../Portal/utils/floating-position";
|
|
3
|
+
import "./styles/popover.css";
|
|
4
|
+
/** A type representing the preferred placement of a Popover. */
|
|
5
|
+
export type PopoverPlacement = FloatingPlacement;
|
|
6
|
+
/** A type representing an interaction that requests a Popover state change. */
|
|
7
|
+
export type PopoverOpenChangeReason = "escape" | "outside" | "programmatic" | "trigger";
|
|
8
|
+
/** A type representing properties for the Popover component. */
|
|
9
|
+
export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "defaultValue" | "onChange"> & {
|
|
10
|
+
/** Whether focus moves inside the panel when it opens. */
|
|
11
|
+
autoFocus?: boolean;
|
|
12
|
+
/** The interactive content displayed inside the Popover panel. */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** Whether an outside pointer interaction closes the Popover. */
|
|
15
|
+
closeOnOutsideInteraction?: boolean;
|
|
16
|
+
/** Whether the Escape key closes the Popover. */
|
|
17
|
+
closeOnEscape?: boolean;
|
|
18
|
+
/** Whether an uncontrolled Popover is initially open. */
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
/** Whether Popover behavior is disabled without removing its trigger. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** The preferred element focused when the Popover opens. */
|
|
23
|
+
initialFocusReference?: RefObject<HTMLElement | null>;
|
|
24
|
+
/** The callback receiving Escape before its default closing behavior. */
|
|
25
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
26
|
+
/** The callback invoked for a requested change to the open state. */
|
|
27
|
+
onOpenChange?: (open: boolean, reason: PopoverOpenChangeReason) => void;
|
|
28
|
+
/** The callback receiving an outside press before default behavior. */
|
|
29
|
+
onPointerDownOutside?: (event: PointerEvent) => void;
|
|
30
|
+
/** The controlled open state of the Popover. */
|
|
31
|
+
open?: boolean;
|
|
32
|
+
/** The preferred placement before viewport collision handling. */
|
|
33
|
+
placement?: PopoverPlacement;
|
|
34
|
+
/** The optional element receiving the Popover portal. */
|
|
35
|
+
portalContainer?: Element | null;
|
|
36
|
+
/** Whether focus returns to the trigger after non-outside closure. */
|
|
37
|
+
restoreFocus?: boolean;
|
|
38
|
+
/** Whether keyboard and programmatic focus remain inside the Popover. */
|
|
39
|
+
trapFocus?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The single element that receives Popover trigger behavior.
|
|
42
|
+
*
|
|
43
|
+
* Custom components must forward standard DOM properties and a reference.
|
|
44
|
+
*/
|
|
45
|
+
trigger: ReactElement;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Renders an interactive, click-triggered panel beside one interface element.
|
|
49
|
+
*
|
|
50
|
+
* @param props - The properties that configure the Popover.
|
|
51
|
+
* @param forwardedReference - The reference assigned to the Popover panel.
|
|
52
|
+
*
|
|
53
|
+
* @returns The trigger and its portal-backed interactive panel.
|
|
54
|
+
*/
|
|
55
|
+
declare const Popover: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "children" | "onChange"> & {
|
|
56
|
+
/** Whether focus moves inside the panel when it opens. */
|
|
57
|
+
autoFocus?: boolean;
|
|
58
|
+
/** The interactive content displayed inside the Popover panel. */
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
/** Whether an outside pointer interaction closes the Popover. */
|
|
61
|
+
closeOnOutsideInteraction?: boolean;
|
|
62
|
+
/** Whether the Escape key closes the Popover. */
|
|
63
|
+
closeOnEscape?: boolean;
|
|
64
|
+
/** Whether an uncontrolled Popover is initially open. */
|
|
65
|
+
defaultOpen?: boolean;
|
|
66
|
+
/** Whether Popover behavior is disabled without removing its trigger. */
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
/** The preferred element focused when the Popover opens. */
|
|
69
|
+
initialFocusReference?: RefObject<HTMLElement | null>;
|
|
70
|
+
/** The callback receiving Escape before its default closing behavior. */
|
|
71
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
72
|
+
/** The callback invoked for a requested change to the open state. */
|
|
73
|
+
onOpenChange?: (open: boolean, reason: PopoverOpenChangeReason) => void;
|
|
74
|
+
/** The callback receiving an outside press before default behavior. */
|
|
75
|
+
onPointerDownOutside?: (event: PointerEvent) => void;
|
|
76
|
+
/** The controlled open state of the Popover. */
|
|
77
|
+
open?: boolean;
|
|
78
|
+
/** The preferred placement before viewport collision handling. */
|
|
79
|
+
placement?: PopoverPlacement;
|
|
80
|
+
/** The optional element receiving the Popover portal. */
|
|
81
|
+
portalContainer?: Element | null;
|
|
82
|
+
/** Whether focus returns to the trigger after non-outside closure. */
|
|
83
|
+
restoreFocus?: boolean;
|
|
84
|
+
/** Whether keyboard and programmatic focus remain inside the Popover. */
|
|
85
|
+
trapFocus?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The single element that receives Popover trigger behavior.
|
|
88
|
+
*
|
|
89
|
+
* Custom components must forward standard DOM properties and a reference.
|
|
90
|
+
*/
|
|
91
|
+
trigger: ReactElement;
|
|
92
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
93
|
+
export default Popover;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** A type representing properties accepted by an internal Portal. */
|
|
3
|
+
type PortalProps = {
|
|
4
|
+
/** The content rendered outside its React layout parent. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** The optional element receiving the portal content. */
|
|
7
|
+
container?: Element | null;
|
|
8
|
+
/** The optional element whose inherited Neatkit variables are preserved. */
|
|
9
|
+
inheritFrom?: HTMLElement | null;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Renders content into a browser-owned container after hydration.
|
|
13
|
+
*
|
|
14
|
+
* @param props - The portal destination, design source, and content.
|
|
15
|
+
*
|
|
16
|
+
* @returns A server-safe source marker and the mounted browser portal.
|
|
17
|
+
*/
|
|
18
|
+
export default function Portal(props: PortalProps): import("react").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A type representing a focus scope shared with nested portals. */
|
|
2
|
+
export type FocusScopeContextValue = {
|
|
3
|
+
/** Registers one portalled branch as part of the logical focus scope. */
|
|
4
|
+
registerBranch: (branch: HTMLElement) => () => void;
|
|
5
|
+
};
|
|
6
|
+
/** The internal React context connecting focus traps with nested portals. */
|
|
7
|
+
export declare const FocusScopeContext: import("react").Context<FocusScopeContextValue | undefined>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/** A type representing options accepted by a dismissable overlay layer. */
|
|
3
|
+
type DismissableLayerOptions = {
|
|
4
|
+
/** Whether the layer currently receives dismissal interactions. */
|
|
5
|
+
active: boolean;
|
|
6
|
+
/** Whether Escape requests dismissal. */
|
|
7
|
+
dismissOnEscape?: boolean;
|
|
8
|
+
/** Whether a pointer press outside every boundary requests dismissal. */
|
|
9
|
+
dismissOnPointerDownOutside?: boolean;
|
|
10
|
+
/** The boundaries considered part of the layer. */
|
|
11
|
+
boundaries: readonly RefObject<HTMLElement | null>[];
|
|
12
|
+
/** The stable overlay stack identifier for the layer. */
|
|
13
|
+
layerId: symbol;
|
|
14
|
+
/** The document owning the layer and its event listeners. */
|
|
15
|
+
ownerDocument: Document | null;
|
|
16
|
+
/** The callback receiving an Escape key before dismissal. */
|
|
17
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
18
|
+
/** The callback receiving an outside pointer press before dismissal. */
|
|
19
|
+
onPointerDownOutside?: (event: PointerEvent) => void;
|
|
20
|
+
/** The callback invoked after an allowed Escape interaction. */
|
|
21
|
+
onEscapeDismiss?: () => void;
|
|
22
|
+
/** The callback invoked after an allowed outside interaction. */
|
|
23
|
+
onPointerDownOutsideDismiss?: () => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Adds top-layer Escape and outside-pointer dismissal behavior.
|
|
27
|
+
*
|
|
28
|
+
* @param options - The layer state, boundaries, and dismissal callbacks.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useDismissableLayer(options: DismissableLayerOptions): void;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FloatingPlacement, type FloatingPosition } from "../utils/floating-position";
|
|
2
|
+
/**
|
|
3
|
+
* Keeps anchored floating content aligned and inside its viewport.
|
|
4
|
+
*
|
|
5
|
+
* @param active - Whether positioning observers should remain active.
|
|
6
|
+
* @param placement - The preferred floating placement.
|
|
7
|
+
* @param trigger - The element anchoring the floating panel.
|
|
8
|
+
* @param panel - The mounted floating panel.
|
|
9
|
+
*
|
|
10
|
+
* @returns The current fixed-position coordinates and resolved placement.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useFloatingPosition(active: boolean, placement: FloatingPlacement, trigger: HTMLElement | null, panel: HTMLElement | null): FloatingPosition | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import type { FocusScopeContextValue } from "../contexts/FocusScopeContext";
|
|
3
|
+
/** A type representing options accepted by the focus trap hook. */
|
|
4
|
+
type FocusTrapOptions = {
|
|
5
|
+
/** Whether focus containment currently applies. */
|
|
6
|
+
active: boolean;
|
|
7
|
+
/** Whether focus moves inside the trap when it activates. */
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
/** The element containing focus while the trap is active. */
|
|
10
|
+
container: HTMLElement | null;
|
|
11
|
+
/** The optional preferred element focused when the trap opens. */
|
|
12
|
+
initialFocusReference?: RefObject<HTMLElement | null>;
|
|
13
|
+
/** The stable overlay stack identifier for the trapped layer. */
|
|
14
|
+
layerId: symbol;
|
|
15
|
+
/** Whether focus returns to its prior owner when the trap closes. */
|
|
16
|
+
restoreFocus?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Traps focus within the topmost overlay and optionally restores its origin.
|
|
20
|
+
*
|
|
21
|
+
* @param options - The focus container, stack identity, and focus behavior.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useFocusTrap(options: FocusTrapOptions): FocusScopeContextValue;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A type representing the visual phase of transition presence. */
|
|
2
|
+
export type PresenceState = "closed" | "closing" | "open";
|
|
3
|
+
/** A type representing a transition presence result. */
|
|
4
|
+
type Presence = {
|
|
5
|
+
/** Whether the transitioning content remains mounted. */
|
|
6
|
+
present: boolean;
|
|
7
|
+
/** The visual phase exposed to component styles. */
|
|
8
|
+
state: PresenceState;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Keeps closing content mounted for its exit transition.
|
|
12
|
+
*
|
|
13
|
+
* @param open - Whether the content should be visibly open.
|
|
14
|
+
* @param exitDuration - The maximum exit transition duration in milliseconds.
|
|
15
|
+
*
|
|
16
|
+
* @returns The current mount and visual transition state.
|
|
17
|
+
*/
|
|
18
|
+
export declare function usePresence(open: boolean, exitDuration?: number): Presence;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locks document scrolling while compensating for the removed scrollbar.
|
|
3
|
+
*
|
|
4
|
+
* @param active - Whether the lock should currently apply.
|
|
5
|
+
* @param ownerDocument - The document whose body scrolling is controlled.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useScrollLock(active: boolean, ownerDocument: Document | null): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** A type representing a side available to anchored floating content. */
|
|
2
|
+
export type FloatingPlacement = "bottom" | "left" | "right" | "top";
|
|
3
|
+
/** A type representing the measured position of anchored floating content. */
|
|
4
|
+
export type FloatingPosition = {
|
|
5
|
+
/** The cross-axis offset at which the arrow points to the trigger. */
|
|
6
|
+
arrowOffset: number;
|
|
7
|
+
/** The resolved placement after viewport collision handling. */
|
|
8
|
+
placement: FloatingPlacement;
|
|
9
|
+
/** The viewport-relative horizontal position. */
|
|
10
|
+
left: number;
|
|
11
|
+
/** The viewport-relative vertical position. */
|
|
12
|
+
top: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Calculates collision-aware floating coordinates within a viewport.
|
|
16
|
+
*
|
|
17
|
+
* @param placement - The preferred floating placement.
|
|
18
|
+
* @param spacing - The minimum distance from triggers and viewport edges.
|
|
19
|
+
* @param triggerBounds - The viewport bounds of the anchoring trigger.
|
|
20
|
+
* @param panelBounds - The measured bounds of the floating panel.
|
|
21
|
+
* @param viewportWidth - The available viewport width.
|
|
22
|
+
* @param viewportHeight - The available viewport height.
|
|
23
|
+
*
|
|
24
|
+
* @returns The fitted coordinates and resolved floating placement.
|
|
25
|
+
*/
|
|
26
|
+
export declare function calculateFloatingPosition(placement: FloatingPlacement, spacing: number, triggerBounds: DOMRect, panelBounds: DOMRect, viewportWidth: number, viewportHeight: number): FloatingPosition;
|