@ndla/primitives 1.0.124-alpha.0 → 1.0.126-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 (182) hide show
  1. package/dist/panda.buildinfo.json +8 -0
  2. package/dist/styles.css +119 -7
  3. package/es/Accordion.mjs +1 -2
  4. package/es/Accordion.mjs.map +1 -1
  5. package/es/ArticleLists.mjs +1 -2
  6. package/es/ArticleLists.mjs.map +1 -1
  7. package/es/Badge.mjs +1 -2
  8. package/es/Badge.mjs.map +1 -1
  9. package/es/BlockQuote.mjs +1 -2
  10. package/es/BlockQuote.mjs.map +1 -1
  11. package/es/Button.mjs +1 -2
  12. package/es/Button.mjs.map +1 -1
  13. package/es/Card/Card.mjs +3 -5
  14. package/es/Card/Card.mjs.map +1 -1
  15. package/es/Checkbox.mjs +1 -2
  16. package/es/Checkbox.mjs.map +1 -1
  17. package/es/Combobox.mjs +1 -2
  18. package/es/Combobox.mjs.map +1 -1
  19. package/es/DatePicker.mjs +1 -2
  20. package/es/DatePicker.mjs.map +1 -1
  21. package/es/Dialog.mjs +1 -2
  22. package/es/Dialog.mjs.map +1 -1
  23. package/es/ErrorMessage/ErrorMessage.mjs +5 -8
  24. package/es/ErrorMessage/ErrorMessage.mjs.map +1 -1
  25. package/es/ExpandableBox.mjs +1 -2
  26. package/es/ExpandableBox.mjs.map +1 -1
  27. package/es/Field.mjs +1 -2
  28. package/es/Field.mjs.map +1 -1
  29. package/es/FieldErrorMessage.mjs +1 -2
  30. package/es/FieldErrorMessage.mjs.map +1 -1
  31. package/es/FieldHelper.mjs +1 -2
  32. package/es/FieldHelper.mjs.map +1 -1
  33. package/es/Figure.mjs +31 -14
  34. package/es/Figure.mjs.map +1 -1
  35. package/es/FileUpload.mjs +1 -2
  36. package/es/FileUpload.mjs.map +1 -1
  37. package/es/FramedContent.mjs +1 -2
  38. package/es/FramedContent.mjs.map +1 -1
  39. package/es/Hero.mjs +1 -2
  40. package/es/Hero.mjs.map +1 -1
  41. package/es/Image.mjs +1 -2
  42. package/es/Image.mjs.map +1 -1
  43. package/es/Input.mjs +1 -2
  44. package/es/Input.mjs.map +1 -1
  45. package/es/Label.mjs +1 -2
  46. package/es/Label.mjs.map +1 -1
  47. package/es/Layout/PageContainer.mjs +1 -2
  48. package/es/Layout/PageContainer.mjs.map +1 -1
  49. package/es/Layout/PageContent.mjs +1 -2
  50. package/es/Layout/PageContent.mjs.map +1 -1
  51. package/es/ListItem/ListItem.mjs +5 -16
  52. package/es/ListItem/ListItem.mjs.map +1 -1
  53. package/es/Menu.mjs +1 -2
  54. package/es/Menu.mjs.map +1 -1
  55. package/es/MessageBox.mjs +1 -2
  56. package/es/MessageBox.mjs.map +1 -1
  57. package/es/NdlaLogo.mjs +1 -2
  58. package/es/NdlaLogo.mjs.map +1 -1
  59. package/es/Pagination.mjs +1 -2
  60. package/es/Pagination.mjs.map +1 -1
  61. package/es/Popover.mjs +1 -2
  62. package/es/Popover.mjs.map +1 -1
  63. package/es/RadioGroup.mjs +1 -2
  64. package/es/RadioGroup.mjs.map +1 -1
  65. package/es/Select.mjs +1 -2
  66. package/es/Select.mjs.map +1 -1
  67. package/es/Skeleton.mjs +1 -2
  68. package/es/Skeleton.mjs.map +1 -1
  69. package/es/Slider.mjs +1 -2
  70. package/es/Slider.mjs.map +1 -1
  71. package/es/Spinner.mjs +1 -2
  72. package/es/Spinner.mjs.map +1 -1
  73. package/es/Switch.mjs +1 -2
  74. package/es/Switch.mjs.map +1 -1
  75. package/es/Table.mjs +1 -2
  76. package/es/Table.mjs.map +1 -1
  77. package/es/Tabs.mjs +1 -2
  78. package/es/Tabs.mjs.map +1 -1
  79. package/es/TagsInput.mjs +1 -2
  80. package/es/TagsInput.mjs.map +1 -1
  81. package/es/Text.mjs +1 -2
  82. package/es/Text.mjs.map +1 -1
  83. package/es/Toast.mjs +1 -2
  84. package/es/Toast.mjs.map +1 -1
  85. package/es/ToggleGroup.mjs +1 -2
  86. package/es/ToggleGroup.mjs.map +1 -1
  87. package/es/Tooltip.mjs +1 -2
  88. package/es/Tooltip.mjs.map +1 -1
  89. package/es/Tree/Tree.mjs +1 -2
  90. package/es/Tree/Tree.mjs.map +1 -1
  91. package/es/index.mjs +1 -2
  92. package/lib/Accordion.js +1 -2
  93. package/lib/Accordion.js.map +1 -1
  94. package/lib/ArticleLists.js +1 -2
  95. package/lib/ArticleLists.js.map +1 -1
  96. package/lib/Badge.js +1 -2
  97. package/lib/Badge.js.map +1 -1
  98. package/lib/BlockQuote.js +1 -2
  99. package/lib/BlockQuote.js.map +1 -1
  100. package/lib/Button.js +2 -3
  101. package/lib/Button.js.map +1 -1
  102. package/lib/Card/Card.js +5 -7
  103. package/lib/Card/Card.js.map +1 -1
  104. package/lib/Checkbox.js +2 -3
  105. package/lib/Checkbox.js.map +1 -1
  106. package/lib/Combobox.js +3 -4
  107. package/lib/Combobox.js.map +1 -1
  108. package/lib/DatePicker.js +2 -3
  109. package/lib/DatePicker.js.map +1 -1
  110. package/lib/Dialog.js +2 -3
  111. package/lib/Dialog.js.map +1 -1
  112. package/lib/ErrorMessage/ErrorMessage.js +6 -9
  113. package/lib/ErrorMessage/ErrorMessage.js.map +1 -1
  114. package/lib/ExpandableBox.js +1 -2
  115. package/lib/ExpandableBox.js.map +1 -1
  116. package/lib/Field.js +1 -2
  117. package/lib/Field.js.map +1 -1
  118. package/lib/FieldErrorMessage.js +1 -2
  119. package/lib/FieldErrorMessage.js.map +1 -1
  120. package/lib/FieldHelper.js +1 -2
  121. package/lib/FieldHelper.js.map +1 -1
  122. package/lib/Figure.d.ts +20 -0
  123. package/lib/Figure.js +31 -14
  124. package/lib/Figure.js.map +1 -1
  125. package/lib/FileUpload.js +3 -4
  126. package/lib/FileUpload.js.map +1 -1
  127. package/lib/FramedContent.js +1 -2
  128. package/lib/FramedContent.js.map +1 -1
  129. package/lib/Hero.js +2 -4
  130. package/lib/Hero.js.map +1 -1
  131. package/lib/Image.js +1 -2
  132. package/lib/Image.js.map +1 -1
  133. package/lib/Input.js +1 -2
  134. package/lib/Input.js.map +1 -1
  135. package/lib/Label.js +1 -2
  136. package/lib/Label.js.map +1 -1
  137. package/lib/Layout/PageContainer.js +3 -4
  138. package/lib/Layout/PageContainer.js.map +1 -1
  139. package/lib/Layout/PageContent.js +1 -2
  140. package/lib/Layout/PageContent.js.map +1 -1
  141. package/lib/ListItem/ListItem.js +5 -7
  142. package/lib/ListItem/ListItem.js.map +1 -1
  143. package/lib/Menu.js +2 -3
  144. package/lib/Menu.js.map +1 -1
  145. package/lib/MessageBox.js +1 -2
  146. package/lib/MessageBox.js.map +1 -1
  147. package/lib/NdlaLogo.js +2 -3
  148. package/lib/NdlaLogo.js.map +1 -1
  149. package/lib/Pagination.js +2 -4
  150. package/lib/Pagination.js.map +1 -1
  151. package/lib/Popover.js +2 -3
  152. package/lib/Popover.js.map +1 -1
  153. package/lib/RadioGroup.js +2 -3
  154. package/lib/RadioGroup.js.map +1 -1
  155. package/lib/Select.js +2 -3
  156. package/lib/Select.js.map +1 -1
  157. package/lib/Skeleton.js +2 -4
  158. package/lib/Skeleton.js.map +1 -1
  159. package/lib/Slider.js +2 -3
  160. package/lib/Slider.js.map +1 -1
  161. package/lib/Spinner.js +1 -2
  162. package/lib/Spinner.js.map +1 -1
  163. package/lib/Switch.js +2 -3
  164. package/lib/Switch.js.map +1 -1
  165. package/lib/Table.js +2 -4
  166. package/lib/Table.js.map +1 -1
  167. package/lib/Tabs.js +1 -2
  168. package/lib/Tabs.js.map +1 -1
  169. package/lib/TagsInput.js +2 -3
  170. package/lib/TagsInput.js.map +1 -1
  171. package/lib/Text.js +1 -2
  172. package/lib/Text.js.map +1 -1
  173. package/lib/Toast.js +2 -3
  174. package/lib/Toast.js.map +1 -1
  175. package/lib/ToggleGroup.js +2 -4
  176. package/lib/ToggleGroup.js.map +1 -1
  177. package/lib/Tooltip.js +1 -2
  178. package/lib/Tooltip.js.map +1 -1
  179. package/lib/Tree/Tree.js +2 -3
  180. package/lib/Tree/Tree.js.map +1 -1
  181. package/lib/index.js +56 -57
  182. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"FramedContent.mjs","names":[],"sources":["../src/FramedContent.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst framedContentRecipe = cva({\n base: {\n padding: \"medium\",\n border: \"1px solid\",\n borderRadius: \"small\",\n clear: \"both\",\n overflow: \"hidden\",\n },\n variants: {\n colorTheme: {\n neutral: {\n backgroundColor: \"surface.default\",\n borderColor: \"stroke.subtle\",\n },\n brand1: {\n backgroundColor: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n },\n});\n\nexport type FramedContentVariantProps = NonNullable<RecipeVariantProps<typeof framedContentRecipe>>;\n\nexport interface FramedContentProps extends HTMLArkProps<\"div\">, StyledProps, FramedContentVariantProps {}\n\nconst StyledFramedContent = styled(ark.div, {}, { baseComponent: true });\n\nexport const FramedContent = forwardRef<HTMLDivElement, FramedContentProps>(\n ({ colorTheme, css: cssProp, ...props }, ref) => (\n <StyledFramedContent\n data-embed-type=\"framed-content\"\n css={css.raw(framedContentRecipe.raw({ colorTheme }), cssProp)}\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,sBAAsB,IAAI;CAC9B,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,cAAc;EACd,OAAO;EACP,UAAU;EACX;CACD,UAAU,EACR,YAAY;EACV,SAAS;GACP,iBAAiB;GACjB,aAAa;GACd;EACD,QAAQ;GACN,iBAAiB;GACjB,aAAa;GACd;EACD,QAAQ;GACN,iBAAiB;GACjB,aAAa;GACd;EACF,EACF;CACD,iBAAiB,EACf,YAAY,WACb;CACF,CAAC;AAMF,MAAM,sBAAsB,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAExE,MAAa,gBAAgB,YAC1B,EAAE,YAAY,KAAK,SAAS,GAAG,SAAS,QACvC,oBAAC;CACC,mBAAgB;CAChB,KAAK,IAAI,IAAI,oBAAoB,IAAI,EAAE,YAAY,CAAC,EAAE,QAAQ;CAC9D,GAAI;CACC;EACL,CAEL"}
1
+ {"version":3,"file":"FramedContent.mjs","names":[],"sources":["../src/FramedContent.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst framedContentRecipe = cva({\n base: {\n padding: \"medium\",\n border: \"1px solid\",\n borderRadius: \"small\",\n clear: \"both\",\n overflow: \"hidden\",\n },\n variants: {\n colorTheme: {\n neutral: {\n backgroundColor: \"surface.default\",\n borderColor: \"stroke.subtle\",\n },\n brand1: {\n backgroundColor: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n },\n});\n\nexport type FramedContentVariantProps = NonNullable<RecipeVariantProps<typeof framedContentRecipe>>;\n\nexport interface FramedContentProps extends HTMLArkProps<\"div\">, StyledProps, FramedContentVariantProps {}\n\nconst StyledFramedContent = styled(ark.div, {}, { baseComponent: true });\n\nexport const FramedContent = forwardRef<HTMLDivElement, FramedContentProps>(\n ({ colorTheme, css: cssProp, ...props }, ref) => (\n <StyledFramedContent\n data-embed-type=\"framed-content\"\n css={css.raw(framedContentRecipe.raw({ colorTheme }), cssProp)}\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,sBAAsB,IAAI;CAC9B,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,cAAc;EACd,OAAO;EACP,UAAU;EACX;CACD,UAAU,EACR,YAAY;EACV,SAAS;GACP,iBAAiB;GACjB,aAAa;GACd;EACD,QAAQ;GACN,iBAAiB;GACjB,aAAa;GACd;EACD,QAAQ;GACN,iBAAiB;GACjB,aAAa;GACd;EACF,EACF;CACD,iBAAiB,EACf,YAAY,WACb;CACF,CAAC;AAMF,MAAM,sBAAsB,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAExE,MAAa,gBAAgB,YAC1B,EAAE,YAAY,KAAK,SAAS,GAAG,SAAS,QACvC,oBAAC,qBAAD;CACE,mBAAgB;CAChB,KAAK,IAAI,IAAI,oBAAoB,IAAI,EAAE,YAAY,CAAC,EAAE,QAAQ;CAC9D,GAAI;CACC;CACL,CAAA,CAEL"}
package/es/Hero.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ark } from "@ark-ui/react";
2
2
  import { sva } from "@ndla/styled-system/css";
3
3
  import { createStyleContext } from "@ndla/styled-system/jsx";
4
-
5
4
  //#region src/Hero.tsx
6
5
  /**
7
6
  * Copyright (c) 2024-present, NDLA.
@@ -67,7 +66,7 @@ const { withProvider, withContext } = createStyleContext(sva({
67
66
  const Hero = withProvider(ark.div, "root", { baseComponent: true });
68
67
  const HeroBackground = withContext(ark.div, "background", { baseComponent: true });
69
68
  const HeroContent = withContext(ark.div, "content", { baseComponent: true });
70
-
71
69
  //#endregion
72
70
  export { Hero, HeroBackground, HeroContent };
71
+
73
72
  //# sourceMappingURL=Hero.mjs.map
package/es/Hero.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Hero.mjs","names":[],"sources":["../src/Hero.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\n\nconst heroRecipe = sva({\n slots: [\"root\", \"background\", \"content\"],\n base: {\n root: {\n width: \"100%\",\n position: \"relative\",\n },\n background: {\n height: \"350px\",\n width: \"100%\",\n zIndex: \"hide\",\n overflow: \"hidden\",\n clipPath: \"polygon(0 0, 100% 0, 100% calc(100% - 5vw), 0 100%)\",\n _print: {\n background: \"none\",\n },\n },\n content: {\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"flex-end\",\n paddingBlock: \"xsmall\",\n tablet: {\n paddingBlockStart: \"xxlarge\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n absolute: true,\n },\n variants: {\n absolute: {\n true: {\n background: {\n position: \"absolute\",\n },\n },\n },\n variant: {\n primary: {\n background: {\n background: \"primary\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2Bold: {\n background: {\n background: \"surface.brand.2.bold\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2: {\n background: {\n background: \"surface.brand.2\",\n },\n },\n brand2Moderate: {\n background: {\n background: \"surface.brand.2.moderate\",\n },\n },\n brand1: {\n background: {\n background: \"surface.brand.1\",\n },\n },\n brand1Subtle: {\n background: {\n background: \"surface.brand.1.subtle\",\n },\n },\n brand1Moderate: {\n background: {\n background: \"surface.brand.1.moderate\",\n },\n },\n brand3Moderate: {\n background: {\n background: \"surface.brand.3.moderate\",\n },\n },\n brand4Moderate: {\n background: {\n background: \"surface.brand.4.moderate\",\n },\n },\n brand5Moderate: {\n background: {\n background: \"surface.brand.5.moderate\",\n },\n },\n neutral: {\n background: {\n background: \"surface.infoSubtle\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(heroRecipe);\n\nexport type HeroVariantProps = NonNullable<RecipeVariantProps<typeof heroRecipe>>;\n\nexport type HeroVariant = NonNullable<HeroVariantProps>[\"variant\"];\n\nexport interface HeroProps extends HTMLArkProps<\"div\">, StyledProps, HeroVariantProps {}\n\nexport const Hero = withProvider(ark.div, \"root\", { baseComponent: true });\n\nexport interface HeroBackgroundProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroBackground = withContext(ark.div, \"background\", { baseComponent: true });\n\nexport interface HeroContentProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroContent = withContext(ark.div, \"content\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;AA0HA,MAAM,EAAE,cAAc,gBAAgB,mBA7GnB,IAAI;CACrB,OAAO;EAAC;EAAQ;EAAc;EAAU;CACxC,MAAM;EACJ,MAAM;GACJ,OAAO;GACP,UAAU;GACX;EACD,YAAY;GACV,QAAQ;GACR,OAAO;GACP,QAAQ;GACR,UAAU;GACV,UAAU;GACV,QAAQ,EACN,YAAY,QACb;GACF;EACD,SAAS;GACP,SAAS;GACT,UAAU;GACV,YAAY;GACZ,cAAc;GACd,QAAQ,EACN,mBAAmB,WACpB;GACF;EACF;CACD,iBAAiB;EACf,SAAS;EACT,UAAU;EACX;CACD,UAAU;EACR,UAAU,EACR,MAAM,EACJ,YAAY,EACV,UAAU,YACX,EACF,EACF;EACD,SAAS;GACP,SAAS;IACP,YAAY,EACV,YAAY,WACb;IACD,SAAS,EACP,oBAAoB,EAClB,OAAO,iBACR,EACF;IACF;GACD,YAAY;IACV,YAAY,EACV,YAAY,wBACb;IACD,SAAS,EACP,oBAAoB,EAClB,OAAO,iBACR,EACF;IACF;GACD,QAAQ,EACN,YAAY,EACV,YAAY,mBACb,EACF;GACD,gBAAgB,EACd,YAAY,EACV,YAAY,4BACb,EACF;GACD,QAAQ,EACN,YAAY,EACV,YAAY,mBACb,EACF;GACD,cAAc,EACZ,YAAY,EACV,YAAY,0BACb,EACF;GACD,gBAAgB,EACd,YAAY,EACV,YAAY,4BACb,EACF;GACD,gBAAgB,EACd,YAAY,EACV,YAAY,4BACb,EACF;GACD,gBAAgB,EACd,YAAY,EACV,YAAY,4BACb,EACF;GACD,gBAAgB,EACd,YAAY,EACV,YAAY,4BACb,EACF;GACD,SAAS,EACP,YAAY,EACV,YAAY,sBACb,EACF;GACF;EACF;CACF,CAAC,CAEkE;AAQpE,MAAa,OAAO,aAAa,IAAI,KAAK,QAAQ,EAAE,eAAe,MAAM,CAAC;AAI1E,MAAa,iBAAiB,YAAY,IAAI,KAAK,cAAc,EAAE,eAAe,MAAM,CAAC;AAIzF,MAAa,cAAc,YAAY,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Hero.mjs","names":[],"sources":["../src/Hero.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\n\nconst heroRecipe = sva({\n slots: [\"root\", \"background\", \"content\"],\n base: {\n root: {\n width: \"100%\",\n position: \"relative\",\n },\n background: {\n height: \"350px\",\n width: \"100%\",\n zIndex: \"hide\",\n overflow: \"hidden\",\n clipPath: \"polygon(0 0, 100% 0, 100% calc(100% - 5vw), 0 100%)\",\n _print: {\n background: \"none\",\n },\n },\n content: {\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"flex-end\",\n paddingBlock: \"xsmall\",\n tablet: {\n paddingBlockStart: \"xxlarge\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n absolute: true,\n },\n variants: {\n absolute: {\n true: {\n background: {\n position: \"absolute\",\n },\n },\n },\n variant: {\n primary: {\n background: {\n background: \"primary\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2Bold: {\n background: {\n background: \"surface.brand.2.bold\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2: {\n background: {\n background: \"surface.brand.2\",\n },\n },\n brand2Moderate: {\n background: {\n background: \"surface.brand.2.moderate\",\n },\n },\n brand1: {\n background: {\n background: \"surface.brand.1\",\n },\n },\n brand1Subtle: {\n background: {\n background: \"surface.brand.1.subtle\",\n },\n },\n brand1Moderate: {\n background: {\n background: \"surface.brand.1.moderate\",\n },\n },\n brand3Moderate: {\n background: {\n background: \"surface.brand.3.moderate\",\n },\n },\n brand4Moderate: {\n background: {\n background: \"surface.brand.4.moderate\",\n },\n },\n brand5Moderate: {\n background: {\n background: \"surface.brand.5.moderate\",\n },\n },\n neutral: {\n background: {\n background: \"surface.infoSubtle\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(heroRecipe);\n\nexport type HeroVariantProps = NonNullable<RecipeVariantProps<typeof heroRecipe>>;\n\nexport type HeroVariant = NonNullable<HeroVariantProps>[\"variant\"];\n\nexport interface HeroProps extends HTMLArkProps<\"div\">, StyledProps, HeroVariantProps {}\n\nexport const Hero = withProvider(ark.div, \"root\", { baseComponent: true });\n\nexport interface HeroBackgroundProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroBackground = withContext(ark.div, \"background\", { baseComponent: true });\n\nexport interface HeroContentProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroContent = withContext(ark.div, \"content\", { baseComponent: true });\n"],"mappings":";;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Ac,YAAY,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC"}
package/es/Image.mjs CHANGED
@@ -2,7 +2,6 @@ import { ark } from "@ark-ui/react";
2
2
  import { styled } from "@ndla/styled-system/jsx";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { forwardRef, useEffect, useState } from "react";
5
-
6
5
  //#region src/Image.tsx
7
6
  /**
8
7
  * Copyright (c) 2024-present, NDLA.
@@ -167,7 +166,7 @@ const Image = forwardRef(({ srcSet: srcSetProp, crop, focalPoint, src, contentTy
167
166
  })
168
167
  ] });
169
168
  });
170
-
171
169
  //#endregion
172
170
  export { Image, Img, Picture, getSrcSet, makeSrcQueryString };
171
+
173
172
  //# sourceMappingURL=Image.mjs.map
package/es/Image.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Image.mjs","names":[],"sources":["../src/Image.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 { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { ImageVariantDTO, ImageVariantSize } from \"@ndla/types-backend/image-api\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef, useEffect, useState } from \"react\";\n\nexport interface ImageCrop {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}\n\nexport interface ImageFocalPoint {\n x: number;\n y: number;\n}\n\ninterface SrcQueryStringOptions {\n width?: number;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const makeSrcQueryString = ({ width, crop, focalPoint, imageLanguage }: SrcQueryStringOptions) => {\n const params = [];\n if (width) {\n params.push(`width=${width}`);\n }\n if (crop) {\n params.push(`cropStartX=${crop.startX}&cropEndX=${crop.endX}&cropStartY=${crop.startY}&cropEndY=${crop.endY}`);\n }\n if (focalPoint) {\n params.push(`focalX=${focalPoint.x}&focalY=${focalPoint.y}`);\n }\n if (imageLanguage) {\n params.push(`language=${imageLanguage}`);\n }\n return params.join(\"&\");\n};\n\ninterface SrcSetOptions {\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n src?: string;\n}\n\nexport const VAR_WIDTHS: Record<ImageVariantSize, number> = {\n icon: 240,\n xsmall: 480,\n small: 800,\n medium: 1080,\n large: 1440,\n xlarge: 1920,\n xxlarge: 2560,\n};\n\nconst IMAGE_WIDTHS = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];\n\nexport const getVariantSrcSet = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant) => {\n return `${variant.variantUrl} ${VAR_WIDTHS[variant.size]}w`;\n })\n .join(\", \");\n};\n\nexport const getVariantSizes = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant, i) => {\n if (i === variants.length - 1) {\n return `${VAR_WIDTHS[variant.size]}px`;\n }\n return `(max-width: ${VAR_WIDTHS[variant.size]}px) ${VAR_WIDTHS[variant.size]}px`;\n })\n .join(\", \");\n};\n\nexport const getSrcSet = ({ src, crop, focalPoint, imageLanguage }: SrcSetOptions) => {\n if (!src) return undefined;\n return IMAGE_WIDTHS.map((width) => {\n const queryString = makeSrcQueryString({ width, crop, focalPoint, imageLanguage });\n const query = queryString.length ? `?${queryString}` : \"\";\n return `${src}${query} ${width}w`;\n }).join(\", \");\n};\n\nconst FALLBACK_WIDTH = 1024;\n\nconst FALLBACK_SIZES = \"(min-width: 1024px) 1024px, 100vw\";\n\nexport interface PictureProps extends StyledProps, ComponentPropsWithRef<\"picture\"> {\n src: string;\n sizes?: string;\n contentType?: string;\n srcSet?: string;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const Picture = forwardRef<HTMLPictureElement, PictureProps>(\n (\n {\n children,\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n imageLanguage,\n contentType,\n sizes = FALLBACK_SIZES,\n ...props\n },\n ref,\n ) => {\n const srcSet = srcSetProp ?? getSrcSet({ src, crop, focalPoint, imageLanguage });\n\n return (\n <styled.picture {...props} ref={ref}>\n {contentType !== \"image/gif\" && <source type={contentType} srcSet={srcSet} sizes={sizes} />}\n {children}\n </styled.picture>\n );\n },\n);\n\nconst StyledImage = styled(\"img\", {\n defaultVariants: { variant: \"regular\" },\n variants: {\n variant: {\n regular: {},\n rounded: {\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\nconst StyledFallbackElement = styled(\n ark.div,\n {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n { baseComponent: true },\n);\n\ntype ImageVariantProps = StyledVariantProps<typeof StyledImage>;\n\nexport interface ImgProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src: string;\n fallbackWidth?: number;\n contentType?: string;\n crop?: ImageCrop;\n imageLanguage?: string;\n focalPoint?: ImageFocalPoint;\n}\n\nexport const Img = forwardRef<HTMLImageElement, ImgProps>(\n ({ fallbackWidth = FALLBACK_WIDTH, crop, focalPoint, imageLanguage, contentType, src, alt, ...props }, ref) => {\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const srcWithParms = queryString ? `${src}?${queryString}` : src;\n return <StyledImage alt={alt} src={contentType === \"image/gif\" ? src : srcWithParms} {...props} ref={ref} />;\n },\n);\n\nexport interface ImageProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src?: string;\n sizes?: string;\n fallbackWidth?: number;\n contentType?: string;\n imageLanguage?: string;\n crop?: ImageCrop;\n fallbackElement?: ReactNode;\n focalPoint?: ImageFocalPoint;\n variants?: ImageVariantDTO[];\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(\n (\n {\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n contentType,\n imageLanguage,\n fallbackWidth = FALLBACK_WIDTH,\n sizes: sizesProp,\n alt,\n fallbackElement,\n variants,\n ...props\n },\n ref,\n ) => {\n const [hasError, setHasError] = useState(false);\n\n useEffect(() => {\n setHasError(false);\n }, [src, srcSetProp, sizesProp, variants]);\n\n if (!src?.length && !variants?.length && fallbackElement) {\n return (\n <StyledFallbackElement {...props} ref={ref}>\n {fallbackElement}\n </StyledFallbackElement>\n );\n }\n\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const fallbackSrc = src && queryString ? `${src}?${queryString}` : src;\n\n return (\n <picture>\n {!!variants?.length && !crop && !focalPoint && contentType !== \"image/gif\" && (\n <source\n type={\"image/webp\"}\n srcSet={getVariantSrcSet(variants)}\n sizes={sizesProp ?? getVariantSizes(variants)}\n />\n )}\n {contentType !== \"image/gif\" && (\n <source\n type={contentType}\n srcSet={getSrcSet({ src, crop, focalPoint, imageLanguage })}\n sizes={sizesProp ?? FALLBACK_SIZES}\n />\n )}\n <StyledImage\n alt={alt}\n src={contentType === \"image/gif\" ? src : fallbackSrc}\n {...props}\n ref={ref}\n data-error={hasError ? \"\" : undefined}\n onError={(e) => {\n setHasError(true);\n props.onError?.(e);\n }}\n onLoad={(e) => {\n setHasError(false);\n props.onLoad?.(e);\n }}\n />\n </picture>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAa,sBAAsB,EAAE,OAAO,MAAM,YAAY,oBAA2C;CACvG,MAAM,SAAS,EAAE;AACjB,KAAI,MACF,QAAO,KAAK,SAAS,QAAQ;AAE/B,KAAI,KACF,QAAO,KAAK,cAAc,KAAK,OAAO,YAAY,KAAK,KAAK,cAAc,KAAK,OAAO,YAAY,KAAK,OAAO;AAEhH,KAAI,WACF,QAAO,KAAK,UAAU,WAAW,EAAE,UAAU,WAAW,IAAI;AAE9D,KAAI,cACF,QAAO,KAAK,YAAY,gBAAgB;AAE1C,QAAO,OAAO,KAAK,IAAI;;AAUzB,MAAa,aAA+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AAe,CAAC;GAC3D,OAAO,aAAa;IACpB;EAEJ,oBAAC;GACM;GACL,KAAK,gBAAgB,cAAc,MAAM;GACzC,GAAI;GACC;GACL,cAAY,WAAW,KAAK;GAC5B,UAAU,MAAM;AACd,gBAAY,KAAK;AACjB,UAAM,UAAU,EAAE;;GAEpB,SAAS,MAAM;AACb,gBAAY,MAAM;AAClB,UAAM,SAAS,EAAE;;IAEnB;KACM;EAGf"}
1
+ {"version":3,"file":"Image.mjs","names":[],"sources":["../src/Image.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 { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { ImageVariantDTO, ImageVariantSize } from \"@ndla/types-backend/image-api\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef, useEffect, useState } from \"react\";\n\nexport interface ImageCrop {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}\n\nexport interface ImageFocalPoint {\n x: number;\n y: number;\n}\n\ninterface SrcQueryStringOptions {\n width?: number;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const makeSrcQueryString = ({ width, crop, focalPoint, imageLanguage }: SrcQueryStringOptions) => {\n const params = [];\n if (width) {\n params.push(`width=${width}`);\n }\n if (crop) {\n params.push(`cropStartX=${crop.startX}&cropEndX=${crop.endX}&cropStartY=${crop.startY}&cropEndY=${crop.endY}`);\n }\n if (focalPoint) {\n params.push(`focalX=${focalPoint.x}&focalY=${focalPoint.y}`);\n }\n if (imageLanguage) {\n params.push(`language=${imageLanguage}`);\n }\n return params.join(\"&\");\n};\n\ninterface SrcSetOptions {\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n src?: string;\n}\n\nexport const VAR_WIDTHS: Record<ImageVariantSize, number> = {\n icon: 240,\n xsmall: 480,\n small: 800,\n medium: 1080,\n large: 1440,\n xlarge: 1920,\n xxlarge: 2560,\n};\n\nconst IMAGE_WIDTHS = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];\n\nexport const getVariantSrcSet = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant) => {\n return `${variant.variantUrl} ${VAR_WIDTHS[variant.size]}w`;\n })\n .join(\", \");\n};\n\nexport const getVariantSizes = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant, i) => {\n if (i === variants.length - 1) {\n return `${VAR_WIDTHS[variant.size]}px`;\n }\n return `(max-width: ${VAR_WIDTHS[variant.size]}px) ${VAR_WIDTHS[variant.size]}px`;\n })\n .join(\", \");\n};\n\nexport const getSrcSet = ({ src, crop, focalPoint, imageLanguage }: SrcSetOptions) => {\n if (!src) return undefined;\n return IMAGE_WIDTHS.map((width) => {\n const queryString = makeSrcQueryString({ width, crop, focalPoint, imageLanguage });\n const query = queryString.length ? `?${queryString}` : \"\";\n return `${src}${query} ${width}w`;\n }).join(\", \");\n};\n\nconst FALLBACK_WIDTH = 1024;\n\nconst FALLBACK_SIZES = \"(min-width: 1024px) 1024px, 100vw\";\n\nexport interface PictureProps extends StyledProps, ComponentPropsWithRef<\"picture\"> {\n src: string;\n sizes?: string;\n contentType?: string;\n srcSet?: string;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const Picture = forwardRef<HTMLPictureElement, PictureProps>(\n (\n {\n children,\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n imageLanguage,\n contentType,\n sizes = FALLBACK_SIZES,\n ...props\n },\n ref,\n ) => {\n const srcSet = srcSetProp ?? getSrcSet({ src, crop, focalPoint, imageLanguage });\n\n return (\n <styled.picture {...props} ref={ref}>\n {contentType !== \"image/gif\" && <source type={contentType} srcSet={srcSet} sizes={sizes} />}\n {children}\n </styled.picture>\n );\n },\n);\n\nconst StyledImage = styled(\"img\", {\n defaultVariants: { variant: \"regular\" },\n variants: {\n variant: {\n regular: {},\n rounded: {\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\nconst StyledFallbackElement = styled(\n ark.div,\n {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n { baseComponent: true },\n);\n\ntype ImageVariantProps = StyledVariantProps<typeof StyledImage>;\n\nexport interface ImgProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src: string;\n fallbackWidth?: number;\n contentType?: string;\n crop?: ImageCrop;\n imageLanguage?: string;\n focalPoint?: ImageFocalPoint;\n}\n\nexport const Img = forwardRef<HTMLImageElement, ImgProps>(\n ({ fallbackWidth = FALLBACK_WIDTH, crop, focalPoint, imageLanguage, contentType, src, alt, ...props }, ref) => {\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const srcWithParms = queryString ? `${src}?${queryString}` : src;\n return <StyledImage alt={alt} src={contentType === \"image/gif\" ? src : srcWithParms} {...props} ref={ref} />;\n },\n);\n\nexport interface ImageProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src?: string;\n sizes?: string;\n fallbackWidth?: number;\n contentType?: string;\n imageLanguage?: string;\n crop?: ImageCrop;\n fallbackElement?: ReactNode;\n focalPoint?: ImageFocalPoint;\n variants?: ImageVariantDTO[];\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(\n (\n {\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n contentType,\n imageLanguage,\n fallbackWidth = FALLBACK_WIDTH,\n sizes: sizesProp,\n alt,\n fallbackElement,\n variants,\n ...props\n },\n ref,\n ) => {\n const [hasError, setHasError] = useState(false);\n\n useEffect(() => {\n setHasError(false);\n }, [src, srcSetProp, sizesProp, variants]);\n\n if (!src?.length && !variants?.length && fallbackElement) {\n return (\n <StyledFallbackElement {...props} ref={ref}>\n {fallbackElement}\n </StyledFallbackElement>\n );\n }\n\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const fallbackSrc = src && queryString ? `${src}?${queryString}` : src;\n\n return (\n <picture>\n {!!variants?.length && !crop && !focalPoint && contentType !== \"image/gif\" && (\n <source\n type={\"image/webp\"}\n srcSet={getVariantSrcSet(variants)}\n sizes={sizesProp ?? getVariantSizes(variants)}\n />\n )}\n {contentType !== \"image/gif\" && (\n <source\n type={contentType}\n srcSet={getSrcSet({ src, crop, focalPoint, imageLanguage })}\n sizes={sizesProp ?? FALLBACK_SIZES}\n />\n )}\n <StyledImage\n alt={alt}\n src={contentType === \"image/gif\" ? src : fallbackSrc}\n {...props}\n ref={ref}\n data-error={hasError ? \"\" : undefined}\n onError={(e) => {\n setHasError(true);\n props.onError?.(e);\n }}\n onLoad={(e) => {\n setHasError(false);\n props.onLoad?.(e);\n }}\n />\n </picture>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;AAiCA,MAAa,sBAAsB,EAAE,OAAO,MAAM,YAAY,oBAA2C;CACvG,MAAM,SAAS,EAAE;AACjB,KAAI,MACF,QAAO,KAAK,SAAS,QAAQ;AAE/B,KAAI,KACF,QAAO,KAAK,cAAc,KAAK,OAAO,YAAY,KAAK,KAAK,cAAc,KAAK,OAAO,YAAY,KAAK,OAAO;AAEhH,KAAI,WACF,QAAO,KAAK,UAAU,WAAW,EAAE,UAAU,WAAW,IAAI;AAE9D,KAAI,cACF,QAAO,KAAK,YAAY,gBAAgB;AAE1C,QAAO,OAAO,KAAK,IAAI;;AAUzB,MAAa,aAA+C;CAC1D,MAAM;CACN,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,SAAS;CACV;AAED,MAAM,eAAe;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAI;AAE5F,MAAa,oBAAoB,aAAgC;AAC/D,QAAO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KAAA;GAC5B,UAAU,MAAM;AACd,gBAAY,KAAK;AACjB,UAAM,UAAU,EAAE;;GAEpB,SAAS,MAAM;AACb,gBAAY,MAAM;AAClB,UAAM,SAAS,EAAE;;GAEnB,CAAA;EACM,EAAA,CAAA;EAGf"}
package/es/Input.mjs CHANGED
@@ -4,7 +4,6 @@ import { styled } from "@ndla/styled-system/jsx";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from "react";
6
6
  import { composeRefs } from "@ndla/util";
7
-
8
7
  //#region src/Input.tsx
9
8
  /**
10
9
  * Copyright (c) 2024-present, NDLA.
@@ -135,7 +134,7 @@ const FieldTextArea = forwardRef((props, ref) => /* @__PURE__ */ jsx(Field.Texta
135
134
  ref,
136
135
  children: /* @__PURE__ */ jsx(TextArea, {})
137
136
  }));
138
-
139
137
  //#endregion
140
138
  export { FieldInput, FieldTextArea, Input, InputContainer, TextArea };
139
+
141
140
  //# sourceMappingURL=Input.mjs.map
package/es/Input.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Input.mjs","names":[],"sources":["../src/Input.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 { Field, type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { composeRefs } from \"@ndla/util\";\nimport { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from \"react\";\n\ninterface InputContextType {}\n\nconst InputContext = createContext<InputContextType | undefined>(undefined);\n\nconst inputCss = css.raw({\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"background.default\",\n borderRadius: \"xsmall\",\n _ariaInvalid: {\n boxShadowColor: \"stroke.error\",\n _hover: {\n boxShadowColor: \"stroke.error\",\n },\n _focusWithin: {\n boxShadowColor: \"stroke.error\",\n _hover: {\n boxShadowColor: \"stroke.error\",\n },\n },\n },\n _hover: {\n boxShadowColor: \"stroke.hover\",\n },\n _focusWithin: {\n boxShadow: \"inset 0 0 0 2px var(--shadow-color)\",\n boxShadowColor: \"stroke.default\",\n _hover: {\n boxShadowColor: \"stroke.default\",\n },\n },\n \"&:disabled, &:has(:disabled)\": {\n boxShadowColor: \"stroke.subtle\",\n _hover: {\n boxShadowColor: \"stroke.subtle\",\n },\n },\n});\n\nconst StyledInputContainer = styled(\n ark.div,\n {\n base: {\n width: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n \"& svg\": {\n width: \"medium\",\n height: \"medium\",\n },\n \"&:not(:has(input:first-child,textarea:first-child))\": {\n paddingInlineStart: \"xsmall\",\n },\n \"&:not(:has(input:last-child,textarea:last-child))\": {\n paddingInlineEnd: \"xsmall\",\n },\n },\n },\n { baseComponent: true },\n);\n\ninterface InputContainerProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const InputContainer = forwardRef<HTMLDivElement, InputContainerProps>(\n ({ children, css: cssProp, ...rest }, ref) => (\n <InputContext.Provider value={{}}>\n <StyledInputContainer css={css.raw(inputCss, cssProp)} {...rest} ref={ref}>\n {children}\n </StyledInputContainer>\n </InputContext.Provider>\n ),\n);\n\nconst baseInputCss = css.raw({\n width: \"100%\",\n color: \"text.default\",\n outline: \"none\",\n background: \"none\",\n border: \"0\",\n _disabled: {\n cursor: \"not-allowed\",\n },\n // Chrome messes with input styling when autofilling. Having a really long transitions cancels this out.\n _autofill: {\n transition: \"background-color 600000s 0s, color 600000s 0s\",\n },\n _focus: {\n appearance: \"none\",\n },\n _placeholder: {\n color: \"text.subtle\",\n },\n});\n\nconst baseTextAreaCss = css.raw({\n padding: \"xsmall\",\n minHeight: \"xxlarge\",\n height: \"xxlarge\",\n resize: \"none\",\n overflowY: \"hidden\",\n});\n\nconst StyledInput = styled(ark.input, {}, { baseComponent: true });\n\nconst inputRecipe = cva({\n defaultVariants: {\n componentSize: \"medium\",\n },\n variants: {\n componentSize: {\n small: {\n paddingBlock: \"4xsmall\",\n paddingInline: \"xsmall\",\n },\n medium: {\n minHeight: \"xxlarge\",\n padding: \"xsmall\",\n },\n },\n },\n});\n\ntype InputVariantProps = NonNullable<RecipeVariantProps<typeof inputRecipe>>;\n\nexport interface InputProps extends HTMLArkProps<\"input\">, StyledProps, InputVariantProps {}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(({ css: cssProp, componentSize, ...props }, ref) => {\n const context = useContext(InputContext);\n return (\n <StyledInput\n css={css.raw(inputRecipe.raw({ componentSize }), baseInputCss, context ? undefined : inputCss, cssProp)}\n ref={ref}\n {...props}\n />\n );\n});\n\nexport const FieldInput = forwardRef<HTMLInputElement, InputProps>((props, ref) => (\n <Field.Input asChild {...props} ref={ref}>\n <Input />\n </Field.Input>\n));\n\ninterface TextAreaProps extends HTMLArkProps<\"textarea\">, StyledProps {\n autoResize?: boolean;\n}\n\nconst StyledTextArea = styled(ark.textarea, {}, { baseComponent: true });\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ css: cssProp, autoResize = true, ...props }, ref) => {\n const context = useContext(InputContext);\n const localRef = useRef<HTMLTextAreaElement>(null);\n\n // Automatically resize a textarea based on its content\n const resize = useCallback(() => {\n if (!localRef.current) return;\n localRef.current.style.height = \"0\";\n // TODO: Figure out if we need to add the 3 extra pixels, maybe related to scroll?\n localRef.current.style.height = `${localRef.current.scrollHeight + 3}px`;\n }, []);\n\n useEffect(() => {\n if (!autoResize) return;\n window.addEventListener(\"input\", resize);\n window.addEventListener(\"resize\", resize);\n resize();\n return () => {\n window.removeEventListener(\"input\", resize);\n window.removeEventListener(\"resize\", resize);\n };\n }, [resize, autoResize]);\n\n return (\n <StyledTextArea\n css={css.raw(baseInputCss, context ? undefined : inputCss, baseTextAreaCss, cssProp)}\n ref={composeRefs(ref, localRef)}\n {...props}\n />\n );\n },\n);\n\nexport const FieldTextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => (\n <Field.Textarea asChild {...props} ref={ref}>\n <TextArea />\n </Field.Textarea>\n));\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,eAAe,cAA4C,OAAU;AAE3E,MAAM,WAAW,IAAI,IAAI;CACvB,gBAAgB;CAChB,WAAW;CACX,YAAY;CACZ,cAAc;CACd,cAAc;EACZ,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,gBACjB;EACD,cAAc;GACZ,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,gBACjB;GACF;EACF;CACD,QAAQ,EACN,gBAAgB,gBACjB;CACD,cAAc;EACZ,WAAW;EACX,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,kBACjB;EACF;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,iBACjB;EACF;CACF,CAAC;AAEF,MAAM,uBAAuB,OAC3B,IAAI,KACJ,EACE,MAAM;CACJ,OAAO;CACP,SAAS;CACT,YAAY;CACZ,SAAS;EACP,OAAO;EACP,QAAQ;EACT;CACD,uDAAuD,EACrD,oBAAoB,UACrB;CACD,qDAAqD,EACnD,kBAAkB,UACnB;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,iBAAiB,YAC3B,EAAE,UAAU,KAAK,SAAS,GAAG,QAAQ,QACpC,oBAAC,aAAa;CAAS,OAAO,EAAE;WAC9B,oBAAC;EAAqB,KAAK,IAAI,IAAI,UAAU,QAAQ;EAAE,GAAI;EAAW;EACnE;GACoB;EACD,CAE3B;AAED,MAAM,eAAe,IAAI,IAAI;CAC3B,OAAO;CACP,OAAO;CACP,SAAS;CACT,YAAY;CACZ,QAAQ;CACR,WAAW,EACT,QAAQ,eACT;CAED,WAAW,EACT,YAAY,iDACb;CACD,QAAQ,EACN,YAAY,QACb;CACD,cAAc,EACZ,OAAO,eACR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,SAAS,OAAO;AAC3C,UAAO,oBAAoB,UAAU,OAAO;;IAE7C,CAAC,QAAQ,WAAW,CAAC;AAExB,QACE,oBAAC;EACC,KAAK,IAAI,IAAI,cAAc,UAAU,SAAY,UAAU,iBAAiB,QAAQ;EACpF,KAAK,YAAY,KAAK,SAAS;EAC/B,GAAI;GACJ;EAGP;AAED,MAAa,gBAAgB,YAAgD,OAAO,QAClF,oBAAC,MAAM;CAAS;CAAQ,GAAI;CAAY;WACtC,oBAAC,aAAW;EACG,CACjB"}
1
+ {"version":3,"file":"Input.mjs","names":[],"sources":["../src/Input.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 { Field, type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { composeRefs } from \"@ndla/util\";\nimport { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from \"react\";\n\ninterface InputContextType {}\n\nconst InputContext = createContext<InputContextType | undefined>(undefined);\n\nconst inputCss = css.raw({\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"background.default\",\n borderRadius: \"xsmall\",\n _ariaInvalid: {\n boxShadowColor: \"stroke.error\",\n _hover: {\n boxShadowColor: \"stroke.error\",\n },\n _focusWithin: {\n boxShadowColor: \"stroke.error\",\n _hover: {\n boxShadowColor: \"stroke.error\",\n },\n },\n },\n _hover: {\n boxShadowColor: \"stroke.hover\",\n },\n _focusWithin: {\n boxShadow: \"inset 0 0 0 2px var(--shadow-color)\",\n boxShadowColor: \"stroke.default\",\n _hover: {\n boxShadowColor: \"stroke.default\",\n },\n },\n \"&:disabled, &:has(:disabled)\": {\n boxShadowColor: \"stroke.subtle\",\n _hover: {\n boxShadowColor: \"stroke.subtle\",\n },\n },\n});\n\nconst StyledInputContainer = styled(\n ark.div,\n {\n base: {\n width: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n \"& svg\": {\n width: \"medium\",\n height: \"medium\",\n },\n \"&:not(:has(input:first-child,textarea:first-child))\": {\n paddingInlineStart: \"xsmall\",\n },\n \"&:not(:has(input:last-child,textarea:last-child))\": {\n paddingInlineEnd: \"xsmall\",\n },\n },\n },\n { baseComponent: true },\n);\n\ninterface InputContainerProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const InputContainer = forwardRef<HTMLDivElement, InputContainerProps>(\n ({ children, css: cssProp, ...rest }, ref) => (\n <InputContext.Provider value={{}}>\n <StyledInputContainer css={css.raw(inputCss, cssProp)} {...rest} ref={ref}>\n {children}\n </StyledInputContainer>\n </InputContext.Provider>\n ),\n);\n\nconst baseInputCss = css.raw({\n width: \"100%\",\n color: \"text.default\",\n outline: \"none\",\n background: \"none\",\n border: \"0\",\n _disabled: {\n cursor: \"not-allowed\",\n },\n // Chrome messes with input styling when autofilling. Having a really long transitions cancels this out.\n _autofill: {\n transition: \"background-color 600000s 0s, color 600000s 0s\",\n },\n _focus: {\n appearance: \"none\",\n },\n _placeholder: {\n color: \"text.subtle\",\n },\n});\n\nconst baseTextAreaCss = css.raw({\n padding: \"xsmall\",\n minHeight: \"xxlarge\",\n height: \"xxlarge\",\n resize: \"none\",\n overflowY: \"hidden\",\n});\n\nconst StyledInput = styled(ark.input, {}, { baseComponent: true });\n\nconst inputRecipe = cva({\n defaultVariants: {\n componentSize: \"medium\",\n },\n variants: {\n componentSize: {\n small: {\n paddingBlock: \"4xsmall\",\n paddingInline: \"xsmall\",\n },\n medium: {\n minHeight: \"xxlarge\",\n padding: \"xsmall\",\n },\n },\n },\n});\n\ntype InputVariantProps = NonNullable<RecipeVariantProps<typeof inputRecipe>>;\n\nexport interface InputProps extends HTMLArkProps<\"input\">, StyledProps, InputVariantProps {}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(({ css: cssProp, componentSize, ...props }, ref) => {\n const context = useContext(InputContext);\n return (\n <StyledInput\n css={css.raw(inputRecipe.raw({ componentSize }), baseInputCss, context ? undefined : inputCss, cssProp)}\n ref={ref}\n {...props}\n />\n );\n});\n\nexport const FieldInput = forwardRef<HTMLInputElement, InputProps>((props, ref) => (\n <Field.Input asChild {...props} ref={ref}>\n <Input />\n </Field.Input>\n));\n\ninterface TextAreaProps extends HTMLArkProps<\"textarea\">, StyledProps {\n autoResize?: boolean;\n}\n\nconst StyledTextArea = styled(ark.textarea, {}, { baseComponent: true });\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ css: cssProp, autoResize = true, ...props }, ref) => {\n const context = useContext(InputContext);\n const localRef = useRef<HTMLTextAreaElement>(null);\n\n // Automatically resize a textarea based on its content\n const resize = useCallback(() => {\n if (!localRef.current) return;\n localRef.current.style.height = \"0\";\n // TODO: Figure out if we need to add the 3 extra pixels, maybe related to scroll?\n localRef.current.style.height = `${localRef.current.scrollHeight + 3}px`;\n }, []);\n\n useEffect(() => {\n if (!autoResize) return;\n window.addEventListener(\"input\", resize);\n window.addEventListener(\"resize\", resize);\n resize();\n return () => {\n window.removeEventListener(\"input\", resize);\n window.removeEventListener(\"resize\", resize);\n };\n }, [resize, autoResize]);\n\n return (\n <StyledTextArea\n css={css.raw(baseInputCss, context ? undefined : inputCss, baseTextAreaCss, cssProp)}\n ref={composeRefs(ref, localRef)}\n {...props}\n />\n );\n },\n);\n\nexport const FieldTextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => (\n <Field.Textarea asChild {...props} ref={ref}>\n <TextArea />\n </Field.Textarea>\n));\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,eAAe,cAA4C,KAAA,EAAU;AAE3E,MAAM,WAAW,IAAI,IAAI;CACvB,gBAAgB;CAChB,WAAW;CACX,YAAY;CACZ,cAAc;CACd,cAAc;EACZ,gBAAgB;EAChB,QAAQ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gD,OAAO,QAClF,oBAAC,MAAM,UAAP;CAAgB,SAAA;CAAQ,GAAI;CAAY;WACtC,oBAAC,UAAD,EAAY,CAAA;CACG,CAAA,CACjB"}
package/es/Label.mjs CHANGED
@@ -3,7 +3,6 @@ import { css } from "@ndla/styled-system/css";
3
3
  import { styled } from "@ndla/styled-system/jsx";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { forwardRef } from "react";
6
-
7
6
  //#region src/Label.tsx
8
7
  /**
9
8
  * Copyright (c) 2024-present, NDLA.
@@ -53,7 +52,7 @@ const FieldLabel = forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ j
53
52
  ref,
54
53
  children: /* @__PURE__ */ jsx(Label, { children })
55
54
  }));
56
-
57
55
  //#endregion
58
56
  export { FieldLabel, FieldsetLegend, Label, Legend };
57
+
59
58
  //# sourceMappingURL=Label.mjs.map
package/es/Label.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Label.mjs","names":[],"sources":["../src/Label.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 { Field, Fieldset, type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { type TextProps } from \"./Text\";\n\nconst StyledLegend = styled(\n ark.legend,\n {\n base: {\n float: \"left\",\n width: \"inherit\",\n _disabled: {\n color: \"text.subtle\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport interface LegendProps extends Omit<HTMLArkProps<\"legend\">, \"color\">, StyledProps, TextProps {}\n\nexport const Legend = forwardRef<HTMLLegendElement, LegendProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", css: cssProp, srOnly, color, ...rest }, ref) => (\n <StyledLegend css={css.raw({ textStyle, fontWeight, srOnly, color }, cssProp)} {...rest} ref={ref} />\n ),\n);\n\nexport interface FieldsetLegendProps extends Omit<Fieldset.LegendProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, LegendProps>(({ children, ...props }, ref) => (\n <Fieldset.Legend asChild {...props} ref={ref}>\n <Legend>{children}</Legend>\n </Fieldset.Legend>\n));\n\nconst StyledLabel = styled(\n ark.label,\n {\n base: {\n display: \"inline-block\",\n _disabled: {\n color: \"text.subtle\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport interface LabelProps extends Omit<HTMLArkProps<\"label\">, \"color\">, TextProps, StyledProps {}\n\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", css: cssProp, srOnly, color, ...rest }, ref) => (\n <StyledLabel css={css.raw({ textStyle, fontWeight, srOnly, color }, cssProp)} {...rest} ref={ref} />\n ),\n);\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, LabelProps>(({ children, ...props }, ref) => (\n <Field.Label asChild {...props} ref={ref}>\n <Label>{children}</Label>\n </Field.Label>\n));\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,eAAe,OACnB,IAAI,QACJ,EACE,MAAM;CACJ,OAAO;CACP,OAAO;CACP,WAAW,EACT,OAAO,eACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,SAAS,YACnB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,oBAAC;CAAa,KAAK,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;EAAO,EAAE,QAAQ;CAAE,GAAI;CAAW;EAAO,CAExG;AAID,MAAa,iBAAiB,YAA4C,EAAE,UAAU,GAAG,SAAS,QAChG,oBAAC,SAAS;CAAO;CAAQ,GAAI;CAAY;WACvC,oBAAC,UAAQ,WAAkB;EACX,CAClB;AAEF,MAAM,cAAc,OAClB,IAAI,OACJ,EACE,MAAM;CACJ,SAAS;CACT,WAAW,EACT,OAAO,eACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,QAAQ,YAClB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,oBAAC;CAAY,KAAK,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;EAAO,EAAE,QAAQ;CAAE,GAAI;CAAW;EAAO,CAEvG;AAED,MAAa,aAAa,YAA0C,EAAE,UAAU,GAAG,SAAS,QAC1F,oBAAC,MAAM;CAAM;CAAQ,GAAI;CAAY;WACnC,oBAAC,SAAO,WAAiB;EACb,CACd"}
1
+ {"version":3,"file":"Label.mjs","names":[],"sources":["../src/Label.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 { Field, Fieldset, type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { type TextProps } from \"./Text\";\n\nconst StyledLegend = styled(\n ark.legend,\n {\n base: {\n float: \"left\",\n width: \"inherit\",\n _disabled: {\n color: \"text.subtle\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport interface LegendProps extends Omit<HTMLArkProps<\"legend\">, \"color\">, StyledProps, TextProps {}\n\nexport const Legend = forwardRef<HTMLLegendElement, LegendProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", css: cssProp, srOnly, color, ...rest }, ref) => (\n <StyledLegend css={css.raw({ textStyle, fontWeight, srOnly, color }, cssProp)} {...rest} ref={ref} />\n ),\n);\n\nexport interface FieldsetLegendProps extends Omit<Fieldset.LegendProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, LegendProps>(({ children, ...props }, ref) => (\n <Fieldset.Legend asChild {...props} ref={ref}>\n <Legend>{children}</Legend>\n </Fieldset.Legend>\n));\n\nconst StyledLabel = styled(\n ark.label,\n {\n base: {\n display: \"inline-block\",\n _disabled: {\n color: \"text.subtle\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport interface LabelProps extends Omit<HTMLArkProps<\"label\">, \"color\">, TextProps, StyledProps {}\n\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", css: cssProp, srOnly, color, ...rest }, ref) => (\n <StyledLabel css={css.raw({ textStyle, fontWeight, srOnly, color }, cssProp)} {...rest} ref={ref} />\n ),\n);\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, LabelProps>(({ children, ...props }, ref) => (\n <Field.Label asChild {...props} ref={ref}>\n <Label>{children}</Label>\n </Field.Label>\n));\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,eAAe,OACnB,IAAI,QACJ,EACE,MAAM;CACJ,OAAO;CACP,OAAO;CACP,WAAW,EACT,OAAO,eACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,SAAS,YACnB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,oBAAC,cAAD;CAAc,KAAK,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;EAAO,EAAE,QAAQ;CAAE,GAAI;CAAW;CAAO,CAAA,CAExG;AAID,MAAa,iBAAiB,YAA4C,EAAE,UAAU,GAAG,SAAS,QAChG,oBAAC,SAAS,QAAV;CAAiB,SAAA;CAAQ,GAAI;CAAY;WACvC,oBAAC,QAAD,EAAS,UAAkB,CAAA;CACX,CAAA,CAClB;AAEF,MAAM,cAAc,OAClB,IAAI,OACJ,EACE,MAAM;CACJ,SAAS;CACT,WAAW,EACT,OAAO,eACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,QAAQ,YAClB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,oBAAC,aAAD;CAAa,KAAK,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;EAAO,EAAE,QAAQ;CAAE,GAAI;CAAW;CAAO,CAAA,CAEvG;AAED,MAAa,aAAa,YAA0C,EAAE,UAAU,GAAG,SAAS,QAC1F,oBAAC,MAAM,OAAP;CAAa,SAAA;CAAQ,GAAI;CAAY;WACnC,oBAAC,OAAD,EAAQ,UAAiB,CAAA;CACb,CAAA,CACd"}
@@ -3,7 +3,6 @@ import "@ark-ui/react";
3
3
  import { css, cva } from "@ndla/styled-system/css";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { forwardRef } from "react";
6
-
7
6
  //#region src/Layout/PageContainer.tsx
8
7
  const pageContainerRecipe = cva({
9
8
  defaultVariants: { padding: "medium" },
@@ -28,7 +27,7 @@ const PageContainer = forwardRef(({ padding, css: cssProp, ...props }, ref) => /
28
27
  ...props,
29
28
  ref
30
29
  }));
31
-
32
30
  //#endregion
33
31
  export { PageContainer };
32
+
34
33
  //# sourceMappingURL=PageContainer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageContainer.mjs","names":[],"sources":["../../src/Layout/PageContainer.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 HTMLArkProps } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { PageContent, type PageContentVariantProps } from \"./PageContent\";\n\nconst pageContainerRecipe = cva({\n defaultVariants: {\n padding: \"medium\",\n },\n variants: {\n padding: {\n none: {},\n small: {\n paddingBlockStart: \"medium\",\n paddingBlockEnd: \"5xlarge\",\n },\n medium: {\n paddingBlockStart: \"xxlarge\",\n paddingBlockEnd: \"5xlarge\",\n },\n large: {\n paddingBlockStart: \"4xlarge\",\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n});\n\nexport type PageContainerVariantProps = NonNullable<RecipeVariantProps<typeof pageContainerRecipe>>;\n\nexport interface PageContainerProps\n extends HTMLArkProps<\"div\">, StyledProps, PageContentVariantProps, PageContainerVariantProps {}\n\nexport const PageContainer = forwardRef<HTMLDivElement, PageContainerProps>(\n ({ padding, css: cssProp, ...props }, ref) => (\n <PageContent css={css.raw(pageContainerRecipe.raw({ padding }), cssProp)} {...props} ref={ref} />\n ),\n);\n"],"mappings":";;;;;;;AAcA,MAAM,sBAAsB,IAAI;CAC9B,iBAAiB,EACf,SAAS,UACV;CACD,UAAU,EACR,SAAS;EACP,MAAM,EAAE;EACR,OAAO;GACL,mBAAmB;GACnB,iBAAiB;GAClB;EACD,QAAQ;GACN,mBAAmB;GACnB,iBAAiB;GAClB;EACD,OAAO;GACL,mBAAmB;GACnB,iBAAiB;GAClB;EACF,EACF;CACF,CAAC;AAOF,MAAa,gBAAgB,YAC1B,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QACpC,oBAAC;CAAY,KAAK,IAAI,IAAI,oBAAoB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;EAAO,CAEpG"}
1
+ {"version":3,"file":"PageContainer.mjs","names":[],"sources":["../../src/Layout/PageContainer.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 HTMLArkProps } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { PageContent, type PageContentVariantProps } from \"./PageContent\";\n\nconst pageContainerRecipe = cva({\n defaultVariants: {\n padding: \"medium\",\n },\n variants: {\n padding: {\n none: {},\n small: {\n paddingBlockStart: \"medium\",\n paddingBlockEnd: \"5xlarge\",\n },\n medium: {\n paddingBlockStart: \"xxlarge\",\n paddingBlockEnd: \"5xlarge\",\n },\n large: {\n paddingBlockStart: \"4xlarge\",\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n});\n\nexport type PageContainerVariantProps = NonNullable<RecipeVariantProps<typeof pageContainerRecipe>>;\n\nexport interface PageContainerProps\n extends HTMLArkProps<\"div\">, StyledProps, PageContentVariantProps, PageContainerVariantProps {}\n\nexport const PageContainer = forwardRef<HTMLDivElement, PageContainerProps>(\n ({ padding, css: cssProp, ...props }, ref) => (\n <PageContent css={css.raw(pageContainerRecipe.raw({ padding }), cssProp)} {...props} ref={ref} />\n ),\n);\n"],"mappings":";;;;;;AAcA,MAAM,sBAAsB,IAAI;CAC9B,iBAAiB,EACf,SAAS,UACV;CACD,UAAU,EACR,SAAS;EACP,MAAM,EAAE;EACR,OAAO;GACL,mBAAmB;GACnB,iBAAiB;GAClB;EACD,QAAQ;GACN,mBAAmB;GACnB,iBAAiB;GAClB;EACD,OAAO;GACL,mBAAmB;GACnB,iBAAiB;GAClB;EACF,EACF;CACF,CAAC;AAOF,MAAa,gBAAgB,YAC1B,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QACpC,oBAAC,aAAD;CAAa,KAAK,IAAI,IAAI,oBAAoB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;CAAO,CAAA,CAEpG"}
@@ -3,7 +3,6 @@ import { css, cva } from "@ndla/styled-system/css";
3
3
  import { styled } from "@ndla/styled-system/jsx";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { forwardRef } from "react";
6
-
7
6
  //#region src/Layout/PageContent.tsx
8
7
  /**
9
8
  * Copyright (c) 2024-present, NDLA.
@@ -68,7 +67,7 @@ const BleedPageContent = styled(ark.div, { base: { "& ": {
68
67
  gridColumnStart: "1",
69
68
  gridColumnEnd: "-1"
70
69
  } } }, { baseComponent: true });
71
-
72
70
  //#endregion
73
71
  export { BleedPageContent, PageContent };
72
+
74
73
  //# sourceMappingURL=PageContent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageContent.mjs","names":[],"sources":["../../src/Layout/PageContent.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst pageRecipe = cva({\n base: {\n display: \"grid\",\n transitionProperty: \"all\",\n transitionDuration: \"default\",\n transitionTimingFunction: \"default\",\n alignContent: \"start\",\n /**\n * var(--size) is the max width of the content\n * calc(100% - (var(--gutter, 0) * 2)) is the max width of the page, minus the gutters (inline padding without being actual padding).\n * In effect, this will center the content on the page, and constrain it to either the content width or the page width, whichever is smaller.\n */\n gridColumnGap: \"var(--gutter, 0)\",\n gridTemplateColumns: \"1fr min(var(--size), calc(100% - (var(--gutter, 0) * 2))) 1fr\",\n \"& > *\": {\n gridColumnStart: \"2\",\n gridColumnEnd: \"2\",\n },\n },\n defaultVariants: {\n variant: \"page\",\n gutters: \"always\",\n },\n variants: {\n variant: {\n content: {\n \"--size\": \"sizes.surface.contentMax\",\n },\n article: {\n \"--size\": \"sizes.surface.articleMax\",\n },\n page: {\n \"--size\": \"sizes.surface.pageMax\",\n },\n wide: {\n \"--size\": \"sizes.surface.wideMax\",\n },\n },\n gutters: {\n never: {\n \"--gutter\": \"0px\",\n },\n mobileUp: {\n \"--gutter\": \"0px\",\n mobileWide: {\n \"--gutter\": \"spacing.medium\",\n },\n },\n tabletUp: {\n \"--gutter\": \"0px\",\n tablet: {\n \"--gutter\": \"spacing.medium\",\n },\n },\n always: {\n \"--gutter\": \"spacing.small\",\n tablet: {\n \"--gutter\": \"spacing.medium\",\n },\n },\n },\n },\n});\n\nconst StyledPageContent = styled(ark.div, {}, { baseComponent: true });\n\nexport type PageContentVariantProps = NonNullable<RecipeVariantProps<typeof pageRecipe>>;\n\nexport interface PageContentProps extends HTMLArkProps<\"div\">, StyledProps, PageContentVariantProps {}\n\nexport const PageContent = forwardRef<HTMLDivElement, PageContentProps>(\n ({ variant, gutters, css: cssProp, ...props }, ref) => (\n <StyledPageContent css={css.raw(pageRecipe.raw({ variant, gutters }), cssProp)} ref={ref} {...props} />\n ),\n);\n\nexport const BleedPageContent = styled(\n ark.div,\n {\n base: {\n \"& \": {\n width: \"100%\",\n gridColumnStart: \"1\",\n gridColumnEnd: \"-1\",\n },\n },\n },\n { baseComponent: true },\n);\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,aAAa,IAAI;CACrB,MAAM;EACJ,SAAS;EACT,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EAMd,eAAe;EACf,qBAAqB;EACrB,SAAS;GACP,iBAAiB;GACjB,eAAe;GAChB;EACF;CACD,iBAAiB;EACf,SAAS;EACT,SAAS;EACV;CACD,UAAU;EACR,SAAS;GACP,SAAS,EACP,UAAU,4BACX;GACD,SAAS,EACP,UAAU,4BACX;GACD,MAAM,EACJ,UAAU,yBACX;GACD,MAAM,EACJ,UAAU,yBACX;GACF;EACD,SAAS;GACP,OAAO,EACL,YAAY,OACb;GACD,UAAU;IACR,YAAY;IACZ,YAAY,EACV,YAAY,kBACb;IACF;GACD,UAAU;IACR,YAAY;IACZ,QAAQ,EACN,YAAY,kBACb;IACF;GACD,QAAQ;IACN,YAAY;IACZ,QAAQ,EACN,YAAY,kBACb;IACF;GACF;EACF;CACF,CAAC;AAEF,MAAM,oBAAoB,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAMtE,MAAa,cAAc,YACxB,EAAE,SAAS,SAAS,KAAK,SAAS,GAAG,SAAS,QAC7C,oBAAC;CAAkB,KAAK,IAAI,IAAI,WAAW,IAAI;EAAE;EAAS;EAAS,CAAC,EAAE,QAAQ;CAAO;CAAK,GAAI;EAAS,CAE1G;AAED,MAAa,mBAAmB,OAC9B,IAAI,KACJ,EACE,MAAM,EACJ,MAAM;CACJ,OAAO;CACP,iBAAiB;CACjB,eAAe;CAChB,EACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB"}
1
+ {"version":3,"file":"PageContent.mjs","names":[],"sources":["../../src/Layout/PageContent.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst pageRecipe = cva({\n base: {\n display: \"grid\",\n transitionProperty: \"all\",\n transitionDuration: \"default\",\n transitionTimingFunction: \"default\",\n alignContent: \"start\",\n /**\n * var(--size) is the max width of the content\n * calc(100% - (var(--gutter, 0) * 2)) is the max width of the page, minus the gutters (inline padding without being actual padding).\n * In effect, this will center the content on the page, and constrain it to either the content width or the page width, whichever is smaller.\n */\n gridColumnGap: \"var(--gutter, 0)\",\n gridTemplateColumns: \"1fr min(var(--size), calc(100% - (var(--gutter, 0) * 2))) 1fr\",\n \"& > *\": {\n gridColumnStart: \"2\",\n gridColumnEnd: \"2\",\n },\n },\n defaultVariants: {\n variant: \"page\",\n gutters: \"always\",\n },\n variants: {\n variant: {\n content: {\n \"--size\": \"sizes.surface.contentMax\",\n },\n article: {\n \"--size\": \"sizes.surface.articleMax\",\n },\n page: {\n \"--size\": \"sizes.surface.pageMax\",\n },\n wide: {\n \"--size\": \"sizes.surface.wideMax\",\n },\n },\n gutters: {\n never: {\n \"--gutter\": \"0px\",\n },\n mobileUp: {\n \"--gutter\": \"0px\",\n mobileWide: {\n \"--gutter\": \"spacing.medium\",\n },\n },\n tabletUp: {\n \"--gutter\": \"0px\",\n tablet: {\n \"--gutter\": \"spacing.medium\",\n },\n },\n always: {\n \"--gutter\": \"spacing.small\",\n tablet: {\n \"--gutter\": \"spacing.medium\",\n },\n },\n },\n },\n});\n\nconst StyledPageContent = styled(ark.div, {}, { baseComponent: true });\n\nexport type PageContentVariantProps = NonNullable<RecipeVariantProps<typeof pageRecipe>>;\n\nexport interface PageContentProps extends HTMLArkProps<\"div\">, StyledProps, PageContentVariantProps {}\n\nexport const PageContent = forwardRef<HTMLDivElement, PageContentProps>(\n ({ variant, gutters, css: cssProp, ...props }, ref) => (\n <StyledPageContent css={css.raw(pageRecipe.raw({ variant, gutters }), cssProp)} ref={ref} {...props} />\n ),\n);\n\nexport const BleedPageContent = styled(\n ark.div,\n {\n base: {\n \"& \": {\n width: \"100%\",\n gridColumnStart: \"1\",\n gridColumnEnd: \"-1\",\n },\n },\n },\n { baseComponent: true },\n);\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,aAAa,IAAI;CACrB,MAAM;EACJ,SAAS;EACT,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EAMd,eAAe;EACf,qBAAqB;EACrB,SAAS;GACP,iBAAiB;GACjB,eAAe;GAChB;EACF;CACD,iBAAiB;EACf,SAAS;EACT,SAAS;EACV;CACD,UAAU;EACR,SAAS;GACP,SAAS,EACP,UAAU,4BACX;GACD,SAAS,EACP,UAAU,4BACX;GACD,MAAM,EACJ,UAAU,yBACX;GACD,MAAM,EACJ,UAAU,yBACX;GACF;EACD,SAAS;GACP,OAAO,EACL,YAAY,OACb;GACD,UAAU;IACR,YAAY;IACZ,YAAY,EACV,YAAY,kBACb;IACF;GACD,UAAU;IACR,YAAY;IACZ,QAAQ,EACN,YAAY,kBACb;IACF;GACD,QAAQ;IACN,YAAY;IACZ,QAAQ,EACN,YAAY,kBACb;IACF;GACF;EACF;CACF,CAAC;AAEF,MAAM,oBAAoB,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAMtE,MAAa,cAAc,YACxB,EAAE,SAAS,SAAS,KAAK,SAAS,GAAG,SAAS,QAC7C,oBAAC,mBAAD;CAAmB,KAAK,IAAI,IAAI,WAAW,IAAI;EAAE;EAAS;EAAS,CAAC,EAAE,QAAQ;CAAO;CAAK,GAAI;CAAS,CAAA,CAE1G;AAED,MAAa,mBAAmB,OAC9B,IAAI,KACJ,EACE,MAAM,EACJ,MAAM;CACJ,OAAO;CACP,iBAAiB;CACjB,eAAe;CAChB,EACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB"}
@@ -5,16 +5,7 @@ import { sva } from "@ndla/styled-system/css";
5
5
  import { createStyleContext } from "@ndla/styled-system/jsx";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { forwardRef } from "react";
8
-
9
- //#region src/ListItem/ListItem.tsx
10
- /**
11
- * Copyright (c) 2024-present, NDLA.
12
- *
13
- * This source code is licensed under the GPLv3 license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- *
16
- */
17
- const listItemRecipe = sva({
8
+ const { withProvider, withContext } = createStyleContext(sva({
18
9
  slots: [
19
10
  "root",
20
11
  "title",
@@ -76,16 +67,14 @@ const listItemRecipe = sva({
76
67
  _hover: { textDecoration: "none" }
77
68
  }
78
69
  } } }
79
- });
80
- const { withProvider, withContext } = createStyleContext(listItemRecipe);
70
+ }));
81
71
  const ListItemRoot = withProvider(ark.div, "root", { baseComponent: true });
82
- const InternalListItemHeading = forwardRef(({ textStyle = "label.medium", fontWeight = "bold", ...props }, ref) => /* @__PURE__ */ jsx(Heading, {
72
+ const ListItemHeading = withContext(forwardRef(({ textStyle = "label.medium", fontWeight = "bold", ...props }, ref) => /* @__PURE__ */ jsx(Heading, {
83
73
  textStyle,
84
74
  fontWeight,
85
75
  ...props,
86
76
  ref
87
- }));
88
- const ListItemHeading = withContext(InternalListItemHeading, "title");
77
+ })), "title");
89
78
  const ListItemContent = withContext(ark.div, "content", { baseComponent: true });
90
79
  const InternalListItemImage = withContext(Image, "image");
91
80
  const ListItemImage = forwardRef(({ variant = "rounded", ...props }, ref) => /* @__PURE__ */ jsx(InternalListItemImage, {
@@ -93,7 +82,7 @@ const ListItemImage = forwardRef(({ variant = "rounded", ...props }, ref) => /*
93
82
  ...props,
94
83
  ref
95
84
  }));
96
-
97
85
  //#endregion
98
86
  export { ListItemContent, ListItemHeading, ListItemImage, ListItemRoot };
87
+
99
88
  //# sourceMappingURL=ListItem.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.mjs","names":[],"sources":["../../src/ListItem/ListItem.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { Image, type ImageProps } from \"../Image\";\nimport { Heading, type TextProps } from \"../Text\";\n\nexport const listItemRecipe = sva({\n slots: [\"root\", \"title\", \"content\", \"image\"],\n base: {\n root: {\n minHeight: \"3xlarge\",\n borderStyle: \"solid\",\n borderWidth: \"1px\",\n borderColor: \"stroke.subtle\",\n backgroundColor: \"background.default\",\n color: \"text.default\",\n position: \"relative\",\n display: \"flex\",\n gap: \"small\",\n alignItems: \"center\",\n paddingBlock: \"xsmall\",\n paddingInline: \"xxsmall\",\n transitionProperty: \"background-color, border-color, color\",\n transitionDuration: \"superFast\",\n transitionTimingFunction: \"ease-in-out\",\n boxShadow: \"xsmall\",\n },\n content: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"xsmall\",\n width: \"100%\",\n },\n image: {\n minHeight: \"50px\",\n maxHeight: \"50px\",\n minWidth: \"70px\",\n maxWidth: \"70px\",\n objectFit: \"cover\",\n },\n },\n defaultVariants: {\n nonInteractive: false,\n },\n variants: {\n nonInteractive: {\n false: {\n root: {\n _highlighted: {\n borderColor: \"stroke.hover\",\n backgroundColor: \"surface.hover\",\n },\n _hover: {\n borderColor: \"stroke.hover\",\n backgroundColor: \"surface.hover\",\n },\n _active: {\n borderColor: \"stroke.hover\",\n backgroundColor: \"surface.active\",\n },\n },\n title: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(listItemRecipe);\n\nexport type ListItemVariantProps = NonNullable<RecipeVariantProps<typeof listItemRecipe>>;\n\nexport interface ListItemProps extends HTMLArkProps<\"div\">, StyledProps, ListItemVariantProps {}\n\nexport const ListItemRoot = withProvider(ark.div, \"root\", { baseComponent: true });\n\ninterface ListItemHeadingProps extends Omit<HTMLArkProps<\"p\">, \"color\">, TextProps {}\n\nconst InternalListItemHeading = forwardRef<HTMLHeadingElement, ListItemHeadingProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", ...props }, ref) => (\n <Heading textStyle={textStyle} fontWeight={fontWeight} {...props} ref={ref} />\n ),\n);\n\nexport const ListItemHeading = withContext(InternalListItemHeading, \"title\");\n\nexport const ListItemContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nconst InternalListItemImage = withContext(Image, \"image\");\n\nexport const ListItemImage = forwardRef<HTMLImageElement, ImageProps>(({ variant = \"rounded\", ...props }, ref) => (\n <InternalListItemImage variant={variant} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,iBAAiB,IAAI;CAChC,OAAO;EAAC;EAAQ;EAAS;EAAW;EAAQ;CAC5C,MAAM;EACJ,MAAM;GACJ,WAAW;GACX,aAAa;GACb,aAAa;GACb,aAAa;GACb,iBAAiB;GACjB,OAAO;GACP,UAAU;GACV,SAAS;GACT,KAAK;GACL,YAAY;GACZ,cAAc;GACd,eAAe;GACf,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,WAAW;GACZ;EACD,SAAS;GACP,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,KAAK;GACL,OAAO;GACR;EACD,OAAO;GACL,WAAW;GACX,WAAW;GACX,UAAU;GACV,UAAU;GACV,WAAW;GACZ;EACF;CACD,iBAAiB,EACf,gBAAgB,OACjB;CACD,UAAU,EACR,gBAAgB,EACd,OAAO;EACL,MAAM;GACJ,cAAc;IACZ,aAAa;IACb,iBAAiB;IAClB;GACD,QAAQ;IACN,aAAa;IACb,iBAAiB;IAClB;GACD,SAAS;IACP,aAAa;IACb,iBAAiB;IAClB;GACF;EACD,OAAO;GACL,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,QACjB;GACF;EACF,EACF,EACF;CACF,CAAC;AAEF,MAAM,EAAE,cAAc,gBAAgB,mBAAmB,eAAe;AAMxE,MAAa,eAAe,aAAa,IAAI,KAAK,QAAQ,EAAE,eAAe,MAAM,CAAC;AAIlF,MAAM,0BAA0B,YAC7B,EAAE,YAAY,gBAAgB,aAAa,QAAQ,GAAG,SAAS,QAC9D,oBAAC;CAAmB;CAAuB;CAAY,GAAI;CAAY;EAAO,CAEjF;AAED,MAAa,kBAAkB,YAAY,yBAAyB,QAAQ;AAE5E,MAAa,kBAAkB,YAAY,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC;AAEvF,MAAM,wBAAwB,YAAY,OAAO,QAAQ;AAEzD,MAAa,gBAAgB,YAA0C,EAAE,UAAU,WAAW,GAAG,SAAS,QACxG,oBAAC;CAA+B;CAAS,GAAI;CAAY;EAAO,CAChE"}
1
+ {"version":3,"file":"ListItem.mjs","names":[],"sources":["../../src/ListItem/ListItem.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { Image, type ImageProps } from \"../Image\";\nimport { Heading, type TextProps } from \"../Text\";\n\nexport const listItemRecipe = sva({\n slots: [\"root\", \"title\", \"content\", \"image\"],\n base: {\n root: {\n minHeight: \"3xlarge\",\n borderStyle: \"solid\",\n borderWidth: \"1px\",\n borderColor: \"stroke.subtle\",\n backgroundColor: \"background.default\",\n color: \"text.default\",\n position: \"relative\",\n display: \"flex\",\n gap: \"small\",\n alignItems: \"center\",\n paddingBlock: \"xsmall\",\n paddingInline: \"xxsmall\",\n transitionProperty: \"background-color, border-color, color\",\n transitionDuration: \"superFast\",\n transitionTimingFunction: \"ease-in-out\",\n boxShadow: \"xsmall\",\n },\n content: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"xsmall\",\n width: \"100%\",\n },\n image: {\n minHeight: \"50px\",\n maxHeight: \"50px\",\n minWidth: \"70px\",\n maxWidth: \"70px\",\n objectFit: \"cover\",\n },\n },\n defaultVariants: {\n nonInteractive: false,\n },\n variants: {\n nonInteractive: {\n false: {\n root: {\n _highlighted: {\n borderColor: \"stroke.hover\",\n backgroundColor: \"surface.hover\",\n },\n _hover: {\n borderColor: \"stroke.hover\",\n backgroundColor: \"surface.hover\",\n },\n _active: {\n borderColor: \"stroke.hover\",\n backgroundColor: \"surface.active\",\n },\n },\n title: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(listItemRecipe);\n\nexport type ListItemVariantProps = NonNullable<RecipeVariantProps<typeof listItemRecipe>>;\n\nexport interface ListItemProps extends HTMLArkProps<\"div\">, StyledProps, ListItemVariantProps {}\n\nexport const ListItemRoot = withProvider(ark.div, \"root\", { baseComponent: true });\n\ninterface ListItemHeadingProps extends Omit<HTMLArkProps<\"p\">, \"color\">, TextProps {}\n\nconst InternalListItemHeading = forwardRef<HTMLHeadingElement, ListItemHeadingProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", ...props }, ref) => (\n <Heading textStyle={textStyle} fontWeight={fontWeight} {...props} ref={ref} />\n ),\n);\n\nexport const ListItemHeading = withContext(InternalListItemHeading, \"title\");\n\nexport const ListItemContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nconst InternalListItemImage = withContext(Image, \"image\");\n\nexport const ListItemImage = forwardRef<HTMLImageElement, ImageProps>(({ variant = \"rounded\", ...props }, ref) => (\n <InternalListItemImage variant={variant} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;AAmFA,MAAM,EAAE,cAAc,gBAAgB,mBAnER,IAAI;CAChC,OAAO;EAAC;EAAQ;EAAS;EAAW;EAAQ;CAC5C,MAAM;EACJ,MAAM;GACJ,WAAW;GACX,aAAa;GACb,aAAa;GACb,aAAa;GACb,iBAAiB;GACjB,OAAO;GACP,UAAU;GACV,SAAS;GACT,KAAK;GACL,YAAY;GACZ,cAAc;GACd,eAAe;GACf,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,WAAW;GACZ;EACD,SAAS;GACP,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,KAAK;GACL,OAAO;GACR;EACD,OAAO;GACL,WAAW;GACX,WAAW;GACX,UAAU;GACV,UAAU;GACV,WAAW;GACZ;EACF;CACD,iBAAiB,EACf,gBAAgB,OACjB;CACD,UAAU,EACR,gBAAgB,EACd,OAAO;EACL,MAAM;GACJ,cAAc;IACZ,aAAa;IACb,iBAAiB;IAClB;GACD,QAAQ;IACN,aAAa;IACb,iBAAiB;IAClB;GACD,SAAS;IACP,aAAa;IACb,iBAAiB;IAClB;GACF;EACD,OAAO;GACL,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,QACjB;GACF;EACF,EACF,EACF;CACF,CAAC,CAEsE;AAMxE,MAAa,eAAe,aAAa,IAAI,KAAK,QAAQ,EAAE,eAAe,MAAM,CAAC;AAUlF,MAAa,kBAAkB,YANC,YAC7B,EAAE,YAAY,gBAAgB,aAAa,QAAQ,GAAG,SAAS,QAC9D,oBAAC,SAAD;CAAoB;CAAuB;CAAY,GAAI;CAAY;CAAO,CAAA,CAEjF,EAEmE,QAAQ;AAE5E,MAAa,kBAAkB,YAAY,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC;AAEvF,MAAM,wBAAwB,YAAY,OAAO,QAAQ;AAEzD,MAAa,gBAAgB,YAA0C,EAAE,UAAU,WAAW,GAAG,SAAS,QACxG,oBAAC,uBAAD;CAAgC;CAAS,GAAI;CAAY;CAAO,CAAA,CAChE"}
package/es/Menu.mjs CHANGED
@@ -4,7 +4,6 @@ import { css, cva, sva } from "@ndla/styled-system/css";
4
4
  import { createStyleContext } from "@ndla/styled-system/jsx";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { forwardRef } from "react";
7
-
8
7
  //#region src/Menu.tsx
9
8
  /**
10
9
  * Copyright (c) 2024-present, NDLA.
@@ -138,7 +137,7 @@ const MenuTriggerItem = forwardRef(({ css: cssProp = {}, variant, ...props }, re
138
137
  const MenuTrigger = withContext(Menu.Trigger, "trigger", { baseComponent: true });
139
138
  const MenuSeparator = withContext(Menu.Separator, "separator", { baseComponent: true });
140
139
  const MenuItemText = withContext(Menu.ItemText, "itemText", { baseComponent: true });
141
-
142
140
  //#endregion
143
141
  export { MenuContent, MenuContentStandalone, MenuItem, MenuItemGroup, MenuItemGroupLabel, MenuItemText, MenuPositioner, MenuRoot, MenuSeparator, MenuTrigger, MenuTriggerItem };
142
+
144
143
  //# sourceMappingURL=Menu.mjs.map
package/es/Menu.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.mjs","names":[],"sources":["../src/Menu.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 { Menu, menuAnatomy } from \"@ark-ui/react\";\nimport { css, cva, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps, SystemStyleObject } from \"@ndla/styled-system/types\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Text, type TextProps } from \"./Text\";\n\nconst itemStyle: SystemStyleObject = css.raw({\n display: \"flex\",\n alignItems: \"center\",\n borderRadius: \"xsmall\",\n cursor: \"pointer\",\n textStyle: \"label.medium\",\n paddingBlock: \"4xsmall\",\n paddingInline: \"xsmall\",\n gap: \"xsmall\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color\",\n transitionTimingFunction: \"default\",\n outline: \"none\",\n _hover: {\n textDecoration: \"underline\",\n },\n _highlighted: {\n textDecoration: \"underline\",\n },\n _disabled: {\n color: \"text.disabled\",\n cursor: \"not-allowed\",\n \"& svg\": {\n color: \"stroke.disabled\",\n },\n _hover: {\n color: \"text.disabled\",\n textDecoration: \"none\",\n background: \"surface.default\",\n \"& svg\": {\n color: \"stroke.disabled\",\n },\n },\n },\n});\n\nconst itemCva = cva({\n defaultVariants: {\n variant: \"action\",\n },\n variants: {\n variant: {\n action: {\n _hover: {\n background: \"surface.hover\",\n },\n _highlighted: {\n background: \"surface.hover\",\n },\n _active: {\n background: \"surface.active\",\n },\n },\n destructive: {\n color: \"text.error\",\n \"& svg\": {\n color: \"icon.error\",\n },\n _hover: {\n color: \"text.default\",\n \"& svg\": {\n color: \"icon.default\",\n },\n background: \"surface.dangerSubtle.hover\",\n },\n _highlighted: {\n color: \"text.default\",\n \"& svg\": {\n color: \"icon.default\",\n },\n background: \"surface.dangerSubtle.hover\",\n },\n _active: {\n background: \"surface.dangerSubtle.active\",\n },\n },\n },\n },\n});\n\nconst menuRecipe = sva({\n slots: menuAnatomy.keys(),\n base: {\n item: itemStyle,\n triggerItem: itemStyle,\n content: {\n color: \"text.default\",\n display: \"flex\",\n flexDirection: \"column\",\n width: \"fit-content\",\n minWidth: \"surface.xxsmall\",\n padding: \"3xsmall\",\n gap: \"3xsmall\",\n background: \"surface.default\",\n boxShadow: \"small\",\n borderRadius: \"xsmall\",\n outline: \"none\",\n zIndex: \"dropdown\",\n _open: {\n animation: \"fade-shift-in 0.25s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"fade-shift-out 0.25s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n itemGroup: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n positioner: {\n zIndex: \"dropdown\",\n },\n },\n});\n\nconst { withRootProvider, withContext } = createStyleContext(menuRecipe);\n\nexport type MenuRootProps = Menu.RootProps;\n\nconst InternalMenuRoot = withRootProvider(Menu.Root);\n\nexport const MenuRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: MenuRootProps) => (\n <InternalMenuRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const MenuContentStandalone = withContext(Menu.Content, \"content\", { baseComponent: true });\n\ninterface MenuContentProps extends Menu.ContentProps, StyledProps {}\n\nexport const MenuContent = forwardRef<HTMLDivElement, MenuContentProps>((props, ref) => (\n <MenuPositioner>\n <MenuContentStandalone ref={ref} {...props} />\n </MenuPositioner>\n));\n\nconst InternalMenuItemGroupLabel = withContext(Menu.ItemGroupLabel, \"itemGroupLabel\");\n\ninterface MenuItemGroupLabelProps\n extends Omit<Menu.ItemGroupLabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLDivElement> {}\n\nexport const MenuItemGroupLabel = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n children,\n ...props\n}: MenuItemGroupLabelProps) => (\n <InternalMenuItemGroupLabel {...props} asChild>\n <Text textStyle={textStyle} fontWeight={fontWeight}>\n {children}\n </Text>\n </InternalMenuItemGroupLabel>\n);\n\nexport const MenuItemGroup = withContext(Menu.ItemGroup, \"itemGroup\", { baseComponent: true });\n\nconst InternalMenuItem = withContext(Menu.Item, \"item\", { baseComponent: true });\n\nexport type MenuItemVariantProps = NonNullable<RecipeVariantProps<typeof itemCva>>;\nexport interface MenuItemProps\n extends Menu.ItemProps, StyledProps, MenuItemVariantProps, RefAttributes<HTMLDivElement> {}\n\nexport const MenuItem = forwardRef<HTMLDivElement, MenuItemProps>(({ css: cssProp = {}, variant, ...props }, ref) => (\n <InternalMenuItem\n css={[itemCva.raw({ variant }), ...(Array.isArray(cssProp) ? cssProp : [cssProp])]}\n {...props}\n ref={ref}\n />\n));\n\nexport const MenuPositioner = withContext(Menu.Positioner, \"positioner\", { baseComponent: true });\n\nconst InternalMenuTriggerItem = withContext(Menu.TriggerItem, \"triggerItem\", { baseComponent: true });\n\ninterface MenuTriggerItemProps\n extends Menu.TriggerItemProps, StyledProps, MenuItemVariantProps, RefAttributes<HTMLButtonElement> {}\n\nexport const MenuTriggerItem = forwardRef<HTMLDivElement, MenuTriggerItemProps>(\n ({ css: cssProp = {}, variant, ...props }, ref) => (\n <InternalMenuTriggerItem\n css={[itemCva.raw({ variant }), ...(Array.isArray(cssProp) ? cssProp : [cssProp])]}\n {...props}\n ref={ref}\n />\n ),\n);\n\nexport const MenuTrigger = withContext(Menu.Trigger, \"trigger\", { baseComponent: true });\n\nexport const MenuSeparator = withContext(Menu.Separator, \"separator\", { baseComponent: true });\n\nexport const MenuItemText = withContext(Menu.ItemText, \"itemText\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,YAA+B,IAAI,IAAI;CAC3C,SAAS;CACT,YAAY;CACZ,cAAc;CACd,QAAQ;CACR,WAAW;CACX,cAAc;CACd,eAAe;CACf,KAAK;CACL,oBAAoB;CACpB,oBAAoB;CACpB,0BAA0B;CAC1B,SAAS;CACT,QAAQ,EACN,gBAAgB,aACjB;CACD,cAAc,E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,YAAY,EAAE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Menu.mjs","names":[],"sources":["../src/Menu.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 { Menu, menuAnatomy } from \"@ark-ui/react\";\nimport { css, cva, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps, SystemStyleObject } from \"@ndla/styled-system/types\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Text, type TextProps } from \"./Text\";\n\nconst itemStyle: SystemStyleObject = css.raw({\n display: \"flex\",\n alignItems: \"center\",\n borderRadius: \"xsmall\",\n cursor: \"pointer\",\n textStyle: \"label.medium\",\n paddingBlock: \"4xsmall\",\n paddingInline: \"xsmall\",\n gap: \"xsmall\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color\",\n transitionTimingFunction: \"default\",\n outline: \"none\",\n _hover: {\n textDecoration: \"underline\",\n },\n _highlighted: {\n textDecoration: \"underline\",\n },\n _disabled: {\n color: \"text.disabled\",\n cursor: \"not-allowed\",\n \"& svg\": {\n color: \"stroke.disabled\",\n },\n _hover: {\n color: \"text.disabled\",\n textDecoration: \"none\",\n background: \"surface.default\",\n \"& svg\": {\n color: \"stroke.disabled\",\n },\n },\n },\n});\n\nconst itemCva = cva({\n defaultVariants: {\n variant: \"action\",\n },\n variants: {\n variant: {\n action: {\n _hover: {\n background: \"surface.hover\",\n },\n _highlighted: {\n background: \"surface.hover\",\n },\n _active: {\n background: \"surface.active\",\n },\n },\n destructive: {\n color: \"text.error\",\n \"& svg\": {\n color: \"icon.error\",\n },\n _hover: {\n color: \"text.default\",\n \"& svg\": {\n color: \"icon.default\",\n },\n background: \"surface.dangerSubtle.hover\",\n },\n _highlighted: {\n color: \"text.default\",\n \"& svg\": {\n color: \"icon.default\",\n },\n background: \"surface.dangerSubtle.hover\",\n },\n _active: {\n background: \"surface.dangerSubtle.active\",\n },\n },\n },\n },\n});\n\nconst menuRecipe = sva({\n slots: menuAnatomy.keys(),\n base: {\n item: itemStyle,\n triggerItem: itemStyle,\n content: {\n color: \"text.default\",\n display: \"flex\",\n flexDirection: \"column\",\n width: \"fit-content\",\n minWidth: \"surface.xxsmall\",\n padding: \"3xsmall\",\n gap: \"3xsmall\",\n background: \"surface.default\",\n boxShadow: \"small\",\n borderRadius: \"xsmall\",\n outline: \"none\",\n zIndex: \"dropdown\",\n _open: {\n animation: \"fade-shift-in 0.25s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"fade-shift-out 0.25s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n itemGroup: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n positioner: {\n zIndex: \"dropdown\",\n },\n },\n});\n\nconst { withRootProvider, withContext } = createStyleContext(menuRecipe);\n\nexport type MenuRootProps = Menu.RootProps;\n\nconst InternalMenuRoot = withRootProvider(Menu.Root);\n\nexport const MenuRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: MenuRootProps) => (\n <InternalMenuRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const MenuContentStandalone = withContext(Menu.Content, \"content\", { baseComponent: true });\n\ninterface MenuContentProps extends Menu.ContentProps, StyledProps {}\n\nexport const MenuContent = forwardRef<HTMLDivElement, MenuContentProps>((props, ref) => (\n <MenuPositioner>\n <MenuContentStandalone ref={ref} {...props} />\n </MenuPositioner>\n));\n\nconst InternalMenuItemGroupLabel = withContext(Menu.ItemGroupLabel, \"itemGroupLabel\");\n\ninterface MenuItemGroupLabelProps\n extends Omit<Menu.ItemGroupLabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLDivElement> {}\n\nexport const MenuItemGroupLabel = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n children,\n ...props\n}: MenuItemGroupLabelProps) => (\n <InternalMenuItemGroupLabel {...props} asChild>\n <Text textStyle={textStyle} fontWeight={fontWeight}>\n {children}\n </Text>\n </InternalMenuItemGroupLabel>\n);\n\nexport const MenuItemGroup = withContext(Menu.ItemGroup, \"itemGroup\", { baseComponent: true });\n\nconst InternalMenuItem = withContext(Menu.Item, \"item\", { baseComponent: true });\n\nexport type MenuItemVariantProps = NonNullable<RecipeVariantProps<typeof itemCva>>;\nexport interface MenuItemProps\n extends Menu.ItemProps, StyledProps, MenuItemVariantProps, RefAttributes<HTMLDivElement> {}\n\nexport const MenuItem = forwardRef<HTMLDivElement, MenuItemProps>(({ css: cssProp = {}, variant, ...props }, ref) => (\n <InternalMenuItem\n css={[itemCva.raw({ variant }), ...(Array.isArray(cssProp) ? cssProp : [cssProp])]}\n {...props}\n ref={ref}\n />\n));\n\nexport const MenuPositioner = withContext(Menu.Positioner, \"positioner\", { baseComponent: true });\n\nconst InternalMenuTriggerItem = withContext(Menu.TriggerItem, \"triggerItem\", { baseComponent: true });\n\ninterface MenuTriggerItemProps\n extends Menu.TriggerItemProps, StyledProps, MenuItemVariantProps, RefAttributes<HTMLButtonElement> {}\n\nexport const MenuTriggerItem = forwardRef<HTMLDivElement, MenuTriggerItemProps>(\n ({ css: cssProp = {}, variant, ...props }, ref) => (\n <InternalMenuTriggerItem\n css={[itemCva.raw({ variant }), ...(Array.isArray(cssProp) ? cssProp : [cssProp])]}\n {...props}\n ref={ref}\n />\n ),\n);\n\nexport const MenuTrigger = withContext(Menu.Trigger, \"trigger\", { baseComponent: true });\n\nexport const MenuSeparator = withContext(Menu.Separator, \"separator\", { baseComponent: true });\n\nexport const MenuItemText = withContext(Menu.ItemText, \"itemText\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,YAA+B,IAAI,IAAI;CAC3C,SAAS;CACT,YAAY;CACZ,cAAc;CACd,QAAQ;CACR,WAAW;CACX,cAAc;CACd,eAAe;CACf,KAAK;CACL,oBA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;CACC;CACL,CAAA,CAEL;AAED,MAAa,cAAc,YAAY,KAAK,SAAS,WAAW,EAAE,eAAe,MAAM,CAAC;AAExF,MAAa,gBAAgB,YAAY,KAAK,WAAW,aAAa,EAAE,eAAe,MAAM,CAAC;AAE9F,MAAa,eAAe,YAAY,KAAK,UAAU,YAAY,EAAE,eAAe,MAAM,CAAC"}
package/es/MessageBox.mjs CHANGED
@@ -3,7 +3,6 @@ import { css, cva } from "@ndla/styled-system/css";
3
3
  import { styled } from "@ndla/styled-system/jsx";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { forwardRef } from "react";
6
-
7
6
  //#region src/MessageBox.tsx
8
7
  /**
9
8
  * Copyright (c) 2024-present, NDLA.
@@ -47,7 +46,7 @@ const MessageBox = forwardRef(({ variant, css: cssProp, ...props }, ref) => /* @
47
46
  ...props,
48
47
  ref
49
48
  }));
50
-
51
49
  //#endregion
52
50
  export { MessageBox };
51
+
53
52
  //# sourceMappingURL=MessageBox.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageBox.mjs","names":[],"sources":["../src/MessageBox.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst messageBoxRecipe = cva({\n base: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"small\",\n padding: \"medium\",\n border: \"1px solid\",\n borderRadius: \"xsmall\",\n },\n defaultVariants: {\n variant: \"info\",\n },\n variants: {\n variant: {\n info: {\n background: \"surface.infoSubtle\",\n borderColor: \"stroke.subtle\",\n },\n warning: {\n background: \"surface.warningSubtle\",\n borderColor: \"stroke.warning\",\n },\n success: {\n background: \"surface.successSubtle\",\n borderColor: \"stroke.success\",\n },\n error: {\n background: \"surface.errorSubtle\",\n borderColor: \"stroke.error\",\n },\n },\n },\n});\n\nexport type MessageBoxVariantProps = NonNullable<RecipeVariantProps<typeof messageBoxRecipe>>;\n\nexport interface MessageBoxProps extends HTMLArkProps<\"div\">, StyledProps, MessageBoxVariantProps {}\n\nconst StyledMessageBox = styled(ark.div, {}, { baseComponent: true });\n\nexport const MessageBox = forwardRef<HTMLDivElement, MessageBoxProps>(({ variant, css: cssProp, ...props }, ref) => (\n <StyledMessageBox css={css.raw(messageBoxRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,mBAAmB,IAAI;CAC3B,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,KAAK;EACL,SAAS;EACT,QAAQ;EACR,cAAc;EACf;CACD,iBAAiB,EACf,SAAS,QACV;CACD,UAAU,EACR,SAAS;EACP,MAAM;GACJ,YAAY;GACZ,aAAa;GACd;EACD,SAAS;GACP,YAAY;GACZ,aAAa;GACd;EACD,SAAS;GACP,YAAY;GACZ,aAAa;GACd;EACD,OAAO;GACL,YAAY;GACZ,aAAa;GACd;EACF,EACF;CACF,CAAC;AAMF,MAAM,mBAAmB,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAErE,MAAa,aAAa,YAA6C,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QAC1G,oBAAC;CAAiB,KAAK,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;EAAO,CACnG"}
1
+ {"version":3,"file":"MessageBox.mjs","names":[],"sources":["../src/MessageBox.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 HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst messageBoxRecipe = cva({\n base: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"small\",\n padding: \"medium\",\n border: \"1px solid\",\n borderRadius: \"xsmall\",\n },\n defaultVariants: {\n variant: \"info\",\n },\n variants: {\n variant: {\n info: {\n background: \"surface.infoSubtle\",\n borderColor: \"stroke.subtle\",\n },\n warning: {\n background: \"surface.warningSubtle\",\n borderColor: \"stroke.warning\",\n },\n success: {\n background: \"surface.successSubtle\",\n borderColor: \"stroke.success\",\n },\n error: {\n background: \"surface.errorSubtle\",\n borderColor: \"stroke.error\",\n },\n },\n },\n});\n\nexport type MessageBoxVariantProps = NonNullable<RecipeVariantProps<typeof messageBoxRecipe>>;\n\nexport interface MessageBoxProps extends HTMLArkProps<\"div\">, StyledProps, MessageBoxVariantProps {}\n\nconst StyledMessageBox = styled(ark.div, {}, { baseComponent: true });\n\nexport const MessageBox = forwardRef<HTMLDivElement, MessageBoxProps>(({ variant, css: cssProp, ...props }, ref) => (\n <StyledMessageBox css={css.raw(messageBoxRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,mBAAmB,IAAI;CAC3B,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,KAAK;EACL,SAAS;EACT,QAAQ;EACR,cAAc;EACf;CACD,iBAAiB,EACf,SAAS,QACV;CACD,UAAU,EACR,SAAS;EACP,MAAM;GACJ,YAAY;GACZ,aAAa;GACd;EACD,SAAS;GACP,YAAY;GACZ,aAAa;GACd;EACD,SAAS;GACP,YAAY;GACZ,aAAa;GACd;EACD,OAAO;GACL,YAAY;GACZ,aAAa;GACd;EACF,EACF;CACF,CAAC;AAMF,MAAM,mBAAmB,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAErE,MAAa,aAAa,YAA6C,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QAC1G,oBAAC,kBAAD;CAAkB,KAAK,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;CAAO,CAAA,CACnG"}
package/es/NdlaLogo.mjs CHANGED
@@ -2,7 +2,6 @@ import { css } from "@ndla/styled-system/css";
2
2
  import { styled } from "@ndla/styled-system/jsx";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import "react";
5
-
6
5
  //#region src/NdlaLogo.tsx
7
6
  /**
8
7
  * Copyright (c) 2024-present, NDLA.
@@ -206,7 +205,7 @@ const NdlaLogoText = (props) => /* @__PURE__ */ jsx(BaseSvg, {
206
205
  ]
207
206
  })
208
207
  });
209
-
210
208
  //#endregion
211
209
  export { NdlaLogoEn, NdlaLogoNb, NdlaLogoText };
210
+
212
211
  //# sourceMappingURL=NdlaLogo.mjs.map