@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 1.95 kB
Source Map (JSON)
{"version":3,"file":"close-button.cjs","names":["createComponent","closeButtonStyle","IconButton","useI18n","XIcon"],"sources":["../../../../src/components/close-button/close-button.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, ThemeProps, WithoutThemeProps } from \"../../core\"\nimport type { IconButtonProps } from \"../button\"\nimport type { CloseButtonStyle } from \"./close-button.style\"\nimport { createComponent } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { IconButton } from \"../button\"\nimport { XIcon } from \"../icon\"\nimport { closeButtonStyle } from \"./close-button.style\"\n\nexport interface CloseButtonProps\n extends Omit<\n WithoutThemeProps<IconButtonProps, CloseButtonStyle>,\n \"aria-label\"\n >,\n Pick<HTMLProps<\"button\">, \"aria-label\">,\n ThemeProps<CloseButtonStyle> {}\n\nconst {\n PropsContext: CloseButtonPropsContext,\n usePropsContext: useCloseButtonPropsContext,\n withContext,\n} = createComponent<CloseButtonProps, CloseButtonStyle>(\n \"close-button\",\n closeButtonStyle,\n)\n\nexport { CloseButtonPropsContext, useCloseButtonPropsContext }\n\n/**\n * `CloseButton` is a component used primarily to trigger the close functionality of a component.\n *\n * @see https://yamada-ui.com/docs/components/close-button\n */\nexport const CloseButton = withContext<\"button\", CloseButtonProps>(IconButton)(\n undefined,\n ({ children, icon, ...rest }) => {\n const { t } = useI18n(\"closeButton\")\n\n return {\n \"aria-label\": t(\"Close\"),\n children: children || icon || <XIcon />,\n ...rest,\n }\n },\n)\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,gBACEA,yCACF,gBACAC,4CACD;;;;;;AASD,MAAa,cAAc,YAAwCC,+BAAW,CAC5E,SACC,EAAE,UAAU,KAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,MAAMC,8BAAQ,cAAc;AAEpC,QAAO;EACL,cAAc,EAAE,QAAQ;EACxB,UAAU,YAAY,QAAQ,2CAACC,yBAAQ;EACvC,GAAG;EACJ;EAEJ"}