tinacms 2.2.0 → 2.2.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/index.js CHANGED
@@ -2745,13 +2745,13 @@ var __publicField = (obj, key, value) => {
2745
2745
  {
2746
2746
  type: "string",
2747
2747
  label: "Alt",
2748
- name: [templateName, "alt"].join("."),
2748
+ name: [templateName.replace(/\.props$/, ""), "alt"].join("."),
2749
2749
  component: "text"
2750
2750
  },
2751
2751
  {
2752
2752
  type: "string",
2753
2753
  label: "Caption",
2754
- name: [templateName, "caption"].join("."),
2754
+ name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
2755
2755
  component: "text"
2756
2756
  }
2757
2757
  ]
@@ -4520,7 +4520,7 @@ var __publicField = (obj, key, value) => {
4520
4520
  side: "bottom",
4521
4521
  className: cn(
4522
4522
  "rounded-md border bg-white p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
4523
- "max-h-[30vh] overflow-y-auto",
4523
+ "max-h-[30vh] max-w-[30vh] overflow-y-auto",
4524
4524
  className
4525
4525
  ),
4526
4526
  ...props
@@ -4549,6 +4549,7 @@ var __publicField = (obj, key, value) => {
4549
4549
  _values
4550
4550
  _internalSys: _sys {
4551
4551
  filename
4552
+ path
4552
4553
  }
4553
4554
  }
4554
4555
  }
@@ -4619,7 +4620,7 @@ var __publicField = (obj, key, value) => {
4619
4620
  Command,
4620
4621
  {
4621
4622
  filter: (value2, search) => {
4622
- if (value2.includes(search))
4623
+ if (value2.toLowerCase().replace(/\//g, "").includes(search.toLowerCase()))
4623
4624
  return 1;
4624
4625
  return 0;
4625
4626
  }
@@ -4632,26 +4633,26 @@ var __publicField = (obj, key, value) => {
4632
4633
  key: `${collection}-group`,
4633
4634
  heading: collection
4634
4635
  },
4635
- /* @__PURE__ */ React__namespace.createElement(CommandList, null, edges.map(
4636
- ({
4637
- node: {
4638
- id,
4639
- _internalSys: { filename },
4640
- _values: { title, name }
4641
- }
4642
- }) => /* @__PURE__ */ React__namespace.createElement(
4636
+ /* @__PURE__ */ React__namespace.createElement(CommandList, null, edges.map(({ node }) => {
4637
+ const { id, _values } = node;
4638
+ return /* @__PURE__ */ React__namespace.createElement(
4643
4639
  CommandItem,
4644
4640
  {
4645
4641
  key: `${id}-option`,
4646
- value: id || title,
4647
- onSelect: () => {
4648
- setValue(id);
4642
+ value: id,
4643
+ onSelect: (currentValue) => {
4644
+ setValue(
4645
+ currentValue === value ? "" : currentValue
4646
+ );
4649
4647
  setOpen(false);
4650
4648
  }
4651
4649
  },
4652
- /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React__namespace.createElement("span", { className: "font-semibold text-sm" }, title || name || id), (title || name) && /* @__PURE__ */ React__namespace.createElement("span", { className: "text-x" }, filename))
4653
- )
4654
- ))
4650
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React__namespace.createElement("div", null, (field == null ? void 0 : field.optionComponent) && _values ? field.optionComponent(
4651
+ _values,
4652
+ node._internalSys
4653
+ ) : /* @__PURE__ */ React__namespace.createElement("span", { className: "text-x" }, id)))
4654
+ );
4655
+ }))
4655
4656
  )))
4656
4657
  ))));
4657
4658
  };
@@ -5814,19 +5815,17 @@ var __publicField = (obj, key, value) => {
5814
5815
  return "Required";
5815
5816
  }
5816
5817
  };
5817
- const TextareaField = wrapFieldsWithMeta(
5818
- (props) => {
5819
- const ref = React__namespace.useRef(null);
5820
- React__namespace.useEffect(() => {
5821
- if (ref.current && props.field.experimental_focusIntent) {
5822
- const el = ref.current;
5823
- el.focus();
5824
- el.setSelectionRange(el.value.length, el.value.length);
5825
- }
5826
- }, [props.field.experimental_focusIntent, ref]);
5827
- return /* @__PURE__ */ React__namespace.createElement(TextArea, { ref, ...props.input });
5828
- }
5829
- );
5818
+ const TextareaField = wrapFieldsWithMeta((props) => {
5819
+ const ref = React__namespace.useRef(null);
5820
+ React__namespace.useEffect(() => {
5821
+ if (ref.current && props.field.experimental_focusIntent) {
5822
+ const el = ref.current;
5823
+ el.focus();
5824
+ el.setSelectionRange(el.value.length, el.value.length);
5825
+ }
5826
+ }, [props.field.experimental_focusIntent, ref]);
5827
+ return /* @__PURE__ */ React__namespace.createElement(TextArea, { ref, ...props.input });
5828
+ });
5830
5829
  const TextareaFieldPlugin = {
5831
5830
  name: "textarea",
5832
5831
  Component: TextareaField,
@@ -32576,7 +32575,6 @@ This will work when developing locally but NOT when deployed to production.
32576
32575
  exports2.TextArea = TextArea;
32577
32576
  exports2.TextField = TextField;
32578
32577
  exports2.TextFieldPlugin = TextFieldPlugin;
32579
- exports2.TextareaField = TextareaField;
32580
32578
  exports2.TextareaFieldPlugin = TextareaFieldPlugin;
32581
32579
  exports2.Tina = Tina;
32582
32580
  exports2.TinaAdmin = TinaAdmin;
package/dist/index.mjs CHANGED
@@ -2768,13 +2768,13 @@ class Form {
2768
2768
  {
2769
2769
  type: "string",
2770
2770
  label: "Alt",
2771
- name: [templateName, "alt"].join("."),
2771
+ name: [templateName.replace(/\.props$/, ""), "alt"].join("."),
2772
2772
  component: "text"
2773
2773
  },
2774
2774
  {
2775
2775
  type: "string",
2776
2776
  label: "Caption",
2777
- name: [templateName, "caption"].join("."),
2777
+ name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
2778
2778
  component: "text"
2779
2779
  }
2780
2780
  ]
@@ -4543,7 +4543,7 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
4543
4543
  side: "bottom",
4544
4544
  className: cn(
4545
4545
  "rounded-md border bg-white p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
4546
- "max-h-[30vh] overflow-y-auto",
4546
+ "max-h-[30vh] max-w-[30vh] overflow-y-auto",
4547
4547
  className
4548
4548
  ),
4549
4549
  ...props
@@ -4572,6 +4572,7 @@ const useGetOptionSets = (cms, collections) => {
4572
4572
  _values
4573
4573
  _internalSys: _sys {
4574
4574
  filename
4575
+ path
4575
4576
  }
4576
4577
  }
4577
4578
  }
@@ -4642,7 +4643,7 @@ const ComboboxDemo = ({
4642
4643
  Command,
4643
4644
  {
4644
4645
  filter: (value2, search) => {
4645
- if (value2.includes(search))
4646
+ if (value2.toLowerCase().replace(/\//g, "").includes(search.toLowerCase()))
4646
4647
  return 1;
4647
4648
  return 0;
4648
4649
  }
@@ -4655,26 +4656,26 @@ const ComboboxDemo = ({
4655
4656
  key: `${collection}-group`,
4656
4657
  heading: collection
4657
4658
  },
4658
- /* @__PURE__ */ React.createElement(CommandList, null, edges.map(
4659
- ({
4660
- node: {
4661
- id,
4662
- _internalSys: { filename },
4663
- _values: { title, name }
4664
- }
4665
- }) => /* @__PURE__ */ React.createElement(
4659
+ /* @__PURE__ */ React.createElement(CommandList, null, edges.map(({ node }) => {
4660
+ const { id, _values } = node;
4661
+ return /* @__PURE__ */ React.createElement(
4666
4662
  CommandItem,
4667
4663
  {
4668
4664
  key: `${id}-option`,
4669
- value: id || title,
4670
- onSelect: () => {
4671
- setValue(id);
4665
+ value: id,
4666
+ onSelect: (currentValue) => {
4667
+ setValue(
4668
+ currentValue === value ? "" : currentValue
4669
+ );
4672
4670
  setOpen(false);
4673
4671
  }
4674
4672
  },
4675
- /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold text-sm" }, title || name || id), (title || name) && /* @__PURE__ */ React.createElement("span", { className: "text-x" }, filename))
4676
- )
4677
- ))
4673
+ /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("div", null, (field == null ? void 0 : field.optionComponent) && _values ? field.optionComponent(
4674
+ _values,
4675
+ node._internalSys
4676
+ ) : /* @__PURE__ */ React.createElement("span", { className: "text-x" }, id)))
4677
+ );
4678
+ }))
4678
4679
  )))
4679
4680
  ))));
4680
4681
  };
@@ -5837,19 +5838,17 @@ const RadioGroupFieldPlugin = {
5837
5838
  return "Required";
5838
5839
  }
5839
5840
  };
5840
- const TextareaField = wrapFieldsWithMeta(
5841
- (props) => {
5842
- const ref = React.useRef(null);
5843
- React.useEffect(() => {
5844
- if (ref.current && props.field.experimental_focusIntent) {
5845
- const el = ref.current;
5846
- el.focus();
5847
- el.setSelectionRange(el.value.length, el.value.length);
5848
- }
5849
- }, [props.field.experimental_focusIntent, ref]);
5850
- return /* @__PURE__ */ React.createElement(TextArea, { ref, ...props.input });
5851
- }
5852
- );
5841
+ const TextareaField = wrapFieldsWithMeta((props) => {
5842
+ const ref = React.useRef(null);
5843
+ React.useEffect(() => {
5844
+ if (ref.current && props.field.experimental_focusIntent) {
5845
+ const el = ref.current;
5846
+ el.focus();
5847
+ el.setSelectionRange(el.value.length, el.value.length);
5848
+ }
5849
+ }, [props.field.experimental_focusIntent, ref]);
5850
+ return /* @__PURE__ */ React.createElement(TextArea, { ref, ...props.input });
5851
+ });
5853
5852
  const TextareaFieldPlugin = {
5854
5853
  name: "textarea",
5855
5854
  Component: TextareaField,
@@ -32593,7 +32592,6 @@ export {
32593
32592
  TextArea,
32594
32593
  TextField,
32595
32594
  TextFieldPlugin,
32596
- TextareaField,
32597
32595
  TextareaFieldPlugin,
32598
32596
  Tina,
32599
32597
  TinaAdmin,
@@ -104,7 +104,7 @@
104
104
  const Component2 = components[child.type];
105
105
  return /* @__PURE__ */ React.createElement(Component2, { ...props });
106
106
  }
107
- return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.caption });
107
+ return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
108
108
  case "a":
109
109
  if (components[child.type]) {
110
110
  const Component2 = components[child.type];
@@ -101,7 +101,7 @@ const Node = ({ components, child }) => {
101
101
  const Component2 = components[child.type];
102
102
  return /* @__PURE__ */ React.createElement(Component2, { ...props });
103
103
  }
104
- return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.caption });
104
+ return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
105
105
  case "a":
106
106
  if (components[child.type]) {
107
107
  const Component2 = components[child.type];
@@ -3,12 +3,18 @@ type Option = {
3
3
  value: string;
4
4
  label: string;
5
5
  };
6
+ type OptionComponent = (props: unknown, _sys: InternalSys) => React.ReactElement | string;
7
+ export interface InternalSys {
8
+ filename: string;
9
+ path: string;
10
+ }
6
11
  export interface ReferenceFieldProps {
7
12
  label?: string;
8
13
  name: string;
9
14
  component: string;
10
15
  collections: string[];
11
16
  options: (Option | string)[];
17
+ optionComponent: OptionComponent;
12
18
  }
13
19
  export interface ReferenceProps {
14
20
  name: string;
@@ -1,8 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { InputProps } from '../components';
3
- export declare const TextareaField: (props: import("./wrap-field-with-meta").InputFieldType<{
4
- input: InputProps;
5
- }, {}>) => React.JSX.Element;
6
3
  export declare const TextareaFieldPlugin: {
7
4
  name: string;
8
5
  Component: (props: import("./wrap-field-with-meta").InputFieldType<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -117,9 +117,9 @@
117
117
  "clsx": "^2.1.1",
118
118
  "yup": "^1.4.0",
119
119
  "zod": "^3.23.8",
120
- "@tinacms/mdx": "1.4.0",
121
- "@tinacms/schema-tools": "1.6.0",
122
- "@tinacms/search": "1.0.26"
120
+ "@tinacms/mdx": "1.4.1",
121
+ "@tinacms/schema-tools": "1.6.1",
122
+ "@tinacms/search": "1.0.27"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@graphql-tools/utils": "^10.3.3",