@overmap-ai/blocks 1.0.40-improvements.0 → 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.
@@ -4091,8 +4091,10 @@
4091
4091
  [getActiveItem, getFirstGroup, getFirstItem, getLastGroup, getLastItem, getNextGroup, getNextItem, onKeyDown]
4092
4092
  );
4093
4093
  react.useEffect(() => {
4094
+ var _a;
4094
4095
  const firstItem = getFirstItem(internalRef.current);
4095
4096
  if (!firstItem) return;
4097
+ (_a = internalRef.current) == null ? void 0 : _a.focus();
4096
4098
  setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
4097
4099
  }, [getFirstItem]);
4098
4100
  const contextValue = react.useMemo(
@@ -4706,6 +4708,65 @@
4706
4708
  Item: RadioGroupItem,
4707
4709
  Root: RadioGroupRoot
4708
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
+ };
4709
4770
  const segmentedControlRootCva = classVarianceAuthority.cva(
4710
4771
  ["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
4711
4772
  {
@@ -6598,6 +6659,10 @@
6598
6659
  exports2.RadioGroupIndicator = RadioGroupIndicator;
6599
6660
  exports2.RadioGroupItem = RadioGroupItem;
6600
6661
  exports2.RadioGroupRoot = RadioGroupRoot;
6662
+ exports2.Rating = Rating;
6663
+ exports2.RatingItem = RatingItem;
6664
+ exports2.RatingItemIndicator = RatingItemIndicator;
6665
+ exports2.RatingRoot = RatingRoot;
6601
6666
  exports2.SegmentedControl = SegmentedControl;
6602
6667
  exports2.SegmentedControlItem = SegmentedControlItem;
6603
6668
  exports2.SegmentedControlRoot = SegmentedControlRoot;