@overmap-ai/blocks 1.0.40-overlay.1 → 1.0.40

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.
@@ -4379,6 +4379,65 @@
4379
4379
  Item: RadioGroupItem,
4380
4380
  Root: RadioGroupRoot
4381
4381
  };
4382
+ const RatingRootContext = React.createContext({});
4383
+ const RatingItemContext = React.createContext({});
4384
+ const RatingItem = React.memo((props) => {
4385
+ const { ref, children, value, ...rest } = props;
4386
+ const { value: activeValue } = React.use(RatingRootContext);
4387
+ const active = !!activeValue && value <= activeValue;
4388
+ const contextValue = React.useMemo(() => ({ value }), [value]);
4389
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { ref, value: value.toString(), "data-active": active, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(RatingItemContext, { value: contextValue, children }) });
4390
+ });
4391
+ RatingItem.displayName = "RatingItem";
4392
+ const RatingItemIndicator = React.memo((props) => {
4393
+ const { ref, children, forceMount, ...rest } = props;
4394
+ const { value: activeValue } = React.use(RatingRootContext);
4395
+ const { value } = React.use(RatingItemContext);
4396
+ const active = !!activeValue && value <= activeValue;
4397
+ return /* @__PURE__ */ jsxRuntime.jsx(
4398
+ RadixRadioGroup__namespace.Indicator,
4399
+ {
4400
+ ref,
4401
+ forceMount: forceMount ?? (active || void 0),
4402
+ "data-active": active,
4403
+ ...rest,
4404
+ children
4405
+ }
4406
+ );
4407
+ });
4408
+ RatingItemIndicator.displayName = "RatingItemIndicator";
4409
+ const RatingRoot = React.memo((props) => {
4410
+ const { ref, children, defaultValue, value: controlledValue, onValueChange, ...rest } = props;
4411
+ const [value, setValue] = useControlledState(defaultValue ?? null, controlledValue, onValueChange);
4412
+ const handleValueChange = React.useCallback(
4413
+ (value2) => {
4414
+ setValue(parseInt(value2));
4415
+ },
4416
+ [setValue]
4417
+ );
4418
+ const contextValue = React.useMemo(
4419
+ () => ({
4420
+ value
4421
+ }),
4422
+ [value]
4423
+ );
4424
+ return /* @__PURE__ */ jsxRuntime.jsx(
4425
+ RadixRadioGroup__namespace.Root,
4426
+ {
4427
+ ref,
4428
+ value: value ? value.toString() : null,
4429
+ onValueChange: handleValueChange,
4430
+ ...rest,
4431
+ children: /* @__PURE__ */ jsxRuntime.jsx(RatingRootContext, { value: contextValue, children })
4432
+ }
4433
+ );
4434
+ });
4435
+ RatingRoot.displayName = "RatingRoot";
4436
+ const Rating = {
4437
+ Item: RatingItem,
4438
+ ItemIndicator: RatingItemIndicator,
4439
+ Root: RatingRoot
4440
+ };
4382
4441
  const segmentedControlRootCva = classVarianceAuthority.cva(
4383
4442
  ["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
4384
4443
  {
@@ -6255,6 +6314,10 @@
6255
6314
  exports2.RadioGroupIndicator = RadioGroupIndicator;
6256
6315
  exports2.RadioGroupItem = RadioGroupItem;
6257
6316
  exports2.RadioGroupRoot = RadioGroupRoot;
6317
+ exports2.Rating = Rating;
6318
+ exports2.RatingItem = RatingItem;
6319
+ exports2.RatingItemIndicator = RatingItemIndicator;
6320
+ exports2.RatingRoot = RatingRoot;
6258
6321
  exports2.SegmentedControl = SegmentedControl;
6259
6322
  exports2.SegmentedControlItem = SegmentedControlItem;
6260
6323
  exports2.SegmentedControlRoot = SegmentedControlRoot;