@tinacms/app 0.0.16 → 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 +43 -13
- 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
|
};
|
|
@@ -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);
|
|
@@ -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();
|
|
@@ -114777,7 +114782,7 @@ const RenderForm$1 = ({
|
|
|
114777
114782
|
templateName,
|
|
114778
114783
|
mutationInfo
|
|
114779
114784
|
}) => {
|
|
114780
|
-
var _a2, _b;
|
|
114785
|
+
var _a2, _b, _c, _d, _e2;
|
|
114781
114786
|
const navigate = useNavigate();
|
|
114782
114787
|
const [formIsPristine, setFormIsPristine] = react.exports.useState(true);
|
|
114783
114788
|
const schema = cms.api.tina.schema;
|
|
@@ -114794,14 +114799,39 @@ const RenderForm$1 = ({
|
|
|
114794
114799
|
schema,
|
|
114795
114800
|
template
|
|
114796
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
|
+
}
|
|
114797
114812
|
const form = react.exports.useMemo(() => {
|
|
114813
|
+
var _a22, _b2;
|
|
114798
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
|
+
},
|
|
114799
114828
|
id: "create-form",
|
|
114800
114829
|
label: "form",
|
|
114801
114830
|
fields: [{
|
|
114802
114831
|
name: "filename",
|
|
114803
114832
|
label: "Filename",
|
|
114804
114833
|
component: "text",
|
|
114834
|
+
disabled: (_b2 = (_a22 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a22.filename) == null ? void 0 : _b2.disabled,
|
|
114805
114835
|
description: /* @__PURE__ */ jsxs("span", {
|
|
114806
114836
|
children: ["A unique filename for the content.", /* @__PURE__ */ jsx$1("br", {}), "Examples: ", /* @__PURE__ */ jsx$1("code", {
|
|
114807
114837
|
children: "My_Document"
|
|
@@ -114843,7 +114873,7 @@ const RenderForm$1 = ({
|
|
|
114843
114873
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
114844
114874
|
return /* @__PURE__ */ jsx$1(PageWrapper, {
|
|
114845
114875
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
114846
|
-
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", {
|
|
114847
114877
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`,
|
|
114848
114878
|
children: /* @__PURE__ */ jsxs("div", {
|
|
114849
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",
|