@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 4.44 kB
Source Map (JSON)
{"version":3,"file":"empty-state.cjs","names":["createSlotComponent","emptyState","useSplitChildren","styled"],"sources":["../../../../src/components/empty-state/empty-state.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { EmptyState } from \"./empty-state.style\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useSplitChildren } from \"../../utils\"\nimport { emptyState } from \"./empty-state.style\"\n\nexport interface EmptyStateRootProps\n extends Omit<HTMLStyledProps, \"title\">,\n ThemeProps<EmptyState> {\n /**\n * The empty state description to use.\n */\n description?: ReactNode\n /**\n * The empty state indicator to use.\n */\n indicator?: ReactNode\n /**\n * The empty state title to use.\n */\n title?: ReactNode\n /**\n * The props for the empty state content component.\n */\n contentProps?: EmptyStateContentProps\n /**\n * The props for the empty state description component.\n */\n descriptionProps?: EmptyStateDescriptionProps\n /**\n * The props for the empty state indicator component.\n */\n indicatorProps?: EmptyStateIndicatorProps\n /**\n * The props for the empty state title component.\n */\n titleProps?: EmptyStateTitleProps\n}\n\nconst {\n PropsContext: EmptyStatePropsContext,\n usePropsContext: useEmptyStatePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<EmptyStateRootProps, EmptyState>(\n \"empty-state\",\n emptyState,\n)\n\nexport { EmptyStatePropsContext, useEmptyStatePropsContext }\n\n/**\n * `EmptyState` is used to display when a resource is empty or not available.\n *\n * @see https://yamada-ui.com/docs/components/empty-state\n */\nexport const EmptyStateRoot = withProvider<\"div\", EmptyStateRootProps>(\n ({\n children,\n description,\n indicator,\n title,\n contentProps,\n descriptionProps,\n indicatorProps,\n titleProps,\n ...rest\n }) => {\n const [\n omittedChildren,\n customIndicator,\n customContent,\n customTitle,\n customDescription,\n ] = useSplitChildren(\n children,\n EmptyStateIndicator,\n EmptyStateContent,\n EmptyStateTitle,\n EmptyStateDescription,\n )\n\n return (\n <styled.div {...rest}>\n {customIndicator ?? (\n <EmptyStateIndicator {...indicatorProps}>\n {indicator}\n </EmptyStateIndicator>\n )}\n\n {customContent ?? (\n <EmptyStateContent {...contentProps}>\n {customTitle ?? (\n <EmptyStateTitle {...titleProps}>{title}</EmptyStateTitle>\n )}\n\n {customDescription ?? (\n <EmptyStateDescription {...descriptionProps}>\n {description}\n </EmptyStateDescription>\n )}\n </EmptyStateContent>\n )}\n\n {omittedChildren}\n </styled.div>\n )\n },\n \"root\",\n)()\n\nexport interface EmptyStateIndicatorProps extends HTMLStyledProps {}\n\nexport const EmptyStateIndicator = withContext<\"div\", EmptyStateIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n\nexport interface EmptyStateContentProps extends HTMLStyledProps {}\n\nexport const EmptyStateContent = withContext<\"div\", EmptyStateContentProps>(\n \"div\",\n \"content\",\n)()\n\nexport interface EmptyStateTitleProps extends HTMLStyledProps<\"h3\"> {}\n\nexport const EmptyStateTitle = withContext<\"h3\", EmptyStateTitleProps>(\n \"h3\",\n \"title\",\n)()\n\nexport interface EmptyStateDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const EmptyStateDescription = withContext<\n \"p\",\n EmptyStateDescriptionProps\n>(\"p\", \"description\")()\n"],"mappings":";;;;;;;;;;;;AA0CA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,aACA,iBACEA,6CACF,eACAC,qCACD;;;;;;AASD,MAAa,iBAAiB,cAC3B,EACC,UACA,aACA,WACA,OACA,cACA,kBACA,gBACA,WACA,GAAG,WACC;CACJ,MAAM,CACJ,iBACA,iBACA,eACA,aACA,qBACEC,kCACF,UACA,qBACA,mBACA,iBACA,sBACD;AAED,QACE,4CAACC,uBAAO;EAAI,GAAI;;GACb,mBACC,2CAAC;IAAoB,GAAI;cACtB;KACmB;GAGvB,iBACC,4CAAC;IAAkB,GAAI;eACpB,eACC,2CAAC;KAAgB,GAAI;eAAa;MAAwB,EAG3D,qBACC,2CAAC;KAAsB,GAAI;eACxB;MACqB;KAER;GAGrB;;GACU;GAGjB,OACD,EAAE;AAIH,MAAa,sBAAsB,YACjC,OACA,YACD,EAAE;AAIH,MAAa,oBAAoB,YAC/B,OACA,UACD,EAAE;AAIH,MAAa,kBAAkB,YAC7B,MACA,QACD,EAAE;AAIH,MAAa,wBAAwB,YAGnC,KAAK,cAAc,EAAE"}