@cerberus-design/react
Version:
The Cerberus Design React component library.
31 lines (26 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const jsxRuntime = require('react/jsx-runtime');
const index = require('../../utils/index.cjs');
const show = require('../show/show.cjs');
const parts = require('./parts.cjs');
function Rating(props) {
const [{ label }, styleProps, rootProps] = index.splitProps(
props,
["label"],
["orientation", "palette", "size"]
);
return /* @__PURE__ */ jsxRuntime.jsxs(parts.RatingParts.Root, { ...styleProps, ...rootProps, children: [
/* @__PURE__ */ jsxRuntime.jsx(show.Show, { when: label, children: /* @__PURE__ */ jsxRuntime.jsx(parts.RatingParts.Label, { children: label }) }),
/* @__PURE__ */ jsxRuntime.jsx(parts.RatingParts.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(parts.RatingParts.Context, { children: (context) => context.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
parts.RatingParts.Item,
{
index: item,
palette: styleProps.palette,
children: /* @__PURE__ */ jsxRuntime.jsx(parts.RatingParts.ItemContext, { children: rootProps.children })
},
item
)) }) })
] });
}
exports.Rating = Rating;