@lessly/ui 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -477,6 +477,10 @@ declare const Toggle: React$1.ForwardRefExoticComponent<Omit<TogglePrimitive.Tog
|
|
|
477
477
|
* carries its own edge and selection steps that edge up. `single` is one object with a moving part,
|
|
478
478
|
* so it takes the segmented-control treatment (#346).
|
|
479
479
|
*
|
|
480
|
+
* A `single` set of **glyphs** is the exception, and it is the treatment's own limit rather than a
|
|
481
|
+
* special case: with no word to thicken the mark would be the tint alone, which greyscale erases.
|
|
482
|
+
* That set takes `frame`, the same as a `multiple` one (#755).
|
|
483
|
+
*
|
|
480
484
|
* **The selected slot is a tint and a heavier word, and the track draws nothing else.** The
|
|
481
485
|
* `bg-brand-subtle` fill measures 1.104:1 against the page in light and 1.144:1 in dark; the label
|
|
482
486
|
* goes to `text-brand` at 600 against the unselected 500, which is 1.55:1 light and 1.26:1 dark
|
package/dist/index.js
CHANGED
|
@@ -914,12 +914,13 @@ var SlidingThumb = ({ index, count }) => /* @__PURE__ */ jsx20(
|
|
|
914
914
|
}
|
|
915
915
|
);
|
|
916
916
|
var ToggleGroup = React16.forwardRef(({ className, variant, size, treatment, sliding, children, ...props }, ref) => {
|
|
917
|
-
const
|
|
917
|
+
const slots = React16.Children.toArray(children).filter(React16.isValidElement);
|
|
918
|
+
const wordless = slots.length > 0 && slots.every((slot) => isIconOnly(slot.props.children));
|
|
919
|
+
const resolved = treatment ?? (props.type === "single" && !wordless ? "track" : "frame");
|
|
918
920
|
const [mirror, setMirror] = React16.useState(
|
|
919
921
|
() => typeof props.defaultValue === "string" ? props.defaultValue : void 0
|
|
920
922
|
);
|
|
921
923
|
const selected = typeof props.value === "string" ? props.value : mirror;
|
|
922
|
-
const slots = React16.Children.toArray(children).filter(React16.isValidElement);
|
|
923
924
|
const index = slots.findIndex((slot) => slot.props.value === selected);
|
|
924
925
|
const rootProps = sliding && typeof props.value !== "string" ? {
|
|
925
926
|
...props,
|
|
@@ -940,10 +941,13 @@ var ToggleGroup = React16.forwardRef(({ className, variant, size, treatment, sli
|
|
|
940
941
|
// what lets the thumb be exactly `100% / count` wide and travel in multiples of itself.
|
|
941
942
|
"inline-flex w-fit items-center gap-0.5"
|
|
942
943
|
) : "flex items-center justify-center gap-1",
|
|
943
|
-
// A sliding track
|
|
944
|
-
//
|
|
945
|
-
//
|
|
946
|
-
|
|
944
|
+
// A sliding track's slots share its width equally, because the thumb is one slot wide and
|
|
945
|
+
// travels in multiples of itself. The gap goes for the same reason: a gap between slots is
|
|
946
|
+
// width the thumb's own step does not account for. The track sizes to those slots rather
|
|
947
|
+
// than to whatever holds it — given a parent and no width of its own it used to span the
|
|
948
|
+
// whole of it, and with no frame drawn the slots then read as loose words with a tint
|
|
949
|
+
// somewhere in them (#754). A caller wanting full width writes one, as every call site did.
|
|
950
|
+
sliding && "relative flex w-fit gap-0",
|
|
947
951
|
className
|
|
948
952
|
),
|
|
949
953
|
...rootProps,
|