@homebound/beam 2.135.0 → 2.135.1

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.
@@ -1,5 +1,4 @@
1
1
  import { IconProps } from "./Icon";
2
- import { Callback } from "../types";
3
2
  export interface ButtonGroupProps {
4
3
  buttons: ButtonGroupButton[];
5
4
  /** Disables all buttons in ButtonGroup */
@@ -9,7 +8,7 @@ export interface ButtonGroupProps {
9
8
  export declare type ButtonGroupButton = {
10
9
  icon?: IconProps["icon"];
11
10
  text?: string;
12
- onClick?: Callback;
11
+ onClick?: VoidFunction;
13
12
  /** Disables the button. Note we don't support the `disabled: ReactNode`/tooltip for now. */
14
13
  disabled?: boolean;
15
14
  /** Indicates the active/selected button, as in a tab or toggle. */
@@ -1,6 +1,5 @@
1
1
  import { IconProps } from "./Icon";
2
2
  import { OverlayTriggerProps } from "./internal/OverlayTrigger";
3
- import { Callback } from "../types";
4
3
  interface ButtonMenuProps extends Pick<OverlayTriggerProps, "trigger" | "placement" | "disabled" | "tooltip"> {
5
4
  items: MenuItem[];
6
5
  persistentItems?: MenuItem[];
@@ -9,7 +8,7 @@ interface ButtonMenuProps extends Pick<OverlayTriggerProps, "trigger" | "placeme
9
8
  export declare function ButtonMenu(props: ButtonMenuProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
9
  declare type MenuItemBase = {
11
10
  label: string;
12
- onClick: string | Callback;
11
+ onClick: string | VoidFunction;
13
12
  disabled?: boolean;
14
13
  };
15
14
  export declare type IconMenuItemType = MenuItemBase & {
@@ -1,6 +1,5 @@
1
1
  import { MutableRefObject, ReactNode } from "react";
2
2
  import { Only, Xss } from "../../Css";
3
- import { Callback } from "../../types";
4
3
  export declare type ModalSize = "sm" | "md" | "lg" | "xl";
5
4
  export interface ModalProps {
6
5
  /**
@@ -18,7 +17,7 @@ export interface ModalProps {
18
17
  /** Force scrolling i.e. to avoid content jumping left/right as scroll bar goes away/comes back. */
19
18
  forceScrolling?: boolean;
20
19
  /** Adds a callback that is called _after_ close has definitely happened. */
21
- onClose?: Callback;
20
+ onClose?: VoidFunction;
22
21
  /** Imperative API for interacting with the Modal */
23
22
  api?: MutableRefObject<ModalApi | undefined>;
24
23
  /** Adds a border for the header. */
@@ -31,8 +31,8 @@ function Modal(props) {
31
31
  onClose: closeModal,
32
32
  isDismissable: true,
33
33
  shouldCloseOnInteractOutside: (el) => {
34
- // Do not close the Modal if the user is interacting with the Tribute mentions dropdown (via RichTextField).
35
- return !el.closest(".tribute-container");
34
+ // Do not close the Modal if the user is interacting with the Tribute mentions dropdown (via RichTextField) or with another 3rd party dialog (such as a lightbox) on top of it.
35
+ return !(el.closest(".tribute-container") || el.closest("[role='dialog']"));
36
36
  },
37
37
  }, ref);
38
38
  const { modalProps } = (0, react_aria_1.useModal)();
@@ -1,8 +1,8 @@
1
- import { Callback, CheckFn } from "../../types";
1
+ import { CheckFn } from "../../types";
2
2
  import { ModalProps } from "./Modal";
3
3
  export interface UseModalHook {
4
4
  openModal: (props: ModalProps) => void;
5
- closeModal: Callback;
5
+ closeModal: VoidFunction;
6
6
  addCanClose: (canClose: CheckFn) => void;
7
7
  setSize: (size: ModalProps["size"]) => void;
8
8
  }
@@ -1,9 +1,8 @@
1
1
  import { HTMLAttributes, PropsWithChildren } from "react";
2
2
  import { MenuItem } from "..";
3
- import { Callback } from "../../types";
4
3
  interface MenuProps<T> {
5
4
  ariaMenuProps: HTMLAttributes<HTMLElement>;
6
- onClose: Callback;
5
+ onClose: VoidFunction;
7
6
  items: MenuItem[];
8
7
  persistentItems?: MenuItem[];
9
8
  }
@@ -1,11 +1,10 @@
1
1
  import { Node } from "@react-types/shared";
2
2
  import { TreeState } from "react-stately";
3
3
  import { MenuItem } from "../ButtonMenu";
4
- import { Callback } from "../../types";
5
4
  interface MenuItemProps {
6
5
  item: Node<MenuItem>;
7
6
  state: TreeState<MenuItem>;
8
- onClose: Callback;
7
+ onClose: VoidFunction;
9
8
  }
10
9
  export declare function MenuItemImpl(props: MenuItemProps): import("@emotion/react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -1,11 +1,10 @@
1
1
  import { Node } from "@react-types/shared";
2
2
  import { TreeState } from "react-stately";
3
3
  import { MenuItem } from "../ButtonMenu";
4
- import { Callback } from "../../types";
5
4
  interface MenuSectionProps {
6
5
  section: Node<MenuItem>;
7
6
  state: TreeState<MenuItem>;
8
- onClose: Callback;
7
+ onClose: VoidFunction;
9
8
  }
10
9
  export declare function MenuSectionImpl(props: MenuSectionProps): import("@emotion/react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -1,8 +1,7 @@
1
1
  import { HTMLAttributes } from "react";
2
- import { Callback } from "../types";
3
2
  interface useHoverProps {
4
- onHoverStart?: Callback;
5
- onHoverEnd?: Callback;
3
+ onHoverStart?: VoidFunction;
4
+ onHoverEnd?: VoidFunction;
6
5
  onHoverChange?: (isHovering: boolean) => void;
7
6
  disabled?: boolean;
8
7
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./Css";
2
- export type { HasIdAndName, Callback, CheckFn } from "./types";
2
+ export type { HasIdAndName, CheckFn } from "./types";
3
3
  export * from "./components";
4
4
  export * from "./forms";
5
5
  export * from "./hooks";
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { Modifier } from "react-day-picker";
3
3
  import { TextFieldBaseProps } from "./TextFieldBase";
4
- import { Callback } from "../types";
5
4
  export interface DateFieldProps extends Pick<TextFieldBaseProps<{}>, "borderless" | "visuallyDisabled" | "hideLabel" | "compact"> {
6
5
  value: Date | undefined;
7
6
  label: string;
@@ -27,7 +26,7 @@ export interface DateFieldProps extends Pick<TextFieldBaseProps<{}>, "borderless
27
26
  * exposed from `react-day-picker`: https://react-day-picker.js.org/api/DayPicker#modifiers
28
27
  */
29
28
  disabledDays?: Modifier | Modifier[];
30
- onEnter?: Callback;
29
+ onEnter?: VoidFunction;
31
30
  defaultOpen?: boolean;
32
31
  }
33
32
  export declare function DateField(props: DateFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from "react";
2
2
  import { Xss } from "../Css";
3
- import { Callback } from "../types";
4
3
  export declare type NumberFieldType = "cents" | "percent" | "basisPoints" | "days";
5
4
  export interface NumberFieldProps {
6
5
  label: string;
@@ -23,7 +22,7 @@ export interface NumberFieldProps {
23
22
  displayDirection?: boolean;
24
23
  numFractionDigits?: number;
25
24
  truncate?: boolean;
26
- onEnter?: Callback;
25
+ onEnter?: VoidFunction;
27
26
  }
28
27
  export declare function NumberField(props: NumberFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
29
28
  export declare function formatValue(value: number, factor: number, numFractionDigits: number | undefined): number | undefined;
@@ -1,9 +1,8 @@
1
1
  import { Only } from "../Css";
2
2
  import { BeamTextFieldProps, TextFieldXss } from "../interfaces";
3
- import { Callback } from "../types";
4
3
  export interface TextAreaFieldProps<X> extends BeamTextFieldProps<X> {
5
4
  preventNewLines?: boolean;
6
- onEnter?: Callback;
5
+ onEnter?: VoidFunction;
7
6
  }
8
7
  /** Returns a <textarea /> element that auto-adjusts height based on the field's value */
9
8
  export declare function TextAreaField<X extends Only<TextFieldXss, X>>(props: TextAreaFieldProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,17 +1,16 @@
1
1
  import { MutableRefObject, ReactNode } from "react";
2
2
  import { Only } from "../Css";
3
3
  import { BeamTextFieldProps, TextFieldXss } from "../interfaces";
4
- import { Callback } from "../types";
5
4
  export interface TextFieldProps<X> extends BeamTextFieldProps<X> {
6
5
  compact?: boolean;
7
6
  inlineLabel?: boolean;
8
7
  clearable?: boolean;
9
8
  api?: MutableRefObject<TextFieldApi | undefined>;
10
- onEnter?: Callback;
9
+ onEnter?: VoidFunction;
11
10
  endAdornment?: ReactNode;
12
11
  startAdornment?: ReactNode;
13
12
  }
14
13
  export declare function TextField<X extends Only<TextFieldXss, X>>(props: TextFieldProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
15
14
  export declare type TextFieldApi = {
16
- focus: Callback;
15
+ focus: VoidFunction;
17
16
  };
@@ -2,7 +2,6 @@ import { InputHTMLAttributes, LabelHTMLAttributes, MutableRefObject, ReactNode }
2
2
  import { ComboBoxState } from "react-stately";
3
3
  import { PresentationFieldProps } from "../../components/PresentationContext";
4
4
  import { Value } from "../Value";
5
- import { Callback } from "../../types";
6
5
  interface SelectFieldInputProps<O, V extends Value> extends PresentationFieldProps {
7
6
  buttonProps: any;
8
7
  buttonRef: MutableRefObject<HTMLButtonElement | null>;
@@ -26,7 +25,7 @@ interface SelectFieldInputProps<O, V extends Value> extends PresentationFieldPro
26
25
  contrast?: boolean;
27
26
  nothingSelectedText: string;
28
27
  tooltip?: ReactNode;
29
- resetField: Callback;
28
+ resetField: VoidFunction;
30
29
  }
31
30
  export declare function SelectFieldInput<O, V extends Value>(props: SelectFieldInputProps<O, V>): import("@emotion/react/jsx-runtime").JSX.Element;
32
31
  export {};
@@ -2,7 +2,6 @@ import type { PressEvent } from "@react-types/shared";
2
2
  import { ReactNode } from "react";
3
3
  import { PresentationFieldProps } from "./components/PresentationContext";
4
4
  import { Xss } from "./Css";
5
- import { Callback } from "./types";
6
5
  /** Base Interfaced */
7
6
  export interface BeamFocusableProps {
8
7
  /** Whether the element should receive focus on render. */
@@ -36,9 +35,9 @@ export interface BeamTextFieldProps<X> extends BeamFocusableProps, PresentationF
36
35
  /** Handler called when the interactive element state changes. */
37
36
  onChange: (value: string | undefined) => void;
38
37
  /** Called when the component loses focus, mostly for BoundTextField to use. */
39
- onBlur?: Callback;
40
- onFocus?: Callback;
41
- onEnter?: Callback;
38
+ onBlur?: VoidFunction;
39
+ onFocus?: VoidFunction;
40
+ onEnter?: VoidFunction;
42
41
  /** Whether the field is readOnly. If a ReactNode, it's treated as a "readOnly reason" that's shown in a tooltip. */
43
42
  readOnly?: boolean | ReactNode;
44
43
  placeholder?: string;
package/dist/types.d.ts CHANGED
@@ -3,7 +3,6 @@ export declare type HasIdAndName<V = string> = {
3
3
  name: string;
4
4
  };
5
5
  export declare type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
6
- export declare type Callback = () => void;
7
6
  export declare type CheckFn = () => boolean;
8
7
  export declare type CanCloseCheck = {
9
8
  check: CheckFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.135.0",
3
+ "version": "2.135.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",