neatkit 0.9.0 → 0.11.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.
Files changed (108) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +191 -120
  3. package/dist/{Button-DU4j_IED.cjs → Button-DtrX4X-s.cjs} +1 -1
  4. package/dist/{Button-BV5OUXpc.js → Button-LmEHdRkW.js} +2 -2
  5. package/dist/Button.cjs +1 -1
  6. package/dist/Button.js +1 -1
  7. package/dist/Checkbox.cjs +1 -1
  8. package/dist/Checkbox.js +112 -111
  9. package/dist/Field.cjs +1 -1
  10. package/dist/Field.js +57 -62
  11. package/dist/Icon-CMSHMSDJ.cjs +1 -0
  12. package/dist/{Icon-CxK1wlGk.js → Icon-NT3kRJYz.js} +275 -94
  13. package/dist/Icon.cjs +1 -1
  14. package/dist/Icon.js +1 -1
  15. package/dist/Input.cjs +1 -1
  16. package/dist/Input.js +53 -52
  17. package/dist/Markdown.cjs +1 -1
  18. package/dist/Markdown.js +1 -1
  19. package/dist/Modal.cjs +1 -1
  20. package/dist/Modal.js +58 -57
  21. package/dist/PinInput.cjs +1 -1
  22. package/dist/PinInput.js +89 -88
  23. package/dist/Popover.cjs +1 -1
  24. package/dist/Popover.js +117 -119
  25. package/dist/Progress.cjs +1 -0
  26. package/dist/Progress.js +40 -0
  27. package/dist/Radio.cjs +1 -1
  28. package/dist/Radio.js +48 -47
  29. package/dist/Select.cjs +1 -1
  30. package/dist/Select.js +364 -359
  31. package/dist/Sidebar.cjs +1 -1
  32. package/dist/Sidebar.js +381 -332
  33. package/dist/Spinner-BE0F4y2S.cjs +1 -0
  34. package/dist/Spinner-CmxlDlOk.js +23 -0
  35. package/dist/Spinner.cjs +1 -1
  36. package/dist/Spinner.js +1 -1
  37. package/dist/Switch.cjs +1 -1
  38. package/dist/Switch.js +1 -1
  39. package/dist/{Table-qetwZpTC.cjs → Table-Bjw9lUKS.cjs} +1 -1
  40. package/dist/{Table-CADupJEU.js → Table-GeoE4h-u.js} +2 -2
  41. package/dist/Table.cjs +1 -1
  42. package/dist/Table.js +1 -1
  43. package/dist/TextArea.cjs +1 -1
  44. package/dist/TextArea.js +1 -1
  45. package/dist/Tooltip-CpyROf6x.js +225 -0
  46. package/dist/Tooltip-DDPh_YFO.cjs +1 -0
  47. package/dist/Tooltip.cjs +1 -1
  48. package/dist/Tooltip.js +1 -1
  49. package/dist/aria-Bv-xVREf.js +17 -0
  50. package/dist/aria-DM-xYEHQ.cjs +1 -0
  51. package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
  52. package/dist/components/Icon/icons/AppleIcon.d.ts +11 -0
  53. package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
  54. package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
  55. package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
  56. package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
  57. package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
  58. package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
  59. package/dist/components/Icon/utils/registry.d.ts +7 -0
  60. package/dist/components/PinInput/PinInput.d.ts +1 -1
  61. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
  62. package/dist/components/Progress/Progress.d.ts +38 -0
  63. package/dist/components/Progress/index.d.ts +2 -0
  64. package/dist/components/Progress/utils/value.d.ts +25 -0
  65. package/dist/components/Radio/Radio.d.ts +1 -1
  66. package/dist/components/Select/Select.d.ts +6 -74
  67. package/dist/components/Select/components/CustomSelect.d.ts +59 -0
  68. package/dist/components/Select/components/NativeSelect.d.ts +26 -0
  69. package/dist/components/Select/components/SelectListbox.d.ts +50 -0
  70. package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
  71. package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
  72. package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
  73. package/dist/components/Select/utils/options.d.ts +38 -0
  74. package/dist/components/Sidebar/Sidebar.d.ts +30 -24
  75. package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
  76. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
  77. package/dist/components/Sidebar/components/SidebarPanel.d.ts +3 -3
  78. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -0
  79. package/dist/effects-D98vUn6N.cjs +1 -0
  80. package/dist/effects-DGbA6Q2O.js +18 -0
  81. package/dist/style.css +1 -1
  82. package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
  83. package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
  84. package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
  85. package/dist/useFloatingPosition-MGoyautY.js +57 -0
  86. package/dist/useFocusTrap-BxPazAL6.js +136 -0
  87. package/dist/useFocusTrap-CrMcAu8s.cjs +1 -0
  88. package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
  89. package/dist/usePresence-Dm0mls5p.cjs +1 -0
  90. package/dist/utils/aria.d.ts +4 -5
  91. package/dist/utils/trigger.d.ts +46 -0
  92. package/package.json +6 -1
  93. package/dist/Icon-BIBzgznI.cjs +0 -1
  94. package/dist/Spinner-BXgw60UC.cjs +0 -1
  95. package/dist/Spinner-CVYvk6YK.js +0 -25
  96. package/dist/Tooltip-B2d5ss7S.cjs +0 -1
  97. package/dist/Tooltip-BK64rkxV.js +0 -231
  98. package/dist/aria-Bntn6ad_.cjs +0 -1
  99. package/dist/aria-CeA9QfD1.js +0 -15
  100. package/dist/effects-D5CWf-Pl.js +0 -8
  101. package/dist/effects-D85L_7zM.cjs +0 -1
  102. package/dist/floating-position-DIjh2wnP.cjs +0 -1
  103. package/dist/floating-position-DvR6e334.js +0 -50
  104. package/dist/useFloatingPosition-B3ZC-v3v.js +0 -43
  105. package/dist/useFloatingPosition-GzkP9dCc.cjs +0 -1
  106. package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
  107. package/dist/useFocusTrap-DhVnlboe.js +0 -136
  108. package/dist/usePresence-B5RYv4e1.cjs +0 -1
@@ -0,0 +1,38 @@
1
+ import { type HTMLAttributes } from "react";
2
+ import "./styles/progress.css";
3
+ /** A type representing the semantic color treatment applied to a Progress. */
4
+ export type ProgressTone = "accent" | "info" | "success" | "warning" | "danger";
5
+ /** A type representing properties for the Progress component. */
6
+ export type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
7
+ /** The completed value, or omitted while the completion is unknown. */
8
+ value?: number;
9
+ /** The maximum the completed value is measured against. */
10
+ max?: number;
11
+ /** The semantic color treatment applied to the completed portion. */
12
+ tone?: ProgressTone;
13
+ };
14
+ /**
15
+ * Renders a determinate or indeterminate progress indicator.
16
+ *
17
+ * Omitting `value` reports an indeterminate task, which animates instead of
18
+ * publishing a completion the consumer cannot yet calculate.
19
+ *
20
+ * Progress carries no accessible name of its own, because only the consumer
21
+ * knows which task is being measured. Name it with `aria-label` or
22
+ * `aria-labelledby` so the task is announced alongside its completion, and
23
+ * describe an unconventional scale with `aria-valuetext`.
24
+ *
25
+ * @param props - The properties that configure the Progress.
26
+ * @param forwardedReference - The reference assigned to the rendered element.
27
+ *
28
+ * @returns The rendered Progress indicator.
29
+ */
30
+ declare const Progress: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
31
+ /** The completed value, or omitted while the completion is unknown. */
32
+ value?: number;
33
+ /** The maximum the completed value is measured against. */
34
+ max?: number;
35
+ /** The semantic color treatment applied to the completed portion. */
36
+ tone?: ProgressTone;
37
+ } & import("react").RefAttributes<HTMLDivElement>>;
38
+ export default Progress;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Progress";
2
+ export type { ProgressProps, ProgressTone } from "./Progress";
@@ -0,0 +1,25 @@
1
+ /** The maximum a Progress value is measured against when none is given. */
2
+ export declare const DEFAULT_PROGRESS_MAX = 100;
3
+ /** A type representing the completion reported by a determinate Progress. */
4
+ export type ProgressMeasurement = {
5
+ /** The maximum the completed value is measured against. */
6
+ max: number;
7
+ /** The completed value, clamped to the resolved range. */
8
+ value: number;
9
+ /** The completed portion of the range, as a percentage. */
10
+ percentage: number;
11
+ };
12
+ /**
13
+ * Resolves the completion a determinate Progress reports.
14
+ *
15
+ * Values outside the range are clamped rather than rejected, because progress
16
+ * computed from live totals overshoots on rounding often enough that failing
17
+ * would cost consumers a guard on every update.
18
+ *
19
+ * @param value - The completed value, or undefined while it is unknown.
20
+ * @param max - The maximum the completed value is measured against.
21
+ *
22
+ * @returns The resolved completion, or undefined when Progress is
23
+ * indeterminate.
24
+ */
25
+ export declare function resolveProgressMeasurement(value: number | undefined, max: number): ProgressMeasurement | undefined;
@@ -20,7 +20,7 @@ export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "checked" |
20
20
  *
21
21
  * @returns The rendered Radio option.
22
22
  */
23
- declare const RadioRoot: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "className" | "style" | "children" | "onChange" | "name" | "type" | "value" | "required" | "checked"> & {
23
+ declare const RadioRoot: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "className" | "style" | "children" | "onChange" | "value" | "name" | "type" | "required" | "checked"> & {
24
24
  /** The clickable and accessible label for the Radio option. */
25
25
  children: ReactNode;
26
26
  /** The additional class name applied to the Radio label root. */
@@ -1,78 +1,10 @@
1
- import { type ButtonHTMLAttributes, type CSSProperties, type ReactElement, type ReactNode, type RefAttributes, type SelectHTMLAttributes } from "react";
2
- import { type IconType } from "../Icon";
1
+ import { type ReactElement, type RefAttributes } from "react";
2
+ import { type CustomSelectProps } from "./components/CustomSelect";
3
+ import { type NativeSelectProps } from "./components/NativeSelect";
3
4
  import "./styles/select.css";
4
- /** A type representing one option in a custom Select. */
5
- export type SelectOption = {
6
- /** Whether the option is unavailable for selection. */
7
- disabled?: boolean;
8
- /** The optional icon displayed beside the option label. */
9
- icon?: IconType;
10
- /** The visible and accessible option label. */
11
- label: string;
12
- /** The form value represented by the option. */
13
- value: string;
14
- };
15
- /** A type representing custom trigger content independent of selection. */
16
- export type SelectDisplayOverride = {
17
- /** The optional icon displayed beside the trigger label. */
18
- icon?: IconType;
19
- /** The label displayed by the trigger. */
20
- label: string;
21
- };
22
- /** A type representing the existing native Select mode properties. */
23
- export type NativeSelectProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, "children" | "className" | "multiple" | "size" | "style"> & {
24
- /** The native option and optgroup content displayed by the Select. */
25
- children: ReactNode;
26
- /** The additional class name applied to the composite Select root. */
27
- className?: string;
28
- /** Whether the Select exposes an invalid semantic and visual state. */
29
- invalid?: boolean;
30
- /** The disabled empty-value guidance displayed before selection. */
31
- placeholder?: string;
32
- /** The inline styles applied to the composite Select root. */
33
- style?: CSSProperties;
34
- /** Custom options select portal mode and cannot accompany children. */
35
- options?: never;
36
- };
37
- /** A type representing the portal-backed custom Select mode properties. */
38
- export type CustomSelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "className" | "defaultValue" | "onChange" | "style" | "value"> & {
39
- /** Whether an outside pointer interaction closes the listbox. */
40
- closeOnOutsideInteraction?: boolean;
41
- /** Whether the Escape key closes the listbox. */
42
- closeOnEscape?: boolean;
43
- /** The additional class name applied to the composite Select root. */
44
- className?: string;
45
- /** The initially selected value for uncontrolled usage. */
46
- defaultValue?: string;
47
- /** The optional content displayed independently from the selected option. */
48
- displayOverride?: SelectDisplayOverride;
49
- /** Whether the Select exposes an invalid semantic and visual state. */
50
- invalid?: boolean;
51
- /** The native form name submitted through the custom Select. */
52
- name?: string;
53
- /** The callback invoked with a newly selected option value. */
54
- onChange?: (value: string) => void;
55
- /** The callback invoked whenever the listbox opens or closes. */
56
- onOpenChange?: (open: boolean) => void;
57
- /** The callback receiving Escape before its default closing behavior. */
58
- onEscapeKeyDown?: (event: KeyboardEvent) => void;
59
- /** The callback receiving an outside press before default behavior. */
60
- onPointerDownOutside?: (event: PointerEvent) => void;
61
- /** The options rendered by the portal-backed listbox. */
62
- options: readonly SelectOption[];
63
- /** The guidance displayed when no option is selected. */
64
- placeholder?: string;
65
- /** The inline styles applied to the composite Select root. */
66
- style?: CSSProperties;
67
- /** Whether the custom Select communicates that a value is required. */
68
- required?: boolean;
69
- /** The selected value for controlled usage. */
70
- value?: string;
71
- /** The width applied to the composite Select root. */
72
- width?: CSSProperties["width"];
73
- /** Native children belong to native mode and cannot accompany options. */
74
- children?: never;
75
- };
5
+ export type { CustomSelectProps, SelectDisplayOverride, } from "./components/CustomSelect";
6
+ export type { NativeSelectProps } from "./components/NativeSelect";
7
+ export type { SelectOption } from "./utils/options";
76
8
  /** A type representing properties accepted by either Select mode. */
77
9
  export type SelectProps = NativeSelectProps | CustomSelectProps;
78
10
  /** A type representing the public Select component overloads. */
@@ -0,0 +1,59 @@
1
+ import { type ButtonHTMLAttributes, type CSSProperties, type ForwardedRef } from "react";
2
+ import { type IconType } from "../../Icon";
3
+ import { type SelectOption } from "../utils/options";
4
+ /** A type representing custom trigger content independent of selection. */
5
+ export type SelectDisplayOverride = {
6
+ /** The optional icon displayed beside the trigger label. */
7
+ icon?: IconType;
8
+ /** The label displayed by the trigger. */
9
+ label: string;
10
+ };
11
+ /** A type representing the portal-backed custom Select mode properties. */
12
+ export type CustomSelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "className" | "defaultValue" | "onChange" | "style" | "value"> & {
13
+ /** Whether an outside pointer interaction closes the listbox. */
14
+ closeOnOutsideInteraction?: boolean;
15
+ /** Whether the Escape key closes the listbox. */
16
+ closeOnEscape?: boolean;
17
+ /** The additional class name applied to the composite Select root. */
18
+ className?: string;
19
+ /** The initially selected value for uncontrolled usage. */
20
+ defaultValue?: string;
21
+ /** The optional content displayed independently from the selected option. */
22
+ displayOverride?: SelectDisplayOverride;
23
+ /** Whether the Select exposes an invalid semantic and visual state. */
24
+ invalid?: boolean;
25
+ /** The native form name submitted through the custom Select. */
26
+ name?: string;
27
+ /** The callback invoked with a newly selected option value. */
28
+ onChange?: (value: string) => void;
29
+ /** The callback invoked whenever the listbox opens or closes. */
30
+ onOpenChange?: (open: boolean) => void;
31
+ /** The callback receiving Escape before its default closing behavior. */
32
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
33
+ /** The callback receiving an outside press before default behavior. */
34
+ onPointerDownOutside?: (event: PointerEvent) => void;
35
+ /** The options rendered by the portal-backed listbox. */
36
+ options: readonly SelectOption[];
37
+ /** The guidance displayed when no option is selected. */
38
+ placeholder?: string;
39
+ /** The inline styles applied to the composite Select root. */
40
+ style?: CSSProperties;
41
+ /** Whether the custom Select communicates that a value is required. */
42
+ required?: boolean;
43
+ /** The selected value for controlled usage. */
44
+ value?: string;
45
+ /** The width applied to the composite Select root. */
46
+ width?: CSSProperties["width"];
47
+ /** Native children belong to native mode and cannot accompany options. */
48
+ children?: never;
49
+ };
50
+ /**
51
+ * Renders the options-driven, portal-backed Select mode.
52
+ *
53
+ * @param props - The custom Select properties and forwarded reference.
54
+ *
55
+ * @returns The rendered custom Select trigger and listbox portal.
56
+ */
57
+ export default function CustomSelect(props: CustomSelectProps & {
58
+ forwardedReference: ForwardedRef<HTMLButtonElement>;
59
+ }): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import type { CSSProperties, ForwardedRef, ReactNode, SelectHTMLAttributes } from "react";
2
+ /** A type representing the existing native Select mode properties. */
3
+ export type NativeSelectProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, "children" | "className" | "multiple" | "size" | "style"> & {
4
+ /** The native option and optgroup content displayed by the Select. */
5
+ children: ReactNode;
6
+ /** The additional class name applied to the composite Select root. */
7
+ className?: string;
8
+ /** Whether the Select exposes an invalid semantic and visual state. */
9
+ invalid?: boolean;
10
+ /** The disabled empty-value guidance displayed before selection. */
11
+ placeholder?: string;
12
+ /** The inline styles applied to the composite Select root. */
13
+ style?: CSSProperties;
14
+ /** Custom options select portal mode and cannot accompany children. */
15
+ options?: never;
16
+ };
17
+ /**
18
+ * Renders a themed native single-selection control.
19
+ *
20
+ * @param props - The native Select properties and forwarded reference.
21
+ *
22
+ * @returns The rendered native Select control.
23
+ */
24
+ export default function NativeSelect(props: NativeSelectProps & {
25
+ forwardedReference: ForwardedRef<HTMLSelectElement>;
26
+ }): import("react").JSX.Element;
@@ -0,0 +1,50 @@
1
+ import { type RefObject } from "react";
2
+ import type { ListboxPosition } from "../utils/listbox-position";
3
+ import type { SelectOption } from "../utils/options";
4
+ /** A type representing properties used by a mounted custom listbox. */
5
+ export type SelectListboxProps = {
6
+ /** Whether the listbox remains interactively open. */
7
+ active: boolean;
8
+ /** Whether Escape closes the listbox. */
9
+ closeOnEscape: boolean;
10
+ /** Whether outside pointer interaction closes the listbox. */
11
+ closeOnOutsideInteraction: boolean;
12
+ /** The highlighted option index. */
13
+ highlightedIndex: number;
14
+ /** The identifier assigned to the listbox. */
15
+ id: string;
16
+ /** The reference receiving the mounted listbox. */
17
+ listboxReference: (element: HTMLDivElement | null) => void;
18
+ /** The callback closing the listbox because of Escape. */
19
+ onEscapeDismiss: () => void;
20
+ /** The callback receiving Escape before default closing behavior. */
21
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
22
+ /** The callback updating the highlighted option. */
23
+ onHighlight: (index: number) => void;
24
+ /** The callback closing the listbox because of an outside press. */
25
+ onOutsideDismiss: () => void;
26
+ /** The callback receiving an outside press before default behavior. */
27
+ onPointerDownOutside?: (event: PointerEvent) => void;
28
+ /** The callback selecting an enabled option. */
29
+ onSelect: (option: SelectOption) => void;
30
+ /** The options displayed by the listbox. */
31
+ options: readonly SelectOption[];
32
+ /** The document owning the listbox layer. */
33
+ ownerDocument: Document;
34
+ /** The boundary-relative position fitted for the listbox. */
35
+ position: ListboxPosition | null;
36
+ /** The selected option value. */
37
+ selectedValue: string;
38
+ /** The visual phase exposed to transition styles. */
39
+ state: "closing" | "open";
40
+ /** The reference containing the Select trigger. */
41
+ triggerReference: RefObject<HTMLButtonElement | null>;
42
+ };
43
+ /**
44
+ * Renders one mounted custom Select listbox and its shared layer behavior.
45
+ *
46
+ * @param props - The listbox options, position, state, and callbacks.
47
+ *
48
+ * @returns The active or exiting custom listbox.
49
+ */
50
+ export default function SelectListbox(props: SelectListboxProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { type MutableRefObject, type RefObject } from "react";
2
+ /** A type representing options accepted by the form reset hook. */
3
+ export type SelectFormResetOptions = {
4
+ /**
5
+ * The form the Select is associated with.
6
+ *
7
+ * Observed rather than read, so the listener follows a reassociated form.
8
+ */
9
+ form?: string;
10
+ /** The callback restoring Select state alongside the proxied control. */
11
+ onReset: () => void;
12
+ /** The option value the proxied control defaults back to. */
13
+ resetValue: string;
14
+ /** The reference containing the Select trigger. */
15
+ triggerReference: RefObject<HTMLButtonElement | null>;
16
+ };
17
+ /**
18
+ * Restores the proxied form control and the Select on a native form reset.
19
+ *
20
+ * The listener follows the trigger's form rather than the proxied control's,
21
+ * because a Select submitting no value still restores what it displays.
22
+ *
23
+ * @param options - The reset value, form association, and restoration.
24
+ *
25
+ * @returns The reference assigned to the proxied form control.
26
+ */
27
+ export declare function useSelectFormReset(options: SelectFormResetOptions): MutableRefObject<HTMLSelectElement | null>;
@@ -0,0 +1,12 @@
1
+ import { type ListboxPosition } from "../utils/listbox-position";
2
+ /**
3
+ * Keeps a custom listbox aligned to its trigger and inside its boundary.
4
+ *
5
+ * @param active - Whether positioning observers should remain active.
6
+ * @param trigger - The trigger anchoring the listbox.
7
+ * @param listbox - The mounted listbox being positioned.
8
+ * @param boundary - The Boundary that constrains the listbox position.
9
+ *
10
+ * @returns The boundary-relative coordinates and size constraints.
11
+ */
12
+ export declare function useSelectPosition(active: boolean, trigger: HTMLButtonElement | null, listbox: HTMLDivElement | null, boundary: HTMLElement | null): ListboxPosition | null;
@@ -0,0 +1,14 @@
1
+ import { type RefObject } from "react";
2
+ /**
3
+ * Accumulates typed characters into a query for incremental search.
4
+ *
5
+ * A run of one repeated character narrows to that single character, so
6
+ * pressing a key repeatedly cycles the entries beginning with it rather
7
+ * than searching for a query nothing can match.
8
+ *
9
+ * @param elementReference - The element whose realm owns the reset timer.
10
+ *
11
+ * @returns Records one character and returns the query to search for, or
12
+ * null when the element has no realm to schedule a reset in.
13
+ */
14
+ export declare function useTypeahead(elementReference: RefObject<HTMLElement | null>): (character: string) => string | null;
@@ -0,0 +1,38 @@
1
+ import type { IconType } from "../../Icon";
2
+ /** A type representing one option in a custom Select. */
3
+ export type SelectOption = {
4
+ /** Whether the option is unavailable for selection. */
5
+ disabled?: boolean;
6
+ /** The optional icon displayed beside the option label. */
7
+ icon?: IconType;
8
+ /** The visible and accessible option label. */
9
+ label: string;
10
+ /** The form value represented by the option. */
11
+ value: string;
12
+ };
13
+ /**
14
+ * Returns the next enabled option index in a requested direction.
15
+ *
16
+ * @param options - The options inspected for availability.
17
+ * @param currentIndex - The index from which navigation begins.
18
+ * @param direction - The movement direction through the options.
19
+ *
20
+ * @returns The next enabled index, or -1 when no enabled option exists.
21
+ */
22
+ export declare function findEnabledOptionIndex(options: readonly SelectOption[], currentIndex: number, direction: 1 | -1): number;
23
+ /**
24
+ * Returns the next enabled option whose label starts with a query.
25
+ *
26
+ * @param options - The options inspected for a matching label.
27
+ * @param query - The normalized typeahead query.
28
+ * @param currentIndex - The index after which matching begins.
29
+ *
30
+ * @returns The next matching index, or -1 when no option matches.
31
+ */
32
+ export declare function findMatchingOptionIndex(options: readonly SelectOption[], query: string, currentIndex: number): number;
33
+ /**
34
+ * Validates that option values identify exactly one custom Select option.
35
+ *
36
+ * @param options - The options whose values are inspected.
37
+ */
38
+ export declare function validateSelectOptions(options: readonly SelectOption[]): void;
@@ -36,26 +36,29 @@ type SidebarComponent = typeof SidebarRoot & {
36
36
  export type SidebarProps = Omit<HTMLAttributes<HTMLElement>, "children" | "id" | "role" | "style" | "tabIndex"> & {
37
37
  /** The regions and groups composing the Sidebar. */
38
38
  children?: ReactNode;
39
+ /**
40
+ * Whether the Sidebar renders inline, as an overlay, or responsively. Where a
41
+ * responsive Sidebar switches at the medium breakpoint of its Boundary.
42
+ */
43
+ variant?: SidebarVariant;
44
+ /** The edge the overlay Sidebar occupies. */
45
+ side?: SidebarSide;
46
+ /** The width of the Sidebar in both presentations, as a CSS length. */
47
+ width?: string;
48
+ /** The height of the Sidebar in inline presentation, as a CSS length. */
49
+ height?: string;
50
+ /** The styles applied to the Sidebar panel. */
51
+ style?: SidebarStyle;
39
52
  /** Whether an uncontrolled overlay Sidebar is initially open. */
40
53
  defaultOpen?: boolean;
54
+ /** The controlled open state of the overlay Sidebar. */
55
+ open?: boolean;
41
56
  /** The preferred element focused when the overlay Sidebar opens. */
42
57
  initialFocusReference?: RefObject<HTMLElement | null>;
43
- /** The distance the inline Sidebar is pinned below its scroll container. */
44
- top?: string;
45
58
  /** Whether document scrolling is locked while the overlay is open. */
46
59
  lockScroll?: boolean;
47
- /** The controlled open state of the overlay Sidebar. */
48
- open?: boolean;
49
60
  /** Whether focus returns to the Trigger after the overlay closes. */
50
61
  restoreFocus?: boolean;
51
- /** The edge the overlay Sidebar occupies. */
52
- side?: SidebarSide;
53
- /** The styles applied to the Sidebar panel. */
54
- style?: SidebarStyle;
55
- /** The responsive behavior selecting the Sidebar presentation. */
56
- variant?: SidebarVariant;
57
- /** The width of the Sidebar as a valid CSS length. */
58
- width?: string;
59
62
  /** The callback invoked when an interaction requests a changed state. */
60
63
  onOpenChange?: (open: boolean, reason: SidebarOpenChangeReason) => void;
61
64
  };
@@ -85,26 +88,29 @@ export type SidebarProps = Omit<HTMLAttributes<HTMLElement>, "children" | "id" |
85
88
  declare const SidebarRoot: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "id" | "style" | "tabIndex" | "role" | "children"> & {
86
89
  /** The regions and groups composing the Sidebar. */
87
90
  children?: ReactNode;
91
+ /**
92
+ * Whether the Sidebar renders inline, as an overlay, or responsively. Where a
93
+ * responsive Sidebar switches at the medium breakpoint of its Boundary.
94
+ */
95
+ variant?: SidebarVariant;
96
+ /** The edge the overlay Sidebar occupies. */
97
+ side?: SidebarSide;
98
+ /** The width of the Sidebar in both presentations, as a CSS length. */
99
+ width?: string;
100
+ /** The height of the Sidebar in inline presentation, as a CSS length. */
101
+ height?: string;
102
+ /** The styles applied to the Sidebar panel. */
103
+ style?: SidebarStyle;
88
104
  /** Whether an uncontrolled overlay Sidebar is initially open. */
89
105
  defaultOpen?: boolean;
106
+ /** The controlled open state of the overlay Sidebar. */
107
+ open?: boolean;
90
108
  /** The preferred element focused when the overlay Sidebar opens. */
91
109
  initialFocusReference?: RefObject<HTMLElement | null>;
92
- /** The distance the inline Sidebar is pinned below its scroll container. */
93
- top?: string;
94
110
  /** Whether document scrolling is locked while the overlay is open. */
95
111
  lockScroll?: boolean;
96
- /** The controlled open state of the overlay Sidebar. */
97
- open?: boolean;
98
112
  /** Whether focus returns to the Trigger after the overlay closes. */
99
113
  restoreFocus?: boolean;
100
- /** The edge the overlay Sidebar occupies. */
101
- side?: SidebarSide;
102
- /** The styles applied to the Sidebar panel. */
103
- style?: SidebarStyle;
104
- /** The responsive behavior selecting the Sidebar presentation. */
105
- variant?: SidebarVariant;
106
- /** The width of the Sidebar as a valid CSS length. */
107
- width?: string;
108
114
  /** The callback invoked when an interaction requests a changed state. */
109
115
  onOpenChange?: (open: boolean, reason: SidebarOpenChangeReason) => void;
110
116
  } & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,32 @@
1
+ import type { RefCallback } from "react";
2
+ import type { SidebarSide } from "./SidebarPanel";
3
+ /** A type representing properties for the fallback Sidebar trigger. */
4
+ export type SidebarFallbackTriggerProps = {
5
+ /** The identifier of the panel, while one is mounted. */
6
+ panelId: string | undefined;
7
+ /** The name announced for the button. */
8
+ label: string;
9
+ /** Whether the Sidebar this button opens is currently open. */
10
+ sidebarOpen: boolean;
11
+ /** Opens or closes the Sidebar. */
12
+ onToggle: () => void;
13
+ /** The reference registering the button for overlay dismissal. */
14
+ reference: RefCallback<HTMLElement>;
15
+ /** The edge the Sidebar occupies. */
16
+ side: SidebarSide;
17
+ };
18
+ /**
19
+ * Renders the button that opens a Sidebar when nothing renders a Trigger.
20
+ *
21
+ * An overlay Sidebar can only be opened by a Trigger, so without one its
22
+ * content is unreachable. The button sits inside the Boundary rather than
23
+ * being fixed to the viewport, so a Boundary smaller than the page keeps it.
24
+ *
25
+ * It stays mounted while the Sidebar is open, as a Trigger does, so closing
26
+ * can return focus to it.
27
+ *
28
+ * @param props - The panel to open and the edge it occupies.
29
+ *
30
+ * @returns The rendered button.
31
+ */
32
+ export default function SidebarFallbackTrigger(props: SidebarFallbackTriggerProps): import("react").JSX.Element;
@@ -5,11 +5,10 @@ import { type SidebarPanelProps } from "./SidebarPanel";
5
5
  * A type representing properties for the mounted Sidebar overlay layer.
6
6
  *
7
7
  * The forwarded panel properties are derived rather than restated, so the
8
- * consumer attributes the root spreads through here stay described by one
9
- * declaration. The overlay supplies the presentation, open state, and
10
- * identifier itself, and a top offset applies to no overlay.
8
+ * consumer attributes that the root spreads through here, stay described by
9
+ * one declaration.
11
10
  */
12
- type SidebarOverlayProps = Omit<SidebarPanelProps, "top" | "open" | "panelId" | "panelReference" | "presentation" | "state"> & {
11
+ type SidebarOverlayProps = Omit<SidebarPanelProps, "height" | "open" | "panelId" | "panelReference" | "presentation" | "state"> & {
13
12
  /** The elements treated as part of the overlay dismissal layer. */
14
13
  boundaries: readonly RefObject<HTMLElement | null>[];
15
14
  /** The preferred element focused when the Sidebar opens. */
@@ -1,7 +1,7 @@
1
1
  import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from "react";
2
2
  import type { SidebarPresentationState } from "../utils/state";
3
3
  /** A type representing the edge an overlay Sidebar occupies. */
4
- export type SidebarSide = "end" | "start";
4
+ export type SidebarSide = "left" | "right";
5
5
  /** A type representing CSS custom properties accepted by Sidebar styles. */
6
6
  type SidebarCustomProperties = {
7
7
  [CustomProperty in `--${string}`]?: string | number;
@@ -12,8 +12,8 @@ export type SidebarStyle = CSSProperties & SidebarCustomProperties;
12
12
  export type SidebarPanelProps = Omit<HTMLAttributes<HTMLElement>, "children" | "style"> & {
13
13
  /** The regions and groups composing the Sidebar. */
14
14
  children?: ReactNode;
15
- /** The distance the inline panel is pinned below its scroll container. */
16
- top?: string;
15
+ /** The height of the inline panel as a CSS length. */
16
+ height?: string;
17
17
  /** The identifier associating the panel with its Trigger. */
18
18
  panelId?: string;
19
19
  /** The reference assigned to the rendered panel element. */
@@ -24,6 +24,10 @@ export type SidebarTriggerProps = {
24
24
  *
25
25
  * Custom components must forward the class name, reference, click handler,
26
26
  * and ARIA properties to their interactive root.
27
+ *
28
+ * When nothing renders a Trigger, Sidebar shows a fallback button instead.
29
+ * A Trigger hidden with CSS still counts as present, so no fallback appears.
30
+ * Render the Trigger conditionally instead of hiding it.
27
31
  */
28
32
  children: ReactElement;
29
33
  };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react"),r=e.createContext(void 0);function n(o){const t=e.useContext(r);if(o!==void 0&&!t)throw new Error(`${o} must be rendered inside Boundary. Neatkit resolves portals, overlay stacking, and responsive behavior against the nearest Boundary, so wrap your interface in <Boundary>.`);return t}const s=typeof window>"u"?e.useEffect:e.useLayoutEffect;exports.BoundaryContext=r;exports.useBoundary=n;exports.useIsomorphicLayoutEffect=s;
@@ -0,0 +1,18 @@
1
+ import { createContext as t, useContext as r, useEffect as n, useLayoutEffect as a } from "react";
2
+ const s = t(
3
+ void 0
4
+ );
5
+ function i(e) {
6
+ const o = r(s);
7
+ if (e !== void 0 && !o)
8
+ throw new Error(
9
+ `${e} must be rendered inside Boundary. Neatkit resolves portals, overlay stacking, and responsive behavior against the nearest Boundary, so wrap your interface in <Boundary>.`
10
+ );
11
+ return o;
12
+ }
13
+ const d = typeof window > "u" ? n : a;
14
+ export {
15
+ s as B,
16
+ d as a,
17
+ i as u
18
+ };