@ndla/ui 56.0.191-alpha.0 → 56.0.194-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.
Files changed (185) hide show
  1. package/dist/panda.buildinfo.json +10 -0
  2. package/dist/styles.css +53 -1
  3. package/es/AnchorHeading/AnchorHeading.mjs.map +1 -1
  4. package/es/Article/Article.mjs +1 -1
  5. package/es/Article/Article.mjs.map +1 -1
  6. package/es/Article/ArticleByline.mjs +1 -1
  7. package/es/Article/ArticleByline.mjs.map +1 -1
  8. package/es/Article/ArticleFootNotes.mjs.map +1 -1
  9. package/es/Article/BadgesContainer.mjs.map +1 -1
  10. package/es/AudioPlayer/AudioElement.mjs.map +1 -1
  11. package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
  12. package/es/AudioPlayer/AudioProgress.mjs.map +1 -1
  13. package/es/AudioPlayer/CompactAudioPlayer.mjs.map +1 -1
  14. package/es/AudioPlayer/Controls.mjs +1 -1
  15. package/es/AudioPlayer/Controls.mjs.map +1 -1
  16. package/es/AudioPlayer/PlayButton.mjs.map +1 -1
  17. package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
  18. package/es/AudioPlayer/VolumeSlider.mjs.map +1 -1
  19. package/es/AudioPlayer/audioUtils.mjs.map +1 -1
  20. package/es/AudioPlayer/useAudioControls.mjs.map +1 -1
  21. package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
  22. package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
  23. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
  24. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
  25. package/es/CodeBlock/CodeBlock.mjs.map +1 -1
  26. package/es/CodeBlock/codeLanguageOptions.mjs.map +1 -1
  27. package/es/Concept/Concept.mjs.map +1 -1
  28. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  29. package/es/Embed/AudioEmbed.mjs.map +1 -1
  30. package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
  31. package/es/Embed/CodeEmbed.mjs.map +1 -1
  32. package/es/Embed/ConceptEmbed.mjs +1 -1
  33. package/es/Embed/ConceptEmbed.mjs.map +1 -1
  34. package/es/Embed/ConceptInlineTriggerButton.mjs.map +1 -1
  35. package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
  36. package/es/Embed/CopyrightEmbed.mjs.map +1 -1
  37. package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
  38. package/es/Embed/EmbedWrapper.mjs +1 -1
  39. package/es/Embed/EmbedWrapper.mjs.map +1 -1
  40. package/es/Embed/ExternalEmbed.mjs.map +1 -1
  41. package/es/Embed/FootnoteEmbed.mjs.map +1 -1
  42. package/es/Embed/GlossEmbed.mjs +1 -1
  43. package/es/Embed/GlossEmbed.mjs.map +1 -1
  44. package/es/Embed/H5pEmbed.mjs.map +1 -1
  45. package/es/Embed/IframeEmbed.mjs.map +1 -1
  46. package/es/Embed/ImageEmbed.mjs.map +1 -1
  47. package/es/Embed/InlineTriggerButton.mjs.map +1 -1
  48. package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
  49. package/es/Embed/UnknownEmbed.mjs.map +1 -1
  50. package/es/Embed/UuDisclaimerEmbed.mjs +50 -15
  51. package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
  52. package/es/FactBox/FactBox.mjs.map +1 -1
  53. package/es/FileList/File.mjs.map +1 -1
  54. package/es/FileList/FileList.mjs +1 -1
  55. package/es/FileList/FileList.mjs.map +1 -1
  56. package/es/FileList/PdfFile.mjs.map +1 -1
  57. package/es/Gloss/Gloss.mjs +1 -1
  58. package/es/Gloss/Gloss.mjs.map +1 -1
  59. package/es/Gloss/GlossExample.mjs.map +1 -1
  60. package/es/Grid/Grid.mjs.map +1 -1
  61. package/es/KeyFigure/KeyFigure.mjs.map +1 -1
  62. package/es/LicenseByline/EmbedByline.mjs.map +1 -1
  63. package/es/LicenseByline/LicenseLink.mjs.map +1 -1
  64. package/es/LinkBlock/LinkBlock.mjs.map +1 -1
  65. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
  66. package/es/Pitch/Pitch.mjs.map +1 -1
  67. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
  68. package/es/ResourceBox/ResourceBox.mjs.map +1 -1
  69. package/es/TagSelector/TagSelector.mjs +3 -8
  70. package/es/TagSelector/TagSelector.mjs.map +1 -1
  71. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
  72. package/es/i18n/useComponentTranslations.mjs +3 -3
  73. package/es/i18n/useComponentTranslations.mjs.map +1 -1
  74. package/es/model/ContentType.mjs.map +1 -1
  75. package/es/model/SubjectCategories.mjs.map +1 -1
  76. package/es/model/SubjectTypes.mjs.map +1 -1
  77. package/es/model/WordClass.mjs.map +1 -1
  78. package/es/model/index.mjs.map +1 -1
  79. package/es/utils/licenseAttributes.mjs.map +1 -1
  80. package/es/utils/relativeUrl.mjs.map +1 -1
  81. package/lib/AnchorHeading/AnchorHeading.js.map +1 -1
  82. package/lib/Article/Article.d.ts +4 -4
  83. package/lib/Article/Article.js +6 -6
  84. package/lib/Article/Article.js.map +1 -1
  85. package/lib/Article/ArticleByline.js +2 -2
  86. package/lib/Article/ArticleByline.js.map +1 -1
  87. package/lib/Article/ArticleFootNotes.js.map +1 -1
  88. package/lib/Article/BadgesContainer.js.map +1 -1
  89. package/lib/AudioPlayer/AudioElement.js.map +1 -1
  90. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  91. package/lib/AudioPlayer/AudioProgress.d.ts +1 -1
  92. package/lib/AudioPlayer/AudioProgress.js.map +1 -1
  93. package/lib/AudioPlayer/CompactAudioPlayer.js.map +1 -1
  94. package/lib/AudioPlayer/Controls.js +2 -2
  95. package/lib/AudioPlayer/Controls.js.map +1 -1
  96. package/lib/AudioPlayer/PlayButton.js.map +1 -1
  97. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  98. package/lib/AudioPlayer/VolumeSlider.d.ts +1 -1
  99. package/lib/AudioPlayer/VolumeSlider.js.map +1 -1
  100. package/lib/AudioPlayer/audioUtils.js.map +1 -1
  101. package/lib/AudioPlayer/useAudioControls.d.ts +1 -1
  102. package/lib/AudioPlayer/useAudioControls.js.map +1 -1
  103. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  104. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  105. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  106. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  107. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  108. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -1
  109. package/lib/Concept/Concept.js.map +1 -1
  110. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  111. package/lib/Embed/AudioEmbed.js.map +1 -1
  112. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  113. package/lib/Embed/CodeEmbed.js.map +1 -1
  114. package/lib/Embed/ConceptEmbed.js +2 -2
  115. package/lib/Embed/ConceptEmbed.js.map +1 -1
  116. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
  117. package/lib/Embed/ContentLinkEmbed.js.map +1 -1
  118. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  119. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  120. package/lib/Embed/EmbedWrapper.d.ts +1 -1
  121. package/lib/Embed/EmbedWrapper.js +2 -2
  122. package/lib/Embed/EmbedWrapper.js.map +1 -1
  123. package/lib/Embed/ExternalEmbed.js.map +1 -1
  124. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  125. package/lib/Embed/GlossEmbed.js +2 -2
  126. package/lib/Embed/GlossEmbed.js.map +1 -1
  127. package/lib/Embed/H5pEmbed.js.map +1 -1
  128. package/lib/Embed/IframeEmbed.js.map +1 -1
  129. package/lib/Embed/ImageEmbed.js.map +1 -1
  130. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  131. package/lib/Embed/RelatedContentEmbed.js.map +1 -1
  132. package/lib/Embed/UnknownEmbed.js.map +1 -1
  133. package/lib/Embed/UuDisclaimerEmbed.js +49 -14
  134. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
  135. package/lib/FactBox/FactBox.js.map +1 -1
  136. package/lib/FileList/File.js.map +1 -1
  137. package/lib/FileList/FileList.d.ts +2 -2
  138. package/lib/FileList/FileList.js +3 -3
  139. package/lib/FileList/FileList.js.map +1 -1
  140. package/lib/FileList/PdfFile.js.map +1 -1
  141. package/lib/Gloss/Gloss.d.ts +2 -2
  142. package/lib/Gloss/Gloss.js +2 -2
  143. package/lib/Gloss/Gloss.js.map +1 -1
  144. package/lib/Gloss/GlossExample.js.map +1 -1
  145. package/lib/Grid/Grid.js.map +1 -1
  146. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  147. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  148. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  149. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  150. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  151. package/lib/Pitch/Pitch.js.map +1 -1
  152. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  153. package/lib/ResourceBox/ResourceBox.js.map +1 -1
  154. package/lib/TagSelector/TagSelector.d.ts +4 -4
  155. package/lib/TagSelector/TagSelector.js +6 -4
  156. package/lib/TagSelector/TagSelector.js.map +1 -1
  157. package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
  158. package/lib/i18n/useComponentTranslations.d.ts +1 -1
  159. package/lib/i18n/useComponentTranslations.js +3 -3
  160. package/lib/i18n/useComponentTranslations.js.map +1 -1
  161. package/lib/model/ContentType.js.map +1 -1
  162. package/lib/model/SubjectCategories.js.map +1 -1
  163. package/lib/model/SubjectTypes.js.map +1 -1
  164. package/lib/model/WordClass.js.map +1 -1
  165. package/lib/model/index.js.map +1 -1
  166. package/lib/utils/licenseAttributes.js.map +1 -1
  167. package/lib/utils/relativeUrl.js.map +1 -1
  168. package/package.json +9 -9
  169. package/src/Article/Article.tsx +1 -1
  170. package/src/Article/ArticleByline.tsx +1 -1
  171. package/src/AudioPlayer/AudioProgress.tsx +1 -1
  172. package/src/AudioPlayer/Controls.tsx +1 -1
  173. package/src/AudioPlayer/SpeechControl.tsx +1 -1
  174. package/src/AudioPlayer/VolumeSlider.tsx +1 -1
  175. package/src/AudioPlayer/useAudioControls.ts +1 -1
  176. package/src/Embed/ConceptEmbed.tsx +1 -1
  177. package/src/Embed/EmbedWrapper.tsx +1 -1
  178. package/src/Embed/GlossEmbed.tsx +1 -1
  179. package/src/Embed/UuDisclaimerEmbed.stories.tsx +28 -1
  180. package/src/Embed/UuDisclaimerEmbed.tsx +32 -5
  181. package/src/FileList/FileList.tsx +1 -1
  182. package/src/Gloss/Gloss.tsx +1 -1
  183. package/src/TagSelector/TagSelector.stories.tsx +2 -1
  184. package/src/TagSelector/TagSelector.tsx +3 -1
  185. package/src/i18n/useComponentTranslations.ts +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"TagSelector.mjs","names":[],"sources":["../../src/TagSelector/TagSelector.tsx"],"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, useTagsInputContext, useComboboxContext } from \"@ark-ui/react\";\nimport { CloseLine } from \"@ndla/icons\";\nimport {\n ComboboxClearTrigger,\n ComboboxControl,\n type ComboboxControlProps,\n ComboboxInput,\n type ComboboxInputProps,\n ComboboxLabel,\n ComboboxRoot,\n type ComboboxRootProps,\n ComboboxTrigger,\n TagsInputControl,\n type TagsInputControlProps,\n TagsInputInput,\n type TagsInputInputProps,\n TagsInputItem,\n TagsInputItemDeleteTrigger,\n TagsInputItemPreview,\n TagsInputItemText,\n TagsInputRoot,\n type TagsInputRootProps,\n TagsInputItemInput,\n} from \"@ndla/primitives\";\nimport { contains } from \"@ndla/util\";\nimport { forwardRef, useEffect, useId, useRef } from \"react\";\n\nexport type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;\n\nexport const TagSelectorRoot = <T extends CollectionItem>({\n allowCustomValue = true,\n multiple = true,\n selectionBehavior = \"clear\",\n editable,\n addOnPaste = false,\n onValueChange,\n children,\n value,\n translations,\n ...rest\n}: TagSelectorRootProps<T>) => {\n const ids = {\n root: useId(),\n input: useId(),\n control: useId(),\n };\n\n const controlRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n if (!controlRef.current) {\n controlRef.current = document.getElementById(ids.control) as HTMLDivElement | undefined;\n }\n }, [ids.control]);\n\n return (\n <ComboboxRoot\n ids={ids}\n asChild\n allowCustomValue={allowCustomValue}\n multiple={multiple}\n selectionBehavior={selectionBehavior}\n onValueChange={onValueChange}\n translations={translations}\n onPointerDownOutside={(event) => {\n if (contains(controlRef.current, event.detail.originalEvent.target)) {\n event.preventDefault();\n }\n }}\n value={value}\n {...rest}\n >\n <TagSelectorTagsInputRoot\n ids={ids}\n value={value}\n editable={editable}\n onValueChange={onValueChange}\n addOnPaste={addOnPaste}\n translations={translations}\n >\n {children}\n </TagSelectorTagsInputRoot>\n </ComboboxRoot>\n );\n};\n\nconst TagSelectorTagsInputRoot = forwardRef<HTMLDivElement, TagsInputRootProps>((props, ref) => {\n const comboboxApi = useComboboxContext();\n return (\n <TagsInputRoot\n ref={ref}\n onInputValueChange={(details) => comboboxApi.setInputValue(details.inputValue)}\n {...props}\n />\n );\n});\n\nexport type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;\n\nexport const TagSelectorLabel = ComboboxLabel;\n\nexport const TagSelectorItemInput = TagsInputItemInput;\n\nexport const TagSelectorTrigger = ComboboxTrigger;\n\nexport const TagSelectorControl = forwardRef<HTMLDivElement, TagSelectorControlProps>(({ children, ...props }, ref) => {\n return (\n <ComboboxControl ref={ref} asChild>\n <TagsInputControl {...props}>{children}</TagsInputControl>\n </ComboboxControl>\n );\n});\n\nexport const TagSelectorClearTrigger = ComboboxClearTrigger;\n\nexport type TagSelectorInputProps = ComboboxInputProps & TagsInputInputProps;\n\n// If you need to modify the TagsInputItem, you can use this.\nexport const TagSelectorInputBase = forwardRef<HTMLInputElement, TagSelectorInputProps>(\n ({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n );\n },\n);\n\nexport const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputProps>(({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <>\n {tagsApi.value.map((value, index) => (\n <TagsInputItem index={index} value={value} key={value}>\n <TagsInputItemPreview>\n <TagsInputItemText>{value}</TagsInputItemText>\n <TagsInputItemDeleteTrigger>\n <CloseLine />\n </TagsInputItemDeleteTrigger>\n </TagsInputItemPreview>\n <TagsInputItemInput />\n </TagsInputItem>\n ))}\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n </>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;AAqCA,MAAa,mBAA6C,EACxD,mBAAmB,MACnB,WAAW,MACX,oBAAoB,SACpB,UACA,aAAa,OACb,eACA,UACA,OACA,cACA,GAAG,WAC0B;CAC7B,MAAM,MAAM;EACV,MAAM,OAAO;EACb,OAAO,OAAO;EACd,SAAS,OAAO;EACjB;CAED,MAAM,aAAa,OAAmC,KAAA,EAAU;AAEhE,iBAAgB;AACd,MAAI,CAAC,WAAW,QACd,YAAW,UAAU,SAAS,eAAe,IAAI,QAAQ;IAE1D,CAAC,IAAI,QAAQ,CAAC;AAEjB,QACE,oBAAC,cAAD;EACO;EACL,SAAA;EACkB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,WAAD,EAAa,CAAA,EACc,CAAA,CACR,EAAA,CAAA,EACvB,oBAAC,oBAAD,EAAsB,CAAA,CACR;IARgC,MAQhC,CAChB,EACF,oBAAC,eAAD;EAAoB;EAAK,SAAA;YACvB,oBAAC,gBAAD;GACE,YAAY,UAAU;AACpB,QAAI,MAAM,QAAQ,QAChB,SAAQ,SAAS,QAAQ,WAAW;;GAGxC,GAAI;GAEH;GACc,CAAA;EACH,CAAA,CACf,EAAA,CAAA;EAEL"}
1
+ {"version":3,"file":"TagSelector.mjs","names":[],"sources":["../../src/TagSelector/TagSelector.tsx"],"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/collection\";\nimport { useComboboxContext } from \"@ark-ui/react/combobox\";\nimport { useTagsInputContext } from \"@ark-ui/react/tags-input\";\nimport { CloseLine } from \"@ndla/icons\";\nimport {\n ComboboxClearTrigger,\n ComboboxControl,\n type ComboboxControlProps,\n ComboboxInput,\n type ComboboxInputProps,\n ComboboxLabel,\n ComboboxRoot,\n type ComboboxRootProps,\n ComboboxTrigger,\n TagsInputControl,\n type TagsInputControlProps,\n TagsInputInput,\n type TagsInputInputProps,\n TagsInputItem,\n TagsInputItemDeleteTrigger,\n TagsInputItemPreview,\n TagsInputItemText,\n TagsInputRoot,\n type TagsInputRootProps,\n TagsInputItemInput,\n} from \"@ndla/primitives\";\nimport { contains } from \"@ndla/util\";\nimport { forwardRef, useEffect, useId, useRef } from \"react\";\n\nexport type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;\n\nexport const TagSelectorRoot = <T extends CollectionItem>({\n allowCustomValue = true,\n multiple = true,\n selectionBehavior = \"clear\",\n editable,\n addOnPaste = false,\n onValueChange,\n children,\n value,\n translations,\n ...rest\n}: TagSelectorRootProps<T>) => {\n const ids = {\n root: useId(),\n input: useId(),\n control: useId(),\n };\n\n const controlRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n if (!controlRef.current) {\n controlRef.current = document.getElementById(ids.control) as HTMLDivElement | undefined;\n }\n }, [ids.control]);\n\n return (\n <ComboboxRoot\n ids={ids}\n asChild\n allowCustomValue={allowCustomValue}\n multiple={multiple}\n selectionBehavior={selectionBehavior}\n onValueChange={onValueChange}\n translations={translations}\n onPointerDownOutside={(event) => {\n if (contains(controlRef.current, event.detail.originalEvent.target)) {\n event.preventDefault();\n }\n }}\n value={value}\n {...rest}\n >\n <TagSelectorTagsInputRoot\n ids={ids}\n value={value}\n editable={editable}\n onValueChange={onValueChange}\n addOnPaste={addOnPaste}\n translations={translations}\n >\n {children}\n </TagSelectorTagsInputRoot>\n </ComboboxRoot>\n );\n};\n\nconst TagSelectorTagsInputRoot = forwardRef<HTMLDivElement, TagsInputRootProps>((props, ref) => {\n const comboboxApi = useComboboxContext();\n return (\n <TagsInputRoot\n ref={ref}\n onInputValueChange={(details) => comboboxApi.setInputValue(details.inputValue)}\n {...props}\n />\n );\n});\n\nexport type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;\n\nexport const TagSelectorLabel = ComboboxLabel;\n\nexport const TagSelectorItemInput = TagsInputItemInput;\n\nexport const TagSelectorTrigger = ComboboxTrigger;\n\nexport const TagSelectorControl = forwardRef<HTMLDivElement, TagSelectorControlProps>(({ children, ...props }, ref) => {\n return (\n <ComboboxControl ref={ref} asChild>\n <TagsInputControl {...props}>{children}</TagsInputControl>\n </ComboboxControl>\n );\n});\n\nexport const TagSelectorClearTrigger = ComboboxClearTrigger;\n\nexport type TagSelectorInputProps = ComboboxInputProps & TagsInputInputProps;\n\n// If you need to modify the TagsInputItem, you can use this.\nexport const TagSelectorInputBase = forwardRef<HTMLInputElement, TagSelectorInputProps>(\n ({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n );\n },\n);\n\nexport const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputProps>(({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <>\n {tagsApi.value.map((value, index) => (\n <TagsInputItem index={index} value={value} key={value}>\n <TagsInputItemPreview>\n <TagsInputItemText>{value}</TagsInputItemText>\n <TagsInputItemDeleteTrigger>\n <CloseLine />\n </TagsInputItemDeleteTrigger>\n </TagsInputItemPreview>\n <TagsInputItemInput />\n </TagsInputItem>\n ))}\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n </>\n );\n});\n"],"mappings":";;;;;;;;;AAuCA,MAAa,mBAA6C,EACxD,mBAAmB,MACnB,WAAW,MACX,oBAAoB,SACpB,UACA,aAAa,OACb,eACA,UACA,OACA,cACA,GAAG,WAC0B;CAC7B,MAAM,MAAM;EACV,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,SAAS,MAAM;CACjB;CAEA,MAAM,aAAa,OAAmC,KAAA,CAAS;CAE/D,gBAAgB;EACd,IAAI,CAAC,WAAW,SACd,WAAW,UAAU,SAAS,eAAe,IAAI,OAAO;CAE5D,GAAG,CAAC,IAAI,OAAO,CAAC;CAEhB,OACE,oBAAC,cAAD;EACO;EACL,SAAA;EACkB;EACR;EACS;EACJ;EACD;EACd,uBAAuB,UAAU;GAC/B,IAAI,SAAS,WAAW,SAAS,MAAM,OAAO,cAAc,MAAM,GAChE,MAAM,eAAe;EAEzB;EACO;EACP,GAAI;YAEJ,oBAAC,0BAAD;GACO;GACE;GACG;GACK;GACH;GACE;GAEb;EACuB,CAAA;CACd,CAAA;AAElB;AAEA,MAAM,2BA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Q,SAAS,QAAQ,UAAU;GAEvC;GACA,GAAI;GAEH;EACa,CAAA;CACH,CAAA,CACf,EAAA,CAAA;AAEN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ZendeskButton.mjs","names":[],"sources":["../../src/ZendeskButton/ZendeskButton.tsx"],"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 { Button, type ButtonProps } from \"@ndla/primitives\";\nimport { forwardRef, useState } from \"react\";\n\n// TODO: Let's consider abandoning `disabled` on the button here. It should instead just open/close the widget based on its current state.\n\nexport interface ZendeskButtonProps extends ButtonProps {\n widgetKey: string;\n locale: string;\n}\n\ndeclare global {\n interface Window {\n zE: (modifier: string, action: string, callback?: (() => void) | string) => void;\n }\n}\n\nexport const ZendeskButton = forwardRef<HTMLButtonElement, ZendeskButtonProps>(\n ({ locale, variant = \"secondary\", widgetKey, children, ...rest }, ref) => {\n const [loading, setLoading] = useState(false);\n const handleClick = () => {\n if (window && !window.zE) {\n setLoading(true);\n // Asynchronously load zendesk scripts for better performance\n const script = document.createElement(\"script\");\n script.id = \"ze-snippet\";\n script.type = \"text/javascript\";\n script.async = true;\n script.onload = () => {\n if (window.zE) {\n window.zE(\"webWidget\", \"setLocale\", locale);\n window.zE(\"webWidget:on\", \"close\", () => {\n setLoading(false);\n });\n window.zE(\"webWidget\", \"open\");\n }\n };\n script.src = `https://static.zdassets.com/ekr/snippet.js?key=${widgetKey}`;\n document.body.appendChild(script);\n } else if (window?.zE) {\n window.zE(\"webWidget\", \"open\");\n }\n };\n\n return (\n <Button onClick={handleClick} variant={variant} id=\"zendeskButton\" disabled={loading} {...rest} ref={ref}>\n {children}\n </Button>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;AAwBA,MAAa,gBAAgB,YAC1B,EAAE,QAAQ,UAAU,aAAa,WAAW,UAAU,GAAG,QAAQ,QAAQ;CACxE,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAC7C,MAAM,oBAAoB;AACxB,MAAI,UAAU,CAAC,OAAO,IAAI;AACxB,cAAW,KAAK;GAEhB,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,UAAO,KAAK;AACZ,UAAO,OAAO;AACd,UAAO,QAAQ;AACf,UAAO,eAAe;AACpB,QAAI,OAAO,IAAI;AACb,YAAO,GAAG,aAAa,aAAa,OAAO;AAC3C,YAAO,GAAG,gBAAgB,eAAe;AACvC,iBAAW,MAAM;OACjB;AACF,YAAO,GAAG,aAAa,OAAO;;;AAGlC,UAAO,MAAM,kDAAkD;AAC/D,YAAS,KAAK,YAAY,OAAO;aACxB,QAAQ,GACjB,QAAO,GAAG,aAAa,OAAO;;AAIlC,QACE,oBAAC,QAAD;EAAQ,SAAS;EAAsB;EAAS,IAAG;EAAgB,UAAU;EAAS,GAAI;EAAW;EAClG;EACM,CAAA;EAGd"}
1
+ {"version":3,"file":"ZendeskButton.mjs","names":[],"sources":["../../src/ZendeskButton/ZendeskButton.tsx"],"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 { Button, type ButtonProps } from \"@ndla/primitives\";\nimport { forwardRef, useState } from \"react\";\n\n// TODO: Let's consider abandoning `disabled` on the button here. It should instead just open/close the widget based on its current state.\n\nexport interface ZendeskButtonProps extends ButtonProps {\n widgetKey: string;\n locale: string;\n}\n\ndeclare global {\n interface Window {\n zE: (modifier: string, action: string, callback?: (() => void) | string) => void;\n }\n}\n\nexport const ZendeskButton = forwardRef<HTMLButtonElement, ZendeskButtonProps>(\n ({ locale, variant = \"secondary\", widgetKey, children, ...rest }, ref) => {\n const [loading, setLoading] = useState(false);\n const handleClick = () => {\n if (window && !window.zE) {\n setLoading(true);\n // Asynchronously load zendesk scripts for better performance\n const script = document.createElement(\"script\");\n script.id = \"ze-snippet\";\n script.type = \"text/javascript\";\n script.async = true;\n script.onload = () => {\n if (window.zE) {\n window.zE(\"webWidget\", \"setLocale\", locale);\n window.zE(\"webWidget:on\", \"close\", () => {\n setLoading(false);\n });\n window.zE(\"webWidget\", \"open\");\n }\n };\n script.src = `https://static.zdassets.com/ekr/snippet.js?key=${widgetKey}`;\n document.body.appendChild(script);\n } else if (window?.zE) {\n window.zE(\"webWidget\", \"open\");\n }\n };\n\n return (\n <Button onClick={handleClick} variant={variant} id=\"zendeskButton\" disabled={loading} {...rest} ref={ref}>\n {children}\n </Button>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;AAwBA,MAAa,gBAAgB,YAC1B,EAAE,QAAQ,UAAU,aAAa,WAAW,UAAU,GAAG,QAAQ,QAAQ;CACxE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,oBAAoB;EACxB,IAAI,UAAU,CAAC,OAAO,IAAI;GACxB,WAAW,IAAI;GAEf,MAAM,SAAS,SAAS,cAAc,QAAQ;GAC9C,OAAO,KAAK;GACZ,OAAO,OAAO;GACd,OAAO,QAAQ;GACf,OAAO,eAAe;IACpB,IAAI,OAAO,IAAI;KACb,OAAO,GAAG,aAAa,aAAa,MAAM;KAC1C,OAAO,GAAG,gBAAgB,eAAe;MACvC,WAAW,KAAK;KAClB,CAAC;KACD,OAAO,GAAG,aAAa,MAAM;IAC/B;GACF;GACA,OAAO,MAAM,kDAAkD;GAC/D,SAAS,KAAK,YAAY,MAAM;EAClC,OAAO,IAAI,QAAQ,IACjB,OAAO,GAAG,aAAa,MAAM;CAEjC;CAEA,OACE,oBAAC,QAAD;EAAQ,SAAS;EAAsB;EAAS,IAAG;EAAgB,UAAU;EAAS,GAAI;EAAW;EAClG;CACK,CAAA;AAEZ,CACF"}
@@ -119,9 +119,9 @@ const useDatePickerTranslations = (translations) => {
119
119
  const { t } = useTranslation("translation", { keyPrefix: "component.datePicker" });
120
120
  return useMemo(() => ({
121
121
  dayCell: (state) => {
122
- if (state.unavailable) return t("dayCell.unavailable", { date: state.formattedDate });
123
- else if (state.selected) return t("dayCell.selected", { date: state.formattedDate });
124
- else return t("dayCell.select", { date: state.formattedDate });
122
+ if (state.unavailable) return t("dayCell.unavailable", { date: state.valueText });
123
+ else if (state.selected) return t("dayCell.selected", { date: state.valueText });
124
+ else return t("dayCell.select", { date: state.valueText });
125
125
  },
126
126
  nextTrigger: (view) => t(`nextTrigger.${view}`),
127
127
  prevTrigger: (view) => t(`prevTrigger.${view}`),
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentTranslations.mjs","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,MAAM,eAAe,eAAe,EAAE,WAAW,uBAAuB,CAAC;AAEjF,QAAO,eACE;EACL,mBAAmB,EA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AgB,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,MAAM,eAAe,eAAe,EAAE,WAAW,wBAAwB,CAAC;AAElF,QAAO,eACE;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.mjs","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/collection\";\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.valueText });\n } else if (state.selected) {\n return t(\"dayCell.selected\", { date: state.valueText });\n } else return t(\"dayCell.select\", { date: state.valueText });\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,MAAM,eAAe,eAAe,EAAE,WAAW,sBAAsB,CAAC;CAEhF,OAAO,eACE;EACL,mBAAmB,EAAE,mBAAmB;EACxC,wBAAwB,QAAQ,EAAE,yBAAyB,EAAE,IAAI,CAAC;EAClE,WAAW,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC;EACxC,aAAa,QAAQ,EAAE,cAAc,EAAE,QAAQ,IAAI,OAAO,CAAC;EAC3D,YAAY,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC;EAC1C,aAAa,QAAQ,EAAE,cAAc,EAAE,IAAI,CAAC;EAC5C,aAAa,QAAQ,EAAE,cAAc,EAAE,IAAI,CAAC;EAC5C,cAAc,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;EAC9C,GAAG;CACL,IACA,CAAC,GAAG,YAAY,CAClB;AACF;AAEA,MAAa,2BACX,iBACyC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,MAAM,UAAU,CAAC;QACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,UAAU,CAAC;EAC7D;EACA,cAAc,SAAS,EAAE,eAAe,MAAM;EAC9C,cAAc,SAAS,EAAE,eAAe,MAAM;EAC9C,aAAa,EAAE,aAAa;EAC5B,YAAY,EAAE,YAAY;EAC1B,cAAc,SAAS,EAAE,eAAe,MAAM;EAC9C,gBAAgB,UAAU;GACxB,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,EAAE,uBAAuB;IAAE,OAAO,MAAM;IAAI,KAAK,MAAM;GAAG,CAAC;QAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,MAAM,CAAC;EACzD;EACA,cAAc,EAAE,cAAc;EAC9B,UAAU,SAAS,EAAE,WAAW,OAAO,UAAU,QAAQ;EACzD,SAAS,EAAE,SAAS;EACpB,cAAc,YAAY;GACxB,OAAO;IAAE,KAAK;IAAM,OAAO;IAAM,MAAM;GAAO;EAChD;EACA,GAAG;CACL,IACA,CAAC,GAAG,YAAY,CAClB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentType.mjs","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"}
1
+ {"version":3,"file":"ContentType.mjs","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;AACF;AAEA,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;AACX;AAEA,MAAa,2BAAmD;CAC9D,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,SAAS;CACT,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubjectCategories.mjs","names":[],"sources":["../../src/model/SubjectCategories.ts"],"sourcesContent":["/**\n * Copyright (c) 2021-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 ACTIVE_SUBJECTS = \"active\";\nexport const ARCHIVE_SUBJECTS = \"archive\";\nexport const BETA_SUBJECTS = \"beta\";\nexport const OTHER = \"otherResources\";\n\nexport const subjectCategories = {\n ACTIVE_SUBJECTS,\n ARCHIVE_SUBJECTS,\n BETA_SUBJECTS,\n OTHER,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AAErB,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"SubjectCategories.mjs","names":[],"sources":["../../src/model/SubjectCategories.ts"],"sourcesContent":["/**\n * Copyright (c) 2021-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 ACTIVE_SUBJECTS = \"active\";\nexport const ARCHIVE_SUBJECTS = \"archive\";\nexport const BETA_SUBJECTS = \"beta\";\nexport const OTHER = \"otherResources\";\n\nexport const subjectCategories = {\n ACTIVE_SUBJECTS,\n ARCHIVE_SUBJECTS,\n BETA_SUBJECTS,\n OTHER,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AAErB,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubjectTypes.mjs","names":[],"sources":["../../src/model/SubjectTypes.ts"],"sourcesContent":["/**\n * Copyright (c) 2022-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 BETA_SUBJECT = \"betaSubject\";\nexport const SUBJECT = \"subject\";\nexport const RESOURCE_COLLECTION = \"resourceCollection\";\nexport const ARCHIVE_SUBJECT = \"archiveSubject\";\n\nexport const subjectTypes = {\n BETA_SUBJECT,\n SUBJECT,\n RESOURCE_COLLECTION,\n ARCHIVE_SUBJECT,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAa,eAAe;AAC5B,MAAa,UAAU;AACvB,MAAa,sBAAsB;AACnC,MAAa,kBAAkB;AAE/B,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"SubjectTypes.mjs","names":[],"sources":["../../src/model/SubjectTypes.ts"],"sourcesContent":["/**\n * Copyright (c) 2022-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 BETA_SUBJECT = \"betaSubject\";\nexport const SUBJECT = \"subject\";\nexport const RESOURCE_COLLECTION = \"resourceCollection\";\nexport const ARCHIVE_SUBJECT = \"archiveSubject\";\n\nexport const subjectTypes = {\n BETA_SUBJECT,\n SUBJECT,\n RESOURCE_COLLECTION,\n ARCHIVE_SUBJECT,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAa,eAAe;AAC5B,MAAa,UAAU;AACvB,MAAa,sBAAsB;AACnC,MAAa,kBAAkB;AAE/B,MAAa,eAAe;CAC1B;CACA;CACA;CACA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"WordClass.mjs","names":[],"sources":["../../src/model/WordClass.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-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 wordClass = {\n adjective: \"adjective\",\n adverb: \"adverb\",\n properNoun: \"proper-noun\",\n auxiliary: \"auxiliary\",\n complement: \"complement\",\n conjunction: \"conjunction\",\n coverb: \"coverb\",\n determiner: \"determiner\",\n interjection: \"interjection\",\n quantifier: \"quantifier\",\n marker: \"marker\",\n modalVerb: \"modal-verb\",\n measureWord: \"measure-word\",\n noun: \"noun\",\n \"noun-zh\": \"noun-zh\",\n nounPhrase: \"noun-phrase\",\n onomatopoeia: \"onomatopoeia\",\n particle: \"particle\",\n demonstrative: \"demonstrative\",\n personalPronoun: \"personal-pronoun\",\n preposition: \"preposition\",\n pronoun: \"pronoun\",\n questionWord: \"question-word\",\n locationWord: \"location-word\",\n suffix: \"suffix\",\n numeral: \"numeral\",\n timeWord: \"time word\",\n timeExpression: \"time-expression\",\n stativeVerb: \"stative-verb\",\n subordinatingConjunction: \"subordinating-conjunction\",\n exclamationWord: \"exclamation-word\",\n expression: \"expression\",\n verb: \"verb\",\n verbComplement: \"verb-complement\",\n verbObject: \"verb-object\",\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,YAAY;CACvB,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,aAAa;CACb,QAAQ;CACR,YAAY;CACZ,cAAc;CACd,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,aAAa;CACb,MAAM;CACN,WAAW;CACX,YAAY;CACZ,cAAc;CACd,UAAU;CACV,eAAe;CACf,iBAAiB;CACjB,aAAa;CACb,SAAS;CACT,cAAc;CACd,cAAc;CACd,QAAQ;CACR,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,aAAa;CACb,0BAA0B;CAC1B,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,YAAY;CACb"}
1
+ {"version":3,"file":"WordClass.mjs","names":[],"sources":["../../src/model/WordClass.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-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 wordClass = {\n adjective: \"adjective\",\n adverb: \"adverb\",\n properNoun: \"proper-noun\",\n auxiliary: \"auxiliary\",\n complement: \"complement\",\n conjunction: \"conjunction\",\n coverb: \"coverb\",\n determiner: \"determiner\",\n interjection: \"interjection\",\n quantifier: \"quantifier\",\n marker: \"marker\",\n modalVerb: \"modal-verb\",\n measureWord: \"measure-word\",\n noun: \"noun\",\n \"noun-zh\": \"noun-zh\",\n nounPhrase: \"noun-phrase\",\n onomatopoeia: \"onomatopoeia\",\n particle: \"particle\",\n demonstrative: \"demonstrative\",\n personalPronoun: \"personal-pronoun\",\n preposition: \"preposition\",\n pronoun: \"pronoun\",\n questionWord: \"question-word\",\n locationWord: \"location-word\",\n suffix: \"suffix\",\n numeral: \"numeral\",\n timeWord: \"time word\",\n timeExpression: \"time-expression\",\n stativeVerb: \"stative-verb\",\n subordinatingConjunction: \"subordinating-conjunction\",\n exclamationWord: \"exclamation-word\",\n expression: \"expression\",\n verb: \"verb\",\n verbComplement: \"verb-complement\",\n verbObject: \"verb-object\",\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,YAAY;CACvB,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,aAAa;CACb,QAAQ;CACR,YAAY;CACZ,cAAc;CACd,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,aAAa;CACb,MAAM;CACN,WAAW;CACX,YAAY;CACZ,cAAc;CACd,UAAU;CACV,eAAe;CACf,iBAAiB;CACjB,aAAa;CACb,SAAS;CACT,cAAc;CACd,cAAc;CACd,QAAQ;CACR,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,aAAa;CACb,0BAA0B;CAC1B,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,YAAY;AACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/model/index.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\nimport { contentTypes, contentTypeMapping, resourceEmbedTypeMapping } from \"./ContentType\";\nimport * as subjectCategories from \"./SubjectCategories\";\nimport * as subjectTypes from \"./SubjectTypes\";\nimport * as wordClass from \"./WordClass\";\n\nexport const constants = {\n contentTypes,\n subjectCategories,\n subjectTypes,\n contentTypeMapping,\n resourceEmbedTypeMapping,\n wordClass,\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,YAAY;CACvB;CACA,mBAAA;CACA,cAAA;CACA;CACA;CACA,WAAA;CACD"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/model/index.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\nimport { contentTypes, contentTypeMapping, resourceEmbedTypeMapping } from \"./ContentType\";\nimport * as subjectCategories from \"./SubjectCategories\";\nimport * as subjectTypes from \"./SubjectTypes\";\nimport * as wordClass from \"./WordClass\";\n\nexport const constants = {\n contentTypes,\n subjectCategories,\n subjectTypes,\n contentTypeMapping,\n resourceEmbedTypeMapping,\n wordClass,\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,YAAY;CACvB;CACA,mBAAA;CACA,cAAA;CACA;CACA;CACA,WAAA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"licenseAttributes.mjs","names":[],"sources":["../../src/utils/licenseAttributes.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 { getLicenseByAbbreviation, isCreativeCommonsLicense } from \"@ndla/licenses\";\n\nexport const licenseAttributes = (license: string | undefined, lang: string | undefined, url: string | undefined) => {\n const licenseAbbr = getLicenseByAbbreviation(license ? license : \"\", lang);\n\n const licenseProps = isCreativeCommonsLicense(licenseAbbr.rights)\n ? {\n \"xmlns:cc\": \"https://creativecommons.org/ns#\",\n \"xmlns:dct\": \"http://purl.org/dc/terms/\",\n about: url ?? undefined,\n }\n : {};\n\n return licenseProps;\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,qBAAqB,SAA6B,MAA0B,QAA4B;AAWnH,QARqB,yBAFD,yBAAyB,UAAU,UAAU,IAAI,KAEZ,CAAC,OAAO,GAC7D;EACE,YAAY;EACZ,aAAa;EACb,OAAO,OAAO,KAAA;EACf,GACD,EAAE"}
1
+ {"version":3,"file":"licenseAttributes.mjs","names":[],"sources":["../../src/utils/licenseAttributes.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 { getLicenseByAbbreviation, isCreativeCommonsLicense } from \"@ndla/licenses\";\n\nexport const licenseAttributes = (license: string | undefined, lang: string | undefined, url: string | undefined) => {\n const licenseAbbr = getLicenseByAbbreviation(license ? license : \"\", lang);\n\n const licenseProps = isCreativeCommonsLicense(licenseAbbr.rights)\n ? {\n \"xmlns:cc\": \"https://creativecommons.org/ns#\",\n \"xmlns:dct\": \"http://purl.org/dc/terms/\",\n about: url ?? undefined,\n }\n : {};\n\n return licenseProps;\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,qBAAqB,SAA6B,MAA0B,QAA4B;CAWnH,OARqB,yBAFD,yBAAyB,UAAU,UAAU,IAAI,IAEb,EAAE,MAAM,IAC5D;EACE,YAAY;EACZ,aAAa;EACb,OAAO,OAAO,KAAA;CAChB,IACA,CAAC;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"relativeUrl.mjs","names":[],"sources":["../../src/utils/relativeUrl.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-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\nconst supportedTranslationLanguages = [\"nb\", \"nn\", \"en\", \"se\"] as const;\n\nconst ENV_REGEX = /(staging|test)\\.?/;\nconst LANGUAGE_REGEX = new RegExp(`^\\\\/((?:${supportedTranslationLanguages.join(\"|\")})(?:$|\\\\/))`, \"\");\n\nconst NDLA_URL = /(.*\\.)?ndla.no.*/;\nconst REPLACE_WWW = /^www\\./;\n\nexport const getPossiblyRelativeUrl = (url: string, path?: string) => {\n if (!path) return url;\n // If url is a mailto link, return url as is.\n if (url.startsWith(\"mailto:\")) return url;\n // If not on NDLA, or if url is not a NDLA url, return url as is\n if (!NDLA_URL.test(url) || !NDLA_URL.test(path)) return url;\n //Remove environment info\n const urlObj = new URL(url.replace(ENV_REGEX, \"\"));\n const pathObj = new URL(path.replace(ENV_REGEX, \"\"));\n // If the host is the same, return the relative path\n if (urlObj.hostname.replace(REPLACE_WWW, \"\") === pathObj.hostname.replace(REPLACE_WWW, \"\")) {\n // Replace the language part of the url with the language part of the path\n // Keep the search params if they exist\n const search = urlObj.search;\n // If the path language part does not exist, remove it.\n const urlMatch = urlObj.pathname.match(LANGUAGE_REGEX);\n const pathMatch = pathObj.pathname.match(LANGUAGE_REGEX);\n if (urlMatch?.[1] && urlMatch?.[1] !== pathMatch?.[1]) {\n return `${urlObj.pathname.replace(urlMatch[1], pathMatch?.[1] || \"\")}${search}`;\n }\n\n return `${urlObj.pathname}${search}`;\n }\n return url;\n};\n"],"mappings":";;;;;;;;AAQA,MAAM,gCAAgC;CAAC;CAAM;CAAM;CAAM;CAAK;AAE9D,MAAM,YAAY;AAClB,MAAM,iBAAiB,IAAI,OAAO,WAAW,8BAA8B,KAAK,IAAI,CAAC,cAAc,GAAG;AAEtG,MAAM,WAAW;AACjB,MAAM,cAAc;AAEpB,MAAa,0BAA0B,KAAa,SAAkB;AACpE,KAAI,CAAC,KAAM,QAAO;AAElB,KAAI,IAAI,WAAW,UAAU,CAAE,QAAO;AAEtC,KAAI,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAE,QAAO;CAExD,MAAM,SAAS,IAAI,IAAI,IAAI,QAAQ,WAAW,GAAG,CAAC;CAClD,MAAM,UAAU,IAAI,IAAI,KAAK,QAAQ,WAAW,GAAG,CAAC;AAEpD,KAAI,OAAO,SAAS,QAAQ,aAAa,GAAG,KAAK,QAAQ,SAAS,QAAQ,aAAa,GAAG,EAAE;EAG1F,MAAM,SAAS,OAAO;EAEtB,MAAM,WAAW,OAAO,SAAS,MAAM,eAAe;EACtD,MAAM,YAAY,QAAQ,SAAS,MAAM,eAAe;AACxD,MAAI,WAAW,MAAM,WAAW,OAAO,YAAY,GACjD,QAAO,GAAG,OAAO,SAAS,QAAQ,SAAS,IAAI,YAAY,MAAM,GAAG,GAAG;AAGzE,SAAO,GAAG,OAAO,WAAW;;AAE9B,QAAO"}
1
+ {"version":3,"file":"relativeUrl.mjs","names":[],"sources":["../../src/utils/relativeUrl.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-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\nconst supportedTranslationLanguages = [\"nb\", \"nn\", \"en\", \"se\"] as const;\n\nconst ENV_REGEX = /(staging|test)\\.?/;\nconst LANGUAGE_REGEX = new RegExp(`^\\\\/((?:${supportedTranslationLanguages.join(\"|\")})(?:$|\\\\/))`, \"\");\n\nconst NDLA_URL = /(.*\\.)?ndla.no.*/;\nconst REPLACE_WWW = /^www\\./;\n\nexport const getPossiblyRelativeUrl = (url: string, path?: string) => {\n if (!path) return url;\n // If url is a mailto link, return url as is.\n if (url.startsWith(\"mailto:\")) return url;\n // If not on NDLA, or if url is not a NDLA url, return url as is\n if (!NDLA_URL.test(url) || !NDLA_URL.test(path)) return url;\n //Remove environment info\n const urlObj = new URL(url.replace(ENV_REGEX, \"\"));\n const pathObj = new URL(path.replace(ENV_REGEX, \"\"));\n // If the host is the same, return the relative path\n if (urlObj.hostname.replace(REPLACE_WWW, \"\") === pathObj.hostname.replace(REPLACE_WWW, \"\")) {\n // Replace the language part of the url with the language part of the path\n // Keep the search params if they exist\n const search = urlObj.search;\n // If the path language part does not exist, remove it.\n const urlMatch = urlObj.pathname.match(LANGUAGE_REGEX);\n const pathMatch = pathObj.pathname.match(LANGUAGE_REGEX);\n if (urlMatch?.[1] && urlMatch?.[1] !== pathMatch?.[1]) {\n return `${urlObj.pathname.replace(urlMatch[1], pathMatch?.[1] || \"\")}${search}`;\n }\n\n return `${urlObj.pathname}${search}`;\n }\n return url;\n};\n"],"mappings":";;;;;;;;AAQA,MAAM,gCAAgC;CAAC;CAAM;CAAM;CAAM;AAAI;AAE7D,MAAM,YAAY;AAClB,MAAM,iBAAiB,IAAI,OAAO,WAAW,8BAA8B,KAAK,GAAG,EAAE,cAAc,EAAE;AAErG,MAAM,WAAW;AACjB,MAAM,cAAc;AAEpB,MAAa,0BAA0B,KAAa,SAAkB;CACpE,IAAI,CAAC,MAAM,OAAO;CAElB,IAAI,IAAI,WAAW,SAAS,GAAG,OAAO;CAEtC,IAAI,CAAC,SAAS,KAAK,GAAG,KAAK,CAAC,SAAS,KAAK,IAAI,GAAG,OAAO;CAExD,MAAM,SAAS,IAAI,IAAI,IAAI,QAAQ,WAAW,EAAE,CAAC;CACjD,MAAM,UAAU,IAAI,IAAI,KAAK,QAAQ,WAAW,EAAE,CAAC;CAEnD,IAAI,OAAO,SAAS,QAAQ,aAAa,EAAE,MAAM,QAAQ,SAAS,QAAQ,aAAa,EAAE,GAAG;EAG1F,MAAM,SAAS,OAAO;EAEtB,MAAM,WAAW,OAAO,SAAS,MAAM,cAAc;EACrD,MAAM,YAAY,QAAQ,SAAS,MAAM,cAAc;EACvD,IAAI,WAAW,MAAM,WAAW,OAAO,YAAY,IACjD,OAAO,GAAG,OAAO,SAAS,QAAQ,SAAS,IAAI,YAAY,MAAM,EAAE,IAAI;EAGzE,OAAO,GAAG,OAAO,WAAW;CAC9B;CACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHeading.js","names":["SafeLink"],"sources":["../../src/AnchorHeading/AnchorHeading.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-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 { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode, useMemo } from \"react\";\n\nconst StyledAnchor = styled(SafeLink, {\n base: {\n _before: {\n position: \"absolute\",\n marginInlineStart: \"-0.75em\",\n content: '\"#\"',\n visibility: \"hidden\",\n },\n _hover: {\n textDecoration: \"underline\",\n tablet: {\n _before: {\n visibility: \"visible\",\n },\n },\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\n\nfunction slugifyUnicode(input: string) {\n return (\n input\n .trim()\n .toLowerCase()\n // Normalize to reduce weird Unicode equivalences\n .normalize(\"NFKC\")\n // Keep any Unicode letters/numbers; replace everything else with \"-\"\n .replace(/[^\\p{Letter}\\p{Number}]+/gu, \"_\")\n // Trim leading/trailing \"-\"\n .replace(/^-+|-+$/g, \"\")\n );\n}\n\nexport const AnchorHeading = ({ children, copyText, lang }: Props) => {\n const slug = useMemo(() => slugifyUnicode(copyText.replace(/ /g, \"_\")), [copyText]);\n\n return (\n <h2 id={slug} lang={lang} tabIndex={-1}>\n <StyledAnchor to={`#${encodeURIComponent(slug)}`}>{children}</StyledAnchor>\n </h2>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,eAAAA,UAAU,EACpC,MAAM;CACJ,SAAS;EACP,UAAU;EACV,mBAAmB;EACnB,SAAS;EACT,YAAY;EACb;CACD,QAAQ;EACN,gBAAgB;EAChB,QAAQ,EACN,SAAS,EACP,YAAY,WACb,EACF;EACF;CACF,EACF,CAAC;AASF,SAAS,eAAe,OAAe;AACrC,QACE,MACG,MAAM,CACN,aAAa,CAEb,UAAU,OAAO,CAEjB,QAAQ,8BAA8B,IAAI,CAE1C,QAAQ,YAAY,GAAG;;AAI9B,MAAa,iBAAiB,EAAE,UAAU,UAAU,WAAkB;CACpE,MAAM,QAAA,GAAA,MAAA,eAAqB,eAAe,SAAS,QAAQ,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC;AAEnF,QACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;EAAI,IAAI;EAAY;EAAM,UAAU;YAClC,iBAAA,GAAA,kBAAA,KAAC,cAAD;GAAc,IAAI,IAAI,mBAAmB,KAAK;GAAK;GAAwB,CAAA;EACxE,CAAA"}
1
+ {"version":3,"file":"AnchorHeading.js","names":["SafeLink"],"sources":["../../src/AnchorHeading/AnchorHeading.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-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 { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode, useMemo } from \"react\";\n\nconst StyledAnchor = styled(SafeLink, {\n base: {\n _before: {\n position: \"absolute\",\n marginInlineStart: \"-0.75em\",\n content: '\"#\"',\n visibility: \"hidden\",\n },\n _hover: {\n textDecoration: \"underline\",\n tablet: {\n _before: {\n visibility: \"visible\",\n },\n },\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\n\nfunction slugifyUnicode(input: string) {\n return (\n input\n .trim()\n .toLowerCase()\n // Normalize to reduce weird Unicode equivalences\n .normalize(\"NFKC\")\n // Keep any Unicode letters/numbers; replace everything else with \"-\"\n .replace(/[^\\p{Letter}\\p{Number}]+/gu, \"_\")\n // Trim leading/trailing \"-\"\n .replace(/^-+|-+$/g, \"\")\n );\n}\n\nexport const AnchorHeading = ({ children, copyText, lang }: Props) => {\n const slug = useMemo(() => slugifyUnicode(copyText.replace(/ /g, \"_\")), [copyText]);\n\n return (\n <h2 id={slug} lang={lang} tabIndex={-1}>\n <StyledAnchor to={`#${encodeURIComponent(slug)}`}>{children}</StyledAnchor>\n </h2>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,eAAAA,UAAU,EACpC,MAAM;CACJ,SAAS;EACP,UAAU;EACV,mBAAmB;EACnB,SAAS;EACT,YAAY;CACd;CACA,QAAQ;EACN,gBAAgB;EAChB,QAAQ,EACN,SAAS,EACP,YAAY,UACd,EACF;CACF;AACF,EACF,CAAC;AASD,SAAS,eAAe,OAAe;CACrC,OACE,MACG,KAAK,EACL,YAAY,EAEZ,UAAU,MAAM,EAEhB,QAAQ,8BAA8B,GAAG,EAEzC,QAAQ,YAAY,EAAE;AAE7B;AAEA,MAAa,iBAAiB,EAAE,UAAU,UAAU,WAAkB;CACpE,MAAM,QAAA,GAAA,MAAA,eAAqB,eAAe,SAAS,QAAQ,MAAM,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;CAElF,OACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;EAAI,IAAI;EAAY;EAAM,UAAU;YAClC,iBAAA,GAAA,kBAAA,KAAC,cAAD;GAAc,IAAI,IAAI,mBAAmB,IAAI;GAAM;EAAuB,CAAA;CACxE,CAAA;AAER"}
@@ -7,11 +7,11 @@
7
7
  */
8
8
  import type { StyledProps } from "@ndla/styled-system/types";
9
9
  import { type ReactNode } from "react";
10
- export declare const ArticleContent: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & StyledProps & import("react").RefAttributes<HTMLElement>>;
10
+ export declare const ArticleContent: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react/factory").PolymorphicProps & StyledProps & import("react").RefAttributes<HTMLElement>>;
11
11
  export declare const ArticleWrapper: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & StyledProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
12
- export declare const ArticleHGroup: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
13
- export declare const ArticleHeader: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
14
- export declare const ArticleFooter: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
12
+ export declare const ArticleHGroup: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react/factory").PolymorphicProps>, {}>;
13
+ export declare const ArticleHeader: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react/factory").PolymorphicProps>, {}>;
14
+ export declare const ArticleFooter: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react/factory").PolymorphicProps>, {}>;
15
15
  interface ArticleTitleProps {
16
16
  badges?: ReactNode;
17
17
  heartButton?: ReactNode;
@@ -4,8 +4,8 @@ let _ndla_primitives = require("@ndla/primitives");
4
4
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
5
  let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
- let _ark_ui_react = require("@ark-ui/react");
8
7
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
8
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
9
9
  //#region src/Article/Article.tsx
10
10
  /**
11
11
  * Copyright (c) 2016-present, NDLA.
@@ -14,13 +14,13 @@ let _ndla_styled_system_css = require("@ndla/styled-system/css");
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  *
16
16
  */
17
- const StyledArticleContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.section, {}, { baseComponent: true });
17
+ const StyledArticleContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.section, {}, { baseComponent: true });
18
18
  const ArticleContent = (0, react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArticleContent, {
19
19
  className: (0, _ndla_styled_system_css.cx)("ndla-article", className),
20
20
  ...props,
21
21
  ref
22
22
  }));
23
- const StyledArticleWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.article, { base: {
23
+ const StyledArticleWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.article, { base: {
24
24
  background: "background.default",
25
25
  display: "flex",
26
26
  flexDirection: "column",
@@ -41,14 +41,14 @@ const ArticleWrapper = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0,
41
41
  ref,
42
42
  ...props
43
43
  }));
44
- const ArticleHGroup = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.hgroup, { base: {
44
+ const ArticleHGroup = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.hgroup, { base: {
45
45
  display: "flex",
46
46
  width: "100%",
47
47
  flexDirection: "column",
48
48
  alignItems: "flex-start",
49
49
  "& h1": { overflowWrap: "anywhere" }
50
50
  } }, { baseComponent: true });
51
- const ArticleHeader = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.header, { base: {
51
+ const ArticleHeader = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.header, { base: {
52
52
  display: "flex",
53
53
  flexDirection: "column",
54
54
  gap: "medium",
@@ -57,7 +57,7 @@ const ArticleHeader = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.head
57
57
  paddingBlockStart: "xxlarge",
58
58
  overflowWrap: "anywhere"
59
59
  } }, { baseComponent: true });
60
- const ArticleFooter = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.footer, { base: {
60
+ const ArticleFooter = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.footer, { base: {
61
61
  display: "flex",
62
62
  flexDirection: "column",
63
63
  gap: "xxlarge",
@@ -1 +1 @@
1
- {"version":3,"file":"Article.js","names":["ark","BadgesContainer","Heading","Text"],"sources":["../../src/Article/Article.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-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 { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { BadgesContainer } from \"./BadgesContainer\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & StyledProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & StyledProps>((props, ref) => (\n <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />\n));\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"small\",\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n badges?: ReactNode;\n heartButton?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n children?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n badges,\n heartButton,\n title,\n lang,\n id,\n introduction,\n competenceGoals,\n disclaimer,\n children,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!badges || !!heartButton) && (\n <InfoWrapper>\n {!!badges && <BadgesContainer>{badges}</BadgesContainer>}\n {heartButton}\n </InfoWrapper>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer}\n </StyledWrapper>\n {children}\n </ArticleHeader>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,wBAAA,GAAA,wBAAA,QAA8BA,cAAAA,IAAI,SAAS,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAE7E,MAAa,kBAAA,GAAA,MAAA,aACV,EAAE,WAAW,GAAG,SAAS,QACxB,iBAAA,GAAA,kBAAA,KAAC,sBAAD;CAAsB,YAAA,GAAA,wBAAA,IAAc,gBAAgB,UAAU;CAAE,GAAI;CAAY;CAAO,CAAA,CAE1F;AAED,MAAM,wBAAA,GAAA,wBAAA,QACJA,cAAAA,IAAI,SACJ,EACE,MAAM;CACJ,YAAY;CACZ,SAAS;CACT,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;CACV,sCAAsC,EACpC,WAAW,mCACZ;CACD,QAAQ;EACN,SAAS;EACT,SAAS;EACT,OAAO;EACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,kBAAA,GAAA,MAAA,aAA0F,OAAO,QAC5G,iBAAA,GAAA,kBAAA,KAAC,sBAAD;CAAsB,qBAAkB;CAAQ;CAAK,GAAI;CAAS,CAAA,CAClE;AAEF,MAAa,iBAAA,GAAA,wBAAA,QACXA,cAAAA,IAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,OAAO;CACP,eAAe;CACf,YAAY;CACZ,QAAQ,EACN,cAAc,YACf;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,iBAAA,GAAA,wBAAA,QACXA,cAAAA,I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AAA,UAAM,cAAmB,CAAA;GACpB,CAAA;EAET,iBAAA,GAAA,kBAAA,MAAC,eAAD,EAAA,UAAA,CACG,iBACA,WACa,EAAA,CAAA;EACf;EACa,EAAA,CAAA"}
1
+ {"version":3,"file":"Article.js","names":["ark","BadgesContainer","Heading","Text"],"sources":["../../src/Article/Article.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-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 { ark, type HTMLArkProps } from \"@ark-ui/react/factory\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { BadgesContainer } from \"./BadgesContainer\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & StyledProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & StyledProps>((props, ref) => (\n <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />\n));\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"small\",\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n badges?: ReactNode;\n heartButton?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n children?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n badges,\n heartButton,\n title,\n lang,\n id,\n introduction,\n competenceGoals,\n disclaimer,\n children,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!badges || !!heartButton) && (\n <InfoWrapper>\n {!!badges && <BadgesContainer>{badges}</BadgesContainer>}\n {heartButton}\n </InfoWrapper>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer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,eAAe;CACf,KAAK;CACL,OAAO;CACP,wBAAwB,EACtB,iBAAiB,UACnB;AACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAEA,MAAM,eAAA,GAAA,wBAAA,QAAqB,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,KAAK;CACL,OAAO;CACP,WAAW;AACb,EACF,CAAC;AAED,MAAM,iBAAA,GAAA,wBAAA,QAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,UAAU;CACV,YAAY;AACd,EACF,CAAC;AAcD,MAAa,gBAAgB,EAC3B,QACA,aACA,OACA,MACA,IACA,cACA,iBACA,YACA,eACuB;CACvB,OACE,iBAAA,GAAA,kBAAA,MAAC,eAAD,EAAA,UAAA;EACE,iBAAA,GAAA,kBAAA,MAAC,eAAD,EAAA,UAAA,EACI,CAAC,CAAC,UAAU,CAAC,CAAC,gBACd,iBAAA,GAAA,kBAAA,MAAC,aAAD,EAAA,UAAA,CACG,CAAC,CAAC,UAAU,iBAAA,GAAA,kBAAA,KAACC,wBAAAA,iBAAD,EAAA,UAAkB,OAAwB,CAAA,GACtD,WACU,EAAA,CAAA,GAEf,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,SAAD;GAAS,WAAU;GAAqB;GAAU;GAAM,UAAS;aAC9D;EACM,CAAA,CACI,EAAA,CAAA;EACd,CAAC,CAAC,gBACD,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,MAAD;GAAY;GAAM,WAAU;GAAc,SAAA;GAAQ,YAAA;aAChD,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UAAM,aAAkB,CAAA;EACpB,CAAA;EAER,iBAAA,GAAA,kBAAA,MAAC,eAAD,EAAA,UAAA,CACG,iBACA,UACY,EAAA,CAAA;EACd;CACY,EAAA,CAAA;AAEnB"}
@@ -8,7 +8,7 @@ let _ndla_icons = require("@ndla/icons");
8
8
  let _ndla_safelink = require("@ndla/safelink");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let _ndla_util = require("@ndla/util");
11
- let _ark_ui_react = require("@ark-ui/react");
11
+ let _ark_ui_react_accordion = require("@ark-ui/react/accordion");
12
12
  //#region src/Article/ArticleByline.tsx
13
13
  /**
14
14
  * Copyright (c) 2020-present, NDLA.
@@ -85,7 +85,7 @@ const ArticleByline = ({ lang, authors = [], suppliers = [], footnotes, licenseB
85
85
  };
86
86
  const ArticleBylineFootnotes = ({ footnotes }) => {
87
87
  const { t } = (0, react_i18next.useTranslation)();
88
- const { value, setValue } = (0, _ark_ui_react.useAccordionContext)();
88
+ const { value, setValue } = (0, _ark_ui_react_accordion.useAccordionContext)();
89
89
  const ref = (0, react.useRef)(null);
90
90
  const onHashChange = (0, react.useCallback)((e) => {
91
91
  const hash = e.newURL.split("#")[1];
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleByline.js","names":["AccordionRoot","SafeLink","ArticleFootNotes","AccordionItem","Heading","AccordionItemTrigger","AccordionItemIndicator","ArrowDownShortLine","AccordionItemContent"],"sources":["../../src/Article/ArticleByline.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-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 { useAccordionContext } from \"@ark-ui/react\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n type AccordionItemProps,\n AccordionItemTrigger,\n AccordionRoot,\n Heading,\n} from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { toIntlLanguage } from \"@ndla/util\";\nimport { type ReactNode, forwardRef, useCallback, useEffect, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport type { FootNote } from \"../types\";\nimport { ArticleFootNotes } from \"./ArticleFootNotes\";\n\nconst Wrapper = styled(\"div\", {\n base: {\n // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.\n marginBlockStart: \"medium\",\n paddingBlockStart: \"xsmall\",\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n width: \"100%\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n textStyle: \"body.medium\",\n '& [data-contributors=\"false\"]': {\n marginInlineStart: \"auto\",\n },\n },\n variants: {\n learningpath: {\n true: {},\n false: {\n tabletWide: {\n flexDirection: \"row\",\n },\n },\n },\n },\n});\n\ntype AuthorProps = {\n name: string;\n};\n\ntype SupplierProps = {\n name: string;\n};\n\ntype Props = {\n lang?: string;\n authors?: AuthorProps[];\n suppliers?: SupplierProps[];\n published?: string;\n licenseBox?: ReactNode;\n footnotes?: FootNote[];\n displayByline?: boolean;\n bylineType?: \"article\" | \"learningPath\" | \"external\";\n bylineSuffix?: ReactNode;\n learningpathCopiedFrom?: string;\n};\n\nfunction formatList(list: SupplierProps[], listFormatter: Intl.ListFormat) {\n return listFormatter.format(list.map((l) => l.name));\n}\n\nconst StyledAccordionRoot = styled(AccordionRoot, {\n base: {\n paddingBlockStart: \"xxlarge\",\n _print: {\n display: \"none\",\n },\n },\n});\n\nconst refRegexp = /note\\d/;\nconst footnotesAccordionId = \"footnotes\";\nconst accordionItemValue = \"rulesForUse\";\n\nexport const ArticleByline = ({\n lang,\n authors = [],\n suppliers = [],\n footnotes,\n licenseBox,\n published,\n displayByline = true,\n bylineType = \"article\",\n bylineSuffix,\n learningpathCopiedFrom,\n}: Props) => {\n const { t, i18n } = useTranslation();\n\n const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;\n const listFormatter = new Intl.ListFormat(toIntlLanguage(lang ?? i18n.language), {\n style: \"long\",\n type: \"conjunction\",\n });\n\n return (\n <Wrapper>\n {!!displayByline && (\n <TextWrapper learningpath={bylineType === \"learningPath\"}>\n {!!showPrimaryContributors && (\n <span>\n {authors.length > 0 &&\n `${t(\"article.authorsLabel\", { context: bylineType })} ${formatList(authors, listFormatter)}. `}\n {suppliers.length > 0 &&\n `${t(\"article.supplierLabel\", { count: suppliers.length })} ${formatList(suppliers, listFormatter)}.`}\n </span>\n )}\n {learningpathCopiedFrom ? (\n <SafeLink to={learningpathCopiedFrom}>{t(`learningPath.copiedFrom`)}</SafeLink>\n ) : null}\n {published ? (\n <div data-contributors={showPrimaryContributors}>\n {t(`${bylineType}.lastUpdated`)} {published}\n </div>\n ) : null}\n {bylineSuffix}\n </TextWrapper>\n )}\n {(!!licenseBox || !!footnotes?.length) && (\n <StyledAccordionRoot multiple>\n {!!licenseBox && (\n <ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t(\"article.useContent\")}>\n {licenseBox}\n </ArticleBylineAccordionItem>\n )}\n {!!footnotes?.length && <ArticleBylineFootnotes footnotes={footnotes} />}\n </StyledAccordionRoot>\n )}\n </Wrapper>\n );\n};\n\ninterface ArticleBylineAccordionprops extends AccordionItemProps {\n accordionTitle: ReactNode;\n}\n\ninterface ArticleBylineFootnotesProps {\n footnotes: FootNote[];\n}\n\nexport const ArticleBylineFootnotes = ({ footnotes }: ArticleBylineFootnotesProps) => {\n const { t } = useTranslation();\n const { value, setValue } = useAccordionContext();\n const ref = useRef<HTMLDivElement>(null);\n\n const onHashChange = useCallback(\n (e: HashChangeEvent) => {\n const hash = e.newURL.split(\"#\")[1];\n if (hash?.match(refRegexp) && !value.includes(footnotesAccordionId)) {\n ref.current?.scrollIntoView({ behavior: \"smooth\" });\n setValue([...value, footnotesAccordionId]);\n setTimeout(() => {\n const el = document.getElementById(`${hash}`);\n el?.click();\n el?.focus();\n }, 300);\n }\n },\n [value, setValue],\n );\n\n useEffect(() => {\n window.addEventListener(\"hashchange\", onHashChange);\n return () => window.removeEventListener(\"hashchange\", onHashChange);\n }, [onHashChange]);\n\n return (\n <ArticleBylineAccordionItem ref={ref} value={footnotesAccordionId} accordionTitle={t(\"article.footnotes\")}>\n <ArticleFootNotes footNotes={footnotes} />\n </ArticleBylineAccordionItem>\n );\n};\n\nexport const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(\n ({ value, accordionTitle, children, ...props }, ref) => {\n return (\n <AccordionItem value={value} ref={ref} {...props}>\n <Heading asChild consumeCss textStyle=\"label.medium\" fontWeight=\"bold\">\n <h2>\n <AccordionItemTrigger>\n {accordionTitle}\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine />\n </AccordionItemIndicator>\n </AccordionItemTrigger>\n </h2>\n </Heading>\n <AccordionItemContent>{children}</AccordionItemContent>\n </AccordionItem>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,MAAM,WAAA,GAAA,wBAAA,QAAiB,OAAO,EAC5B,MAAM;CAEJ,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,aAAa;CACd,EACF,CAAC;AAEF,MAAM,eAAA,GAAA,wBAAA,QAAqB,OAAO;CAChC,MAAM;EACJ,SAAS;EACT,eAAe;EACf,KAAK;EACL,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,WAAW;EACX,mCAAiC,EAC/B,mBAAmB,QACpB;EACF;CACD,UAAU,EACR,cAAc;EACZ,MAAM,EAAE;EACR,OAAO,EACL,YAAY,EACV,eAAe,OAChB,EACF;EACF,EACF;CACF,CAAC;AAuBF,SAAS,WAAW,MAAuB,eAAgC;AACzE,QAAO,cAAc,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK,CAAC;;AAGtD,MAAM,uBAAA,GAAA,wBAAA,QAA6BA,iBAAAA,eAAe,EAChD,MAAM;CACJ,mBAAmB;CACnB,QAAQ,EACN,SAAS,QACV;CACF,EACF,CAAC;AAEF,MAAM,YAAY;AAClB,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAE3B,MAAa,iBAAiB,EAC5B,MACA,UAAU,EAAE,EACZ,YAAY,EAAE,EACd,WACA,YACA,WACA,gBAAgB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A,sBAAD,EAAA,UAAA,CACG,gBACD,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,wBAAD;IAAwB,SAAA;cACtB,iBAAA,GAAA,kBAAA,KAACC,YAAAA,oBAAD,EAAsB,CAAA;IACC,CAAA,CACJ,EAAA,CAAA,EACpB,CAAA;GACG,CAAA,EACV,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,sBAAD,EAAuB,UAAgC,CAAA,CACzC;;EAGrB"}
1
+ {"version":3,"file":"ArticleByline.js","names":["AccordionRoot","SafeLink","ArticleFootNotes","AccordionItem","Heading","AccordionItemTrigger","AccordionItemIndicator","ArrowDownShortLine","AccordionItemContent"],"sources":["../../src/Article/ArticleByline.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-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 { useAccordionContext } from \"@ark-ui/react/accordion\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n type AccordionItemProps,\n AccordionItemTrigger,\n AccordionRoot,\n Heading,\n} from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { toIntlLanguage } from \"@ndla/util\";\nimport { type ReactNode, forwardRef, useCallback, useEffect, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport type { FootNote } from \"../types\";\nimport { ArticleFootNotes } from \"./ArticleFootNotes\";\n\nconst Wrapper = styled(\"div\", {\n base: {\n // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.\n marginBlockStart: \"medium\",\n paddingBlockStart: \"xsmall\",\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n width: \"100%\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n textStyle: \"body.medium\",\n '& [data-contributors=\"false\"]': {\n marginInlineStart: \"auto\",\n },\n },\n variants: {\n learningpath: {\n true: {},\n false: {\n tabletWide: {\n flexDirection: \"row\",\n },\n },\n },\n },\n});\n\ntype AuthorProps = {\n name: string;\n};\n\ntype SupplierProps = {\n name: string;\n};\n\ntype Props = {\n lang?: string;\n authors?: AuthorProps[];\n suppliers?: SupplierProps[];\n published?: string;\n licenseBox?: ReactNode;\n footnotes?: FootNote[];\n displayByline?: boolean;\n bylineType?: \"article\" | \"learningPath\" | \"external\";\n bylineSuffix?: ReactNode;\n learningpathCopiedFrom?: string;\n};\n\nfunction formatList(list: SupplierProps[], listFormatter: Intl.ListFormat) {\n return listFormatter.format(list.map((l) => l.name));\n}\n\nconst StyledAccordionRoot = styled(AccordionRoot, {\n base: {\n paddingBlockStart: \"xxlarge\",\n _print: {\n display: \"none\",\n },\n },\n});\n\nconst refRegexp = /note\\d/;\nconst footnotesAccordionId = \"footnotes\";\nconst accordionItemValue = \"rulesForUse\";\n\nexport const ArticleByline = ({\n lang,\n authors = [],\n suppliers = [],\n footnotes,\n licenseBox,\n published,\n displayByline = true,\n bylineType = \"article\",\n bylineSuffix,\n learningpathCopiedFrom,\n}: Props) => {\n const { t, i18n } = useTranslation();\n\n const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;\n const listFormatter = new Intl.ListFormat(toIntlLanguage(lang ?? i18n.language), {\n style: \"long\",\n type: \"conjunction\",\n });\n\n return (\n <Wrapper>\n {!!displayByline && (\n <TextWrapper learningpath={bylineType === \"learningPath\"}>\n {!!showPrimaryContributors && (\n <span>\n {authors.length > 0 &&\n `${t(\"article.authorsLabel\", { context: bylineType })} ${formatList(authors, listFormatter)}. `}\n {suppliers.length > 0 &&\n `${t(\"article.supplierLabel\", { count: suppliers.length })} ${formatList(suppliers, listFormatter)}.`}\n </span>\n )}\n {learningpathCopiedFrom ? (\n <SafeLink to={learningpathCopiedFrom}>{t(`learningPath.copiedFrom`)}</SafeLink>\n ) : null}\n {published ? (\n <div data-contributors={showPrimaryContributors}>\n {t(`${bylineType}.lastUpdated`)} {published}\n </div>\n ) : null}\n {bylineSuffix}\n </TextWrapper>\n )}\n {(!!licenseBox || !!footnotes?.length) && (\n <StyledAccordionRoot multiple>\n {!!licenseBox && (\n <ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t(\"article.useContent\")}>\n {licenseBox}\n </ArticleBylineAccordionItem>\n )}\n {!!footnotes?.length && <ArticleBylineFootnotes footnotes={footnotes} />}\n </StyledAccordionRoot>\n )}\n </Wrapper>\n );\n};\n\ninterface ArticleBylineAccordionprops extends AccordionItemProps {\n accordionTitle: ReactNode;\n}\n\ninterface ArticleBylineFootnotesProps {\n footnotes: FootNote[];\n}\n\nexport const ArticleBylineFootnotes = ({ footnotes }: ArticleBylineFootnotesProps) => {\n const { t } = useTranslation();\n const { value, setValue } = useAccordionContext();\n const ref = useRef<HTMLDivElement>(null);\n\n const onHashChange = useCallback(\n (e: HashChangeEvent) => {\n const hash = e.newURL.split(\"#\")[1];\n if (hash?.match(refRegexp) && !value.includes(footnotesAccordionId)) {\n ref.current?.scrollIntoView({ behavior: \"smooth\" });\n setValue([...value, footnotesAccordionId]);\n setTimeout(() => {\n const el = document.getElementById(`${hash}`);\n el?.click();\n el?.focus();\n }, 300);\n }\n },\n [value, setValue],\n );\n\n useEffect(() => {\n window.addEventListener(\"hashchange\", onHashChange);\n return () => window.removeEventListener(\"hashchange\", onHashChange);\n }, [onHashChange]);\n\n return (\n <ArticleBylineAccordionItem ref={ref} value={footnotesAccordionId} accordionTitle={t(\"article.footnotes\")}>\n <ArticleFootNotes footNotes={footnotes} />\n </ArticleBylineAccordionItem>\n );\n};\n\nexport const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(\n ({ value, accordionTitle, children, ...props }, ref) => {\n return (\n <AccordionItem value={value} ref={ref} {...props}>\n <Heading asChild consumeCss textStyle=\"label.medium\" fontWeight=\"bold\">\n <h2>\n <AccordionItemTrigger>\n {accordionTitle}\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine />\n </AccordionItemIndicator>\n </AccordionItemTrigger>\n </h2>\n </Heading>\n <AccordionItemContent>{children}</AccordionItemContent>\n </AccordionItem>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,MAAM,WAAA,GAAA,wBAAA,QAAiB,OAAO,EAC5B,MAAM;CAEJ,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,aAAa;AACf,EACF,CAAC;AAED,MAAM,eAAA,GAAA,wBAAA,QAAqB,OAAO;CAChC,MAAM;EACJ,SAAS;EACT,eAAe;EACf,KAAK;EACL,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,WAAW;EACX,mCAAiC,EAC/B,mBAAmB,OACrB;CACF;CACA,UAAU,EACR,cAAc;EACZ,MAAM,CAAC;EACP,OAAO,EACL,YAAY,EACV,eAAe,MACjB,EACF;CACF,EACF;AACF,CAAC;AAuBD,SAAS,WAAW,MAAuB,eAAgC;CACzE,OAAO,cAAc,OAAO,KAAK,KAAK,MAAM,EAAE,IAAI,CAAC;AACrD;AAEA,MAAM,uBAAA,GAAA,wBAAA,QAA6BA,iBAAAA,eAAe,EAChD,MAAM;CACJ,mBAAmB;CACnB,QAAQ,EACN,SAAS,OACX;AACF,EACF,CAAC;AAED,MAAM,YAAY;AAClB,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAE3B,MAAa,iBAAiB,EAC5B,MACA,UAAU,CAAC,GACX,YAAY,CAAC,GACb,WACA,YACA,WACA,gBAAgB,MAChB,aAAa,WACb,cACA,6BACW;CACX,MAAM,EAAE,GAAG,UAAA,GAAA,cAAA,gBAAwB;CAEnC,MAAM,0BAA0B,UAAU,SAAS,KAAK,QAAQ,SAAS;CACzE,MAAM,gBAAgB,IAAI,KAAK,YAAA,GAAA,WAAA,gBAA0B,QAAQ,KAAK,QAAQ,GAAG;EAC/E,OAAO;EACP,M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,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,sBAAD,EAAuB,SAA+B,CAAA,CACzC;;AAEnB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleFootNotes.js","names":["Text"],"sources":["../../src/Article/ArticleFootNotes.tsx"],"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\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootNote as FootNoteType } from \"../types\";\n\nconst citeDetailString = (description: string | undefined) => (description ? `${description}. ` : \"\");\n\ntype FootNoteProps = {\n footNote: FootNoteType;\n};\n\nconst StyledCite = styled(\"cite\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xsmall\",\n },\n});\n\nconst FootNote = ({ footNote }: FootNoteProps) => (\n <li>\n <Text id={`note${footNote.ref}`} asChild consumeCss textStyle=\"body.medium\" tabIndex={-1}>\n <StyledCite>\n <a href={`#ref${footNote.ref}`} target=\"_self\">\n {footNote.ref}\n </a>\n {`«${footNote.title}». ${footNote.authors.join(\" \")}. ${citeDetailString(footNote.edition)}${citeDetailString(\n footNote.publisher,\n )}${footNote.year}. `}\n {footNote.url ? (\n <a href={footNote.url}>\n {footNote.url}\n {\".\"}\n </a>\n ) : null}\n </StyledCite>\n </Text>\n </li>\n);\n\ntype ArticleFootNotesProps = {\n footNotes: Array<FootNoteType>;\n};\n\nconst FootnoteList = styled(\"ol\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n listStyle: \"none\",\n },\n});\n\nexport const ArticleFootNotes = ({ footNotes }: ArticleFootNotesProps) => (\n <FootnoteList>\n {footNotes.map((footNote) => (\n <FootNote key={footNote.ref} footNote={footNote} />\n ))}\n </FootnoteList>\n);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,oBAAoB,gBAAqC,cAAc,GAAG,YAAY,MAAM;AAMlG,MAAM,cAAA,GAAA,wBAAA,QAAoB,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;CACN,EACF,CAAC;AAEF,MAAM,YAAY,EAAE,eAClB,iBAAA,GAAA,kBAAA,KAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;CAAM,IAAI,OAAO,SAAS;CAAO,SAAA;CAAQ,YAAA;CAAW,WAAU;CAAc,UAAU;WACpF,iBAAA,GAAA,kBAAA,MAAC,YAAD,EAAA,UAAA;EACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,MAAM,OAAO,SAAS;GAAO,QAAO;aACpC,SAAS;GACR,CAAA;EACH,IAAI,SAAS,MAAM,KAAK,SAAS,QAAQ,KAAK,IAAI,CAAC,IAAI,iBAAiB,SAAS,QAAQ,GAAG,iBAC3F,SAAS,UACV,GAAG,SAAS,KAAK;EACjB,SAAS,MACR,iBAAA,GAAA,kBAAA,MAAC,KAAD;GAAG,MAAM,SAAS;aAAlB,CACG,SAAS,KACT,IACC;OACF;EACO,EAAA,CAAA;CACR,CAAA,EACJ,CAAA;AAOP,MAAM,gBAAA,GAAA,wBAAA,QAAsB,MAAM,EAChC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,oBAAoB,EAAE,gBACjC,iBAAA,GAAA,kBAAA,KAAC,cAAD,EAAA,UACG,UAAU,KAAK,aACd,iBAAA,GAAA,kBAAA,KAAC,UAAD,EAAuC,UAAY,EAApC,SAAS,IAA2B,CACnD,EACW,CAAA"}
1
+ {"version":3,"file":"ArticleFootNotes.js","names":["Text"],"sources":["../../src/Article/ArticleFootNotes.tsx"],"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\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootNote as FootNoteType } from \"../types\";\n\nconst citeDetailString = (description: string | undefined) => (description ? `${description}. ` : \"\");\n\ntype FootNoteProps = {\n footNote: FootNoteType;\n};\n\nconst StyledCite = styled(\"cite\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xsmall\",\n },\n});\n\nconst FootNote = ({ footNote }: FootNoteProps) => (\n <li>\n <Text id={`note${footNote.ref}`} asChild consumeCss textStyle=\"body.medium\" tabIndex={-1}>\n <StyledCite>\n <a href={`#ref${footNote.ref}`} target=\"_self\">\n {footNote.ref}\n </a>\n {`«${footNote.title}». ${footNote.authors.join(\" \")}. ${citeDetailString(footNote.edition)}${citeDetailString(\n footNote.publisher,\n )}${footNote.year}. `}\n {footNote.url ? (\n <a href={footNote.url}>\n {footNote.url}\n {\".\"}\n </a>\n ) : null}\n </StyledCite>\n </Text>\n </li>\n);\n\ntype ArticleFootNotesProps = {\n footNotes: Array<FootNoteType>;\n};\n\nconst FootnoteList = styled(\"ol\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n listStyle: \"none\",\n },\n});\n\nexport const ArticleFootNotes = ({ footNotes }: ArticleFootNotesProps) => (\n <FootnoteList>\n {footNotes.map((footNote) => (\n <FootNote key={footNote.ref} footNote={footNote} />\n ))}\n </FootnoteList>\n);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,oBAAoB,gBAAqC,cAAc,GAAG,YAAY,MAAM;AAMlG,MAAM,cAAA,GAAA,wBAAA,QAAoB,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;AACP,EACF,CAAC;AAED,MAAM,YAAY,EAAE,eAClB,iBAAA,GAAA,kBAAA,KAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;CAAM,IAAI,OAAO,SAAS;CAAO,SAAA;CAAQ,YAAA;CAAW,WAAU;CAAc,UAAU;WACpF,iBAAA,GAAA,kBAAA,MAAC,YAAD,EAAA,UAAA;EACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,MAAM,OAAO,SAAS;GAAO,QAAO;aACpC,SAAS;EACT,CAAA;EACF,IAAI,SAAS,MAAM,KAAK,SAAS,QAAQ,KAAK,GAAG,EAAE,IAAI,iBAAiB,SAAS,OAAO,IAAI,iBAC3F,SAAS,SACX,IAAI,SAAS,KAAK;EACjB,SAAS,MACR,iBAAA,GAAA,kBAAA,MAAC,KAAD;GAAG,MAAM,SAAS;aAAlB,CACG,SAAS,KACT,GACA;OACD;CACM,EAAA,CAAA;AACR,CAAA,EACJ,CAAA;AAON,MAAM,gBAAA,GAAA,wBAAA,QAAsB,MAAM,EAChC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,WAAW;AACb,EACF,CAAC;AAED,MAAa,oBAAoB,EAAE,gBACjC,iBAAA,GAAA,kBAAA,KAAC,cAAD,EAAA,UACG,UAAU,KAAK,aACd,iBAAA,GAAA,kBAAA,KAAC,UAAD,EAAuC,SAAW,GAAnC,SAAS,GAA0B,CACnD,EACW,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"BadgesContainer.js","names":[],"sources":["../../src/Article/BadgesContainer.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-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 { styled } from \"@ndla/styled-system/jsx\";\n\nexport const BadgesContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"flex-start\",\n flexWrap: \"wrap\",\n gap: \"xxsmall\",\n },\n});\n"],"mappings":";;;;;;;;;AAUA,MAAa,mBAAA,qCAAA,CAAA,QAAyB,OAAO,EAC3C,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,UAAU;CACV,KAAK;CACN,EACF,CAAC"}
1
+ {"version":3,"file":"BadgesContainer.js","names":[],"sources":["../../src/Article/BadgesContainer.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-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 { styled } from \"@ndla/styled-system/jsx\";\n\nexport const BadgesContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"flex-start\",\n flexWrap: \"wrap\",\n gap: \"xxsmall\",\n },\n});\n"],"mappings":";;;;;;;;;AAUA,MAAa,mBAAA,oCAAA,EAAA,QAAyB,OAAO,EAC3C,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,UAAU;CACV,KAAK;AACP,EACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AudioElement.js","names":[],"sources":["../../src/AudioPlayer/AudioElement.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026-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 { ComponentProps } from \"react\";\n\ninterface Props extends ComponentProps<\"audio\"> {\n src: string;\n title: string;\n}\n\nexport const AudioElement = (props: Props) => {\n // TODO: We should tie this up to the textual description somehow\n // oxlint-disable-next-line jsx-a11y/media-has-caption\n return <audio preload=\"metadata\" {...props} />;\n};\n"],"mappings":";;;AAeA,MAAa,gBAAgB,UAAiB;AAG5C,QAAO,iBAAA,GAAA,kBAAA,KAAC,SAAD;EAAO,SAAQ;EAAW,GAAI;EAAS,CAAA"}
1
+ {"version":3,"file":"AudioElement.js","names":[],"sources":["../../src/AudioPlayer/AudioElement.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026-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 { ComponentProps } from \"react\";\n\ninterface Props extends ComponentProps<\"audio\"> {\n src: string;\n title: string;\n}\n\nexport const AudioElement = (props: Props) => {\n // TODO: We should tie this up to the textual description somehow\n // oxlint-disable-next-line jsx-a11y/media-has-caption\n return <audio preload=\"metadata\" {...props} />;\n};\n"],"mappings":";;;AAeA,MAAa,gBAAgB,UAAiB;CAG5C,OAAO,iBAAA,GAAA,kBAAA,KAAC,SAAD;EAAO,SAAQ;EAAW,GAAI;CAAQ,CAAA;AAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"AudioPlayer.js","names":["Button","SpeechControl","CompactAudioPlayer","SafeLink","Heading","Text","Controls"],"sources":["../../src/AudioPlayer/AudioPlayer.tsx"],"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\nimport { Heading, Text, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode, useId, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { CompactAudioPlayer } from \"./CompactAudioPlayer\";\nimport { Controls } from \"./Controls\";\nimport { SpeechControl } from \"./SpeechControl\";\n\n// TODO: Could the audio metadata be more tightly coupled to the audio player?\n\nconst AudioPlayerWrapper = styled(\"div\", {\n base: {\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"full\",\n marginBlockEnd: \"4xsmall\",\n overflow: \"hidden\",\n },\n});\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n tabletWideDown: {\n display: \"block\",\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n flex: \"1 0 auto\",\n width: \"surface.4xsmall\",\n height: \"surface.4xsmall\",\n overflow: \"hidden\",\n \"& img\": {\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n },\n desktop: {\n width: \"260px\",\n height: \"260px\",\n },\n tabletWideDown: {\n maxHeight: \"surface.small\",\n maxWidth: \"100%\",\n width: \"100%\",\n height: \"auto\",\n },\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n width: \"100%\",\n \"&[data-has-image='true']\": {\n tablet: {\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n },\n },\n },\n});\n\nconst TitleWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n fontFamily: \"sans\",\n tabletWide: {\n width: \"100%\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n },\n});\n\nconst TextVersionWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n borderBlockStart: \"1px solid\",\n borderColor: \"stroke.default\",\n paddingBlock: \"medium\",\n paddingInline: \"xsmall\",\n tablet: {\n paddingInline: \"medium\",\n },\n },\n});\n\nconst TextVersionText = styled(\"div\", {\n base: {\n maxWidth: \"surface.xlarge\",\n \"& span > *\": {\n whiteSpace: \"pre-wrap\",\n },\n \"& p:not(:first-child):not(:last-child)\": {\n marginBlock: \"small\",\n },\n '& p[data-align=\"center\"]': {\n textAlign: \"center\",\n },\n '& p:has(span[dir=\"rtl\"])': {\n direction: \"rtl\",\n },\n },\n});\n\nconst TextVersionButton = styled(Button, {\n base: {\n alignSelf: \"flex-start\",\n },\n});\n\nconst ShowMoreButton = styled(Button, {\n base: {\n marginInlineStart: \"3xsmall\",\n },\n});\n\nconst DESCRIPTION_MAX_LENGTH = 200;\n\nexport type AudioPlayerVariant = \"standard\" | \"minimal\" | \"compact\";\n\ninterface Props {\n src: string;\n title: string;\n subtitle?: {\n title: string;\n url?: string;\n };\n variant?: AudioPlayerVariant;\n description?: string;\n textVersion?: ReactNode;\n img?: {\n url: string;\n alt: string;\n };\n}\n\nexport const AudioPlayer = ({ src, title, subtitle, variant = \"standard\", description, img, textVersion }: Props) => {\n const { t } = useTranslation();\n const [showTextVersion, setShowTextVersion] = useState(false);\n const [showFullDescription, setShowFullDescription] = useState(false);\n const truncatedDescription = useMemo(() => description?.slice(0, DESCRIPTION_MAX_LENGTH), [description]);\n const textDescriptionId = useId();\n\n if (variant === \"minimal\") {\n return <SpeechControl src={src} title={title} />;\n }\n\n if (variant === \"compact\") {\n return <CompactAudioPlayer src={src} title={title} />;\n }\n\n const toggleTextVersion = () => {\n setShowTextVersion((curr) => !curr);\n };\n\n const textVersionButton = (\n <TextVersionButton\n variant=\"secondary\"\n aria-expanded={showTextVersion}\n aria-controls={textDescriptionId}\n size=\"small\"\n onClick={toggleTextVersion}\n >\n {t(showTextVersion ? \"audio.textVersion.close\" : \"audio.textVersion.heading\")}\n </TextVersionButton>\n );\n\n return (\n <AudioPlayerWrapper>\n <InfoWrapper>\n {!!img && (\n <ImageWrapper>\n <img src={img.url} alt={img.alt} />\n </ImageWrapper>\n )}\n <TextWrapper data-has-image={!!img}>\n <TitleWrapper>\n <div>\n {subtitle?.url ? <SafeLink to={subtitle.url}>{subtitle.title}</SafeLink> : subtitle?.title}\n <Heading asChild consumeCss textStyle=\"title.large\">\n <h3>{title}</h3>\n </Heading>\n </div>\n {!!textVersion && !img && textVersionButton}\n </TitleWrapper>\n {!!description && (\n <Text textStyle=\"body.medium\">\n {showFullDescription || description.length < DESCRIPTION_MAX_LENGTH\n ? description\n : `${truncatedDescription}...`}\n {description.length > DESCRIPTION_MAX_LENGTH && (\n <ShowMoreButton variant=\"link\" onClick={() => setShowFullDescription((p) => !p)}>\n {t(`audio.${showFullDescription ? \"readLessDescriptionLabel\" : \"readMoreDescriptionLabel\"}`)}\n </ShowMoreButton>\n )}\n </Text>\n )}\n {!!textVersion && !!img && textVersionButton}\n </TextWrapper>\n </InfoWrapper>\n <Controls src={src} title={title} />\n {!!textVersion && (\n <TextVersionWrapper id={textDescriptionId} hidden={!showTextVersion}>\n <Heading asChild textStyle=\"title.medium\" consumeCss>\n <h4>{t(\"audio.textVersion.heading\")}</h4>\n </Heading>\n <TextVersionText>{textVersion}</TextVersion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,CAAC;aAApD,CACE,iBAAA,GAAA,kBAAA,KAACF,iBAAAA,SAAD;IAAS,SAAA;IAAQ,WAAU;IAAe,YAAA;cACxC,iBAAA,GAAA,kBAAA,KAAC,MAAD,EAAA,UAAK,EAAE,4BAA4B,EAAM,CAAA;IACjC,CAAA,EACV,iBAAA,GAAA,kBAAA,KAAC,iBAAD,EAAA,UAAkB,aAA8B,CAAA,CAC7B;;EAEJ,EAAA,CAAA"}
1
+ {"version":3,"file":"AudioPlayer.js","names":["Button","SpeechControl","CompactAudioPlayer","SafeLink","Heading","Text","Controls"],"sources":["../../src/AudioPlayer/AudioPlayer.tsx"],"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\nimport { Heading, Text, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode, useId, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { CompactAudioPlayer } from \"./CompactAudioPlayer\";\nimport { Controls } from \"./Controls\";\nimport { SpeechControl } from \"./SpeechControl\";\n\n// TODO: Could the audio metadata be more tightly coupled to the audio player?\n\nconst AudioPlayerWrapper = styled(\"div\", {\n base: {\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"full\",\n marginBlockEnd: \"4xsmall\",\n overflow: \"hidden\",\n },\n});\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n tabletWideDown: {\n display: \"block\",\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n flex: \"1 0 auto\",\n width: \"surface.4xsmall\",\n height: \"surface.4xsmall\",\n overflow: \"hidden\",\n \"& img\": {\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n },\n desktop: {\n width: \"260px\",\n height: \"260px\",\n },\n tabletWideDown: {\n maxHeight: \"surface.small\",\n maxWidth: \"100%\",\n width: \"100%\",\n height: \"auto\",\n },\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n width: \"100%\",\n \"&[data-has-image='true']\": {\n tablet: {\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n },\n },\n },\n});\n\nconst TitleWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n fontFamily: \"sans\",\n tabletWide: {\n width: \"100%\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n },\n});\n\nconst TextVersionWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n borderBlockStart: \"1px solid\",\n borderColor: \"stroke.default\",\n paddingBlock: \"medium\",\n paddingInline: \"xsmall\",\n tablet: {\n paddingInline: \"medium\",\n },\n },\n});\n\nconst TextVersionText = styled(\"div\", {\n base: {\n maxWidth: \"surface.xlarge\",\n \"& span > *\": {\n whiteSpace: \"pre-wrap\",\n },\n \"& p:not(:first-child):not(:last-child)\": {\n marginBlock: \"small\",\n },\n '& p[data-align=\"center\"]': {\n textAlign: \"center\",\n },\n '& p:has(span[dir=\"rtl\"])': {\n direction: \"rtl\",\n },\n },\n});\n\nconst TextVersionButton = styled(Button, {\n base: {\n alignSelf: \"flex-start\",\n },\n});\n\nconst ShowMoreButton = styled(Button, {\n base: {\n marginInlineStart: \"3xsmall\",\n },\n});\n\nconst DESCRIPTION_MAX_LENGTH = 200;\n\nexport type AudioPlayerVariant = \"standard\" | \"minimal\" | \"compact\";\n\ninterface Props {\n src: string;\n title: string;\n subtitle?: {\n title: string;\n url?: string;\n };\n variant?: AudioPlayerVariant;\n description?: string;\n textVersion?: ReactNode;\n img?: {\n url: string;\n alt: string;\n };\n}\n\nexport const AudioPlayer = ({ src, title, subtitle, variant = \"standard\", description, img, textVersion }: Props) => {\n const { t } = useTranslation();\n const [showTextVersion, setShowTextVersion] = useState(false);\n const [showFullDescription, setShowFullDescription] = useState(false);\n const truncatedDescription = useMemo(() => description?.slice(0, DESCRIPTION_MAX_LENGTH), [description]);\n const textDescriptionId = useId();\n\n if (variant === \"minimal\") {\n return <SpeechControl src={src} title={title} />;\n }\n\n if (variant === \"compact\") {\n return <CompactAudioPlayer src={src} title={title} />;\n }\n\n const toggleTextVersion = () => {\n setShowTextVersion((curr) => !curr);\n };\n\n const textVersionButton = (\n <TextVersionButton\n variant=\"secondary\"\n aria-expanded={showTextVersion}\n aria-controls={textDescriptionId}\n size=\"small\"\n onClick={toggleTextVersion}\n >\n {t(showTextVersion ? \"audio.textVersion.close\" : \"audio.textVersion.heading\")}\n </TextVersionButton>\n );\n\n return (\n <AudioPlayerWrapper>\n <InfoWrapper>\n {!!img && (\n <ImageWrapper>\n <img src={img.url} alt={img.alt} />\n </ImageWrapper>\n )}\n <TextWrapper data-has-image={!!img}>\n <TitleWrapper>\n <div>\n {subtitle?.url ? <SafeLink to={subtitle.url}>{subtitle.title}</SafeLink> : subtitle?.title}\n <Heading asChild consumeCss textStyle=\"title.large\">\n <h3>{title}</h3>\n </Heading>\n </div>\n {!!textVersion && !img && textVersionButton}\n </TitleWrapper>\n {!!description && (\n <Text textStyle=\"body.medium\">\n {showFullDescription || description.length < DESCRIPTION_MAX_LENGTH\n ? description\n : `${truncatedDescription}...`}\n {description.length > DESCRIPTION_MAX_LENGTH && (\n <ShowMoreButton variant=\"link\" onClick={() => setShowFullDescription((p) => !p)}>\n {t(`audio.${showFullDescription ? \"readLessDescriptionLabel\" : \"readMoreDescriptionLabel\"}`)}\n </ShowMoreButton>\n )}\n </Text>\n )}\n {!!textVersion && !!img && textVersionButton}\n </TextWrapper>\n </InfoWrapper>\n <Controls src={src} title={title} />\n {!!textVersion && (\n <TextVersionWrapper id={textDescriptionId} hidden={!showTextVersion}>\n <Heading asChild textStyle=\"title.medium\" consumeCss>\n <h4>{t(\"audio.textVersion.heading\")}</h4>\n </Heading>\n <TextVersionText>{textVersion}</TextVersionText>\n </TextVersionWrapper>\n )}\n </AudioPlayerWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,sBAAA,GAAA,wBAAA,QAA4B,OAAO,EACvC,MAAM;CACJ,QAAQ;CACR,aAAa;CACb,cAAc;CACd,WAAW;CACX,gBAAgB;CAChB,UAAU;AACZ,EACF,CAAC;AAED,MAAM,eAAA,GAAA,wBAAA,QAAqB,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,gBAAgB,EACd,SAAS,QACX;AACF,EACF,CAAC;AAED,MAAM,gBAAA,GAAA,wBAAA,QAAsB,OAAO,EACjC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,MAAM;CACN,OAAO;CACP,QAAQ;CACR,UAAU;CACV,SAAS;EACP,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA,SAAS;EACP,OAAO;EACP,QAAQ;CACV;CACA,gBAAgB;EACd,WAAW;EACX,UAAU;EACV,OAAO;EACP,QAAQ;CACV;AACF,EACF,CAAC;AAED,MAAM,eAAA,GAAA,wBAAA,QAAqB,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,eAAe;CACf,KAAK;CACL,SAAS;CACT,OAAO;CACP,4BAA4B,EAC1B,QAAQ;EACN,cAAc;EACd,eAAe;CACjB,EACF;AACF,EACF,CAAC;AAED,MAAM,gBAAA,GAAA,wBAAA,QAAsB,OAAO,EACjC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,YAAY;EACV,OAAO;EACP,eAAe;EACf,gBAAgB;CAClB;AACF,EACF,CAAC;AAED,MAAM,sBAAA,GAAA,wBAAA,QAA4B,OAAO,EACvC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,kBAAkB;CAClB,aAAa;CACb,cAAc;CACd,e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Y;EAAQ,CAAA;EAClC,CAAC,CAAC,eACD,iBAAA,GAAA,kBAAA,MAAC,oBAAD;GAAoB,IAAI;GAAmB,QAAQ,CAAC;aAApD,CACE,iBAAA,GAAA,kBAAA,KAACF,iBAAAA,SAAD;IAAS,SAAA;IAAQ,WAAU;IAAe,YAAA;cACxC,iBAAA,GAAA,kBAAA,KAAC,MAAD,EAAA,UAAK,EAAE,2BAA2B,EAAM,CAAA;GACjC,CAAA,GACT,iBAAA,GAAA,kBAAA,KAAC,iBAAD,EAAA,UAAkB,YAA6B,CAAA,CAC7B;;CAEJ,EAAA,CAAA;AAExB"}
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { SliderValueChangeDetails } from "@ark-ui/react";
8
+ import type { SliderValueChangeDetails } from "@ark-ui/react/slider";
9
9
  interface Props {
10
10
  currentTime: number;
11
11
  duration: number;
@@ -1 +1 @@
1
- {"version":3,"file":"AudioProgress.js","names":["SliderThumb","SliderTrack","SliderRoot","formatTime","SliderLabel","SliderControl","SliderRange","SliderHiddenInput"],"sources":["../../src/AudioPlayer/AudioProgress.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026-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 { SliderValueChangeDetails } from \"@ark-ui/react\";\nimport {\n SliderRoot,\n SliderLabel,\n SliderControl,\n SliderTrack,\n SliderRange,\n SliderThumb,\n SliderHiddenInput,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { useTranslation } from \"react-i18next\";\nimport { formatTime } from \"./audioUtils\";\n\ninterface Props {\n currentTime: number;\n duration: number;\n onValueChange: (details: SliderValueChangeDetails) => void;\n variant?: \"simple\" | \"standard\";\n}\n\nconst StyledSliderThumb = styled(SliderThumb, {\n variants: {\n variant: {\n standard: {},\n simple: {\n marginBlockStart: \"-4xsmall\",\n transitionProperty: \"background, border-radius, width, height\",\n width: \"4xsmall\",\n height: \"4xsmall\",\n borderRadius: \"sharp\",\n },\n },\n },\n});\n\nconst StyledSliderTrack = styled(SliderTrack, {\n variants: {\n variant: {\n standard: {},\n simple: {\n marginBlockStart: \"-4xsmall\",\n background: \"unset\",\n },\n },\n },\n});\n\nconst StyledSliderRoot = styled(SliderRoot, {\n variants: {\n variant: {\n standard: {},\n simple: {\n position: \"relative\",\n marginBlockEnd: \"-xsmall\",\n },\n },\n },\n});\n\nexport const AudioProgress = ({ currentTime, duration, onValueChange, variant }: Props) => {\n const { t } = useTranslation();\n return (\n <StyledSliderRoot\n value={[currentTime]}\n defaultValue={[0]}\n step={1}\n max={duration}\n onValueChange={onValueChange}\n variant={variant}\n getAriaValueText={(value) =>\n t(\"audio.valueText\", {\n start: formatTime(Math.round(value.value)),\n end: formatTime(Math.round(duration)),\n })\n }\n >\n <SliderLabel srOnly>{t(\"audio.progressBar\")}</SliderLabel>\n <SliderControl>\n <StyledSliderTrack variant={variant}>\n <SliderRange />\n </StyledSliderTrack>\n <StyledSliderThumb index={0} variant={variant}>\n <SliderHiddenInput />\n </StyledSliderThumb>\n </SliderControl>\n </StyledSliderRoot>\n );\n};\n"],"mappings":";;;;;;;AA6BA,MAAM,qBAAA,GAAA,wBAAA,QAA2BA,iBAAAA,aAAa,EAC5C,UAAU,EACR,SAAS;CACP,UAAU,EAAE;CACZ,QAAQ;EACN,kBAAkB;EAClB,oBAAoB;EACpB,OAAO;EACP,QAAQ;EACR,cAAc;EACf;CACF,EACF,EACF,CAAC;AAEF,MAAM,qBAAA,GAAA,wBAAA,QAA2BC,iBAAAA,aAAa,EAC5C,UAAU,EACR,SAAS;CACP,UAAU,EAAE;CACZ,QAAQ;EACN,kBAAkB;EAClB,YAAY;EACb;CACF,EACF,EACF,CAAC;AAEF,MAAM,oBAAA,GAAA,wBAAA,QAA0BC,iBAAAA,YAAY,EAC1C,UAAU,EACR,SAAS;CACP,UAAU,EAAE;CACZ,QAAQ;EACN,UAAU;EACV,gBAAgB;EACjB;CACF,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,aAAa,UAAU,eAAe,cAAqB;CACzF,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAC9B,QACE,iBAAA,GAAA,kBAAA,MAAC,kBAAD;EACE,OAAO,CAAC,YAAY;EACpB,cAAc,CAAC,EAAE;EACjB,MAAM;EACN,KAAK;EACU;EACN;EACT,mBAAmB,UACjB,EAAE,mBAAmB;GACnB,OAAOC,mBAAAA,WAAW,KAAK,MAAM,MAAM,MAAM,CAAC;GAC1C,KAAKA,mBAAAA,WAAW,KAAK,MAAM,SAAS,CAAC;GACtC,CAAC;YAXN,CAcE,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,aAAD;GAAa,QAAA;aAAQ,EAAE,oBAAoB;GAAe,CAAA,EAC1D,iBAAA,GAAA,kBAAA,MAACC,iBAAAA,eAAD,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAC,mBAAD;GAA4B;aAC1B,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,aAAD,EAAe,CAAA;GACG,CAAA,EACpB,iBAAA,GAAA,kBAAA,KAAC,mBAAD;GAAmB,OAAO;GAAY;aACpC,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,mBAAD,EAAqB,CAAA;GACH,CAAA,CACN,EAAA,CAAA,CACC"}
1
+ {"version":3,"file":"AudioProgress.js","names":["SliderThumb","SliderTrack","SliderRoot","formatTime","SliderLabel","SliderControl","SliderRange","SliderHiddenInput"],"sources":["../../src/AudioPlayer/AudioProgress.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026-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 { SliderValueChangeDetails } from \"@ark-ui/react/slider\";\nimport {\n SliderRoot,\n SliderLabel,\n SliderControl,\n SliderTrack,\n SliderRange,\n SliderThumb,\n SliderHiddenInput,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { useTranslation } from \"react-i18next\";\nimport { formatTime } from \"./audioUtils\";\n\ninterface Props {\n currentTime: number;\n duration: number;\n onValueChange: (details: SliderValueChangeDetails) => void;\n variant?: \"simple\" | \"standard\";\n}\n\nconst StyledSliderThumb = styled(SliderThumb, {\n variants: {\n variant: {\n standard: {},\n simple: {\n marginBlockStart: \"-4xsmall\",\n transitionProperty: \"background, border-radius, width, height\",\n width: \"4xsmall\",\n height: \"4xsmall\",\n borderRadius: \"sharp\",\n },\n },\n },\n});\n\nconst StyledSliderTrack = styled(SliderTrack, {\n variants: {\n variant: {\n standard: {},\n simple: {\n marginBlockStart: \"-4xsmall\",\n background: \"unset\",\n },\n },\n },\n});\n\nconst StyledSliderRoot = styled(SliderRoot, {\n variants: {\n variant: {\n standard: {},\n simple: {\n position: \"relative\",\n marginBlockEnd: \"-xsmall\",\n },\n },\n },\n});\n\nexport const AudioProgress = ({ currentTime, duration, onValueChange, variant }: Props) => {\n const { t } = useTranslation();\n return (\n <StyledSliderRoot\n value={[currentTime]}\n defaultValue={[0]}\n step={1}\n max={duration}\n onValueChange={onValueChange}\n variant={variant}\n getAriaValueText={(value) =>\n t(\"audio.valueText\", {\n start: formatTime(Math.round(value.value)),\n end: formatTime(Math.round(duration)),\n })\n }\n >\n <SliderLabel srOnly>{t(\"audio.progressBar\")}</SliderLabel>\n <SliderControl>\n <StyledSliderTrack variant={variant}>\n <SliderRange />\n </StyledSliderTrack>\n <StyledSliderThumb index={0} variant={variant}>\n <SliderHiddenInput />\n </StyledSliderThumb>\n </SliderControl>\n </StyledSliderRoot>\n );\n};\n"],"mappings":";;;;;;;AA6BA,MAAM,qBAAA,GAAA,wBAAA,QAA2BA,iBAAAA,aAAa,EAC5C,UAAU,EACR,SAAS;CACP,UAAU,CAAC;CACX,QAAQ;EACN,kBAAkB;EAClB,oBAAoB;EACpB,OAAO;EACP,QAAQ;EACR,cAAc;CAChB;AACF,EACF,EACF,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