@overmap-ai/blocks 1.0.40-improvements.1 → 1.0.40-improvements.2

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.
@@ -4708,6 +4708,65 @@
4708
4708
  Item: RadioGroupItem,
4709
4709
  Root: RadioGroupRoot
4710
4710
  };
4711
+ const RatingRootContext = react.createContext({});
4712
+ const RatingItemContext = react.createContext({});
4713
+ const RatingItem = react.memo((props) => {
4714
+ const { ref, children, value, ...rest } = props;
4715
+ const { value: activeValue } = react.use(RatingRootContext);
4716
+ const active = !!activeValue && value <= activeValue;
4717
+ const contextValue = react.useMemo(() => ({ value }), [value]);
4718
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { ref, value: value.toString(), "data-active": active, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(RatingItemContext, { value: contextValue, children }) });
4719
+ });
4720
+ RatingItem.displayName = "RatingItem";
4721
+ const RatingItemIndicator = react.memo((props) => {
4722
+ const { ref, children, forceMount, ...rest } = props;
4723
+ const { value: activeValue } = react.use(RatingRootContext);
4724
+ const { value } = react.use(RatingItemContext);
4725
+ const active = !!activeValue && value <= activeValue;
4726
+ return /* @__PURE__ */ jsxRuntime.jsx(
4727
+ RadixRadioGroup__namespace.Indicator,
4728
+ {
4729
+ ref,
4730
+ forceMount: forceMount ?? (active || void 0),
4731
+ "data-active": active,
4732
+ ...rest,
4733
+ children
4734
+ }
4735
+ );
4736
+ });
4737
+ RatingItemIndicator.displayName = "RatingItemIndicator";
4738
+ const RatingRoot = react.memo((props) => {
4739
+ const { ref, children, defaultValue, value: controlledValue, onValueChange, ...rest } = props;
4740
+ const [value, setValue] = useControlledState(defaultValue ?? null, controlledValue, onValueChange);
4741
+ const handleValueChange = react.useCallback(
4742
+ (value2) => {
4743
+ setValue(parseInt(value2));
4744
+ },
4745
+ [setValue]
4746
+ );
4747
+ const contextValue = react.useMemo(
4748
+ () => ({
4749
+ value
4750
+ }),
4751
+ [value]
4752
+ );
4753
+ return /* @__PURE__ */ jsxRuntime.jsx(
4754
+ RadixRadioGroup__namespace.Root,
4755
+ {
4756
+ ref,
4757
+ value: value ? value.toString() : null,
4758
+ onValueChange: handleValueChange,
4759
+ ...rest,
4760
+ children: /* @__PURE__ */ jsxRuntime.jsx(RatingRootContext, { value: contextValue, children })
4761
+ }
4762
+ );
4763
+ });
4764
+ RatingRoot.displayName = "RatingRoot";
4765
+ const Rating = {
4766
+ Item: RatingItem,
4767
+ ItemIndicator: RatingItemIndicator,
4768
+ Root: RatingRoot
4769
+ };
4711
4770
  const segmentedControlRootCva = classVarianceAuthority.cva(
4712
4771
  ["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
4713
4772
  {
@@ -6600,6 +6659,10 @@
6600
6659
  exports2.RadioGroupIndicator = RadioGroupIndicator;
6601
6660
  exports2.RadioGroupItem = RadioGroupItem;
6602
6661
  exports2.RadioGroupRoot = RadioGroupRoot;
6662
+ exports2.Rating = Rating;
6663
+ exports2.RatingItem = RatingItem;
6664
+ exports2.RatingItemIndicator = RatingItemIndicator;
6665
+ exports2.RatingRoot = RatingRoot;
6603
6666
  exports2.SegmentedControl = SegmentedControl;
6604
6667
  exports2.SegmentedControlItem = SegmentedControlItem;
6605
6668
  exports2.SegmentedControlRoot = SegmentedControlRoot;