(aria-valuetext value max-stars shape)Screen-reader announcement for the current rating. The icon noun follows the shape so a heart rating is not announced as "stars".
Screen-reader announcement for the current rating. The icon noun follows the shape so a heart rating is not announced as "stars".
(clamp v lo hi)Clamp v into [lo, hi]. When hi < lo (degenerate range) returns lo.
Clamp `v` into [lo, hi]. When hi < lo (degenerate range) returns lo.
(clamp-value v max-stars)Clamp a rating into [0, max-stars].
Clamp a rating into [0, max-stars].
(fill-states value max-stars)Per-star fill keywords (:full / :half / :empty) for the whole row.
Per-star fill keywords (:full / :half / :empty) for the whole row.
(interactable? {:keys [disabled? readonly?]})True when the rating accepts user interaction (not disabled, not readonly).
True when the rating accepts user interaction (not disabled, not readonly).
(key-target key cur max-stars p-step allow-clear?)Pure: the proposed (unclamped) value for a keydown. Arrow keys move by one precision step, Home jumps to 0, End to max, Delete/Backspace clear to 0 when clearing is allowed.
Pure: the proposed (unclamped) value for a keydown. Arrow keys move by one precision step, Home jumps to 0, End to max, Delete/Backspace clear to 0 when clearing is allowed.
(non-empty s)The string s when it is a non-empty string, otherwise nil.
The string `s` when it is a non-empty string, otherwise nil.
(normalize {:keys [value max precision shape allow-clear disabled readonly name
label size aria-label aria-labelledby aria-describedby]})Build the stable, value-comparable view-model from raw attribute strings.
Build the stable, value-comparable view-model from raw attribute strings.
(normalize-max s)Star count: a whole number in [1, max-stars-cap]. The cap also tames a
non-finite attribute — js/Math.round of Infinity stays Infinity, which the
min then clamps.
Star count: a whole number in [1, max-stars-cap]. The cap also tames a non-finite attribute — js/Math.round of Infinity stays Infinity, which the `min` then clamps.
(normalize-number s default-val)Parse s to a number, falling back to default-val for nil / NaN input.
Parse `s` to a number, falling back to `default-val` for nil / NaN input.
(pointer->value client-x rect-left rect-width star-count p-step)Pointer clientX + stars-row rect -> the discrete rating candidate in [0.5 .. star-count]. Stars are laid out with no gap, so each star spans rect-width / star-count. With a 0.5 step, the left half of a star picks the half value. Never returns 0 — clearing is handled by the component.
Pointer clientX + stars-row rect -> the discrete rating candidate in [0.5 .. star-count]. Stars are laid out with no gap, so each star spans rect-width / star-count. With a 0.5 step, the left half of a star picks the half value. Never returns 0 — clearing is handled by the component.
(pointer-star-index client-x rect-left rect-width star-count)0-based index of the star under the pointer, clamped to [0, star-count-1].
0-based index of the star under the pointer, clamped to [0, star-count-1].
(precision-step norm-precision)Numeric increment for a normalized precision: 0.5 for "half", else 1.
Numeric increment for a normalized precision: 0.5 for "half", else 1.
(snap-to-precision v step)Snap v to the nearest multiple of step. A nil or non-positive step
leaves v unchanged. The result is rounded to 9 decimals to suppress
floating-point noise.
Snap `v` to the nearest multiple of `step`. A nil or non-positive step leaves `v` unchanged. The result is rounded to 9 decimals to suppress floating-point noise.
(star-fill star-index value)Fill state of star star-index (0-based) for the rating value.
Fill state of star `star-index` (0-based) for the rating `value`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |