@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.
- package/dist/Rating/Item.d.ts +6 -0
- package/dist/Rating/ItemIndicator.d.ts +5 -0
- package/dist/Rating/Root.d.ts +8 -0
- package/dist/Rating/context.d.ts +9 -0
- package/dist/Rating/index.d.ts +9 -0
- package/dist/blocks.js +65 -0
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +65 -0
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import * as RadixRadioGroup from "@radix-ui/react-radio-group";
|
|
3
|
+
export interface RatingItemProps extends Omit<ComponentPropsWithRef<typeof RadixRadioGroup.Item>, "value"> {
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const RatingItem: import('react').NamedExoticComponent<RatingItemProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import * as RadixRadioGroup from "@radix-ui/react-radio-group";
|
|
3
|
+
export interface RatingItemIndicatorProps extends ComponentPropsWithRef<typeof RadixRadioGroup.Indicator> {
|
|
4
|
+
}
|
|
5
|
+
export declare const RatingItemIndicator: import('react').NamedExoticComponent<RatingItemIndicatorProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import * as RadixRadioGroup from "@radix-ui/react-radio-group";
|
|
3
|
+
export interface RatingRootProps extends Omit<ComponentPropsWithRef<typeof RadixRadioGroup.Root>, "defaultValue" | "value" | "onValueChange"> {
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
value?: number | null;
|
|
6
|
+
onValueChange?: (value: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const RatingRoot: import('react').NamedExoticComponent<RatingRootProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface IRatingRootContext {
|
|
3
|
+
value: number | null;
|
|
4
|
+
}
|
|
5
|
+
export declare const RatingRootContext: import('react').Context<IRatingRootContext>;
|
|
6
|
+
export interface IRatingItemContext {
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const RatingItemContext: import('react').Context<IRatingItemContext>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export * from './Item';
|
|
3
|
+
export * from './ItemIndicator';
|
|
4
|
+
export * from './Root';
|
|
5
|
+
export declare const Rating: {
|
|
6
|
+
Item: import('react').NamedExoticComponent<import('./Item').RatingItemProps>;
|
|
7
|
+
ItemIndicator: import('react').NamedExoticComponent<import('./ItemIndicator').RatingItemIndicatorProps>;
|
|
8
|
+
Root: import('react').NamedExoticComponent<import('./Root').RatingRootProps>;
|
|
9
|
+
};
|
package/dist/blocks.js
CHANGED
|
@@ -4085,8 +4085,10 @@ const MenuV2Root = memo((props) => {
|
|
|
4085
4085
|
[getActiveItem, getFirstGroup, getFirstItem, getLastGroup, getLastItem, getNextGroup, getNextItem, onKeyDown]
|
|
4086
4086
|
);
|
|
4087
4087
|
useEffect(() => {
|
|
4088
|
+
var _a;
|
|
4088
4089
|
const firstItem = getFirstItem(internalRef.current);
|
|
4089
4090
|
if (!firstItem) return;
|
|
4091
|
+
(_a = internalRef.current) == null ? void 0 : _a.focus();
|
|
4090
4092
|
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4091
4093
|
}, [getFirstItem]);
|
|
4092
4094
|
const contextValue = useMemo(
|
|
@@ -4700,6 +4702,65 @@ const RadioGroup = {
|
|
|
4700
4702
|
Item: RadioGroupItem,
|
|
4701
4703
|
Root: RadioGroupRoot
|
|
4702
4704
|
};
|
|
4705
|
+
const RatingRootContext = createContext({});
|
|
4706
|
+
const RatingItemContext = createContext({});
|
|
4707
|
+
const RatingItem = memo((props) => {
|
|
4708
|
+
const { ref, children, value, ...rest } = props;
|
|
4709
|
+
const { value: activeValue } = use(RatingRootContext);
|
|
4710
|
+
const active = !!activeValue && value <= activeValue;
|
|
4711
|
+
const contextValue = useMemo(() => ({ value }), [value]);
|
|
4712
|
+
return /* @__PURE__ */ jsx(RadixRadioGroup.Item, { ref, value: value.toString(), "data-active": active, ...rest, children: /* @__PURE__ */ jsx(RatingItemContext, { value: contextValue, children }) });
|
|
4713
|
+
});
|
|
4714
|
+
RatingItem.displayName = "RatingItem";
|
|
4715
|
+
const RatingItemIndicator = memo((props) => {
|
|
4716
|
+
const { ref, children, forceMount, ...rest } = props;
|
|
4717
|
+
const { value: activeValue } = use(RatingRootContext);
|
|
4718
|
+
const { value } = use(RatingItemContext);
|
|
4719
|
+
const active = !!activeValue && value <= activeValue;
|
|
4720
|
+
return /* @__PURE__ */ jsx(
|
|
4721
|
+
RadixRadioGroup.Indicator,
|
|
4722
|
+
{
|
|
4723
|
+
ref,
|
|
4724
|
+
forceMount: forceMount ?? (active || void 0),
|
|
4725
|
+
"data-active": active,
|
|
4726
|
+
...rest,
|
|
4727
|
+
children
|
|
4728
|
+
}
|
|
4729
|
+
);
|
|
4730
|
+
});
|
|
4731
|
+
RatingItemIndicator.displayName = "RatingItemIndicator";
|
|
4732
|
+
const RatingRoot = memo((props) => {
|
|
4733
|
+
const { ref, children, defaultValue, value: controlledValue, onValueChange, ...rest } = props;
|
|
4734
|
+
const [value, setValue] = useControlledState(defaultValue ?? null, controlledValue, onValueChange);
|
|
4735
|
+
const handleValueChange = useCallback(
|
|
4736
|
+
(value2) => {
|
|
4737
|
+
setValue(parseInt(value2));
|
|
4738
|
+
},
|
|
4739
|
+
[setValue]
|
|
4740
|
+
);
|
|
4741
|
+
const contextValue = useMemo(
|
|
4742
|
+
() => ({
|
|
4743
|
+
value
|
|
4744
|
+
}),
|
|
4745
|
+
[value]
|
|
4746
|
+
);
|
|
4747
|
+
return /* @__PURE__ */ jsx(
|
|
4748
|
+
RadixRadioGroup.Root,
|
|
4749
|
+
{
|
|
4750
|
+
ref,
|
|
4751
|
+
value: value ? value.toString() : null,
|
|
4752
|
+
onValueChange: handleValueChange,
|
|
4753
|
+
...rest,
|
|
4754
|
+
children: /* @__PURE__ */ jsx(RatingRootContext, { value: contextValue, children })
|
|
4755
|
+
}
|
|
4756
|
+
);
|
|
4757
|
+
});
|
|
4758
|
+
RatingRoot.displayName = "RatingRoot";
|
|
4759
|
+
const Rating = {
|
|
4760
|
+
Item: RatingItem,
|
|
4761
|
+
ItemIndicator: RatingItemIndicator,
|
|
4762
|
+
Root: RatingRoot
|
|
4763
|
+
};
|
|
4703
4764
|
const segmentedControlRootCva = cva(
|
|
4704
4765
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4705
4766
|
{
|
|
@@ -6593,6 +6654,10 @@ export {
|
|
|
6593
6654
|
RadioGroupIndicator,
|
|
6594
6655
|
RadioGroupItem,
|
|
6595
6656
|
RadioGroupRoot,
|
|
6657
|
+
Rating,
|
|
6658
|
+
RatingItem,
|
|
6659
|
+
RatingItemIndicator,
|
|
6660
|
+
RatingRoot,
|
|
6596
6661
|
SegmentedControl,
|
|
6597
6662
|
SegmentedControlItem,
|
|
6598
6663
|
SegmentedControlRoot,
|