@prismicio/editor-ui 0.4.49 → 0.4.50

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,8 +1,16 @@
1
+ import type { ReactNode } from "react";
1
2
  export interface AvatarProps {
2
3
  imageUrl?: string;
3
4
  firstName?: string;
4
5
  lastName?: string;
5
6
  hasBorder?: boolean;
6
- size?: 16 | 24 | 32;
7
+ size?: 16 | 24 | 32 | 40;
8
+ variant?: "circle" | "square";
9
+ /**
10
+ * The content to show when the imageUrl was not provided
11
+ * or image is not available after delayMs.
12
+ * If not provided, the initials of the first and last name will be shown.
13
+ */
14
+ fallback?: ReactNode;
7
15
  }
8
16
  export declare function Avatar(props: AvatarProps): JSX.Element;
@@ -7,6 +7,7 @@ export declare const Default: {
7
7
  imageUrl: string;
8
8
  hasBorder: boolean;
9
9
  size: number;
10
+ variant: string;
10
11
  };
11
12
  name: string;
12
13
  };
@@ -59,7 +59,7 @@ export declare const Default: {
59
59
  bottomRight?: 0 | 2 | 1 | "50%" | "100%" | "inherit" | 4 | 6 | 8 | 10 | 12 | undefined;
60
60
  }) | undefined;
61
61
  borderStyle?: "none" | "dashed" | "solid" | undefined;
62
- backgroundColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | undefined;
62
+ backgroundColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo8" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | "logoPurple" | "logoBlue" | "logoYellow" | "logoRed" | undefined;
63
63
  opacity?: 0 | 1 | 0.1 | 0.3 | 0.4 | 0.5 | 0.6 | 0.8 | 0.9 | undefined;
64
64
  visibility?: "hidden" | "visible" | undefined;
65
65
  overflowY?: "auto" | "hidden" | undefined;
@@ -123,7 +123,7 @@ export declare const Default: {
123
123
  bottomRight?: 0 | 2 | 1 | "50%" | "100%" | "inherit" | 4 | 6 | 8 | 10 | 12 | undefined;
124
124
  }) | undefined;
125
125
  borderStyle?: "none" | "dashed" | "solid" | undefined;
126
- backgroundColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | undefined;
126
+ backgroundColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo8" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | "logoPurple" | "logoBlue" | "logoYellow" | "logoRed" | undefined;
127
127
  opacity?: 0 | 1 | 0.1 | 0.3 | 0.4 | 0.5 | 0.6 | 0.8 | 0.9 | undefined;
128
128
  visibility?: "hidden" | "visible" | undefined;
129
129
  overflowY?: "auto" | "hidden" | undefined;
@@ -1,23 +1,59 @@
1
- import { type ReactNode } from "react";
1
+ import { type ReactNode, type RefObject } from "react";
2
2
  import type { SX } from "../../theme";
3
- type Variant = "attached" | "detached";
3
+ import { type IconProps } from "../Icon";
4
+ type Variant = "attached" | "detached" | "detached-connected";
4
5
  export interface ComboBoxProps {
5
6
  children: ReactNode;
7
+ /**
8
+ * Variant defines the appearance and behavior of the ComboBox
9
+ * - "detached" - the dropdown is hiding or appearing according to user focus on the input
10
+ * - "detached-connected" - same as "detached" but the dropdown is connected to the input visually
11
+ * - "attached" - dropdown is connected to the input both visually and functionally (it's always shown)
12
+ */
6
13
  variant?: Variant;
14
+ /**
15
+ * Aligns content above the input or below
16
+ * Supports only "detached*" variants
17
+ */
18
+ side?: "top" | "bottom";
7
19
  sx?: SX;
20
+ /**
21
+ * Controls the visibility of the list
22
+ * Enables "detached*" variants to be controlled from the outside
23
+ */
24
+ isOpen?: boolean;
25
+ /**
26
+ * Callback to be called when the list is closed
27
+ * Enables "detached*" variants to be controlled from the outside
28
+ */
29
+ onClose?: () => void;
30
+ /**
31
+ * Refs to elements that should not close the list when clicked
32
+ */
33
+ dropdownRefs?: RefObject<HTMLDivElement>[];
34
+ /**
35
+ * Enables a translucent grey overlay that appears when the list is open
36
+ * Supports only "detached*" variants
37
+ */
38
+ overlay?: boolean;
8
39
  }
9
40
  export declare const ComboBox: (props: ComboBoxProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
10
41
  interface ComboBoxContentProps {
11
42
  children: ReactNode;
12
- /**
13
- * Aligns "detached" content above the input or below
14
- * @variant - detached
15
- */
16
- side?: "top" | "bottom";
17
43
  /**
18
44
  * Adds padding to the top and bottom of the content
19
45
  */
20
46
  paddingBlock?: 0 | 2 | 4;
47
+ /**
48
+ * Maximum height of the content
49
+ */
50
+ maxHeight?: 200 | "full";
51
+ /**
52
+ * Disable default onClick handler.
53
+ * Useful when you want to handle click events manually,
54
+ * ie. with a Link component to make cmd+click work.
55
+ */
56
+ disableOnClick?: boolean;
21
57
  }
22
58
  export declare const ComboBoxContent: (props: ComboBoxContentProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
23
59
  type ComboBoxItemProps = {
@@ -26,6 +62,12 @@ type ComboBoxItemProps = {
26
62
  onCheckedChange?: (checked: boolean) => void;
27
63
  disabled?: boolean;
28
64
  children: ReactNode;
65
+ iconStyle?: Pick<IconProps, "color" | "size">;
66
+ /**
67
+ * Changes the style of the item
68
+ * "action-list-item" styles the item as if it was an ActionListItem component
69
+ */
70
+ variant?: "default" | "action-list-item";
29
71
  };
30
72
  export declare const ComboBoxItem: (props: ComboBoxItemProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
31
73
  interface ComboBoxInputProps {
@@ -37,6 +79,13 @@ interface ComboBoxInputProps {
37
79
  * Needed when ComboBox is nested within Popovers
38
80
  */
39
81
  autoFocus?: boolean;
82
+ /**
83
+ * Callback to be called when the input is focused
84
+ * Returning false will prevent the list from opening
85
+ */
86
+ onFocus?: () => boolean;
87
+ maxLength?: number;
88
+ endAdornment?: boolean;
40
89
  }
41
90
  export declare const ComboBoxInput: (props: ComboBoxInputProps & import("react").RefAttributes<HTMLInputElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
42
91
  interface ComboBoxActionProps {
@@ -9,6 +9,9 @@ declare const meta: {
9
9
  control: string;
10
10
  options: string[];
11
11
  };
12
+ overlay: {
13
+ control: string;
14
+ };
12
15
  };
13
16
  };
14
17
  export default meta;
@@ -54,7 +54,7 @@ export interface DropdownMenuContentProps {
54
54
  */
55
55
  childrenFocusScope?: boolean;
56
56
  }
57
- export declare function DropdownMenuContent(props: DropdownMenuContentProps): JSX.Element;
57
+ export declare const DropdownMenuContent: (props: DropdownMenuContentProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
58
58
  interface DropdownMenuItemProps {
59
59
  children: ReactNode;
60
60
  disabled?: boolean;
@@ -11,6 +11,7 @@ type LabelProps = {
11
11
  label: string;
12
12
  id: string;
13
13
  } | object;
14
+ export type RoundedSide = "all" | "top" | "bottom";
14
15
  export type FormInputFieldProps = {
15
16
  children?: ReactNode;
16
17
  error?: boolean | string;
@@ -18,6 +19,7 @@ export type FormInputFieldProps = {
18
19
  disabled?: boolean;
19
20
  size?: "small" | "medium" | "large";
20
21
  sx?: SX;
22
+ roundedSide?: RoundedSide;
21
23
  } & LabelProps;
22
24
  export declare const FormInputField: (props: FormInputFieldProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
23
25
  export {};
@@ -1,6 +1,6 @@
1
1
  import { type AriaRole, type FocusEvent } from "react";
2
2
  import { type FormInputFieldProps } from "./FormField";
3
- export interface FormSearchInputProps extends Pick<FormInputFieldProps, "disabled" | "error" | "sx" | "description"> {
3
+ export interface FormSearchInputProps extends Pick<FormInputFieldProps, "disabled" | "error" | "sx" | "description" | "roundedSide"> {
4
4
  label?: string;
5
5
  placeholder?: string;
6
6
  maxLength?: number;
@@ -61,9 +61,9 @@ declare const meta: {
61
61
  max?: number | undefined;
62
62
  getValueLabel?: ((value: number, max: number) => string) | undefined;
63
63
  displayLabel?: boolean | undefined;
64
- color?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | undefined;
65
- backgroundColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | undefined;
66
- labelColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | undefined;
64
+ color?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo8" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | "logoPurple" | "logoBlue" | "logoYellow" | "logoRed" | undefined;
65
+ backgroundColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo8" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | "logoPurple" | "logoBlue" | "logoYellow" | "logoRed" | undefined;
66
+ labelColor?: "inherit" | "currentColor" | "transparent" | "white" | "black" | "grey1" | "grey2" | "grey3" | "grey4" | "grey5" | "grey6" | "grey7" | "grey8" | "grey9" | "grey10" | "grey11" | "grey12" | "dark12" | "indigo2" | "indigo4" | "indigo5" | "indigo7" | "indigo8" | "indigo10" | "indigo11" | "indigo12" | "green3" | "green4" | "green9" | "green10" | "green11" | "green12" | "amber3" | "amber4" | "amber9" | "amber10" | "amber11" | "amber12" | "tomato1" | "tomato2" | "tomato3" | "tomato4" | "tomato5" | "tomato6" | "tomato7" | "tomato8" | "tomato9" | "tomato10" | "tomato11" | "tomato12" | "purple1" | "purple2" | "purple3" | "purple4" | "purple5" | "purple6" | "purple7" | "purple8" | "purple9" | "purple10" | "purple11" | "purple12" | "greyAlpha1" | "logoPurple" | "logoBlue" | "logoYellow" | "logoRed" | undefined;
67
67
  height?: "large" | "normal" | "collapsed" | undefined;
68
68
  transition?: "slow" | "fast" | undefined;
69
69
  sx?: import("../../theme").SX | undefined;