@yamada-ui/rating
Version:
Yamada UI rating component
1 lines • 1.93 kB
Source Map (JSON)
{"version":3,"sources":["../src/rating.tsx"],"sourcesContent":["import type { CSSUIObject, ThemeProps } from \"@yamada-ui/core\"\nimport type { UseRatingProps } from \"./use-rating\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { RatingProvider } from \"./rating-context\"\nimport { useRating } from \"./use-rating\"\n\nexport interface RatingProps extends ThemeProps<\"Rating\">, UseRatingProps {}\n\n/**\n * `Rating` is a component used to allow users to provide ratings.\n *\n * @see Docs https://yamada-ui.com/components/forms/rating\n */\nexport const Rating = forwardRef<RatingProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Rating\", props)\n const { className, ...computedProps } = omitThemeProps(mergedProps)\n const { children, getContainerProps, ...rest } = useRating(computedProps)\n const css: CSSUIObject = { display: \"flex\", ...styles.container }\n\n return (\n <RatingProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-rating\", className)}\n __css={css}\n {...getContainerProps({}, ref)}\n >\n {children}\n </ui.div>\n </RatingProvider>\n )\n})\n\nRating.displayName = \"Rating\"\nRating.__ui__ = \"Rating\"\n"],"mappings":";;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AAmBb;AARC,IAAM,SAAS,WAA+B,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,UAAU,KAAK;AACpE,QAAM,EAAE,WAAW,GAAG,cAAc,IAAI,eAAe,WAAW;AAClE,QAAM,EAAE,UAAU,mBAAmB,GAAG,KAAK,IAAI,UAAU,aAAa;AACxE,QAAM,MAAmB,EAAE,SAAS,QAAQ,GAAG,OAAO,UAAU;AAEhE,SACE,oBAAC,kBAAe,OAAO,EAAE,QAAQ,GAAG,KAAK,GACvC;AAAA,IAAC,GAAG;AAAA,IAAH;AAAA,MACC,WAAW,GAAG,aAAa,SAAS;AAAA,MACpC,OAAO;AAAA,MACN,GAAG,kBAAkB,CAAC,GAAG,GAAG;AAAA,MAE5B;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AAED,OAAO,cAAc;AACrB,OAAO,SAAS;","names":[]}