@ndla/image-search 11.0.19-alpha.0 → 11.0.21-alpha.0

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 CHANGED
@@ -32,18 +32,18 @@ const searchImages = (query, page) => {
32
32
  const onError = (err) => void
33
33
 
34
34
  const translations = {
35
- close: "Lukk",
36
35
  searchPlaceholder: "Søk i bilder",
37
36
  searchButtonTitle: "Søk",
38
- useImageTitle: "Bruk bildet",
39
- checkboxLabel: "Sett som metabilde",
40
- imageMetadata: {
37
+ imagePreview: {
41
38
  creatorsLabel: "Bilde",
42
39
  license: "Lisens",
43
40
  caption: "Bildetekst",
44
41
  altText: "Alt-tekst",
45
42
  modelRelease: "Modellklarert",
46
43
  tags: "Emneknagger",
44
+ checkboxLabel: "Sett som metabilde",
45
+ close: "Lukk",
46
+ useImageTitle: "Bruk bildet",
47
47
  },
48
48
  paginationTranslations: {
49
49
  rootLabel: "Sidenavigering",
@@ -52,5 +52,5 @@ const translations = {
52
52
  },
53
53
  }
54
54
 
55
- <ImageSearch onImageSelect={onImageSelect} searchImages={searchImages} onError={onError} translations={translations} locale="nb"/>;
55
+ <ImageSearch onImageSelect={onImageSelect} searchImages={searchImages} onError={onError} translations={translations} locale="nb" showCheckbox />;
56
56
  ```
package/es/ImageSearch.js CHANGED
@@ -57,11 +57,6 @@ const ImageSearch = _ref => {
57
57
  page
58
58
  } = queryObject;
59
59
  const noResultsFound = !searching && searchResult?.results.length === 0;
60
- const imageSearchTranslations = {
61
- ...translations.imageMetadata,
62
- close: translations.close,
63
- missingTitleFallback: translations.missingTitleFallback
64
- };
65
60
  const onImageClick = image => {
66
61
  if (!selectedImage || image.id !== selectedImage.id) {
67
62
  fetchImage(Number.parseInt(image.id)).then(result => {
@@ -134,9 +129,8 @@ const ImageSearch = _ref => {
134
129
  onImageClick: onImageClick,
135
130
  selectedImage: selectedImage,
136
131
  onSelectImage: onSelectImage,
137
- useImageTitle: translations.useImageTitle,
138
132
  showCheckbox: !!showCheckbox,
139
- translations: imageSearchTranslations,
133
+ translations: translations.imagePreview,
140
134
  locale: locale
141
135
  }, image.id))
142
136
  }), /*#__PURE__*/_jsxs(PaginationRoot, {
@@ -34,7 +34,6 @@ export default function ImageSearchResult(_ref) {
34
34
  onImageClick,
35
35
  selectedImage,
36
36
  onSelectImage,
37
- useImageTitle,
38
37
  showCheckbox,
39
38
  translations,
40
39
  locale
@@ -63,7 +62,6 @@ export default function ImageSearchResult(_ref) {
63
62
  id: `image-preview-${image.id}`,
64
63
  image: selectedImage,
65
64
  onSelectImage: onSelectImage,
66
- useImageTitle: useImageTitle,
67
65
  translations: translations,
68
66
  showCheckbox: showCheckbox,
69
67
  locale: locale
@@ -92,7 +92,6 @@ const PreviewImage = _ref => {
92
92
  id,
93
93
  image,
94
94
  onSelectImage,
95
- useImageTitle,
96
95
  showCheckbox,
97
96
  translations,
98
97
  locale
@@ -164,7 +163,7 @@ const PreviewImage = _ref => {
164
163
  children: [/*#__PURE__*/_jsx(Button, {
165
164
  "data-testid": "use-image",
166
165
  onClick: () => onSelectImage(image, saveAsMetaImage),
167
- children: useImageTitle
166
+ children: translations.useImageTitle
168
167
  }), showCheckbox && /*#__PURE__*/_jsxs(CheckboxRoot, {
169
168
  checked: saveAsMetaImage,
170
169
  onCheckedChange: () => setSaveAsMetaImage(prev => !prev),
@@ -8,23 +8,23 @@
8
8
  import { ReactNode } from "react";
9
9
  import { PaginationRootProps } from "@ndla/primitives";
10
10
  import { IImageMetaInformationV3, ISearchResultV3 } from "@ndla/types-backend/image-api";
11
- export interface MetadataTranslations {
11
+ export interface PreviewTranslations {
12
12
  creatorsLabel: string;
13
13
  license: string;
14
14
  caption: string;
15
15
  altText: string;
16
16
  modelRelease: string;
17
17
  tags: string;
18
+ close: string;
19
+ checkboxLabel?: string;
20
+ missingTitleFallback?: string;
21
+ useImageTitle: string;
18
22
  }
19
23
  export interface ImageSearchTranslations {
20
24
  searchPlaceholder: string;
21
25
  searchButtonTitle: string;
22
- useImageTitle: string;
23
- close: string;
24
- imageMetadata: MetadataTranslations;
26
+ imagePreview: PreviewTranslations;
25
27
  paginationTranslations: PaginationRootProps["translations"];
26
- missingTitleFallback?: string;
27
- checkboxLabel?: string;
28
28
  }
29
29
  interface Props {
30
30
  onImageSelect: (image: IImageMetaInformationV3) => void;
@@ -64,11 +64,6 @@ const ImageSearch = _ref => {
64
64
  page
65
65
  } = queryObject;
66
66
  const noResultsFound = !searching && searchResult?.results.length === 0;
67
- const imageSearchTranslations = {
68
- ...translations.imageMetadata,
69
- close: translations.close,
70
- missingTitleFallback: translations.missingTitleFallback
71
- };
72
67
  const onImageClick = image => {
73
68
  if (!selectedImage || image.id !== selectedImage.id) {
74
69
  fetchImage(Number.parseInt(image.id)).then(result => {
@@ -141,9 +136,8 @@ const ImageSearch = _ref => {
141
136
  onImageClick: onImageClick,
142
137
  selectedImage: selectedImage,
143
138
  onSelectImage: onSelectImage,
144
- useImageTitle: translations.useImageTitle,
145
139
  showCheckbox: !!showCheckbox,
146
- translations: imageSearchTranslations,
140
+ translations: translations.imagePreview,
147
141
  locale: locale
148
142
  }, image.id))
149
143
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PaginationRoot, {
@@ -6,20 +6,15 @@
6
6
  *
7
7
  */
8
8
  import { IImageMetaInformationV3 } from "@ndla/types-backend/image-api";
9
- import { MetadataTranslations } from "./ImageSearch";
9
+ import { PreviewTranslations } from "./ImageSearch";
10
10
  interface Props {
11
11
  image: IImageMetaInformationV3;
12
12
  onImageClick: (image: IImageMetaInformationV3) => void;
13
13
  selectedImage?: IImageMetaInformationV3;
14
14
  onSelectImage: (image: IImageMetaInformationV3 | undefined, saveAsMetaImage?: boolean) => void;
15
- useImageTitle: string;
16
15
  showCheckbox: boolean;
17
- translations: MetadataTranslations & {
18
- close: string;
19
- missingTitleFallback?: string;
20
- checkboxLabel?: string;
21
- };
16
+ translations: PreviewTranslations;
22
17
  locale: string;
23
18
  }
24
- export default function ImageSearchResult({ image, onImageClick, selectedImage, onSelectImage, useImageTitle, showCheckbox, translations, locale, }: Props): import("react/jsx-runtime").JSX.Element;
19
+ export default function ImageSearchResult({ image, onImageClick, selectedImage, onSelectImage, showCheckbox, translations, locale, }: Props): import("react/jsx-runtime").JSX.Element;
25
20
  export {};
@@ -41,7 +41,6 @@ function ImageSearchResult(_ref) {
41
41
  onImageClick,
42
42
  selectedImage,
43
43
  onSelectImage,
44
- useImageTitle,
45
44
  showCheckbox,
46
45
  translations,
47
46
  locale
@@ -70,7 +69,6 @@ function ImageSearchResult(_ref) {
70
69
  id: `image-preview-${image.id}`,
71
70
  image: selectedImage,
72
71
  onSelectImage: onSelectImage,
73
- useImageTitle: useImageTitle,
74
72
  translations: translations,
75
73
  showCheckbox: showCheckbox,
76
74
  locale: locale
@@ -6,19 +6,14 @@
6
6
  *
7
7
  */
8
8
  import { IImageMetaInformationV3 } from "@ndla/types-backend/image-api";
9
- import { MetadataTranslations } from "./ImageSearch";
9
+ import { PreviewTranslations } from "./ImageSearch";
10
10
  interface Props {
11
11
  id: string;
12
12
  image: IImageMetaInformationV3;
13
13
  onSelectImage: (image: IImageMetaInformationV3 | undefined, saveAsMetaImage?: boolean) => void;
14
- useImageTitle: string;
15
14
  showCheckbox: boolean;
16
- translations: MetadataTranslations & {
17
- close: string;
18
- missingTitleFallback?: string;
19
- checkboxLabel?: string;
20
- };
15
+ translations: PreviewTranslations;
21
16
  locale: string;
22
17
  }
23
- declare const PreviewImage: ({ id, image, onSelectImage, useImageTitle, showCheckbox, translations, locale }: Props) => import("react/jsx-runtime").JSX.Element;
18
+ declare const PreviewImage: ({ id, image, onSelectImage, showCheckbox, translations, locale }: Props) => import("react/jsx-runtime").JSX.Element;
24
19
  export default PreviewImage;
@@ -99,7 +99,6 @@ const PreviewImage = _ref => {
99
99
  id,
100
100
  image,
101
101
  onSelectImage,
102
- useImageTitle,
103
102
  showCheckbox,
104
103
  translations,
105
104
  locale
@@ -171,7 +170,7 @@ const PreviewImage = _ref => {
171
170
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Button, {
172
171
  "data-testid": "use-image",
173
172
  onClick: () => onSelectImage(image, saveAsMetaImage),
174
- children: useImageTitle
173
+ children: translations.useImageTitle
175
174
  }), showCheckbox && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.CheckboxRoot, {
176
175
  checked: saveAsMetaImage,
177
176
  onCheckedChange: () => setSaveAsMetaImage(prev => !prev),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/image-search",
3
- "version": "11.0.19-alpha.0",
3
+ "version": "11.0.21-alpha.0",
4
4
  "description": "A simple library for searching images from NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -26,14 +26,14 @@
26
26
  "es"
27
27
  ],
28
28
  "dependencies": {
29
- "@ndla/icons": "^8.0.13-alpha.0",
29
+ "@ndla/icons": "^8.0.15-alpha.0",
30
30
  "@ndla/licenses": "^8.0.2-alpha.0",
31
- "@ndla/primitives": "^1.0.17-alpha.0",
32
- "@ndla/styled-system": "^0.0.15",
31
+ "@ndla/primitives": "^1.0.19-alpha.0",
32
+ "@ndla/styled-system": "^0.0.17",
33
33
  "pretty-bytes": "^5.6.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ndla/preset-panda": "^0.0.23",
36
+ "@ndla/preset-panda": "^0.0.25",
37
37
  "@ndla/types-backend": "^0.2.86",
38
38
  "@pandacss/dev": "^0.45.2"
39
39
  },
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "58687255a5be26e49b6a21d830cf0af5be37b9fa"
47
+ "gitHead": "4271f1708f835715edca5fd10f6ee4b182a207b4"
48
48
  }