@collective-intelligence/ui-react 0.1.9 → 0.1.10

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.
@@ -132,18 +132,15 @@ export declare const CollapsibleContent: ({ ...props }: React$1.ComponentProps<t
132
132
  export interface ComboboxOption {
133
133
  value: string;
134
134
  label: string;
135
+ /** Listed but not selectable, e.g. once a selection reaches its limit. */
136
+ disabled?: boolean;
135
137
  }
136
138
  export interface ComboboxActionOption extends ComboboxOption {
137
139
  icon?: React$1.ReactNode;
138
140
  }
139
- export interface ComboboxProps {
141
+ export interface ComboboxBaseProps {
140
142
  options: ComboboxOption[];
141
143
  id?: string;
142
- value?: string;
143
- /** A durable label for a selected value that is not in the loaded page. */
144
- selectedLabel?: string;
145
- defaultValue?: string;
146
- onChange?: (value: string) => void;
147
144
  placeholder?: string;
148
145
  searchPlaceholder?: string;
149
146
  emptyMessage?: string;
@@ -170,7 +167,28 @@ export interface ComboboxProps {
170
167
  actionOption?: ComboboxActionOption;
171
168
  /** Enables modal focus and scroll handling for use inside another modal. */
172
169
  modal?: boolean;
170
+ /** Reports when the option list opens or closes, e.g. to fetch options lazily. */
171
+ onOpenChange?: (open: boolean) => void;
172
+ }
173
+ /** Picks one value; picking the selected value again clears it. */
174
+ export interface ComboboxSingleProps extends ComboboxBaseProps {
175
+ multiple?: false;
176
+ value?: string;
177
+ /** A durable label for a selected value that is not in the loaded page. */
178
+ selectedLabel?: string;
179
+ defaultValue?: string;
180
+ onChange?: (value: string) => void;
181
+ }
182
+ /** Picks several values; picking a selected value again removes it. */
183
+ export interface ComboboxMultipleProps extends ComboboxBaseProps {
184
+ multiple: true;
185
+ value?: readonly string[];
186
+ /** Durable labels, by value, for selected values not in the loaded page. */
187
+ selectedLabels?: Readonly<Record<string, string>>;
188
+ defaultValue?: readonly string[];
189
+ onChange?: (value: string[]) => void;
173
190
  }
191
+ export type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps;
174
192
  export declare const Combobox: React$1.ForwardRefExoticComponent<ComboboxProps & React$1.RefAttributes<HTMLButtonElement>>;
175
193
  export declare const Dialog: ({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Root>) => React$1.JSX.Element;
176
194
  export declare const DialogTrigger: ({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Trigger>) => React$1.JSX.Element;