muffin-admin 8.3.0 → 8.4.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.
package/dist/buildRA.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ArrayField, ArrayInput, AutocompleteArrayInput, AutocompleteInput, BooleanField, BooleanInput, CheckboxGroupInput, ChipField, DateField, DateInput, DateTimeInput, EmailField, FileField, FileInput, ImageField, ImageInput, NullableBooleanInput, NumberField, NumberInput, PasswordInput, RadioButtonGroupInput, ReferenceArrayField, ReferenceArrayInput, ReferenceField, ReferenceInput, ReferenceManyField, required, RichTextField, SelectArrayInput, SelectField, SelectInput, TextField, TextInput, UrlField, } from "react-admin";
3
- import { AvatarField, EditableBooleanField, FKField, JsonField } from "./fields";
3
+ import { AvatarField, CopyField, EditableBooleanField, FKField, JsonField } from "./fields";
4
4
  import { FilterInput, FKInput, JsonInput, TimestampInput } from "./inputs";
5
5
  const UI = {
6
6
  // Fields
@@ -23,6 +23,7 @@ const UI = {
23
23
  EditableBooleanField,
24
24
  FKField,
25
25
  JsonField,
26
+ CopyField,
26
27
  // Inputs
27
28
  ArrayInput,
28
29
  AutocompleteArrayInput,
@@ -0,0 +1,3 @@
1
+ export declare function CopyButton({ value }: {
2
+ value: any;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import CopyIcon from "@mui/icons-material/FileCopy";
3
+ import { Snackbar } from "@mui/material";
4
+ import { useState } from "react";
5
+ export function CopyButton({ value }) {
6
+ const [open, setOpen] = useState(false);
7
+ const handleClick = (e) => {
8
+ setOpen(true);
9
+ navigator.clipboard.writeText(value);
10
+ e.stopPropagation();
11
+ };
12
+ return (_jsxs("span", { title: "Copy to clipboard", children: [_jsx(CopyIcon, { color: "info", fontSize: "small", onClick: handleClick, style: { cursor: "pointer" } }), _jsx(Snackbar, { open: open, autoHideDuration: 2000, onClose: () => setOpen(false), message: `Copied to clipboard: ${value}` })] }));
13
+ }
@@ -1,2 +1,3 @@
1
1
  export * from "./ActionButton";
2
+ export * from "./CopyButton";
2
3
  export * from "./LinkButton";
@@ -1,2 +1,3 @@
1
1
  export * from "./ActionButton";
2
+ export * from "./CopyButton";
2
3
  export * from "./LinkButton";
@@ -0,0 +1,4 @@
1
+ export declare function CopyField({ source, ...props }: {
2
+ [x: string]: any;
3
+ source: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import get from "lodash/get";
14
+ import { useRecordContext } from "react-admin";
15
+ import { CopyButton } from "../buttons";
16
+ export function CopyField(_a) {
17
+ var { source } = _a, props = __rest(_a, ["source"]);
18
+ const record = useRecordContext(props);
19
+ const value = get(record, source);
20
+ if (!value)
21
+ return null;
22
+ return (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [_jsx("span", { children: value }), _jsx(CopyButton, { value: value })] }));
23
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./AvatarField";
2
+ export * from "./CopyField";
2
3
  export * from "./EditableBooleanField";
3
4
  export * from "./FKField";
4
5
  export * from "./JsonField";
@@ -1,4 +1,5 @@
1
1
  export * from "./AvatarField";
2
+ export * from "./CopyField";
2
3
  export * from "./EditableBooleanField";
3
4
  export * from "./FKField";
4
5
  export * from "./JsonField";
package/dist/index.d.ts CHANGED
@@ -18,4 +18,4 @@ export * from "./fields";
18
18
  export * from "./hooks";
19
19
  export * from "./types";
20
20
  export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
21
- export declare const VERSION = "8.3.0";
21
+ export declare const VERSION = "8.4.1";
package/dist/index.js CHANGED
@@ -41,4 +41,4 @@ export function initAdmin() {
41
41
  root.render(_jsx(MuffinAdminContext.Provider, { value: adminOpts, children: _jsx(MuffinAdmin, {}) }));
42
42
  });
43
43
  }
44
- export const VERSION = "8.3.0";
44
+ export const VERSION = "8.4.1";