@compill/admin 1.0.94 → 1.0.98

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/index.cjs.js CHANGED
@@ -2076,6 +2076,7 @@ function ItemDeleteDialog(_a) {
2076
2076
  var {
2077
2077
  title,
2078
2078
  actionButtonLabel,
2079
+ closeActionButtonLabel = "Cancel",
2079
2080
  itemLabel,
2080
2081
  queryId = "",
2081
2082
  api: api$1,
@@ -2086,13 +2087,17 @@ function ItemDeleteDialog(_a) {
2086
2087
  md_boxSizing,
2087
2088
  msg,
2088
2089
  show,
2089
- onClose
2090
+ onClose,
2091
+ onSuccess
2090
2092
  } = _a,
2091
- props = tslib.__rest(_a, ["title", "actionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2093
+ props = tslib.__rest(_a, ["title", "actionButtonLabel", "closeActionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose", "onSuccess"]);
2092
2094
  const fn = apiFn ? api$1[apiFn] : api$1.delete;
2093
2095
  const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(fn, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey) : api.useApiMutation(fn, api$1.queryKey);
2094
2096
  const mutate = api.useMutate(mutation, {
2095
- onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
2097
+ onSuccess: () => {
2098
+ onClose === null || onClose === void 0 ? void 0 : onClose();
2099
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
2100
+ }
2096
2101
  });
2097
2102
  const handleDelete = React.useCallback(() => mutate(queryId), [mutate, queryId]);
2098
2103
  return jsxRuntime.jsxs(ui.Modal, Object.assign({
@@ -2113,19 +2118,19 @@ function ItemDeleteDialog(_a) {
2113
2118
  placeContent: "end",
2114
2119
  spaceX: "3",
2115
2120
  children: [jsxRuntime.jsx(ui.Button, {
2116
- disabled: mutation.isLoading,
2121
+ disabled: mutation.isPending,
2117
2122
  onClick: onClose,
2118
2123
  variant: "borderless",
2119
- scheme: "secondary",
2124
+ scheme: "dark",
2120
2125
  me: "2",
2121
- children: "Cancel"
2126
+ children: closeActionButtonLabel
2122
2127
  }), jsxRuntime.jsx(ui.Button, {
2123
2128
  scheme: "danger",
2124
- disabled: mutation.isLoading,
2129
+ disabled: mutation.isPending,
2125
2130
  onClick: handleDelete,
2126
2131
  children: actionButtonLabel || "Delete"
2127
2132
  })]
2128
- }), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
2133
+ }), mutation.isPending && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
2129
2134
  }));
2130
2135
  }
2131
2136
 
package/index.esm.js CHANGED
@@ -2074,6 +2074,7 @@ function ItemDeleteDialog(_a) {
2074
2074
  var {
2075
2075
  title,
2076
2076
  actionButtonLabel,
2077
+ closeActionButtonLabel = "Cancel",
2077
2078
  itemLabel,
2078
2079
  queryId = "",
2079
2080
  api,
@@ -2084,13 +2085,17 @@ function ItemDeleteDialog(_a) {
2084
2085
  md_boxSizing,
2085
2086
  msg,
2086
2087
  show,
2087
- onClose
2088
+ onClose,
2089
+ onSuccess
2088
2090
  } = _a,
2089
- props = __rest(_a, ["title", "actionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2091
+ props = __rest(_a, ["title", "actionButtonLabel", "closeActionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose", "onSuccess"]);
2090
2092
  const fn = apiFn ? api[apiFn] : api.delete;
2091
2093
  const mutation = invalidateQueriesOnSuccess ? useInvalidateParentMutation(fn, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api.queryKey) : useApiMutation(fn, api.queryKey);
2092
2094
  const mutate = useMutate(mutation, {
2093
- onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
2095
+ onSuccess: () => {
2096
+ onClose === null || onClose === void 0 ? void 0 : onClose();
2097
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
2098
+ }
2094
2099
  });
2095
2100
  const handleDelete = React.useCallback(() => mutate(queryId), [mutate, queryId]);
2096
2101
  return jsxs(Modal, Object.assign({
@@ -2111,19 +2116,19 @@ function ItemDeleteDialog(_a) {
2111
2116
  placeContent: "end",
2112
2117
  spaceX: "3",
2113
2118
  children: [jsx(Button, {
2114
- disabled: mutation.isLoading,
2119
+ disabled: mutation.isPending,
2115
2120
  onClick: onClose,
2116
2121
  variant: "borderless",
2117
- scheme: "secondary",
2122
+ scheme: "dark",
2118
2123
  me: "2",
2119
- children: "Cancel"
2124
+ children: closeActionButtonLabel
2120
2125
  }), jsx(Button, {
2121
2126
  scheme: "danger",
2122
- disabled: mutation.isLoading,
2127
+ disabled: mutation.isPending,
2123
2128
  onClick: handleDelete,
2124
2129
  children: actionButtonLabel || "Delete"
2125
2130
  })]
2126
- }), mutation.isLoading && jsx(ModalLoadingOverlay, {})]
2131
+ }), mutation.isPending && jsx(ModalLoadingOverlay, {})]
2127
2132
  }));
2128
2133
  }
2129
2134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.94",
3
+ "version": "1.0.98",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
@@ -10,6 +10,8 @@ export interface ItemDeleteDialogProps extends ModalProps {
10
10
  invalidateQueryKey?: string[];
11
11
  msg?: (itemLabel: string) => string | React.ReactNode;
12
12
  actionButtonLabel?: string;
13
+ closeActionButtonLabel?: string;
13
14
  title?: string;
15
+ onSuccess?: () => void;
14
16
  }
15
- export declare function ItemDeleteDialog({ title, actionButtonLabel, itemLabel, queryId, api, apiFn, invalidateQueriesOnSuccess, invalidateQueryKey, size, md_boxSizing, msg, show, onClose, ...props }: ItemDeleteDialogProps): JSX.Element;
17
+ export declare function ItemDeleteDialog({ title, actionButtonLabel, closeActionButtonLabel, itemLabel, queryId, api, apiFn, invalidateQueriesOnSuccess, invalidateQueryKey, size, md_boxSizing, msg, show, onClose, onSuccess, ...props }: ItemDeleteDialogProps): JSX.Element;