@economic/taco 0.0.8-alpha.0 → 0.0.9-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.
@@ -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;
|
@@ -16,6 +16,8 @@ export declare type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'childre
|
|
16
16
|
icon: IconName;
|
17
17
|
/** Hanger component associated with the button. */
|
18
18
|
hanger?: React.ReactElement<HangerProps>;
|
19
|
+
/** Menu component associated with the button. */
|
20
|
+
menu?: React.ReactElement<MenuProps>;
|
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
|
@@ -45,6 +47,8 @@ export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrim
|
|
45
47
|
hanger?: React.ReactElement<{
|
46
48
|
children?: React.ReactNode;
|
47
49
|
}, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
|
50
|
+
/** Menu component associated with the button. */
|
51
|
+
menu?: React.ReactElement<MenuProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
|
48
52
|
/**
|
49
53
|
* Popover component associated with the button, clicking the button will open the popover.
|
50
54
|
* *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getAppearanceClasses, getButtonClasses, createButton } from '../Button/util';\nimport { Appearance } from '../../types';\nimport { DialogProps, HangerProps, PopoverProps } from '../..';\n\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\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 /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\n /** Hanger component associated with the button. */\n hanger?: React.ReactElement<HangerProps>;\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 /**\n * Set whether the button is rounded.\n * Default value is `false`\n */\n rounded?: boolean;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const IconButton = React.forwardRef(function IconButton(props: IconButtonProps, ref: React.Ref<HTMLButtonElement>) {\n const { appearance, icon, rounded = false, ...otherProps } = props;\n\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance, true),\n {\n 'rounded-full': rounded,\n rounded: !rounded,\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n },\n props.className\n );\n\n if (!icon) {\n return null;\n }\n\n return createButton(\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\n className,\n ref\n );\n});\n"],"names":["IconButton","React","props","ref","appearance","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButton","children","Icon","name"],"mappings":";;;;;;;
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getAppearanceClasses, getButtonClasses, createButton } from '../Button/util';\nimport { Appearance } from '../../types';\nimport { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';\n\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\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 /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\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 /**\n * Set whether the button is rounded.\n * Default value is `false`\n */\n rounded?: boolean;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const IconButton = React.forwardRef(function IconButton(props: IconButtonProps, ref: React.Ref<HTMLButtonElement>) {\n const { appearance, icon, rounded = false, ...otherProps } = props;\n\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance, true),\n {\n 'rounded-full': rounded,\n rounded: !rounded,\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n },\n props.className\n );\n\n if (!icon) {\n return null;\n }\n\n return createButton(\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\n className,\n ref\n );\n});\n"],"names":["IconButton","React","props","ref","appearance","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButton","children","Icon","name"],"mappings":";;;;;;;IAsCaA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AACvC,MAAQC,UAAR,GAA6DF,KAA7D,CAAQE,UAAR;AAAA,MAAoBC,IAApB,GAA6DH,KAA7D,CAAoBG,IAApB;AAAA,uBAA6DH,KAA7D,CAA0BI,OAA1B;AAAA,MAA0BA,OAA1B,+BAAoC,KAApC;AAAA,MAA8CC,UAA9C,iCAA6DL,KAA7D;;AAEA,MAAMM,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACP,UAAD,EAAa,IAAb,CAFJ,EAGhB;AACI,oBAAgBE,OADpB;AAEIA,IAAAA,OAAO,EAAE,CAACA,OAFd;AAGI,qCAAiCJ,KAAK,CAACU,QAH3C;AAII,4CAAwC,CAACV,KAAK,CAACU;AAJnD,GAHgB,EAShBV,KAAK,CAACM,SATU,CAApB;;AAYA,MAAI,CAACH,IAAL,EAAW;AACP,WAAO,IAAP;AACH;;AAED,SAAOQ,YAAY,cACVN,UADU;AACEO,IAAAA,QAAQ,EAAEb,aAAA,CAACc,IAAD;AAAMC,MAAAA,IAAI,EAAEX;AAAMG,MAAAA,SAAS,EAAC;KAA5B,CADZ;AACsD,iBAAa;AADnE,MAEfA,SAFe,EAGfL,GAHe,CAAnB;AAKH,CAxByB;;;;"}
|