Updateing Docs
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
// components/Rating.js
|
||||
import { $html } from "sigpro";
|
||||
import { val } from "../core/utils.js";
|
||||
import { val, ui } from "../core/utils.js";
|
||||
|
||||
/** RATING */
|
||||
/**
|
||||
* Rating component
|
||||
*
|
||||
* daisyUI classes used:
|
||||
* - rating, rating-half, rating-hidden
|
||||
* - mask, mask-star, mask-star-2, mask-heart, mask-circle
|
||||
* - pointer-events-none
|
||||
*/
|
||||
export const Rating = (props) => {
|
||||
const { value, count = 5, mask = "mask-star", readonly = false, onchange, ...rest } = props;
|
||||
const { class: className, value, count = 5, mask = "mask-star", readonly = false, onchange, ...rest } = props;
|
||||
|
||||
const ratingGroup = `rating-${Math.random().toString(36).slice(2, 7)}`;
|
||||
|
||||
return $html(
|
||||
"div",
|
||||
{
|
||||
...rest,
|
||||
class: () => `rating ${val(readonly) ? "pointer-events-none" : ""} ${props.class || ""}`,
|
||||
class: () => ui(`rating ${val(readonly) ? "pointer-events-none" : ""}`, className),
|
||||
},
|
||||
Array.from({ length: val(count) }, (_, i) => {
|
||||
const starValue = i + 1;
|
||||
|
||||
Reference in New Issue
Block a user