@kjun-ui/react 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/styles.css CHANGED
@@ -4800,7 +4800,7 @@
4800
4800
 
4801
4801
  .kjun-list-section,.kjun-top-navigation,.kjun-bottom-navigation,.kjun-bottom-action-bar{min-width:0;max-width:100%;color:var(--_kjun-color-text);background:var(--_kjun-color-surface)}
4802
4802
  .kjun-list-heading{display:flex;align-items:center;justify-content:space-between;gap:var(--_kjun-extension-list-gap);padding:var(--_kjun-extension-list-padding)}.kjun-list-heading h3{font-size:var(--_kjun-type-card-title-size);margin:0;line-height:var(--_kjun-type-card-title-line);font-weight:var(--_kjun-type-card-title-weight);letter-spacing:var(--_kjun-type-card-title-tracking)}.kjun-list-heading p{margin:var(--_kjun-geometry-dimension-value4) 0 0;font-size:var(--_kjun-type-caption-size);color:var(--_kjun-color-text-secondary);overflow-wrap:anywhere;line-height:var(--_kjun-type-caption-line);font-weight:var(--_kjun-type-caption-weight);letter-spacing:var(--_kjun-type-caption-tracking)}
4803
- .kjun-list{list-style:none;padding:0;margin:0}.kjun-list-row{display:flex;align-items:center;gap:var(--_kjun-extension-list-gap);border-bottom:var(--_kjun-border-default-width) solid var(--_kjun-color-divider);min-width:0}.kjun-list-row:last-child{border-bottom:0}.kjun-list[data-divider=false]>.kjun-list-row{border-bottom:0}.kjun-list[data-density=compact] .kjun-list-main{min-height:var(--_kjun-extension-list-compact-minimum-height);padding-block:var(--_kjun-extension-list-compact-padding-y)}.kjun-list-main{display:flex;align-items:center;gap:var(--_kjun-extension-list-gap);flex:1;min-width:0;min-height:var(--_kjun-extension-list-minimum-height);padding:var(--_kjun-extension-list-padding);text-align:start;color:inherit;text-decoration:none;background:transparent;border:0;font:inherit}.kjun-list-main:is(button,a):hover{background:var(--_kjun-color-hover)}.kjun-list-body{flex:1;min-width:0}.kjun-list-title,.kjun-list-description{display:block;overflow-wrap:anywhere;line-height:1.5}.kjun-list-title{font-size:var(--_kjun-type-label-size);line-height:var(--_kjun-type-label-line);font-weight:var(--_kjun-type-label-weight);letter-spacing:var(--_kjun-type-label-tracking)}.kjun-list-description{font-size:var(--_kjun-type-caption-size);color:var(--_kjun-color-text-secondary);line-height:var(--_kjun-type-caption-line);font-weight:var(--_kjun-type-caption-weight);letter-spacing:var(--_kjun-type-caption-tracking)}.kjun-list-leading{flex-shrink:0}.kjun-list-trailing{overflow-wrap:anywhere;max-width:35%}.kjun-list-actions{display:flex;flex-wrap:wrap;gap:var(--_kjun-extension-list-actions-gap);padding-inline-end:var(--_kjun-extension-list-actions-padding);max-width:45%}
4803
+ .kjun-list{list-style:none;padding:0;margin:0}.kjun-list-row{display:flex;align-items:center;gap:var(--_kjun-extension-list-gap);border-bottom:var(--_kjun-border-default-width) solid var(--_kjun-color-divider);min-width:0}.kjun-list-row:last-child{border-bottom:0}.kjun-list[data-divider=false]>.kjun-list-row{border-bottom:0}.kjun-list[data-density=compact] .kjun-list-main{min-height:var(--_kjun-extension-list-compact-minimum-height);padding-block:var(--_kjun-extension-list-compact-padding-y)}.kjun-list-main{display:flex;align-items:center;gap:var(--_kjun-extension-list-gap);flex:1;min-width:0;min-height:var(--_kjun-extension-list-minimum-height);padding:var(--_kjun-extension-list-padding);text-align:start;color:inherit;text-decoration:none;background:transparent;border:0;font:inherit}.kjun-list-main:is(button,a):hover{background:var(--_kjun-color-hover)}.kjun-list-body{flex:1;min-width:0}.kjun-list-content{display:block;margin-top:var(--_kjun-extension-list-description-gap)}.kjun-list-title,.kjun-list-description{display:block;overflow-wrap:anywhere;line-height:1.5}.kjun-list-title{font-size:var(--_kjun-type-label-size);line-height:var(--_kjun-type-label-line);font-weight:var(--_kjun-type-label-weight);letter-spacing:var(--_kjun-type-label-tracking)}.kjun-list-description{font-size:var(--_kjun-type-caption-size);color:var(--_kjun-color-text-secondary);line-height:var(--_kjun-type-caption-line);font-weight:var(--_kjun-type-caption-weight);letter-spacing:var(--_kjun-type-caption-tracking)}.kjun-list-leading{flex-shrink:0}.kjun-list-trailing{overflow-wrap:anywhere;max-width:35%}.kjun-list-actions{display:flex;flex-wrap:wrap;gap:var(--_kjun-extension-list-actions-gap);padding-inline-end:var(--_kjun-extension-list-actions-padding);max-width:45%}
4804
4804
  /* A disabled row disables its actions too, so the row never reads as partly available. */
4805
4805
  .kjun-list-actions[data-disabled]{opacity:var(--_kjun-state-opacity-disabled)}
4806
4806
  .kjun-navigation-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:var(--_kjun-extension-navigation-actions-gap);min-width:0}
@@ -1,5 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- export declare function Collapse({ open, children }: {
2
+ /** keepMounted: once opened, the body stays mounted (inert, hidden from assistive technology) while closed. */
3
+ export declare function Collapse({ open, keepMounted, children }: {
3
4
  open: boolean;
5
+ keepMounted?: boolean;
4
6
  children: ReactNode;
5
7
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- export declare function Collapse({ open, children }: {
2
+ /** keepMounted: once opened, the body stays mounted (inert, hidden from assistive technology) while closed. */
3
+ export declare function Collapse({ open, keepMounted, children }: {
3
4
  open: boolean;
5
+ keepMounted?: boolean;
4
6
  children: ReactNode;
5
7
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  import { type InputSize } from "@kjun-ui/tokens";
2
2
  import { type ReactNode } from "react";
3
+ import { type FocusReturn } from "./floating-panel.cjs";
3
4
  import { OptionValue, SelectOption } from "./select-options.cjs";
4
5
  export interface KjunComboboxProps<T extends SelectOption = SelectOption> {
5
6
  value: OptionValue | null;
@@ -19,8 +20,10 @@ export interface KjunComboboxProps<T extends SelectOption = SelectOption> {
19
20
  onChange?: (v: OptionValue | null) => void;
20
21
  onSearch?: (v: string) => void;
21
22
  onClear?: () => void;
23
+ /** Where focus goes after choosing an option or Escape. Closing while typing keeps focus in the input. Web only. */
24
+ returnFocus?: FocusReturn;
22
25
  }
23
- export declare function KjunCombobox<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, valueKey, filterFn, size, disabled, error, clearable, emptyText, renderOption, onValueChange, onChange, onSearch, onClear, }: KjunComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
26
+ export declare function KjunCombobox<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, valueKey, filterFn, size, disabled, error, clearable, emptyText, renderOption, onValueChange, onChange, onSearch, onClear, returnFocus, }: KjunComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
24
27
  export interface SearchFieldProps<T extends SelectOption> {
25
28
  value: string;
26
29
  size: InputSize;
@@ -44,5 +47,6 @@ export interface SearchFieldProps<T extends SelectOption> {
44
47
  onSelect: (o: T) => void;
45
48
  onClear?: () => void;
46
49
  onEnter?: () => void;
50
+ returnFocus?: () => HTMLElement | null;
47
51
  }
48
- export declare function SearchField<T extends SelectOption>({ value, size, placeholder, ariaLabel, disabled, error, clearable, open, onOpenChange, options, labelKey, itemKey, emptyText, loading, failed, errorText, renderOption, onValueChange, onSelect, onClear, onEnter, }: SearchFieldProps<T>): import("react/jsx-runtime").JSX.Element;
52
+ export declare function SearchField<T extends SelectOption>({ value, size, placeholder, ariaLabel, disabled, error, clearable, open, onOpenChange, options, labelKey, itemKey, emptyText, loading, failed, errorText, renderOption, onValueChange, onSelect, onClear, onEnter, returnFocus, }: SearchFieldProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { type InputSize } from "@kjun-ui/tokens";
2
2
  import { type ReactNode } from "react";
3
+ import { type FocusReturn } from "./floating-panel.js";
3
4
  import { OptionValue, SelectOption } from "./select-options.js";
4
5
  export interface KjunComboboxProps<T extends SelectOption = SelectOption> {
5
6
  value: OptionValue | null;
@@ -19,8 +20,10 @@ export interface KjunComboboxProps<T extends SelectOption = SelectOption> {
19
20
  onChange?: (v: OptionValue | null) => void;
20
21
  onSearch?: (v: string) => void;
21
22
  onClear?: () => void;
23
+ /** Where focus goes after choosing an option or Escape. Closing while typing keeps focus in the input. Web only. */
24
+ returnFocus?: FocusReturn;
22
25
  }
23
- export declare function KjunCombobox<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, valueKey, filterFn, size, disabled, error, clearable, emptyText, renderOption, onValueChange, onChange, onSearch, onClear, }: KjunComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
26
+ export declare function KjunCombobox<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, valueKey, filterFn, size, disabled, error, clearable, emptyText, renderOption, onValueChange, onChange, onSearch, onClear, returnFocus, }: KjunComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
24
27
  export interface SearchFieldProps<T extends SelectOption> {
25
28
  value: string;
26
29
  size: InputSize;
@@ -44,5 +47,6 @@ export interface SearchFieldProps<T extends SelectOption> {
44
47
  onSelect: (o: T) => void;
45
48
  onClear?: () => void;
46
49
  onEnter?: () => void;
50
+ returnFocus?: () => HTMLElement | null;
47
51
  }
48
- export declare function SearchField<T extends SelectOption>({ value, size, placeholder, ariaLabel, disabled, error, clearable, open, onOpenChange, options, labelKey, itemKey, emptyText, loading, failed, errorText, renderOption, onValueChange, onSelect, onClear, onEnter, }: SearchFieldProps<T>): import("react/jsx-runtime").JSX.Element;
52
+ export declare function SearchField<T extends SelectOption>({ value, size, placeholder, ariaLabel, disabled, error, clearable, open, onOpenChange, options, labelKey, itemKey, emptyText, loading, failed, errorText, renderOption, onValueChange, onSelect, onClear, onEnter, returnFocus, }: SearchFieldProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -13,6 +13,8 @@ export interface KjunDrawerProps {
13
13
  footer?: ReactNode;
14
14
  children: ReactNode;
15
15
  onClose?: () => void;
16
+ /** Called once after the close finishes and the layer has left the screen (not when it mounts closed or reopens during the exit). */
17
+ onAfterClose?: () => void;
16
18
  ariaLabel?: string;
17
19
  /** Top safe area in px, padded inside top and side drawers and kept clear above a bottom sheet. */
18
20
  safeAreaTop?: number;
@@ -21,4 +23,4 @@ export interface KjunDrawerProps {
21
23
  /** Height limit in px for top and bottom drawers; by default they stop a sheet gap short of the opposite edge. */
22
24
  maxHeight?: number;
23
25
  }
24
- export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, ariaLabel, safeAreaTop, safeAreaBottom, maxHeight, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
26
+ export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, onAfterClose, ariaLabel, safeAreaTop, safeAreaBottom, maxHeight, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
@@ -13,6 +13,8 @@ export interface KjunDrawerProps {
13
13
  footer?: ReactNode;
14
14
  children: ReactNode;
15
15
  onClose?: () => void;
16
+ /** Called once after the close finishes and the layer has left the screen (not when it mounts closed or reopens during the exit). */
17
+ onAfterClose?: () => void;
16
18
  ariaLabel?: string;
17
19
  /** Top safe area in px, padded inside top and side drawers and kept clear above a bottom sheet. */
18
20
  safeAreaTop?: number;
@@ -21,4 +23,4 @@ export interface KjunDrawerProps {
21
23
  /** Height limit in px for top and bottom drawers; by default they stop a sheet gap short of the opposite edge. */
22
24
  maxHeight?: number;
23
25
  }
24
- export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, ariaLabel, safeAreaTop, safeAreaBottom, maxHeight, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
26
+ export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, onAfterClose, ariaLabel, safeAreaTop, safeAreaBottom, maxHeight, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type KjunButtonProps } from "./button.cjs";
3
- import { type Placement } from "./floating-panel.cjs";
3
+ import { type FocusReturn, type Placement } from "./floating-panel.cjs";
4
4
  import { type KjunTooltipProps } from "./popover.cjs";
5
5
  export interface KjunDropdownProps {
6
6
  disabled?: boolean;
@@ -12,8 +12,10 @@ export interface KjunDropdownProps {
12
12
  children: ReactNode;
13
13
  onOpen?: () => void;
14
14
  onClose?: () => void;
15
+ /** Where focus goes when the menu closes by choosing or Escape, instead of the trigger (e.g. an edited cell). Web only. */
16
+ returnFocus?: FocusReturn;
15
17
  }
16
- export declare function KjunDropdown({ disabled, placement, menuId, triggerId, menuClass, trigger, children, onOpen, onClose, }: KjunDropdownProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function KjunDropdown({ disabled, placement, menuId, triggerId, menuClass, trigger, children, onOpen, onClose, returnFocus, }: KjunDropdownProps): import("react/jsx-runtime").JSX.Element;
17
19
  export interface KjunDropdownItemProps {
18
20
  id?: string;
19
21
  variant?: "default" | "danger";
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type KjunButtonProps } from "./button.js";
3
- import { type Placement } from "./floating-panel.js";
3
+ import { type FocusReturn, type Placement } from "./floating-panel.js";
4
4
  import { type KjunTooltipProps } from "./popover.js";
5
5
  export interface KjunDropdownProps {
6
6
  disabled?: boolean;
@@ -12,8 +12,10 @@ export interface KjunDropdownProps {
12
12
  children: ReactNode;
13
13
  onOpen?: () => void;
14
14
  onClose?: () => void;
15
+ /** Where focus goes when the menu closes by choosing or Escape, instead of the trigger (e.g. an edited cell). Web only. */
16
+ returnFocus?: FocusReturn;
15
17
  }
16
- export declare function KjunDropdown({ disabled, placement, menuId, triggerId, menuClass, trigger, children, onOpen, onClose, }: KjunDropdownProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function KjunDropdown({ disabled, placement, menuId, triggerId, menuClass, trigger, children, onOpen, onClose, returnFocus, }: KjunDropdownProps): import("react/jsx-runtime").JSX.Element;
17
19
  export interface KjunDropdownItemProps {
18
20
  id?: string;
19
21
  variant?: "default" | "danger";
@@ -16,3 +16,6 @@ export declare function FloatingPanel({ open, onOpenChange, triggerRef, children
16
16
  ownsDismiss?: boolean;
17
17
  returnFocus?: () => HTMLElement | null | false | undefined;
18
18
  }): import("react/jsx-runtime").JSX.Element | null;
19
+ /** A focus target given as an element, a ref or a function read when the panel closes. */
20
+ export type FocusReturn = HTMLElement | RefObject<HTMLElement | null> | (() => HTMLElement | null);
21
+ export declare const resolveFocusReturn: (target: FocusReturn | undefined) => (() => HTMLElement | null) | undefined;
@@ -16,3 +16,6 @@ export declare function FloatingPanel({ open, onOpenChange, triggerRef, children
16
16
  ownsDismiss?: boolean;
17
17
  returnFocus?: () => HTMLElement | null | false | undefined;
18
18
  }): import("react/jsx-runtime").JSX.Element | null;
19
+ /** A focus target given as an element, a ref or a function read when the panel closes. */
20
+ export type FocusReturn = HTMLElement | RefObject<HTMLElement | null> | (() => HTMLElement | null);
21
+ export declare const resolveFocusReturn: (target: FocusReturn | undefined) => (() => HTMLElement | null) | undefined;
@@ -12,8 +12,12 @@ export interface KjunListRowProps {
12
12
  /** Ends the row with a decorative chevron that marks it as navigation. */
13
13
  chevron?: boolean;
14
14
  onClick?: (event: MouseEvent<HTMLElement>) => void;
15
+ /** Name of a pressable or link row, e.g. with the amount a screen reader should hear. */
16
+ ariaLabel?: string;
17
+ /** Display-only content under the description (a budget bar); no buttons or links inside a pressable row. */
18
+ children?: ReactNode;
15
19
  }
16
- export declare function KjunListRow({ title, description, leading, trailing, actions, href, disabled, destructive, chevron, onClick }: KjunListRowProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function KjunListRow({ title, description, leading, trailing, actions, href, disabled, destructive, chevron, onClick, ariaLabel, children }: KjunListRowProps): import("react/jsx-runtime").JSX.Element;
17
21
  export interface KjunListSectionProps {
18
22
  title?: string;
19
23
  description?: string;
@@ -12,8 +12,12 @@ export interface KjunListRowProps {
12
12
  /** Ends the row with a decorative chevron that marks it as navigation. */
13
13
  chevron?: boolean;
14
14
  onClick?: (event: MouseEvent<HTMLElement>) => void;
15
+ /** Name of a pressable or link row, e.g. with the amount a screen reader should hear. */
16
+ ariaLabel?: string;
17
+ /** Display-only content under the description (a budget bar); no buttons or links inside a pressable row. */
18
+ children?: ReactNode;
15
19
  }
16
- export declare function KjunListRow({ title, description, leading, trailing, actions, href, disabled, destructive, chevron, onClick }: KjunListRowProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function KjunListRow({ title, description, leading, trailing, actions, href, disabled, destructive, chevron, onClick, ariaLabel, children }: KjunListRowProps): import("react/jsx-runtime").JSX.Element;
17
21
  export interface KjunListSectionProps {
18
22
  title?: string;
19
23
  description?: string;
@@ -19,6 +19,8 @@ export interface KjunModalProps {
19
19
  open: boolean;
20
20
  onOpenChange: (open: boolean) => void;
21
21
  onClose?: () => void;
22
+ /** Called once after the close finishes and the layer has left the screen (not when it mounts closed or reopens during the exit). */
23
+ onAfterClose?: () => void;
22
24
  onCancel?: () => void;
23
25
  onConfirm?: () => void;
24
26
  title?: string;
@@ -43,4 +45,4 @@ export interface KjunModalProps {
43
45
  children: ReactNode;
44
46
  ariaLabel?: string;
45
47
  }
46
- export declare function KjunModal({ open, onOpenChange, onClose, onCancel, onConfirm, title, size, closable, closeOnOverlay, closeOnEsc, showHeader, showFooter, showConfirmButton, showCancelButton, confirmText, cancelText, confirmDisabled, loading, noPadding, height, confirmVariant, footerSize, header, footer, children, ariaLabel, }: KjunModalProps): import("react/jsx-runtime").JSX.Element | null;
48
+ export declare function KjunModal({ open, onOpenChange, onClose, onAfterClose, onCancel, onConfirm, title, size, closable, closeOnOverlay, closeOnEsc, showHeader, showFooter, showConfirmButton, showCancelButton, confirmText, cancelText, confirmDisabled, loading, noPadding, height, confirmVariant, footerSize, header, footer, children, ariaLabel, }: KjunModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -19,6 +19,8 @@ export interface KjunModalProps {
19
19
  open: boolean;
20
20
  onOpenChange: (open: boolean) => void;
21
21
  onClose?: () => void;
22
+ /** Called once after the close finishes and the layer has left the screen (not when it mounts closed or reopens during the exit). */
23
+ onAfterClose?: () => void;
22
24
  onCancel?: () => void;
23
25
  onConfirm?: () => void;
24
26
  title?: string;
@@ -43,4 +45,4 @@ export interface KjunModalProps {
43
45
  children: ReactNode;
44
46
  ariaLabel?: string;
45
47
  }
46
- export declare function KjunModal({ open, onOpenChange, onClose, onCancel, onConfirm, title, size, closable, closeOnOverlay, closeOnEsc, showHeader, showFooter, showConfirmButton, showCancelButton, confirmText, cancelText, confirmDisabled, loading, noPadding, height, confirmVariant, footerSize, header, footer, children, ariaLabel, }: KjunModalProps): import("react/jsx-runtime").JSX.Element | null;
48
+ export declare function KjunModal({ open, onOpenChange, onClose, onAfterClose, onCancel, onConfirm, title, size, closable, closeOnOverlay, closeOnEsc, showHeader, showFooter, showConfirmButton, showCancelButton, confirmText, cancelText, confirmDisabled, loading, noPadding, height, confirmVariant, footerSize, header, footer, children, ariaLabel, }: KjunModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -38,11 +38,17 @@ export declare function KjunAccordion({ multiple, tone, children, }: KjunAccordi
38
38
  export interface KjunAccordionItemProps {
39
39
  title?: string;
40
40
  defaultOpen?: boolean;
41
+ /** Controlled open state. A controlled item follows this value only and stays out of the Accordion's single-open rule. */
42
+ open?: boolean;
43
+ /** Requests a change on a controlled item; reports every change on an uncontrolled one (also when a sibling closes it). */
44
+ onOpenChange?: (open: boolean) => void;
45
+ /** Keeps the body mounted after it first opens, so inputs keep their state while closed. */
46
+ keepMounted?: boolean;
41
47
  disabled?: boolean;
42
48
  header?: ReactNode;
43
49
  children: ReactNode;
44
50
  }
45
- export declare function KjunAccordionItem({ title, defaultOpen, disabled, header, children, }: KjunAccordionItemProps): import("react/jsx-runtime").JSX.Element;
51
+ export declare function KjunAccordionItem({ title, defaultOpen, disabled, header, open: openProp, onOpenChange, keepMounted, children, }: KjunAccordionItemProps): import("react/jsx-runtime").JSX.Element;
46
52
  export interface BreadcrumbItem {
47
53
  label: string;
48
54
  to?: string;
@@ -38,11 +38,17 @@ export declare function KjunAccordion({ multiple, tone, children, }: KjunAccordi
38
38
  export interface KjunAccordionItemProps {
39
39
  title?: string;
40
40
  defaultOpen?: boolean;
41
+ /** Controlled open state. A controlled item follows this value only and stays out of the Accordion's single-open rule. */
42
+ open?: boolean;
43
+ /** Requests a change on a controlled item; reports every change on an uncontrolled one (also when a sibling closes it). */
44
+ onOpenChange?: (open: boolean) => void;
45
+ /** Keeps the body mounted after it first opens, so inputs keep their state while closed. */
46
+ keepMounted?: boolean;
41
47
  disabled?: boolean;
42
48
  header?: ReactNode;
43
49
  children: ReactNode;
44
50
  }
45
- export declare function KjunAccordionItem({ title, defaultOpen, disabled, header, children, }: KjunAccordionItemProps): import("react/jsx-runtime").JSX.Element;
51
+ export declare function KjunAccordionItem({ title, defaultOpen, disabled, header, open: openProp, onOpenChange, keepMounted, children, }: KjunAccordionItemProps): import("react/jsx-runtime").JSX.Element;
46
52
  export interface BreadcrumbItem {
47
53
  label: string;
48
54
  to?: string;
@@ -1,5 +1,6 @@
1
1
  import { type InputSize } from "@kjun-ui/tokens";
2
2
  import { type ReactNode } from "react";
3
+ import { type FocusReturn } from "./floating-panel.cjs";
3
4
  import { OptionValue, SelectOption } from "./select-options.cjs";
4
5
  export interface KjunSelectProps<T extends SelectOption = SelectOption> {
5
6
  value: OptionValue | OptionValue[] | null;
@@ -34,5 +35,7 @@ export interface KjunSelectProps<T extends SelectOption = SelectOption> {
34
35
  /** Extra option fields searched after the label. */
35
36
  searchKeys?: string[];
36
37
  onClear?: () => void;
38
+ /** Where focus goes when the menu closes by choosing or Escape, instead of the trigger (e.g. an edited cell). Web only. */
39
+ returnFocus?: FocusReturn;
37
40
  }
38
- export declare function KjunSelect<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, id: triggerId, ariaDescribedBy, valueKey, size, disabled, searchable, open: controlled, loading, searchPlaceholder, optionPageSize, clearable, multiple, error, menuHeader, renderOption, renderSelected, onValueChange, onChange, onOpenChange, onSearch, onClear, filterFn, searchKeys, }: KjunSelectProps<T>): import("react/jsx-runtime").JSX.Element;
41
+ export declare function KjunSelect<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, id: triggerId, ariaDescribedBy, valueKey, size, disabled, searchable, open: controlled, loading, searchPlaceholder, optionPageSize, clearable, multiple, error, menuHeader, renderOption, renderSelected, onValueChange, onChange, onOpenChange, onSearch, onClear, filterFn, searchKeys, returnFocus, }: KjunSelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { type InputSize } from "@kjun-ui/tokens";
2
2
  import { type ReactNode } from "react";
3
+ import { type FocusReturn } from "./floating-panel.js";
3
4
  import { OptionValue, SelectOption } from "./select-options.js";
4
5
  export interface KjunSelectProps<T extends SelectOption = SelectOption> {
5
6
  value: OptionValue | OptionValue[] | null;
@@ -34,5 +35,7 @@ export interface KjunSelectProps<T extends SelectOption = SelectOption> {
34
35
  /** Extra option fields searched after the label. */
35
36
  searchKeys?: string[];
36
37
  onClear?: () => void;
38
+ /** Where focus goes when the menu closes by choosing or Escape, instead of the trigger (e.g. an edited cell). Web only. */
39
+ returnFocus?: FocusReturn;
37
40
  }
38
- export declare function KjunSelect<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, id: triggerId, ariaDescribedBy, valueKey, size, disabled, searchable, open: controlled, loading, searchPlaceholder, optionPageSize, clearable, multiple, error, menuHeader, renderOption, renderSelected, onValueChange, onChange, onOpenChange, onSearch, onClear, filterFn, searchKeys, }: KjunSelectProps<T>): import("react/jsx-runtime").JSX.Element;
41
+ export declare function KjunSelect<T extends SelectOption = SelectOption>({ value, options, placeholder, ariaLabel, labelKey, id: triggerId, ariaDescribedBy, valueKey, size, disabled, searchable, open: controlled, loading, searchPlaceholder, optionPageSize, clearable, multiple, error, menuHeader, renderOption, renderSelected, onValueChange, onChange, onOpenChange, onSearch, onClear, filterFn, searchKeys, returnFocus, }: KjunSelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** Development only: warns once per call when `root` holds a control. */
2
+ export declare function warnNestedControls(root: Element | null | undefined, message: string): void;
@@ -0,0 +1,2 @@
1
+ /** Development only: warns once per call when `root` holds a control. */
2
+ export declare function warnNestedControls(root: Element | null | undefined, message: string): void;
@@ -0,0 +1,6 @@
1
+ /** Calls onAfterClose once when a layer leaves the screen (present true → false). A reopen during the exit keeps
2
+ * present true, so it reports nothing; a layer mounted closed reports nothing either. */
3
+ export declare function useAfterClose(present: boolean, onAfterClose?: () => void, enabled?: boolean): void;
4
+ /** Web overlays can outlive present by a render (react-aria finishes its exit first), so this reports when the
5
+ * overlay element itself leaves the DOM while closed. Attach the returned ref to the overlay. */
6
+ export declare function useAfterCloseRef(open: boolean, onAfterClose?: () => void): (node: Element | null) => void;
@@ -0,0 +1,6 @@
1
+ /** Calls onAfterClose once when a layer leaves the screen (present true → false). A reopen during the exit keeps
2
+ * present true, so it reports nothing; a layer mounted closed reports nothing either. */
3
+ export declare function useAfterClose(present: boolean, onAfterClose?: () => void, enabled?: boolean): void;
4
+ /** Web overlays can outlive present by a render (react-aria finishes its exit first), so this reports when the
5
+ * overlay element itself leaves the DOM while closed. Attach the returned ref to the overlay. */
6
+ export declare function useAfterCloseRef(open: boolean, onAfterClose?: () => void): (node: Element | null) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kjun-ui/react",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://ui.kjun.dev",
6
6
  "repository": {
@@ -41,9 +41,9 @@
41
41
  "./package.json": "./package.json"
42
42
  },
43
43
  "dependencies": {
44
- "@kjun-ui/tokens": "0.14.0",
44
+ "@kjun-ui/tokens": "0.15.0",
45
45
  "react-aria-components": "1.21.1",
46
- "@kjun-ui/icons": "0.14.0"
46
+ "@kjun-ui/icons": "0.15.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19.2.3",