@mirohq/design-system-combobox 1.1.0-stop-using-strict-component-props.0 → 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,36 +1,35 @@
1
1
  import * as react from 'react';
2
- import react__default, { ComponentPropsWithRef, ReactNode, FC, ForwardRefExoticComponent } from 'react';
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';
7
8
  import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
9
+ import { StrictComponentProps } from '@mirohq/design-system-stitches';
8
10
  import * as RadixPopover from '@radix-ui/react-popover';
9
11
  import { PopoverPortalProps } from '@radix-ui/react-popover';
10
12
  import * as _ariakit_react from '@ariakit/react';
11
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';
12
15
 
13
- interface TriggerSharedProps extends Omit<BaseInputStyledProps, 'size'> {
16
+ type InputProps = Omit<BaseInputStyledProps, 'size'> & {
14
17
  /**
15
- * The content.
16
- */
17
- children?: react__default.ReactNode;
18
- /**
19
- * The size of the trigger.
18
+ * The size of the input.
20
19
  * @default 'large'
21
20
  */
22
21
  size?: BaseInputProps['size'];
23
22
  /**
24
- * 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
25
24
  * defaultValue is set.
26
25
  */
27
26
  placeholder?: string;
28
27
  /**
29
- * 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.
30
29
  */
31
30
  openActionLabel: string;
32
31
  /**
33
- * 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.
34
33
  */
35
34
  closeActionLabel: string;
36
35
  /**
@@ -38,20 +37,35 @@ interface TriggerSharedProps extends Omit<BaseInputStyledProps, 'size'> {
38
37
  * @default true
39
38
  */
40
39
  clearable?: boolean;
41
- }
42
- type TriggerProps = TriggerSharedProps & ({
40
+ } & ({
43
41
  clearable: false;
44
42
  clearActionLabel?: never;
45
43
  } | {
46
44
  /**
47
- * 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.
48
46
  */
49
47
  clearActionLabel: string;
50
48
  });
51
- 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>>;
52
66
 
53
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>>, {}, {}>;
54
- type StyledContentProps = ComponentPropsWithRef<typeof StyledContent>;
68
+ type StyledContentProps = StrictComponentProps<typeof StyledContent>;
55
69
 
56
70
  type PointerDownOutsideEvent = CustomEvent<{
57
71
  originalEvent: PointerEvent;
@@ -170,7 +184,7 @@ interface ContentProps extends StyledContentProps {
170
184
  declare const Content: react__default.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
171
185
 
172
186
  declare const StyledItem: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<(props: _ariakit_react.ComboboxItemProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<(props: _ariakit_react.ComboboxItemProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>, {}, {}>;
173
- type StyledItemProps = ComponentPropsWithRef<typeof StyledItem>;
187
+ type StyledItemProps = StrictComponentProps<typeof StyledItem>;
174
188
 
175
189
  interface ItemProps extends StyledItemProps {
176
190
  /**
@@ -204,15 +218,13 @@ interface PortalProps extends PopoverPortalProps {
204
218
  declare const Portal: ({ forceMount: forceMountProp, ...restProps }: PortalProps) => react__default.ReactNode;
205
219
 
206
220
  declare const StyledGroup: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<(props: _ariakit_react.GroupProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<(props: _ariakit_react.GroupProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>, {}, {}>;
207
- type StyledGroupProps = ComponentPropsWithRef<typeof StyledGroup>;
221
+ type StyledGroupProps = StrictComponentProps<typeof StyledGroup>;
208
222
 
209
223
  type GroupProps = StyledGroupProps;
210
- declare const Group: react__default.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<(props: _ariakit_react.GroupProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react__default.RefAttributes<HTMLDivElement>, "ref"> & {
211
- ref?: ((instance: HTMLDivElement | null) => void | react__default.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react__default.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react__default.RefObject<HTMLDivElement> | null | undefined;
212
- }, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
224
+ declare const Group: react__default.ForwardRefExoticComponent<Omit<StyledGroupProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
213
225
 
214
226
  declare const StyledGroupLabel: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<(props: _ariakit_react.GroupLabelProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<(props: _ariakit_react.GroupLabelProps) => react.ReactElement<any, string | react.JSXElementConstructor<any>>, {}, {}>;
215
- type StyledGroupLabelProps = ComponentPropsWithRef<typeof StyledGroupLabel>;
227
+ type StyledGroupLabelProps = StrictComponentProps<typeof StyledGroupLabel>;
216
228
 
217
229
  interface GroupLabelProps extends StyledGroupLabelProps {
218
230
  }
@@ -232,7 +244,7 @@ interface ValueProps {
232
244
  declare const Value: FC<ValueProps>;
233
245
 
234
246
  declare const StyledSeparator: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
235
- type StyledSeparatorProps = ComponentPropsWithRef<typeof StyledSeparator>;
247
+ type StyledSeparatorProps = StrictComponentProps<typeof StyledSeparator>;
236
248
 
237
249
  interface SeparatorProps extends StyledSeparatorProps {
238
250
  }
@@ -242,7 +254,7 @@ declare const StyledComboboxContent: react.ForwardRefExoticComponent<Omit<Omit<_
242
254
  type StyledComboboxProps = ComponentPropsWithRef<typeof StyledComboboxContent>;
243
255
 
244
256
  declare const StyledNoResult: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
245
- type StyledNoResultProps = ComponentPropsWithRef<typeof StyledNoResult>;
257
+ type StyledNoResultProps = StrictComponentProps<typeof StyledNoResult>;
246
258
 
247
259
  interface NoResultProps extends StyledNoResultProps {
248
260
  /**
@@ -326,6 +338,7 @@ declare const Combobox: ForwardRefExoticComponent<ComboboxProps> & Partials;
326
338
  interface Partials {
327
339
  Portal: typeof Portal;
328
340
  Trigger: typeof Trigger;
341
+ Input: typeof Input;
329
342
  Content: typeof Content;
330
343
  Item: typeof Item;
331
344
  Group: typeof Group;
@@ -335,4 +348,46 @@ interface Partials {
335
348
  NoResult: typeof NoResult;
336
349
  }
337
350
 
338
- 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.1.0-stop-using-strict-component-props.0",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -32,19 +32,19 @@
32
32
  "@radix-ui/react-use-controllable-state": "1.0.1",
33
33
  "@react-aria/utils": "^3.13.0",
34
34
  "@mirohq/design-system-base-form": "^1.0.0",
35
- "@mirohq/design-system-base-input": "^1.0.1-stop-using-strict-component-props.0",
35
+ "@mirohq/design-system-base-input": "^1.0.0",
36
36
  "@mirohq/design-system-base-select": "^1.0.0",
37
- "@mirohq/design-system-chip": "^1.1.0-stop-using-strict-component-props.0",
38
37
  "@mirohq/design-system-base-tooltip": "^1.0.0",
39
- "@mirohq/design-system-icons": "^1.5.0",
40
- "@mirohq/design-system-use-aria-disabled": "^1.0.0",
38
+ "@mirohq/design-system-chip": "^1.0.9",
39
+ "@mirohq/design-system-icons": "^1.6.2",
41
40
  "@mirohq/design-system-primitive": "^2.0.0",
42
- "@mirohq/design-system-scroll-area": "^1.1.0-stop-using-strict-component-props.0",
41
+ "@mirohq/design-system-scroll-area": "^1.0.0",
42
+ "@mirohq/design-system-stitches": "^3.0.0",
43
+ "@mirohq/design-system-use-aria-disabled": "^1.0.0",
43
44
  "@mirohq/design-system-use-id": "^1.0.0",
44
45
  "@mirohq/design-system-use-layout-effect": "^1.0.0",
45
- "@mirohq/design-system-utils": "^1.0.0",
46
- "@mirohq/design-system-stitches": "^3.0.0",
47
- "@mirohq/design-system-use-previous": "^1.0.0"
46
+ "@mirohq/design-system-use-previous": "^1.0.0",
47
+ "@mirohq/design-system-utils": "^1.0.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup -c ../../../rollup.config.js",