@overmap-ai/blocks 1.0.10-fix-dropdown-buttons.0 → 1.0.10

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.
@@ -1,8 +1,9 @@
1
- import { FC } from "react";
1
+ import { FC, ReactElement } from "react";
2
2
  import { MenuGroupProps, MenuItemProps } from "@radix-ui/react-menu";
3
3
  import { BaseMenuItemProps, BaseMenuGroupProps, TextFilterProps } from "../typings.ts";
4
4
  export type BaseItemProps = BaseMenuItemProps & Omit<MenuItemProps, "asChild" | "content"> & {
5
5
  shortcut?: string[];
6
+ itemDecorator?: (itemElement: ReactElement) => ReactElement;
6
7
  };
7
8
  export type BaseItemGroupProps = BaseMenuGroupProps<BaseItemProps> & Omit<MenuGroupProps, "asChild"> & TextFilterProps;
8
9
  export interface BaseItemGroupElementProps {
@@ -1,6 +1,7 @@
1
1
  import { FC, PropsWithChildren, ReactNode } from "react";
2
2
  import { InputProps } from "..";
3
3
  export interface BaseMenuItem extends PropsWithChildren {
4
+ className?: string;
4
5
  rightSlot?: ReactNode;
5
6
  }
6
7
  export declare const BaseMenuItem: FC<BaseMenuItem>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from "../Buttons/typings";
3
- export type ButtonContextType = Pick<ButtonProps, "variant" | "size" | "severity" | "hoverEffects" | "fluid">;
3
+ export type ButtonContextType = Pick<ButtonProps, "variant" | "size" | "severity" | "hoverEffects" | "fluid" | "highContrast">;
4
4
  export declare const ButtonGroupContext: import("react").Context<ButtonContextType>;
5
5
  export declare const useButtonGroupContext: () => ButtonContextType;
@@ -30,4 +30,8 @@ export interface ButtonGroupProps extends Omit<ComponentProps<typeof Flex>, keyo
30
30
  * @default false
31
31
  * */
32
32
  fluid?: boolean;
33
+ /** When set to true, all Buttons will have higher contrast
34
+ * @default false
35
+ * */
36
+ highContrast?: boolean;
33
37
  }
@@ -32,6 +32,7 @@ interface SlideOutProps extends Omit<DismissableLayerProps, "disableOutsidePoint
32
32
  * @default "absolute"
33
33
  * */
34
34
  position?: "absolute" | "relative";
35
+ overlayClassName?: string;
35
36
  }
36
37
  /** The SlideOut component is a UI element that allows you to create a slide-in/slide-out effect for content within
37
38
  * your application. It provides a smooth transition animation for revealing and hiding content. */
package/dist/blocks.js CHANGED
@@ -319,6 +319,7 @@ const _Button$1 = forwardRef(function Button$1(props, ref) {
319
319
  severity = buttonGroupContext.severity ?? "primary",
320
320
  hoverEffects = buttonGroupContext.hoverEffects ?? [],
321
321
  variant = buttonGroupContext.variant,
322
+ highContrast = buttonGroupContext.highContrast ?? false,
322
323
  shortcut = {
323
324
  keys: [],
324
325
  action: () => {
@@ -347,6 +348,7 @@ const _Button$1 = forwardRef(function Button$1(props, ref) {
347
348
  size: useResponsiveMapping(size, SizeMapping),
348
349
  variant,
349
350
  disabled: loading || disabled,
351
+ highContrast,
350
352
  ...rest,
351
353
  children: loading ? /* @__PURE__ */ jsx(Spinner, {}) : children
352
354
  }
@@ -364,6 +366,7 @@ const _Button = forwardRef(function Button3(props, ref) {
364
366
  severity = buttonGroupContext.severity ?? "primary",
365
367
  hoverEffects = buttonGroupContext.hoverEffects ?? [],
366
368
  variant = buttonGroupContext.variant,
369
+ highContrast = buttonGroupContext.highContrast ?? false,
367
370
  shortcut = {
368
371
  keys: [],
369
372
  action: () => {
@@ -388,6 +391,7 @@ const _Button = forwardRef(function Button3(props, ref) {
388
391
  size: useResponsiveMapping(size, SizeMapping),
389
392
  variant,
390
393
  type,
394
+ highContrast,
391
395
  ...rest,
392
396
  children
393
397
  }
@@ -413,6 +417,7 @@ const _ButtonGroup = forwardRef(function ButtonGroup2({
413
417
  variant,
414
418
  hoverEffects,
415
419
  fluid: fluid2,
420
+ highContrast,
416
421
  ...rest
417
422
  }, ref) {
418
423
  const ghostSize = useResponsiveMapping(size, GhostVariantSizeToGapMapping[direction]);
@@ -428,7 +433,7 @@ const _ButtonGroup = forwardRef(function ButtonGroup2({
428
433
  direction,
429
434
  "data-direction": direction,
430
435
  ...rest,
431
- children: /* @__PURE__ */ jsx(ButtonGroupContext.Provider, { value: { size, severity, variant, hoverEffects, fluid: fluid2 }, children })
436
+ children: /* @__PURE__ */ jsx(ButtonGroupContext.Provider, { value: { size, severity, variant, hoverEffects, fluid: fluid2, highContrast }, children })
432
437
  }
433
438
  );
434
439
  });
@@ -656,10 +661,10 @@ const DropdownMenu = memo(
656
661
  ] });
657
662
  })
658
663
  );
659
- const BaseMenuItem$1 = "_BaseMenuItem_1s610_1";
660
- const RemoveOutline = "_RemoveOutline_1s610_15";
661
- const BaseMenuSeparator$1 = "_BaseMenuSeparator_1s610_19";
662
- const BaseMenuInput$1 = "_BaseMenuInput_1s610_27";
664
+ const BaseMenuItem$1 = "_BaseMenuItem_5r3et_1";
665
+ const RemoveOutline = "_RemoveOutline_5r3et_15";
666
+ const BaseMenuSeparator$1 = "_BaseMenuSeparator_5r3et_19";
667
+ const BaseMenuInput$1 = "_BaseMenuInput_5r3et_27";
663
668
  const styles$h = {
664
669
  BaseMenuItem: BaseMenuItem$1,
665
670
  RemoveOutline,
@@ -667,11 +672,22 @@ const styles$h = {
667
672
  BaseMenuInput: BaseMenuInput$1
668
673
  };
669
674
  const BaseMenuItem = memo(
670
- forwardRef(({ children, rightSlot }, ref) => {
671
- return /* @__PURE__ */ jsx(Box, { className: styles$h.BaseMenuItem, ref, position: "relative", px: "2", height: "6", children: /* @__PURE__ */ jsxs(Flex, { gap: "6", height: "100%", align: "center", children: [
672
- /* @__PURE__ */ jsx(Flex, { grow: "1", height: "100%", align: "center", gap: "1", children }),
673
- /* @__PURE__ */ jsx(Flex, { height: "100%", width: "4", align: "center", justify: "end", children: rightSlot })
674
- ] }) });
675
+ forwardRef(({ children, rightSlot, className, ...rest }, ref) => {
676
+ return /* @__PURE__ */ jsx(
677
+ Box,
678
+ {
679
+ className: classNames(styles$h.BaseMenuItem, className),
680
+ ref,
681
+ position: "relative",
682
+ px: "2",
683
+ height: "6",
684
+ ...rest,
685
+ children: /* @__PURE__ */ jsxs(Flex, { gap: "6", height: "100%", align: "center", children: [
686
+ /* @__PURE__ */ jsx(Flex, { grow: "1", height: "100%", align: "center", gap: "1", children }),
687
+ /* @__PURE__ */ jsx(Flex, { height: "100%", width: "4", align: "center", justify: "end", children: rightSlot })
688
+ ] })
689
+ }
690
+ );
675
691
  })
676
692
  );
677
693
  const BaseMenuInput = memo(
@@ -739,16 +755,21 @@ const BaseItemGroup = memo(function BaseItemGroup2({
739
755
  ),
740
756
  items.length !== 0 && /* @__PURE__ */ jsx(BaseMenuSeparator, {})
741
757
  ] }),
742
- items.map(({ content, shortcut, className, onSelect, ...rest2 }, index) => /* @__PURE__ */ jsx(
743
- ItemElement,
744
- {
745
- className: classNames(className, styles$h.RemoveOutline),
746
- onSelect: closeOnSelectHandler(onSelect),
747
- ...rest2,
748
- children: /* @__PURE__ */ jsx(BaseMenuItem, { rightSlot: shortcut == null ? void 0 : shortcut.map((key, index2) => /* @__PURE__ */ jsx(Kbd, { children: key }, index2)), children: content })
749
- },
750
- index
751
- ))
758
+ items.map(({ content, itemDecorator, shortcut, className, onSelect, ...rest2 }, index) => {
759
+ const itemContent = /* @__PURE__ */ jsx(
760
+ ItemElement,
761
+ {
762
+ className: classNames(className, styles$h.RemoveOutline),
763
+ onSelect: closeOnSelectHandler(onSelect),
764
+ textValue: "",
765
+ asChild: true,
766
+ ...rest2,
767
+ children: /* @__PURE__ */ jsx(BaseMenuItem, { rightSlot: shortcut == null ? void 0 : shortcut.map((key, index2) => /* @__PURE__ */ jsx(Kbd, { children: key }, index2)), children: content })
768
+ },
769
+ index
770
+ );
771
+ return itemDecorator ? itemDecorator(itemContent) : itemContent;
772
+ })
752
773
  ] }) }),
753
774
  separator && /* @__PURE__ */ jsx(BaseMenuSeparator, {})
754
775
  ] });
@@ -806,6 +827,7 @@ const BaseSelectGroup = memo(function BaseSelectGroup2({
806
827
  onCheckedChange: handleCheckedChange(itemValue),
807
828
  onSelect: closeOnSelectHandler(onSelect),
808
829
  textValue: "",
830
+ asChild: true,
809
831
  ...rest,
810
832
  children: /* @__PURE__ */ jsx(
811
833
  BaseMenuItem,
@@ -884,6 +906,7 @@ const BaseMultiSelectGroup = memo(function BaseMultiSelectGroup2({
884
906
  onCheckedChange: handleCheckedChange(value),
885
907
  checked: values.includes(value),
886
908
  textValue: "",
909
+ asChild: true,
887
910
  ...rest,
888
911
  children: /* @__PURE__ */ jsx(
889
912
  BaseMenuItem,
@@ -910,7 +933,7 @@ const BaseSubMenuGroup = memo(function BaseSubMenuGroup2({
910
933
  }) {
911
934
  return /* @__PURE__ */ jsxs(Fragment, { children: [
912
935
  /* @__PURE__ */ jsx(GroupElement, { ...rest, children: items.map(({ triggerIndicator, content, subContent, className, ...rest2 }, index) => /* @__PURE__ */ jsxs(SubElement, { children: [
913
- /* @__PURE__ */ jsx(SubTriggerElement, { className: classNames(className, styles$h.RemoveOutline), ...rest2, children: /* @__PURE__ */ jsx(BaseMenuItem, { rightSlot: triggerIndicator, children: content }) }),
936
+ /* @__PURE__ */ jsx(SubTriggerElement, { className: classNames(className, styles$h.RemoveOutline), asChild: true, ...rest2, children: /* @__PURE__ */ jsx(BaseMenuItem, { rightSlot: triggerIndicator, children: content }) }),
914
937
  /* @__PURE__ */ jsx(SubContentElement, { sideOffset: 10, children: subContent })
915
938
  ] }, index)) }),
916
939
  separator && /* @__PURE__ */ jsx(BaseMenuSeparator, {})
@@ -966,7 +989,7 @@ const DropdownItemMenu = memo(
966
989
  ...rest
967
990
  }) => {
968
991
  const infoColor = useSeverityColor("info");
969
- return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { modal: false, children: [
992
+ return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
970
993
  /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled, children: trigger }),
971
994
  /* @__PURE__ */ jsx(DropdownMenu$1.Content, { variant: "soft", ...rest, color: infoColor, children: /* @__PURE__ */ jsx(
972
995
  DropdownMenuItemGroup,
@@ -1326,15 +1349,15 @@ const _Sidebar = forwardRef(function Sidebar2({
1326
1349
  ] }) });
1327
1350
  });
1328
1351
  const Sidebar = memo(_Sidebar);
1329
- const outerContent = "_outerContent_1iy9c_1";
1330
- const enter = "_enter_1iy9c_4";
1331
- const right$1 = "_right_1iy9c_4";
1332
- const left$1 = "_left_1iy9c_8";
1333
- const enterActive = "_enterActive_1iy9c_12";
1334
- const exitActive = "_exitActive_1iy9c_22";
1335
- const exitDone = "_exitDone_1iy9c_32";
1336
- const resizable$1 = "_resizable_1iy9c_41";
1337
- const slideOutOverlay = "_slideOutOverlay_1iy9c_47";
1352
+ const outerContent = "_outerContent_n84eo_1";
1353
+ const enter = "_enter_n84eo_4";
1354
+ const right$1 = "_right_n84eo_7";
1355
+ const left$1 = "_left_n84eo_11";
1356
+ const enterActive = "_enterActive_n84eo_15";
1357
+ const exitActive = "_exitActive_n84eo_28";
1358
+ const exitDone = "_exitDone_n84eo_41";
1359
+ const resizable$1 = "_resizable_n84eo_53";
1360
+ const slideOutOverlay = "_slideOutOverlay_n84eo_59";
1338
1361
  const styles$d = {
1339
1362
  outerContent,
1340
1363
  enter,
@@ -1359,6 +1382,7 @@ const SlideOut = memo(function SlideOut2({
1359
1382
  modal = false,
1360
1383
  resizeHandle: resizeHandle2,
1361
1384
  position = "absolute",
1385
+ overlayClassName,
1362
1386
  ...rest
1363
1387
  }) {
1364
1388
  const contentRef = useRef(null);
@@ -1389,7 +1413,12 @@ const SlideOut = memo(function SlideOut2({
1389
1413
  unmountOnExit: true,
1390
1414
  mountOnEnter: true,
1391
1415
  children: /* @__PURE__ */ jsxs(Fragment, { children: [
1392
- overlay2 && /* @__PURE__ */ jsx("div", { className: classNames("overamp-slide-out-overlay", styles$d.slideOutOverlay) }),
1416
+ overlay2 && /* @__PURE__ */ jsx(
1417
+ "div",
1418
+ {
1419
+ className: classNames("overmap-slide-out-overlay", styles$d.slideOutOverlay, overlayClassName)
1420
+ }
1421
+ ),
1393
1422
  /* @__PURE__ */ jsx(DismissableLayer, { disableOutsidePointerEvents: modal, asChild: true, ...rest, children: /* @__PURE__ */ jsx(
1394
1423
  Flex$1,
1395
1424
  {