neatkit 0.8.0 → 0.10.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 (113) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +29 -29
  3. package/dist/Button-CVe9T_Zw.cjs +1 -0
  4. package/dist/Button-D6rXvcqq.js +101 -0
  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 +111 -110
  9. package/dist/{Code-JDb4VFl7.cjs → Code-B7s_rN0G.cjs} +1 -1
  10. package/dist/{Code-ClkozPlv.js → Code-Bp2X1k-g.js} +1 -4
  11. package/dist/Code.cjs +1 -1
  12. package/dist/Code.js +1 -1
  13. package/dist/Divider-C7XGlr26.cjs +1 -0
  14. package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
  15. package/dist/Divider.cjs +1 -1
  16. package/dist/Divider.js +1 -1
  17. package/dist/Icon-BIBzgznI.cjs +1 -0
  18. package/dist/{Icon-BoEUoOk7.js → Icon-CxK1wlGk.js} +98 -52
  19. package/dist/Icon.cjs +1 -1
  20. package/dist/Icon.js +1 -1
  21. package/dist/Input.cjs +1 -1
  22. package/dist/Input.js +52 -51
  23. package/dist/Markdown.cjs +1 -1
  24. package/dist/Markdown.js +108 -104
  25. package/dist/Modal.cjs +1 -1
  26. package/dist/Modal.js +57 -56
  27. package/dist/PinInput.cjs +1 -1
  28. package/dist/PinInput.js +88 -87
  29. package/dist/Popover.cjs +1 -1
  30. package/dist/Popover.js +147 -141
  31. package/dist/Progress.cjs +1 -0
  32. package/dist/Progress.js +40 -0
  33. package/dist/Radio.cjs +1 -1
  34. package/dist/Radio.js +48 -47
  35. package/dist/Select.cjs +1 -1
  36. package/dist/Select.js +363 -359
  37. package/dist/Sidebar.cjs +1 -1
  38. package/dist/Sidebar.js +326 -311
  39. package/dist/Spinner-BE0F4y2S.cjs +1 -0
  40. package/dist/Spinner-CmxlDlOk.js +23 -0
  41. package/dist/Spinner.cjs +1 -1
  42. package/dist/Spinner.js +1 -1
  43. package/dist/Table-BqWBgMTU.cjs +1 -0
  44. package/dist/Table-DutHfiXR.js +423 -0
  45. package/dist/Table.cjs +1 -1
  46. package/dist/Table.js +1 -1
  47. package/dist/{Tooltip-B4bajPtk.cjs → Tooltip-CCuE-hfp.cjs} +1 -1
  48. package/dist/{Tooltip-BVqdnKK_.js → Tooltip-CeyRKNv4.js} +1 -1
  49. package/dist/Tooltip.cjs +1 -1
  50. package/dist/Tooltip.js +1 -1
  51. package/dist/albert-sans-cb3e34c4.woff2 +0 -0
  52. package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
  53. package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
  54. package/dist/components/Icon/utils/registry.d.ts +2 -0
  55. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
  56. package/dist/components/Progress/Progress.d.ts +38 -0
  57. package/dist/components/Progress/index.d.ts +2 -0
  58. package/dist/components/Progress/utils/value.d.ts +25 -0
  59. package/dist/components/Select/Select.d.ts +6 -74
  60. package/dist/components/Select/components/CustomSelect.d.ts +59 -0
  61. package/dist/components/Select/components/NativeSelect.d.ts +26 -0
  62. package/dist/components/Select/components/SelectListbox.d.ts +50 -0
  63. package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
  64. package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
  65. package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
  66. package/dist/components/Select/utils/options.d.ts +38 -0
  67. package/dist/components/Sidebar/Sidebar.d.ts +36 -25
  68. package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
  69. package/dist/components/Sidebar/components/SidebarGroup.d.ts +5 -16
  70. package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
  71. package/dist/components/Sidebar/components/SidebarItem.d.ts +3 -0
  72. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
  73. package/dist/components/Sidebar/components/SidebarPanel.d.ts +4 -4
  74. package/dist/components/Sidebar/hooks/usePresentation.d.ts +2 -2
  75. package/dist/components/Sidebar/index.d.ts +1 -1
  76. package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
  77. package/dist/components/Sidebar/utils/state.d.ts +2 -2
  78. package/dist/components/Table/Table.d.ts +21 -209
  79. package/dist/components/Table/components/TableAction.d.ts +18 -0
  80. package/dist/components/Table/components/TableActionCell.d.ts +15 -0
  81. package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
  82. package/dist/components/Table/components/TableBody.d.ts +27 -0
  83. package/dist/components/Table/components/TableCell.d.ts +42 -0
  84. package/dist/components/Table/components/TableFoot.d.ts +19 -0
  85. package/dist/components/Table/components/TableHead.d.ts +19 -0
  86. package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
  87. package/dist/components/Table/components/TableRow.d.ts +67 -0
  88. package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
  89. package/dist/components/Table/utils/cell.d.ts +25 -0
  90. package/dist/components/Table/utils/children.d.ts +18 -0
  91. package/dist/components/Table/utils/trigger.d.ts +54 -0
  92. package/dist/style.css +1 -1
  93. package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
  94. package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
  95. package/dist/useFloatingPosition-Dq8xpr3E.js +27 -0
  96. package/dist/useFloatingPosition-g5kXywoB.cjs +1 -0
  97. package/dist/useFocusTrap-C0IcCdNf.js +136 -0
  98. package/dist/useFocusTrap-gAK_402D.cjs +1 -0
  99. package/package.json +7 -1
  100. package/dist/Button-Chv4O66e.js +0 -99
  101. package/dist/Button-DCKtFvSo.cjs +0 -1
  102. package/dist/Divider-CJYbFcSX.cjs +0 -1
  103. package/dist/Icon-DJ4BigRz.cjs +0 -1
  104. package/dist/Spinner-BXgw60UC.cjs +0 -1
  105. package/dist/Spinner-CVYvk6YK.js +0 -25
  106. package/dist/Table-B30TBckZ.js +0 -402
  107. package/dist/Table-DceR12X9.cjs +0 -1
  108. package/dist/floating-position-5wJ5G5IT.js +0 -48
  109. package/dist/floating-position-Cy9xxdH4.cjs +0 -1
  110. package/dist/useFloatingPosition-BBEUHPqy.cjs +0 -1
  111. package/dist/useFloatingPosition-CMirP2-2.js +0 -43
  112. package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
  113. package/dist/useFocusTrap-DhVnlboe.js +0 -136
@@ -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;
@@ -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;
@@ -1,6 +1,7 @@
1
1
  import { type HTMLAttributes, type ReactNode, type RefObject } from "react";
2
2
  import SidebarFooter from "./components/SidebarFooter";
3
3
  import SidebarGroup from "./components/SidebarGroup";
4
+ import SidebarHeader from "./components/SidebarHeader";
4
5
  import SidebarItem from "./components/SidebarItem";
5
6
  import { type SidebarSide, type SidebarStyle } from "./components/SidebarPanel";
6
7
  import SidebarTrigger from "./components/SidebarTrigger";
@@ -8,11 +9,13 @@ import SidebarUser from "./components/SidebarUser";
8
9
  import { type SidebarOpenChangeReason, type SidebarVariant } from "./utils/state";
9
10
  import "./styles/sidebar.css";
10
11
  export type { SidebarFooterProps } from "./components/SidebarFooter";
11
- export type { SidebarGroupPresentation, SidebarGroupProps, } from "./components/SidebarGroup";
12
+ export type { SidebarGroupProps } from "./components/SidebarGroup";
13
+ export type { SidebarHeaderProps } from "./components/SidebarHeader";
12
14
  export type { SidebarItemProps } from "./components/SidebarItem";
13
15
  export type { SidebarSide } from "./components/SidebarPanel";
14
16
  export type { SidebarTriggerProps } from "./components/SidebarTrigger";
15
17
  export type { SidebarUserAction, SidebarUserProps, } from "./components/SidebarUser";
18
+ export type { SidebarPresentation } from "./utils/presentation";
16
19
  export type { SidebarOpenChangeReason, SidebarVariant } from "./utils/state";
17
20
  /** A type representing the complete compound Sidebar component. */
18
21
  type SidebarComponent = typeof SidebarRoot & {
@@ -20,6 +23,8 @@ type SidebarComponent = typeof SidebarRoot & {
20
23
  Footer: typeof SidebarFooter;
21
24
  /** A related set of Sidebar items forming one navigation region. */
22
25
  Group: typeof SidebarGroup;
26
+ /** The region rendered at the top of the Sidebar. */
27
+ Header: typeof SidebarHeader;
23
28
  /** One navigation destination or action inside a group. */
24
29
  Item: typeof SidebarItem;
25
30
  /** The control disclosing an overlay Sidebar. */
@@ -31,26 +36,29 @@ type SidebarComponent = typeof SidebarRoot & {
31
36
  export type SidebarProps = Omit<HTMLAttributes<HTMLElement>, "children" | "id" | "role" | "style" | "tabIndex"> & {
32
37
  /** The regions and groups composing the Sidebar. */
33
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;
34
52
  /** Whether an uncontrolled overlay Sidebar is initially open. */
35
53
  defaultOpen?: boolean;
54
+ /** The controlled open state of the overlay Sidebar. */
55
+ open?: boolean;
36
56
  /** The preferred element focused when the overlay Sidebar opens. */
37
57
  initialFocusReference?: RefObject<HTMLElement | null>;
38
- /** The distance the inline Sidebar is pinned below its scroll container. */
39
- top?: string;
40
58
  /** Whether document scrolling is locked while the overlay is open. */
41
59
  lockScroll?: boolean;
42
- /** The controlled open state of the overlay Sidebar. */
43
- open?: boolean;
44
60
  /** Whether focus returns to the Trigger after the overlay closes. */
45
61
  restoreFocus?: boolean;
46
- /** The edge the overlay Sidebar occupies. */
47
- side?: SidebarSide;
48
- /** The styles applied to the Sidebar panel. */
49
- style?: SidebarStyle;
50
- /** The responsive behavior selecting the Sidebar presentation. */
51
- variant?: SidebarVariant;
52
- /** The width of the Sidebar as a valid CSS length. */
53
- width?: string;
54
62
  /** The callback invoked when an interaction requests a changed state. */
55
63
  onOpenChange?: (open: boolean, reason: SidebarOpenChangeReason) => void;
56
64
  };
@@ -80,26 +88,29 @@ export type SidebarProps = Omit<HTMLAttributes<HTMLElement>, "children" | "id" |
80
88
  declare const SidebarRoot: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "id" | "style" | "tabIndex" | "role" | "children"> & {
81
89
  /** The regions and groups composing the Sidebar. */
82
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;
83
104
  /** Whether an uncontrolled overlay Sidebar is initially open. */
84
105
  defaultOpen?: boolean;
106
+ /** The controlled open state of the overlay Sidebar. */
107
+ open?: boolean;
85
108
  /** The preferred element focused when the overlay Sidebar opens. */
86
109
  initialFocusReference?: RefObject<HTMLElement | null>;
87
- /** The distance the inline Sidebar is pinned below its scroll container. */
88
- top?: string;
89
110
  /** Whether document scrolling is locked while the overlay is open. */
90
111
  lockScroll?: boolean;
91
- /** The controlled open state of the overlay Sidebar. */
92
- open?: boolean;
93
112
  /** Whether focus returns to the Trigger after the overlay closes. */
94
113
  restoreFocus?: boolean;
95
- /** The edge the overlay Sidebar occupies. */
96
- side?: SidebarSide;
97
- /** The styles applied to the Sidebar panel. */
98
- style?: SidebarStyle;
99
- /** The responsive behavior selecting the Sidebar presentation. */
100
- variant?: SidebarVariant;
101
- /** The width of the Sidebar as a valid CSS length. */
102
- width?: string;
103
114
  /** The callback invoked when an interaction requests a changed state. */
104
115
  onOpenChange?: (open: boolean, reason: SidebarOpenChangeReason) => void;
105
116
  } & import("react").RefAttributes<HTMLElement>>;
@@ -1,8 +1,11 @@
1
1
  import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type SidebarPresentation } from "../utils/presentation";
2
3
  /** A type representing properties for the Sidebar.Footer component. */
3
4
  export type SidebarFooterProps = HTMLAttributes<HTMLDivElement> & {
4
5
  /** The content pinned to the bottom of the Sidebar. */
5
6
  children?: ReactNode;
7
+ /** The presentations the footer is rendered in. */
8
+ presentation?: SidebarPresentation;
6
9
  };
7
10
  /**
8
11
  * Renders the region pinned to the bottom of a Sidebar.
@@ -15,5 +18,7 @@ export type SidebarFooterProps = HTMLAttributes<HTMLDivElement> & {
15
18
  declare const SidebarFooter: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
16
19
  /** The content pinned to the bottom of the Sidebar. */
17
20
  children?: ReactNode;
21
+ /** The presentations the footer is rendered in. */
22
+ presentation?: SidebarPresentation;
18
23
  } & import("react").RefAttributes<HTMLDivElement>>;
19
24
  export default SidebarFooter;
@@ -1,19 +1,13 @@
1
1
  import { type HTMLAttributes, type ReactNode } from "react";
2
- /** A type representing the presentations that render a Sidebar group. */
3
- export type SidebarGroupPresentation = "both" | "inline" | "overlay";
2
+ import { type SidebarPresentation } from "../utils/presentation";
4
3
  /** A type representing properties for the Sidebar.Group component. */
5
4
  export type SidebarGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
6
5
  /** The Sidebar items rendered inside the group. */
7
6
  children?: ReactNode;
8
7
  /** The visible heading naming the group's navigation region. */
9
8
  label?: ReactNode;
10
- /**
11
- * The Sidebar presentations that render the group.
12
- *
13
- * Restricting a group suits navigation duplicated elsewhere in a wide
14
- * layout, such as links an application bar already provides.
15
- */
16
- presentation?: SidebarGroupPresentation;
9
+ /** The presentations the group is rendered in. */
10
+ presentation?: SidebarPresentation;
17
11
  };
18
12
  /**
19
13
  * Renders a related set of Sidebar items as one navigation region.
@@ -31,12 +25,7 @@ declare const SidebarGroup: import("react").ForwardRefExoticComponent<Omit<HTMLA
31
25
  children?: ReactNode;
32
26
  /** The visible heading naming the group's navigation region. */
33
27
  label?: ReactNode;
34
- /**
35
- * The Sidebar presentations that render the group.
36
- *
37
- * Restricting a group suits navigation duplicated elsewhere in a wide
38
- * layout, such as links an application bar already provides.
39
- */
40
- presentation?: SidebarGroupPresentation;
28
+ /** The presentations the group is rendered in. */
29
+ presentation?: SidebarPresentation;
41
30
  } & import("react").RefAttributes<HTMLElement>>;
42
31
  export default SidebarGroup;
@@ -0,0 +1,29 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type SidebarPresentation } from "../utils/presentation";
3
+ /** A type representing properties for the Sidebar.Header component. */
4
+ export type SidebarHeaderProps = HTMLAttributes<HTMLDivElement> & {
5
+ /** The content rendered at the top of the Sidebar. */
6
+ children?: ReactNode;
7
+ /** The presentations the header is rendered in. */
8
+ presentation?: SidebarPresentation;
9
+ };
10
+ /**
11
+ * Renders the region at the top of a Sidebar.
12
+ *
13
+ * The region holds whatever identifies the interface, such as a logo or a
14
+ * workspace switcher, and scrolls away with the navigation rather than
15
+ * pinning like the footer. Giving it an `id` and passing that to the
16
+ * Sidebar's `aria-labelledby` names the panel after the content shown here.
17
+ *
18
+ * @param props - The native properties that configure the header.
19
+ * @param forwardedReference - The reference assigned to the header element.
20
+ *
21
+ * @returns The rendered Sidebar header.
22
+ */
23
+ declare const SidebarHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
24
+ /** The content rendered at the top of the Sidebar. */
25
+ children?: ReactNode;
26
+ /** The presentations the header is rendered in. */
27
+ presentation?: SidebarPresentation;
28
+ } & import("react").RefAttributes<HTMLDivElement>>;
29
+ export default SidebarHeader;
@@ -1,5 +1,6 @@
1
1
  import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type ReactElement, type ReactNode } from "react";
2
2
  import { type IconType } from "../../Icon";
3
+ import { type SidebarPresentation } from "../utils/presentation";
3
4
  /** A type representing properties owned by the Sidebar.Item component. */
4
5
  type SidebarItemOwnProps = {
5
6
  /** Whether the item represents the current page or view. */
@@ -10,6 +11,8 @@ type SidebarItemOwnProps = {
10
11
  disabled?: boolean;
11
12
  /** The icon displayed before the item label. */
12
13
  icon?: IconType;
14
+ /** The presentations the item is rendered in. */
15
+ presentation?: SidebarPresentation;
13
16
  };
14
17
  /** A type representing the reference accepted by a polymorphic element. */
15
18
  type SidebarItemReference<Component extends ElementType> = ComponentPropsWithRef<Component>["ref"];
@@ -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. */