@economic/taco 1.12.1 → 1.12.3
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/components/Button/Button.stories.d.ts +3 -3
- package/dist/components/Button/util.d.ts +2 -1
- package/dist/components/IconButton/IconButton.d.ts +30 -1
- package/dist/components/IconButton/IconButton.stories.d.ts +2 -2
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/esm/components/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/esm/components/AlertDialog/components/Trigger.js +8 -4
- package/dist/esm/components/AlertDialog/components/Trigger.js.map +1 -1
- package/dist/esm/components/Button/Button.js +26 -8
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Button/util.js +22 -16
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Dialog/components/Trigger.js +8 -4
- package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +13 -6
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/HoverCard/HoverCard.js +3 -3
- package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js +22 -4
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Menu/components/Content.js +1 -1
- package/dist/esm/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +8 -4
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/taco.cjs.development.js +108 -46
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +3 -3
@@ -7,7 +7,7 @@ declare const _default: {
|
|
7
7
|
href?: string | undefined;
|
8
8
|
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
9
9
|
} & {
|
10
|
-
appearance?: "
|
10
|
+
appearance?: "primary" | "default" | "danger" | "ghost" | "discrete" | undefined;
|
11
11
|
dialog?: ((props: Partial<import("../..").DialogProps>) => JSX.Element) | undefined;
|
12
12
|
fluid?: boolean | undefined;
|
13
13
|
hanger?: ((props: Partial<React.PropsWithChildren<{
|
@@ -54,11 +54,11 @@ export declare const WithHanger: {
|
|
54
54
|
(args: ButtonProps): JSX.Element;
|
55
55
|
storyName: string;
|
56
56
|
};
|
57
|
-
export declare const
|
57
|
+
export declare const WithAlertDialog: {
|
58
58
|
(args: ButtonProps): JSX.Element;
|
59
59
|
storyName: string;
|
60
60
|
};
|
61
|
-
export declare const
|
61
|
+
export declare const WithDialog: {
|
62
62
|
(args: ButtonProps): JSX.Element;
|
63
63
|
storyName: string;
|
64
64
|
};
|
@@ -2,4 +2,5 @@ import React from 'react';
|
|
2
2
|
import { Appearance } from '../../types';
|
3
3
|
export declare const getButtonClasses: () => string;
|
4
4
|
export declare const getAppearanceClasses: (value: Appearance | undefined, icon?: boolean) => string;
|
5
|
-
export declare const
|
5
|
+
export declare const createButtonWithTooltip: (props: any, className: string, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => JSX.Element;
|
6
|
+
export declare const createButtonWithOverlays: (props: any, buttonBase: JSX.Element) => JSX.Element;
|
@@ -32,6 +32,35 @@ export declare type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'childre
|
|
32
32
|
/** A tooltip to show when hovering over the button */
|
33
33
|
tooltip?: string;
|
34
34
|
};
|
35
|
+
export declare const Base: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.ButtonProps, "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "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" | "href" | "target"> & {
|
36
|
+
/** Appearance will change the style of the button */
|
37
|
+
appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
|
38
|
+
/**
|
39
|
+
* Dialog component associated with the button, clicking the button will open the dialog.
|
40
|
+
* *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
|
41
|
+
* the button should be only to open the associated dialog when clicked.
|
42
|
+
*/
|
43
|
+
dialog?: ((props: Partial<DialogProps>) => JSX.Element) | undefined;
|
44
|
+
/** Hanger component associated with the button. */
|
45
|
+
hanger?: ((props: Partial<HangerProps>) => JSX.Element) | undefined;
|
46
|
+
/** Set which icon should be rendered within button */
|
47
|
+
icon: IconName;
|
48
|
+
/** Menu component associated with the button. */
|
49
|
+
menu?: ((props: Partial<MenuProps>) => JSX.Element) | undefined;
|
50
|
+
/**
|
51
|
+
* Popover component associated with the button, clicking the button will open the popover.
|
52
|
+
* *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
|
53
|
+
* the button should be only to open the associated popover when clicked.
|
54
|
+
*/
|
55
|
+
popover?: ((props: Partial<PopoverProps>) => JSX.Element) | undefined;
|
56
|
+
/**
|
57
|
+
* Set whether the button is rounded.
|
58
|
+
* Default value is `false`
|
59
|
+
*/
|
60
|
+
rounded?: boolean | undefined;
|
61
|
+
/** A tooltip to show when hovering over the button */
|
62
|
+
tooltip?: string | undefined;
|
63
|
+
} & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
35
64
|
export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.ButtonProps, "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "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" | "href" | "target"> & {
|
36
65
|
/** Appearance will change the style of the button */
|
37
66
|
appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
|
@@ -60,4 +89,4 @@ export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrim
|
|
60
89
|
rounded?: boolean | undefined;
|
61
90
|
/** A tooltip to show when hovering over the button */
|
62
91
|
tooltip?: string | undefined;
|
63
|
-
} & React.RefAttributes<HTMLButtonElement>>;
|
92
|
+
} & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
declare const _default: {
|
3
3
|
title: string;
|
4
4
|
component: React.ForwardRefExoticComponent<Pick<import("../../primitives/Button").ButtonProps, "draggable" | "name" | "form" | "className" | "color" | "id" | "lang" | "style" | "target" | "type" | "role" | "tabIndex" | "href" | "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" | "slot" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value"> & {
|
5
|
-
appearance?: "
|
5
|
+
appearance?: "primary" | "default" | "danger" | "ghost" | "discrete" | undefined;
|
6
6
|
dialog?: ((props: Partial<import("../..").DialogProps>) => JSX.Element) | undefined;
|
7
7
|
hanger?: ((props: Partial<React.PropsWithChildren<{
|
8
8
|
anchor?: JSX.Element | undefined;
|
@@ -16,7 +16,7 @@ declare const _default: {
|
|
16
16
|
}>>) => JSX.Element) | undefined;
|
17
17
|
rounded?: boolean | undefined;
|
18
18
|
tooltip?: string | undefined;
|
19
|
-
} & React.RefAttributes<HTMLButtonElement>>;
|
19
|
+
} & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
20
20
|
};
|
21
21
|
export default _default;
|
22
22
|
export declare const Default: () => JSX.Element;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Placement } from '../..';
|
3
|
-
export declare type PopoverTriggerProps = React.HTMLAttributes<
|
3
|
+
export declare type PopoverTriggerProps = React.HTMLAttributes<HTMLElement>;
|
4
4
|
export declare type PopoverContentRenderProps = {
|
5
5
|
close: () => void;
|
6
6
|
};
|
@@ -17,9 +17,9 @@ const AlertDialog = /*#__PURE__*/forwardRef(function AlertDialog(props, ref) {
|
|
17
17
|
...otherProps
|
18
18
|
} = props;
|
19
19
|
const context = useMemo(() => ({
|
20
|
-
ref,
|
21
20
|
draggable,
|
22
21
|
props: otherProps,
|
22
|
+
ref,
|
23
23
|
size,
|
24
24
|
trigger
|
25
25
|
}), [draggable, open, otherProps]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AlertDialog.js","sources":["../../../../src/components/AlertDialog/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { AlertDialogContext } from './Context';\nimport { Trigger, AlertDialogTriggerProps } from './components/Trigger';\nimport {\n Cancel,\n Action,\n Footer,\n AlertDialogCancelProps,\n AlertDialogActionProps,\n AlertDialogFooterProps,\n} from './components/Footer';\nimport { Title, Content, AlertDialogContentProps, AlertDialogTitleProps } from './components/Content';\nimport { DialogSize } from '../Dialog/types';\n\nexport type AlertDialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** Set whether the alert dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Allows dragging the alert dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Called when the alert dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** Size of the alert dialog. This is the recommended way to set a size for alert dialog component. */\n size?: DialogSize;\n /** A trigger to be used for the alert dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nexport type ForwardedAlertDialogWithStatics = React.ForwardRefExoticComponent<\n AlertDialogProps & React.RefAttributes<HTMLElement>\n> & {\n Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<AlertDialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;\n Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const AlertDialog = React.forwardRef(function AlertDialog(props: AlertDialogProps, ref: React.Ref<HTMLElement>) {\n const {\n children: initialChildren,\n defaultOpen,\n draggable = false,\n size = 'dialog',\n onChange,\n open,\n trigger,\n ...otherProps\n } = props;\n\n const context = React.useMemo(\n () => ({\n
|
1
|
+
{"version":3,"file":"AlertDialog.js","sources":["../../../../src/components/AlertDialog/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { AlertDialogContext } from './Context';\nimport { Trigger, AlertDialogTriggerProps } from './components/Trigger';\nimport {\n Cancel,\n Action,\n Footer,\n AlertDialogCancelProps,\n AlertDialogActionProps,\n AlertDialogFooterProps,\n} from './components/Footer';\nimport { Title, Content, AlertDialogContentProps, AlertDialogTitleProps } from './components/Content';\nimport { DialogSize } from '../Dialog/types';\n\nexport type AlertDialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** Set whether the alert dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Allows dragging the alert dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Called when the alert dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** Size of the alert dialog. This is the recommended way to set a size for alert dialog component. */\n size?: DialogSize;\n /** A trigger to be used for the alert dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nexport type ForwardedAlertDialogWithStatics = React.ForwardRefExoticComponent<\n AlertDialogProps & React.RefAttributes<HTMLElement>\n> & {\n Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<AlertDialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;\n Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const AlertDialog = React.forwardRef(function AlertDialog(props: AlertDialogProps, ref: React.Ref<HTMLElement>) {\n const {\n children: initialChildren,\n defaultOpen,\n draggable = false,\n size = 'dialog',\n onChange,\n open,\n trigger,\n ...otherProps\n } = props;\n\n const context = React.useMemo(\n () => ({\n draggable,\n props: otherProps,\n ref,\n size,\n trigger,\n }),\n [draggable, open, otherProps]\n );\n\n return (\n <AlertDialogContext.Provider value={context}>\n <AlertDialogPrimitive.Root {...props} defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {props.children}\n </AlertDialogPrimitive.Root>\n </AlertDialogContext.Provider>\n );\n}) as ForwardedAlertDialogWithStatics;\n\nAlertDialog.Trigger = Trigger;\nAlertDialog.Content = Content;\nAlertDialog.Title = Title;\nAlertDialog.Cancel = Cancel;\nAlertDialog.Action = Action;\nAlertDialog.Footer = Footer;\n"],"names":["AlertDialog","React","props","ref","children","initialChildren","defaultOpen","draggable","size","onChange","open","trigger","otherProps","context","AlertDialogContext","Provider","value","AlertDialogPrimitive","onOpenChange","Trigger","Content","Title","Cancel","Action","Footer"],"mappings":";;;;;;;MA0CaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,CAAqBE,KAArB,EAA8CC,GAA9C;EACxC,MAAM;IACFC,QAAQ,EAAEC,eADR;IAEFC,WAFE;IAGFC,SAAS,GAAG,KAHV;IAIFC,IAAI,GAAG,QAJL;IAKFC,QALE;IAMFC,IANE;IAOFC,OAPE;IAQF,GAAGC;MACHV,KATJ;EAWA,MAAMW,OAAO,GAAGZ,OAAA,CACZ,OAAO;IACHM,SADG;IAEHL,KAAK,EAAEU,UAFJ;IAGHT,GAHG;IAIHK,IAJG;IAKHG;GALJ,CADY,EAQZ,CAACJ,SAAD,EAAYG,IAAZ,EAAkBE,UAAlB,CARY,CAAhB;EAWA,oBACIX,aAAA,CAACa,kBAAkB,CAACC,QAApB;IAA6BC,KAAK,EAAEH;GAApC,eACIZ,aAAA,CAACgB,IAAD,oBAA+Bf;IAAOI,WAAW,EAAEA;IAAaI,IAAI,EAAEA;IAAMQ,YAAY,EAAET;IAA1F,EACKE,OAAO,iBAAIV,aAAA,CAACkB,OAAD,MAAA,EAAUR,OAAV,CADhB,EAEKT,KAAK,CAACE,QAFX,CADJ,CADJ;AAQH,CA/B0B;AAiC3BJ,WAAW,CAACmB,OAAZ,GAAsBA,OAAtB;AACAnB,WAAW,CAACoB,OAAZ,GAAsBA,OAAtB;AACApB,WAAW,CAACqB,KAAZ,GAAoBA,KAApB;AACArB,WAAW,CAACsB,MAAZ,GAAqBA,MAArB;AACAtB,WAAW,CAACuB,MAAZ,GAAqBA,MAArB;AACAvB,WAAW,CAACwB,MAAZ,GAAqBA,MAArB;;;;"}
|
@@ -3,10 +3,14 @@ import { Trigger as Trigger$1 } from '@radix-ui/react-alert-dialog';
|
|
3
3
|
import { useCurrentAlertDialog } from '../Context.js';
|
4
4
|
import { mergeRefs } from '../../../utils/mergeRefs.js';
|
5
5
|
|
6
|
-
const Trigger = /*#__PURE__*/forwardRef(function AlertDialogTrigger(props,
|
7
|
-
const
|
8
|
-
|
9
|
-
|
6
|
+
const Trigger = /*#__PURE__*/forwardRef(function AlertDialogTrigger(props, externalRef) {
|
7
|
+
const {
|
8
|
+
ref: parentRef,
|
9
|
+
props: parentProps
|
10
|
+
} = useCurrentAlertDialog();
|
11
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
12
|
+
return /*#__PURE__*/createElement(Trigger$1, Object.assign({}, parentProps, props, {
|
13
|
+
ref: refCallback,
|
10
14
|
asChild: true
|
11
15
|
}));
|
12
16
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Trigger.js","sources":["../../../../../src/components/AlertDialog/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { useCurrentAlertDialog } from '../Context';\nimport { mergeRefs } from '../../../utils/mergeRefs';\n\nexport type AlertDialogTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\nexport const Trigger = React.forwardRef(function AlertDialogTrigger(\n props: AlertDialogTriggerProps,\n
|
1
|
+
{"version":3,"file":"Trigger.js","sources":["../../../../../src/components/AlertDialog/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { useCurrentAlertDialog } from '../Context';\nimport { mergeRefs } from '../../../utils/mergeRefs';\n\nexport type AlertDialogTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Trigger = React.forwardRef(function AlertDialogTrigger(\n props: AlertDialogTriggerProps,\n externalRef: React.Ref<HTMLButtonElement>\n) {\n const { ref: parentRef, props: parentProps } = useCurrentAlertDialog();\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n return <AlertDialogPrimitive.Trigger {...parentProps} {...props} ref={refCallback} asChild />;\n});\n"],"names":["Trigger","React","AlertDialogTrigger","props","externalRef","ref","parentRef","parentProps","useCurrentAlertDialog","refCallback","mergeRefs","AlertDialogPrimitive","asChild"],"mappings":";;;;;MAOaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,kBAAT,CACpCC,KADoC,EAEpCC,WAFoC;EAIpC,MAAM;IAAEC,GAAG,EAAEC,SAAP;IAAkBH,KAAK,EAAEI;MAAgBC,qBAAqB,EAApE;EACA,MAAMC,WAAW,GAAGC,SAAS,CAAC,CAACJ,SAAD,EAAYF,WAAZ,CAAD,CAA7B;EAEA,oBAAOH,aAAA,CAACU,SAAD,oBAAkCJ,aAAiBJ;IAAOE,GAAG,EAAEI;IAAaG,OAAO;IAAnF,CAAP;AACH,CARsB;;;;"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { Icon } from '../Icon/Icon.js';
|
4
|
-
import { getButtonClasses, getAppearanceClasses,
|
4
|
+
import { createButtonWithOverlays, getButtonClasses, getAppearanceClasses, createButtonWithTooltip } from './util.js';
|
5
5
|
|
6
|
-
const
|
6
|
+
const Base = /*#__PURE__*/forwardRef(function ButtonBase(props, ref) {
|
7
7
|
const {
|
8
8
|
fluid,
|
9
9
|
...otherProps
|
@@ -13,9 +13,21 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
13
13
|
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
14
14
|
'w-full': fluid
|
15
15
|
}, props.className);
|
16
|
-
|
16
|
+
return createButtonWithTooltip({ ...otherProps,
|
17
|
+
'data-taco': 'button'
|
18
|
+
}, className, ref);
|
19
|
+
});
|
20
|
+
const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
21
|
+
const {
|
22
|
+
dialog,
|
23
|
+
hanger,
|
24
|
+
menu,
|
25
|
+
popover,
|
26
|
+
...buttonProps
|
27
|
+
} = props;
|
28
|
+
let children = buttonProps.children; // add a chevron icon to menu buttons
|
17
29
|
|
18
|
-
if (typeof
|
30
|
+
if (typeof menu === 'function') {
|
19
31
|
children = Array.isArray(children) ? [...children, /*#__PURE__*/createElement(Icon, {
|
20
32
|
key: "chevron-down",
|
21
33
|
name: "chevron-down"
|
@@ -25,10 +37,16 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
25
37
|
})];
|
26
38
|
}
|
27
39
|
|
28
|
-
|
29
|
-
children,
|
30
|
-
|
31
|
-
}
|
40
|
+
const button = /*#__PURE__*/createElement(Base, Object.assign({}, buttonProps, {
|
41
|
+
children: children,
|
42
|
+
ref: ref
|
43
|
+
}));
|
44
|
+
return createButtonWithOverlays({
|
45
|
+
dialog,
|
46
|
+
hanger,
|
47
|
+
menu,
|
48
|
+
popover
|
49
|
+
}, button);
|
32
50
|
});
|
33
51
|
|
34
52
|
export { Button };
|
@@ -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,
|
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, createButtonWithTooltip, createButtonWithOverlays } 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';\nimport { Icon } from '../Icon/Icon';\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\nconst Base = React.forwardRef(function ButtonBase(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(otherProps.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 createButtonWithTooltip({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, hanger, menu, popover, ...buttonProps } = props;\n\n let children = buttonProps.children;\n\n // add a chevron icon to menu buttons\n if (typeof menu === 'function') {\n children = Array.isArray(children)\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\n }\n\n const button = <Base {...buttonProps} children={children} ref={ref} />;\n\n return createButtonWithOverlays({ dialog, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","ButtonBase","props","ref","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","createButtonWithTooltip","Button","dialog","hanger","menu","popover","buttonProps","children","Array","isArray","Icon","key","name","button","createButtonWithOverlays"],"mappings":";;;;;AAqCA,MAAMA,IAAI,gBAAGC,UAAA,CAAiB,SAASC,UAAT,CAAoBC,KAApB,EAAwCC,GAAxC;EAC1B,MAAM;IAAEC,KAAF;IAAS,GAAGC;MAAeH,KAAjC;EACA,MAAMI,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACJ,UAAU,CAACK,UAAZ,CAFJ,EAGhB,cAHgB,EAIhB;IACI,iCAAiCR,KAAK,CAACS,QAD3C;IAEI,wCAAwC,CAACT,KAAK,CAACS,QAFnD;IAGI,UAAUP;GAPE,EAShBF,KAAK,CAACI,SATU,CAApB;EAYA,OAAOM,uBAAuB,CAAC,EAAE,GAAGP,UAAL;IAAiB,aAAa;GAA/B,EAA2CC,SAA3C,EAAsDH,GAAtD,CAA9B;AACH,CAfY,CAAb;MAiBaU,MAAM,gBAAGb,UAAA,CAAiB,SAASa,MAAT,CACnCX,KADmC,EAEnCC,GAFmC;EAInC,MAAM;IAAEW,MAAF;IAAUC,MAAV;IAAkBC,IAAlB;IAAwBC,OAAxB;IAAiC,GAAGC;MAAgBhB,KAA1D;EAEA,IAAIiB,QAAQ,GAAGD,WAAW,CAACC,QAA3B;;EAGA,IAAI,OAAOH,IAAP,KAAgB,UAApB,EAAgC;IAC5BG,QAAQ,GAAGC,KAAK,CAACC,OAAN,CAAcF,QAAd,IACL,CAAC,GAAGA,QAAJ,eAAcnB,aAAA,CAACsB,IAAD;MAAMC,GAAG,EAAC;MAAeC,IAAI,EAAC;KAA9B,CAAd,CADK,GAEL,CAACL,QAAD,eAAWnB,aAAA,CAACsB,IAAD;MAAMC,GAAG,EAAC;MAAeC,IAAI,EAAC;KAA9B,CAAX,CAFN;;;EAKJ,MAAMC,MAAM,gBAAGzB,aAAA,CAACD,IAAD,oBAAUmB;IAAaC,QAAQ,EAAEA;IAAUhB,GAAG,EAAEA;IAAhD,CAAf;EAEA,OAAOuB,wBAAwB,CAAC;IAAEZ,MAAF;IAAUC,MAAV;IAAkBC,IAAlB;IAAwBC;GAAzB,EAAoCQ,MAApC,CAA/B;AACH,CAlBqB;;;;"}
|
@@ -29,28 +29,40 @@ const getAppearanceClasses = (value, icon = false) => {
|
|
29
29
|
return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;
|
30
30
|
}
|
31
31
|
};
|
32
|
-
const
|
32
|
+
const createButtonWithTooltip = (props, className, ref) => {
|
33
33
|
const {
|
34
|
-
dialog,
|
35
|
-
hanger,
|
36
|
-
menu,
|
37
|
-
popover,
|
38
34
|
tooltip,
|
39
|
-
...
|
35
|
+
...buttonProps
|
40
36
|
} = props;
|
41
|
-
|
37
|
+
const button = /*#__PURE__*/React__default.createElement(Button, Object.assign({}, buttonProps, {
|
42
38
|
className: className,
|
43
39
|
ref: ref
|
44
40
|
}));
|
45
41
|
|
42
|
+
if (tooltip) {
|
43
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
44
|
+
title: tooltip
|
45
|
+
}, button);
|
46
|
+
}
|
47
|
+
|
48
|
+
return button;
|
49
|
+
};
|
50
|
+
const createButtonWithOverlays = (props, buttonBase) => {
|
51
|
+
const {
|
52
|
+
dialog,
|
53
|
+
hanger,
|
54
|
+
menu,
|
55
|
+
popover
|
56
|
+
} = props;
|
57
|
+
let button = buttonBase;
|
58
|
+
|
46
59
|
if (typeof dialog === 'function') {
|
47
60
|
button = dialog({
|
48
61
|
trigger: button
|
49
62
|
});
|
50
63
|
} else if (typeof menu === 'function') {
|
51
64
|
button = menu({
|
52
|
-
trigger: button
|
53
|
-
appearance: otherProps.appearance
|
65
|
+
trigger: button
|
54
66
|
});
|
55
67
|
} else if (typeof popover === 'function') {
|
56
68
|
button = popover({
|
@@ -64,14 +76,8 @@ const createButton = (props, className, ref) => {
|
|
64
76
|
});
|
65
77
|
}
|
66
78
|
|
67
|
-
if (tooltip) {
|
68
|
-
button = /*#__PURE__*/React__default.createElement(Tooltip, {
|
69
|
-
title: tooltip
|
70
|
-
}, button);
|
71
|
-
}
|
72
|
-
|
73
79
|
return button;
|
74
80
|
};
|
75
81
|
|
76
|
-
export {
|
82
|
+
export { createButtonWithOverlays, createButtonWithTooltip, getAppearanceClasses, getButtonClasses };
|
77
83
|
//# sourceMappingURL=util.js.map
|
@@ -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';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue`;\n\n case 'danger':\n return `yt-red-solid focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT)] text-blue focus:bg-transparent focus:text-blue active:bg-blue-lightest focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-dark hover:bg-blue-lightest hover:shadow-[inset_0_0_0_1px_theme(colors.blue.light)] hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.light),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-light`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black `;\n }\n\n return `yt-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const
|
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)] gap-1 h-max leading-5 inline-flex items-center justify-center';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue`;\n\n case 'danger':\n return `yt-red-solid focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT)] text-blue focus:bg-transparent focus:text-blue active:bg-blue-lightest focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-dark hover:bg-blue-lightest hover:shadow-[inset_0_0_0_1px_theme(colors.blue.light)] hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.light),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-light`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black `;\n }\n\n return `yt-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, hanger, menu, popover } = props;\n let button = buttonBase;\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 return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays","buttonBase","dialog","hanger","menu","popover","trigger","anchor"],"mappings":";;;;MAKaA,gBAAgB,GAAG;EAC5B,OAAO,iHAAP;AACH;MAEYC,oBAAoB,GAAG,CAACC,KAAD,EAAgCC,IAAI,GAAG,KAAvC;EAChC,QAAQD,KAAR;IACI,KAAK,SAAL;MACI,4RAAA;;IAEJ,KAAK,QAAL;MACI,2NAAA;;IAEJ,KAAK,OAAL;MACI,sfAAA;;IAEJ,KAAK,UAAL;MAAiB;QACb,IAAIC,IAAJ,EAAU;UACN,wLAAA;;;QAGJ,4JAAA;;;IAGJ;MACI,0NAAA;;AAEX;MAEYC,uBAAuB,GAAG,CACnCC,KADmC,EAEnCC,SAFmC,EAGnCC,GAHmC;EAKnC,MAAM;IAAEC,OAAF;IAAW,GAAGC;MAAgBJ,KAApC;EACA,MAAMK,MAAM,gBAAGC,4BAAA,CAACC,MAAD,oBAA4BH;IAAaH,SAAS,EAAEA;IAAWC,GAAG,EAAEA;IAApE,CAAf;;EAEA,IAAIC,OAAJ,EAAa;IACT,oBAAOG,4BAAA,CAACE,OAAD;MAASC,KAAK,EAAEN;KAAhB,EAA0BE,MAA1B,CAAP;;;EAGJ,OAAOA,MAAP;AACH;MAEYK,wBAAwB,GAAG,CAACV,KAAD,EAAaW,UAAb;EACpC,MAAM;IAAEC,MAAF;IAAUC,MAAV;IAAkBC,IAAlB;IAAwBC;MAAYf,KAA1C;EACA,IAAIK,MAAM,GAAGM,UAAb;;EAEA,IAAI,OAAOC,MAAP,KAAkB,UAAtB,EAAkC;IAC9BP,MAAM,GAAGO,MAAM,CAAC;MAAEI,OAAO,EAAEX;KAAZ,CAAf;GADJ,MAEO,IAAI,OAAOS,IAAP,KAAgB,UAApB,EAAgC;IACnCT,MAAM,GAAGS,IAAI,CAAC;MAAEE,OAAO,EAAEX;KAAZ,CAAb;GADG,MAEA,IAAI,OAAOU,OAAP,KAAmB,UAAvB,EAAmC;IACtCV,MAAM,GAAGU,OAAO,CAAC;MAAEC,OAAO,EAAEX;KAAZ,CAAhB;;;EAGJ,IAAI,OAAOQ,MAAP,KAAkB,UAAtB,EAAkC;IAC9BR,MAAM,GAAGQ,MAAM,CAAC;MAAEI,MAAM,EAAEZ;KAAX,CAAf;;;EAGJ,OAAOA,MAAP;AACH;;;;"}
|
@@ -3,10 +3,14 @@ import { mergeRefs } from '../../../utils/mergeRefs.js';
|
|
3
3
|
import { Trigger as Trigger$1 } from '@radix-ui/react-dialog';
|
4
4
|
import { useCurrentDialog } from '../Context.js';
|
5
5
|
|
6
|
-
const Trigger = /*#__PURE__*/forwardRef(function DialogTrigger(props,
|
7
|
-
const
|
8
|
-
|
9
|
-
|
6
|
+
const Trigger = /*#__PURE__*/forwardRef(function DialogTrigger(props, externalRef) {
|
7
|
+
const {
|
8
|
+
ref: parentRef,
|
9
|
+
props: parentProps
|
10
|
+
} = useCurrentDialog();
|
11
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
12
|
+
return /*#__PURE__*/createElement(Trigger$1, Object.assign({}, parentProps, props, {
|
13
|
+
ref: refCallback,
|
10
14
|
asChild: true
|
11
15
|
}));
|
12
16
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Dialog/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useCurrentDialog } from '../Context';\nimport { mergeRefs } from '../../../utils/mergeRefs';\n\nexport type DialogTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Trigger = React.forwardRef(function DialogTrigger(props: DialogTriggerProps
|
1
|
+
{"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Dialog/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useCurrentDialog } from '../Context';\nimport { mergeRefs } from '../../../utils/mergeRefs';\n\nexport type DialogTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Trigger = React.forwardRef(function DialogTrigger(\n props: DialogTriggerProps,\n externalRef: React.Ref<HTMLButtonElement>\n) {\n const { ref: parentRef, props: parentProps } = useCurrentDialog();\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n return <DialogPrimitive.Trigger {...parentProps} {...props} ref={refCallback} asChild />;\n});\n"],"names":["Trigger","React","DialogTrigger","props","externalRef","ref","parentRef","parentProps","useCurrentDialog","refCallback","mergeRefs","DialogPrimitive","asChild"],"mappings":";;;;;MAOaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,aAAT,CACpCC,KADoC,EAEpCC,WAFoC;EAIpC,MAAM;IAAEC,GAAG,EAAEC,SAAP;IAAkBH,KAAK,EAAEI;MAAgBC,gBAAgB,EAA/D;EACA,MAAMC,WAAW,GAAGC,SAAS,CAAC,CAACJ,SAAD,EAAYF,WAAZ,CAAD,CAA7B;EAEA,oBAAOH,aAAA,CAACU,SAAD,oBAA6BJ,aAAiBJ;IAAOE,GAAG,EAAEI;IAAaG,OAAO;IAA9E,CAAP;AACH,CARsB;;;;"}
|
@@ -7,13 +7,18 @@ import { Root, Anchor as Anchor$1, Close } from '@radix-ui/react-popover';
|
|
7
7
|
import { UnstyledContent, UnstyledArrow } from '../Popover/Primitives.js';
|
8
8
|
|
9
9
|
const HangerContext = /*#__PURE__*/createContext({
|
10
|
+
onClose: undefined,
|
10
11
|
props: {},
|
11
12
|
ref: null
|
12
13
|
});
|
13
|
-
const Anchor = /*#__PURE__*/forwardRef(function HangerAnchor(props,
|
14
|
+
const Anchor = /*#__PURE__*/forwardRef(function HangerAnchor(props, externalRef) {
|
14
15
|
var _props$children;
|
15
16
|
|
16
|
-
const
|
17
|
+
const {
|
18
|
+
ref: parentRef,
|
19
|
+
props: parentProps
|
20
|
+
} = useContext(HangerContext);
|
21
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
17
22
|
let children = props.children;
|
18
23
|
|
19
24
|
if ( /*#__PURE__*/isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
@@ -21,9 +26,9 @@ const Anchor = /*#__PURE__*/forwardRef(function HangerAnchor(props, ref) {
|
|
21
26
|
children = /*#__PURE__*/createElement("span", null, props.children);
|
22
27
|
}
|
23
28
|
|
24
|
-
return /*#__PURE__*/createElement(Anchor$1, Object.assign({},
|
29
|
+
return /*#__PURE__*/createElement(Anchor$1, Object.assign({}, parentProps, props, {
|
25
30
|
children: children,
|
26
|
-
ref:
|
31
|
+
ref: refCallback,
|
27
32
|
asChild: true
|
28
33
|
}));
|
29
34
|
});
|
@@ -60,7 +65,7 @@ const Content = /*#__PURE__*/forwardRef(function HangerContent(props, ref) {
|
|
60
65
|
"aria-label": texts.hanger.close,
|
61
66
|
className: "absolute top-0 right-0 ml-2 mr-2 mt-2 text-white",
|
62
67
|
icon: "close",
|
63
|
-
onClick: context.
|
68
|
+
onClick: context.onClose
|
64
69
|
})));
|
65
70
|
});
|
66
71
|
const Hanger = /*#__PURE__*/forwardRef(function Hanger(props, ref) {
|
@@ -68,12 +73,14 @@ const Hanger = /*#__PURE__*/forwardRef(function Hanger(props, ref) {
|
|
68
73
|
anchor,
|
69
74
|
children,
|
70
75
|
defaultOpen = true,
|
76
|
+
onClose,
|
71
77
|
...otherProps
|
72
78
|
} = props;
|
73
79
|
const context = useMemo(() => ({
|
80
|
+
onClose,
|
74
81
|
props: otherProps,
|
75
82
|
ref
|
76
|
-
}), [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
83
|
+
}), [onClose, otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
77
84
|
|
78
85
|
const [open, setOpen] = useState(false);
|
79
86
|
useEffect(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Hanger.js","sources":["../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Provider';\nimport './Hanger.css';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n props: any;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps,
|
1
|
+
{"version":3,"file":"Hanger.js","sources":["../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Provider';\nimport './Hanger.css';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: any;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return <PopoverPrimitive.Anchor {...parentProps} {...props} children={children} ref={refCallback} asChild />;\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent max-w-sm',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <UnstyledContent\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n placement={props.placement}\n ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-blue\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute top-0 right-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </UnstyledContent>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["HangerContext","React","onClose","undefined","props","ref","Anchor","HangerAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","type","console","warn","name","PopoverPrimitive","asChild","Title","DialogTitle","className","cn","Content","HangerContent","context","texts","useLocalization","handleInteractOutside","event","preventDefault","UnstyledContent","onInteractOutside","placement","UnstyledArrow","IconButton","appearance","hanger","close","icon","onClick","Hanger","anchor","defaultOpen","otherProps","open","setOpen","Provider","value","key","String"],"mappings":";;;;;;;;AAgBA,MAAMA,aAAa,gBAAGC,aAAA,CAAwC;EAC1DC,OAAO,EAAEC,SADiD;EAE1DC,KAAK,EAAE,EAFmD;EAG1DC,GAAG,EAAE;AAHqD,CAAxC,CAAtB;AAYA,MAAMC,MAAM,gBAAGL,UAAA,CAAiB,SAASM,YAAT,CAAsBH,KAAtB,EAAgDI,WAAhD;;;EAC5B,MAAM;IAAEH,GAAG,EAAEI,SAAP;IAAkBL,KAAK,EAAEM;MAAgBT,UAAA,CAAiBD,aAAjB,CAA/C;EACA,MAAMW,WAAW,GAAGC,SAAS,CAAC,CAACH,SAAD,EAAYD,WAAZ,CAAD,CAA7B;EAEA,IAAIK,QAAQ,GAAGT,KAAK,CAACS,QAArB;;EAEA,kBAAIZ,cAAA,CAAqBG,KAAK,CAACS,QAA3B,KAAwC,2BAAOT,KAAK,CAACS,QAAb,oDAAO,gBAAgBC,IAAvB,MAAgC,UAA5E,EAAwF;IACpFC,OAAO,CAACC,IAAR,mHACsHZ,KAAK,CAACS,QAAN,CAAeC,IAAf,CAAoBG,kDAAkDb,KAAK,CAACS,QAAN,CAAeC,IAAf,CAAoBG,sFADhN;IAGAJ,QAAQ,gBAAGZ,aAAA,OAAA,MAAA,EAAOG,KAAK,CAACS,QAAb,CAAX;;;EAGJ,oBAAOZ,aAAA,CAACiB,QAAD,oBAA6BR,aAAiBN;IAAOS,QAAQ,EAAEA;IAAUR,GAAG,EAAEM;IAAaQ,OAAO;IAAlG,CAAP;AACH,CAdc,CAAf;MAiBaC,KAAK,gBAAGnB,UAAA,CAAiB,SAASoB,WAAT,CAAqBjB,KAArB,EAA8CC,GAA9C;EAClC,MAAMiB,SAAS,GAAGC,EAAE,CAAC,sCAAD,EAAyCnB,KAAK,CAACkB,SAA/C,CAApB;EACA,oBAAOrB,aAAA,OAAA,oBAAUG;IAAOkB,SAAS,EAAEA;IAAWjB,GAAG,EAAEA;IAA5C,CAAP;AACH,CAHoB;AAUrB,MAAMmB,OAAO,gBAAGvB,UAAA,CAAiB,SAASwB,aAAT,CAAuBrB,KAAvB,EAAkDC,GAAlD;EAC7B,MAAMqB,OAAO,GAAGzB,UAAA,CAAiBD,aAAjB,CAAhB;EACA,MAAM;IAAE2B;MAAUC,eAAe,EAAjC;EACA,MAAMN,SAAS,GAAGC,EAAE,CAChB,2GADgB,EAEhBnB,KAAK,CAACkB,SAFU,CAApB;;EAIA,MAAMO,qBAAqB,GAAIC,KAAD;IAC1BA,KAAK,CAACC,cAAN;GADJ;;EAIA,oBACI9B,aAAA,CAAC+B,eAAD;IACIV,SAAS,EAAEA;iBACD;IACVW,iBAAiB,EAAEJ;IACnBK,SAAS,EAAE9B,KAAK,CAAC8B;IACjB7B,GAAG,EAAEA;GALT,EAMKD,KAAK,CAACS,QANX,eAOIZ,aAAA,CAACkC,aAAD;IAAeb,SAAS,EAAC;GAAzB,CAPJ,eAQIrB,aAAA,CAACiB,KAAD;IAAwBC,OAAO;GAA/B,eACIlB,aAAA,CAACmC,UAAD;IACIC,UAAU,EAAC;kBACCV,KAAK,CAACW,MAAN,CAAaC;IACzBjB,SAAS,EAAC;IACVkB,IAAI,EAAC;IACLC,OAAO,EAAEf,OAAO,CAACxB;GALrB,CADJ,CARJ,CADJ;AAoBH,CA/Be,CAAhB;MAmDawC,MAAM,gBAAGzC,UAAA,CAA2C,SAASyC,MAAT,CAAgBtC,KAAhB,EAAuBC,GAAvB;EAC7D,MAAM;IAAEsC,MAAF;IAAU9B,QAAV;IAAoB+B,WAAW,GAAG,IAAlC;IAAwC1C,OAAxC;IAAiD,GAAG2C;MAAezC,KAAzE;EACA,MAAMsB,OAAO,GAAGzB,OAAA,CAAc,OAAO;IAAEC,OAAF;IAAWE,KAAK,EAAEyC,UAAlB;IAA8BxC;GAArC,CAAd,EAA2D,CAACH,OAAD,EAAU2C,UAAV,CAA3D,CAAhB;;EAGA,MAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB9C,QAAA,CAAe,KAAf,CAAxB;EACAA,SAAA,CAAgB;IACZ,IAAI2C,WAAJ,EAAiB;MACbG,OAAO,CAACH,WAAD,CAAP;;GAFR,EAIG,EAJH;EAMA,oBACI3C,aAAA,CAACD,aAAa,CAACgD,QAAf;IAAwBC,KAAK,EAAEvB;GAA/B,eACIzB,aAAA,CAACiB,IAAD;IAAuBgC,GAAG,EAAEC,MAAM,CAACL,IAAD;IAAQF,WAAW,EAAEE;GAAvD,EACKH,MAAM,iBAAI1C,aAAA,CAACK,MAAD,MAAA,EAASqC,MAAT,CADf,EAEK9B,QAFL,CADJ,CADJ;AAQH,CApBqB;AAqBtB6B,MAAM,CAACpC,MAAP,GAAgBA,MAAhB;AACAoC,MAAM,CAAClB,OAAP,GAAiBA,OAAjB;AACAkB,MAAM,CAACtB,KAAP,GAAeA,KAAf;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createElement, forwardRef } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { Root, Trigger as Trigger$1 } from '@radix-ui/react-hover-card';
|
3
|
+
import { Root, Trigger as Trigger$1, Portal } from '@radix-ui/react-hover-card';
|
4
4
|
import { UnstyledContent, UnstyledArrow } from './Primitives.js';
|
5
5
|
|
6
6
|
const Trigger = /*#__PURE__*/forwardRef(function HoverCardTrigger(props, ref) {
|
@@ -15,13 +15,13 @@ const Content = /*#__PURE__*/forwardRef(function HoverCardContent(externalProps,
|
|
15
15
|
...props
|
16
16
|
} = externalProps;
|
17
17
|
const className = cn('bg-white focus:border-blue-light rounded p-3 yt-shadow min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);
|
18
|
-
return /*#__PURE__*/createElement(UnstyledContent, Object.assign({}, props, {
|
18
|
+
return /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(UnstyledContent, Object.assign({}, props, {
|
19
19
|
className: className,
|
20
20
|
placement: placement,
|
21
21
|
ref: ref
|
22
22
|
}), props.children, /*#__PURE__*/createElement(UnstyledArrow, {
|
23
23
|
className: "text-white"
|
24
|
-
}));
|
24
|
+
})));
|
25
25
|
});
|
26
26
|
const HoverCard = props => {
|
27
27
|
return /*#__PURE__*/createElement(Root, Object.assign({}, props, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HoverCard.js","sources":["../../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\n\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement>;\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n return <HoverCardPrimitive.Trigger {...props} asChild ref={ref} />;\n});\n\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(externalProps: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement, ...props } = externalProps;\n const className = cn(\n 'bg-white focus:border-blue-light rounded p-3 yt-shadow min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]',\n props.className\n );\n\n return (\n <UnstyledContent {...props} className={className} placement={placement} ref={ref}>\n
|
1
|
+
{"version":3,"file":"HoverCard.js","sources":["../../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\n\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement>;\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n return <HoverCardPrimitive.Trigger {...props} asChild ref={ref} />;\n});\n\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(externalProps: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement, ...props } = externalProps;\n const className = cn(\n 'bg-white focus:border-blue-light rounded p-3 yt-shadow min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]',\n props.className\n );\n\n return (\n <HoverCardPrimitive.Portal>\n <UnstyledContent {...props} className={className} placement={placement} ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-white\" />\n </UnstyledContent>\n </HoverCardPrimitive.Portal>\n );\n});\n\nexport type HoverCardProps = React.PropsWithChildren<{}>;\n\nexport const HoverCard = (props: HoverCardProps) => {\n return <HoverCardPrimitive.Root {...props} openDelay={300} />;\n};\nHoverCard.Trigger = Trigger;\nHoverCard.Content = Content;\n"],"names":["Trigger","React","HoverCardTrigger","props","ref","HoverCardPrimitive","asChild","Content","HoverCardContent","externalProps","placement","className","cn","UnstyledContent","children","UnstyledArrow","HoverCard","openDelay"],"mappings":";;;;;AAOA,MAAMA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,gBAAT,CAA0BC,KAA1B,EAAwDC,GAAxD;EAC7B,oBAAOH,aAAA,CAACI,SAAD,oBAAgCF;IAAOG,OAAO;IAACF,GAAG,EAAEA;IAApD,CAAP;AACH,CAFe,CAAhB;AAQA,MAAMG,OAAO,gBAAGN,UAAA,CAAiB,SAASO,gBAAT,CAA0BC,aAA1B,EAAgEL,GAAhE;EAC7B,MAAM;IAAEM,SAAF;IAAa,GAAGP;MAAUM,aAAhC;EACA,MAAME,SAAS,GAAGC,EAAE,CAChB,4GADgB,EAEhBT,KAAK,CAACQ,SAFU,CAApB;EAKA,oBACIV,aAAA,CAACI,MAAD,MAAA,eACIJ,aAAA,CAACY,eAAD,oBAAqBV;IAAOQ,SAAS,EAAEA;IAAWD,SAAS,EAAEA;IAAWN,GAAG,EAAEA;IAA7E,EACKD,KAAK,CAACW,QADX,eAEIb,aAAA,CAACc,aAAD;IAAeJ,SAAS,EAAC;GAAzB,CAFJ,CADJ,CADJ;AAQH,CAfe,CAAhB;MAmBaK,SAAS,GAAIb,KAAD;EACrB,oBAAOF,aAAA,CAACI,IAAD,oBAA6BF;IAAOc,SAAS,EAAE;IAA/C,CAAP;AACH;AACDD,SAAS,CAAChB,OAAV,GAAoBA,OAApB;AACAgB,SAAS,CAACT,OAAV,GAAoBA,OAApB;;;;"}
|