UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

1 lines 1.77 kB
{"version":3,"file":"icon-button.cjs","names":["createComponent","iconButtonStyle","Button"],"sources":["../../../../src/components/button/icon-button.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { ThemeProps, WithoutThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"./button\"\nimport type { IconButtonStyle } from \"./icon-button.style\"\nimport { createComponent } from \"../../core\"\nimport { Button } from \"./button\"\nimport { iconButtonStyle } from \"./icon-button.style\"\n\nexport interface IconButtonProps\n extends Omit<\n WithoutThemeProps<ButtonProps, IconButtonStyle>,\n | \"endIcon\"\n | \"iconProps\"\n | \"loadingIcon\"\n | \"loadingMessage\"\n | \"loadingPlacement\"\n | \"loadingProps\"\n | \"startIcon\"\n >,\n ThemeProps<IconButtonStyle> {\n /**\n * The icon to be used in the button.\n */\n icon?: ReactNode\n}\n\nconst {\n PropsContext: IconButtonPropsContext,\n usePropsContext: useIconButtonPropsContext,\n withContext,\n} = createComponent<IconButtonProps, IconButtonStyle>(\n \"icon-button\",\n iconButtonStyle,\n)\n\nexport { IconButtonPropsContext, useIconButtonPropsContext }\n\n/**\n * `IconButton` is a component that displays an icon within a button.\n *\n * @see https://yamada-ui.com/docs/components/icon-button\n */\nexport const IconButton = withContext<\"button\", IconButtonProps>(Button)(\n undefined,\n ({ children, icon, ...rest }) => ({\n children: icon || children,\n ...rest,\n }),\n)\n"],"mappings":";;;;;;;;AA4BA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,gBACEA,yCACF,eACAC,0CACD;;;;;;AASD,MAAa,aAAa,YAAuCC,sBAAO,CACtE,SACC,EAAE,UAAU,KAAM,GAAG,YAAY;CAChC,UAAU,QAAQ;CAClB,GAAG;CACJ,EACF"}