lightnet 3.10.3 → 3.10.5
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 +356 -100
- package/__e2e__/fixtures/basics/node_modules/.bin/astro +2 -2
- package/__e2e__/fixtures/basics/package.json +5 -5
- package/package.json +9 -9
- package/src/admin/components/form/DynamicArray.tsx +74 -0
- package/src/admin/components/form/Input.tsx +36 -0
- package/src/admin/components/form/Select.tsx +22 -20
- package/src/admin/components/form/SubmitButton.tsx +20 -18
- package/src/admin/components/form/atoms/ErrorMessage.tsx +13 -0
- package/src/admin/components/form/atoms/Hint.tsx +3 -3
- package/src/admin/components/form/atoms/Label.tsx +17 -6
- package/src/admin/components/form/atoms/Legend.tsx +20 -0
- package/src/admin/components/form/hooks/use-field-error.tsx +13 -0
- package/src/admin/i18n/translations/en.yml +18 -7
- package/src/admin/pages/media/EditForm.tsx +52 -68
- package/src/admin/pages/media/EditRoute.astro +35 -11
- package/src/admin/pages/media/fields/Authors.tsx +43 -0
- package/src/admin/pages/media/fields/Categories.tsx +64 -0
- package/src/admin/pages/media/fields/Collections.tsx +103 -0
- package/src/admin/pages/media/media-item-store.ts +14 -7
- package/src/admin/types/media-item.ts +38 -2
- package/src/components/CategoriesSection.astro +2 -2
- package/src/components/HeroSection.astro +1 -1
- package/src/components/HighlightSection.astro +1 -1
- package/src/components/MediaGallerySection.astro +3 -3
- package/src/components/MediaList.astro +2 -2
- package/src/components/SearchInput.astro +1 -1
- package/src/content/get-categories.ts +18 -3
- package/src/i18n/react/i18n-context.ts +14 -12
- package/src/i18n/resolve-language.ts +1 -1
- package/src/layouts/MarkdownPage.astro +1 -1
- package/src/layouts/Page.astro +3 -2
- package/src/layouts/components/LanguagePicker.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/details-page/components/more-details/Languages.astro +2 -2
- package/src/pages/search-page/components/LoadingSkeleton.tsx +1 -1
- package/src/pages/search-page/components/SearchFilter.astro +7 -7
- package/src/pages/search-page/components/SearchFilter.tsx +5 -5
- package/src/pages/search-page/components/SearchList.astro +4 -4
- package/src/pages/search-page/components/SearchListItem.tsx +5 -5
- package/src/pages/search-page/components/Select.tsx +4 -4
- package/src/pages/search-page/hooks/use-search.ts +4 -4
- package/src/admin/components/form/TextInput.tsx +0 -34
- package/src/admin/components/form/atoms/FieldErrors.tsx +0 -22
- package/src/admin/components/form/form-context.ts +0 -4
- package/src/admin/components/form/index.ts +0 -18
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { FieldErrors } from "./atoms/FieldErrors"
|
|
2
|
-
import Hint from "./atoms/Hint"
|
|
3
|
-
import Label from "./atoms/Label"
|
|
4
|
-
import { useFieldContext } from "./form-context"
|
|
5
|
-
|
|
6
|
-
export default function TextInput({
|
|
7
|
-
label,
|
|
8
|
-
hint,
|
|
9
|
-
type = "text",
|
|
10
|
-
}: {
|
|
11
|
-
label: string
|
|
12
|
-
hint?: string
|
|
13
|
-
type?: "text" | "date"
|
|
14
|
-
}) {
|
|
15
|
-
const field = useFieldContext<string>()
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<label className="dy-form-control w-full">
|
|
19
|
-
<Label label={label} />
|
|
20
|
-
<input
|
|
21
|
-
id={field.name}
|
|
22
|
-
name={field.name}
|
|
23
|
-
type={type}
|
|
24
|
-
value={field.state.value}
|
|
25
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
26
|
-
onBlur={field.handleBlur}
|
|
27
|
-
className={`dy-input dy-input-bordered ${field.state.meta.errors.length ? "dy-input-error" : ""}`}
|
|
28
|
-
/>
|
|
29
|
-
<FieldErrors meta={field.state.meta} />
|
|
30
|
-
<Hint hint={hint} />
|
|
31
|
-
</label>
|
|
32
|
-
</>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
@@ -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,18 +0,0 @@
|
|
|
1
|
-
import { createFormHook } from "@tanstack/react-form"
|
|
2
|
-
|
|
3
|
-
import { fieldContext, formContext } from "./form-context"
|
|
4
|
-
import Select from "./Select"
|
|
5
|
-
import SubmitButton from "./SubmitButton"
|
|
6
|
-
import TextInput from "./TextInput"
|
|
7
|
-
|
|
8
|
-
export const { useAppForm, withForm } = createFormHook({
|
|
9
|
-
fieldComponents: {
|
|
10
|
-
TextInput,
|
|
11
|
-
Select,
|
|
12
|
-
},
|
|
13
|
-
formComponents: {
|
|
14
|
-
SubmitButton,
|
|
15
|
-
},
|
|
16
|
-
fieldContext,
|
|
17
|
-
formContext,
|
|
18
|
-
})
|