@ndla/ui 56.0.172-alpha.0 → 56.0.174-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/es/AnchorHeading/AnchorHeading.mjs +1 -1
- package/es/AnchorHeading/AnchorHeading.mjs.map +1 -1
- package/es/Article/Article.mjs +1 -8
- package/es/Article/Article.mjs.map +1 -1
- package/es/Article/ArticleByline.mjs +1 -1
- package/es/Article/ArticleByline.mjs.map +1 -1
- package/es/AudioPlayer/AudioPlayer.mjs +1 -1
- package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
- package/es/AudioPlayer/Controls.mjs +1 -1
- package/es/AudioPlayer/Controls.mjs.map +1 -1
- package/es/AudioPlayer/SpeechControl.mjs +1 -1
- package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
- package/es/Breadcrumb/Breadcrumb.mjs +8 -1
- package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
- package/es/Breadcrumb/BreadcrumbItem.mjs +8 -1
- package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
- package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
- package/es/CampaignBlock/CampaignBlock.mjs +1 -8
- package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
- package/es/CodeBlock/CodeBlock.mjs +1 -8
- package/es/CodeBlock/CodeBlock.mjs.map +1 -1
- package/es/Concept/Concept.mjs +1 -8
- package/es/Concept/Concept.mjs.map +1 -1
- package/es/ContactBlock/ContactBlock.mjs +0 -7
- package/es/ContactBlock/ContactBlock.mjs.map +1 -1
- package/es/Embed/AudioEmbed.mjs +1 -8
- package/es/Embed/AudioEmbed.mjs.map +1 -1
- package/es/Embed/BrightcoveEmbed.mjs +2 -9
- package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
- package/es/Embed/CodeEmbed.mjs +1 -8
- package/es/Embed/CodeEmbed.mjs.map +1 -1
- package/es/Embed/ConceptEmbed.mjs +1 -8
- package/es/Embed/ConceptEmbed.mjs.map +1 -1
- package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
- package/es/Embed/CopyrightEmbed.mjs.map +1 -1
- package/es/Embed/EmbedErrorPlaceholder.mjs +8 -1
- package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
- package/es/Embed/EmbedWrapper.mjs +1 -8
- package/es/Embed/EmbedWrapper.mjs.map +1 -1
- package/es/Embed/ExternalEmbed.mjs +1 -8
- package/es/Embed/ExternalEmbed.mjs.map +1 -1
- package/es/Embed/FootnoteEmbed.mjs +0 -7
- package/es/Embed/FootnoteEmbed.mjs.map +1 -1
- package/es/Embed/GlossEmbed.mjs +1 -8
- package/es/Embed/GlossEmbed.mjs.map +1 -1
- package/es/Embed/H5pEmbed.mjs +0 -7
- package/es/Embed/H5pEmbed.mjs.map +1 -1
- package/es/Embed/IframeEmbed.mjs +2 -9
- package/es/Embed/IframeEmbed.mjs.map +1 -1
- package/es/Embed/ImageEmbed.mjs +2 -9
- package/es/Embed/ImageEmbed.mjs.map +1 -1
- package/es/Embed/InlineTriggerButton.mjs +1 -1
- package/es/Embed/InlineTriggerButton.mjs.map +1 -1
- package/es/Embed/RelatedContentEmbed.mjs +0 -7
- package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
- package/es/Embed/UnknownEmbed.mjs +0 -7
- package/es/Embed/UnknownEmbed.mjs.map +1 -1
- package/es/Embed/UuDisclaimerEmbed.mjs +1 -1
- package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
- package/es/FactBox/FactBox.mjs +1 -1
- package/es/FactBox/FactBox.mjs.map +1 -1
- package/es/FileList/File.mjs +1 -1
- package/es/FileList/File.mjs.map +1 -1
- package/es/FileList/FileList.mjs +8 -1
- package/es/FileList/FileList.mjs.map +1 -1
- package/es/Gloss/Gloss.mjs +1 -8
- package/es/Gloss/Gloss.mjs.map +1 -1
- package/es/Gloss/GlossExample.mjs +1 -8
- package/es/Gloss/GlossExample.mjs.map +1 -1
- package/es/Grid/Grid.mjs +1 -1
- package/es/Grid/Grid.mjs.map +1 -1
- package/es/KeyFigure/KeyFigure.mjs.map +1 -1
- package/es/LicenseByline/EmbedByline.mjs +1 -8
- package/es/LicenseByline/EmbedByline.mjs.map +1 -1
- package/es/LicenseByline/LicenseLink.mjs +1 -8
- package/es/LicenseByline/LicenseLink.mjs.map +1 -1
- package/es/LinkBlock/LinkBlock.mjs +1 -8
- package/es/LinkBlock/LinkBlock.mjs.map +1 -1
- package/es/LinkBlock/LinkBlockSection.mjs +1 -1
- package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
- package/es/Pitch/Pitch.mjs.map +1 -1
- package/es/RelatedArticleList/RelatedArticleList.mjs +1 -1
- package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
- package/es/TagSelector/TagSelector.mjs +1 -1
- package/es/TagSelector/TagSelector.mjs.map +1 -1
- package/es/ZendeskButton/ZendeskButton.mjs +1 -1
- package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
- package/es/i18n/useComponentTranslations.mjs +0 -7
- package/es/i18n/useComponentTranslations.mjs.map +1 -1
- package/es/model/ContentType.mjs +8 -1
- package/es/model/ContentType.mjs.map +1 -1
- package/lib/AnchorHeading/AnchorHeading.js +1 -1
- package/lib/AnchorHeading/AnchorHeading.js.map +1 -1
- package/lib/Article/Article.d.ts +1 -1
- package/lib/Article/Article.js +1 -8
- package/lib/Article/Article.js.map +1 -1
- package/lib/Article/ArticleByline.d.ts +1 -1
- package/lib/Article/ArticleByline.js +1 -1
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/AudioPlayer/AudioPlayer.js +1 -1
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
- package/lib/AudioPlayer/Controls.js +1 -1
- package/lib/AudioPlayer/Controls.js.map +1 -1
- package/lib/AudioPlayer/SpeechControl.js +1 -1
- package/lib/AudioPlayer/SpeechControl.js.map +1 -1
- package/lib/Breadcrumb/Breadcrumb.js +1 -1
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
- package/lib/CampaignBlock/CampaignBlock.js +1 -8
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
- package/lib/CodeBlock/CodeBlock.d.ts +1 -1
- package/lib/CodeBlock/CodeBlock.js +1 -8
- package/lib/CodeBlock/CodeBlock.js.map +1 -1
- package/lib/Concept/Concept.d.ts +1 -1
- package/lib/Concept/Concept.js +1 -8
- package/lib/Concept/Concept.js.map +1 -1
- package/lib/ContactBlock/ContactBlock.js +0 -7
- package/lib/ContactBlock/ContactBlock.js.map +1 -1
- package/lib/Embed/AudioEmbed.js +1 -8
- package/lib/Embed/AudioEmbed.js.map +1 -1
- package/lib/Embed/BrightcoveEmbed.js +2 -9
- package/lib/Embed/BrightcoveEmbed.js.map +1 -1
- package/lib/Embed/CodeEmbed.js +1 -8
- package/lib/Embed/CodeEmbed.js.map +1 -1
- package/lib/Embed/ConceptEmbed.d.ts +1 -1
- package/lib/Embed/ConceptEmbed.js +1 -8
- package/lib/Embed/ConceptEmbed.js.map +1 -1
- package/lib/Embed/ContentLinkEmbed.d.ts +1 -1
- package/lib/Embed/ContentLinkEmbed.js.map +1 -1
- package/lib/Embed/CopyrightEmbed.d.ts +1 -1
- package/lib/Embed/CopyrightEmbed.js.map +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.d.ts +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.js +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
- package/lib/Embed/EmbedWrapper.d.ts +1 -1
- package/lib/Embed/EmbedWrapper.js +1 -8
- package/lib/Embed/EmbedWrapper.js.map +1 -1
- package/lib/Embed/ExternalEmbed.js +1 -8
- package/lib/Embed/ExternalEmbed.js.map +1 -1
- package/lib/Embed/FootnoteEmbed.js +0 -7
- package/lib/Embed/FootnoteEmbed.js.map +1 -1
- package/lib/Embed/GlossEmbed.d.ts +1 -1
- package/lib/Embed/GlossEmbed.js +1 -8
- package/lib/Embed/GlossEmbed.js.map +1 -1
- package/lib/Embed/H5pEmbed.js +0 -7
- package/lib/Embed/H5pEmbed.js.map +1 -1
- package/lib/Embed/IframeEmbed.js +2 -9
- package/lib/Embed/IframeEmbed.js.map +1 -1
- package/lib/Embed/ImageEmbed.d.ts +1 -1
- package/lib/Embed/ImageEmbed.js +2 -9
- package/lib/Embed/ImageEmbed.js.map +1 -1
- package/lib/Embed/InlineTriggerButton.js +1 -1
- package/lib/Embed/InlineTriggerButton.js.map +1 -1
- package/lib/Embed/RelatedContentEmbed.js +0 -7
- package/lib/Embed/RelatedContentEmbed.js.map +1 -1
- package/lib/Embed/UnknownEmbed.js +0 -7
- package/lib/Embed/UnknownEmbed.js.map +1 -1
- package/lib/Embed/UuDisclaimerEmbed.d.ts +1 -1
- package/lib/Embed/UuDisclaimerEmbed.js +1 -8
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
- package/lib/Embed/types.d.ts +1 -1
- package/lib/FactBox/FactBox.js +2 -2
- package/lib/FactBox/FactBox.js.map +1 -1
- package/lib/FileList/File.js +1 -1
- package/lib/FileList/File.js.map +1 -1
- package/lib/FileList/FileList.js +1 -1
- package/lib/FileList/FileList.js.map +1 -1
- package/lib/Gloss/Gloss.js +1 -8
- package/lib/Gloss/Gloss.js.map +1 -1
- package/lib/Gloss/GlossExample.js +1 -8
- package/lib/Gloss/GlossExample.js.map +1 -1
- package/lib/Grid/Grid.d.ts +1 -1
- package/lib/Grid/Grid.js +1 -8
- package/lib/Grid/Grid.js.map +1 -1
- package/lib/KeyFigure/KeyFigure.js.map +1 -1
- package/lib/LicenseByline/EmbedByline.d.ts +1 -1
- package/lib/LicenseByline/EmbedByline.js +1 -8
- package/lib/LicenseByline/EmbedByline.js.map +1 -1
- package/lib/LicenseByline/LicenseLink.js +1 -8
- package/lib/LicenseByline/LicenseLink.js.map +1 -1
- package/lib/LinkBlock/LinkBlock.js +1 -8
- package/lib/LinkBlock/LinkBlock.js.map +1 -1
- package/lib/LinkBlock/LinkBlockSection.js +1 -1
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
- package/lib/Pitch/Pitch.js.map +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
- package/lib/TagSelector/TagSelector.js +1 -1
- package/lib/TagSelector/TagSelector.js.map +1 -1
- package/lib/ZendeskButton/ZendeskButton.js +1 -1
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
- package/lib/i18n/useComponentTranslations.js +0 -7
- package/lib/i18n/useComponentTranslations.js.map +1 -1
- package/lib/model/ContentType.d.ts +5 -0
- package/lib/model/ContentType.js +8 -1
- package/lib/model/ContentType.js.map +1 -1
- package/lib/model/index.d.ts +2 -0
- package/package.json +9 -9
- package/src/AnchorHeading/AnchorHeading.tsx +1 -1
- package/src/Article/Article.tsx +2 -2
- package/src/Article/ArticleByline.stories.tsx +0 -1
- package/src/Article/ArticleByline.tsx +3 -3
- package/src/AudioPlayer/AudioPlayer.tsx +2 -2
- package/src/AudioPlayer/Controls.tsx +2 -2
- package/src/AudioPlayer/SpeechControl.tsx +2 -2
- package/src/Breadcrumb/Breadcrumb.tsx +1 -1
- package/src/Breadcrumb/BreadcrumbItem.tsx +1 -1
- package/src/Breadcrumb/HomeBreadcrumb.tsx +1 -1
- package/src/CampaignBlock/CampaignBlock.tsx +3 -3
- package/src/CodeBlock/CodeBlock.tsx +2 -2
- package/src/Concept/Concept.stories.tsx +1 -1
- package/src/Concept/Concept.tsx +3 -3
- package/src/ContactBlock/ContactBlock.tsx +3 -3
- package/src/Embed/AudioEmbed.stories.tsx +2 -2
- package/src/Embed/AudioEmbed.tsx +2 -2
- package/src/Embed/BrightcoveEmbed.stories.tsx +2 -2
- package/src/Embed/BrightcoveEmbed.tsx +4 -4
- package/src/Embed/CodeEmbed.stories.tsx +1 -1
- package/src/Embed/CodeEmbed.tsx +4 -4
- package/src/Embed/ConceptEmbed.stories.tsx +2 -2
- package/src/Embed/ConceptEmbed.tsx +5 -5
- package/src/Embed/ContentLinkEmbed.tsx +2 -2
- package/src/Embed/CopyrightEmbed.tsx +1 -1
- package/src/Embed/EmbedErrorPlaceholder.tsx +1 -1
- package/src/Embed/EmbedWrapper.tsx +2 -2
- package/src/Embed/ExternalEmbed.stories.tsx +2 -2
- package/src/Embed/ExternalEmbed.tsx +4 -4
- package/src/Embed/FootnoteEmbed.stories.tsx +2 -2
- package/src/Embed/FootnoteEmbed.tsx +2 -2
- package/src/Embed/GlossEmbed.stories.tsx +2 -2
- package/src/Embed/GlossEmbed.tsx +3 -3
- package/src/Embed/H5pEmbed.stories.tsx +2 -2
- package/src/Embed/H5pEmbed.tsx +2 -2
- package/src/Embed/IframeEmbed.stories.tsx +2 -2
- package/src/Embed/IframeEmbed.tsx +5 -5
- package/src/Embed/ImageEmbed.stories.tsx +4 -4
- package/src/Embed/ImageEmbed.tsx +5 -5
- package/src/Embed/InlineTriggerButton.tsx +1 -1
- package/src/Embed/RelatedContentEmbed.stories.tsx +2 -2
- package/src/Embed/RelatedContentEmbed.tsx +1 -1
- package/src/Embed/UnknownEmbed.tsx +2 -2
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +4 -4
- package/src/Embed/UuDisclaimerEmbed.tsx +3 -3
- package/src/Embed/types.ts +1 -1
- package/src/FactBox/FactBox.tsx +3 -3
- package/src/FileList/File.tsx +2 -2
- package/src/FileList/FileList.tsx +1 -1
- package/src/Gloss/Gloss.stories.tsx +1 -1
- package/src/Gloss/Gloss.tsx +6 -6
- package/src/Gloss/GlossExample.tsx +2 -2
- package/src/Grid/Grid.stories.tsx +1 -1
- package/src/Grid/Grid.tsx +2 -2
- package/src/KeyFigure/KeyFigure.tsx +1 -1
- package/src/LicenseByline/EmbedByline.tsx +6 -6
- package/src/LicenseByline/LicenseLink.tsx +1 -1
- package/src/LinkBlock/LinkBlock.tsx +3 -3
- package/src/LinkBlock/LinkBlockSection.tsx +1 -1
- package/src/Pitch/Pitch.stories.tsx +1 -1
- package/src/Pitch/Pitch.tsx +1 -1
- package/src/RelatedArticleList/RelatedArticleList.tsx +2 -2
- package/src/TagSelector/TagSelector.stories.tsx +3 -4
- package/src/TagSelector/TagSelector.tsx +1 -1
- package/src/ZendeskButton/ZendeskButton.tsx +1 -1
- package/src/i18n/useComponentTranslations.ts +2 -2
- package/src/model/ContentType.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComponentTranslations.js","names":[],"sources":["../../src/i18n/useComponentTranslations.ts"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport type { CollectionItem } from \"@ark-ui/react\";\nimport type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps, DatePickerRootProps } from \"@ndla/primitives\";\nimport { type TagSelectorRootProps } from \"../TagSelector/TagSelector\";\nimport { useMemo } from \"react\";\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport const useTagsInputTranslations = (\n translations?: Partial<TagsInputRootProps[\"translations\"]>,\n): TagsInputRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.tagsInput\" });\n\n return useMemo(\n () => ({\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n deleteTagTriggerLabel: (tag) => t(\"deleteTagTriggerLabel\", { tag }),\n tagAdded: (tag) => t(\"tagAdded\", { tag }),\n tagsPasted: (tag) => t(\"tagsPasted\", { length: tag.length }),\n tagEdited: (tag) => t(\"tagEdited\", { tag }),\n tagUpdated: (tag) => t(\"tagUpdated\", { tag }),\n tagDeleted: (tag) => t(\"tagDeleted\", { tag }),\n tagSelected: (tag) => t(\"tagSelected\", { tag }),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useComboboxTranslations = <T extends CollectionItem>(\n translations?: Partial<ComboboxRootProps<T>[\"translations\"]>,\n): ComboboxRootProps<T>[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.combobox\" });\n\n return useMemo(\n () => ({\n triggerLabel: t(\"triggerLabel\"),\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useTagSelectorTranslations = <T extends CollectionItem>(\n translations?: Partial<TagSelectorRootProps<T>[\"translations\"]>,\n): TagSelectorRootProps<T>[\"translations\"] => {\n const tagsInputTranslations = useTagsInputTranslations();\n const comboboxTranslations = useComboboxTranslations();\n\n return useMemo(\n () =>\n ({\n ...comboboxTranslations,\n ...tagsInputTranslations,\n ...translations,\n }) as TagSelectorRootProps<T>[\"translations\"],\n [comboboxTranslations, tagsInputTranslations, translations],\n );\n};\n\nexport const usePaginationTranslations = (\n translations?: Partial<PaginationRootProps[\"translations\"]>,\n): PaginationRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.pagination\" });\n\n return useMemo(\n () => ({\n rootLabel: t(\"rootLabel\"),\n prevTriggerLabel: t(\"prevTriggerLabel\"),\n nextTriggerLabel: t(\"nextTriggerLabel\"),\n itemLabel: (details) => {\n const lastPage = details.totalPages > 1 && details.page === details.totalPages;\n return lastPage ? t(\"lastPage\", { page: details.page }) : t(\"page\", { page: details.page });\n },\n ...translations,\n }),\n [translations, t],\n );\n};\n\n// TODO: Deduplicate this and place it somewhere smart. Maybe core?\ninterface AudioSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n useAudio: string;\n noResults: string;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\ninterface VideoTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n loadMoreVideos: string;\n noResults: string;\n is360Video: string;\n previewVideo: string;\n addVideo: string;\n close: string;\n}\ninterface PreviewTranslations {\n creatorsLabel: string;\n license: string;\n caption: string;\n altText: string;\n modelRelease: string;\n tags: string;\n close: string;\n checkboxLabel?: string;\n missingTitleFallback?: string;\n useImageTitle: string;\n}\n\ninterface ImageSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n imagePreview: PreviewTranslations;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\nexport const useImageSearchTranslations = (\n translations: DeepPartial<ImageSearchTranslations> = {},\n): ImageSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.imageSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { imagePreview, paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n imagePreview: {\n creatorsLabel: t(\"imagePreview.creatorsLabel\"),\n license: t(\"imagePreview.license\"),\n caption: t(\"imagePreview.caption\"),\n altText: t(\"imagePreview.altText\"),\n modelRelease: t(\"imagePreview.modelRelease\"),\n tags: t(\"imagePreview.tags\"),\n close: t(\"close\"),\n checkboxLabel: t(\"imagePreview.checkboxLabel\"),\n useImageTitle: t(\"imagePreview.useImageTitle\"),\n ...imagePreview,\n },\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, imagePreview, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useAudioSearchTranslations = (\n translations: DeepPartial<AudioSearchTranslations> = {},\n): AudioSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.audioSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n useAudio: t(\"useAudio\"),\n noResults: t(\"noResults\"),\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useVideoSearchTranslations = (translations?: Partial<VideoTranslations>): VideoTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.videoSearch\" });\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n loadMoreVideos: t(\"loadMoreVideos\"),\n noResults: t(\"noResults\"),\n is360Video: t(\"is360Video\"),\n previewVideo: t(\"previewVideo\"),\n addVideo: t(\"addVideo\"),\n close: t(\"close\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useDatePickerTranslations = (\n translations?: Partial<DatePickerRootProps[\"translations\"]>,\n): NonNullable<DatePickerRootProps[\"translations\"]> => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.datePicker\" });\n\n return useMemo(\n () => ({\n dayCell: (state) => {\n if (state.unavailable) {\n return t(\"dayCell.unavailable\", { date: state.formattedDate });\n } else if (state.selected) {\n return t(\"dayCell.selected\", { date: state.formattedDate });\n } else return t(\"dayCell.select\", { date: state.formattedDate });\n },\n nextTrigger: (view) => t(`nextTrigger.${view}`),\n prevTrigger: (view) => t(`prevTrigger.${view}`),\n monthSelect: t(\"monthSelect\"),\n yearSelect: t(\"yearSelect\"),\n viewTrigger: (view) => t(`viewTrigger.${view}`),\n presetTrigger: (value) => {\n if (Array.isArray(value)) {\n return t(\"presetTrigger.range\", { start: value[0], end: value[1] });\n } else return t(\"presetTrigger.single\", { date: value });\n },\n clearTrigger: t(\"clearTrigger\"),\n trigger: (open) => t(`trigger.${open ? \"close\" : \"open\"}`),\n content: t(\"content\"),\n placeholder: (_locale) => {\n return { day: \"dd\", month: \"mm\", year: \"yyyy\" };\n },\n ...translations,\n }),\n [t, translations],\n );\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,4BACX,iBACuC;CACvC,MAAM,EAAE,wCAAqB,eAAe,EAAE,WAAW,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,EAAE,iBAAiB;EACnC,WAAW,EAAE,YAAY;EACzB,YAAY,EAAE,aAAa;EAC3B,cAAc,EAAE,eAAe;EAC/B,UAAU,EAAE,WAAW;EACvB,OAAO,EAAE,QAAQ;EACjB,GAAG;EACJ,GACD,CAAC,GAAG,aAAa,CAClB;;AAGH,MAAa,6BACX,iBACqD;CACrD,MAAM,EAAE,wCAAqB,eAAe,EAAE,WAAW,wBAAwB,CAAC;AAElF,kCACS;EACL,UAAU,UAAU;AAClB,OAAI,MAAM,YACR,QAAO,EAAE,uBAAuB,EAAE,MAAM,MAAM,eAAe,CAAC;YACrD,MAAM,SACf,QAAO,EAAE,oBAAoB,EAAE,MAAM,MAAM,eAAe,CAAC;OACtD,QAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,eAAe,CAAC;;EAElE,cAAc,SAAS,EAAE,eAAe,OAAO;EAC/C,cAAc,SAAS,EAAE,eAAe,OAAO;EAC/C,aAAa,EAAE,cAAc;EAC7B,YAAY,EAAE,aAAa;EAC3B,cAAc,SAAS,EAAE,eAAe,OAAO;EAC/C,gBAAgB,UAAU;AACxB,OAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,EAAE,uBAAuB;IAAE,OAAO,MAAM;IAAI,KAAK,MAAM;IAAI,CAAC;OAC9D,QAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;;EAE1D,cAAc,EAAE,eAAe;EAC/B,UAAU,SAAS,EAAE,WAAW,OAAO,UAAU,SAAS;EAC1D,SAAS,EAAE,UAAU;EACrB,cAAc,YAAY;AACxB,UAAO;IAAE,KAAK;IAAM,OAAO;IAAM,MAAM;IAAQ;;EAEjD,GAAG;EACJ,GACD,CAAC,GAAG,aAAa,CAClB"}
|
|
1
|
+
{"version":3,"file":"useComponentTranslations.js","names":[],"sources":["../../src/i18n/useComponentTranslations.ts"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { CollectionItem } from \"@ark-ui/react\";\nimport type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps, DatePickerRootProps } from \"@ndla/primitives\";\nimport { useMemo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { type TagSelectorRootProps } from \"../TagSelector/TagSelector\";\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport const useTagsInputTranslations = (\n translations?: Partial<TagsInputRootProps[\"translations\"]>,\n): TagsInputRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.tagsInput\" });\n\n return useMemo(\n () => ({\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n deleteTagTriggerLabel: (tag) => t(\"deleteTagTriggerLabel\", { tag }),\n tagAdded: (tag) => t(\"tagAdded\", { tag }),\n tagsPasted: (tag) => t(\"tagsPasted\", { length: tag.length }),\n tagEdited: (tag) => t(\"tagEdited\", { tag }),\n tagUpdated: (tag) => t(\"tagUpdated\", { tag }),\n tagDeleted: (tag) => t(\"tagDeleted\", { tag }),\n tagSelected: (tag) => t(\"tagSelected\", { tag }),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useComboboxTranslations = <T extends CollectionItem>(\n translations?: Partial<ComboboxRootProps<T>[\"translations\"]>,\n): ComboboxRootProps<T>[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.combobox\" });\n\n return useMemo(\n () => ({\n triggerLabel: t(\"triggerLabel\"),\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useTagSelectorTranslations = <T extends CollectionItem>(\n translations?: Partial<TagSelectorRootProps<T>[\"translations\"]>,\n): TagSelectorRootProps<T>[\"translations\"] => {\n const tagsInputTranslations = useTagsInputTranslations();\n const comboboxTranslations = useComboboxTranslations();\n\n return useMemo(\n () =>\n ({\n ...comboboxTranslations,\n ...tagsInputTranslations,\n ...translations,\n }) as TagSelectorRootProps<T>[\"translations\"],\n [comboboxTranslations, tagsInputTranslations, translations],\n );\n};\n\nexport const usePaginationTranslations = (\n translations?: Partial<PaginationRootProps[\"translations\"]>,\n): PaginationRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.pagination\" });\n\n return useMemo(\n () => ({\n rootLabel: t(\"rootLabel\"),\n prevTriggerLabel: t(\"prevTriggerLabel\"),\n nextTriggerLabel: t(\"nextTriggerLabel\"),\n itemLabel: (details) => {\n const lastPage = details.totalPages > 1 && details.page === details.totalPages;\n return lastPage ? t(\"lastPage\", { page: details.page }) : t(\"page\", { page: details.page });\n },\n ...translations,\n }),\n [translations, t],\n );\n};\n\n// TODO: Deduplicate this and place it somewhere smart. Maybe core?\ninterface AudioSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n useAudio: string;\n noResults: string;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\ninterface VideoTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n loadMoreVideos: string;\n noResults: string;\n is360Video: string;\n previewVideo: string;\n addVideo: string;\n close: string;\n}\ninterface PreviewTranslations {\n creatorsLabel: string;\n license: string;\n caption: string;\n altText: string;\n modelRelease: string;\n tags: string;\n close: string;\n checkboxLabel?: string;\n missingTitleFallback?: string;\n useImageTitle: string;\n}\n\ninterface ImageSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n imagePreview: PreviewTranslations;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\nexport const useImageSearchTranslations = (\n translations: DeepPartial<ImageSearchTranslations> = {},\n): ImageSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.imageSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { imagePreview, paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n imagePreview: {\n creatorsLabel: t(\"imagePreview.creatorsLabel\"),\n license: t(\"imagePreview.license\"),\n caption: t(\"imagePreview.caption\"),\n altText: t(\"imagePreview.altText\"),\n modelRelease: t(\"imagePreview.modelRelease\"),\n tags: t(\"imagePreview.tags\"),\n close: t(\"close\"),\n checkboxLabel: t(\"imagePreview.checkboxLabel\"),\n useImageTitle: t(\"imagePreview.useImageTitle\"),\n ...imagePreview,\n },\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, imagePreview, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useAudioSearchTranslations = (\n translations: DeepPartial<AudioSearchTranslations> = {},\n): AudioSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.audioSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n useAudio: t(\"useAudio\"),\n noResults: t(\"noResults\"),\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useVideoSearchTranslations = (translations?: Partial<VideoTranslations>): VideoTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.videoSearch\" });\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n loadMoreVideos: t(\"loadMoreVideos\"),\n noResults: t(\"noResults\"),\n is360Video: t(\"is360Video\"),\n previewVideo: t(\"previewVideo\"),\n addVideo: t(\"addVideo\"),\n close: t(\"close\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useDatePickerTranslations = (\n translations?: Partial<DatePickerRootProps[\"translations\"]>,\n): NonNullable<DatePickerRootProps[\"translations\"]> => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.datePicker\" });\n\n return useMemo(\n () => ({\n dayCell: (state) => {\n if (state.unavailable) {\n return t(\"dayCell.unavailable\", { date: state.formattedDate });\n } else if (state.selected) {\n return t(\"dayCell.selected\", { date: state.formattedDate });\n } else return t(\"dayCell.select\", { date: state.formattedDate });\n },\n nextTrigger: (view) => t(`nextTrigger.${view}`),\n prevTrigger: (view) => t(`prevTrigger.${view}`),\n monthSelect: t(\"monthSelect\"),\n yearSelect: t(\"yearSelect\"),\n viewTrigger: (view) => t(`viewTrigger.${view}`),\n presetTrigger: (value) => {\n if (Array.isArray(value)) {\n return t(\"presetTrigger.range\", { start: value[0], end: value[1] });\n } else return t(\"presetTrigger.single\", { date: value });\n },\n clearTrigger: t(\"clearTrigger\"),\n trigger: (open) => t(`trigger.${open ? \"close\" : \"open\"}`),\n content: t(\"content\"),\n placeholder: (_locale) => {\n return { day: \"dd\", month: \"mm\", year: \"yyyy\" };\n },\n ...translations,\n }),\n [t, translations],\n );\n};\n"],"mappings":";;;;;AAkBA,MAAa,4BACX,iBACuC;CACvC,MAAM,EAAE,wCAAqB,eAAe,EAAE,WAAW,uBAAuB,CAAC;AAEjF,kCACS;EACL,mBAAmB,EAAE,oBAAoB;EACzC,wBAAwB,QAAQ,EAAE,yBAAyB,EAAE,KAAK,CAAC;EACnE,WAAW,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC;EACzC,aAAa,QAAQ,EAAE,cAAc,EAAE,QAAQ,IAAI,QAAQ,CAAC;EAC5D,YAAY,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC;EAC3C,aAAa,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;EAC7C,aAAa,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;EAC7C,cAAc,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;EAC/C,GAAG;EACJ,GACD,CAAC,GAAG,aAAa,CAClB;;AAGH,MAAa,2BACX,iBACyC;CACzC,MAA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c,SAAS,EAAE,eAAe,OAAO;EAC/C,cAAc,SAAS,EAAE,eAAe,OAAO;EAC/C,aAAa,EAAE,cAAc;EAC7B,YAAY,EAAE,aAAa;EAC3B,cAAc,SAAS,EAAE,eAAe,OAAO;EAC/C,gBAAgB,UAAU;AACxB,OAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,EAAE,uBAAuB;IAAE,OAAO,MAAM;IAAI,KAAK,MAAM;IAAI,CAAC;OAC9D,QAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;;EAE1D,cAAc,EAAE,eAAe;EAC/B,UAAU,SAAS,EAAE,WAAW,OAAO,UAAU,SAAS;EAC1D,SAAS,EAAE,UAAU;EACrB,cAAc,YAAY;AACxB,UAAO;IAAE,KAAK;IAAM,OAAO;IAAM,MAAM;IAAQ;;EAEjD,GAAG;EACJ,GACD,CAAC,GAAG,aAAa,CAClB"}
|
|
@@ -24,6 +24,8 @@ export declare const GLOSS = "gloss";
|
|
|
24
24
|
export declare const PROGRAMME = "programme";
|
|
25
25
|
export declare const PODCAST_SERIES = "podcast-series";
|
|
26
26
|
export declare const FRONTPAGE_ARTICLE = "frontpage-article";
|
|
27
|
+
export declare const GAME = "game";
|
|
28
|
+
export declare const CASE = "case";
|
|
27
29
|
export declare const contentTypes: {
|
|
28
30
|
SUBJECT_MATERIAL: string;
|
|
29
31
|
TASKS_AND_ACTIVITIES: string;
|
|
@@ -38,6 +40,8 @@ export declare const contentTypes: {
|
|
|
38
40
|
MISSING: string;
|
|
39
41
|
PROGRAMME: string;
|
|
40
42
|
PODCAST_SERIES: string;
|
|
43
|
+
GAME: string;
|
|
44
|
+
CASE: string;
|
|
41
45
|
};
|
|
42
46
|
export declare const RESOURCE_TYPE_LEARNING_PATH = "urn:resourcetype:learningPath";
|
|
43
47
|
export declare const RESOURCE_TYPE_SUBJECT_MATERIAL = "urn:resourcetype:subjectMaterial";
|
|
@@ -45,5 +49,6 @@ export declare const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = "urn:resourcetype:task
|
|
|
45
49
|
export declare const RESOURCE_TYPE_ASSESSMENT_RESOURCES = "urn:resourcetype:reviewResource";
|
|
46
50
|
export declare const RESOURCE_TYPE_SOURCE_MATERIAL = "urn:resourcetype:SourceMaterial";
|
|
47
51
|
export declare const RESOURCE_TYPE_CONCEPT = "urn:resourcetype:concept";
|
|
52
|
+
export declare const RESOURCE_TYPE_GAME = "urn:resourcetype:game";
|
|
48
53
|
export declare const contentTypeMapping: Record<string, string>;
|
|
49
54
|
export declare const resourceEmbedTypeMapping: Record<string, string>;
|
package/lib/model/ContentType.js
CHANGED
|
@@ -21,6 +21,8 @@ const MISSING = "missing";
|
|
|
21
21
|
const PROGRAMME = "programme";
|
|
22
22
|
const PODCAST_SERIES = "podcast-series";
|
|
23
23
|
const FRONTPAGE_ARTICLE = "frontpage-article";
|
|
24
|
+
const GAME = "game";
|
|
25
|
+
const CASE = "case";
|
|
24
26
|
const contentTypes = {
|
|
25
27
|
SUBJECT_MATERIAL,
|
|
26
28
|
TASKS_AND_ACTIVITIES,
|
|
@@ -34,7 +36,9 @@ const contentTypes = {
|
|
|
34
36
|
EXTERNAL,
|
|
35
37
|
MISSING,
|
|
36
38
|
PROGRAMME,
|
|
37
|
-
PODCAST_SERIES
|
|
39
|
+
PODCAST_SERIES,
|
|
40
|
+
GAME,
|
|
41
|
+
CASE
|
|
38
42
|
};
|
|
39
43
|
const RESOURCE_TYPE_LEARNING_PATH = "urn:resourcetype:learningPath";
|
|
40
44
|
const RESOURCE_TYPE_SUBJECT_MATERIAL = "urn:resourcetype:subjectMaterial";
|
|
@@ -42,6 +46,7 @@ const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = "urn:resourcetype:tasksAndActivities"
|
|
|
42
46
|
const RESOURCE_TYPE_ASSESSMENT_RESOURCES = "urn:resourcetype:reviewResource";
|
|
43
47
|
const RESOURCE_TYPE_SOURCE_MATERIAL = "urn:resourcetype:SourceMaterial";
|
|
44
48
|
const RESOURCE_TYPE_CONCEPT = "urn:resourcetype:concept";
|
|
49
|
+
const RESOURCE_TYPE_GAME = "urn:resourcetype:game";
|
|
45
50
|
const contentTypeMapping = {
|
|
46
51
|
[RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,
|
|
47
52
|
[RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,
|
|
@@ -49,7 +54,9 @@ const contentTypeMapping = {
|
|
|
49
54
|
[RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,
|
|
50
55
|
[RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,
|
|
51
56
|
[RESOURCE_TYPE_CONCEPT]: CONCEPT,
|
|
57
|
+
[RESOURCE_TYPE_GAME]: GAME,
|
|
52
58
|
[MULTIDISCIPLINARY]: MULTIDISCIPLINARY,
|
|
59
|
+
[CASE]: CASE,
|
|
53
60
|
[TOPIC]: TOPIC,
|
|
54
61
|
[FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,
|
|
55
62
|
default: SUBJECT_MATERIAL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentType.js","names":[],"sources":["../../src/model/ContentType.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const SUBJECT_MATERIAL = \"subject-material\";\nexport const TASKS_AND_ACTIVITIES = \"tasks-and-activities\";\nexport const ASSESSMENT_RESOURCES = \"assessment-resources\";\nexport const SUBJECT = \"subject\";\nexport const SOURCE_MATERIAL = \"source-material\";\nexport const LEARNING_PATH = \"learning-path\";\nexport const TOPIC = \"topic\";\nexport const MULTIDISCIPLINARY = \"multidisciplinary\";\nexport const CONCEPT = \"concept\";\nexport const EXTERNAL = \"external\";\nexport const MISSING = \"missing\";\nexport const IMAGE = \"image\";\nexport const VIDEO = \"video\";\nexport const AUDIO = \"audio\";\nexport const PODCAST = \"podcast\";\nexport const GLOSS = \"gloss\";\nexport const PROGRAMME = \"programme\";\nexport const PODCAST_SERIES = \"podcast-series\";\nexport const FRONTPAGE_ARTICLE = \"frontpage-article\";\n\nexport const contentTypes = {\n SUBJECT_MATERIAL,\n TASKS_AND_ACTIVITIES,\n ASSESSMENT_RESOURCES,\n SUBJECT,\n SOURCE_MATERIAL,\n LEARNING_PATH,\n TOPIC,\n MULTIDISCIPLINARY,\n CONCEPT,\n EXTERNAL,\n MISSING,\n PROGRAMME,\n PODCAST_SERIES,\n};\n\nexport const RESOURCE_TYPE_LEARNING_PATH = \"urn:resourcetype:learningPath\";\nexport const RESOURCE_TYPE_SUBJECT_MATERIAL = \"urn:resourcetype:subjectMaterial\";\nexport const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = \"urn:resourcetype:tasksAndActivities\";\nexport const RESOURCE_TYPE_ASSESSMENT_RESOURCES = \"urn:resourcetype:reviewResource\";\nexport const RESOURCE_TYPE_SOURCE_MATERIAL = \"urn:resourcetype:SourceMaterial\";\nexport const RESOURCE_TYPE_CONCEPT = \"urn:resourcetype:concept\";\n\nexport const contentTypeMapping: Record<string, string> = {\n [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,\n [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,\n [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,\n [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,\n [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,\n [RESOURCE_TYPE_CONCEPT]: CONCEPT,\n [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,\n [TOPIC]: TOPIC,\n [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,\n default: SUBJECT_MATERIAL,\n};\n\nexport const resourceEmbedTypeMapping: Record<string, string> = {\n image: \"image\",\n video: \"video\",\n concept: \"concept\",\n audio: \"audio\",\n podcast: \"podcast\",\n gloss: \"gloss\",\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAAmB;AAChC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,UAAU;AACvB,MAAa,kBAAkB;AAC/B,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AACrB,MAAa,oBAAoB;AACjC,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;AAMvB,MAAa,YAAY;AACzB,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;
|
|
1
|
+
{"version":3,"file":"ContentType.js","names":[],"sources":["../../src/model/ContentType.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const SUBJECT_MATERIAL = \"subject-material\";\nexport const TASKS_AND_ACTIVITIES = \"tasks-and-activities\";\nexport const ASSESSMENT_RESOURCES = \"assessment-resources\";\nexport const SUBJECT = \"subject\";\nexport const SOURCE_MATERIAL = \"source-material\";\nexport const LEARNING_PATH = \"learning-path\";\nexport const TOPIC = \"topic\";\nexport const MULTIDISCIPLINARY = \"multidisciplinary\";\nexport const CONCEPT = \"concept\";\nexport const EXTERNAL = \"external\";\nexport const MISSING = \"missing\";\nexport const IMAGE = \"image\";\nexport const VIDEO = \"video\";\nexport const AUDIO = \"audio\";\nexport const PODCAST = \"podcast\";\nexport const GLOSS = \"gloss\";\nexport const PROGRAMME = \"programme\";\nexport const PODCAST_SERIES = \"podcast-series\";\nexport const FRONTPAGE_ARTICLE = \"frontpage-article\";\nexport const GAME = \"game\";\nexport const CASE = \"case\";\n\nexport const contentTypes = {\n SUBJECT_MATERIAL,\n TASKS_AND_ACTIVITIES,\n ASSESSMENT_RESOURCES,\n SUBJECT,\n SOURCE_MATERIAL,\n LEARNING_PATH,\n TOPIC,\n MULTIDISCIPLINARY,\n CONCEPT,\n EXTERNAL,\n MISSING,\n PROGRAMME,\n PODCAST_SERIES,\n GAME,\n CASE,\n};\n\nexport const RESOURCE_TYPE_LEARNING_PATH = \"urn:resourcetype:learningPath\";\nexport const RESOURCE_TYPE_SUBJECT_MATERIAL = \"urn:resourcetype:subjectMaterial\";\nexport const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = \"urn:resourcetype:tasksAndActivities\";\nexport const RESOURCE_TYPE_ASSESSMENT_RESOURCES = \"urn:resourcetype:reviewResource\";\nexport const RESOURCE_TYPE_SOURCE_MATERIAL = \"urn:resourcetype:SourceMaterial\";\nexport const RESOURCE_TYPE_CONCEPT = \"urn:resourcetype:concept\";\nexport const RESOURCE_TYPE_GAME = \"urn:resourcetype:game\";\n\nexport const contentTypeMapping: Record<string, string> = {\n [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,\n [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,\n [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,\n [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,\n [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,\n [RESOURCE_TYPE_CONCEPT]: CONCEPT,\n [RESOURCE_TYPE_GAME]: GAME,\n [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,\n [CASE]: CASE,\n [TOPIC]: TOPIC,\n [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,\n default: SUBJECT_MATERIAL,\n};\n\nexport const resourceEmbedTypeMapping: Record<string, string> = {\n image: \"image\",\n video: \"video\",\n concept: \"concept\",\n audio: \"audio\",\n podcast: \"podcast\",\n gloss: \"gloss\",\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAAmB;AAChC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,UAAU;AACvB,MAAa,kBAAkB;AAC/B,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AACrB,MAAa,oBAAoB;AACjC,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;AAMvB,MAAa,YAAY;AACzB,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AACjC,MAAa,OAAO;AACpB,MAAa,OAAO;AAEpB,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,8BAA8B;AAC3C,MAAa,iCAAiC;AAC9C,MAAa,qCAAqC;AAClD,MAAa,qCAAqC;AAClD,MAAa,gCAAgC;AAC7C,MAAa,wBAAwB;AACrC,MAAa,qBAAqB;AAElC,MAAa,qBAA6C;EACvD,8BAA8B;EAC9B,iCAAiC;EACjC,qCAAqC;EACrC,qCAAqC;EACrC,gCAAgC;EAChC,wBAAwB;EACxB,qBAAqB;EACrB,oBAAoB;EACpB,OAAO;EACP,QAAQ;EACR,oBAAoB;CACrB,SAAS;CACV;AAED,MAAa,2BAAmD;CAC9D,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,SAAS;CACT,OAAO;CACR"}
|
package/lib/model/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "56.0.
|
|
4
|
+
"version": "56.0.174-alpha.0",
|
|
5
5
|
"description": "UI component library for NDLA",
|
|
6
6
|
"license": "GPL-3.0",
|
|
7
7
|
"exports": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ark-ui/react": "^5.30.0",
|
|
40
40
|
"@ndla/core": "^6.0.7-alpha.0",
|
|
41
|
-
"@ndla/icons": "^8.0.
|
|
42
|
-
"@ndla/licenses": "^10.0.
|
|
43
|
-
"@ndla/locales": "^0.0.
|
|
44
|
-
"@ndla/primitives": "^1.0.
|
|
45
|
-
"@ndla/safelink": "^7.0.
|
|
41
|
+
"@ndla/icons": "^8.0.79-alpha.0",
|
|
42
|
+
"@ndla/licenses": "^10.0.10-alpha.0",
|
|
43
|
+
"@ndla/locales": "^0.0.2",
|
|
44
|
+
"@ndla/primitives": "^1.0.120-alpha.0",
|
|
45
|
+
"@ndla/safelink": "^7.0.123-alpha.0",
|
|
46
46
|
"@ndla/styled-system": "^0.0.46",
|
|
47
47
|
"@ndla/util": "^5.0.18-alpha.0",
|
|
48
48
|
"html-react-parser": "^5.2.8"
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"react-router": ">= 7.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@ndla/preset-panda": "^0.0.
|
|
58
|
+
"@ndla/preset-panda": "^0.0.71",
|
|
59
59
|
"@ndla/types-backend": "^1.0.89",
|
|
60
|
-
"@ndla/types-embed": "^5.0.
|
|
60
|
+
"@ndla/types-embed": "^5.0.21-alpha.0",
|
|
61
61
|
"@pandacss/dev": "^1.7.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "04d83d133eb6a3f2f0944fe217cf407f05716d4c"
|
|
67
67
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ReactNode, useMemo } from "react";
|
|
10
9
|
import { SafeLink } from "@ndla/safelink";
|
|
11
10
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
import { type ReactNode, useMemo } from "react";
|
|
12
12
|
|
|
13
13
|
const StyledAnchor = styled(SafeLink, {
|
|
14
14
|
base: {
|
package/src/Article/Article.tsx
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import type { StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
import { ark, type HTMLArkProps } from "@ark-ui/react";
|
|
11
11
|
import { Heading, Text } from "@ndla/primitives";
|
|
12
12
|
import { cx } from "@ndla/styled-system/css";
|
|
13
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import type
|
|
14
|
+
import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
|
|
15
15
|
import { BadgesContainer } from "./BadgesContainer";
|
|
16
16
|
|
|
17
17
|
const StyledArticleContent = styled(ark.section, {}, { baseComponent: true });
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ReactNode, forwardRef, useCallback, useEffect, useRef } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
9
|
import { useAccordionContext } from "@ark-ui/react";
|
|
12
10
|
import { ArrowDownShortLine } from "@ndla/icons";
|
|
13
11
|
import {
|
|
@@ -21,8 +19,10 @@ import {
|
|
|
21
19
|
} from "@ndla/primitives";
|
|
22
20
|
import { SafeLink } from "@ndla/safelink";
|
|
23
21
|
import { styled } from "@ndla/styled-system/jsx";
|
|
24
|
-
import {
|
|
22
|
+
import { type ReactNode, forwardRef, useCallback, useEffect, useRef } from "react";
|
|
23
|
+
import { useTranslation } from "react-i18next";
|
|
25
24
|
import type { FootNote } from "../types";
|
|
25
|
+
import { ArticleFootNotes } from "./ArticleFootNotes";
|
|
26
26
|
|
|
27
27
|
const Wrapper = styled("div", {
|
|
28
28
|
base: {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ReactNode, useId, useMemo, useState } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
9
|
import { Heading, Text, Button } from "@ndla/primitives";
|
|
12
10
|
import { SafeLink } from "@ndla/safelink";
|
|
13
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
+
import { type ReactNode, useId, useMemo, useState } from "react";
|
|
13
|
+
import { useTranslation } from "react-i18next";
|
|
14
14
|
import { Controls } from "./Controls";
|
|
15
15
|
import { SpeechControl } from "./SpeechControl";
|
|
16
16
|
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { useEffect, useRef, useState } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
9
|
import { type SliderValueChangeDetails, createListCollection } from "@ark-ui/react";
|
|
12
10
|
import { Replay15Line, Forward15Line, PlayFill, PauseLine, VolumeUpFill, CheckLine } from "@ndla/icons";
|
|
13
11
|
import {
|
|
@@ -35,6 +33,8 @@ import {
|
|
|
35
33
|
Text,
|
|
36
34
|
} from "@ndla/primitives";
|
|
37
35
|
import { styled } from "@ndla/styled-system/jsx";
|
|
36
|
+
import { useEffect, useRef, useState } from "react";
|
|
37
|
+
import { useTranslation } from "react-i18next";
|
|
38
38
|
|
|
39
39
|
const ControlsWrapper = styled("div", {
|
|
40
40
|
base: {
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { useRef } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
9
|
import { VolumeUpFill } from "@ndla/icons";
|
|
12
10
|
import { IconButton } from "@ndla/primitives";
|
|
11
|
+
import { useRef } from "react";
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
13
|
|
|
14
14
|
type Props = {
|
|
15
15
|
src: string;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
9
10
|
import { type ReactNode } from "react";
|
|
10
11
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
12
|
import { BreadcrumbItem, type IndexedBreadcrumbItem, type SimpleBreadcrumbItem } from "./BreadcrumbItem";
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { ArrowRightShortLine, HomeLine } from "@ndla/icons";
|
|
10
10
|
import { SafeLink } from "@ndla/safelink";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
-
import { Breadcrumb } from "./Breadcrumb";
|
|
13
12
|
import type { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from "./BreadcrumbItem";
|
|
13
|
+
import { Breadcrumb } from "./Breadcrumb";
|
|
14
14
|
|
|
15
15
|
const StyledSafeLink = styled(SafeLink, {
|
|
16
16
|
base: {
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import { type ReactNode } from "react";
|
|
9
|
+
import type { CampaignBlockEmbedData } from "@ndla/types-embed";
|
|
11
10
|
import { ArrowRightLine } from "@ndla/icons";
|
|
12
11
|
import { Text } from "@ndla/primitives";
|
|
13
12
|
import { SafeLinkButton } from "@ndla/safelink";
|
|
14
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import
|
|
14
|
+
import parse from "html-react-parser";
|
|
15
|
+
import { type ReactNode } from "react";
|
|
16
16
|
import type { HeadingLevel } from "../types";
|
|
17
17
|
import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
|
|
18
18
|
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import type { StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
import { cx } from "@ndla/styled-system/css";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
-
import type
|
|
12
|
+
import { type ComponentPropsWithRef, forwardRef, useMemo } from "react";
|
|
13
13
|
|
|
14
14
|
interface Props extends StyledProps, ComponentPropsWithRef<"pre"> {
|
|
15
15
|
highlightedCode: string;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
9
|
import type { ConceptData } from "@ndla/types-embed";
|
|
10
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
11
11
|
import { Concept } from "./Concept";
|
|
12
12
|
|
|
13
13
|
const visualElementData: ConceptData["visualElement"] = {
|
package/src/Concept/Concept.tsx
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
|
|
10
|
-
import { Figure } from "@ndla/primitives";
|
|
11
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
9
|
import type { DraftCopyrightDTO as ConceptCopyright } from "@ndla/types-backend/concept-api";
|
|
13
10
|
import type { ConceptVisualElementMeta } from "@ndla/types-embed";
|
|
11
|
+
import { Figure } from "@ndla/primitives";
|
|
12
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
+
import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
|
|
14
14
|
import { BrightcoveEmbed } from "../Embed/BrightcoveEmbed";
|
|
15
15
|
import { ExternalEmbed } from "../Embed/ExternalEmbed";
|
|
16
16
|
import { H5pEmbed } from "../Embed/H5pEmbed";
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { useTranslation } from "react-i18next";
|
|
10
|
-
import { Text } from "@ndla/primitives";
|
|
11
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
9
|
import type { SystemStyleObject } from "@ndla/styled-system/types";
|
|
13
10
|
import type { ImageMetaInformationV3DTO } from "@ndla/types-backend/image-api";
|
|
11
|
+
import { Text } from "@ndla/primitives";
|
|
12
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
+
import { useTranslation } from "react-i18next";
|
|
14
14
|
import { LicenseContainerContent } from "../LicenseByline/EmbedByline";
|
|
15
15
|
|
|
16
16
|
export type ContactBlockBackground = "strong" | "moderate" | "subtle";
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { AudioEmbedData, AudioMeta } from "@ndla/types-embed";
|
|
9
10
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
11
|
import { PageContent } from "@ndla/primitives";
|
|
11
|
-
import type { AudioEmbedData, AudioMeta } from "@ndla/types-embed";
|
|
12
|
-
import { AudioEmbed } from "./AudioEmbed";
|
|
13
12
|
import { ArticleContent, ArticleWrapper } from "../Article/Article";
|
|
13
|
+
import { AudioEmbed } from "./AudioEmbed";
|
|
14
14
|
|
|
15
15
|
const embedData: AudioEmbedData = {
|
|
16
16
|
resource: "audio",
|
package/src/Embed/AudioEmbed.tsx
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { AudioMetaData } from "@ndla/types-embed";
|
|
9
10
|
import { Figure } from "@ndla/primitives";
|
|
10
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import type { AudioMetaData } from "@ndla/types-embed";
|
|
12
|
-
import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
|
|
13
12
|
import type { Author } from "./ImageEmbed";
|
|
14
13
|
import { AudioPlayer } from "../AudioPlayer/AudioPlayer";
|
|
15
14
|
import { EmbedByline } from "../LicenseByline/EmbedByline";
|
|
16
15
|
import { licenseAttributes } from "../utils/licenseAttributes";
|
|
16
|
+
import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
|
|
17
17
|
|
|
18
18
|
const StyledFigure = styled(Figure, {
|
|
19
19
|
base: {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData } from "@ndla/types-embed";
|
|
9
10
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
11
|
import { PageContent } from "@ndla/primitives";
|
|
11
|
-
import type { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData } from "@ndla/types-embed";
|
|
12
|
-
import { BrightcoveEmbed } from "./BrightcoveEmbed";
|
|
13
12
|
import { ArticleContent, ArticleWrapper } from "../Article/Article";
|
|
13
|
+
import { BrightcoveEmbed } from "./BrightcoveEmbed";
|
|
14
14
|
|
|
15
15
|
const embedData: BrightcoveEmbedData = {
|
|
16
16
|
resource: "brightcove",
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from "@ndla/types-embed";
|
|
10
|
+
import { Button, Figure } from "@ndla/primitives";
|
|
11
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
9
12
|
import parse from "html-react-parser";
|
|
10
13
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
11
14
|
import { useTranslation } from "react-i18next";
|
|
12
|
-
import { Button, Figure } from "@ndla/primitives";
|
|
13
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from "@ndla/types-embed";
|
|
15
|
-
import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
|
|
16
15
|
import type { RenderContext } from "./types";
|
|
17
16
|
import { EmbedByline } from "../LicenseByline/EmbedByline";
|
|
18
17
|
import { licenseAttributes } from "../utils/licenseAttributes";
|
|
18
|
+
import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
21
|
embed: BrightcoveMetaData;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
9
|
import type { CodeEmbedData, CodeMetaData } from "@ndla/types-embed";
|
|
10
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
11
11
|
import { CodeEmbed } from "./CodeEmbed";
|
|
12
12
|
|
|
13
13
|
const codeEmbedData: CodeEmbedData = {
|
package/src/Embed/CodeEmbed.tsx
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
9
|
+
import type { CodeMetaData } from "@ndla/types-embed";
|
|
11
10
|
import { FileCopyLine, CheckLine } from "@ndla/icons";
|
|
12
11
|
import { Button, Figure } from "@ndla/primitives";
|
|
13
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
13
|
+
import { useEffect, useState } from "react";
|
|
14
|
+
import { useTranslation } from "react-i18next";
|
|
16
15
|
import { CodeBlock } from "../CodeBlock/CodeBlock";
|
|
17
16
|
import { codeLanguageOptions, type ICodeLangugeOption } from "../CodeBlock/codeLanguageOptions";
|
|
17
|
+
import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
|
|
18
18
|
|
|
19
19
|
interface Props {
|
|
20
20
|
embed: CodeMetaData;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { ConceptData, ConceptEmbedData } from "@ndla/types-embed";
|
|
9
10
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
11
|
import { PageContent } from "@ndla/primitives";
|
|
11
|
-
import type { ConceptData, ConceptEmbedData } from "@ndla/types-embed";
|
|
12
|
-
import { ConceptEmbed } from "./ConceptEmbed";
|
|
13
12
|
import { ArticleContent, ArticleWrapper } from "../Article/Article";
|
|
13
|
+
import { ConceptEmbed } from "./ConceptEmbed";
|
|
14
14
|
|
|
15
15
|
const blockEmbedData: ConceptEmbedData = {
|
|
16
16
|
contentId: "35",
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import { forwardRef, useMemo, useRef, type ReactNode } from "react";
|
|
9
|
+
import type { ConceptMetaData } from "@ndla/types-embed";
|
|
11
10
|
import { Portal } from "@ark-ui/react";
|
|
12
11
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
13
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import
|
|
13
|
+
import parse from "html-react-parser";
|
|
14
|
+
import { forwardRef, useMemo, useRef, type ReactNode } from "react";
|
|
15
|
+
import type { RenderContext } from "./types";
|
|
16
|
+
import { Concept, type ConceptProps } from "../Concept/Concept";
|
|
15
17
|
import { ConceptInlineTriggerButton } from "./ConceptInlineTriggerButton";
|
|
16
18
|
import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
|
|
17
19
|
import { GlossEmbed } from "./GlossEmbed";
|
|
18
|
-
import type { RenderContext } from "./types";
|
|
19
|
-
import { Concept, type ConceptProps } from "../Concept/Concept";
|
|
20
20
|
|
|
21
21
|
interface BaseProps {
|
|
22
22
|
renderContext?: RenderContext;
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { ContentLinkMetaData } from "@ndla/types-embed";
|
|
9
10
|
import type { ReactNode } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
11
|
import { Text } from "@ndla/primitives";
|
|
12
|
-
import
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
15
15
|
embed: ContentLinkMetaData;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { CopyrightMetaData } from "@ndla/types-embed";
|
|
9
10
|
import type { ReactNode } from "react";
|
|
10
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import type { CopyrightMetaData } from "@ndla/types-embed";
|
|
12
12
|
import { EmbedByline } from "../LicenseByline/EmbedByline";
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ReactNode } from "react";
|
|
10
9
|
import { ErrorWarningLine } from "@ndla/icons";
|
|
11
10
|
import { Figure, type FigureFloat, type FigureSize } from "@ndla/primitives";
|
|
12
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
+
import { type ReactNode } from "react";
|
|
13
13
|
import { EmbedByline, type EmbedBylineErrorProps } from "../LicenseByline/EmbedByline";
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
|
|
10
10
|
import { ark, type HTMLArkProps } from "@ark-ui/react";
|
|
11
11
|
import { css, cva } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import
|
|
13
|
+
import { forwardRef } from "react";
|
|
14
14
|
|
|
15
15
|
const embedWrapperRecipe = cva({
|
|
16
16
|
base: {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { OembedEmbedData, OembedData } from "@ndla/types-embed";
|
|
9
10
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
11
|
import { PageContent } from "@ndla/primitives";
|
|
11
|
-
import type { OembedEmbedData, OembedData } from "@ndla/types-embed";
|
|
12
|
-
import { ExternalEmbed } from "./ExternalEmbed";
|
|
13
12
|
import { ArticleWrapper, ArticleContent } from "../Article/Article";
|
|
13
|
+
import { ExternalEmbed } from "./ExternalEmbed";
|
|
14
14
|
|
|
15
15
|
const embedData: OembedEmbedData = {
|
|
16
16
|
resource: "external",
|