@overmap-ai/blocks 1.0.18 → 1.0.19-always-show-checkbox.1

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.
@@ -7,6 +7,7 @@ export interface CheckboxProps extends RadixCheckboxProps {
7
7
  labelClassName?: string;
8
8
  label?: ReactNode;
9
9
  doesLabelCheck?: boolean;
10
+ alwaysShow?: boolean;
10
11
  }
11
12
  export interface SelectAllCheckboxProps extends Omit<CheckboxProps, "checked"> {
12
13
  children: Array<ReactElement<CheckboxProps>>;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface ErrorBoundaryProps extends React.PropsWithChildren {
3
+ absoluteCentering?: boolean;
4
+ }
5
+ export declare const OvermapErrorBoundary: React.MemoExoticComponent<(props: ErrorBoundaryProps) => import("react/jsx-runtime").JSX.Element>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./OvermapErrorBoundary";
@@ -14,6 +14,7 @@ export interface TableCell {
14
14
  filterValue?: ValueLabel;
15
15
  sortValue?: ValueLabel;
16
16
  searchValue?: ValueLabel;
17
+ disabled?: boolean;
17
18
  className?: string;
18
19
  }
19
20
  export interface TableColumn {
@@ -25,12 +26,14 @@ export interface TableColumn {
25
26
  width?: string;
26
27
  maxWidth?: string;
27
28
  className?: string;
29
+ disabled?: boolean;
28
30
  filterValues?: FilterValue[];
29
31
  }
30
32
  export interface TableRow {
31
33
  id: IdLabel;
32
34
  onClick?: (row: TableRow) => void;
33
35
  className?: string;
36
+ disabled?: boolean;
34
37
  columns: {
35
38
  [columnId: string]: TableCell;
36
39
  };
@@ -10,7 +10,7 @@ export interface TextAreaProps extends Omit<ComponentProps<typeof RadixTextArea>
10
10
  * @default false
11
11
  * */
12
12
  showInputLength?: boolean;
13
- resize: "vertical" | "horizontal" | "both";
13
+ resize: "vertical" | "horizontal" | "both" | "none";
14
14
  inputLengthTemplate?: string;
15
15
  variant?: ComponentProps<typeof RadixTextArea>["variant"] | "ghost";
16
16
  }
package/dist/blocks.js CHANGED
@@ -14,6 +14,8 @@ import { Root as Root$1, Item as Item$1 } from "@radix-ui/react-toggle-group";
14
14
  import { Root as Root$2 } from "@radix-ui/react-toolbar";
15
15
  import * as RadixToast from "@radix-ui/react-toast";
16
16
  import { ToastProvider as ToastProvider$1, ToastViewport as ToastViewport$1 } from "@radix-ui/react-toast";
17
+ import { useErrorBoundary, ErrorBoundary } from "react-error-boundary";
18
+ import FeatherIcon from "feather-icons-react";
17
19
  import { flushSync } from "react-dom";
18
20
  import { HeaderCell, Table as Table$1, Header, HeaderRow, Body, Cell, Row } from "@table-library/react-table-library/table.js";
19
21
  import { useTheme } from "@table-library/react-table-library/theme.js";
@@ -334,7 +336,7 @@ const _Button$1 = forwardRef(function Button$1(props, ref) {
334
336
  },
335
337
  loading,
336
338
  children,
337
- disabled,
339
+ disabled: disabled2,
338
340
  ...rest
339
341
  } = props;
340
342
  const color = useSeverityColor(severity);
@@ -353,7 +355,7 @@ const _Button$1 = forwardRef(function Button$1(props, ref) {
353
355
  color,
354
356
  size: useResponsiveMapping(size, SizeMapping),
355
357
  variant,
356
- disabled: loading || disabled,
358
+ disabled: loading || disabled2,
357
359
  highContrast,
358
360
  ...rest,
359
361
  children: loading ? /* @__PURE__ */ jsx(Spinner, {}) : children
@@ -659,10 +661,10 @@ const useDiscardAlertDialog = () => {
659
661
  );
660
662
  };
661
663
  const DropdownMenu = memo(
662
- forwardRef(({ trigger, disabled, children, ...rest }) => {
664
+ forwardRef(({ trigger, disabled: disabled2, children, ...rest }) => {
663
665
  const infoColor = useSeverityColor("info");
664
666
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
665
- /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled, children: trigger }),
667
+ /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
666
668
  /* @__PURE__ */ jsx(DropdownMenu$1.Content, { variant: "soft", color: infoColor, ...rest, children })
667
669
  ] });
668
670
  })
@@ -987,7 +989,7 @@ const DropdownItemMenu = memo(
987
989
  ({
988
990
  trigger,
989
991
  items,
990
- disabled,
992
+ disabled: disabled2,
991
993
  closeOnSelect = true,
992
994
  filterValue,
993
995
  onFilterValueChange,
@@ -996,7 +998,7 @@ const DropdownItemMenu = memo(
996
998
  }) => {
997
999
  const infoColor = useSeverityColor("info");
998
1000
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
999
- /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled, children: trigger }),
1001
+ /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
1000
1002
  /* @__PURE__ */ jsx(DropdownMenu$1.Content, { variant: "soft", ...rest, color: infoColor, children: /* @__PURE__ */ jsx(
1001
1003
  DropdownMenuItemGroup,
1002
1004
  {
@@ -1016,7 +1018,7 @@ const DropdownSelect = memo(
1016
1018
  ({
1017
1019
  trigger,
1018
1020
  items,
1019
- disabled = false,
1021
+ disabled: disabled2 = false,
1020
1022
  value,
1021
1023
  onValueChange,
1022
1024
  placeholder,
@@ -1028,7 +1030,7 @@ const DropdownSelect = memo(
1028
1030
  }, ref) => {
1029
1031
  const infoColor = useSeverityColor("info");
1030
1032
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
1031
- /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled, children: trigger }),
1033
+ /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
1032
1034
  /* @__PURE__ */ jsx(DropdownMenu$1.Content, { ref, variant: "soft", color: infoColor, side, children: /* @__PURE__ */ jsx(
1033
1035
  DropdownMenuSelectGroup,
1034
1036
  {
@@ -1051,7 +1053,7 @@ const DropdownMultiSelect = memo(
1051
1053
  ({
1052
1054
  trigger,
1053
1055
  items,
1054
- disabled = false,
1056
+ disabled: disabled2 = false,
1055
1057
  values,
1056
1058
  onValueChange,
1057
1059
  placeholder,
@@ -1063,7 +1065,7 @@ const DropdownMultiSelect = memo(
1063
1065
  }, ref) => {
1064
1066
  const infoColor = useSeverityColor("info");
1065
1067
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
1066
- /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled, children: trigger }),
1068
+ /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
1067
1069
  /* @__PURE__ */ jsx(DropdownMenu$1.Content, { ref, variant: "soft", color: infoColor, side, children: /* @__PURE__ */ jsx(
1068
1070
  DropdownMenuMultiSelectGroup,
1069
1071
  {
@@ -1154,7 +1156,7 @@ const SELECT_ALL_VALUE = "__select_all__";
1154
1156
  const MultiSelect = memo(
1155
1157
  forwardRef((props, ref) => {
1156
1158
  const [open, setOpen] = useState(false);
1157
- const { placeholder, value, onValueChange, options, disabled, name, ...triggerProps } = props;
1159
+ const { placeholder, value, onValueChange, options, disabled: disabled2, name, ...triggerProps } = props;
1158
1160
  const size = useResponsiveMapping(props.size, SizeMapping);
1159
1161
  const color = useSeverityColor(props.severity);
1160
1162
  const optionsMap = useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);
@@ -1195,7 +1197,7 @@ const MultiSelect = memo(
1195
1197
  value: "",
1196
1198
  onOpenChange: handleOpenChange,
1197
1199
  onValueChange: handleValueChange,
1198
- disabled,
1200
+ disabled: disabled2,
1199
1201
  size,
1200
1202
  name,
1201
1203
  autoComplete: "off",
@@ -1974,7 +1976,7 @@ const _ToggleGroup = forwardRef(function ToggleGroup2({
1974
1976
  value,
1975
1977
  onValueChange,
1976
1978
  defaultValue,
1977
- disabled,
1979
+ disabled: disabled2,
1978
1980
  items,
1979
1981
  // ButtonGroup Props
1980
1982
  className,
@@ -1989,7 +1991,7 @@ const _ToggleGroup = forwardRef(function ToggleGroup2({
1989
1991
  ref,
1990
1992
  value,
1991
1993
  onValueChange,
1992
- disabled,
1994
+ disabled: disabled2,
1993
1995
  orientation: direction === "column" ? "vertical" : "horizontal",
1994
1996
  loop,
1995
1997
  rovingFocus,
@@ -2260,6 +2262,39 @@ const _Separator = forwardRef(function Separator2({
2260
2262
  );
2261
2263
  });
2262
2264
  const Separator = memo(_Separator);
2265
+ const centerStyles = { placeSelf: "center" };
2266
+ const ErrorFallback = memo((props) => {
2267
+ const { absoluteCentering } = props;
2268
+ const { resetBoundary } = useErrorBoundary();
2269
+ const height = "20px";
2270
+ const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
2271
+ return /* @__PURE__ */ jsxs(Flex, { gap: "2", direction: "row", width: "100%", style: outerFlexStyles, children: [
2272
+ /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }),
2273
+ /* @__PURE__ */ jsx(FeatherIcon, { icon: "alert-triangle", size: height, style: centerStyles }),
2274
+ /* @__PURE__ */ jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: "Something went wrong" }),
2275
+ /* @__PURE__ */ jsx(
2276
+ IconButton,
2277
+ {
2278
+ "aria-label": "Try again",
2279
+ variant: "soft",
2280
+ onClick: resetBoundary,
2281
+ style: centerStyles,
2282
+ hoverEffects: ["spin180Clockwise"],
2283
+ children: /* @__PURE__ */ jsx(FeatherIcon, { icon: "refresh-ccw", size: height })
2284
+ }
2285
+ ),
2286
+ /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } })
2287
+ ] });
2288
+ });
2289
+ ErrorFallback.displayName = "ErrorFallback";
2290
+ const OvermapErrorBoundary = memo((props) => {
2291
+ const { absoluteCentering } = props;
2292
+ const logError = useCallback((error, info) => {
2293
+ console.error(error, info);
2294
+ }, []);
2295
+ return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, { absoluteCentering }), onError: logError, children: props.children });
2296
+ });
2297
+ OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
2263
2298
  function _extends() {
2264
2299
  _extends = Object.assign ? Object.assign.bind() : function(target) {
2265
2300
  for (var i = 1; i < arguments.length; i++) {
@@ -2726,7 +2761,7 @@ const $e698a72e93240346$var$CHECKBOX_NAME = "Checkbox";
2726
2761
  const [$e698a72e93240346$var$createCheckboxContext, $e698a72e93240346$export$b566c4ff5488ea01] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($e698a72e93240346$var$CHECKBOX_NAME);
2727
2762
  const [$e698a72e93240346$var$CheckboxProvider, $e698a72e93240346$var$useCheckboxContext] = $e698a72e93240346$var$createCheckboxContext($e698a72e93240346$var$CHECKBOX_NAME);
2728
2763
  const $e698a72e93240346$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2729
- const { __scopeCheckbox, name, checked: checkedProp, defaultChecked, required, disabled, value = "on", onCheckedChange, ...checkboxProps } = props;
2764
+ const { __scopeCheckbox, name, checked: checkedProp, defaultChecked, required, disabled: disabled2, value = "on", onCheckedChange, ...checkboxProps } = props;
2730
2765
  const [button, setButton] = useState(null);
2731
2766
  const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
2732
2767
  forwardedRef,
@@ -2754,15 +2789,15 @@ const $e698a72e93240346$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef((pr
2754
2789
  return /* @__PURE__ */ createElement($e698a72e93240346$var$CheckboxProvider, {
2755
2790
  scope: __scopeCheckbox,
2756
2791
  state: checked,
2757
- disabled
2792
+ disabled: disabled2
2758
2793
  }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
2759
2794
  type: "button",
2760
2795
  role: "checkbox",
2761
2796
  "aria-checked": $e698a72e93240346$var$isIndeterminate(checked) ? "mixed" : checked,
2762
2797
  "aria-required": required,
2763
2798
  "data-state": $e698a72e93240346$var$getState(checked),
2764
- "data-disabled": disabled ? "" : void 0,
2765
- disabled,
2799
+ "data-disabled": disabled2 ? "" : void 0,
2800
+ disabled: disabled2,
2766
2801
  value
2767
2802
  }, checkboxProps, {
2768
2803
  ref: composedRefs,
@@ -2787,7 +2822,7 @@ const $e698a72e93240346$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef((pr
2787
2822
  value,
2788
2823
  checked,
2789
2824
  required,
2790
- disabled,
2825
+ disabled: disabled2,
2791
2826
  style: {
2792
2827
  transform: "translateX(-100%)"
2793
2828
  }
@@ -2872,14 +2907,14 @@ const styles$2 = {
2872
2907
  noTextHighlight,
2873
2908
  checkboxHidden
2874
2909
  };
2875
- const _Checkbox = forwardRef(function Checkbox2({ className, labelClassName, label, checked, onCheckedChange, ...rest }, ref) {
2910
+ const _Checkbox = forwardRef(function Checkbox2({ className, labelClassName, label, checked, onCheckedChange, alwaysShow = true, ...rest }, ref) {
2876
2911
  return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props }) => /* @__PURE__ */ jsxs(Flex$1, { className: styles$2.checkboxContainer, ...props, children: [
2877
2912
  /* @__PURE__ */ jsx(
2878
2913
  $e698a72e93240346$export$be92b6f5f03c0fe9,
2879
2914
  {
2880
2915
  className: classNames(
2881
2916
  styles$2.checkbox,
2882
- !isHovered && !checked && styles$2.checkboxHidden,
2917
+ !alwaysShow && !isHovered && !checked && styles$2.checkboxHidden,
2883
2918
  className
2884
2919
  ),
2885
2920
  checked,
@@ -2973,24 +3008,26 @@ const SelectAllCheckbox = memo(function SelectAllCheckbox2({
2973
3008
  childrenWithProps
2974
3009
  ] });
2975
3010
  });
2976
- const outerTableContainer = "_outerTableContainer_1wqc9_1";
2977
- const headerContainer = "_headerContainer_1wqc9_13";
2978
- const tableTopContainer = "_tableTopContainer_1wqc9_17";
2979
- const tableContainer = "_tableContainer_1wqc9_21";
2980
- const searchContainer = "_searchContainer_1wqc9_26";
2981
- const columnFilterSelect = "_columnFilterSelect_1wqc9_36";
2982
- const table = "_table_1wqc9_17";
2983
- const tableHeaderCell = "_tableHeaderCell_1wqc9_54";
2984
- const showSortIcon = "_showSortIcon_1wqc9_70";
2985
- const tableRow = "_tableRow_1wqc9_74";
2986
- const tableCell = "_tableCell_1wqc9_89";
2987
- const noDataTextContainer = "_noDataTextContainer_1wqc9_99";
2988
- const tableBottomContainer = "_tableBottomContainer_1wqc9_105";
2989
- const rowsPerPageContainer = "_rowsPerPageContainer_1wqc9_109";
2990
- const rowsPerPageText = "_rowsPerPageText_1wqc9_119";
2991
- const pageText = "_pageText_1wqc9_124";
2992
- const descriptionSecondLine = "_descriptionSecondLine_1wqc9_128";
3011
+ const disabled = "_disabled_5i91d_1";
3012
+ const outerTableContainer = "_outerTableContainer_5i91d_5";
3013
+ const headerContainer = "_headerContainer_5i91d_17";
3014
+ const tableTopContainer = "_tableTopContainer_5i91d_21";
3015
+ const tableContainer = "_tableContainer_5i91d_25";
3016
+ const searchContainer = "_searchContainer_5i91d_30";
3017
+ const columnFilterSelect = "_columnFilterSelect_5i91d_40";
3018
+ const table = "_table_5i91d_21";
3019
+ const tableHeaderCell = "_tableHeaderCell_5i91d_58";
3020
+ const showSortIcon = "_showSortIcon_5i91d_74";
3021
+ const tableRow = "_tableRow_5i91d_78";
3022
+ const tableCell = "_tableCell_5i91d_93";
3023
+ const noDataTextContainer = "_noDataTextContainer_5i91d_103";
3024
+ const tableBottomContainer = "_tableBottomContainer_5i91d_109";
3025
+ const rowsPerPageContainer = "_rowsPerPageContainer_5i91d_113";
3026
+ const rowsPerPageText = "_rowsPerPageText_5i91d_123";
3027
+ const pageText = "_pageText_5i91d_128";
3028
+ const descriptionSecondLine = "_descriptionSecondLine_5i91d_132";
2993
3029
  const styles$1 = {
3030
+ disabled,
2994
3031
  outerTableContainer,
2995
3032
  headerContainer,
2996
3033
  tableTopContainer,
@@ -3119,7 +3156,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3119
3156
  })
3120
3157
  )
3121
3158
  ).map((row) => {
3122
- const destructedRow = { ...row.columns, ...row };
3159
+ const destructedRow = { ...row.columns, ...row, disabled: row.disabled };
3123
3160
  const { columns: _, ...newRow } = destructedRow;
3124
3161
  return newRow;
3125
3162
  }),
@@ -3405,23 +3442,29 @@ const _Table = forwardRef(function Table2(props, ref) {
3405
3442
  Row,
3406
3443
  {
3407
3444
  item: row,
3408
- className: classNames(styles$1.tableRow, rowClassName, row.className),
3409
- onClick: row.onClick,
3445
+ className: classNames(styles$1.tableRow, rowClassName, row.className, {
3446
+ [styles$1.disabled]: row.disabled
3447
+ }),
3448
+ onClick: !row.disabled && row.onClick,
3410
3449
  children: [
3411
3450
  showSelect && /* @__PURE__ */ jsx(CellSelect, { item: row }, row.id),
3412
- columns.map((column, i) => /* @__PURE__ */ jsx(
3413
- Cell,
3414
- {
3415
- className: classNames(
3416
- styles$1.tableCell,
3417
- cellClassName,
3418
- row[column.id].className
3419
- ),
3420
- onClick: row[column.id].onClick,
3421
- children: /* @__PURE__ */ jsx(Text$1, { size: "2", children: row[column.id].label })
3422
- },
3423
- i
3424
- ))
3451
+ columns.map((column, i) => {
3452
+ const cell = row[column.id];
3453
+ return /* @__PURE__ */ jsx(
3454
+ Cell,
3455
+ {
3456
+ className: classNames(
3457
+ styles$1.tableCell,
3458
+ cellClassName,
3459
+ cell.className,
3460
+ { [styles$1.disabled]: cell.disabled || column.disabled }
3461
+ ),
3462
+ onClick: cell.disabled || column.disabled ? void 0 : row[column.id].onClick,
3463
+ children: cell.label
3464
+ },
3465
+ i
3466
+ );
3467
+ })
3425
3468
  ]
3426
3469
  },
3427
3470
  row.id
@@ -3573,7 +3616,7 @@ const _ConfirmEditInput = forwardRef(function ConfirmEditInput2({
3573
3616
  },
3574
3617
  [onCheckClick, onCancelClick, isConfirmDisabled, mode]
3575
3618
  );
3576
- return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props }) => /* @__PURE__ */ jsxs(Flex, { className: styles.editableTextContainer, gap: "3", ...props, children: [
3619
+ return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props }) => /* @__PURE__ */ jsxs(Flex, { className: styles.editableTextContainer, gap: "2", ...props, children: [
3577
3620
  /* @__PURE__ */ jsx(
3578
3621
  Input,
3579
3622
  {
@@ -3681,6 +3724,7 @@ export {
3681
3724
  LeftAndRightPanels,
3682
3725
  MultiPagePopover,
3683
3726
  MultiSelect,
3727
+ OvermapErrorBoundary,
3684
3728
  Popover,
3685
3729
  Root2 as Root,
3686
3730
  Select,