@tinacms/app 0.0.15 → 0.0.17
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/assets/out.es.js +46 -22
- package/package.json +3 -3
package/dist/assets/out.es.js
CHANGED
|
@@ -81906,7 +81906,8 @@ class Form {
|
|
|
81906
81906
|
onChange(formState);
|
|
81907
81907
|
}
|
|
81908
81908
|
}, {
|
|
81909
|
-
values: true
|
|
81909
|
+
values: true,
|
|
81910
|
+
...(options == null ? void 0 : options.extraSubscribeValues) || {}
|
|
81910
81911
|
});
|
|
81911
81912
|
}
|
|
81912
81913
|
}
|
|
@@ -82061,12 +82062,13 @@ const ModalLayout = ({
|
|
|
82061
82062
|
});
|
|
82062
82063
|
};
|
|
82063
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";
|
|
82064
82066
|
const BaseTextField = ({
|
|
82065
82067
|
...props
|
|
82066
82068
|
}) => {
|
|
82067
82069
|
return /* @__PURE__ */ jsx$1("input", {
|
|
82068
82070
|
type: "text",
|
|
82069
|
-
className: textFieldClasses
|
|
82071
|
+
className: `${textFieldClasses}${(props == null ? void 0 : props.disabled) ? disabledClasses : ""}`,
|
|
82070
82072
|
...props
|
|
82071
82073
|
});
|
|
82072
82074
|
};
|
|
@@ -82213,7 +82215,7 @@ function FieldsBuilder({
|
|
|
82213
82215
|
useEventSubscription("plugin:add:field", () => updateFieldPlugins(), []);
|
|
82214
82216
|
return /* @__PURE__ */ jsx$1(FieldsGroup, {
|
|
82215
82217
|
padding,
|
|
82216
|
-
children:
|
|
82218
|
+
children: fields7.map((field) => /* @__PURE__ */ jsx$1(InnerField, {
|
|
82217
82219
|
field,
|
|
82218
82220
|
form,
|
|
82219
82221
|
fieldPlugins
|
|
@@ -82243,16 +82245,11 @@ const InnerField = ({
|
|
|
82243
82245
|
if (!format2 && plugin && plugin.format) {
|
|
82244
82246
|
format2 = plugin.format;
|
|
82245
82247
|
}
|
|
82246
|
-
let defaultValue = field.defaultValue;
|
|
82247
|
-
if (!parse22 && plugin && plugin.defaultValue) {
|
|
82248
|
-
defaultValue = plugin.defaultValue;
|
|
82249
|
-
}
|
|
82250
82248
|
return /* @__PURE__ */ jsx$1(Field, {
|
|
82251
82249
|
name: field.name,
|
|
82252
82250
|
type,
|
|
82253
82251
|
parse: parse22 ? (value, name2) => parse22(value, name2, field) : void 0,
|
|
82254
82252
|
format: format2 ? (value, name2) => format2(value, name2, field) : void 0,
|
|
82255
|
-
defaultValue,
|
|
82256
82253
|
validate: (value, values2, meta) => {
|
|
82257
82254
|
if (validate) {
|
|
82258
82255
|
return validate(value, values2, meta, field);
|
|
@@ -82286,7 +82283,7 @@ const FieldsGroup = ({
|
|
|
82286
82283
|
children: children2
|
|
82287
82284
|
}) => {
|
|
82288
82285
|
return /* @__PURE__ */ jsx$1("div", {
|
|
82289
|
-
className: `relative w-full h-full whitespace-nowrap overflow-x-visible
|
|
82286
|
+
className: `relative block w-full h-full whitespace-nowrap overflow-x-visible ${padding ? `pb-5` : ``}`,
|
|
82290
82287
|
children: children2
|
|
82291
82288
|
});
|
|
82292
82289
|
};
|
|
@@ -84368,7 +84365,7 @@ const FieldWrapper = ({
|
|
|
84368
84365
|
...props
|
|
84369
84366
|
}) => {
|
|
84370
84367
|
return /* @__PURE__ */ jsx$1("div", {
|
|
84371
|
-
className: `relative ${margin ? `mb-5
|
|
84368
|
+
className: `relative ${margin ? `mb-5 last:mb-0` : ``}`,
|
|
84372
84369
|
...props,
|
|
84373
84370
|
children: children2
|
|
84374
84371
|
});
|
|
@@ -88416,10 +88413,14 @@ const TextareaFieldPlugin = {
|
|
|
88416
88413
|
const TextField = wrapFieldsWithMeta(({
|
|
88417
88414
|
input,
|
|
88418
88415
|
field
|
|
88419
|
-
}) =>
|
|
88420
|
-
|
|
88421
|
-
|
|
88422
|
-
|
|
88416
|
+
}) => {
|
|
88417
|
+
var _a2;
|
|
88418
|
+
return /* @__PURE__ */ jsx$1(BaseTextField, {
|
|
88419
|
+
...input,
|
|
88420
|
+
disabled: (_a2 = field == null ? void 0 : field.disabled) != null ? _a2 : false,
|
|
88421
|
+
placeholder: field.placeholder
|
|
88422
|
+
});
|
|
88423
|
+
});
|
|
88423
88424
|
const TextFieldPlugin = {
|
|
88424
88425
|
name: "text",
|
|
88425
88426
|
Component: TextField,
|
|
@@ -89650,6 +89651,8 @@ const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
|
89650
89651
|
const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
|
|
89651
89652
|
const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
|
|
89652
89653
|
const format = (val, _name, field) => {
|
|
89654
|
+
if (!val)
|
|
89655
|
+
return val;
|
|
89653
89656
|
const dateFormat = parseDateFormat(field.dateFormat);
|
|
89654
89657
|
const timeFormat = parseTimeFormat(field.timeFormat);
|
|
89655
89658
|
const combinedFormat = typeof timeFormat === "string" ? `${dateFormat} ${timeFormat}` : dateFormat;
|
|
@@ -89660,6 +89663,8 @@ const format = (val, _name, field) => {
|
|
|
89660
89663
|
return hooks(val).format(combinedFormat);
|
|
89661
89664
|
};
|
|
89662
89665
|
const parse$3 = (val) => {
|
|
89666
|
+
if (!val)
|
|
89667
|
+
return val;
|
|
89663
89668
|
const date2 = new Date(val);
|
|
89664
89669
|
if (!isNaN(date2.getTime())) {
|
|
89665
89670
|
return new Date(val).toISOString();
|
|
@@ -94557,9 +94562,6 @@ var styles$1 = `.tina-tailwind {
|
|
|
94557
94562
|
.tina-tailwind .flex-col {
|
|
94558
94563
|
flex-direction: column;
|
|
94559
94564
|
}
|
|
94560
|
-
.tina-tailwind .flex-col-reverse {
|
|
94561
|
-
flex-direction: column-reverse;
|
|
94562
|
-
}
|
|
94563
94565
|
.tina-tailwind .flex-wrap {
|
|
94564
94566
|
flex-wrap: wrap;
|
|
94565
94567
|
}
|
|
@@ -95373,9 +95375,6 @@ var styles$1 = `.tina-tailwind {
|
|
|
95373
95375
|
.with-toolbar [data-slate-editor='true'] {
|
|
95374
95376
|
min-height: 72px;
|
|
95375
95377
|
}
|
|
95376
|
-
.tina-tailwind .first\\:mb-0:first-child {
|
|
95377
|
-
margin-bottom: 0px;
|
|
95378
|
-
}
|
|
95379
95378
|
.tina-tailwind .first\\:mt-0:first-child {
|
|
95380
95379
|
margin-top: 0px;
|
|
95381
95380
|
}
|
|
@@ -114783,7 +114782,7 @@ const RenderForm$1 = ({
|
|
|
114783
114782
|
templateName,
|
|
114784
114783
|
mutationInfo
|
|
114785
114784
|
}) => {
|
|
114786
|
-
var _a2, _b;
|
|
114785
|
+
var _a2, _b, _c, _d, _e2;
|
|
114787
114786
|
const navigate = useNavigate();
|
|
114788
114787
|
const [formIsPristine, setFormIsPristine] = react.exports.useState(true);
|
|
114789
114788
|
const schema = cms.api.tina.schema;
|
|
@@ -114800,14 +114799,39 @@ const RenderForm$1 = ({
|
|
|
114800
114799
|
schema,
|
|
114801
114800
|
template
|
|
114802
114801
|
});
|
|
114802
|
+
let slugFunction = (_b = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b.slugify;
|
|
114803
|
+
if (!slugFunction) {
|
|
114804
|
+
const titleField = (_c = schemaCollection.fields.find((x2) => x2.required && x2.type === "string" && x2.isTitle)) == null ? void 0 : _c.name;
|
|
114805
|
+
if (titleField) {
|
|
114806
|
+
slugFunction = (values2) => {
|
|
114807
|
+
var _a22;
|
|
114808
|
+
return (_a22 = values2[titleField]) == null ? void 0 : _a22.replace(/ /g, "-").replace(/[^a-zA-Z0-9-]/g, "");
|
|
114809
|
+
};
|
|
114810
|
+
}
|
|
114811
|
+
}
|
|
114803
114812
|
const form = react.exports.useMemo(() => {
|
|
114813
|
+
var _a22, _b2;
|
|
114804
114814
|
return new Form({
|
|
114815
|
+
initialValues: typeof (schemaCollection == null ? void 0 : schemaCollection.defaultItem) === "function" ? schemaCollection.defaultItem() : schemaCollection == null ? void 0 : schemaCollection.defaultItem,
|
|
114816
|
+
extraSubscribeValues: {
|
|
114817
|
+
active: true,
|
|
114818
|
+
submitting: true,
|
|
114819
|
+
touched: true
|
|
114820
|
+
},
|
|
114821
|
+
onChange: (values2) => {
|
|
114822
|
+
var _a3;
|
|
114823
|
+
if (slugFunction && typeof values2.active === "string" && (values2 == null ? void 0 : values2.active) !== "filename" && !(values2 == null ? void 0 : values2.submitting) && !((_a3 = values2.touched) == null ? void 0 : _a3.filename)) {
|
|
114824
|
+
const value = slugFunction(values2 == null ? void 0 : values2.values);
|
|
114825
|
+
form.finalForm.change("filename", value);
|
|
114826
|
+
}
|
|
114827
|
+
},
|
|
114805
114828
|
id: "create-form",
|
|
114806
114829
|
label: "form",
|
|
114807
114830
|
fields: [{
|
|
114808
114831
|
name: "filename",
|
|
114809
114832
|
label: "Filename",
|
|
114810
114833
|
component: "text",
|
|
114834
|
+
disabled: (_b2 = (_a22 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a22.filename) == null ? void 0 : _b2.disabled,
|
|
114811
114835
|
description: /* @__PURE__ */ jsxs("span", {
|
|
114812
114836
|
children: ["A unique filename for the content.", /* @__PURE__ */ jsx$1("br", {}), "Examples: ", /* @__PURE__ */ jsx$1("code", {
|
|
114813
114837
|
children: "My_Document"
|
|
@@ -114849,7 +114873,7 @@ const RenderForm$1 = ({
|
|
|
114849
114873
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
114850
114874
|
return /* @__PURE__ */ jsx$1(PageWrapper, {
|
|
114851
114875
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
114852
|
-
children: [((
|
|
114876
|
+
children: [((_e2 = (_d = cms == null ? void 0 : cms.api) == null ? void 0 : _d.tina) == null ? void 0 : _e2.isLocalMode) && /* @__PURE__ */ jsx$1(LocalWarning, {}), /* @__PURE__ */ jsx$1("div", {
|
|
114853
114877
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`,
|
|
114854
114878
|
children: /* @__PURE__ */ jsxs("div", {
|
|
114855
114879
|
className: "max-w-form mx-auto",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
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.
|
|
40
|
+
"@tinacms/schema-tools": "0.1.5",
|
|
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.
|
|
58
|
+
"tinacms": "0.69.12",
|
|
59
59
|
"typescript": "^4.6.4",
|
|
60
60
|
"vite": "2.9.15",
|
|
61
61
|
"vite-node": "^0.23.4",
|