litecms 0.2.1 → 0.2.3
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/README.md +26 -1
- package/dist/admin/CmsBlogAdmin.d.ts.map +1 -1
- package/dist/admin/exports.js +470 -469
- package/dist/components/index.js +55 -55
- package/dist/index-xscpb89q.js +4422 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/components/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
set,
|
|
13
13
|
useCmsLanguageOptional,
|
|
14
14
|
useForm
|
|
15
|
-
} from "../index-
|
|
15
|
+
} from "../index-xscpb89q.js";
|
|
16
16
|
import {
|
|
17
17
|
$ZodError,
|
|
18
18
|
parse,
|
|
@@ -156,7 +156,7 @@ function a(o2, a2, u) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// src/components/CmsForm.tsx
|
|
159
|
-
import {
|
|
159
|
+
import { jsx } from "react/jsx-runtime";
|
|
160
160
|
var CmsFormContext = React.createContext(null);
|
|
161
161
|
function CmsForm({
|
|
162
162
|
schema,
|
|
@@ -219,21 +219,21 @@ function CmsForm({
|
|
|
219
219
|
setIsPending(false);
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ jsx(FormProvider, {
|
|
223
223
|
...form,
|
|
224
|
-
children: /* @__PURE__ */
|
|
224
|
+
children: /* @__PURE__ */ jsx(CmsFormContext.Provider, {
|
|
225
225
|
value: {
|
|
226
226
|
isPending,
|
|
227
227
|
formError: state.errors?.formError,
|
|
228
228
|
showSuccess
|
|
229
229
|
},
|
|
230
|
-
children: /* @__PURE__ */
|
|
230
|
+
children: /* @__PURE__ */ jsx("form", {
|
|
231
231
|
onSubmit: handleSubmit,
|
|
232
232
|
className,
|
|
233
233
|
children
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
237
|
}
|
|
238
238
|
function useCmsForm() {
|
|
239
239
|
const context = React.useContext(CmsFormContext);
|
|
@@ -258,22 +258,22 @@ function CmsSubmitButton({
|
|
|
258
258
|
});
|
|
259
259
|
const resolvedChildren = children ?? t2("save");
|
|
260
260
|
const resolvedPendingText = pendingText ?? t2("saving");
|
|
261
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ jsx("button", {
|
|
262
262
|
type: "submit",
|
|
263
263
|
disabled: isPending,
|
|
264
264
|
className,
|
|
265
265
|
children: isPending ? resolvedPendingText : resolvedChildren
|
|
266
|
-
}
|
|
266
|
+
});
|
|
267
267
|
}
|
|
268
268
|
function CmsFormError({ className }) {
|
|
269
269
|
const { formError } = useCmsForm();
|
|
270
270
|
if (!formError)
|
|
271
271
|
return null;
|
|
272
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ jsx("div", {
|
|
273
273
|
role: "alert",
|
|
274
274
|
className,
|
|
275
275
|
children: formError
|
|
276
|
-
}
|
|
276
|
+
});
|
|
277
277
|
}
|
|
278
278
|
function CmsFormSuccess({
|
|
279
279
|
children,
|
|
@@ -290,14 +290,14 @@ function CmsFormSuccess({
|
|
|
290
290
|
const resolvedChildren = children ?? t2("savedSuccessfully");
|
|
291
291
|
if (!showSuccess)
|
|
292
292
|
return null;
|
|
293
|
-
return /* @__PURE__ */
|
|
293
|
+
return /* @__PURE__ */ jsx("div", {
|
|
294
294
|
role: "status",
|
|
295
295
|
className,
|
|
296
296
|
children: resolvedChildren
|
|
297
|
-
}
|
|
297
|
+
});
|
|
298
298
|
}
|
|
299
299
|
// src/components/CmsAutoForm.tsx
|
|
300
|
-
import {
|
|
300
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
301
301
|
function CmsAutoForm({
|
|
302
302
|
definition,
|
|
303
303
|
action,
|
|
@@ -323,44 +323,44 @@ function CmsAutoForm({
|
|
|
323
323
|
const editableFields = getEditableFields(definition);
|
|
324
324
|
const defaultValues = { ...definition.defaults, ...values };
|
|
325
325
|
const groupedFields = groupFields(editableFields);
|
|
326
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ jsx2(CmsForm, {
|
|
327
327
|
schema: definition.schema,
|
|
328
328
|
action,
|
|
329
329
|
defaultValues,
|
|
330
330
|
onSuccess,
|
|
331
|
-
children: /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
332
332
|
className: styles.wrapper ?? "",
|
|
333
333
|
children: [
|
|
334
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ jsxs("div", {
|
|
335
335
|
className: "space-y-8",
|
|
336
336
|
children: [
|
|
337
|
-
groupedFields.map((group) => /* @__PURE__ */
|
|
337
|
+
groupedFields.map((group) => /* @__PURE__ */ jsx2(FieldGroup, {
|
|
338
338
|
group,
|
|
339
339
|
styles
|
|
340
|
-
}, group.name ?? "__ungrouped"
|
|
341
|
-
/* @__PURE__ */
|
|
340
|
+
}, group.name ?? "__ungrouped")),
|
|
341
|
+
/* @__PURE__ */ jsx2(CmsFormError, {
|
|
342
342
|
className: styles.formError ?? "flex items-center gap-3 rounded-lg px-4 py-3 text-sm"
|
|
343
|
-
}
|
|
344
|
-
/* @__PURE__ */
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ jsx2(CmsFormSuccess, {
|
|
345
345
|
className: styles.formSuccess ?? "flex items-center gap-3 rounded-lg px-4 py-3 text-sm",
|
|
346
346
|
children: resolvedSuccessMessage
|
|
347
|
-
}
|
|
347
|
+
})
|
|
348
348
|
]
|
|
349
|
-
}
|
|
350
|
-
/* @__PURE__ */
|
|
349
|
+
}),
|
|
350
|
+
/* @__PURE__ */ jsx2("div", {
|
|
351
351
|
className: "mt-8 flex items-center justify-end gap-4 pt-6",
|
|
352
352
|
style: {
|
|
353
353
|
borderTop: "1px solid var(--cms-border, rgba(255, 255, 255, 0.06))"
|
|
354
354
|
},
|
|
355
|
-
children: /* @__PURE__ */
|
|
355
|
+
children: /* @__PURE__ */ jsx2(CmsSubmitButton, {
|
|
356
356
|
className: styles.submitButton ?? "inline-flex h-9 items-center justify-center gap-2 rounded-lg px-6 py-2 text-sm font-medium text-white transition-all duration-180 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
357
357
|
pendingText: resolvedSubmitPendingText,
|
|
358
358
|
children: resolvedSubmitText
|
|
359
|
-
}
|
|
360
|
-
}
|
|
359
|
+
})
|
|
360
|
+
})
|
|
361
361
|
]
|
|
362
|
-
}
|
|
363
|
-
}
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
364
|
}
|
|
365
365
|
function FieldGroup({
|
|
366
366
|
group,
|
|
@@ -379,32 +379,32 @@ function FieldGroup({
|
|
|
379
379
|
border: "1px solid var(--cms-border, rgba(255, 255, 255, 0.06))"
|
|
380
380
|
};
|
|
381
381
|
if (group.name) {
|
|
382
|
-
return /* @__PURE__ */
|
|
382
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
383
383
|
className: styles.group ?? "p-6",
|
|
384
384
|
style: fieldsetStyle,
|
|
385
385
|
children: [
|
|
386
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ jsx2("legend", {
|
|
387
387
|
className: styles.groupTitle ?? "text-sm font-semibold mb-4",
|
|
388
388
|
style: legendStyle,
|
|
389
389
|
children: group.name
|
|
390
|
-
}
|
|
391
|
-
/* @__PURE__ */
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ jsx2("div", {
|
|
392
392
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",
|
|
393
|
-
children: group.fields.map((field) => /* @__PURE__ */
|
|
393
|
+
children: group.fields.map((field) => /* @__PURE__ */ jsx2(AutoField, {
|
|
394
394
|
field,
|
|
395
395
|
styles
|
|
396
|
-
}, field.name
|
|
397
|
-
}
|
|
396
|
+
}, field.name))
|
|
397
|
+
})
|
|
398
398
|
]
|
|
399
|
-
}
|
|
399
|
+
});
|
|
400
400
|
}
|
|
401
|
-
return /* @__PURE__ */
|
|
401
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
402
402
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",
|
|
403
|
-
children: group.fields.map((field) => /* @__PURE__ */
|
|
403
|
+
children: group.fields.map((field) => /* @__PURE__ */ jsx2(AutoField, {
|
|
404
404
|
field,
|
|
405
405
|
styles
|
|
406
|
-
}, field.name
|
|
407
|
-
}
|
|
406
|
+
}, field.name))
|
|
407
|
+
});
|
|
408
408
|
}
|
|
409
409
|
function AutoField({
|
|
410
410
|
field,
|
|
@@ -414,9 +414,9 @@ function AutoField({
|
|
|
414
414
|
const isFullWidth = meta.type === "textarea" || meta.type === "image";
|
|
415
415
|
const colSpan = isFullWidth ? "col-span-1 md:col-span-2 lg:col-span-3" : "col-span-1";
|
|
416
416
|
if (meta.type === "checkbox") {
|
|
417
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
418
418
|
className: colSpan,
|
|
419
|
-
children: /* @__PURE__ */
|
|
419
|
+
children: /* @__PURE__ */ jsx2(CmsCheckbox, {
|
|
420
420
|
name,
|
|
421
421
|
label: meta.label,
|
|
422
422
|
helpText: meta.helpText,
|
|
@@ -425,13 +425,13 @@ function AutoField({
|
|
|
425
425
|
inputClassName: styles.input,
|
|
426
426
|
errorClassName: styles.error,
|
|
427
427
|
helpClassName: styles.help
|
|
428
|
-
}
|
|
429
|
-
}
|
|
428
|
+
})
|
|
429
|
+
});
|
|
430
430
|
}
|
|
431
431
|
if (meta.type === "image") {
|
|
432
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
433
433
|
className: colSpan,
|
|
434
|
-
children: /* @__PURE__ */
|
|
434
|
+
children: /* @__PURE__ */ jsx2(CmsImageField, {
|
|
435
435
|
name,
|
|
436
436
|
label: meta.label,
|
|
437
437
|
helpText: meta.helpText,
|
|
@@ -441,12 +441,12 @@ function AutoField({
|
|
|
441
441
|
labelClassName: styles.label,
|
|
442
442
|
errorClassName: styles.error,
|
|
443
443
|
helpClassName: styles.help
|
|
444
|
-
}
|
|
445
|
-
}
|
|
444
|
+
})
|
|
445
|
+
});
|
|
446
446
|
}
|
|
447
|
-
return /* @__PURE__ */
|
|
447
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
448
448
|
className: colSpan,
|
|
449
|
-
children: /* @__PURE__ */
|
|
449
|
+
children: /* @__PURE__ */ jsx2(CmsField, {
|
|
450
450
|
name,
|
|
451
451
|
label: meta.label,
|
|
452
452
|
type: meta.type ?? "text",
|
|
@@ -460,8 +460,8 @@ function AutoField({
|
|
|
460
460
|
inputClassName: styles.input,
|
|
461
461
|
errorClassName: styles.error,
|
|
462
462
|
helpClassName: styles.help
|
|
463
|
-
}
|
|
464
|
-
}
|
|
463
|
+
})
|
|
464
|
+
});
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
// src/components/index.ts
|