@firecms/core 3.0.0-canary.107 → 3.0.0-canary.109

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.
Files changed (48) hide show
  1. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/form/components/LabelWithIcon.d.ts +1 -1
  4. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  5. package/dist/form/components/index.d.ts +1 -0
  6. package/dist/index.es.js +287 -187
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/index.umd.js +286 -186
  9. package/dist/index.umd.js.map +1 -1
  10. package/package.json +5 -5
  11. package/src/app/Scaffold.tsx +13 -10
  12. package/src/components/ArrayContainer.tsx +9 -7
  13. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +3 -1
  14. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +1 -1
  15. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
  16. package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
  17. package/src/components/EntityPreview.tsx +2 -2
  18. package/src/components/PropertyIdCopyTooltip.tsx +48 -0
  19. package/src/components/SearchIconsView.tsx +2 -1
  20. package/src/components/index.tsx +1 -0
  21. package/src/core/DefaultAppBar.tsx +1 -1
  22. package/src/core/DrawerNavigationItem.tsx +28 -26
  23. package/src/core/EntityEditView.tsx +7 -13
  24. package/src/form/components/CustomIdField.tsx +4 -2
  25. package/src/form/components/FieldHelperText.tsx +1 -1
  26. package/src/form/components/LabelWithIcon.tsx +27 -19
  27. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  28. package/src/form/components/StorageItemPreview.tsx +1 -0
  29. package/src/form/components/StorageUploadProgress.tsx +0 -1
  30. package/src/form/components/index.tsx +1 -0
  31. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +7 -5
  32. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +18 -16
  33. package/src/form/field_bindings/BlockFieldBinding.tsx +7 -5
  34. package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
  35. package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -2
  36. package/src/form/field_bindings/MapFieldBinding.tsx +10 -16
  37. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +10 -8
  38. package/src/form/field_bindings/MultiSelectBinding.tsx +7 -5
  39. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +8 -6
  40. package/src/form/field_bindings/ReferenceFieldBinding.tsx +8 -5
  41. package/src/form/field_bindings/RepeatFieldBinding.tsx +7 -5
  42. package/src/form/field_bindings/SelectFieldBinding.tsx +44 -40
  43. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +7 -5
  44. package/src/form/field_bindings/SwitchFieldBinding.tsx +7 -3
  45. package/src/form/field_bindings/TextFieldBinding.tsx +24 -22
  46. package/src/preview/components/ImagePreview.tsx +3 -1
  47. package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
  48. package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from "react";
2
2
 
3
3
  import { Field, useFormex } from "@firecms/formex";
4
4
 
5
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
5
+ import { FieldHelperText, FormikArrayContainer, LabelWithIconAndTooltip } from "../components";
6
6
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
7
7
  import { EnumValuesChip } from "../../preview";
8
8
  import { FieldProps, FormContext, PropertyFieldBindingProps, PropertyOrBuilder } from "../../types";
@@ -61,10 +61,12 @@ export function BlockFieldBinding<T extends Array<any>>({
61
61
  }, [context, lastAddedId, property.oneOf, propertyKey, value]);
62
62
 
63
63
  const title = (
64
- <LabelWithIcon icon={getIconForProperty(property, "small")}
65
- required={property.validation?.required}
66
- title={property.name}
67
- className={"text-text-secondary dark:text-text-secondary-dark"}/>
64
+ <LabelWithIconAndTooltip
65
+ propertyKey={propertyKey}
66
+ icon={getIconForProperty(property, "small")}
67
+ required={property.validation?.required}
68
+ title={property.name}
69
+ className={"text-text-secondary dark:text-text-secondary-dark"}/>
68
70
  );
69
71
 
70
72
  const firstOneOfKey = Object.keys(property.oneOf.properties)[0];
@@ -7,6 +7,7 @@ import { useCustomizationController } from "../../hooks";
7
7
  import { getIconForProperty } from "../../util";
8
8
  import { DateTimeField } from "@firecms/ui";
9
9
  import { useClearRestoreValue } from "../useClearRestoreValue";
10
+ import { PropertyIdCopyTooltip } from "../../components";
10
11
 
11
12
  type DateTimeFieldProps = FieldProps<Date>;
12
13
 
@@ -41,20 +42,22 @@ export function DateTimeFieldBinding({
41
42
 
42
43
  return (
43
44
  <>
44
- <DateTimeField
45
- value={internalValue}
46
- onChange={(dateValue) => setValue(dateValue)}
47
- size={"medium"}
48
- mode={property.mode}
49
- clearable={property.clearable}
50
- locale={locale}
51
- error={showError}
52
- label={<LabelWithIcon
53
- icon={getIconForProperty(property, "small")}
54
- required={property.validation?.required}
55
- className={showError ? "text-red-500 dark:text-red-500" : "text-text-secondary dark:text-text-secondary-dark"}
56
- title={property.name}/>}
57
- />
45
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
46
+ <DateTimeField
47
+ value={internalValue}
48
+ onChange={(dateValue) => setValue(dateValue)}
49
+ size={"medium"}
50
+ mode={property.mode}
51
+ clearable={property.clearable}
52
+ locale={locale}
53
+ error={showError}
54
+ label={<LabelWithIcon
55
+ icon={getIconForProperty(property, "small")}
56
+ required={property.validation?.required}
57
+ className={showError ? "text-red-500 dark:text-red-500" : "text-text-secondary dark:text-text-secondary-dark"}
58
+ title={property.name}/>}
59
+ />
60
+ </PropertyIdCopyTooltip>
58
61
 
59
62
  <FieldHelperText includeDescription={includeDescription}
60
63
  showError={showError}
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
2
2
  import { DataType, FieldProps, GeoPoint } from "../../types";
3
3
 
4
4
  import { ArrayContainer } from "../../components";
5
- import { FieldHelperText, LabelWithIcon } from "../components";
5
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
6
6
  import {
7
7
  AddIcon,
8
8
  ArrowDropDownIcon,
@@ -62,7 +62,8 @@ export function KeyValueFieldBinding({
62
62
  initialValue={initialValues}
63
63
  fieldName={property.name ?? propertyKey}/>;
64
64
 
65
- const title = <LabelWithIcon
65
+ const title = <LabelWithIconAndTooltip
66
+ propertyKey={propertyKey}
66
67
  icon={getIconForProperty(property, "small")}
67
68
  required={property.validation?.required}
68
69
  title={property.name}
@@ -1,17 +1,9 @@
1
1
  import React from "react";
2
- import {
3
- CMSType,
4
- FieldProps,
5
- FormContext,
6
- MapProperty,
7
- Properties,
8
- ResolvedProperties,
9
- ResolvedProperty
10
- } from "../../types";
2
+ import { FieldProps, Properties, ResolvedProperties } from "../../types";
11
3
 
12
4
  import { ErrorBoundary } from "../../components";
13
5
  import { getIconForProperty, isHidden, pick } from "../../util";
14
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
15
7
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
16
8
  import { ExpandablePanel, InputLabel, Select, SelectItem } from "@firecms/ui";
17
9
 
@@ -91,18 +83,20 @@ export function MapFieldBinding({
91
83
  </>;
92
84
 
93
85
  const title = (
94
- <LabelWithIcon icon={getIconForProperty(property, "small")}
95
- required={property.validation?.required}
96
- title={property.name}
97
- className={"text-text-secondary dark:text-text-secondary-dark"}/>
86
+ <LabelWithIconAndTooltip
87
+ propertyKey={propertyKey}
88
+ icon={getIconForProperty(property, "small")}
89
+ required={property.validation?.required}
90
+ title={property.name}
91
+ className={"text-text-secondary dark:text-text-secondary-dark"}/>
98
92
  );
99
93
 
100
94
  return (
101
95
  <ErrorBoundary>
102
96
 
103
97
  {!minimalistView && !minimalistView && <ExpandablePanel initiallyExpanded={expanded}
104
- className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-slate-50 bg-opacity-50 dark:bg-gray-900"}
105
- title={title}>{mapFormView}</ExpandablePanel>}
98
+ className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-slate-50 bg-opacity-50 dark:bg-gray-900"}
99
+ title={title}>{mapFormView}</ExpandablePanel>}
106
100
 
107
101
  {(minimalistView || minimalistView) && mapFormView}
108
102
 
@@ -2,11 +2,11 @@ import {
2
2
  FieldHelperText,
3
3
  FieldProps,
4
4
  getIconForProperty,
5
- LabelWithIcon,
5
+ LabelWithIconAndTooltip,
6
6
  randomString,
7
7
  useStorageSource
8
8
  } from "../../index";
9
- import { Paper } from "@firecms/ui";
9
+ import { cls, fieldBackgroundHoverMixin, fieldBackgroundMixin } from "@firecms/ui";
10
10
  import { FireCMSEditor } from "@firecms/editor";
11
11
  import React, { useCallback, useEffect, useRef, useState } from "react";
12
12
  import { resolveStorageFilenameString, resolveStoragePathString } from "../../util/storage";
@@ -115,13 +115,15 @@ export function MarkdownEditorFieldBinding({
115
115
 
116
116
  return (
117
117
  <>
118
- <LabelWithIcon icon={getIconForProperty(property, "small")}
119
- required={property.validation?.required}
120
- title={property.name}
121
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
122
- <Paper>
118
+ <LabelWithIconAndTooltip
119
+ propertyKey={propertyKey}
120
+ icon={getIconForProperty(property, "small")}
121
+ required={property.validation?.required}
122
+ title={property.name}
123
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
124
+ <div className={cls("rounded-md", fieldBackgroundMixin, fieldBackgroundHoverMixin)}>
123
125
  {editor}
124
- </Paper>
126
+ </div>
125
127
  <FieldHelperText includeDescription={includeDescription}
126
128
  showError={showError}
127
129
  error={error}
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
3
  import { EnumType, FieldProps, ResolvedProperty } from "../../types";
4
- import { FieldHelperText, LabelWithIcon } from "../components";
4
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
5
5
  import { EnumValuesChip } from "../../preview";
6
6
  import { enumToObjectEntries, getIconForProperty, getLabelOrConfigFrom } from "../../util";
7
7
  import { CloseIcon, MultiSelect, MultiSelectItem } from "@firecms/ui";
@@ -85,10 +85,12 @@ export function MultiSelectBinding({
85
85
  size={size === "medium" ? "medium" : "small"}
86
86
  value={validValue ? value.map((v) => v.toString()) : []}
87
87
  disabled={disabled}
88
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
89
- required={property.validation?.required}
90
- title={property.name}
91
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
88
+ label={<LabelWithIconAndTooltip
89
+ propertyKey={propertyKey}
90
+ icon={getIconForProperty(property, "small")}
91
+ required={property.validation?.required}
92
+ title={property.name}
93
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
92
94
  renderValue={useCallback((v: string) => renderValue(v, false), [renderValue])}
93
95
  onMultiValueChange={(updatedValue: string[]) => {
94
96
  let newValue: EnumType[] | null;
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
 
3
- import { Entity, FieldProps } from "../../types";
3
+ import { FieldProps } from "../../types";
4
4
 
5
5
  import { PropertyPreview } from "../../preview";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
  import { ErrorBoundary } from "../../components";
8
8
  import { getIconForProperty } from "../../util";
9
9
  import { cls, paperMixin } from "@firecms/ui";
@@ -34,10 +34,12 @@ export function ReadOnlyFieldBinding({
34
34
 
35
35
  <>
36
36
 
37
- {!minimalistView && <LabelWithIcon icon={getIconForProperty(property, "small")}
38
- required={property.validation?.required}
39
- title={property.name}
40
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
37
+ {!minimalistView && <LabelWithIconAndTooltip
38
+ propertyKey={propertyKey}
39
+ icon={getIconForProperty(property, "small")}
40
+ required={property.validation?.required}
41
+ title={property.name}
42
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
41
43
  }
42
44
 
43
45
  <div
@@ -3,7 +3,7 @@ import React, { useCallback, useMemo } from "react";
3
3
  import { Entity, EntityCollection, EntityReference, FieldProps } from "../../types";
4
4
  import { useNavigationController, useReferenceDialog } from "../../hooks";
5
5
  import { ReadOnlyFieldBinding } from "./ReadOnlyFieldBinding";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
  import { ErrorView } from "../../components";
8
8
  import { EmptyValue, ReferencePreview } from "../../preview";
9
9
  import { getIconForProperty, getReferenceFrom } from "../../util";
@@ -29,6 +29,7 @@ export function ReferenceFieldBinding<M extends Record<string, any>>(props: Fiel
29
29
  }
30
30
 
31
31
  function ReferenceFieldBindingInternal({
32
+ propertyKey,
32
33
  value,
33
34
  setValue,
34
35
  error,
@@ -84,10 +85,12 @@ function ReferenceFieldBindingInternal({
84
85
 
85
86
  return (
86
87
  <>
87
- {!minimalistView && <LabelWithIcon icon={getIconForProperty(property, "small")}
88
- required={property.validation?.required}
89
- title={property.name}
90
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
88
+ {!minimalistView && <LabelWithIconAndTooltip
89
+ propertyKey={propertyKey}
90
+ icon={getIconForProperty(property, "small")}
91
+ required={property.validation?.required}
92
+ title={property.name}
93
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
91
94
 
92
95
  {!collection && <ErrorView
93
96
  error={"The specified collection does not exist. Check console"}/>}
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from "react";
2
2
  import { CMSType, FieldProps, ResolvedProperty } from "../../types";
3
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
3
+ import { FieldHelperText, FormikArrayContainer, LabelWithIconAndTooltip } from "../components";
4
4
  import { ErrorBoundary } from "../../components";
5
5
  import { getDefaultValueFor, getIconForProperty } from "../../util";
6
6
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
@@ -77,10 +77,12 @@ export function RepeatFieldBinding<T extends Array<any>>({
77
77
  newDefaultEntry={getDefaultValueFor(property.of)}/>;
78
78
 
79
79
  const title = (<>
80
- <LabelWithIcon icon={getIconForProperty(property, "small")}
81
- required={property.validation?.required}
82
- title={property.name}
83
- className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
80
+ <LabelWithIconAndTooltip
81
+ propertyKey={propertyKey}
82
+ icon={getIconForProperty(property, "small")}
83
+ required={property.validation?.required}
84
+ title={property.name}
85
+ className={"flex flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
84
86
  {Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
85
87
  </>);
86
88
 
@@ -6,6 +6,7 @@ import { EnumValuesChip } from "../../preview";
6
6
  import { getIconForProperty } from "../../util";
7
7
  import { ClearIcon, cls, IconButton, Select, SelectItem } from "@firecms/ui";
8
8
  import { useClearRestoreValue } from "../useClearRestoreValue";
9
+ import { PropertyIdCopyTooltip } from "../../components";
9
10
 
10
11
  type SelectProps<T extends EnumType> = FieldProps<T>;
11
12
 
@@ -48,47 +49,50 @@ export function SelectFieldBinding<T extends EnumType>({
48
49
  return (
49
50
  <>
50
51
 
51
- <Select
52
- size={size === "medium" ? "medium" : "small"}
53
- value={value !== undefined && value != null ? value.toString() : ""}
54
- disabled={disabled}
55
- position="item-aligned"
56
- inputClassName={cls("w-full")}
57
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
58
- required={property.validation?.required}
59
- title={property.name}
60
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}
61
- />}
62
- endAdornment={
63
- property.clearable && <IconButton
64
- onClick={handleClearClick}>
65
- <ClearIcon/>
66
- </IconButton>
67
- }
68
- onValueChange={(updatedValue: string) => {
69
- const newValue = updatedValue
70
- ? (property.dataType === "number" ? parseFloat(updatedValue) : updatedValue)
71
- : null;
72
- return setValue(newValue as T);
73
- }}
74
- renderValue={(enumKey: any) => {
75
- return <EnumValuesChip
76
- enumKey={enumKey}
77
- enumValues={enumValues}
78
- size={size}/>;
79
- }}
80
- >
81
- {enumValues && enumValues.map((option) => {
82
- return <SelectItem
83
- key={option.id}
84
- value={String(option.id)}>
85
- <EnumValuesChip
86
- enumKey={String(option.id)}
52
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
53
+ <Select
54
+ size={size === "medium" ? "medium" : "small"}
55
+ value={value !== undefined && value != null ? value.toString() : ""}
56
+ disabled={disabled}
57
+ position="item-aligned"
58
+ inputClassName={cls("w-full")}
59
+ label={<LabelWithIcon
60
+ icon={getIconForProperty(property, "small")}
61
+ required={property.validation?.required}
62
+ title={property.name}
63
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}
64
+ />}
65
+ endAdornment={
66
+ property.clearable && <IconButton
67
+ onClick={handleClearClick}>
68
+ <ClearIcon/>
69
+ </IconButton>
70
+ }
71
+ onValueChange={(updatedValue: string) => {
72
+ const newValue = updatedValue
73
+ ? (property.dataType === "number" ? parseFloat(updatedValue) : updatedValue)
74
+ : null;
75
+ return setValue(newValue as T);
76
+ }}
77
+ renderValue={(enumKey: any) => {
78
+ return <EnumValuesChip
79
+ enumKey={enumKey}
87
80
  enumValues={enumValues}
88
- size={size}/>
89
- </SelectItem>
90
- })}
91
- </Select>
81
+ size={size}/>;
82
+ }}
83
+ >
84
+ {enumValues && enumValues.map((option) => {
85
+ return <SelectItem
86
+ key={option.id}
87
+ value={String(option.id)}>
88
+ <EnumValuesChip
89
+ enumKey={String(option.id)}
90
+ enumValues={enumValues}
91
+ size={size}/>
92
+ </SelectItem>
93
+ })}
94
+ </Select>
95
+ </PropertyIdCopyTooltip>
92
96
 
93
97
  <FieldHelperText includeDescription={includeDescription}
94
98
  showError={showError}
@@ -3,7 +3,7 @@ import React, { useCallback } from "react";
3
3
  import { ArrayProperty, FieldProps, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig } from "../../types";
4
4
  import { useDropzone } from "react-dropzone";
5
5
  import { PreviewSize } from "../../preview";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
 
8
8
  import { getIconForProperty, isReadOnly } from "../../util";
9
9
  import { useSnackbarController, useStorageSource } from "../../hooks";
@@ -88,10 +88,12 @@ export function StorageUploadFieldBinding({
88
88
  <>
89
89
 
90
90
  {!minimalistView &&
91
- <LabelWithIcon icon={getIconForProperty(property, "small")}
92
- required={property.validation?.required}
93
- title={property.name}
94
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
91
+ <LabelWithIconAndTooltip
92
+ propertyKey={propertyKey}
93
+ icon={getIconForProperty(property, "small")}
94
+ required={property.validation?.required}
95
+ title={property.name}
96
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
95
97
 
96
98
  <StorageUpload
97
99
  value={internalValue}
@@ -5,6 +5,7 @@ import { getIconForProperty } from "../../util";
5
5
  import { FieldHelperText, LabelWithIcon } from "../components";
6
6
  import { BooleanSwitchWithLabel } from "@firecms/ui";
7
7
  import { useClearRestoreValue } from "../useClearRestoreValue";
8
+ import { PropertyIdCopyTooltip } from "../../components";
8
9
 
9
10
  type SwitchFieldProps = FieldProps<boolean>;
10
11
 
@@ -37,17 +38,20 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
37
38
  return (
38
39
  <>
39
40
 
41
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
40
42
  <BooleanSwitchWithLabel
41
43
  value={value}
42
44
  onValueChange={(v) => setValue(v)}
43
45
  error={showError}
44
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
45
- required={property.validation?.required}
46
- title={property.name}/>}
46
+ label={<LabelWithIcon
47
+ icon={getIconForProperty(property, "small")}
48
+ required={property.validation?.required}
49
+ title={property.name}/>}
47
50
  disabled={disabled}
48
51
  autoFocus={autoFocus}
49
52
  size={size}
50
53
  />
54
+ </PropertyIdCopyTooltip>
51
55
 
52
56
  <FieldHelperText includeDescription={includeDescription}
53
57
  showError={showError}
@@ -6,6 +6,7 @@ import { FieldHelperText, LabelWithIcon } from "../components";
6
6
  import { getIconForProperty } from "../../util";
7
7
  import { PropertyPreview } from "../../preview";
8
8
  import { useClearRestoreValue } from "../useClearRestoreValue";
9
+ import { PropertyIdCopyTooltip } from "../../components/PropertyIdCopyTooltip";
9
10
 
10
11
  interface TextFieldBindingProps<T extends string | number> extends FieldProps<T> {
11
12
  allowInfinity?: boolean
@@ -68,28 +69,29 @@ export function TextFieldBinding<T extends string | number>({
68
69
  const isMultiline = Boolean(multiline);
69
70
 
70
71
  const inputType = property.dataType === "number" ? "number" : undefined;
71
- return (
72
- <>
73
- <TextField
74
- size={size}
75
- value={value}
76
- onChange={onChange}
77
- autoFocus={autoFocus}
78
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
79
- required={property.validation?.required}
80
- title={property.name}/>}
81
- type={inputType}
82
- multiline={isMultiline}
83
- disabled={disabled}
84
- endAdornment={
85
- property.clearable && <IconButton
86
- onClick={handleClearClick}>
87
- <ClearIcon/>
88
- </IconButton>
89
- }
90
- error={showError ? error : undefined}
91
- inputClassName={error ? "text-red-500 dark:text-red-600" : ""}/>
92
-
72
+ return (<>
73
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
74
+ <TextField
75
+ size={size}
76
+ value={value}
77
+ onChange={onChange}
78
+ autoFocus={autoFocus}
79
+ label={<LabelWithIcon
80
+ icon={getIconForProperty(property, "small")}
81
+ required={property.validation?.required}
82
+ title={property.name}/>}
83
+ type={inputType}
84
+ multiline={isMultiline}
85
+ disabled={disabled}
86
+ endAdornment={
87
+ property.clearable && <IconButton
88
+ onClick={handleClearClick}>
89
+ <ClearIcon/>
90
+ </IconButton>
91
+ }
92
+ error={showError ? error : undefined}
93
+ inputClassName={error ? "text-red-500 dark:text-red-600" : ""}/>
94
+ </PropertyIdCopyTooltip>
93
95
  <FieldHelperText includeDescription={includeDescription}
94
96
  showError={showError}
95
97
  error={error}
@@ -58,7 +58,9 @@ export function ImagePreview({
58
58
 
59
59
 
60
60
  <div className={"flex flex-row gap-2 absolute bottom-[-4px] right-[-4px] invisible group-hover:visible"}>
61
- {navigator && <Tooltip title="Copy url to clipboard" side={"bottom"}>
61
+ {navigator && <Tooltip
62
+ asChild={true}
63
+ title="Copy url to clipboard" side={"bottom"}>
62
64
  <IconButton
63
65
  variant={"filled"}
64
66
  size={"small"}
@@ -1,3 +0,0 @@
1
- export declare function PropertyIdCopyTooltipContent({ propertyId }: {
2
- propertyId: string;
3
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +0,0 @@
1
- import { ContentCopyIcon, IconButton, Typography } from "@firecms/ui";
2
- import { useCallback, useState } from "react";
3
-
4
- export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: string }) {
5
-
6
- const [copied, setCopied] = useState(false);
7
-
8
- return (
9
- <div className={"flex flex-row gap-2 items-center justify-center text-white"}>
10
- <div>
11
- <Typography variant={"caption"} className={"min-w-20 text-slate-400"}
12
- color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
13
- <Typography variant={"caption"} className={"text-white"}><code>{propertyId}</code></Typography>
14
- </div>
15
- <IconButton size={"small"}>
16
- <ContentCopyIcon size={"smallest"}
17
- className={"text-white"}
18
- onClick={useCallback(() => {
19
- navigator.clipboard.writeText(propertyId);
20
- setCopied(true);
21
- setTimeout(() => setCopied(false), 2000);
22
- }, [propertyId])}
23
- />
24
- </IconButton>
25
- </div>
26
- );
27
- }