@tinacms/app 0.0.18 → 0.0.20

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 (2) hide show
  1. package/dist/assets/out.es.js +162 -22
  2. package/package.json +3 -3
@@ -82062,13 +82062,13 @@ const ModalLayout = ({
82062
82062
  });
82063
82063
  };
82064
82064
  const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded-md";
82065
- const disabledClasses = "bg-gray-100 pointer-events-none opacity-30 cursor-not-allowed";
82065
+ const disabledClasses = "opacity-50 pointer-events-none cursor-not-allowed";
82066
82066
  const BaseTextField = ({
82067
82067
  ...props
82068
82068
  }) => {
82069
82069
  return /* @__PURE__ */ jsx$1("input", {
82070
82070
  type: "text",
82071
- className: `${textFieldClasses}${(props == null ? void 0 : props.disabled) ? disabledClasses : ""}`,
82071
+ className: `${textFieldClasses} ${(props == null ? void 0 : props.disabled) ? disabledClasses : ""}`,
82072
82072
  ...props
82073
82073
  });
82074
82074
  };
@@ -82215,17 +82215,19 @@ function FieldsBuilder({
82215
82215
  useEventSubscription("plugin:add:field", () => updateFieldPlugins(), []);
82216
82216
  return /* @__PURE__ */ jsx$1(FieldsGroup, {
82217
82217
  padding,
82218
- children: fields7.map((field) => /* @__PURE__ */ jsx$1(InnerField, {
82218
+ children: fields7.map((field, index2) => /* @__PURE__ */ jsx$1(InnerField, {
82219
82219
  field,
82220
82220
  form,
82221
- fieldPlugins
82221
+ fieldPlugins,
82222
+ index: index2
82222
82223
  }, field.name))
82223
82224
  });
82224
82225
  }
82225
82226
  const InnerField = ({
82226
82227
  field,
82227
82228
  form,
82228
- fieldPlugins
82229
+ fieldPlugins,
82230
+ index: index2
82229
82231
  }) => {
82230
82232
  react.exports.useEffect(() => {
82231
82233
  form.mutators.setFieldData(field.name, {
@@ -82269,7 +82271,8 @@ const InnerField = ({
82269
82271
  ...fieldProps,
82270
82272
  form: form.finalForm,
82271
82273
  tinaForm: form,
82272
- field
82274
+ field,
82275
+ index: index2
82273
82276
  });
82274
82277
  }
82275
82278
  return /* @__PURE__ */ jsx$1("p", {
@@ -84317,6 +84320,7 @@ function wrapFieldsWithMeta(Field22) {
84317
84320
  label: props.field.label,
84318
84321
  description: props.field.description,
84319
84322
  error: props.meta.error,
84323
+ index: props.index,
84320
84324
  children: /* @__PURE__ */ jsx$1(Field22, {
84321
84325
  ...props
84322
84326
  })
@@ -84329,6 +84333,7 @@ const FieldMeta = ({
84329
84333
  error: error2,
84330
84334
  margin = true,
84331
84335
  children: children2,
84336
+ index: index2,
84332
84337
  ...props
84333
84338
  }) => {
84334
84339
  const {
@@ -84348,6 +84353,9 @@ const FieldMeta = ({
84348
84353
  onClick: () => setFocusedField({
84349
84354
  fieldName: name2
84350
84355
  }),
84356
+ style: {
84357
+ zIndex: index2 ? 1e3 - index2 : void 0
84358
+ },
84351
84359
  ...props,
84352
84360
  children: [/* @__PURE__ */ jsxs(FieldLabel, {
84353
84361
  name: name2,
@@ -112316,6 +112324,9 @@ var styles = `.tina-tailwind {
112316
112324
  --tw-backdrop-saturate: ;
112317
112325
  --tw-backdrop-sepia: ;
112318
112326
  }
112327
+ .tina-tailwind .pointer-events-none {
112328
+ pointer-events: none;
112329
+ }
112319
112330
  .tina-tailwind .pointer-events-auto {
112320
112331
  pointer-events: auto;
112321
112332
  }
@@ -112355,6 +112366,12 @@ var styles = `.tina-tailwind {
112355
112366
  .tina-tailwind .top-4 {
112356
112367
  top: 16px;
112357
112368
  }
112369
+ .tina-tailwind .top-1\\/2 {
112370
+ top: 50%;
112371
+ }
112372
+ .tina-tailwind .left-2 {
112373
+ left: 8px;
112374
+ }
112358
112375
  .tina-tailwind .z-overlay {
112359
112376
  z-index: 10600;
112360
112377
  }
@@ -112431,12 +112448,12 @@ var styles = `.tina-tailwind {
112431
112448
  .tina-tailwind .h-7 {
112432
112449
  height: 28px;
112433
112450
  }
112434
- .tina-tailwind .h-10 {
112435
- height: 40px;
112436
- }
112437
112451
  .tina-tailwind .h-5 {
112438
112452
  height: 20px;
112439
112453
  }
112454
+ .tina-tailwind .h-10 {
112455
+ height: 40px;
112456
+ }
112440
112457
  .tina-tailwind .h-12 {
112441
112458
  height: 48px;
112442
112459
  }
@@ -112500,6 +112517,10 @@ var styles = `.tina-tailwind {
112500
112517
  --tw-translate-x: 100%;
112501
112518
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
112502
112519
  }
112520
+ .tina-tailwind .-translate-y-1\\/2 {
112521
+ --tw-translate-y: -50%;
112522
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
112523
+ }
112503
112524
  .tina-tailwind .scale-95 {
112504
112525
  --tw-scale-x: .95;
112505
112526
  --tw-scale-y: .95;
@@ -112567,6 +112588,11 @@ var styles = `.tina-tailwind {
112567
112588
  .tina-tailwind .overflow-y-auto {
112568
112589
  overflow-y: auto;
112569
112590
  }
112591
+ .tina-tailwind .truncate {
112592
+ overflow: hidden;
112593
+ text-overflow: ellipsis;
112594
+ white-space: nowrap;
112595
+ }
112570
112596
  .tina-tailwind .whitespace-normal {
112571
112597
  white-space: normal;
112572
112598
  }
@@ -112579,12 +112605,12 @@ var styles = `.tina-tailwind {
112579
112605
  .tina-tailwind .rounded {
112580
112606
  border-radius: 4px;
112581
112607
  }
112582
- .tina-tailwind .rounded-full {
112583
- border-radius: 9999px;
112584
- }
112585
112608
  .tina-tailwind .rounded-md {
112586
112609
  border-radius: 6px;
112587
112610
  }
112611
+ .tina-tailwind .rounded-full {
112612
+ border-radius: 9999px;
112613
+ }
112588
112614
  .tina-tailwind .rounded-r-md {
112589
112615
  border-top-right-radius: 6px;
112590
112616
  border-bottom-right-radius: 6px;
@@ -112665,6 +112691,10 @@ var styles = `.tina-tailwind {
112665
112691
  padding-top: 40px;
112666
112692
  padding-bottom: 40px;
112667
112693
  }
112694
+ .tina-tailwind .py-2 {
112695
+ padding-top: 8px;
112696
+ padding-bottom: 8px;
112697
+ }
112668
112698
  .tina-tailwind .px-20 {
112669
112699
  padding-left: 80px;
112670
112700
  padding-right: 80px;
@@ -112677,10 +112707,6 @@ var styles = `.tina-tailwind {
112677
112707
  padding-top: 4px;
112678
112708
  padding-bottom: 4px;
112679
112709
  }
112680
- .tina-tailwind .py-2 {
112681
- padding-top: 8px;
112682
- padding-bottom: 8px;
112683
- }
112684
112710
  .tina-tailwind .py-5 {
112685
112711
  padding-top: 20px;
112686
112712
  padding-bottom: 20px;
@@ -112694,6 +112720,15 @@ var styles = `.tina-tailwind {
112694
112720
  .tina-tailwind .pt-16 {
112695
112721
  padding-top: 64px;
112696
112722
  }
112723
+ .tina-tailwind .pr-3 {
112724
+ padding-right: 12px;
112725
+ }
112726
+ .tina-tailwind .pl-8 {
112727
+ padding-left: 32px;
112728
+ }
112729
+ .tina-tailwind .pl-3 {
112730
+ padding-left: 12px;
112731
+ }
112697
112732
  .tina-tailwind .pt-3 {
112698
112733
  padding-top: 12px;
112699
112734
  }
@@ -112773,10 +112808,18 @@ var styles = `.tina-tailwind {
112773
112808
  --tw-text-opacity: 1;
112774
112809
  color: rgb(113 108 127 / var(--tw-text-opacity));
112775
112810
  }
112811
+ .tina-tailwind .text-gray-300 {
112812
+ --tw-text-opacity: 1;
112813
+ color: rgb(178 173 190 / var(--tw-text-opacity));
112814
+ }
112776
112815
  .tina-tailwind .text-gray-400 {
112777
112816
  --tw-text-opacity: 1;
112778
112817
  color: rgb(145 140 158 / var(--tw-text-opacity));
112779
112818
  }
112819
+ .tina-tailwind .text-blue-500 {
112820
+ --tw-text-opacity: 1;
112821
+ color: rgb(0 132 255 / var(--tw-text-opacity));
112822
+ }
112780
112823
  .tina-tailwind .text-current {
112781
112824
  color: currentColor;
112782
112825
  }
@@ -112811,6 +112854,9 @@ var styles = `.tina-tailwind {
112811
112854
  .tina-tailwind .opacity-90 {
112812
112855
  opacity: .9;
112813
112856
  }
112857
+ .tina-tailwind .opacity-20 {
112858
+ opacity: .2;
112859
+ }
112814
112860
  .tina-tailwind .opacity-50 {
112815
112861
  opacity: .5;
112816
112862
  }
@@ -112827,6 +112873,11 @@ var styles = `.tina-tailwind {
112827
112873
  --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
112828
112874
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
112829
112875
  }
112876
+ .tina-tailwind .shadow-inner {
112877
+ --tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
112878
+ --tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);
112879
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
112880
+ }
112830
112881
  .tina-tailwind .shadow {
112831
112882
  --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
112832
112883
  --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
@@ -112916,6 +112967,14 @@ var styles = `.tina-tailwind {
112916
112967
  .tina-tailwind .hover\\:opacity-60:hover {
112917
112968
  opacity: .6;
112918
112969
  }
112970
+ .tina-tailwind .focus\\:border-blue-500:focus {
112971
+ --tw-border-opacity: 1;
112972
+ border-color: rgb(0 132 255 / var(--tw-border-opacity));
112973
+ }
112974
+ .tina-tailwind .focus\\:text-gray-900:focus {
112975
+ --tw-text-opacity: 1;
112976
+ color: rgb(37 35 54 / var(--tw-text-opacity));
112977
+ }
112919
112978
  .tina-tailwind .focus\\:text-blue-400:focus {
112920
112979
  --tw-text-opacity: 1;
112921
112980
  color: rgb(34 150 254 / var(--tw-text-opacity));
@@ -112941,6 +113000,30 @@ var styles = `.tina-tailwind {
112941
113000
  --tw-ring-opacity: 1;
112942
113001
  --tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
112943
113002
  }
113003
+ .tina-tailwind .group:hover .group-hover\\:border-gray-200 {
113004
+ --tw-border-opacity: 1;
113005
+ border-color: rgb(225 221 236 / var(--tw-border-opacity));
113006
+ }
113007
+ .tina-tailwind .group:hover .group-hover\\:bg-white {
113008
+ --tw-bg-opacity: 1;
113009
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
113010
+ }
113011
+ .tina-tailwind .group:hover .group-hover\\:text-gray-600 {
113012
+ --tw-text-opacity: 1;
113013
+ color: rgb(86 81 101 / var(--tw-text-opacity));
113014
+ }
113015
+ .tina-tailwind .group:hover .group-hover\\:opacity-0 {
113016
+ opacity: 0;
113017
+ }
113018
+ .tina-tailwind .group:hover .group-hover\\:opacity-80 {
113019
+ opacity: .8;
113020
+ }
113021
+ .tina-tailwind .group:active .group-active\\:opacity-0 {
113022
+ opacity: 0;
113023
+ }
113024
+ .tina-tailwind .group:active .group-active\\:opacity-80 {
113025
+ opacity: .8;
113026
+ }
112944
113027
  `;
112945
113028
  class ContentCreatorPlugin {
112946
113029
  constructor(options) {
@@ -114721,6 +114804,34 @@ function HiChevronRight(props) {
114721
114804
  }]
114722
114805
  })(props);
114723
114806
  }
114807
+ function FaLock(props) {
114808
+ return GenIcon({
114809
+ "tag": "svg",
114810
+ "attr": {
114811
+ "viewBox": "0 0 448 512"
114812
+ },
114813
+ "child": [{
114814
+ "tag": "path",
114815
+ "attr": {
114816
+ "d": "M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"
114817
+ }
114818
+ }]
114819
+ })(props);
114820
+ }
114821
+ function FaUnlock(props) {
114822
+ return GenIcon({
114823
+ "tag": "svg",
114824
+ "attr": {
114825
+ "viewBox": "0 0 448 512"
114826
+ },
114827
+ "child": [{
114828
+ "tag": "path",
114829
+ "attr": {
114830
+ "d": "M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"
114831
+ }
114832
+ }]
114833
+ })(props);
114834
+ }
114724
114835
  const createDocument = async (cms, collection, template, mutationInfo, values2) => {
114725
114836
  const api = new TinaAdminApi(cms);
114726
114837
  const {
@@ -114776,6 +114887,25 @@ const CollectionCreatePage = () => {
114776
114887
  })
114777
114888
  });
114778
114889
  };
114890
+ const FilenameInput = (props) => {
114891
+ const [filenameTouched, setFilenameTouched] = React.useState(false);
114892
+ return /* @__PURE__ */ jsxs("div", {
114893
+ className: "group relative block cursor-pointer",
114894
+ onClick: () => {
114895
+ setFilenameTouched(true);
114896
+ },
114897
+ children: [/* @__PURE__ */ jsx$1("input", {
114898
+ type: "text",
114899
+ className: `shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base pr-3 truncate py-2 w-full border transition-all ease-out duration-150 focus:text-gray-900 rounded-md ${props.readonly || !filenameTouched ? "bg-gray-50 text-gray-300 border-gray-150 pointer-events-none pl-8 group-hover:bg-white group-hover:text-gray-600 group-hover:border-gray-200" : "bg-white text-gray-600 border-gray-200 pl-3"}`,
114900
+ ...props,
114901
+ disabled: props.readonly || !filenameTouched
114902
+ }), /* @__PURE__ */ jsx$1(FaLock, {
114903
+ className: `text-gray-400 absolute top-1/2 left-2 -translate-y-1/2 pointer-events-none h-5 w-auto transition-opacity duration-150 ease-out ${!filenameTouched && !props.readonly ? "opacity-20 group-hover:opacity-0 group-active:opacity-0" : "opacity-0"}`
114904
+ }), /* @__PURE__ */ jsx$1(FaUnlock, {
114905
+ className: `text-blue-500 absolute top-1/2 left-2 -translate-y-1/2 pointer-events-none h-5 w-auto transition-opacity duration-150 ease-out ${!filenameTouched && !props.readonly ? "opacity-0 group-hover:opacity-80 group-active:opacity-80" : "opacity-0"}`
114906
+ })]
114907
+ });
114908
+ };
114779
114909
  const RenderForm$1 = ({
114780
114910
  cms,
114781
114911
  collection,
@@ -114799,9 +114929,9 @@ const RenderForm$1 = ({
114799
114929
  schema,
114800
114930
  template
114801
114931
  });
114802
- let slugFunction = (_b = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b.slugify;
114932
+ let slugFunction = (_b = (_a2 = template == null ? void 0 : template.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b.slugify;
114803
114933
  if (!slugFunction) {
114804
- const titleField = (_c = schemaCollection.fields.find((x2) => x2.required && x2.type === "string" && x2.isTitle)) == null ? void 0 : _c.name;
114934
+ const titleField = (_c = template == null ? void 0 : template.fields.find((x2) => x2.required && x2.type === "string" && x2.isTitle)) == null ? void 0 : _c.name;
114805
114935
  if (titleField) {
114806
114936
  slugFunction = (values2) => {
114807
114937
  var _a22;
@@ -114827,11 +114957,21 @@ const RenderForm$1 = ({
114827
114957
  },
114828
114958
  id: "create-form",
114829
114959
  label: "form",
114830
- fields: [{
114960
+ fields: [...formInfo.fields, {
114831
114961
  name: "filename",
114832
114962
  label: "Filename",
114833
- component: "text",
114834
- disabled: (_b2 = (_a22 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a22.filename) == null ? void 0 : _b2.disabled,
114963
+ component: slugFunction ? wrapFieldsWithMeta(({
114964
+ field,
114965
+ input,
114966
+ meta
114967
+ }) => {
114968
+ var _a3, _b3;
114969
+ return /* @__PURE__ */ jsx$1(FilenameInput, {
114970
+ readonly: (_b3 = (_a3 = template == null ? void 0 : template.ui) == null ? void 0 : _a3.filename) == null ? void 0 : _b3.readonly,
114971
+ ...input
114972
+ });
114973
+ }) : "text",
114974
+ disabled: (_b2 = (_a22 = template == null ? void 0 : template.ui) == null ? void 0 : _a22.filename) == null ? void 0 : _b2.readonly,
114835
114975
  description: /* @__PURE__ */ jsxs("span", {
114836
114976
  children: ["A unique filename for the content.", /* @__PURE__ */ jsx$1("br", {}), "Examples: ", /* @__PURE__ */ jsx$1("code", {
114837
114977
  children: "My_Document"
@@ -114854,7 +114994,7 @@ const RenderForm$1 = ({
114854
114994
  return "Must begin with a-z, A-Z, 0-9, or _ and contain only a-z, A-Z, 0-9, -, _, ., or /.";
114855
114995
  }
114856
114996
  }
114857
- }, ...formInfo.fields],
114997
+ }],
114858
114998
  onSubmit: async (values2) => {
114859
114999
  try {
114860
115000
  await createDocument(cms, collection, template, mutationInfo, values2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -37,7 +37,7 @@
37
37
  "@tailwindcss/aspect-ratio": "^0.4.0",
38
38
  "@tailwindcss/line-clamp": "^0.3.1",
39
39
  "@tailwindcss/typography": "^0.5.4",
40
- "@tinacms/schema-tools": "0.1.5",
40
+ "@tinacms/schema-tools": "0.1.7",
41
41
  "@tinacms/scripts": "0.51.1",
42
42
  "@vitejs/plugin-react": "^1.3.2",
43
43
  "@xstate/react": "^3.0.0",
@@ -55,7 +55,7 @@
55
55
  "react-router-dom": "6",
56
56
  "styled-components": "5.3.5",
57
57
  "tailwindcss": "^3.1.6",
58
- "tinacms": "0.69.13",
58
+ "tinacms": "0.69.15",
59
59
  "typescript": "^4.6.4",
60
60
  "vite": "2.9.15",
61
61
  "vite-node": "^0.23.4",