@mirohq/design-system-combobox 1.0.9 → 1.1.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/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { ReactNode, FC, ComponentPropsWithRef, ForwardRefExoticComponent } from 'react';
3
3
  import { FormElementProps } from '@mirohq/design-system-base-form';
4
+ import * as _mirohq_design_system_base_input from '@mirohq/design-system-base-input';
4
5
  import { BaseInputStyledProps, BaseInputProps } from '@mirohq/design-system-base-input';
5
6
  import { CSSProperties } from '@stitches/react';
6
7
  import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
@@ -10,28 +11,25 @@ import * as RadixPopover from '@radix-ui/react-popover';
10
11
  import { PopoverPortalProps } from '@radix-ui/react-popover';
11
12
  import * as _ariakit_react from '@ariakit/react';
12
13
  import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';
14
+ import * as packages_components_internal_base_input_src_base_input from 'packages/components/internal/base-input/src/base-input';
13
15
 
14
- interface TriggerSharedProps extends Omit<BaseInputStyledProps, 'size'> {
16
+ type InputProps = Omit<BaseInputStyledProps, 'size'> & {
15
17
  /**
16
- * The content.
17
- */
18
- children?: react__default.ReactNode;
19
- /**
20
- * The size of the trigger.
18
+ * The size of the input.
21
19
  * @default 'large'
22
20
  */
23
21
  size?: BaseInputProps['size'];
24
22
  /**
25
- * The content that will be rendered inside the Combobox.Trigger when no value or
23
+ * The content that will be rendered inside the Combobox.Input when no value or
26
24
  * defaultValue is set.
27
25
  */
28
26
  placeholder?: string;
29
27
  /**
30
- * The label text for Trigger's action button when Combobox is empty and closed. Will be rendered in a Tooltip.
28
+ * The label text for Input's action button when Combobox is empty and closed. Will be rendered in a Tooltip.
31
29
  */
32
30
  openActionLabel: string;
33
31
  /**
34
- * The label text for Trigger's action button when Combobox is empty and open. Will be rendered in a Tooltip.
32
+ * The label text for Input's action button when Combobox is empty and open. Will be rendered in a Tooltip.
35
33
  */
36
34
  closeActionLabel: string;
37
35
  /**
@@ -39,17 +37,32 @@ interface TriggerSharedProps extends Omit<BaseInputStyledProps, 'size'> {
39
37
  * @default true
40
38
  */
41
39
  clearable?: boolean;
42
- }
43
- type TriggerProps = TriggerSharedProps & ({
40
+ } & ({
44
41
  clearable: false;
45
42
  clearActionLabel?: never;
46
43
  } | {
47
44
  /**
48
- * The label text for Trigger's action button when Combobox has values selected. Will be rendered in a Tooltip.
45
+ * The label text for Input's action button when Combobox has values selected. Will be rendered in a Tooltip.
49
46
  */
50
47
  clearActionLabel: string;
51
48
  });
52
- declare const Trigger: react__default.ForwardRefExoticComponent<TriggerProps & react__default.RefAttributes<HTMLInputElement>>;
49
+ declare const Input: react__default.ForwardRefExoticComponent<InputProps & react__default.RefAttributes<HTMLInputElement>>;
50
+
51
+ interface TriggerPropsWithChildren {
52
+ /**
53
+ * Render the trigger as a custom component, passed in as a child
54
+ */
55
+ asChild: true;
56
+ /**
57
+ * The content that will be rendered inside the Combobox.Trigger instead of the Combobox.Input, when asChild is true
58
+ */
59
+ children: react__default.ReactNode;
60
+ }
61
+ type TriggerPropsWithInput = InputProps & {
62
+ asChild?: never;
63
+ };
64
+ type TriggerProps = TriggerPropsWithChildren | TriggerPropsWithInput;
65
+ declare const Trigger: react__default.ForwardRefExoticComponent<TriggerProps & react__default.RefAttributes<HTMLDivElement>>;
53
66
 
54
67
  declare const StyledContent: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<RadixPopover.PopoverContentProps & react.RefAttributes<HTMLDivElement>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<RadixPopover.PopoverContentProps & react.RefAttributes<HTMLDivElement>>, {}, {}>;
55
68
  type StyledContentProps = StrictComponentProps<typeof StyledContent>;
@@ -325,6 +338,7 @@ declare const Combobox: ForwardRefExoticComponent<ComboboxProps> & Partials;
325
338
  interface Partials {
326
339
  Portal: typeof Portal;
327
340
  Trigger: typeof Trigger;
341
+ Input: typeof Input;
328
342
  Content: typeof Content;
329
343
  Item: typeof Item;
330
344
  Group: typeof Group;
@@ -334,4 +348,46 @@ interface Partials {
334
348
  NoResult: typeof NoResult;
335
349
  }
336
350
 
337
- export { Combobox, ContentProps as ComboboxContentProps, GroupLabelProps as ComboboxGroupLabelProps, GroupProps as ComboboxGroupProps, ItemProps as ComboboxItemProps, NoResultProps as ComboboxNoResultProps, PortalProps as ComboboxPortalProps, ComboboxProps, SeparatorProps as ComboboxSeparatorProps, TriggerProps as ComboboxTriggerProps, types as ComboboxTypes, ValueProps as ComboboxValueProps };
351
+ declare const StyledBaseInput: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_base_input.BaseInputProps> & packages_components_internal_base_input_src_base_input.Partials>, "size"> & _stitches_react_types_styled_component.TransformProps<{
352
+ size?: "medium" | "large" | "x-large" | undefined;
353
+ }, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_base_input.BaseInputProps> & packages_components_internal_base_input_src_base_input.Partials, {
354
+ size?: "medium" | "large" | "x-large" | undefined;
355
+ }, {}>;
356
+ type StyledBaseInputProps = ComponentPropsWithRef<typeof StyledBaseInput>;
357
+
358
+ interface ItemData {
359
+ displayedText: string;
360
+ groupId: string | undefined;
361
+ }
362
+ interface ComboboxProviderSharedProps extends FormElementProps {
363
+ value?: string[] | string;
364
+ direction?: Direction;
365
+ autoFilter: boolean;
366
+ }
367
+ interface ComboboxContextProps extends ComboboxProviderSharedProps {
368
+ setOpenState: react__default.Dispatch<react__default.SetStateAction<boolean | undefined>>;
369
+ openState: boolean;
370
+ setValue: react__default.Dispatch<react__default.SetStateAction<string[] | string | undefined>>;
371
+ triggerRef: react__default.RefObject<HTMLInputElement>;
372
+ inputRef: react__default.RefObject<HTMLInputElement>;
373
+ contentRef: react__default.RefObject<HTMLDivElement>;
374
+ searchValue: string;
375
+ setSearchValue: react__default.Dispatch<react__default.SetStateAction<string | undefined>>;
376
+ placeholder?: string;
377
+ setPlaceholder: react__default.Dispatch<react__default.SetStateAction<string | undefined>>;
378
+ size: StyledBaseInputProps['size'];
379
+ setSize: react__default.Dispatch<react__default.SetStateAction<StyledBaseInputProps['size']>>;
380
+ /**
381
+ * includes all visible and hidden items to render Chips and get filtered items
382
+ */
383
+ itemsMap: Map<string, ItemData>;
384
+ setItemsMap: react__default.Dispatch<react__default.SetStateAction<Map<string, ItemData>>>;
385
+ /**
386
+ * @returns filtered items based on itemsMap
387
+ * @returns empty array when searchValue is empty or auto filtering is disabled
388
+ */
389
+ filteredItems: ItemData[];
390
+ }
391
+ declare const useComboboxContext: () => ComboboxContextProps;
392
+
393
+ export { Combobox, ContentProps as ComboboxContentProps, GroupLabelProps as ComboboxGroupLabelProps, GroupProps as ComboboxGroupProps, InputProps as ComboboxInputProps, ItemProps as ComboboxItemProps, NoResultProps as ComboboxNoResultProps, PortalProps as ComboboxPortalProps, ComboboxProps, SeparatorProps as ComboboxSeparatorProps, TriggerProps as ComboboxTriggerProps, types as ComboboxTypes, ValueProps as ComboboxValueProps, useComboboxContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-combobox",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",