@overmap-ai/blocks 1.0.34-command-menu.2 → 1.0.34-command-menu.4

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,5 @@
1
- import { FC, PropsWithChildren } from "react";
2
- export interface CheckedIndicatorProps {
1
+ import { ComponentPropsWithRef, FC, PropsWithChildren } from "react";
2
+ export interface CheckedIndicatorProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
3
3
  children: PropsWithChildren["children"] | ((indeterminate: boolean) => PropsWithChildren["children"]);
4
4
  }
5
5
  export declare const CheckedIndicator: FC<CheckedIndicatorProps>;
@@ -1,7 +1,6 @@
1
1
  import { ComponentPropsWithRef, ReactNode } from "react";
2
2
  import type { CheckedState } from "./typings";
3
3
  export interface CommandMenuCheckboxIndicatorProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
4
- alwaysRender?: boolean;
5
4
  children: ReactNode | ((checked: CheckedState) => ReactNode);
6
5
  }
7
- export declare const CommandMenuCheckboxIndicator: (props: CommandMenuCheckboxIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export declare const CommandMenuCheckboxIndicator: (props: CommandMenuCheckboxIndicatorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,5 @@
1
+ import { MultiSelectProps } from "../SelectContext/typings";
1
2
  import { CommandMenuGroupProps } from "./Group";
2
- export interface CommandMenuMultiSelectGroupProps extends CommandMenuGroupProps {
3
- defaultValues?: string[];
4
- values?: string[];
5
- onValuesChange?: (values: string[]) => void;
3
+ export interface CommandMenuMultiSelectGroupProps extends CommandMenuGroupProps, MultiSelectProps {
6
4
  }
7
5
  export declare const CommandMenuMultiSelectGroup: (props: CommandMenuMultiSelectGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,4 @@
1
+ import { SingleSelectProps } from "../SelectContext/typings";
1
2
  import { CommandMenuGroupProps } from "./Group";
2
- export interface CommandMenuRadioGroupProps extends Omit<CommandMenuGroupProps, "defaultValue" | "value"> {
3
- defaultValue?: string | null;
4
- value?: string | null;
5
- onValueChange?: (value: string | null) => void;
6
- }
3
+ export type CommandMenuRadioGroupProps = SingleSelectProps & Omit<CommandMenuGroupProps, "defaultValue" | "value">;
7
4
  export declare const CommandMenuRadioGroup: (props: CommandMenuRadioGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithRef, ReactNode } from "react";
2
2
  export interface CommandMenuSelectedIndicatorProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
3
- alwaysRender?: boolean;
4
3
  children: ReactNode | ((selected: boolean) => ReactNode);
5
4
  }
6
- export declare const CommandMenuSelectedIndicator: (props: CommandMenuSelectedIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
5
+ export declare const CommandMenuSelectedIndicator: (props: CommandMenuSelectedIndicatorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Dispatch, SetStateAction } from "react";
1
+ /// <reference types="react" />
2
2
  import type { ComponentRadius } from "../Provider";
3
3
  import type { CheckedState, CommandMenuSize, CommandMenuVariant } from "./typings";
4
4
  interface ICommandMenuContext {
@@ -7,18 +7,6 @@ interface ICommandMenuContext {
7
7
  radius: ComponentRadius;
8
8
  }
9
9
  export declare const CommandMenuContext: import("react").Context<ICommandMenuContext>;
10
- export interface ISelectContext {
11
- selectValue: (value: string) => void;
12
- selected: (value: string) => boolean;
13
- }
14
- export declare const SelectContext: import("react").Context<ISelectContext>;
15
- export interface IMultiSelectGroupContext {
16
- itemValueMapping: Map<string, string>;
17
- setItemValueMapping: Dispatch<SetStateAction<Map<string, string>>>;
18
- values: string[];
19
- setValues: (values: string[]) => void;
20
- }
21
- export declare const MultiSelectGroupContext: import("react").Context<IMultiSelectGroupContext>;
22
10
  export declare const SelectedIndicatorContext: import("react").Context<boolean>;
23
11
  export declare const CheckboxIndicatorContext: import("react").Context<CheckedState>;
24
12
  export interface IMenuPagesContext {
@@ -35,11 +35,11 @@ export declare const CommandMenu: {
35
35
  MultiSelectGroup: (props: import("./MultiSelectGroup").CommandMenuMultiSelectGroupProps) => import("react/jsx-runtime").JSX.Element;
36
36
  MultiSelectItem: (props: import("./MultiSelectItem").CommandMenuMultiSelectItemProps) => import("react/jsx-runtime").JSX.Element;
37
37
  SelectAllItem: (props: import("./SelectAllItem").CommandMenuSelectAllItemProps) => import("react/jsx-runtime").JSX.Element;
38
- SelectedIndicator: (props: import("./SelectedIndicator").CommandMenuSelectedIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
38
+ SelectedIndicator: (props: import("./SelectedIndicator").CommandMenuSelectedIndicatorProps) => import("react/jsx-runtime").JSX.Element;
39
39
  RadioGroup: (props: import("./RadioGroup").CommandMenuRadioGroupProps) => import("react/jsx-runtime").JSX.Element;
40
40
  RadioItem: (props: import("./RadioItem").CommandMenuRadioItemProps) => import("react/jsx-runtime").JSX.Element;
41
41
  CheckboxItem: (props: import("./CheckboxItem").CommandMenuCheckboxItemProps) => import("react/jsx-runtime").JSX.Element;
42
- CheckboxIndicator: (props: import("./CheckboxIndicator").CommandMenuCheckboxIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
42
+ CheckboxIndicator: (props: import("./CheckboxIndicator").CommandMenuCheckboxIndicatorProps) => import("react/jsx-runtime").JSX.Element;
43
43
  Pages: (props: import("./Pages").CommandMenuPagesProps) => import("react/jsx-runtime").JSX.Element;
44
44
  Page: (props: import("./Page").CommandMenuPageProps) => import("react/jsx-runtime").JSX.Element;
45
45
  PageTriggerItem: (props: import("./PageTriggerItem").CommandMenuPageTriggerItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { CheckedState } from "./typings";
1
+ import type { CheckedState } from "../CheckedIndicator";
2
2
  export declare function getSelectedState(selected: boolean): "selected" | "unselected";
3
3
  export declare function getCheckedState(checked: CheckedState): "checked" | "indeterminate" | "unchecked";
4
4
  export declare function getActiveState(active: boolean): "active" | "inactive";
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import type { MenuCheckboxIndicatorProps } from "../typings";
3
- export declare const MenuCheckboxItemIndicator: import("react").ForwardRefExoticComponent<MenuCheckboxIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
3
+ export declare const MenuCheckboxItemIndicator: import("react").ForwardRefExoticComponent<Omit<MenuCheckboxIndicatorProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
@@ -1,2 +1 @@
1
- export * from "./SelectAllIndicator";
2
1
  export * from "./SelectAllItem";
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const MenuSelectedIndicator: import("react").ForwardRefExoticComponent<{
3
3
  children?: import("react").ReactNode;
4
- } & import("react").RefAttributes<HTMLDivElement>>;
4
+ } & import("react").RefAttributes<HTMLSpanElement>>;
@@ -1,7 +1,3 @@
1
1
  /// <reference types="react" />
2
- interface ISelectedIndicatorContext {
3
- selected: boolean;
4
- }
5
- export declare const SelectedIndicatorContext: import("react").Context<ISelectedIndicatorContext>;
6
- export declare const useSelectedIndicatorContext: () => ISelectedIndicatorContext;
7
- export {};
2
+ export declare const SelectedIndicatorContext: import("react").Context<boolean>;
3
+ export declare const useSelectedIndicatorContext: () => boolean;
@@ -5,9 +5,6 @@ export declare const menuItem: (props?: ({
5
5
  export declare const menuSeparator: (props?: ({
6
6
  size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
- export declare const menuSelectedIndicator: (props?: ({
9
- size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
10
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
8
  export declare const menuContent: (props?: ({
12
9
  size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
13
10
  radius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | null | undefined;
@@ -44,11 +44,10 @@ export declare const Menu: {
44
44
  MultiSelectItem: import("react").NamedExoticComponent<import("./typings").MenuSelectItemProps & import("react").RefAttributes<HTMLDivElement>>;
45
45
  SelectAllItem: import("react").ForwardRefExoticComponent<import("./typings").SelectAllItemProps & import("react").RefAttributes<HTMLDivElement>>;
46
46
  CheckboxItem: import("react").ForwardRefExoticComponent<import("./typings").MenuCheckboxItemProps & import("react").RefAttributes<HTMLDivElement>>;
47
- SelectAllIndicator: import("react").ForwardRefExoticComponent<import("./typings").SelectAllIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
48
47
  SelectedIndicator: import("react").ForwardRefExoticComponent<{
49
48
  children?: import("react").ReactNode;
50
- } & import("react").RefAttributes<HTMLDivElement>>;
51
- CheckboxItemIndicator: import("react").ForwardRefExoticComponent<import("./typings").MenuCheckboxIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
49
+ } & import("react").RefAttributes<HTMLSpanElement>>;
50
+ CheckboxItemIndicator: import("react").ForwardRefExoticComponent<Omit<import("./typings").MenuCheckboxIndicatorProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
52
51
  InputRoot: import("react").NamedExoticComponent<import("./typings").MenuInputRootProps & import("react").RefAttributes<HTMLDivElement>>;
53
52
  InputField: import("react").NamedExoticComponent<Omit<import("./typings").MenuInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
54
53
  InputSlot: import("react").NamedExoticComponent<import("./typings").MenuInputSlotProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -4,6 +4,7 @@ import type { VariantProps } from "class-variance-authority";
4
4
  import { ComponentProps, PropsWithChildren, PropsWithoutRef, ReactElement, ReactNode } from "react";
5
5
  import type { CheckedIndicatorProps } from "../CheckedIndicator";
6
6
  import type { ComponentRadius } from "../Provider";
7
+ import type { MultiSelectProps, SingleSelectProps } from "../SelectContext/typings";
7
8
  import type { AccentColorProps } from "../typings";
8
9
  import { menuItem } from "./cva";
9
10
  type MenuItemVariants = VariantProps<typeof menuItem>;
@@ -43,11 +44,8 @@ export interface MenuVirtualTriggerProps {
43
44
  }
44
45
  export interface MenuGroupProps extends PropsWithoutRef<ComponentProps<"div">> {
45
46
  }
46
- export interface MenuSelectGroupProps extends MenuGroupProps {
47
- value: string | null;
48
- onValueChange: (value: string | null) => void;
49
- }
50
- export interface MenuMultiSelectGroupProps extends MenuGroupProps {
47
+ export type MenuSelectGroupProps = MenuGroupProps & SingleSelectProps;
48
+ export interface MenuMultiSelectGroupProps extends MenuGroupProps, MultiSelectProps {
51
49
  values: string[];
52
50
  onValuesChange: (values: string[]) => void;
53
51
  }
@@ -66,7 +64,6 @@ export interface MenuSelectItemProps extends MenuItemProps {
66
64
  value: string;
67
65
  }
68
66
  export interface SelectAllItemProps extends Omit<MenuItemProps, "children"> {
69
- allValues: string[];
70
67
  children: ReactNode | ((meta: {
71
68
  active: boolean;
72
69
  selected: boolean | "indeterminate";
@@ -111,9 +108,6 @@ export interface MenuInputRootProps extends PropsWithoutRef<ComponentProps<"div"
111
108
  }
112
109
  export interface MenuInputSlotProps extends PropsWithoutRef<ComponentProps<"div">> {
113
110
  }
114
- export interface SelectAllIndicatorProps extends Omit<PropsWithoutRef<ComponentProps<"span">>, "children"> {
115
- children: ReactNode | ((indeterminate: boolean) => ReactNode);
116
- }
117
111
  export interface MenuCheckboxIndicatorProps extends Omit<PropsWithoutRef<ComponentProps<"span">>, "children">, CheckedIndicatorProps {
118
112
  }
119
113
  export interface MenuScrollProps extends PropsWithoutRef<ComponentProps<"div">> {
@@ -1,5 +1,11 @@
1
- import { MenuAlignment, MenuSide } from "./typings";
1
+ import type { CheckedState } from "../CheckedIndicator";
2
+ import type { MenuAlignment, MenuSide } from "./typings";
2
3
  export declare const computeOffsets: (side: MenuSide, alignment: MenuAlignment) => {
3
4
  mainAxis: number;
4
5
  crossAxis: number;
5
6
  };
7
+ export declare function getSelectedState(selected: boolean): "selected" | "unselected";
8
+ export declare function getCheckedState(checked: CheckedState): "checked" | "indeterminate" | "unchecked";
9
+ export declare function getActiveState(active: boolean): "active" | "inactive";
10
+ export declare function getBooleanState(value: boolean): "true" | "false";
11
+ export declare function getOpenState(open: boolean): "open" | "closed";
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from "react";
2
+ import type { MultiSelectProps } from "./typings";
3
+ export declare const MultiSelectProvider: import("react").NamedExoticComponent<PropsWithChildren<MultiSelectProps>>;
@@ -0,0 +1,4 @@
1
+ import { PropsWithChildren } from "react";
2
+ import type { SingleSelectNotRequiredProps, SingleSelectRequiredProps } from "./typings";
3
+ export declare const SingleSelectRequiredProvider: import("react").NamedExoticComponent<PropsWithChildren<SingleSelectRequiredProps>>;
4
+ export declare const SingleSelectNotRequiredProvider: import("react").NamedExoticComponent<PropsWithChildren<SingleSelectNotRequiredProps>>;
@@ -1,5 +1,15 @@
1
1
  /// <reference types="react" />
2
- import { MultiSelectContext, SingleSelectContext } from "./typings";
3
- export type ISelectContext = SingleSelectContext | MultiSelectContext;
2
+ export interface ISelectContext {
3
+ selectValue: (value: string) => void;
4
+ selected: (value: string) => boolean;
5
+ }
4
6
  export declare const SelectContext: import("react").Context<ISelectContext>;
5
- export declare function useSelectContext<Type = SingleSelectContext | MultiSelectContext>(): Type;
7
+ export interface IMultiSelectContext {
8
+ selectValue: (value: string) => void;
9
+ selected: (value: string) => boolean;
10
+ registerValue: (value: string) => () => void;
11
+ allSelected: boolean;
12
+ someSelected: boolean;
13
+ toggleSelectAll: () => void;
14
+ }
15
+ export declare const MultiSelectContext: import("react").Context<IMultiSelectContext>;
@@ -1,3 +1,3 @@
1
1
  export * from "./context";
2
- export * from "./Provider";
3
- export * from "./typings";
2
+ export * from "./MultiSelectProvider";
3
+ export * from "./SingleSelectProvider";
@@ -1,10 +1,18 @@
1
- export type SingleSelectContext = {
2
- type: "single";
3
- value: string | null;
4
- handleValueChange: (value: string | null) => void;
1
+ type _SingleSelectProps<TValue> = {
2
+ onValueChange?: (value: TValue) => void;
3
+ defaultValue?: TValue;
4
+ value?: TValue;
5
5
  };
6
- export type MultiSelectContext = {
7
- type: "multi";
8
- values: string[];
9
- handleValuesChange: (value: string[]) => void;
6
+ export type SingleSelectRequiredProps = _SingleSelectProps<string>;
7
+ export type SingleSelectNotRequiredProps = _SingleSelectProps<string | null>;
8
+ export type SingleSelectProps = (SingleSelectRequiredProps & {
9
+ required: true;
10
+ }) | (SingleSelectNotRequiredProps & {
11
+ required: false;
12
+ });
13
+ export type MultiSelectProps = {
14
+ onValuesChange?: (value: string[]) => void;
15
+ defaultValues?: string[];
16
+ values?: string[];
10
17
  };
18
+ export {};