@ndla/ui 56.0.166-alpha.0 → 56.0.168-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 (161) hide show
  1. package/README.md +1 -11
  2. package/dist/panda.buildinfo.json +9 -9
  3. package/dist/styles.css +38 -36
  4. package/es/AnchorHeading/AnchorHeading.mjs +43 -0
  5. package/es/AnchorHeading/AnchorHeading.mjs.map +1 -0
  6. package/es/CodeBlock/codeLanguageOptions.mjs.map +1 -1
  7. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  8. package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +1 -1
  9. package/es/Embed/ImageEmbed.mjs.map +1 -1
  10. package/es/Grid/Grid.mjs +2 -2
  11. package/es/Grid/Grid.mjs.map +1 -1
  12. package/es/_virtual/rolldown_runtime.mjs +2 -2
  13. package/es/index.mjs +2 -2
  14. package/es/locale/messages-en.mjs +1 -0
  15. package/es/locale/messages-en.mjs.map +1 -1
  16. package/es/locale/messages-nb.mjs +1 -0
  17. package/es/locale/messages-nb.mjs.map +1 -1
  18. package/es/locale/messages-nn.mjs +1 -0
  19. package/es/locale/messages-nn.mjs.map +1 -1
  20. package/es/locale/messages-se.mjs +1 -0
  21. package/es/locale/messages-se.mjs.map +1 -1
  22. package/es/model/ContentType.mjs.map +1 -1
  23. package/es/model/SubjectCategories.mjs +2 -2
  24. package/es/model/SubjectTypes.mjs +2 -2
  25. package/es/model/WordClass.mjs +2 -2
  26. package/lib/{CopyParagraphButton/CopyParagraphButton.d.ts → AnchorHeading/AnchorHeading.d.ts} +1 -1
  27. package/lib/AnchorHeading/AnchorHeading.js +44 -0
  28. package/lib/AnchorHeading/AnchorHeading.js.map +1 -0
  29. package/lib/Article/Article.js +14 -14
  30. package/lib/Article/Article.js.map +1 -1
  31. package/lib/Article/ArticleByline.js +13 -13
  32. package/lib/Article/ArticleByline.js.map +1 -1
  33. package/lib/Article/ArticleFootNotes.js +5 -5
  34. package/lib/Article/ArticleFootNotes.js.map +1 -1
  35. package/lib/Article/BadgesContainer.js +2 -2
  36. package/lib/Article/BadgesContainer.js.map +1 -1
  37. package/lib/AudioPlayer/AudioPlayer.js +16 -16
  38. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  39. package/lib/AudioPlayer/Controls.js +35 -35
  40. package/lib/AudioPlayer/Controls.js.map +1 -1
  41. package/lib/AudioPlayer/SpeechControl.js +4 -4
  42. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  43. package/lib/Breadcrumb/Breadcrumb.js +2 -2
  44. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  45. package/lib/Breadcrumb/BreadcrumbItem.js +2 -2
  46. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  47. package/lib/Breadcrumb/HomeBreadcrumb.js +8 -8
  48. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  49. package/lib/CampaignBlock/CampaignBlock.js +12 -12
  50. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  51. package/lib/CodeBlock/CodeBlock.js +4 -4
  52. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  53. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -1
  54. package/lib/Concept/Concept.js +4 -4
  55. package/lib/Concept/Concept.js.map +1 -1
  56. package/lib/ContactBlock/ContactBlock.js +12 -12
  57. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  58. package/lib/ContentTypeBadge/ContentTypeBadge.js +2 -2
  59. package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -1
  60. package/lib/Embed/AudioEmbed.js +3 -3
  61. package/lib/Embed/AudioEmbed.js.map +1 -1
  62. package/lib/Embed/BrightcoveEmbed.js +5 -5
  63. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  64. package/lib/Embed/CodeEmbed.js +7 -7
  65. package/lib/Embed/CodeEmbed.js.map +1 -1
  66. package/lib/Embed/ConceptEmbed.js +7 -7
  67. package/lib/Embed/ConceptEmbed.js.map +1 -1
  68. package/lib/Embed/ConceptInlineTriggerButton.js +2 -2
  69. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
  70. package/lib/Embed/ContentLinkEmbed.js +2 -2
  71. package/lib/Embed/CopyrightEmbed.js +2 -2
  72. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  73. package/lib/Embed/EmbedErrorPlaceholder.js +6 -6
  74. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  75. package/lib/Embed/EmbedWrapper.js +6 -6
  76. package/lib/Embed/EmbedWrapper.js.map +1 -1
  77. package/lib/Embed/ExternalEmbed.js +4 -4
  78. package/lib/Embed/ExternalEmbed.js.map +1 -1
  79. package/lib/Embed/FootnoteEmbed.js +2 -2
  80. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  81. package/lib/Embed/GlossEmbed.js +9 -9
  82. package/lib/Embed/GlossEmbed.js.map +1 -1
  83. package/lib/Embed/H5pEmbed.js +4 -4
  84. package/lib/Embed/H5pEmbed.js.map +1 -1
  85. package/lib/Embed/IframeEmbed.js +4 -4
  86. package/lib/Embed/IframeEmbed.js.map +1 -1
  87. package/lib/Embed/ImageEmbed.js +8 -8
  88. package/lib/Embed/ImageEmbed.js.map +1 -1
  89. package/lib/Embed/InlineTriggerButton.js +4 -4
  90. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  91. package/lib/Embed/UnknownEmbed.js +2 -2
  92. package/lib/Embed/UuDisclaimerEmbed.js +11 -11
  93. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
  94. package/lib/FactBox/FactBox.js +7 -7
  95. package/lib/FactBox/FactBox.js.map +1 -1
  96. package/lib/FileList/File.js +13 -13
  97. package/lib/FileList/File.js.map +1 -1
  98. package/lib/FileList/FileList.js +4 -4
  99. package/lib/FileList/FileList.js.map +1 -1
  100. package/lib/FileList/PdfFile.js +6 -6
  101. package/lib/FileList/PdfFile.js.map +1 -1
  102. package/lib/Gloss/Gloss.js +19 -19
  103. package/lib/Gloss/Gloss.js.map +1 -1
  104. package/lib/Gloss/GlossExample.js +6 -6
  105. package/lib/Gloss/GlossExample.js.map +1 -1
  106. package/lib/Grid/Grid.js +5 -5
  107. package/lib/Grid/Grid.js.map +1 -1
  108. package/lib/KeyFigure/KeyFigure.js +5 -5
  109. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  110. package/lib/LicenseByline/EmbedByline.js +15 -15
  111. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  112. package/lib/LicenseByline/LicenseLink.js +3 -3
  113. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  114. package/lib/LinkBlock/LinkBlock.js +10 -10
  115. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  116. package/lib/LinkBlock/LinkBlockSection.js +2 -2
  117. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  118. package/lib/Pitch/Pitch.js +10 -10
  119. package/lib/Pitch/Pitch.js.map +1 -1
  120. package/lib/RelatedArticleList/RelatedArticleList.js +19 -19
  121. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  122. package/lib/ResourceBox/ResourceBox.js +13 -13
  123. package/lib/ResourceBox/ResourceBox.js.map +1 -1
  124. package/lib/TagSelector/TagSelector.js +22 -22
  125. package/lib/TagSelector/TagSelector.js.map +1 -1
  126. package/lib/ZendeskButton/ZendeskButton.js +2 -2
  127. package/lib/_virtual/rolldown_runtime.js +2 -2
  128. package/lib/index.d.ts +1 -1
  129. package/lib/index.js +6 -6
  130. package/lib/locale/messages-en.d.ts +1 -0
  131. package/lib/locale/messages-en.js +3 -2
  132. package/lib/locale/messages-en.js.map +1 -1
  133. package/lib/locale/messages-nb.d.ts +1 -0
  134. package/lib/locale/messages-nb.js +3 -2
  135. package/lib/locale/messages-nb.js.map +1 -1
  136. package/lib/locale/messages-nn.d.ts +1 -0
  137. package/lib/locale/messages-nn.js +3 -2
  138. package/lib/locale/messages-nn.js.map +1 -1
  139. package/lib/locale/messages-se.d.ts +1 -0
  140. package/lib/locale/messages-se.js +3 -2
  141. package/lib/locale/messages-se.js.map +1 -1
  142. package/lib/model/ContentType.js.map +1 -1
  143. package/lib/model/SubjectCategories.js +1 -1
  144. package/lib/model/SubjectTypes.js +1 -1
  145. package/lib/model/WordClass.js +1 -1
  146. package/lib/utils/licenseAttributes.js +2 -2
  147. package/lib/utils/licenseAttributes.js.map +1 -1
  148. package/package.json +10 -10
  149. package/src/AnchorHeading/AnchorHeading.tsx +60 -0
  150. package/src/Embed/UuDisclaimerEmbed.stories.tsx +8 -8
  151. package/src/Grid/Grid.tsx +4 -2
  152. package/src/index.ts +1 -1
  153. package/src/locale/messages-en.ts +1 -0
  154. package/src/locale/messages-nb.ts +1 -0
  155. package/src/locale/messages-nn.ts +1 -0
  156. package/src/locale/messages-se.ts +1 -0
  157. package/es/CopyParagraphButton/CopyParagraphButton.mjs +0 -69
  158. package/es/CopyParagraphButton/CopyParagraphButton.mjs.map +0 -1
  159. package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -70
  160. package/lib/CopyParagraphButton/CopyParagraphButton.js.map +0 -1
  161. package/src/CopyParagraphButton/CopyParagraphButton.tsx +0 -87
@@ -1 +1 @@
1
- {"version":3,"file":"File.js","names":["SafeLink","DownloadLine","linkOverlay","Text","FileListItem"],"sources":["../../src/FileList/File.tsx"],"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\nimport { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DownloadLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { FileListItem } from \"./FileList\";\n\nexport interface FileProps extends ComponentPropsWithRef<\"div\"> {\n title: string;\n url: string;\n fileExists: boolean;\n fileType: string;\n fileSize?: string;\n}\n\nexport interface FileType {\n title: string;\n formats: FileFormat[];\n fileExists?: boolean;\n}\n\nexport interface FileFormat {\n url: string;\n fileType: string;\n tooltip: string;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n textUnderlineOffset: \"2px\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst FileContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n position: \"relative\",\n paddingBlock: \"small\",\n paddingInlineEnd: \"medium\",\n paddingInlineStart: \"small\",\n width: \"100%\",\n },\n});\n\nconst InfoContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"center\",\n },\n});\n\nexport const File = forwardRef<HTMLDivElement, FileProps>(\n ({ title, url, fileExists, fileType, fileSize, ...rest }, ref) => {\n const { t } = useTranslation();\n const filename = `${title}-${url.split(\"/\").pop() ?? \"\"}`;\n const downloadUrl = `${url}?download=true`;\n const tooltip = `${t(\"download\")} ${filename}`;\n\n return (\n <FileContainer ref={ref} {...rest}>\n <InfoContainer>\n <DownloadLine />\n {fileExists ? (\n <StyledSafeLink unstyled download={filename} css={linkOverlay.raw()} to={downloadUrl} title={tooltip}>\n {title}\n </StyledSafeLink>\n ) : (\n <Text textStyle=\"label.medium\">{title}</Text>\n )}\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>({fileType?.toUpperCase()})</span>\n </Text>\n </InfoContainer>\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>{fileSize}</span>\n </Text>\n </FileContainer>\n );\n },\n);\n\nexport const FileListElement = ({ title, url, fileExists, fileType, fileSize }: FileProps) => (\n <FileListItem>\n <File title={title} url={url} fileExists={fileExists} fileType={fileType} fileSize={fileSize} />\n </FileListItem>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAM,sDAAwBA,0BAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,QACjB;CACF,EACF,CAAC;AAEF,MAAM,qDAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;CACR,EACF,CAAC;AAEF,MAAM,qDAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,YAAY;CACb,EACF,CAAC;AAEF,MAAa,8BACV,EAAE,OAAO,KAAK,YAAY,UAAU,UAAU,GAAG,QAAQ,QAAQ;CAChE,MAAM,EAAE,yCAAsB;CAC9B,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,IAAI;CACrD,MAAM,cAAc,GAAG,IAAI;CAC3B,MAAM,UAAU,GAAG,EAAE,WAAW,CAAC,GAAG;AAEpC,QACE,4CAAC;EAAmB;EAAK,GAAI;aAC3B,4CAAC;GACC,2CAACC,8BAAe;GACf,aACC,2CAAC;IAAe;IAAS,UAAU;IAAU,KAAKC,0CAAY,KAAK;IAAE,IAAI;IAAa,OAAO;cAC1F;KACc,GAEjB,2CAACC;IAAK,WAAU;cAAgB;KAAa;GAE/C,2CAACA;IAAK,WAAU;IAAc;IAAQ;cACpC,4CAAC;KAAK;KAAE,UAAU,aAAa;KAAC;QAAQ;KACnC;MACO,EAChB,2CAACA;GAAK,WAAU;GAAc;GAAQ;aACpC,2CAAC,oBAAM,WAAgB;IAClB;GACO;EAGrB;AAED,MAAa,mBAAmB,EAAE,OAAO,KAAK,YAAY,UAAU,eAClE,2CAACC,2CACC,2CAAC;CAAY;CAAY;CAAiB;CAAsB;CAAoB;EAAY,GACnF"}
1
+ {"version":3,"file":"File.js","names":["SafeLink","DownloadLine","linkOverlay","Text","FileListItem"],"sources":["../../src/FileList/File.tsx"],"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\nimport { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DownloadLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { FileListItem } from \"./FileList\";\n\nexport interface FileProps extends ComponentPropsWithRef<\"div\"> {\n title: string;\n url: string;\n fileExists: boolean;\n fileType: string;\n fileSize?: string;\n}\n\nexport interface FileType {\n title: string;\n formats: FileFormat[];\n fileExists?: boolean;\n}\n\nexport interface FileFormat {\n url: string;\n fileType: string;\n tooltip: string;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n textUnderlineOffset: \"2px\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst FileContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n position: \"relative\",\n paddingBlock: \"small\",\n paddingInlineEnd: \"medium\",\n paddingInlineStart: \"small\",\n width: \"100%\",\n },\n});\n\nconst InfoContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"center\",\n },\n});\n\nexport const File = forwardRef<HTMLDivElement, FileProps>(\n ({ title, url, fileExists, fileType, fileSize, ...rest }, ref) => {\n const { t } = useTranslation();\n const filename = `${title}-${url.split(\"/\").pop() ?? \"\"}`;\n const downloadUrl = `${url}?download=true`;\n const tooltip = `${t(\"download\")} ${filename}`;\n\n return (\n <FileContainer ref={ref} {...rest}>\n <InfoContainer>\n <DownloadLine />\n {fileExists ? (\n <StyledSafeLink unstyled download={filename} css={linkOverlay.raw()} to={downloadUrl} title={tooltip}>\n {title}\n </StyledSafeLink>\n ) : (\n <Text textStyle=\"label.medium\">{title}</Text>\n )}\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>({fileType?.toUpperCase()})</span>\n </Text>\n </InfoContainer>\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>{fileSize}</span>\n </Text>\n </FileContainer>\n );\n },\n);\n\nexport const FileListElement = ({ title, url, fileExists, fileType, fileSize }: FileProps) => (\n <FileListItem>\n <File title={title} url={url} fileExists={fileExists} fileType={fileType} fileSize={fileSize} />\n </FileListItem>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAM,qDAAwBA,yBAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,QACjB;CACF,EACF,CAAC;AAEF,MAAM,oDAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;CACR,EACF,CAAC;AAEF,MAAM,oDAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,YAAY;CACb,EACF,CAAC;AAEF,MAAa,8BACV,EAAE,OAAO,KAAK,YAAY,UAAU,UAAU,GAAG,QAAQ,QAAQ;CAChE,MAAM,EAAE,yCAAsB;CAC9B,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,IAAI;CACrD,MAAM,cAAc,GAAG,IAAI;CAC3B,MAAM,UAAU,GAAG,EAAE,WAAW,CAAC,GAAG;AAEpC,QACE,4CAAC;EAAmB;EAAK,GAAI;aAC3B,4CAAC;GACC,2CAACC,6BAAe;GACf,aACC,2CAAC;IAAe;IAAS,UAAU;IAAU,KAAKC,yCAAY,KAAK;IAAE,IAAI;IAAa,OAAO;cAC1F;KACc,GAEjB,2CAACC;IAAK,WAAU;cAAgB;KAAa;GAE/C,2CAACA;IAAK,WAAU;IAAc;IAAQ;cACpC,4CAAC;KAAK;KAAE,UAAU,aAAa;KAAC;QAAQ;KACnC;MACO,EAChB,2CAACA;GAAK,WAAU;GAAc;GAAQ;aACpC,2CAAC,oBAAM,WAAgB;IAClB;GACO;EAGrB;AAED,MAAa,mBAAmB,EAAE,OAAO,KAAK,YAAY,UAAU,eAClE,2CAACC,2CACC,2CAAC;CAAY;CAAY;CAAiB;CAAsB;CAAoB;EAAY,GACnF"}
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let react = require("react");
3
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
- let __ark_ui_react = require("@ark-ui/react");
5
+ let _ark_ui_react = require("@ark-ui/react");
6
6
 
7
7
  //#region src/FileList/FileList.tsx
8
8
  /**
@@ -12,13 +12,13 @@ let __ark_ui_react = require("@ark-ui/react");
12
12
  * LICENSE file in the root directory of this source tree.
13
13
  *
14
14
  */
15
- const FileListWrapper = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.ul, { base: {
15
+ const FileListWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.ul, { base: {
16
16
  display: "flex",
17
17
  flexDirection: "column",
18
18
  gap: "xsmall",
19
19
  clear: "both"
20
20
  } }, { baseComponent: true });
21
- const FileListItem = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.li, { base: {
21
+ const FileListItem = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.li, { base: {
22
22
  listStyle: "none",
23
23
  background: "surface.infoSubtle",
24
24
  borderBlockEnd: "1px solid",
@@ -1 +1 @@
1
- {"version":3,"file":"FileList.js","names":["ark"],"sources":["../../src/FileList/FileList.tsx"],"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\nimport { type ComponentPropsWithoutRef } from \"react\";\nimport { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const FileListWrapper = styled(\n ark.ul,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n clear: \"both\",\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListItem = styled(\n ark.li,\n {\n base: {\n listStyle: \"none\",\n background: \"surface.infoSubtle\",\n borderBlockEnd: \"1px solid\",\n borderColor: \"stroke.default\",\n display: \"flex\",\n justifyContent: \"space-between\",\n\n _hover: {\n backgroundColor: \"surface.infoSubtle.hover\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListEmbed = ({ children, ...rest }: Props) => {\n return (\n <FileListWrapper {...rest} data-embed-type=\"file-list\">\n {children}\n </FileListWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,uDACXA,mBAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACR,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,oDACXA,mBAAI,IACJ,EACE,MAAM;CACJ,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,gBAAgB;CAEhB,QAAQ,EACN,iBAAiB,4BAClB;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,iBAAiB,EAAE,UAAU,GAAG,WAAkB;AAC7D,QACE,2CAAC;EAAgB,GAAI;EAAM,mBAAgB;EACxC;GACe"}
1
+ {"version":3,"file":"FileList.js","names":["ark"],"sources":["../../src/FileList/FileList.tsx"],"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\nimport { type ComponentPropsWithoutRef } from \"react\";\nimport { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const FileListWrapper = styled(\n ark.ul,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n clear: \"both\",\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListItem = styled(\n ark.li,\n {\n base: {\n listStyle: \"none\",\n background: \"surface.infoSubtle\",\n borderBlockEnd: \"1px solid\",\n borderColor: \"stroke.default\",\n display: \"flex\",\n justifyContent: \"space-between\",\n\n _hover: {\n backgroundColor: \"surface.infoSubtle.hover\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListEmbed = ({ children, ...rest }: Props) => {\n return (\n <FileListWrapper {...rest} data-embed-type=\"file-list\">\n {children}\n </FileListWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,sDACXA,kBAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACR,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,mDACXA,kBAAI,IACJ,EACE,MAAM;CACJ,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,gBAAgB;CAEhB,QAAQ,EACN,iBAAiB,4BAClB;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,iBAAiB,EAAE,UAAU,GAAG,WAAkB;AAC7D,QACE,2CAAC;EAAgB,GAAI;EAAM,mBAAgB;EACxC;GACe"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- let __ndla_primitives = require("@ndla/primitives");
3
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
2
+ let _ndla_primitives = require("@ndla/primitives");
3
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
 
6
6
  //#region src/FileList/PdfFile.tsx
@@ -11,15 +11,15 @@ let react_jsx_runtime = require("react/jsx-runtime");
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  *
13
13
  */
14
- const StyledIframe = (0, __ndla_styled_system_jsx.styled)("iframe", { base: { width: "100%" } });
15
- const StyledListElement = (0, __ndla_styled_system_jsx.styled)("li", { base: { listStyle: "none" } });
16
- const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: {
14
+ const StyledIframe = (0, _ndla_styled_system_jsx.styled)("iframe", { base: { width: "100%" } });
15
+ const StyledListElement = (0, _ndla_styled_system_jsx.styled)("li", { base: { listStyle: "none" } });
16
+ const StyledFigure = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Figure, { base: {
17
17
  display: "flex",
18
18
  flexDirection: "column",
19
19
  gap: "xsmall"
20
20
  } });
21
21
  const PdfFile = ({ title, url }) => {
22
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledListElement, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Heading, {
22
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledListElement, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Heading, {
23
23
  asChild: true,
24
24
  consumeCss: true,
25
25
  textStyle: "title.medium",
@@ -1 +1 @@
1
- {"version":3,"file":"PdfFile.js","names":["Figure","Heading"],"sources":["../../src/FileList/PdfFile.tsx"],"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\nimport { Heading, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props {\n title: string;\n url: string;\n}\n\nconst StyledIframe = styled(\"iframe\", {\n base: {\n width: \"100%\",\n },\n});\n\nconst StyledListElement = styled(\"li\", {\n base: {\n listStyle: \"none\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n});\n\nexport const PdfFile = ({ title, url }: Props) => {\n return (\n <StyledListElement>\n <StyledFigure>\n <Heading asChild consumeCss textStyle=\"title.medium\">\n <h4>{title}</h4>\n </Heading>\n <StyledIframe title={title} height=\"1050\" src={url} />\n </StyledFigure>\n </StyledListElement>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,oDAAsB,UAAU,EACpC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAEF,MAAM,yDAA2B,MAAM,EACrC,MAAM,EACJ,WAAW,QACZ,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAa,WAAW,EAAE,OAAO,UAAiB;AAChD,QACE,2CAAC,+BACC,4CAAC,2BACC,2CAACC;EAAQ;EAAQ;EAAW,WAAU;YACpC,2CAAC,kBAAI,QAAW;GACR,EACV,2CAAC;EAAoB;EAAO,QAAO;EAAO,KAAK;GAAO,IACzC,GACG"}
1
+ {"version":3,"file":"PdfFile.js","names":["Figure","Heading"],"sources":["../../src/FileList/PdfFile.tsx"],"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\nimport { Heading, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props {\n title: string;\n url: string;\n}\n\nconst StyledIframe = styled(\"iframe\", {\n base: {\n width: \"100%\",\n },\n});\n\nconst StyledListElement = styled(\"li\", {\n base: {\n listStyle: \"none\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n});\n\nexport const PdfFile = ({ title, url }: Props) => {\n return (\n <StyledListElement>\n <StyledFigure>\n <Heading asChild consumeCss textStyle=\"title.medium\">\n <h4>{title}</h4>\n </Heading>\n <StyledIframe title={title} height=\"1050\" src={url} />\n </StyledFigure>\n </StyledListElement>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,mDAAsB,UAAU,EACpC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAEF,MAAM,wDAA2B,MAAM,EACrC,MAAM,EACJ,WAAW,QACZ,EACF,CAAC;AAEF,MAAM,mDAAsBA,yBAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAa,WAAW,EAAE,OAAO,UAAiB;AAChD,QACE,2CAAC,+BACC,4CAAC,2BACC,2CAACC;EAAQ;EAAQ;EAAW,WAAU;YACpC,2CAAC,kBAAI,QAAW;GACR,EACV,2CAAC;EAAoB;EAAO,QAAO;EAAO,KAAK;GAAO,IACzC,GACG"}
@@ -2,14 +2,14 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_SpeechControl = require('../AudioPlayer/SpeechControl.js');
3
3
  const require_GlossExample = require('./GlossExample.js');
4
4
  let react = require("react");
5
- let __ndla_primitives = require("@ndla/primitives");
6
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
+ let _ndla_primitives = require("@ndla/primitives");
6
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
7
7
  let html_react_parser = require("html-react-parser");
8
8
  html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
9
9
  let react_i18next = require("react-i18next");
10
- let __ndla_icons = require("@ndla/icons");
10
+ let _ndla_icons = require("@ndla/icons");
11
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
- let __ark_ui_react = require("@ark-ui/react");
12
+ let _ark_ui_react = require("@ark-ui/react");
13
13
 
14
14
  //#region src/Gloss/Gloss.tsx
15
15
  /**
@@ -30,18 +30,18 @@ const getFilteredExamples = (glossData, exampleIds, exampleLangs) => {
30
30
  }
31
31
  return glossData?.examples ?? [];
32
32
  };
33
- const Container = (0, __ndla_styled_system_jsx.styled)("div", { base: {
33
+ const Container = (0, _ndla_styled_system_jsx.styled)("div", { base: {
34
34
  display: "flex",
35
35
  alignItems: "center",
36
36
  justifyContent: "space-between"
37
37
  } });
38
- const TextWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
38
+ const TextWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
39
39
  display: "flex",
40
40
  gap: "small"
41
41
  } });
42
- const StyledAccordionItemContent = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.AccordionItemContent, { base: { paddingInline: "0" } });
43
- const StyledContainer = (0, __ndla_styled_system_jsx.styled)(Container, { base: { marginBlockStart: "3xsmall" } });
44
- const StyledAccordionItem = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.AccordionItem, {
42
+ const StyledAccordionItemContent = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.AccordionItemContent, { base: { paddingInline: "0" } });
43
+ const StyledContainer = (0, _ndla_styled_system_jsx.styled)(Container, { base: { marginBlockStart: "3xsmall" } });
44
+ const StyledAccordionItem = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.AccordionItem, {
45
45
  base: {
46
46
  paddingBlock: "small",
47
47
  paddingInline: "medium"
@@ -65,7 +65,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
65
65
  glossData
66
66
  ]);
67
67
  if (!glossData) return null;
68
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.AccordionRoot, {
68
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.AccordionRoot, {
69
69
  multiple: true,
70
70
  variant: "clean",
71
71
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledAccordionItem, {
@@ -73,7 +73,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
73
73
  variant,
74
74
  children: [
75
75
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TextWrapper, { children: [
76
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
76
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
77
77
  textStyle: "label.medium",
78
78
  fontWeight: "bold",
79
79
  asChild: true,
@@ -81,7 +81,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
81
81
  lang: glossData.originalLanguage,
82
82
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: glossData.gloss })
83
83
  }),
84
- !!glossData.transcriptions.traditional && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
84
+ !!glossData.transcriptions.traditional && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
85
85
  textStyle: "label.medium",
86
86
  asChild: true,
87
87
  consumeCss: true,
@@ -91,7 +91,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
91
91
  children: glossData.transcriptions.traditional
92
92
  }, t("gloss.transcriptions.traditional"))
93
93
  }),
94
- !!glossData.transcriptions.pinyin && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
94
+ !!glossData.transcriptions.pinyin && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
95
95
  textStyle: "label.medium",
96
96
  asChild: true,
97
97
  consumeCss: true,
@@ -102,7 +102,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
102
102
  children: glossData.transcriptions.pinyin
103
103
  }, t("gloss.transcriptions.pinyin"))
104
104
  }),
105
- !!glossData.wordClass && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
105
+ !!glossData.wordClass && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
106
106
  textStyle: "label.medium",
107
107
  asChild: true,
108
108
  consumeCss: true,
@@ -116,7 +116,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
116
116
  title: audio.title,
117
117
  type: "gloss"
118
118
  })] }),
119
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContainer, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
119
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContainer, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
120
120
  textStyle: "label.medium",
121
121
  asChild: true,
122
122
  consumeCss: true,
@@ -124,15 +124,15 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) =
124
124
  lang: title.language,
125
125
  children: parsedTitle
126
126
  })
127
- }), !!filteredExamples.length && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ark_ui_react.AccordionItemTrigger, {
127
+ }), !!filteredExamples.length && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.AccordionItemTrigger, {
128
128
  asChild: true,
129
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.IconButton, {
129
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.IconButton, {
130
130
  variant: "tertiary",
131
131
  "aria-label": t("gloss.showExamples"),
132
132
  title: t("gloss.showExamples"),
133
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.AccordionItemIndicator, {
133
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.AccordionItemIndicator, {
134
134
  asChild: true,
135
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowDownShortLine, { size: "medium" })
135
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.ArrowDownShortLine, { size: "medium" })
136
136
  })
137
137
  })
138
138
  })] }),
@@ -1 +1 @@
1
- {"version":3,"file":"Gloss.js","names":["AccordionItemContent","AccordionItem","AccordionRoot","Text","SpeechControl","AccordionItemTrigger","IconButton","AccordionItemIndicator","ArrowDownShortLine","GlossExample"],"sources":["../../src/Gloss/Gloss.tsx"],"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\nimport parse from \"html-react-parser\";\nimport { useMemo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { AccordionItemTrigger } from \"@ark-ui/react\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n AccordionRoot,\n IconButton,\n Text,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { ConceptTitleDTO, GlossDataDTO, GlossExampleDTO } from \"@ndla/types-backend/concept-api\";\nimport { GlossExample } from \"./GlossExample\";\nimport { SpeechControl } from \"../AudioPlayer/SpeechControl\";\n\n// TODO: Figure out padding between bordered and simple variant.\n// The design says that the content above the accordion content should have enough padding to align with the accordion content.\n// When a gloss is bordered there's way too much padding.\n\nconst getFilteredExamples = (\n glossData: GlossDataDTO | undefined,\n exampleIds: string | undefined,\n exampleLangs: string | undefined,\n): GlossExampleDTO[][] => {\n if (exampleIds !== undefined || exampleLangs !== undefined) {\n const exampleIdsList = exampleIds?.toString()?.split(\",\") ?? [];\n const exampleLangsList = exampleLangs?.split(\",\") ?? [];\n\n const filteredExamples =\n glossData?.examples?.map((examples, i) => {\n if (exampleIdsList.includes(i.toString())) {\n return examples.filter((e) => exampleLangsList.includes(e.language));\n }\n return [];\n }) ?? [];\n const examplesWithoutEmpty = filteredExamples.filter((el) => !!el.length);\n return examplesWithoutEmpty;\n }\n return glossData?.examples ?? [];\n};\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n },\n});\n\nconst StyledAccordionItemContent = styled(AccordionItemContent, {\n base: {\n paddingInline: \"0\",\n },\n});\n\nconst StyledContainer = styled(Container, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst StyledAccordionItem = styled(AccordionItem, {\n base: {\n paddingBlock: \"small\",\n paddingInline: \"medium\",\n },\n defaultVariants: {\n variant: \"simple\",\n },\n variants: {\n variant: {\n simple: {},\n bordered: {\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\ntype GlossVariantProps = StyledVariantProps<typeof StyledAccordionItem>;\n\nexport interface Props {\n title: ConceptTitleDTO;\n glossData?: GlossDataDTO;\n audio?: {\n title: string;\n src?: string;\n };\n exampleIds?: string;\n exampleLangs?: string;\n}\n\nexport const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }: Props & GlossVariantProps) => {\n const { t } = useTranslation();\n\n const parsedTitle = useMemo(() => parse(title.htmlTitle), [title.htmlTitle]);\n\n const filteredExamples = useMemo(\n () => getFilteredExamples(glossData, exampleIds, exampleLangs),\n [exampleIds, exampleLangs, glossData],\n );\n\n if (!glossData) return null;\n\n return (\n <AccordionRoot multiple variant=\"clean\">\n <StyledAccordionItem value=\"gloss\" variant={variant}>\n <Container>\n <TextWrapper>\n <Text textStyle=\"label.medium\" fontWeight=\"bold\" asChild consumeCss lang={glossData.originalLanguage}>\n <span>{glossData.gloss}</span>\n </Text>\n {!!glossData.transcriptions.traditional && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span\n key={t(\"gloss.transcriptions.traditional\")}\n aria-label={t(\"gloss.transcriptions.traditional\")}\n lang={glossData.originalLanguage}\n >\n {glossData.transcriptions.traditional}\n </span>\n </Text>\n )}\n {!!glossData.transcriptions.pinyin && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span\n data-pinyin=\"\"\n key={t(\"gloss.transcriptions.pinyin\")}\n aria-label={t(\"gloss.transcriptions.pinyin\")}\n lang={glossData.originalLanguage}\n >\n {glossData.transcriptions.pinyin}\n </span>\n </Text>\n )}\n {!!glossData.wordClass && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span aria-label={t(\"gloss.wordClass\")}>\n {glossData.wordClass.map((wc) => t(`wordClass.${wc}`).toLowerCase()).join(\" / \")}\n </span>\n </Text>\n )}\n </TextWrapper>\n {!!audio?.src && <SpeechControl src={audio.src} title={audio.title} type=\"gloss\" />}\n </Container>\n <StyledContainer>\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span lang={title.language}>{parsedTitle}</span>\n </Text>\n {!!filteredExamples.length && (\n <AccordionItemTrigger asChild>\n <IconButton variant=\"tertiary\" aria-label={t(\"gloss.showExamples\")} title={t(\"gloss.showExamples\")}>\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine size=\"medium\" />\n </AccordionItemIndicator>\n </IconButton>\n </AccordionItemTrigger>\n )}\n </StyledContainer>\n <StyledAccordionItemContent>\n {filteredExamples.map((examples, index) => (\n <GlossExample\n key={`gloss-example-${index}`}\n examples={examples}\n originalLanguage={glossData.originalLanguage}\n />\n ))}\n </StyledAccordionItemContent>\n </StyledAccordionItem>\n </AccordionRoot>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBACJ,WACA,YACA,iBACwB;AACxB,KAAI,eAAe,UAAa,iBAAiB,QAAW;EAC1D,MAAM,iBAAiB,YAAY,UAAU,EAAE,MAAM,IAAI,IAAI,EAAE;EAC/D,MAAM,mBAAmB,cAAc,MAAM,IAAI,IAAI,EAAE;AAUvD,UAPE,WAAW,UAAU,KAAK,UAAU,MAAM;AACxC,OAAI,eAAe,SAAS,EAAE,UAAU,CAAC,CACvC,QAAO,SAAS,QAAQ,MAAM,iBAAiB,SAAS,EAAE,SAAS,CAAC;AAEtE,UAAO,EAAE;IACT,IAAI,EAAE,EACoC,QAAQ,OAAO,CAAC,CAAC,GAAG,OAAO;;AAG3E,QAAO,W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AACA;MAAK,WAAU;MAAe;MAAQ;gBACrC,2CAAC;OACC,eAAY;OAEZ,cAAY,EAAE,8BAA8B;OAC5C,MAAM,UAAU;iBAEf,UAAU,eAAe;SAJrB,EAAE,8BAA8B,CAKhC;OACF;KAER,CAAC,CAAC,UAAU,aACX,2CAACA;MAAK,WAAU;MAAe;MAAQ;gBACrC,2CAAC;OAAK,cAAY,EAAE,kBAAkB;iBACnC,UAAU,UAAU,KAAK,OAAO,EAAE,aAAa,KAAK,CAAC,aAAa,CAAC,CAAC,KAAK,MAAM;QAC3E;OACF;QAEG,EACb,CAAC,CAAC,OAAO,OAAO,2CAACC;KAAc,KAAK,MAAM;KAAK,OAAO,MAAM;KAAO,MAAK;MAAU,IACzE;IACZ,4CAAC,8BACC,2CAACD;KAAK,WAAU;KAAe;KAAQ;eACrC,2CAAC;MAAK,MAAM,MAAM;gBAAW;OAAmB;MAC3C,EACN,CAAC,CAAC,iBAAiB,UAClB,2CAACE;KAAqB;eACpB,2CAACC;MAAW,SAAQ;MAAW,cAAY,EAAE,qBAAqB;MAAE,OAAO,EAAE,qBAAqB;gBAChG,2CAACC;OAAuB;iBACtB,2CAACC,mCAAmB,MAAK,WAAW;QACb;OACd;MACQ,IAET;IAClB,2CAAC,wCACE,iBAAiB,KAAK,UAAU,UAC/B,2CAACC;KAEW;KACV,kBAAkB,UAAU;OAFvB,iBAAiB,QAGtB,CACF,GACyB;;IACT;GACR"}
1
+ {"version":3,"file":"Gloss.js","names":["AccordionItemContent","AccordionItem","AccordionRoot","Text","SpeechControl","AccordionItemTrigger","IconButton","AccordionItemIndicator","ArrowDownShortLine","GlossExample"],"sources":["../../src/Gloss/Gloss.tsx"],"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\nimport parse from \"html-react-parser\";\nimport { useMemo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { AccordionItemTrigger } from \"@ark-ui/react\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n AccordionRoot,\n IconButton,\n Text,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { ConceptTitleDTO, GlossDataDTO, GlossExampleDTO } from \"@ndla/types-backend/concept-api\";\nimport { GlossExample } from \"./GlossExample\";\nimport { SpeechControl } from \"../AudioPlayer/SpeechControl\";\n\n// TODO: Figure out padding between bordered and simple variant.\n// The design says that the content above the accordion content should have enough padding to align with the accordion content.\n// When a gloss is bordered there's way too much padding.\n\nconst getFilteredExamples = (\n glossData: GlossDataDTO | undefined,\n exampleIds: string | undefined,\n exampleLangs: string | undefined,\n): GlossExampleDTO[][] => {\n if (exampleIds !== undefined || exampleLangs !== undefined) {\n const exampleIdsList = exampleIds?.toString()?.split(\",\") ?? [];\n const exampleLangsList = exampleLangs?.split(\",\") ?? [];\n\n const filteredExamples =\n glossData?.examples?.map((examples, i) => {\n if (exampleIdsList.includes(i.toString())) {\n return examples.filter((e) => exampleLangsList.includes(e.language));\n }\n return [];\n }) ?? [];\n const examplesWithoutEmpty = filteredExamples.filter((el) => !!el.length);\n return examplesWithoutEmpty;\n }\n return glossData?.examples ?? [];\n};\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n },\n});\n\nconst StyledAccordionItemContent = styled(AccordionItemContent, {\n base: {\n paddingInline: \"0\",\n },\n});\n\nconst StyledContainer = styled(Container, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst StyledAccordionItem = styled(AccordionItem, {\n base: {\n paddingBlock: \"small\",\n paddingInline: \"medium\",\n },\n defaultVariants: {\n variant: \"simple\",\n },\n variants: {\n variant: {\n simple: {},\n bordered: {\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\ntype GlossVariantProps = StyledVariantProps<typeof StyledAccordionItem>;\n\nexport interface Props {\n title: ConceptTitleDTO;\n glossData?: GlossDataDTO;\n audio?: {\n title: string;\n src?: string;\n };\n exampleIds?: string;\n exampleLangs?: string;\n}\n\nexport const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }: Props & GlossVariantProps) => {\n const { t } = useTranslation();\n\n const parsedTitle = useMemo(() => parse(title.htmlTitle), [title.htmlTitle]);\n\n const filteredExamples = useMemo(\n () => getFilteredExamples(glossData, exampleIds, exampleLangs),\n [exampleIds, exampleLangs, glossData],\n );\n\n if (!glossData) return null;\n\n return (\n <AccordionRoot multiple variant=\"clean\">\n <StyledAccordionItem value=\"gloss\" variant={variant}>\n <Container>\n <TextWrapper>\n <Text textStyle=\"label.medium\" fontWeight=\"bold\" asChild consumeCss lang={glossData.originalLanguage}>\n <span>{glossData.gloss}</span>\n </Text>\n {!!glossData.transcriptions.traditional && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span\n key={t(\"gloss.transcriptions.traditional\")}\n aria-label={t(\"gloss.transcriptions.traditional\")}\n lang={glossData.originalLanguage}\n >\n {glossData.transcriptions.traditional}\n </span>\n </Text>\n )}\n {!!glossData.transcriptions.pinyin && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span\n data-pinyin=\"\"\n key={t(\"gloss.transcriptions.pinyin\")}\n aria-label={t(\"gloss.transcriptions.pinyin\")}\n lang={glossData.originalLanguage}\n >\n {glossData.transcriptions.pinyin}\n </span>\n </Text>\n )}\n {!!glossData.wordClass && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span aria-label={t(\"gloss.wordClass\")}>\n {glossData.wordClass.map((wc) => t(`wordClass.${wc}`).toLowerCase()).join(\" / \")}\n </span>\n </Text>\n )}\n </TextWrapper>\n {!!audio?.src && <SpeechControl src={audio.src} title={audio.title} type=\"gloss\" />}\n </Container>\n <StyledContainer>\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span lang={title.language}>{parsedTitle}</span>\n </Text>\n {!!filteredExamples.length && (\n <AccordionItemTrigger asChild>\n <IconButton variant=\"tertiary\" aria-label={t(\"gloss.showExamples\")} title={t(\"gloss.showExamples\")}>\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine size=\"medium\" />\n </AccordionItemIndicator>\n </IconButton>\n </AccordionItemTrigger>\n )}\n </StyledContainer>\n <StyledAccordionItemContent>\n {filteredExamples.map((examples, index) => (\n <GlossExample\n key={`gloss-example-${index}`}\n examples={examples}\n originalLanguage={glossData.originalLanguage}\n />\n ))}\n </StyledAccordionItemContent>\n </StyledAccordionItem>\n </AccordionRoot>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBACJ,WACA,YACA,iBACwB;AACxB,KAAI,eAAe,UAAa,iBAAiB,QAAW;EAC1D,MAAM,iBAAiB,YAAY,UAAU,EAAE,MAAM,IAAI,IAAI,EAAE;EAC/D,MAAM,mBAAmB,cAAc,MAAM,IAAI,IAAI,EAAE;AAUvD,UAPE,WAAW,UAAU,KAAK,UAAU,MAAM;AACxC,OAAI,eAAe,SAAS,EAAE,UAAU,CAAC,CACvC,QAAO,SAAS,QAAQ,MAAM,iBAAiB,SAAS,EAAE,SAAS,CAAC;AAEtE,UAAO,EAAE;IACT,IAAI,EAAE,EACoC,QAAQ,OAAO,CAAC,CAAC,GAAG,OAAO;;AAG3E,QAAO,WAAW,YAAY,EAAE;;AAGlC,MAAM,gDAAmB,OAAO,EAC9B,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CACjB,EACF,CAAC;AAEF,MAAM,kDAAqB,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,KAAK;CACN,EACF,CAAC;AAEF,MAAM,iEAAoCA,uCAAsB,EAC9D,MAAM,EACJ,eAAe,KAChB,EACF,CAAC;AAEF,M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UAAU,KAAK,OAAO,EAAE,aAAa,KAAK,CAAC,aAAa,CAAC,CAAC,KAAK,MAAM;QAC3E;OACF;QAEG,EACb,CAAC,CAAC,OAAO,OAAO,2CAACC;KAAc,KAAK,MAAM;KAAK,OAAO,MAAM;KAAO,MAAK;MAAU,IACzE;IACZ,4CAAC,8BACC,2CAACD;KAAK,WAAU;KAAe;KAAQ;eACrC,2CAAC;MAAK,MAAM,MAAM;gBAAW;OAAmB;MAC3C,EACN,CAAC,CAAC,iBAAiB,UAClB,2CAACE;KAAqB;eACpB,2CAACC;MAAW,SAAQ;MAAW,cAAY,EAAE,qBAAqB;MAAE,OAAO,EAAE,qBAAqB;gBAChG,2CAACC;OAAuB;iBACtB,2CAACC,kCAAmB,MAAK,WAAW;QACb;OACd;MACQ,IAET;IAClB,2CAAC,wCACE,iBAAiB,KAAK,UAAU,UAC/B,2CAACC;KAEW;KACV,kBAAkB,UAAU;OAFvB,iBAAiB,QAGtB,CACF,GACyB;;IACT;GACR"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let react = require("react");
3
- let __ndla_primitives = require("@ndla/primitives");
4
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
+ let _ndla_primitives = require("@ndla/primitives");
4
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
6
 
7
7
  //#region src/Gloss/GlossExample.tsx
@@ -12,7 +12,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
12
  * LICENSE file in the root directory of this source tree.
13
13
  *
14
14
  */
15
- const StyledGlossExample = (0, __ndla_styled_system_jsx.styled)("div", { base: {
15
+ const StyledGlossExample = (0, _ndla_styled_system_jsx.styled)("div", { base: {
16
16
  borderTop: "1px solid",
17
17
  borderColor: "stroke.subtle",
18
18
  paddingBlock: "xsmall",
@@ -23,12 +23,12 @@ const StyledGlossExample = (0, __ndla_styled_system_jsx.styled)("div", { base: {
23
23
  "& p": { fontWeight: "bold" }
24
24
  }
25
25
  } });
26
- const PinyinText = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Text, { base: { fontStyle: "italic" } });
26
+ const PinyinText = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Text, { base: { fontStyle: "italic" } });
27
27
  const GlossExample = ({ examples, originalLanguage }) => {
28
28
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: examples.map((examples$1, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [
29
29
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledGlossExample, {
30
30
  lang: examples$1.language,
31
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
31
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
32
32
  textStyle: "label.medium",
33
33
  lang: examples$1.language,
34
34
  children: examples$1.example
@@ -40,7 +40,7 @@ const GlossExample = ({ examples, originalLanguage }) => {
40
40
  textStyle: "label.medium",
41
41
  children: examples$1.transcriptions?.pinyin
42
42
  }) }),
43
- !!examples$1.transcriptions?.traditional && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledGlossExample, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
43
+ !!examples$1.transcriptions?.traditional && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledGlossExample, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
44
44
  textStyle: "label.medium",
45
45
  lang: originalLanguage,
46
46
  children: examples$1.transcriptions.traditional
@@ -1 +1 @@
1
- {"version":3,"file":"GlossExample.js","names":["Text","Fragment","examples"],"sources":["../../src/Gloss/GlossExample.tsx"],"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\nimport { Fragment } from \"react\";\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { GlossExampleDTO } from \"@ndla/types-backend/concept-api\";\n\ninterface Props {\n examples: GlossExampleDTO[];\n originalLanguage: string | undefined;\n}\n\nconst StyledGlossExample = styled(\"div\", {\n base: {\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n _first: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"stroke.default\",\n \"& p\": {\n fontWeight: \"bold\",\n },\n },\n },\n});\n\nconst PinyinText = styled(Text, {\n base: {\n fontStyle: \"italic\",\n },\n});\n\nexport const GlossExample = ({ examples, originalLanguage }: Props) => {\n return (\n <div>\n {examples.map((examples, index) => (\n <Fragment key={index}>\n <StyledGlossExample lang={examples.language}>\n <Text textStyle=\"label.medium\" lang={examples.language}>\n {examples.example}\n </Text>\n </StyledGlossExample>\n {!!examples.transcriptions.pinyin && (\n <StyledGlossExample>\n <PinyinText data-pinyin=\"\" lang={originalLanguage} textStyle=\"label.medium\">\n {examples.transcriptions?.pinyin}\n </PinyinText>\n </StyledGlossExample>\n )}\n {!!examples.transcriptions?.traditional && (\n <StyledGlossExample>\n <Text textStyle=\"label.medium\" lang={originalLanguage}>\n {examples.transcriptions.traditional}\n </Text>\n </StyledGlossExample>\n )}\n </Fragment>\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,0DAA4B,OAAO,EACvC,MAAM;CACJ,WAAW;CACX,aAAa;CACb,cAAc;CACd,eAAe;CACf,QAAQ;EACN,YAAY;EACZ,aAAa;EACb,OAAO,EACL,YAAY,QACb;EACF;CACF,EACF,CAAC;AAEF,MAAM,kDAAoBA,wBAAM,EAC9B,MAAM,EACJ,WAAW,UACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,UAAU,uBAA8B;AACrE,QACE,2CAAC,mBACE,SAAS,KAAK,YAAU,UACvB,4CAACC;EACC,2CAAC;GAAmB,MAAMC,WAAS;aACjC,2CAACF;IAAK,WAAU;IAAe,MAAME,WAAS;cAC3CA,WAAS;KACL;IACY;EACpB,CAAC,CAACA,WAAS,eAAe,UACzB,2CAAC,gCACC,2CAAC;GAAW,eAAY;GAAG,MAAM;GAAkB,WAAU;aAC1DA,WAAS,gBAAgB;IACf,GACM;EAEtB,CAAC,CAACA,WAAS,gBAAgB,eAC1B,2CAAC,gCACC,2CAACF;GAAK,WAAU;GAAe,MAAM;aAClCE,WAAS,eAAe;IACpB,GACY;MAlBV,MAoBJ,CACX,GACE"}
1
+ {"version":3,"file":"GlossExample.js","names":["Text","Fragment","examples"],"sources":["../../src/Gloss/GlossExample.tsx"],"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\nimport { Fragment } from \"react\";\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { GlossExampleDTO } from \"@ndla/types-backend/concept-api\";\n\ninterface Props {\n examples: GlossExampleDTO[];\n originalLanguage: string | undefined;\n}\n\nconst StyledGlossExample = styled(\"div\", {\n base: {\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n _first: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"stroke.default\",\n \"& p\": {\n fontWeight: \"bold\",\n },\n },\n },\n});\n\nconst PinyinText = styled(Text, {\n base: {\n fontStyle: \"italic\",\n },\n});\n\nexport const GlossExample = ({ examples, originalLanguage }: Props) => {\n return (\n <div>\n {examples.map((examples, index) => (\n <Fragment key={index}>\n <StyledGlossExample lang={examples.language}>\n <Text textStyle=\"label.medium\" lang={examples.language}>\n {examples.example}\n </Text>\n </StyledGlossExample>\n {!!examples.transcriptions.pinyin && (\n <StyledGlossExample>\n <PinyinText data-pinyin=\"\" lang={originalLanguage} textStyle=\"label.medium\">\n {examples.transcriptions?.pinyin}\n </PinyinText>\n </StyledGlossExample>\n )}\n {!!examples.transcriptions?.traditional && (\n <StyledGlossExample>\n <Text textStyle=\"label.medium\" lang={originalLanguage}>\n {examples.transcriptions.traditional}\n </Text>\n </StyledGlossExample>\n )}\n </Fragment>\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,yDAA4B,OAAO,EACvC,MAAM;CACJ,WAAW;CACX,aAAa;CACb,cAAc;CACd,eAAe;CACf,QAAQ;EACN,YAAY;EACZ,aAAa;EACb,OAAO,EACL,YAAY,QACb;EACF;CACF,EACF,CAAC;AAEF,MAAM,iDAAoBA,uBAAM,EAC9B,MAAM,EACJ,WAAW,UACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,UAAU,uBAA8B;AACrE,QACE,2CAAC,mBACE,SAAS,KAAK,YAAU,UACvB,4CAACC;EACC,2CAAC;GAAmB,MAAMC,WAAS;aACjC,2CAACF;IAAK,WAAU;IAAe,MAAME,WAAS;cAC3CA,WAAS;KACL;IACY;EACpB,CAAC,CAACA,WAAS,eAAe,UACzB,2CAAC,gCACC,2CAAC;GAAW,eAAY;GAAG,MAAM;GAAkB,WAAU;aAC1DA,WAAS,gBAAgB;IACf,GACM;EAEtB,CAAC,CAACA,WAAS,gBAAgB,eAC1B,2CAAC,gCACC,2CAACF;GAAK,WAAU;GAAe,MAAM;aAClCE,WAAS,eAAe;IACpB,GACY;MAlBV,MAoBJ,CACX,GACE"}
package/lib/Grid/Grid.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let react = require("react");
3
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
 
6
6
  //#region src/Grid/Grid.tsx
@@ -11,7 +11,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  *
13
13
  */
14
- const GridContainer = (0, __ndla_styled_system_jsx.styled)("div", {
14
+ const GridContainer = (0, _ndla_styled_system_jsx.styled)("div", {
15
15
  base: {
16
16
  display: "grid",
17
17
  justifyContent: "center",
@@ -51,11 +51,11 @@ const GridContainer = (0, __ndla_styled_system_jsx.styled)("div", {
51
51
  } }
52
52
  }
53
53
  });
54
- const StyledGridItem = (0, __ndla_styled_system_jsx.styled)("div", {
55
- base: {},
54
+ const StyledGridItem = (0, _ndla_styled_system_jsx.styled)("div", {
55
+ base: { padding: "medium" },
56
56
  variants: { border: { true: {
57
57
  outline: "1px solid",
58
- borderColor: "stroke.default"
58
+ outlineColor: "stroke.default"
59
59
  } } }
60
60
  });
61
61
  const Grid = ({ columns, border, children, ...rest }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.js","names":[],"sources":["../../src/Grid/Grid.tsx"],"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\nimport { type ComponentProps, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\n\nconst GridContainer = styled(\"div\", {\n base: {\n display: \"grid\",\n justifyContent: \"center\",\n borderRadius: \"xsmall\",\n gridRowGap: \"large\",\n gridColumnGap: \"medium\",\n width: \"100%\",\n minWidth: \"surface.xxsmall\",\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n\n \"& div[data-embed-type='pitch']\": {\n height: \"100%\",\n \"& > :last-child\": {\n marginTop: \"auto\",\n },\n },\n tabletDown: {\n gridTemplateColumns: \"repeat(1, minmax(0, 1fr))\",\n },\n tabletToDesktop: {\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n \"& > div:nth-child(3):last-child\": {\n display: \"flex\",\n flexFlow: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gridColumn: \"span 2\",\n },\n },\n },\n variants: {\n columns: {\n \"2\": {},\n \"2x2\": {},\n \"3\": { desktop: { gridTemplateColumns: \"repeat(3, minmax(0, 1fr))\" } },\n \"4\": { desktop: { gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\" } },\n },\n border: {\n lightBlue: {\n padding: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"surface.brand.2\",\n },\n },\n },\n});\n\nconst StyledGridItem = styled(\"div\", {\n base: {},\n variants: {\n border: {\n true: {\n outline: \"1px solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n});\n\ntype GridVariantProps = NonNullable<StyledVariantProps<typeof GridContainer>>;\n\nexport interface GridProps extends ComponentProps<\"div\">, GridVariantProps {\n children?: ReactNode[];\n columns: NonNullable<GridVariantProps[\"columns\"]>;\n}\n\ntype GridItemVariantProps = NonNullable<StyledVariantProps<typeof StyledGridItem>>;\n\nexport interface GridItemProps extends ComponentProps<\"div\">, GridItemVariantProps {}\n\nexport const Grid = ({ columns, border, children, ...rest }: GridProps) => {\n const amountOfColumns = children?.length === 3 ? \"3\" : columns;\n\n return (\n <GridContainer data-embed-type=\"grid\" border={border} columns={amountOfColumns} {...rest}>\n {children}\n </GridContainer>\n );\n};\n\nexport const GridItem = ({ border, children, ...rest }: GridItemProps) => {\n return (\n <StyledGridItem data-embed-type=\"grid-cell\" border={border} {...rest}>\n {children}\n </StyledGridItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,qDAAuB,OAAO;CAClC,MAAM;EACJ,SAAS;EACT,gBAAgB;EAChB,cAAc;EACd,YAAY;EACZ,eAAe;EACf,OAAO;EACP,UAAU;EACV,qBAAqB;EAErB,kCAAkC;GAChC,QAAQ;GACR,mBAAmB,EACjB,WAAW,QACZ;GACF;EACD,YAAY,EACV,qBAAqB,6BACtB;EACD,iBAAiB;GACf,qBAAqB;GACrB,mCAAmC;IACjC,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACb;GACF;EACF;CACD,UAAU;EACR,SAAS;GACP,KAAK,EAAE;GACP,OAAO,EAAE;GACT,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACtE,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACvE;EACD,QAAQ,EACN,WAAW;GACT,SAAS;GACT,QAAQ;GACR,aAAa;GACd,EACF;EACF;CACF,CAAC;AAEF,MAAM,sDAAwB,OAAO;CACnC,MAAM,EAAE;CACR,UAAU,EACR,QAAQ,EACN,MAAM;EACJ,SAAS;EACT,aAAa;EACd,EACF,EACF;CACF,CAAC;AAaF,MAAa,QAAQ,EAAE,SAAS,QAAQ,UAAU,GAAG,WAAsB;CACzE,MAAM,kBAAkB,UAAU,WAAW,IAAI,MAAM;AAEvD,QACE,2CAAC;EAAc,mBAAgB;EAAe;EAAQ,SAAS;EAAiB,GAAI;EACjF;GACa;;AAIpB,MAAa,YAAY,EAAE,QAAQ,UAAU,GAAG,WAA0B;AACxE,QACE,2CAAC;EAAe,mBAAgB;EAAoB;EAAQ,GAAI;EAC7D;GACc"}
1
+ {"version":3,"file":"Grid.js","names":[],"sources":["../../src/Grid/Grid.tsx"],"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\nimport { type ComponentProps, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\n\nconst GridContainer = styled(\"div\", {\n base: {\n display: \"grid\",\n justifyContent: \"center\",\n borderRadius: \"xsmall\",\n gridRowGap: \"large\",\n gridColumnGap: \"medium\",\n width: \"100%\",\n minWidth: \"surface.xxsmall\",\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n\n \"& div[data-embed-type='pitch']\": {\n height: \"100%\",\n \"& > :last-child\": {\n marginTop: \"auto\",\n },\n },\n tabletDown: {\n gridTemplateColumns: \"repeat(1, minmax(0, 1fr))\",\n },\n tabletToDesktop: {\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n \"& > div:nth-child(3):last-child\": {\n display: \"flex\",\n flexFlow: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gridColumn: \"span 2\",\n },\n },\n },\n variants: {\n columns: {\n \"2\": {},\n \"2x2\": {},\n \"3\": { desktop: { gridTemplateColumns: \"repeat(3, minmax(0, 1fr))\" } },\n \"4\": { desktop: { gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\" } },\n },\n border: {\n lightBlue: {\n padding: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"surface.brand.2\",\n },\n },\n },\n});\n\nconst StyledGridItem = styled(\"div\", {\n base: {\n padding: \"medium\",\n },\n variants: {\n border: {\n true: {\n outline: \"1px solid\",\n outlineColor: \"stroke.default\",\n },\n },\n },\n});\n\ntype GridVariantProps = NonNullable<StyledVariantProps<typeof GridContainer>>;\n\nexport interface GridProps extends ComponentProps<\"div\">, GridVariantProps {\n children?: ReactNode[];\n columns: NonNullable<GridVariantProps[\"columns\"]>;\n}\n\ntype GridItemVariantProps = NonNullable<StyledVariantProps<typeof StyledGridItem>>;\n\nexport interface GridItemProps extends ComponentProps<\"div\">, GridItemVariantProps {}\n\nexport const Grid = ({ columns, border, children, ...rest }: GridProps) => {\n const amountOfColumns = children?.length === 3 ? \"3\" : columns;\n\n return (\n <GridContainer data-embed-type=\"grid\" border={border} columns={amountOfColumns} {...rest}>\n {children}\n </GridContainer>\n );\n};\n\nexport const GridItem = ({ border, children, ...rest }: GridItemProps) => {\n return (\n <StyledGridItem data-embed-type=\"grid-cell\" border={border} {...rest}>\n {children}\n </StyledGridItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,oDAAuB,OAAO;CAClC,MAAM;EACJ,SAAS;EACT,gBAAgB;EAChB,cAAc;EACd,YAAY;EACZ,eAAe;EACf,OAAO;EACP,UAAU;EACV,qBAAqB;EAErB,kCAAkC;GAChC,QAAQ;GACR,mBAAmB,EACjB,WAAW,QACZ;GACF;EACD,YAAY,EACV,qBAAqB,6BACtB;EACD,iBAAiB;GACf,qBAAqB;GACrB,mCAAmC;IACjC,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACb;GACF;EACF;CACD,UAAU;EACR,SAAS;GACP,KAAK,EAAE;GACP,OAAO,EAAE;GACT,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACtE,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACvE;EACD,QAAQ,EACN,WAAW;GACT,SAAS;GACT,QAAQ;GACR,aAAa;GACd,EACF;EACF;CACF,CAAC;AAEF,MAAM,qDAAwB,OAAO;CACnC,MAAM,EACJ,SAAS,UACV;CACD,UAAU,EACR,QAAQ,EACN,MAAM;EACJ,SAAS;EACT,cAAc;EACf,EACF,EACF;CACF,CAAC;AAaF,MAAa,QAAQ,EAAE,SAAS,QAAQ,UAAU,GAAG,WAAsB;CACzE,MAAM,kBAAkB,UAAU,WAAW,IAAI,MAAM;AAEvD,QACE,2CAAC;EAAc,mBAAgB;EAAe;EAAQ,SAAS;EAAiB,GAAI;EACjF;GACa;;AAIpB,MAAa,YAAY,EAAE,QAAQ,UAAU,GAAG,WAA0B;AACxE,QACE,2CAAC;EAAe,mBAAgB;EAAoB;EAAQ,GAAI;EAC7D;GACc"}
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
2
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
3
  let html_react_parser = require("html-react-parser");
4
4
  html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -12,7 +12,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
12
  * LICENSE file in the root directory of this source tree.
13
13
  *
14
14
  */
15
- const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
15
+ const ContentWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
16
16
  display: "flex",
17
17
  flexDirection: "column",
18
18
  alignItems: "center",
@@ -20,16 +20,16 @@ const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
20
20
  gap: "xsmall",
21
21
  "&:not(:has(> img))": { paddingBlock: "xxlarge" }
22
22
  } });
23
- const StyledImage = (0, __ndla_styled_system_jsx.styled)("img", { base: {
23
+ const StyledImage = (0, _ndla_styled_system_jsx.styled)("img", { base: {
24
24
  height: "surface.3xsmall",
25
25
  width: "surface.3xsmall",
26
26
  borderRadius: "xsmall"
27
27
  } });
28
- const TitleWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
28
+ const TitleWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
29
29
  textStyle: "heading.large",
30
30
  textAlign: "center"
31
31
  } });
32
- const SubTitleWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
32
+ const SubTitleWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
33
33
  textStyle: "title.medium",
34
34
  textAlign: "center"
35
35
  } });
@@ -1 +1 @@
1
- {"version":3,"file":"KeyFigure.js","names":[],"sources":["../../src/KeyFigure/KeyFigure.tsx"],"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\nimport parse from \"html-react-parser\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"xsmall\",\n\n \"&:not(:has(> img))\": {\n paddingBlock: \"xxlarge\",\n },\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n height: \"surface.3xsmall\",\n width: \"surface.3xsmall\",\n borderRadius: \"xsmall\",\n },\n});\n\nconst TitleWrapper = styled(\"div\", {\n base: {\n textStyle: \"heading.large\",\n textAlign: \"center\",\n },\n});\n\nconst SubTitleWrapper = styled(\"div\", {\n base: {\n textStyle: \"title.medium\",\n textAlign: \"center\",\n },\n});\n\nexport interface Props {\n image?: {\n src?: string;\n alt?: string;\n };\n title: string;\n subtitle: string;\n}\n\nexport const KeyFigure = ({ image, title, subtitle }: Props) => {\n return (\n <ContentWrapper data-embed-type=\"key-figure\">\n {!!image && <StyledImage src={`${image?.src}?width=150`} width={150} height={150} alt={image?.alt} />}\n <TitleWrapper>{parse(title)}</TitleWrapper>\n <SubTitleWrapper>{parse(subtitle)}</SubTitleWrapper>\n </ContentWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,gBAAgB;CAChB,KAAK;CAEL,sBAAsB,EACpB,cAAc,WACf;CACF,EACF,CAAC;AAEF,MAAM,mDAAqB,OAAO,EAChC,MAAM;CACJ,QAAQ;CACR,OAAO;CACP,cAAc;CACf,EACF,CAAC;AAEF,MAAM,oDAAsB,OAAO,EACjC,MAAM;CACJ,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,uDAAyB,OAAO,EACpC,MAAM;CACJ,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAWF,MAAa,aAAa,EAAE,OAAO,OAAO,eAAsB;AAC9D,QACE,4CAAC;EAAe,mBAAgB;;GAC7B,CAAC,CAAC,SAAS,2CAAC;IAAY,KAAK,GAAG,OAAO,IAAI;IAAa,OAAO;IAAK,QAAQ;IAAK,KAAK,OAAO;KAAO;GACrG,2CAAC,yDAAoB,MAAM,GAAgB;GAC3C,2CAAC,4DAAuB,SAAS,GAAmB;;GACrC"}
1
+ {"version":3,"file":"KeyFigure.js","names":[],"sources":["../../src/KeyFigure/KeyFigure.tsx"],"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\nimport parse from \"html-react-parser\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"xsmall\",\n\n \"&:not(:has(> img))\": {\n paddingBlock: \"xxlarge\",\n },\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n height: \"surface.3xsmall\",\n width: \"surface.3xsmall\",\n borderRadius: \"xsmall\",\n },\n});\n\nconst TitleWrapper = styled(\"div\", {\n base: {\n textStyle: \"heading.large\",\n textAlign: \"center\",\n },\n});\n\nconst SubTitleWrapper = styled(\"div\", {\n base: {\n textStyle: \"title.medium\",\n textAlign: \"center\",\n },\n});\n\nexport interface Props {\n image?: {\n src?: string;\n alt?: string;\n };\n title: string;\n subtitle: string;\n}\n\nexport const KeyFigure = ({ image, title, subtitle }: Props) => {\n return (\n <ContentWrapper data-embed-type=\"key-figure\">\n {!!image && <StyledImage src={`${image?.src}?width=150`} width={150} height={150} alt={image?.alt} />}\n <TitleWrapper>{parse(title)}</TitleWrapper>\n <SubTitleWrapper>{parse(subtitle)}</SubTitleWrapper>\n </ContentWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,qDAAwB,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,gBAAgB;CAChB,KAAK;CAEL,sBAAsB,EACpB,cAAc,WACf;CACF,EACF,CAAC;AAEF,MAAM,kDAAqB,OAAO,EAChC,MAAM;CACJ,QAAQ;CACR,OAAO;CACP,cAAc;CACf,EACF,CAAC;AAEF,MAAM,mDAAsB,OAAO,EACjC,MAAM;CACJ,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,sDAAyB,OAAO,EACpC,MAAM;CACJ,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAWF,MAAa,aAAa,EAAE,OAAO,OAAO,eAAsB;AAC9D,QACE,4CAAC;EAAe,mBAAgB;;GAC7B,CAAC,CAAC,SAAS,2CAAC;IAAY,KAAK,GAAG,OAAO,IAAI;IAAa,OAAO;IAAK,QAAQ;IAAK,KAAK,OAAO;KAAO;GACrG,2CAAC,yDAAoB,MAAM,GAAgB;GAC3C,2CAAC,4DAAuB,SAAS,GAAmB;;GACrC"}
@@ -1,11 +1,11 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_LicenseLink = require('./LicenseLink.js');
3
3
  let react = require("react");
4
- let __ndla_primitives = require("@ndla/primitives");
5
- let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
+ let _ndla_primitives = require("@ndla/primitives");
5
+ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
6
6
  let react_i18next = require("react-i18next");
7
- let __ndla_icons = require("@ndla/icons");
8
- let __ndla_licenses = require("@ndla/licenses");
7
+ let _ndla_icons = require("@ndla/icons");
8
+ let _ndla_licenses = require("@ndla/licenses");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
 
11
11
  //#region src/LicenseByline/EmbedByline.tsx
@@ -16,14 +16,14 @@ let react_jsx_runtime = require("react/jsx-runtime");
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  *
18
18
  */
19
- const BylineWrapper = (0, __ndla_styled_system_jsx.styled)("figcaption", { base: {
19
+ const BylineWrapper = (0, _ndla_styled_system_jsx.styled)("figcaption", { base: {
20
20
  display: "flex",
21
21
  flexDirection: "column",
22
22
  paddingBlock: "xsmall",
23
23
  textStyle: "label.medium",
24
24
  color: "text.subtle"
25
25
  } });
26
- const ErrorBylineWrapper = (0, __ndla_styled_system_jsx.styled)(BylineWrapper, { base: {
26
+ const ErrorBylineWrapper = (0, _ndla_styled_system_jsx.styled)(BylineWrapper, { base: {
27
27
  border: "1px solid",
28
28
  borderColor: "stroke.error",
29
29
  borderRadius: "xsmall",
@@ -31,14 +31,14 @@ const ErrorBylineWrapper = (0, __ndla_styled_system_jsx.styled)(BylineWrapper, {
31
31
  paddingInline: "medium",
32
32
  paddingBlock: "medium"
33
33
  } });
34
- const StyledText = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Text, { base: { fontStyle: "italic" } });
35
- const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
34
+ const StyledText = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Text, { base: { fontStyle: "italic" } });
35
+ const ContentWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
36
36
  display: "flex",
37
37
  gap: "xsmall",
38
38
  alignItems: "center",
39
39
  textStyle: "label.medium"
40
40
  } });
41
- const BaseDescription = (0, __ndla_styled_system_jsx.styled)("div", { base: {
41
+ const BaseDescription = (0, _ndla_styled_system_jsx.styled)("div", { base: {
42
42
  display: "inline-flex",
43
43
  whiteSpace: "pre-wrap"
44
44
  } });
@@ -46,7 +46,7 @@ const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright, .
46
46
  const { t } = (0, react_i18next.useTranslation)();
47
47
  if (props.error) {
48
48
  const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
49
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorBylineWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.AlertLine, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BaseDescription, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("embed.embedError", { type: typeString }) }) })] }) });
49
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorBylineWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.AlertLine, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BaseDescription, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("embed.embedError", { type: typeString }) }) })] }) });
50
50
  }
51
51
  const { copyright } = props;
52
52
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!(hideCopyright && !description) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BylineWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
@@ -65,14 +65,14 @@ const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright, .
65
65
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: `Alt: ${visibleAlt}` })
66
66
  }) : null] });
67
67
  };
68
- const StyledDescription = (0, __ndla_styled_system_jsx.styled)(BaseDescription, { base: { mobileWideDown: {
68
+ const StyledDescription = (0, _ndla_styled_system_jsx.styled)(BaseDescription, { base: { mobileWideDown: {
69
69
  display: "grid",
70
70
  gridTemplateColumns: "1fr auto",
71
71
  alignItems: "center",
72
72
  overflow: "hidden",
73
73
  _open: { display: "inline" }
74
74
  } } });
75
- const TextContent = (0, __ndla_styled_system_jsx.styled)("span", { base: { mobileWideDown: {
75
+ const TextContent = (0, _ndla_styled_system_jsx.styled)("span", { base: { mobileWideDown: {
76
76
  whiteSpace: "nowrap",
77
77
  maxHeight: "large",
78
78
  overflow: "hidden",
@@ -86,7 +86,7 @@ const TextContent = (0, __ndla_styled_system_jsx.styled)("span", { base: { mobil
86
86
  maxHeight: "none"
87
87
  }
88
88
  } } });
89
- const StyledButton = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Button, { base: { mobileWide: { display: "none" } } });
89
+ const StyledButton = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Button, { base: { mobileWide: { display: "none" } } });
90
90
  const LicenseDescription = ({ children, isOpen, setIsOpen }) => {
91
91
  const open = isOpen ? { "data-open": "" } : {};
92
92
  const { t } = (0, react_i18next.useTranslation)();
@@ -108,7 +108,7 @@ const LicenseDescription = ({ children, isOpen, setIsOpen }) => {
108
108
  };
109
109
  const LicenseContainerContent = ({ children, copyright, type }) => {
110
110
  const { t, i18n } = (0, react_i18next.useTranslation)();
111
- const license = copyright ? (0, __ndla_licenses.getLicenseByAbbreviation)(copyright.license?.license ?? "", i18n.language) : void 0;
111
+ const license = copyright ? (0, _ndla_licenses.getLicenseByAbbreviation)(copyright.license?.license ?? "", i18n.language) : void 0;
112
112
  const captionAuthors = [
113
113
  copyright?.creators,
114
114
  copyright?.rightsholders,
@@ -129,7 +129,7 @@ const LicenseContainerContent = ({ children, copyright, type }) => {
129
129
  setIsOpen,
130
130
  children: content
131
131
  });
132
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
132
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
133
133
  textStyle: "label.medium",
134
134
  asChild: true,
135
135
  consumeCss: true,
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedByline.js","names":["Text","AlertLine","Button","LicenseLink"],"sources":["../../src/LicenseByline/EmbedByline.tsx"],"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\nimport { type Dispatch, type ReactNode, type SetStateAction, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { AlertLine } from \"@ndla/icons\";\nimport { getLicenseByAbbreviation } from \"@ndla/licenses\";\nimport { Button, Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightDTO as ArticleCopyright } from \"@ndla/types-backend/article-api\";\nimport type { CopyrightDTO as AudioCopyright } from \"@ndla/types-backend/audio-api\";\nimport type { DraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { CopyrightDTO as ImageCopyright } from \"@ndla/types-backend/image-api\";\nimport type { BrightcoveCopyright } from \"@ndla/types-embed\";\nimport { LicenseLink } from \"./LicenseLink\";\n\ninterface BaseProps {\n description?: ReactNode;\n children?: ReactNode;\n visibleAlt?: string;\n error?: true | false;\n hideDescription?: boolean;\n hideCopyright?: boolean;\n}\n\nexport interface EmbedBylineErrorProps extends BaseProps {\n type: EmbedBylineTypeProps[\"type\"] | \"h5p\" | \"external\" | \"code\";\n error: true;\n}\n\ninterface ImageProps extends BaseProps {\n type: \"image\";\n copyright: ImageCopyright | undefined;\n}\n\ninterface BrightcoveProps extends BaseProps {\n type: \"video\";\n copyright: BrightcoveCopyright | undefined;\n}\n\ninterface AudioProps extends BaseProps {\n type: \"audio\";\n copyright: AudioCopyright | undefined;\n}\n\ninterface PodcastProps extends BaseProps {\n type: \"podcast\";\n copyright: AudioCopyright | undefined;\n}\n\ninterface ConceptProps extends BaseProps {\n type: \"concept\" | \"gloss\";\n copyright: ConceptCopyright | undefined;\n}\n\ninterface CopyrightProps extends BaseProps {\n type: \"copyright\";\n copyright: ArticleCopyright | undefined;\n}\n\nexport type EmbedBylineTypeProps =\n | ImageProps\n | BrightcoveProps\n | AudioProps\n | PodcastProps\n | ConceptProps\n | CopyrightProps;\n\ntype Props = EmbedBylineTypeProps | EmbedBylineErrorProps;\n\nconst BylineWrapper = styled(\"figcaption\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: \"xsmall\",\n textStyle: \"label.medium\",\n color: \"text.subtle\",\n },\n});\n\nconst ErrorBylineWrapper = styled(BylineWrapper, {\n base: {\n border: \"1px solid\",\n borderColor: \"stroke.error\",\n borderRadius: \"xsmall\",\n background: \"surface.dangerSubtle\",\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n fontStyle: \"italic\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xsmall\",\n alignItems: \"center\",\n textStyle: \"label.medium\",\n },\n});\n\nconst BaseDescription = styled(\"div\", {\n base: {\n display: \"inline-flex\",\n whiteSpace: \"pre-wrap\",\n },\n});\n\nexport const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright, ...props }: Props) => {\n const { t } = useTranslation();\n\n if (props.error) {\n const typeString = type === \"h5p\" ? \"H5P\" : t(`embed.type.${type}`).toLowerCase();\n return (\n <ErrorBylineWrapper>\n <ContentWrapper>\n <AlertLine />\n <BaseDescription>\n <span>{t(\"embed.embedError\", { type: typeString })}</span>\n </BaseDescription>\n </ContentWrapper>\n </ErrorBylineWrapper>\n );\n }\n\n const { copyright } = props;\n const hideByline = hideCopyright && !description;\n\n return (\n <>\n {!hideByline && (\n <BylineWrapper>\n <div>\n {!!hideCopyright && description}\n {!hideCopyright && (\n <LicenseContainerContent type={type} copyright={copyright}>\n {description}\n </LicenseContainerContent>\n )}\n {children}\n </div>\n </BylineWrapper>\n )}\n {visibleAlt ? (\n <StyledText color=\"text.subtle\" textStyle=\"label.medium\" asChild consumeCss>\n <span>{`Alt: ${visibleAlt}`}</span>\n </StyledText>\n ) : null}\n </>\n );\n};\n\ninterface LicenseContainerProps {\n children?: ReactNode;\n copyright: EmbedBylineTypeProps[\"copyright\"];\n type: Props[\"type\"];\n}\n\nconst StyledDescription = styled(BaseDescription, {\n base: {\n mobileWideDown: {\n display: \"grid\",\n gridTemplateColumns: \"1fr auto\",\n alignItems: \"center\",\n overflow: \"hidden\",\n _open: {\n display: \"inline\",\n },\n },\n },\n});\n\nconst TextContent = styled(\"span\", {\n base: {\n mobileWideDown: {\n whiteSpace: \"nowrap\",\n maxHeight: \"large\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n transitionProperty: \"max-height\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in\",\n marginInlineEnd: \"4xsmall\",\n _open: {\n whiteSpace: \"pre-wrap\",\n maxHeight: \"none\",\n },\n },\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n mobileWide: {\n display: \"none\",\n },\n },\n});\n\ninterface LicenseDescriptionProps {\n children?: ReactNode;\n isOpen: boolean;\n setIsOpen: Dispatch<SetStateAction<boolean>>;\n}\n\nconst LicenseDescription = ({ children, isOpen, setIsOpen }: LicenseDescriptionProps) => {\n const open = isOpen ? { \"data-open\": \"\" } : {};\n const { t } = useTranslation();\n\n const handleToggle = () => {\n setIsOpen(!isOpen);\n };\n\n return (\n <ContentWrapper>\n <StyledDescription {...open}>\n <TextContent {...open}>{children}</TextContent>\n <StyledButton variant=\"link\" size=\"small\" onClick={handleToggle}>\n {isOpen ? `${t(\"audio.readLessDescriptionLabel\")}` : `${t(\"audio.readMoreDescriptionLabel\")}`}\n </StyledButton>\n </StyledDescription>\n </ContentWrapper>\n );\n};\n\nexport const LicenseContainerContent = ({ children, copyright, type }: LicenseContainerProps) => {\n const { t, i18n } = useTranslation();\n const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? \"\", i18n.language) : undefined;\n const captionAuthors =\n [copyright?.creators, copyright?.rightsholders, copyright?.processors].find((authors) => authors?.length) ?? [];\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n const content = (\n <>\n {children}\n {` ${t(`embed.type.${type}`)}${captionAuthors.length ? \": \" : \"\"}`}\n <span>{captionAuthors.map((author) => author.name).join(\", \")}</span>\n {license ? (\n <>\n {\" / \"}\n {<LicenseLink license={license} hideLink={!isOpen && !!children} />}\n </>\n ) : null}\n </>\n );\n\n if (children) {\n return (\n <LicenseDescription isOpen={isOpen} setIsOpen={setIsOpen}>\n {content}\n </LicenseDescription>\n );\n }\n\n return (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span>{content}</span>\n </Text>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,MAAM,qDAAuB,cAAc,EACzC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,cAAc;CACd,WAAW;CACX,OAAO;CACR,EACF,CAAC;AAEF,MAAM,0DAA4B,eAAe,EAC/C,MAAM;CACJ,QAAQ;CACR,aAAa;CACb,cAAc;CACd,YAAY;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Byline.js","names":["Text","AlertLine","Button","LicenseLink"],"sources":["../../src/LicenseByline/EmbedByline.tsx"],"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\nimport { type Dispatch, type ReactNode, type SetStateAction, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { AlertLine } from \"@ndla/icons\";\nimport { getLicenseByAbbreviation } from \"@ndla/licenses\";\nimport { Button, Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightDTO as ArticleCopyright } from \"@ndla/types-backend/article-api\";\nimport type { CopyrightDTO as AudioCopyright } from \"@ndla/types-backend/audio-api\";\nimport type { DraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { CopyrightDTO as ImageCopyright } from \"@ndla/types-backend/image-api\";\nimport type { BrightcoveCopyright } from \"@ndla/types-embed\";\nimport { LicenseLink } from \"./LicenseLink\";\n\ninterface BaseProps {\n description?: ReactNode;\n children?: ReactNode;\n visibleAlt?: string;\n error?: true | false;\n hideDescription?: boolean;\n hideCopyright?: boolean;\n}\n\nexport interface EmbedBylineErrorProps extends BaseProps {\n type: EmbedBylineTypeProps[\"type\"] | \"h5p\" | \"external\" | \"code\";\n error: true;\n}\n\ninterface ImageProps extends BaseProps {\n type: \"image\";\n copyright: ImageCopyright | undefined;\n}\n\ninterface BrightcoveProps extends BaseProps {\n type: \"video\";\n copyright: BrightcoveCopyright | undefined;\n}\n\ninterface AudioProps extends BaseProps {\n type: \"audio\";\n copyright: AudioCopyright | undefined;\n}\n\ninterface PodcastProps extends BaseProps {\n type: \"podcast\";\n copyright: AudioCopyright | undefined;\n}\n\ninterface ConceptProps extends BaseProps {\n type: \"concept\" | \"gloss\";\n copyright: ConceptCopyright | undefined;\n}\n\ninterface CopyrightProps extends BaseProps {\n type: \"copyright\";\n copyright: ArticleCopyright | undefined;\n}\n\nexport type EmbedBylineTypeProps =\n | ImageProps\n | BrightcoveProps\n | AudioProps\n | PodcastProps\n | ConceptProps\n | CopyrightProps;\n\ntype Props = EmbedBylineTypeProps | EmbedBylineErrorProps;\n\nconst BylineWrapper = styled(\"figcaption\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: \"xsmall\",\n textStyle: \"label.medium\",\n color: \"text.subtle\",\n },\n});\n\nconst ErrorBylineWrapper = styled(BylineWrapper, {\n base: {\n border: \"1px solid\",\n borderColor: \"stroke.error\",\n borderRadius: \"xsmall\",\n background: \"surface.dangerSubtle\",\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n fontStyle: \"italic\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xsmall\",\n alignItems: \"center\",\n textStyle: \"label.medium\",\n },\n});\n\nconst BaseDescription = styled(\"div\", {\n base: {\n display: \"inline-flex\",\n whiteSpace: \"pre-wrap\",\n },\n});\n\nexport const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright, ...props }: Props) => {\n const { t } = useTranslation();\n\n if (props.error) {\n const typeString = type === \"h5p\" ? \"H5P\" : t(`embed.type.${type}`).toLowerCase();\n return (\n <ErrorBylineWrapper>\n <ContentWrapper>\n <AlertLine />\n <BaseDescription>\n <span>{t(\"embed.embedError\", { type: typeString })}</span>\n </BaseDescription>\n </ContentWrapper>\n </ErrorBylineWrapper>\n );\n }\n\n const { copyright } = props;\n const hideByline = hideCopyright && !description;\n\n return (\n <>\n {!hideByline && (\n <BylineWrapper>\n <div>\n {!!hideCopyright && description}\n {!hideCopyright && (\n <LicenseContainerContent type={type} copyright={copyright}>\n {description}\n </LicenseContainerContent>\n )}\n {children}\n </div>\n </BylineWrapper>\n )}\n {visibleAlt ? (\n <StyledText color=\"text.subtle\" textStyle=\"label.medium\" asChild consumeCss>\n <span>{`Alt: ${visibleAlt}`}</span>\n </StyledText>\n ) : null}\n </>\n );\n};\n\ninterface LicenseContainerProps {\n children?: ReactNode;\n copyright: EmbedBylineTypeProps[\"copyright\"];\n type: Props[\"type\"];\n}\n\nconst StyledDescription = styled(BaseDescription, {\n base: {\n mobileWideDown: {\n display: \"grid\",\n gridTemplateColumns: \"1fr auto\",\n alignItems: \"center\",\n overflow: \"hidden\",\n _open: {\n display: \"inline\",\n },\n },\n },\n});\n\nconst TextContent = styled(\"span\", {\n base: {\n mobileWideDown: {\n whiteSpace: \"nowrap\",\n maxHeight: \"large\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n transitionProperty: \"max-height\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in\",\n marginInlineEnd: \"4xsmall\",\n _open: {\n whiteSpace: \"pre-wrap\",\n maxHeight: \"none\",\n },\n },\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n mobileWide: {\n display: \"none\",\n },\n },\n});\n\ninterface LicenseDescriptionProps {\n children?: ReactNode;\n isOpen: boolean;\n setIsOpen: Dispatch<SetStateAction<boolean>>;\n}\n\nconst LicenseDescription = ({ children, isOpen, setIsOpen }: LicenseDescriptionProps) => {\n const open = isOpen ? { \"data-open\": \"\" } : {};\n const { t } = useTranslation();\n\n const handleToggle = () => {\n setIsOpen(!isOpen);\n };\n\n return (\n <ContentWrapper>\n <StyledDescription {...open}>\n <TextContent {...open}>{children}</TextContent>\n <StyledButton variant=\"link\" size=\"small\" onClick={handleToggle}>\n {isOpen ? `${t(\"audio.readLessDescriptionLabel\")}` : `${t(\"audio.readMoreDescriptionLabel\")}`}\n </StyledButton>\n </StyledDescription>\n </ContentWrapper>\n );\n};\n\nexport const LicenseContainerContent = ({ children, copyright, type }: LicenseContainerProps) => {\n const { t, i18n } = useTranslation();\n const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? \"\", i18n.language) : undefined;\n const captionAuthors =\n [copyright?.creators, copyright?.rightsholders, copyright?.processors].find((authors) => authors?.length) ?? [];\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n const content = (\n <>\n {children}\n {` ${t(`embed.type.${type}`)}${captionAuthors.length ? \": \" : \"\"}`}\n <span>{captionAuthors.map((author) => author.name).join(\", \")}</span>\n {license ? (\n <>\n {\" / \"}\n {<LicenseLink license={license} hideLink={!isOpen && !!children} />}\n </>\n ) : null}\n </>\n );\n\n if (children) {\n return (\n <LicenseDescription isOpen={isOpen} setIsOpen={setIsOpen}>\n {content}\n </LicenseDescription>\n );\n }\n\n return (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span>{content}</span>\n </Text>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,MAAM,oDAAuB,cAAc,EACzC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,cAAc;CACd,WAAW;CACX,OAAO;CACR,EACF,CAAC;AAEF,MAAM,yDAA4B,eAAe,EAC/C,MAAM;CACJ,QAAQ;CACR,aAAa;CACb,cAAc;CACd,YAAY;CACZ,eAAe;CACf,cAAc;CACf,EACF,CAAC;AAEF,MAAM,iDAAoBA,uBAAM,EAC9B,MAAM,EACJ,WAAW,UACZ,EACF,CAAC;AAEF,MAAM,qDAAwB,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,YAAY;CACZ,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,sDAAyB,OAAO,EACpC,MAAM;CACJ,SAAS;CACT,YAAY;CACb,EACF,CAAC;AAEF,MAAa,eAAe,EAAE,MAAM,aAAa,UAAU,YAAY,eAAe,GAAG,YAAmB;CAC1G,MAAM,EAAE,yCAAsB;AAE9B,KAAI,MAAM,OAAO;EACf,MAAM,aAAa,SAAS,QAAQ,QAAQ,EAAE,cAAc,OAAO,CAAC,aAAa;AACjF,SACE,2CAAC,gCACC,4CAAC,6BACC,2CAACC,0BAAY,EACb,2CAAC,6BACC,2CAAC,oBAAM,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC,GAAQ,GAC1C,IACH,GACE;;CAIzB,MAAM,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