lightnet 3.10.2 → 3.10.4
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/CHANGELOG.md +12 -0
- package/__e2e__/admin.spec.ts +297 -100
- package/__e2e__/fixtures/basics/node_modules/.bin/astro +2 -2
- package/__e2e__/fixtures/basics/package.json +5 -5
- package/package.json +10 -9
- package/src/admin/api/fs/{writeText.ts → write-file.ts} +9 -6
- package/src/admin/components/form/Input.tsx +36 -0
- package/src/admin/components/form/Select.tsx +43 -0
- package/src/admin/components/form/SubmitButton.tsx +21 -16
- package/src/admin/components/form/atoms/ErrorMessage.tsx +34 -0
- package/src/admin/components/form/atoms/Hint.tsx +10 -0
- package/src/admin/components/form/atoms/Label.tsx +19 -0
- package/src/admin/components/form/atoms/Legend.tsx +10 -0
- package/src/admin/components/form/hooks/use-field-error.tsx +21 -0
- package/src/admin/i18n/translations/en.yml +8 -2
- package/src/admin/pages/media/EditForm.tsx +43 -43
- package/src/admin/pages/media/EditRoute.astro +28 -5
- package/src/admin/pages/media/fields/Authors.tsx +58 -0
- package/src/admin/pages/media/file-system.ts +3 -3
- package/src/admin/pages/media/media-item-store.ts +9 -7
- package/src/admin/types/media-item.ts +10 -1
- package/src/astro-integration/integration.ts +2 -2
- package/src/components/HeroSection.astro +1 -1
- package/src/components/HighlightSection.astro +1 -1
- package/src/components/SearchInput.astro +1 -1
- package/src/components/Toast.tsx +1 -1
- package/src/i18n/react/i18n-context.ts +14 -8
- package/src/layouts/MarkdownPage.astro +1 -1
- package/src/layouts/components/Menu.astro +1 -1
- package/src/layouts/components/PageNavigation.astro +1 -1
- package/src/pages/details-page/components/main-details/OpenButton.astro +1 -1
- package/src/pages/search-page/components/LoadingSkeleton.tsx +1 -1
- package/src/pages/search-page/components/SearchFilter.tsx +1 -1
- package/src/pages/search-page/components/SearchListItem.tsx +1 -1
- package/src/pages/search-page/components/Select.tsx +1 -1
- package/src/admin/components/form/FieldErrors.tsx +0 -22
- package/src/admin/components/form/TextField.tsx +0 -24
- package/src/admin/components/form/form-context.ts +0 -4
- package/src/admin/components/form/index.ts +0 -16
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { AnyFieldMeta } from "@tanstack/react-form"
|
|
2
|
-
|
|
3
|
-
import { useI18n } from "../../../i18n/react/useI18n"
|
|
4
|
-
|
|
5
|
-
type FieldErrorsProps = {
|
|
6
|
-
meta: AnyFieldMeta
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const FieldErrors = ({ meta }: FieldErrorsProps) => {
|
|
10
|
-
const { t } = useI18n()
|
|
11
|
-
if (!meta.isTouched || meta.isValid) return null
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<ul className="my-2 flex flex-col gap-1" role="alert">
|
|
15
|
-
{meta.errors.map((error) => (
|
|
16
|
-
<li className="text-sm text-rose-800" key={error.code}>
|
|
17
|
-
{t(error.message)}
|
|
18
|
-
</li>
|
|
19
|
-
))}
|
|
20
|
-
</ul>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FieldErrors } from "./FieldErrors"
|
|
2
|
-
import { useFieldContext } from "./form-context"
|
|
3
|
-
|
|
4
|
-
export default function TextField({ label }: { label: string }) {
|
|
5
|
-
const field = useFieldContext<string>()
|
|
6
|
-
return (
|
|
7
|
-
<>
|
|
8
|
-
<label className="dy-form-control w-full max-w-sm">
|
|
9
|
-
<div className="dy-label">
|
|
10
|
-
<span className="dy-label-text">{label}</span>
|
|
11
|
-
</div>
|
|
12
|
-
<input
|
|
13
|
-
id={field.name}
|
|
14
|
-
name={field.name}
|
|
15
|
-
value={field.state.value}
|
|
16
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
17
|
-
onBlur={field.handleBlur}
|
|
18
|
-
className={`dy-input dy-input-bordered dy-input-sm w-full max-w-sm ${field.state.meta.errors.length ? "dy-input-error" : ""}`}
|
|
19
|
-
/>
|
|
20
|
-
<FieldErrors meta={field.state.meta} />
|
|
21
|
-
</label>
|
|
22
|
-
</>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createFormHook } from "@tanstack/react-form"
|
|
2
|
-
|
|
3
|
-
import { fieldContext, formContext } from "./form-context"
|
|
4
|
-
import SubmitButton from "./SubmitButton"
|
|
5
|
-
import TextField from "./TextField"
|
|
6
|
-
|
|
7
|
-
export const { useAppForm, withForm } = createFormHook({
|
|
8
|
-
fieldComponents: {
|
|
9
|
-
TextField,
|
|
10
|
-
},
|
|
11
|
-
formComponents: {
|
|
12
|
-
SubmitButton,
|
|
13
|
-
},
|
|
14
|
-
fieldContext,
|
|
15
|
-
formContext,
|
|
16
|
-
})
|