@economic/taco 0.0.7-alpha.0 → 0.0.11-alpha.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.
Files changed (61) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +9 -9
  2. package/dist/components/Backdrop/Backdrop.d.ts +1 -1
  3. package/dist/components/Button/Button.d.ts +8 -12
  4. package/dist/components/Dialog/Context.d.ts +0 -1
  5. package/dist/components/Dialog/Dialog.d.ts +14 -8
  6. package/dist/components/Hanger/Hanger.d.ts +4 -1
  7. package/dist/components/IconButton/IconButton.d.ts +13 -13
  8. package/dist/components/Menu/Menu.d.ts +3 -1
  9. package/dist/components/Popover/Popover.d.ts +4 -1
  10. package/dist/esm/components/Accordion/Accordion.js +14 -9
  11. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  12. package/dist/esm/components/Backdrop/Backdrop.js +5 -4
  13. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  14. package/dist/esm/components/Button/Button.js.map +1 -1
  15. package/dist/esm/components/Button/util.js +16 -16
  16. package/dist/esm/components/Button/util.js.map +1 -1
  17. package/dist/esm/components/Calendar/Calendar.js +1 -1
  18. package/dist/esm/components/Combobox/Combobox.js +1 -1
  19. package/dist/esm/components/Datepicker/Datepicker.js +2 -2
  20. package/dist/esm/components/Dialog/Context.js +0 -1
  21. package/dist/esm/components/Dialog/Context.js.map +1 -1
  22. package/dist/esm/components/Dialog/Dialog.js +11 -15
  23. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  24. package/dist/esm/components/Dialog/components/Content.js +28 -11
  25. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  26. package/dist/esm/components/Hanger/Hanger.js +6 -6
  27. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  28. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  29. package/dist/esm/components/Input/Input.js +1 -1
  30. package/dist/esm/components/Input/Input.js.map +1 -1
  31. package/dist/esm/components/Listbox/ScrollableList.js +1 -1
  32. package/dist/esm/components/Menu/Menu.js +9 -3
  33. package/dist/esm/components/Menu/Menu.js.map +1 -1
  34. package/dist/esm/components/Menu/components/Content.js +2 -2
  35. package/dist/esm/components/Menu/components/Header.js +1 -1
  36. package/dist/esm/components/Menu/components/Item.js +1 -1
  37. package/dist/esm/components/Menu/components/Separator.js +1 -1
  38. package/dist/esm/components/Menu/components/Trigger.js +2 -2
  39. package/dist/esm/components/Pagination/PageNumbers.js +1 -1
  40. package/dist/esm/components/Pagination/Pagination.js +1 -1
  41. package/dist/esm/components/Popover/Popover.js +3 -4
  42. package/dist/esm/components/Popover/Popover.js.map +1 -1
  43. package/dist/esm/components/SearchInput/SearchInput.js +8 -8
  44. package/dist/esm/components/Table/components/Table.js +1 -2
  45. package/dist/esm/components/Table/components/Table.js.map +1 -1
  46. package/dist/esm/components/Table/components/WindowedTable.js +0 -1
  47. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  48. package/dist/esm/components/Table/hooks/plugins/useRowActions.js +1 -1
  49. package/dist/esm/components/Table/hooks/useTable.js +4 -1
  50. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  51. package/dist/esm/components/Toast/Toast.js +1 -1
  52. package/dist/esm/components/Tour/Tour.js +1 -1
  53. package/dist/esm/index.css +37 -37
  54. package/dist/esm/index.js +8 -8
  55. package/dist/index.css +37 -37
  56. package/dist/taco.cjs.development.js +2619 -2592
  57. package/dist/taco.cjs.development.js.map +1 -1
  58. package/dist/taco.cjs.production.min.js +1 -1
  59. package/dist/taco.cjs.production.min.js.map +1 -1
  60. package/package.json +2 -2
  61. package/types.json +1110 -637
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
+ export declare type AccordionTriggerProps = React.HTMLAttributes<HTMLElement>;
3
+ export declare type AccordionContentProps = React.HTMLAttributes<HTMLElement>;
4
+ export declare type AccordionItemProps = React.HTMLAttributes<HTMLDivElement> & {
5
+ id: string;
6
+ disabled?: boolean;
7
+ };
2
8
  declare type AccordionBaseProps = {
3
9
  children: React.ReactNode[];
4
10
  /** Change what heading element accordion regions will render */
@@ -27,16 +33,10 @@ export interface AccordionSingleControlledProps extends AccordionBaseProps {
27
33
  defaultId?: never;
28
34
  }
29
35
  export declare type AccordionProps = AccordionUncontrolledProps | AccordionMultipleControlledProps | AccordionSingleControlledProps;
30
- declare type AccordionItem = React.HTMLAttributes<HTMLDivElement> & {
31
- id: string;
32
- disabled?: boolean;
33
- };
34
- declare type AccordionTrigger = React.HTMLAttributes<HTMLElement>;
35
- declare type AccordionContent = React.HTMLAttributes<HTMLElement>;
36
36
  export declare const Accordion: {
37
37
  (props: AccordionProps): JSX.Element;
38
- Item: React.FC<AccordionItem>;
39
- Trigger: React.ForwardRefExoticComponent<AccordionTrigger & React.RefAttributes<HTMLButtonElement>>;
40
- Content: React.ForwardRefExoticComponent<AccordionContent & React.RefAttributes<HTMLDivElement>>;
38
+ Item: (props: AccordionItemProps) => JSX.Element;
39
+ Trigger: React.ForwardRefExoticComponent<AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>>;
40
+ Content: React.ForwardRefExoticComponent<AccordionContentProps & React.RefAttributes<HTMLDivElement>>;
41
41
  };
42
42
  export {};
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  export declare type BackdropProps = React.HTMLAttributes<HTMLDivElement>;
3
- export declare const Backdrop: (props: BackdropProps) => JSX.Element;
3
+ export declare const Backdrop: React.ForwardRefExoticComponent<BackdropProps & React.RefAttributes<HTMLDivElement>>;
@@ -14,19 +14,19 @@ export declare type ButtonProps = ButtonPrimitive.ButtonProps & {
14
14
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
15
15
  * the button should be only to open the associated dialog when clicked.
16
16
  */
17
- dialog?: React.ReactElement<DialogProps>;
17
+ dialog?: (props: Partial<DialogProps>) => JSX.Element;
18
18
  /** If fluid, button expands to the width of it's container */
19
19
  fluid?: boolean;
20
20
  /** Hanger component associated with the button. */
21
- hanger?: React.ReactElement<HangerProps>;
21
+ hanger?: (props: Partial<HangerProps>) => JSX.Element;
22
22
  /** Menu component associated with the button. */
23
- menu?: React.ReactElement<MenuProps>;
23
+ menu?: (props: Partial<MenuProps>) => JSX.Element;
24
24
  /**
25
25
  * Popover component associated with the button, clicking the button will open the popover.
26
26
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
27
27
  * the button should be only to open the associated popover when clicked.
28
28
  */
29
- popover?: React.ReactElement<PopoverProps>;
29
+ popover?: (props: Partial<PopoverProps>) => JSX.Element;
30
30
  /** A tooltip to show when hovering over the button */
31
31
  tooltip?: string;
32
32
  };
@@ -42,23 +42,19 @@ export declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAtt
42
42
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
43
43
  * the button should be only to open the associated dialog when clicked.
44
44
  */
45
- dialog?: React.ReactElement<DialogProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
45
+ dialog?: ((props: Partial<DialogProps>) => JSX.Element) | undefined;
46
46
  /** If fluid, button expands to the width of it's container */
47
47
  fluid?: boolean | undefined;
48
48
  /** Hanger component associated with the button. */
49
- hanger?: React.ReactElement<{
50
- children?: React.ReactNode;
51
- }, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
49
+ hanger?: ((props: Partial<HangerProps>) => JSX.Element) | undefined;
52
50
  /** Menu component associated with the button. */
53
- menu?: React.ReactElement<MenuProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
51
+ menu?: ((props: Partial<MenuProps>) => JSX.Element) | undefined;
54
52
  /**
55
53
  * Popover component associated with the button, clicking the button will open the popover.
56
54
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
57
55
  * the button should be only to open the associated popover when clicked.
58
56
  */
59
- popover?: React.ReactElement<{
60
- children?: React.ReactNode;
61
- }, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
57
+ popover?: ((props: Partial<PopoverProps>) => JSX.Element) | undefined;
62
58
  /** A tooltip to show when hovering over the button */
63
59
  tooltip?: string | undefined;
64
60
  } & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
@@ -11,7 +11,6 @@ export declare type DialogContext = {
11
11
  drawer?: React.ReactNode;
12
12
  extra?: React.ReactNode;
13
13
  };
14
- close: () => void;
15
14
  onClose?: () => void;
16
15
  props: {};
17
16
  ref: React.Ref<HTMLElement>;
@@ -18,24 +18,30 @@ export declare type DialogProps = {
18
18
  children: React.ReactNode | React.ReactNode[];
19
19
  /** When `true`, pressing escape will close the dialog */
20
20
  closeOnEscape?: boolean;
21
+ /** Set whether the dialog is open by default or not, use when not providing a trigger */
22
+ defaultOpen?: boolean;
21
23
  /** Allows dragging the dialog around the screen (window constrained) */
22
24
  draggable?: boolean;
23
25
  /** Handler called when dialog closes by user interaction */
24
26
  onClose?: () => void;
25
- /** Set whether the dialog is open by default or not, use when not providing a trigger */
27
+ /** Called when the dialog opens or closes, must be used in conjunction with open */
28
+ onChange?: (open: boolean) => void;
29
+ /** Control the open state of the dialog from outside the component */
26
30
  open?: boolean;
27
31
  /** Shows the close icon button of the dialog */
28
32
  showCloseButton?: boolean;
29
33
  /** Size of the dialog. This is the recommended way to set a size for dialog component. */
30
34
  size?: DialogSize;
35
+ /** A trigger to be used for the dialog, should not be set if `children` already contains a trigger */
36
+ trigger?: JSX.Element;
31
37
  };
32
38
  export declare type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {
33
- Trigger: React.ForwardRefExoticComponent<DialogTriggerProps>;
34
- Content: React.ForwardRefExoticComponent<DialogContentProps>;
35
- Title: React.ForwardRefExoticComponent<DialogTitleProps>;
36
- Footer: React.ForwardRefExoticComponent<DialogFooterProps>;
37
- Extra: React.ForwardRefExoticComponent<DialogExtraProps>;
38
- Drawer: React.ForwardRefExoticComponent<DialogDrawerProps>;
39
- Close: React.ForwardRefExoticComponent<DialogCloseProps>;
39
+ Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
40
+ Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
41
+ Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
42
+ Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
43
+ Extra: React.ForwardRefExoticComponent<DialogExtraProps & React.RefAttributes<HTMLDivElement>>;
44
+ Drawer: React.ForwardRefExoticComponent<DialogDrawerProps & React.RefAttributes<HTMLDivElement>>;
45
+ Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
40
46
  };
41
47
  export declare const Dialog: ForwardedDialogWithStatics;
@@ -13,7 +13,10 @@ export declare type HangerContentProps = React.HTMLAttributes<HTMLDivElement> &
13
13
  /** Set the position of the Hanger relative to its achor. Default value is `bottom` */
14
14
  placement?: Placement;
15
15
  };
16
- export declare type HangerProps = React.PropsWithChildren<{}>;
16
+ export declare type HangerProps = React.PropsWithChildren<{
17
+ /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */
18
+ anchor?: JSX.Element;
19
+ }>;
17
20
  export declare type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {
18
21
  Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;
19
22
  Content: React.ForwardRefExoticComponent<HangerContentProps>;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import * as ButtonPrimitive from '../../primitives/Button';
3
3
  import { IconName } from '../Icon/Icon';
4
4
  import { Appearance } from '../../types';
5
- import { DialogProps, HangerProps, PopoverProps } from '../..';
5
+ import { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';
6
6
  export declare type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {
7
7
  /** Appearance will change the style of the button */
8
8
  appearance?: Appearance;
@@ -11,17 +11,19 @@ export declare type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'childre
11
11
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
12
12
  * the button should be only to open the associated dialog when clicked.
13
13
  */
14
- dialog?: React.ReactElement<DialogProps>;
14
+ dialog?: (props: Partial<DialogProps>) => JSX.Element;
15
+ /** Hanger component associated with the button. */
16
+ hanger?: (props: Partial<HangerProps>) => JSX.Element;
15
17
  /** Set which icon should be rendered within button */
16
18
  icon: IconName;
17
- /** Hanger component associated with the button. */
18
- hanger?: React.ReactElement<HangerProps>;
19
+ /** Menu component associated with the button. */
20
+ menu?: (props: Partial<MenuProps>) => JSX.Element;
19
21
  /**
20
22
  * Popover component associated with the button, clicking the button will open the popover.
21
23
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
22
24
  * the button should be only to open the associated popover when clicked.
23
25
  */
24
- popover?: React.ReactElement<PopoverProps>;
26
+ popover?: (props: Partial<PopoverProps>) => JSX.Element;
25
27
  /**
26
28
  * Set whether the button is rounded.
27
29
  * Default value is `false`
@@ -38,21 +40,19 @@ export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrim
38
40
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
39
41
  * the button should be only to open the associated dialog when clicked.
40
42
  */
41
- dialog?: React.ReactElement<DialogProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
43
+ dialog?: ((props: Partial<DialogProps>) => JSX.Element) | undefined;
44
+ /** Hanger component associated with the button. */
45
+ hanger?: ((props: Partial<HangerProps>) => JSX.Element) | undefined;
42
46
  /** Set which icon should be rendered within button */
43
47
  icon: IconName;
44
- /** Hanger component associated with the button. */
45
- hanger?: React.ReactElement<{
46
- children?: React.ReactNode;
47
- }, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
48
+ /** Menu component associated with the button. */
49
+ menu?: ((props: Partial<MenuProps>) => JSX.Element) | undefined;
48
50
  /**
49
51
  * Popover component associated with the button, clicking the button will open the popover.
50
52
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
51
53
  * the button should be only to open the associated popover when clicked.
52
54
  */
53
- popover?: React.ReactElement<{
54
- children?: React.ReactNode;
55
- }, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
55
+ popover?: ((props: Partial<PopoverProps>) => JSX.Element) | undefined;
56
56
  /**
57
57
  * Set whether the button is rounded.
58
58
  * Default value is `false`
@@ -3,9 +3,11 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
3
  export declare type MenuProps = {
4
4
  children: React.ReactNode;
5
5
  id?: string;
6
+ /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */
7
+ trigger?: JSX.Element;
6
8
  };
7
9
  export declare const Menu: {
8
- (props: MenuProps): JSX.Element;
10
+ (externalProps: MenuProps): JSX.Element;
9
11
  Trigger: React.ForwardRefExoticComponent<Pick<React.HTMLAttributes<HTMLButtonElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
10
12
  children: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
11
13
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -10,7 +10,10 @@ export declare type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivEleme
10
10
  placement?: Placement;
11
11
  };
12
12
  export declare type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;
13
- export declare type PopoverProps = React.PropsWithChildren<{}>;
13
+ export declare type PopoverProps = React.PropsWithChildren<{
14
+ /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */
15
+ trigger?: JSX.Element;
16
+ }>;
14
17
  export declare type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {
15
18
  Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;
16
19
  Content: React.ForwardRefExoticComponent<PopoverContentProps>;
@@ -6,7 +6,9 @@ import { Icon } from '../Icon/Icon.js';
6
6
 
7
7
  var _excluded = ["id"],
8
8
  _excluded2 = ["id", "defaultId", "onChange", "as"];
9
- var AccordionContext = /*#__PURE__*/React__default.createContext({});
9
+ var AccordionContext = /*#__PURE__*/React__default.createContext({
10
+ as: 'h2'
11
+ });
10
12
  var StyledTrigger = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
11
13
  var isExpanded = !!props['aria-expanded'];
12
14
  var className = cn('w-full inline-flex justify-between items-center align-middle', 'focus:rounded-sm focus:border-blue focus:yt-focus', props.className);
@@ -21,8 +23,7 @@ var Trigger = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
21
23
  var children = props.children;
22
24
 
23
25
  var _React$useContext = React__default.useContext(AccordionContext),
24
- _React$useContext$as = _React$useContext.as,
25
- Heading = _React$useContext$as === void 0 ? 'h2' : _React$useContext$as;
26
+ Heading = _React$useContext.as;
26
27
 
27
28
  return React__default.createElement(Header, {
28
29
  asChild: true
@@ -52,9 +53,15 @@ var Accordion = function Accordion(props) {
52
53
  var id = props.id,
53
54
  defaultId = props.defaultId,
54
55
  onChange = props.onChange,
55
- as = props.as,
56
+ _props$as = props.as,
57
+ as = _props$as === void 0 ? 'h2' : _props$as,
56
58
  otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
57
59
 
60
+ var context = React__default.useMemo(function () {
61
+ return {
62
+ as: as
63
+ };
64
+ }, [as]);
58
65
  var valueProps;
59
66
 
60
67
  if (defaultId) {
@@ -71,13 +78,11 @@ var Accordion = function Accordion(props) {
71
78
  var type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';
72
79
  var className = cn('divide-y divide-grey', props.className);
73
80
  return React__default.createElement(AccordionContext.Provider, {
74
- value: {
75
- as: as
76
- }
81
+ value: context
77
82
  }, React__default.createElement(Root, Object.assign({}, otherProps, valueProps, {
78
83
  "data-taco": "accordion",
79
- type: type,
80
- className: className
84
+ className: className,
85
+ type: type
81
86
  })));
82
87
  };
83
88
  Accordion.Item = Item;
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { Icon } from '../Icon/Icon';\n\ntype AccordionBaseProps = {\n children: React.ReactNode[];\n\n /** Change what heading element accordion regions will render */\n as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Additional classes for Accordion root element */\n className?: string;\n};\n\nexport interface AccordionUncontrolledProps extends AccordionBaseProps {\n /** Default expanded accordion(s) */\n defaultId: string | string[];\n\n id?: never;\n onChange?: never;\n}\n\nexport interface AccordionMultipleControlledProps extends AccordionBaseProps {\n /** Expanded accordions */\n id: string[];\n\n /** onChange function to receive ids of expanded accordions */\n onChange: (id: string[]) => void;\n\n defaultId?: never;\n}\nexport interface AccordionSingleControlledProps extends AccordionBaseProps {\n /** Expanded accordion */\n id: string;\n\n /** onChange function to receive id of expanded accordion */\n onChange: (id: string) => void;\n\n defaultId?: never;\n}\n\nexport type AccordionProps = AccordionUncontrolledProps | AccordionMultipleControlledProps | AccordionSingleControlledProps;\n\ntype AccordionItem = React.HTMLAttributes<HTMLDivElement> & {\n id: string;\n disabled?: boolean;\n};\ntype AccordionTrigger = React.HTMLAttributes<HTMLElement>;\ntype AccordionContent = React.HTMLAttributes<HTMLElement>;\n\ntype AccordionContext = {\n as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n};\nconst AccordionContext = React.createContext<AccordionContext>({});\n\nconst StyledTrigger = React.forwardRef((props: AccordionPrimitive.AccordionTriggerProps, ref: React.Ref<HTMLButtonElement>) => {\n const isExpanded = !!props['aria-expanded'];\n\n const className = cn(\n 'w-full inline-flex justify-between items-center align-middle',\n 'focus:rounded-sm focus:border-blue focus:yt-focus',\n props.className\n );\n\n return (\n <button {...props} ref={ref} className={className}>\n {props.children}\n <Icon name={isExpanded ? 'chevron-up' : 'chevron-down'} />\n </button>\n );\n});\n\nconst Trigger = React.forwardRef((props: AccordionTrigger, ref: React.Ref<HTMLButtonElement>) => {\n const { children } = props;\n const { as: Heading = 'h2' } = React.useContext(AccordionContext);\n\n return (\n <AccordionPrimitive.Header asChild>\n <Heading className=\"my-3\">\n <AccordionPrimitive.Trigger ref={ref} asChild>\n <StyledTrigger>{children}</StyledTrigger>\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n});\n\nconst Content = React.forwardRef((props: AccordionContent, ref: React.Ref<HTMLDivElement>) => (\n <AccordionPrimitive.Content {...props} ref={ref} />\n));\n\nconst Item: React.FC<AccordionItem> = props => {\n const { id, ...otherProps } = props;\n return <AccordionPrimitive.Item {...otherProps} value={id} />;\n};\n\nexport const Accordion = (props: AccordionProps) => {\n const { id, defaultId, onChange, as, ...otherProps } = props;\n\n let valueProps;\n\n if (defaultId) {\n valueProps = {\n defaultValue: defaultId || undefined,\n };\n } else {\n valueProps = {\n onValueChange: onChange,\n value: id || undefined,\n };\n }\n\n const type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';\n const className = cn('divide-y divide-grey', props.className);\n\n return (\n <AccordionContext.Provider value={{ as }}>\n <AccordionPrimitive.Root {...otherProps} {...valueProps} data-taco=\"accordion\" type={type} className={className} />\n </AccordionContext.Provider>\n );\n};\n\nAccordion.Item = Item;\nAccordion.Trigger = Trigger;\nAccordion.Content = Content;\n"],"names":["AccordionContext","React","createContext","StyledTrigger","forwardRef","props","ref","isExpanded","className","cn","children","Icon","name","Trigger","useContext","as","Heading","AccordionPrimitive","asChild","Content","Item","id","otherProps","value","Accordion","defaultId","onChange","valueProps","defaultValue","undefined","onValueChange","type","Array","isArray","Provider"],"mappings":"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"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { Icon } from '../Icon/Icon';\n\ntype AccordionContext = {\n as: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n};\nconst AccordionContext = React.createContext<AccordionContext>({\n as: 'h2',\n});\n\nexport type AccordionTriggerProps = React.HTMLAttributes<HTMLElement>;\n\nconst StyledTrigger = React.forwardRef((props: AccordionPrimitive.AccordionTriggerProps, ref: React.Ref<HTMLButtonElement>) => {\n const isExpanded = !!props['aria-expanded'];\n\n const className = cn(\n 'w-full inline-flex justify-between items-center align-middle',\n 'focus:rounded-sm focus:border-blue focus:yt-focus',\n props.className\n );\n\n return (\n <button {...props} ref={ref} className={className}>\n {props.children}\n <Icon name={isExpanded ? 'chevron-up' : 'chevron-down'} />\n </button>\n );\n});\n\nconst Trigger = React.forwardRef((props: AccordionTriggerProps, ref: React.Ref<HTMLButtonElement>) => {\n const { children } = props;\n const { as: Heading } = React.useContext(AccordionContext);\n\n return (\n <AccordionPrimitive.Header asChild>\n <Heading className=\"my-3\">\n <AccordionPrimitive.Trigger ref={ref} asChild>\n <StyledTrigger>{children}</StyledTrigger>\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n});\n\nexport type AccordionContentProps = React.HTMLAttributes<HTMLElement>;\nconst Content = React.forwardRef((props: AccordionContentProps, ref: React.Ref<HTMLDivElement>) => (\n <AccordionPrimitive.Content {...props} ref={ref} />\n));\n\nexport type AccordionItemProps = React.HTMLAttributes<HTMLDivElement> & {\n id: string;\n disabled?: boolean;\n};\nconst Item = (props: AccordionItemProps) => {\n const { id, ...otherProps } = props;\n return <AccordionPrimitive.Item {...otherProps} value={id} />;\n};\n\ntype AccordionBaseProps = {\n children: React.ReactNode[];\n\n /** Change what heading element accordion regions will render */\n as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Additional classes for Accordion root element */\n className?: string;\n};\n\nexport interface AccordionUncontrolledProps extends AccordionBaseProps {\n /** Default expanded accordion(s) */\n defaultId: string | string[];\n\n id?: never;\n onChange?: never;\n}\n\nexport interface AccordionMultipleControlledProps extends AccordionBaseProps {\n /** Expanded accordions */\n id: string[];\n\n /** onChange function to receive ids of expanded accordions */\n onChange: (id: string[]) => void;\n\n defaultId?: never;\n}\nexport interface AccordionSingleControlledProps extends AccordionBaseProps {\n /** Expanded accordion */\n id: string;\n\n /** onChange function to receive id of expanded accordion */\n onChange: (id: string) => void;\n\n defaultId?: never;\n}\n\nexport type AccordionProps = AccordionUncontrolledProps | AccordionMultipleControlledProps | AccordionSingleControlledProps;\n\nexport const Accordion = (props: AccordionProps) => {\n const { id, defaultId, onChange, as = 'h2', ...otherProps } = props;\n const context = React.useMemo(() => ({ as }), [as]);\n\n let valueProps;\n\n if (defaultId) {\n valueProps = {\n defaultValue: defaultId || undefined,\n };\n } else {\n valueProps = {\n onValueChange: onChange,\n value: id || undefined,\n };\n }\n\n const type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';\n const className = cn('divide-y divide-grey', props.className);\n\n return (\n <AccordionContext.Provider value={context}>\n <AccordionPrimitive.Root {...otherProps} {...valueProps} data-taco=\"accordion\" className={className} type={type} />\n </AccordionContext.Provider>\n );\n};\n\nAccordion.Item = Item;\nAccordion.Trigger = Trigger;\nAccordion.Content = Content;\n"],"names":["AccordionContext","React","createContext","as","StyledTrigger","forwardRef","props","ref","isExpanded","className","cn","children","Icon","name","Trigger","useContext","Heading","AccordionPrimitive","asChild","Content","Item","id","otherProps","value","Accordion","defaultId","onChange","context","useMemo","valueProps","defaultValue","undefined","onValueChange","type","Array","isArray","Provider"],"mappings":"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"}
@@ -1,12 +1,13 @@
1
- import { createElement } from 'react';
1
+ import { forwardRef, createElement } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
- var Backdrop = function Backdrop(props) {
4
+ var Backdrop = /*#__PURE__*/forwardRef(function Backdrop(props, ref) {
5
5
  var className = cn('fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] animate-[fade-in_150ms] aria-hidden:hidden', props.className);
6
6
  return createElement("div", Object.assign({}, props, {
7
- className: className
7
+ className: className,
8
+ ref: ref
8
9
  }));
9
- };
10
+ });
10
11
 
11
12
  export { Backdrop };
12
13
  //# sourceMappingURL=Backdrop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Backdrop.js","sources":["../../../../src/components/Backdrop/Backdrop.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type BackdropProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Backdrop = (props: BackdropProps) => {\n const className = cn(\n 'fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] animate-[fade-in_150ms] aria-hidden:hidden',\n props.className\n );\n\n return <div {...props} className={className} />;\n};\n"],"names":["Backdrop","props","className","cn","React"],"mappings":";;;IAKaA,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD;AACpB,MAAMC,SAAS,GAAGC,EAAE,CAChB,iHADgB,EAEhBF,KAAK,CAACC,SAFU,CAApB;AAKA,SAAOE,aAAA,MAAA,oBAASH;AAAOC,IAAAA,SAAS,EAAEA;IAA3B,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"Backdrop.js","sources":["../../../../src/components/Backdrop/Backdrop.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type BackdropProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Backdrop = React.forwardRef<HTMLDivElement, BackdropProps>(function Backdrop(props, ref) {\n const className = cn(\n 'fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] animate-[fade-in_150ms] aria-hidden:hidden',\n props.className\n );\n\n return <div {...props} className={className} ref={ref} />;\n});\n"],"names":["Backdrop","React","props","ref","className","cn"],"mappings":";;;IAKaA,QAAQ,gBAAGC,UAAA,CAAgD,SAASD,QAAT,CAAkBE,KAAlB,EAAyBC,GAAzB;AACpE,MAAMC,SAAS,GAAGC,EAAE,CAChB,iHADgB,EAEhBH,KAAK,CAACE,SAFU,CAApB;AAKA,SAAOH,aAAA,MAAA,oBAASC;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA3C,CAAP;AACH,CAPuB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButton } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { MenuProps } from '../Menu/Menu';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: React.ReactElement<DialogProps>;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: React.ReactElement<HangerProps>;\n /** Menu component associated with the button. */\n menu?: React.ReactElement<MenuProps>;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: React.ReactElement<PopoverProps>;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { appearance, fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance),\n 'rounded px-3',\n {\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButton({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n"],"names":["Button","React","props","ref","appearance","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButton"],"mappings":";;;;;;IAoCaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CACnCE,KADmC,EAEnCC,GAFmC;AAInC,MAAQC,UAAR,GAA6CF,KAA7C,CAAQE,UAAR;AAAA,MAAoBC,KAApB,GAA6CH,KAA7C,CAAoBG,KAApB;AAAA,MAA8BC,UAA9B,iCAA6CJ,KAA7C;;AACA,MAAMK,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACN,UAAD,CAFJ,EAGhB,cAHgB,EAIhB;AACI,qCAAiCF,KAAK,CAACS,QAD3C;AAEI,4CAAwC,CAACT,KAAK,CAACS,QAFnD;AAGI,cAAUN;AAHd,GAJgB,EAShBH,KAAK,CAACK,SATU,CAApB;AAYA,SAAOK,YAAY,cAAMN,UAAN;AAAkB,iBAAa;AAA/B,MAA2CC,SAA3C,EAAsDJ,GAAtD,CAAnB;AACH,CAlBqB;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButton } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { MenuProps } from '../Menu/Menu';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { appearance, fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance),\n 'rounded px-3',\n {\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButton({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n"],"names":["Button","React","props","ref","appearance","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButton"],"mappings":";;;;;;IAoCaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CACnCE,KADmC,EAEnCC,GAFmC;AAInC,MAAQC,UAAR,GAA6CF,KAA7C,CAAQE,UAAR;AAAA,MAAoBC,KAApB,GAA6CH,KAA7C,CAAoBG,KAApB;AAAA,MAA8BC,UAA9B,iCAA6CJ,KAA7C;;AACA,MAAMK,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACN,UAAD,CAFJ,EAGhB,cAHgB,EAIhB;AACI,qCAAiCF,KAAK,CAACS,QAD3C;AAEI,4CAAwC,CAACT,KAAK,CAACS,QAFnD;AAGI,cAAUN;AAHd,GAJgB,EAShBH,KAAK,CAACK,SATU,CAApB;AAYA,SAAOK,YAAY,cAAMN,UAAN;AAAkB,iBAAa;AAA/B,MAA2CC,SAA3C,EAAsDJ,GAAtD,CAAnB;AACH,CAlBqB;;;;"}
@@ -2,10 +2,6 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '.
2
2
  import React__default from 'react';
3
3
  import { Button } from '../../primitives/Button.js';
4
4
  import { Tooltip } from '../Tooltip/Tooltip.js';
5
- import { Hanger } from '../Hanger/Hanger.js';
6
- import { Menu } from '../Menu/Menu.js';
7
- import { Dialog } from '../Dialog/Dialog.js';
8
- import { Popover } from '../Popover/Popover.js';
9
5
 
10
6
  var _excluded = ["dialog", "hanger", "menu", "popover", "tooltip"];
11
7
  var getButtonClasses = function getButtonClasses() {
@@ -52,20 +48,24 @@ var createButton = function createButton(props, className, ref) {
52
48
  ref: ref
53
49
  }));
54
50
 
55
- if (hanger) {
56
- button = React__default.createElement(Hanger, Object.assign({}, hanger.props), React__default.createElement(Hanger.Anchor, null, button), hanger.props.children);
51
+ if (typeof dialog === 'function') {
52
+ button = dialog({
53
+ trigger: button
54
+ });
55
+ } else if (typeof menu === 'function') {
56
+ button = menu({
57
+ trigger: button
58
+ });
59
+ } else if (typeof popover === 'function') {
60
+ button = popover({
61
+ trigger: button
62
+ });
57
63
  }
58
64
 
59
- if (menu) {
60
- button = React__default.createElement(Menu, Object.assign({}, menu.props), React__default.createElement(Menu.Trigger, null, button), menu.props.children);
61
- }
62
-
63
- if (dialog) {
64
- button = React__default.createElement(Dialog, Object.assign({}, dialog.props), React__default.createElement(Dialog.Trigger, null, button), dialog.props.children);
65
- }
66
-
67
- if (popover) {
68
- button = React__default.createElement(Popover, Object.assign({}, popover.props), React__default.createElement(Popover.Trigger, null, button), popover.props.children);
65
+ if (typeof hanger === 'function') {
66
+ button = hanger({
67
+ anchor: button
68
+ });
69
69
  }
70
70
 
71
71
  if (tooltip) {
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\nimport { Hanger } from '../Hanger/Hanger';\nimport { Menu } from '../Menu/Menu';\nimport { Dialog } from '../Dialog/Dialog';\nimport { Popover } from '../Popover/Popover';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid`;\n\n case 'danger':\n return `yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `yt-blue-inverted\n focus:bg-transparent focus:text-blue focus:yt-focus\n active:bg-blue-lightest active:border-blue active:text-blue-dark \n hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light\n hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light\n disabled:hover:yt-blue-inverted`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent\n focus:text-black focus:yt-focus\n active:text-black\n hover:text-grey-darkest\n hover:focus:text-grey-darkest\n disabled:hover:yt-transparent`;\n }\n\n return `yt-transparent border-transparent\n focus:text-blue focus:yt-focus\n active:text-blue-dark\n hover:text-blue-light\n hover:focus:text-blue-light\n disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButton = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { dialog, hanger, menu, popover, tooltip, ...otherProps } = props;\n\n let button = <ButtonPrimitive.Button {...otherProps} className={className} ref={ref} />;\n\n if (hanger) {\n button = (\n <Hanger {...hanger.props}>\n <Hanger.Anchor>{button}</Hanger.Anchor>\n {hanger.props.children}\n </Hanger>\n );\n }\n\n if (menu) {\n button = (\n <Menu {...menu.props}>\n <Menu.Trigger>{button}</Menu.Trigger>\n {menu.props.children}\n </Menu>\n );\n }\n\n if (dialog) {\n button = (\n <Dialog {...dialog.props}>\n <Dialog.Trigger>{button}</Dialog.Trigger>\n {dialog.props.children}\n </Dialog>\n );\n }\n\n if (popover) {\n button = (\n <Popover {...popover.props}>\n <Popover.Trigger>{button}</Popover.Trigger>\n {popover.props.children}\n </Popover>\n );\n }\n\n if (tooltip) {\n button = <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButton","props","className","ref","dialog","hanger","menu","popover","tooltip","otherProps","button","React","ButtonPrimitive","Hanger","Anchor","children","Menu","Trigger","Dialog","Popover","Tooltip","title"],"mappings":";;;;;;;;;;IASaA,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAO,6IAAP;AACH;IAEYC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD,EAAgCC,IAAhC;MAAgCA;AAAAA,IAAAA,OAAO;;;AACvE,UAAQD,KAAR;AACI,SAAK,SAAL;AACI;;AAOJ,SAAK,QAAL;AACI;;AAOJ,SAAK,OAAL;AACI;;AAOJ,SAAK,UAAL;AAAiB;AACb,YAAIC,IAAJ,EAAU;AACN;AAMH;;AAED;AAMH;;AAED;AACI;AA5CR;AAmDH;IAEYC,YAAY,GAAG,SAAfA,YAAe,CACxBC,KADwB,EAExBC,SAFwB,EAGxBC,GAHwB;AAKxB,MAAQC,MAAR,GAAkEH,KAAlE,CAAQG,MAAR;AAAA,MAAgBC,MAAhB,GAAkEJ,KAAlE,CAAgBI,MAAhB;AAAA,MAAwBC,IAAxB,GAAkEL,KAAlE,CAAwBK,IAAxB;AAAA,MAA8BC,OAA9B,GAAkEN,KAAlE,CAA8BM,OAA9B;AAAA,MAAuCC,OAAvC,GAAkEP,KAAlE,CAAuCO,OAAvC;AAAA,MAAmDC,UAAnD,iCAAkER,KAAlE;;AAEA,MAAIS,MAAM,GAAGC,4BAAA,CAACC,MAAD,oBAA4BH;AAAYP,IAAAA,SAAS,EAAEA;AAAWC,IAAAA,GAAG,EAAEA;IAAnE,CAAb;;AAEA,MAAIE,MAAJ,EAAY;AACRK,IAAAA,MAAM,GACFC,4BAAA,CAACE,MAAD,oBAAYR,MAAM,CAACJ,MAAnB,EACIU,4BAAA,CAACE,MAAM,CAACC,MAAR,MAAA,EAAgBJ,MAAhB,CADJ,EAEKL,MAAM,CAACJ,KAAP,CAAac,QAFlB,CADJ;AAMH;;AAED,MAAIT,IAAJ,EAAU;AACNI,IAAAA,MAAM,GACFC,4BAAA,CAACK,IAAD,oBAAUV,IAAI,CAACL,MAAf,EACIU,4BAAA,CAACK,IAAI,CAACC,OAAN,MAAA,EAAeP,MAAf,CADJ,EAEKJ,IAAI,CAACL,KAAL,CAAWc,QAFhB,CADJ;AAMH;;AAED,MAAIX,MAAJ,EAAY;AACRM,IAAAA,MAAM,GACFC,4BAAA,CAACO,MAAD,oBAAYd,MAAM,CAACH,MAAnB,EACIU,4BAAA,CAACO,MAAM,CAACD,OAAR,MAAA,EAAiBP,MAAjB,CADJ,EAEKN,MAAM,CAACH,KAAP,CAAac,QAFlB,CADJ;AAMH;;AAED,MAAIR,OAAJ,EAAa;AACTG,IAAAA,MAAM,GACFC,4BAAA,CAACQ,OAAD,oBAAaZ,OAAO,CAACN,MAArB,EACIU,4BAAA,CAACQ,OAAO,CAACF,OAAT,MAAA,EAAkBP,MAAlB,CADJ,EAEKH,OAAO,CAACN,KAAR,CAAcc,QAFnB,CADJ;AAMH;;AAED,MAAIP,OAAJ,EAAa;AACTE,IAAAA,MAAM,GAAGC,4BAAA,CAACS,OAAD;AAASC,MAAAA,KAAK,EAAEb;KAAhB,EAA0BE,MAA1B,CAAT;AACH;;AAED,SAAOA,MAAP;AACH;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid`;\n\n case 'danger':\n return `yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `yt-blue-inverted\n focus:bg-transparent focus:text-blue focus:yt-focus\n active:bg-blue-lightest active:border-blue active:text-blue-dark \n hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light\n hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light\n disabled:hover:yt-blue-inverted`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent\n focus:text-black focus:yt-focus\n active:text-black\n hover:text-grey-darkest\n hover:focus:text-grey-darkest\n disabled:hover:yt-transparent`;\n }\n\n return `yt-transparent border-transparent\n focus:text-blue focus:yt-focus\n active:text-blue-dark\n hover:text-blue-light\n hover:focus:text-blue-light\n disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButton = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { dialog, hanger, menu, popover, tooltip, ...otherProps } = props;\n\n let button = <ButtonPrimitive.Button {...otherProps} className={className} ref={ref} />;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n if (tooltip) {\n button = <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButton","props","className","ref","dialog","hanger","menu","popover","tooltip","otherProps","button","React","ButtonPrimitive","trigger","anchor","Tooltip","title"],"mappings":";;;;;;IAKaA,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAO,6IAAP;AACH;IAEYC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD,EAAgCC,IAAhC;MAAgCA;AAAAA,IAAAA,OAAO;;;AACvE,UAAQD,KAAR;AACI,SAAK,SAAL;AACI;;AAOJ,SAAK,QAAL;AACI;;AAOJ,SAAK,OAAL;AACI;;AAOJ,SAAK,UAAL;AAAiB;AACb,YAAIC,IAAJ,EAAU;AACN;AAMH;;AAED;AAMH;;AAED;AACI;AA5CR;AAmDH;IAEYC,YAAY,GAAG,SAAfA,YAAe,CACxBC,KADwB,EAExBC,SAFwB,EAGxBC,GAHwB;AAKxB,MAAQC,MAAR,GAAkEH,KAAlE,CAAQG,MAAR;AAAA,MAAgBC,MAAhB,GAAkEJ,KAAlE,CAAgBI,MAAhB;AAAA,MAAwBC,IAAxB,GAAkEL,KAAlE,CAAwBK,IAAxB;AAAA,MAA8BC,OAA9B,GAAkEN,KAAlE,CAA8BM,OAA9B;AAAA,MAAuCC,OAAvC,GAAkEP,KAAlE,CAAuCO,OAAvC;AAAA,MAAmDC,UAAnD,iCAAkER,KAAlE;;AAEA,MAAIS,MAAM,GAAGC,4BAAA,CAACC,MAAD,oBAA4BH;AAAYP,IAAAA,SAAS,EAAEA;AAAWC,IAAAA,GAAG,EAAEA;IAAnE,CAAb;;AAEA,MAAI,OAAOC,MAAP,KAAkB,UAAtB,EAAkC;AAC9BM,IAAAA,MAAM,GAAGN,MAAM,CAAC;AAAES,MAAAA,OAAO,EAAEH;AAAX,KAAD,CAAf;AACH,GAFD,MAEO,IAAI,OAAOJ,IAAP,KAAgB,UAApB,EAAgC;AACnCI,IAAAA,MAAM,GAAGJ,IAAI,CAAC;AAAEO,MAAAA,OAAO,EAAEH;AAAX,KAAD,CAAb;AACH,GAFM,MAEA,IAAI,OAAOH,OAAP,KAAmB,UAAvB,EAAmC;AACtCG,IAAAA,MAAM,GAAGH,OAAO,CAAC;AAAEM,MAAAA,OAAO,EAAEH;AAAX,KAAD,CAAhB;AACH;;AAED,MAAI,OAAOL,MAAP,KAAkB,UAAtB,EAAkC;AAC9BK,IAAAA,MAAM,GAAGL,MAAM,CAAC;AAAES,MAAAA,MAAM,EAAEJ;AAAV,KAAD,CAAf;AACH;;AAED,MAAIF,OAAJ,EAAa;AACTE,IAAAA,MAAM,GAAGC,4BAAA,CAACI,OAAD;AAASC,MAAAA,KAAK,EAAER;KAAhB,EAA0BE,MAA1B,CAAT;AACH;;AAED,SAAOA,MAAP;AACH;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { forwardRef, useState, useEffect, createElement, memo } from 'react';
3
3
  import cn from 'classnames';
4
- import { useLocalization } from '../Provider/Provider.js';
5
4
  import { IconButton } from '../IconButton/IconButton.js';
6
5
  import ReactDayPicker from 'react-day-picker';
6
+ import { useLocalization } from '../Provider/Provider.js';
7
7
 
8
8
  var _excluded = ["onChange", "value"];
9
9
 
@@ -1,8 +1,8 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { forwardRef, useRef, createElement } from 'react';
3
3
  import cn from 'classnames';
4
- import { Root, Anchor, Content } from '@radix-ui/react-popover';
5
4
  import { IconButton } from '../IconButton/IconButton.js';
5
+ import { Root, Anchor, Content } from '@radix-ui/react-popover';
6
6
  import { Input } from '../Input/Input.js';
7
7
  import { ScrollableList } from '../Listbox/ScrollableList.js';
8
8
  import { useCombobox } from './useCombobox.js';
@@ -1,12 +1,12 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { forwardRef, createElement } from 'react';
3
3
  import cn from 'classnames';
4
- import { useLocalization } from '../Provider/Provider.js';
5
- import { Popover } from '../Popover/Popover.js';
6
4
  import { IconButton } from '../IconButton/IconButton.js';
5
+ import { useLocalization } from '../Provider/Provider.js';
7
6
  import { Calendar } from '../Calendar/Calendar.js';
8
7
  import { Input } from '../Input/Input.js';
9
8
  import { useDatepicker } from './useDatepicker.js';
9
+ import { Popover } from '../Popover/Popover.js';
10
10
 
11
11
  var _excluded = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
12
12
  var Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
@@ -3,7 +3,6 @@ import { createContext, useContext } from 'react';
3
3
  /* eslint-disable @typescript-eslint/no-empty-function */
4
4
  var DialogContext = /*#__PURE__*/createContext({
5
5
  closeOnEscape: true,
6
- close: function close() {},
7
6
  draggable: false,
8
7
  drawer: undefined,
9
8
  elements: {
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sources":["../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n closeOnEscape: boolean;\n draggable: boolean;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n close: () => void;\n onClose?: () => void;\n props: {};\n ref: React.Ref<HTMLElement>;\n showCloseButton: boolean;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n closeOnEscape: true,\n close: () => {},\n draggable: false,\n drawer: undefined,\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n showCloseButton: true,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","closeOnEscape","close","draggable","drawer","undefined","elements","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;IAuBaA,aAAa,gBAAGC,aAAA,CAAmC;AAC5DC,EAAAA,aAAa,EAAE,IAD6C;AAE5DC,EAAAA,KAAK,EAAE,mBAFqD;AAG5DC,EAAAA,SAAS,EAAE,KAHiD;AAI5DC,EAAAA,MAAM,EAAEC,SAJoD;AAK5DC,EAAAA,QAAQ,EAAE;AACNF,IAAAA,MAAM,EAAEC,SADF;AAENE,IAAAA,KAAK,EAAEF;AAFD,GALkD;AAS5DG,EAAAA,OAAO,EAAE,qBATmD;AAU5DC,EAAAA,KAAK,EAAE,EAVqD;AAW5DC,EAAAA,GAAG,EAAE,IAXuD;AAY5DC,EAAAA,eAAe,EAAE,IAZ2C;AAa5DC,EAAAA,IAAI,EAAE;AAbsD,CAAnC;IAgBhBC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAOb,UAAA,CAAiBD,aAAjB,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"Context.js","sources":["../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n closeOnEscape: boolean;\n draggable: boolean;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n onClose?: () => void;\n props: {};\n ref: React.Ref<HTMLElement>;\n showCloseButton: boolean;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n closeOnEscape: true,\n draggable: false,\n drawer: undefined,\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n showCloseButton: true,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","closeOnEscape","draggable","drawer","undefined","elements","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;IAsBaA,aAAa,gBAAGC,aAAA,CAAmC;AAC5DC,EAAAA,aAAa,EAAE,IAD6C;AAE5DC,EAAAA,SAAS,EAAE,KAFiD;AAG5DC,EAAAA,MAAM,EAAEC,SAHoD;AAI5DC,EAAAA,QAAQ,EAAE;AACNF,IAAAA,MAAM,EAAEC,SADF;AAENE,IAAAA,KAAK,EAAEF;AAFD,GAJkD;AAQ5DG,EAAAA,OAAO,EAAE,qBARmD;AAS5DC,EAAAA,KAAK,EAAE,EATqD;AAU5DC,EAAAA,GAAG,EAAE,IAVuD;AAW5DC,EAAAA,eAAe,EAAE,IAX2C;AAY5DC,EAAAA,IAAI,EAAE;AAZsD,CAAnC;IAehBC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAOZ,UAAA,CAAiBD,aAAjB,CAAP;AACH;;;;"}
@@ -7,7 +7,7 @@ import { Content, Title, Footer, Close } from './components/Content.js';
7
7
  import { Drawer } from './components/Drawer.js';
8
8
  import { Extra } from './components/Extra.js';
9
9
 
10
- var _excluded = ["children", "closeOnEscape", "draggable", "onClose", "open", "showCloseButton", "size"];
10
+ var _excluded = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
11
11
 
12
12
  var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
13
13
  return useMemo(function () {
@@ -31,14 +31,17 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
31
31
  var initialChildren = props.children,
32
32
  _props$closeOnEscape = props.closeOnEscape,
33
33
  closeOnEscape = _props$closeOnEscape === void 0 ? true : _props$closeOnEscape,
34
+ defaultOpen = props.defaultOpen,
34
35
  _props$draggable = props.draggable,
35
36
  draggable = _props$draggable === void 0 ? false : _props$draggable,
37
+ onChange = props.onChange,
36
38
  onClose = props.onClose,
37
- defaultOpen = props.open,
39
+ open = props.open,
38
40
  _props$showCloseButto = props.showCloseButton,
39
41
  showCloseButton = _props$showCloseButto === void 0 ? true : _props$showCloseButto,
40
42
  _props$size = props.size,
41
43
  size = _props$size === void 0 ? 'sm' : _props$size,
44
+ trigger = props.trigger,
42
45
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
43
46
 
44
47
  var _useSeparatedChildren = useSeparatedChildren(initialChildren),
@@ -46,19 +49,12 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
46
49
  drawer = _useSeparatedChildren[1],
47
50
  extra = _useSeparatedChildren[2];
48
51
 
49
- var _React$useState = useState(defaultOpen),
50
- open = _React$useState[0],
51
- setOpen = _React$useState[1];
52
-
53
- var _React$useState2 = useState(false),
54
- drawerOpen = _React$useState2[0],
55
- setDrawerOpen = _React$useState2[1];
52
+ var _React$useState = useState(false),
53
+ drawerOpen = _React$useState[0],
54
+ setDrawerOpen = _React$useState[1];
56
55
 
57
56
  var context = useMemo(function () {
58
57
  return {
59
- close: function close() {
60
- return setOpen(false);
61
- },
62
58
  closeOnEscape: closeOnEscape,
63
59
  draggable: draggable,
64
60
  drawer: {
@@ -83,10 +79,10 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
83
79
  return createElement(DialogContext.Provider, {
84
80
  value: context
85
81
  }, createElement(Root, {
86
- children: children,
82
+ defaultOpen: defaultOpen,
87
83
  open: open,
88
- onOpenChange: setOpen
89
- }));
84
+ onOpenChange: onChange
85
+ }, trigger && createElement(Trigger, null, trigger), children));
90
86
  });
91
87
  Dialog.Trigger = Trigger;
92
88
  Dialog.Content = Content;