@ndla/primitives 1.0.129-alpha.0 → 1.0.132-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 (227) hide show
  1. package/dist/panda.buildinfo.json +25 -1
  2. package/dist/styles.css +100 -4
  3. package/es/Accordion.mjs +1 -1
  4. package/es/Accordion.mjs.map +1 -1
  5. package/es/ArticleLists.mjs +1 -1
  6. package/es/ArticleLists.mjs.map +1 -1
  7. package/es/Badge.mjs +1 -1
  8. package/es/Badge.mjs.map +1 -1
  9. package/es/BlockQuote.mjs +1 -1
  10. package/es/BlockQuote.mjs.map +1 -1
  11. package/es/Button.mjs +1 -1
  12. package/es/Button.mjs.map +1 -1
  13. package/es/Card/Card.mjs +1 -1
  14. package/es/Card/Card.mjs.map +1 -1
  15. package/es/Checkbox.mjs +2 -1
  16. package/es/Checkbox.mjs.map +1 -1
  17. package/es/Combobox.mjs +1 -1
  18. package/es/Combobox.mjs.map +1 -1
  19. package/es/DatePicker.mjs +1 -1
  20. package/es/DatePicker.mjs.map +1 -1
  21. package/es/Dialog.mjs +1 -1
  22. package/es/Dialog.mjs.map +1 -1
  23. package/es/ErrorMessage/ErrorMessage.mjs +1 -1
  24. package/es/ErrorMessage/ErrorMessage.mjs.map +1 -1
  25. package/es/ExpandableBox.mjs +1 -1
  26. package/es/ExpandableBox.mjs.map +1 -1
  27. package/es/Field.mjs +2 -1
  28. package/es/Field.mjs.map +1 -1
  29. package/es/FieldErrorMessage.mjs +2 -1
  30. package/es/FieldErrorMessage.mjs.map +1 -1
  31. package/es/FieldHelper.mjs +2 -1
  32. package/es/FieldHelper.mjs.map +1 -1
  33. package/es/Figure.mjs +1 -1
  34. package/es/Figure.mjs.map +1 -1
  35. package/es/FileUpload.mjs +1 -1
  36. package/es/FileUpload.mjs.map +1 -1
  37. package/es/FramedContent.mjs +1 -1
  38. package/es/FramedContent.mjs.map +1 -1
  39. package/es/Hero.mjs +1 -1
  40. package/es/Hero.mjs.map +1 -1
  41. package/es/Image.mjs +1 -1
  42. package/es/Image.mjs.map +1 -1
  43. package/es/Input.mjs +2 -1
  44. package/es/Input.mjs.map +1 -1
  45. package/es/Label.mjs +3 -1
  46. package/es/Label.mjs.map +1 -1
  47. package/es/Layout/PageContainer.mjs +1 -1
  48. package/es/Layout/PageContainer.mjs.map +1 -1
  49. package/es/Layout/PageContent.mjs +1 -1
  50. package/es/Layout/PageContent.mjs.map +1 -1
  51. package/es/ListItem/ListItem.mjs +1 -1
  52. package/es/ListItem/ListItem.mjs.map +1 -1
  53. package/es/Menu.mjs +1 -1
  54. package/es/Menu.mjs.map +1 -1
  55. package/es/MessageBox.mjs +1 -1
  56. package/es/MessageBox.mjs.map +1 -1
  57. package/es/NdlaLogo.mjs.map +1 -1
  58. package/es/Pagination.mjs +1 -1
  59. package/es/Pagination.mjs.map +1 -1
  60. package/es/Popover.mjs +1 -1
  61. package/es/Popover.mjs.map +1 -1
  62. package/es/RadioGroup.mjs +3 -2
  63. package/es/RadioGroup.mjs.map +1 -1
  64. package/es/RainbowSpinner.mjs +66 -0
  65. package/es/RainbowSpinner.mjs.map +1 -0
  66. package/es/Select.mjs +1 -1
  67. package/es/Select.mjs.map +1 -1
  68. package/es/Skeleton.mjs +1 -1
  69. package/es/Skeleton.mjs.map +1 -1
  70. package/es/Slider.mjs +1 -1
  71. package/es/Slider.mjs.map +1 -1
  72. package/es/Spinner.mjs +1 -1
  73. package/es/Spinner.mjs.map +1 -1
  74. package/es/Switch.mjs +1 -1
  75. package/es/Switch.mjs.map +1 -1
  76. package/es/Table.mjs +1 -1
  77. package/es/Table.mjs.map +1 -1
  78. package/es/Tabs.mjs +1 -1
  79. package/es/Tabs.mjs.map +1 -1
  80. package/es/TagsInput.mjs +1 -1
  81. package/es/TagsInput.mjs.map +1 -1
  82. package/es/Text.mjs +1 -1
  83. package/es/Text.mjs.map +1 -1
  84. package/es/Toast.mjs +1 -1
  85. package/es/Toast.mjs.map +1 -1
  86. package/es/ToggleGroup.mjs +1 -1
  87. package/es/ToggleGroup.mjs.map +1 -1
  88. package/es/Tooltip.mjs +1 -1
  89. package/es/Tooltip.mjs.map +1 -1
  90. package/es/Tree/Tree.mjs +1 -1
  91. package/es/Tree/Tree.mjs.map +1 -1
  92. package/es/index.mjs +3 -2
  93. package/lib/Accordion.d.ts +1 -1
  94. package/lib/Accordion.js +7 -7
  95. package/lib/Accordion.js.map +1 -1
  96. package/lib/ArticleLists.d.ts +1 -1
  97. package/lib/ArticleLists.js +2 -2
  98. package/lib/ArticleLists.js.map +1 -1
  99. package/lib/Badge.d.ts +1 -1
  100. package/lib/Badge.js +2 -2
  101. package/lib/Badge.js.map +1 -1
  102. package/lib/BlockQuote.d.ts +1 -1
  103. package/lib/BlockQuote.js +2 -2
  104. package/lib/BlockQuote.js.map +1 -1
  105. package/lib/Button.d.ts +1 -1
  106. package/lib/Button.js +2 -2
  107. package/lib/Button.js.map +1 -1
  108. package/lib/Card/Card.d.ts +3 -3
  109. package/lib/Card/Card.js +3 -3
  110. package/lib/Card/Card.js.map +1 -1
  111. package/lib/Checkbox.d.ts +2 -1
  112. package/lib/Checkbox.js +9 -8
  113. package/lib/Checkbox.js.map +1 -1
  114. package/lib/Combobox.d.ts +1 -1
  115. package/lib/Combobox.js +16 -16
  116. package/lib/Combobox.js.map +1 -1
  117. package/lib/DatePicker.d.ts +2 -2
  118. package/lib/DatePicker.js +26 -26
  119. package/lib/DatePicker.js.map +1 -1
  120. package/lib/Dialog.d.ts +2 -2
  121. package/lib/Dialog.js +12 -12
  122. package/lib/Dialog.js.map +1 -1
  123. package/lib/ErrorMessage/ErrorMessage.d.ts +4 -4
  124. package/lib/ErrorMessage/ErrorMessage.js +4 -4
  125. package/lib/ErrorMessage/ErrorMessage.js.map +1 -1
  126. package/lib/ExpandableBox.d.ts +1 -1
  127. package/lib/ExpandableBox.js +3 -3
  128. package/lib/ExpandableBox.js.map +1 -1
  129. package/lib/Field.d.ts +2 -1
  130. package/lib/Field.js +4 -3
  131. package/lib/Field.js.map +1 -1
  132. package/lib/FieldErrorMessage.d.ts +2 -1
  133. package/lib/FieldErrorMessage.js +4 -3
  134. package/lib/FieldErrorMessage.js.map +1 -1
  135. package/lib/FieldHelper.d.ts +2 -1
  136. package/lib/FieldHelper.js +4 -3
  137. package/lib/FieldHelper.js.map +1 -1
  138. package/lib/Figure.d.ts +1 -1
  139. package/lib/Figure.js +2 -2
  140. package/lib/Figure.js.map +1 -1
  141. package/lib/FileUpload.d.ts +1 -1
  142. package/lib/FileUpload.js +15 -15
  143. package/lib/FileUpload.js.map +1 -1
  144. package/lib/FramedContent.d.ts +1 -1
  145. package/lib/FramedContent.js +2 -2
  146. package/lib/FramedContent.js.map +1 -1
  147. package/lib/Hero.d.ts +4 -4
  148. package/lib/Hero.js +6 -5
  149. package/lib/Hero.js.map +1 -1
  150. package/lib/Image.js +2 -2
  151. package/lib/Image.js.map +1 -1
  152. package/lib/Input.d.ts +1 -1
  153. package/lib/Input.js +7 -6
  154. package/lib/Input.js.map +1 -1
  155. package/lib/Label.d.ts +2 -1
  156. package/lib/Label.js +7 -5
  157. package/lib/Label.js.map +1 -1
  158. package/lib/Layout/PageContainer.d.ts +1 -1
  159. package/lib/Layout/PageContainer.js +1 -1
  160. package/lib/Layout/PageContainer.js.map +1 -1
  161. package/lib/Layout/PageContent.d.ts +2 -2
  162. package/lib/Layout/PageContent.js +3 -3
  163. package/lib/Layout/PageContent.js.map +1 -1
  164. package/lib/ListItem/ListItem.d.ts +3 -3
  165. package/lib/ListItem/ListItem.js +3 -3
  166. package/lib/ListItem/ListItem.js.map +1 -1
  167. package/lib/Menu.d.ts +1 -1
  168. package/lib/Menu.js +12 -12
  169. package/lib/Menu.js.map +1 -1
  170. package/lib/MessageBox.d.ts +1 -1
  171. package/lib/MessageBox.js +2 -2
  172. package/lib/MessageBox.js.map +1 -1
  173. package/lib/NdlaLogo.js.map +1 -1
  174. package/lib/Pagination.d.ts +1 -1
  175. package/lib/Pagination.js +10 -9
  176. package/lib/Pagination.js.map +1 -1
  177. package/lib/Popover.d.ts +2 -2
  178. package/lib/Popover.js +15 -15
  179. package/lib/Popover.js.map +1 -1
  180. package/lib/RadioGroup.d.ts +1 -1
  181. package/lib/RadioGroup.js +13 -12
  182. package/lib/RadioGroup.js.map +1 -1
  183. package/lib/RainbowSpinner.d.ts +26 -0
  184. package/lib/RainbowSpinner.js +66 -0
  185. package/lib/RainbowSpinner.js.map +1 -0
  186. package/lib/Select.d.ts +1 -1
  187. package/lib/Select.js +18 -18
  188. package/lib/Select.js.map +1 -1
  189. package/lib/Skeleton.d.ts +2 -2
  190. package/lib/Skeleton.js +3 -2
  191. package/lib/Skeleton.js.map +1 -1
  192. package/lib/Slider.d.ts +1 -1
  193. package/lib/Slider.js +9 -9
  194. package/lib/Slider.js.map +1 -1
  195. package/lib/Spinner.d.ts +1 -1
  196. package/lib/Spinner.js +2 -2
  197. package/lib/Spinner.js.map +1 -1
  198. package/lib/Switch.d.ts +1 -1
  199. package/lib/Switch.js +7 -7
  200. package/lib/Switch.js.map +1 -1
  201. package/lib/Table.d.ts +2 -2
  202. package/lib/Table.js +3 -2
  203. package/lib/Table.js.map +1 -1
  204. package/lib/Tabs.d.ts +1 -1
  205. package/lib/Tabs.js +6 -6
  206. package/lib/Tabs.js.map +1 -1
  207. package/lib/TagsInput.d.ts +1 -1
  208. package/lib/TagsInput.js +12 -12
  209. package/lib/TagsInput.js.map +1 -1
  210. package/lib/Text.d.ts +1 -1
  211. package/lib/Text.js +3 -3
  212. package/lib/Text.js.map +1 -1
  213. package/lib/Toast.d.ts +1 -1
  214. package/lib/Toast.js +7 -7
  215. package/lib/Toast.js.map +1 -1
  216. package/lib/ToggleGroup.d.ts +1 -1
  217. package/lib/ToggleGroup.js +6 -5
  218. package/lib/ToggleGroup.js.map +1 -1
  219. package/lib/Tooltip.d.ts +1 -1
  220. package/lib/Tooltip.js +8 -8
  221. package/lib/Tooltip.js.map +1 -1
  222. package/lib/Tree/Tree.d.ts +2 -2
  223. package/lib/Tree/Tree.js +19 -19
  224. package/lib/Tree/Tree.js.map +1 -1
  225. package/lib/index.d.ts +2 -1
  226. package/lib/index.js +6 -3
  227. package/package.json +5 -5
package/lib/Hero.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Hero.js","names":["ark"],"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,iBAAA,qCAAA,CAAA,qBAAA,GAAA,wBAAA,KA7GC;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,CAEkE,CAAC;AAQpE,MAAa,OAAO,aAAaA,cAAAA,IAAI,KAAK,QAAQ,EAAE,eAAe,MAAM,CAAC;AAI1E,MAAa,iBAAiB,YAAYA,cAAAA,IAAI,KAAK,cAAc,EAAE,eAAe,MAAM,CAAC;AAIzF,MAAa,cAAc,YAAYA,cAAAA,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Hero.js","names":["ark"],"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/factory\";\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,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA7GC;CACrB,OAAO;EAAC;EAAQ;EAAc;CAAS;CACvC,MAAM;EACJ,MAAM;GACJ,OAAO;GACP,UAAU;EACZ;EACA,YAAY;GACV,QAAQ;GACR,OAAO;GACP,QAAQ;GACR,UAAU;GACV,UAAU;GACV,QAAQ,EACN,YAAY,OACd;EACF;EACA,SAAS;GACP,SAAS;GACT,UAAU;GACV,YAAY;GACZ,cAAc;GACd,QAAQ,EACN,mBAAmB,UACrB;EACF;CACF;CACA,iBAAiB;EACf,SAAS;EACT,UAAU;CACZ;CACA,UAAU;EACR,UAAU,EACR,MAAM,EACJ,YAAY,EACV,UAAU,WACZ,EACF,EACF;EACA,SAAS;GACP,SAAS;IACP,YAAY,EACV,YAAY,UACd;IACA,SAAS,EACP,oBAAoB,EAClB,OAAO,gBACT,EACF;GACF;GACA,YAAY;IACV,YAAY,EACV,YAAY,uBACd;IACA,SAAS,EACP,oBAAoB,EAClB,OAAO,gBACT,EACF;GACF;GACA,QAAQ,EACN,YAAY,EACV,YAAY,kBACd,EACF;GACA,gBAAgB,EACd,YAAY,EACV,YAAY,2BACd,EACF;GACA,QAAQ,EACN,YAAY,EACV,YAAY,kBACd,EACF;GACA,cAAc,EACZ,YAAY,EACV,YAAY,yBACd,EACF;GACA,gBAAgB,EACd,YAAY,EACV,YAAY,2BACd,EACF;GACA,gBAAgB,EACd,YAAY,EACV,YAAY,2BACd,EACF;GACA,gBAAgB,EACd,YAAY,EACV,YAAY,2BACd,EACF;GACA,gBAAgB,EACd,YAAY,EACV,YAAY,2BACd,EACF;GACA,SAAS,EACP,YAAY,EACV,YAAY,qBACd,EACF;EACF;CACF;AACF,CAEkE,CAAC;AAQnE,MAAa,OAAO,aAAaA,sBAAAA,IAAI,KAAK,QAAQ,EAAE,eAAe,KAAK,CAAC;AAIzE,MAAa,iBAAiB,YAAYA,sBAAAA,IAAI,KAAK,cAAc,EAAE,eAAe,KAAK,CAAC;AAIxF,MAAa,cAAc,YAAYA,sBAAAA,IAAI,KAAK,WAAW,EAAE,eAAe,KAAK,CAAC"}
package/lib/Image.js CHANGED
@@ -1,6 +1,6 @@
1
- let _ark_ui_react = require("@ark-ui/react");
2
1
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
2
  let react_jsx_runtime = require("react/jsx-runtime");
3
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
4
4
  let react = require("react");
5
5
  //#region src/Image.tsx
6
6
  /**
@@ -91,7 +91,7 @@ const StyledImage = (0, _ndla_styled_system_jsx.styled)("img", {
91
91
  rounded: { borderRadius: "xsmall" }
92
92
  } }
93
93
  });
94
- const StyledFallbackElement = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.div, { base: {
94
+ const StyledFallbackElement = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, { base: {
95
95
  display: "flex",
96
96
  alignItems: "center",
97
97
  justifyContent: "center"
package/lib/Image.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Image.js","names":["styled","ark"],"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,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CAAC;AAE1C,KAAI,CAAC,KAAK,UAAU,CAAC,UAAU,UAAU,gBACvC,QACE,iBAAA,GAAA,kBAAA,KAAC,uBAAD;EAAuB,GAAI;EAAY;YACpC;EACqB,CAAA;CAI5B,MAAM,cAAc,mBAAmB;EAAE,OAAO;EAAe;EAAM;EAAY;EAAe,CAAC;CACjG,MAAM,cAAc,OAAO,cAAc,GAAG,IAAI,GAAG,gBAAgB;AAEnE,QACE,iBAAA,GAAA,kBAAA,MAAC,WAAD,EAAA,UAAA;EACG,CAAC,CAAC,UAAU,UAAU,CAAC,QAAQ,CAAC,cAAc,gBAAgB,eAC7D,iBAAA,GAAA,kBAAA,KAAC,UAAD;GACE,MAAM;GACN,QAAQ,iBAAiB,SAAS;GAClC,OAAO,aAAa,gBAAgB,SAAS;GAC7C,CAAA;EAEH,gBAAgB,eACf,iBAAA,GAAA,kBAAA,KAAC,UAAD;GACE,MAAM;GACN,QAAQ,UAAU;IAAE;IAAK;IAAM;IAAY;IAAe,CAAC;GAC3D,OAAO,aAAa;GACpB,CAAA;EAEJ,iBAAA,GAAA,kBAAA,KAAC,aAAD;GACO;GACL,KAAK,gBAAgB,cAAc,MAAM;GACzC,GAAI;GACC;GACL,cAAY,WAAW,KAAK,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"}
1
+ {"version":3,"file":"Image.js","names":["styled","ark"],"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/factory\";\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.on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
  *
7
7
  */
8
- import { type HTMLArkProps } from "@ark-ui/react";
8
+ import { type HTMLArkProps } from "@ark-ui/react/factory";
9
9
  import type { RecipeVariantProps, StyledProps } from "@ndla/styled-system/types";
10
10
  interface InputContainerProps extends HTMLArkProps<"div">, StyledProps {
11
11
  }
package/lib/Input.js CHANGED
@@ -1,8 +1,9 @@
1
- let _ark_ui_react = require("@ark-ui/react");
2
1
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
3
2
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
5
5
  let react = require("react");
6
+ let _ark_ui_react_field = require("@ark-ui/react/field");
6
7
  let _ndla_util = require("@ndla/util");
7
8
  //#region src/Input.tsx
8
9
  /**
@@ -37,7 +38,7 @@ const inputCss = _ndla_styled_system_css.css.raw({
37
38
  _hover: { boxShadowColor: "stroke.subtle" }
38
39
  }
39
40
  });
40
- const StyledInputContainer = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.div, { base: {
41
+ const StyledInputContainer = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, { base: {
41
42
  width: "100%",
42
43
  display: "flex",
43
44
  alignItems: "center",
@@ -75,7 +76,7 @@ const baseTextAreaCss = _ndla_styled_system_css.css.raw({
75
76
  resize: "none",
76
77
  overflowY: "hidden"
77
78
  });
78
- const StyledInput = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.input, {}, { baseComponent: true });
79
+ const StyledInput = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.input, {}, { baseComponent: true });
79
80
  const inputRecipe = (0, _ndla_styled_system_css.cva)({
80
81
  defaultVariants: { componentSize: "medium" },
81
82
  variants: { componentSize: {
@@ -97,13 +98,13 @@ const Input = (0, react.forwardRef)(({ css: cssProp, componentSize, ...props },
97
98
  ...props
98
99
  });
99
100
  });
100
- const FieldInput = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.Field.Input, {
101
+ const FieldInput = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_field.Field.Input, {
101
102
  asChild: true,
102
103
  ...props,
103
104
  ref,
104
105
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {})
105
106
  }));
106
- const StyledTextArea = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.textarea, {}, { baseComponent: true });
107
+ const StyledTextArea = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.textarea, {}, { baseComponent: true });
107
108
  const TextArea = (0, react.forwardRef)(({ css: cssProp, autoResize = true, ...props }, ref) => {
108
109
  const context = (0, react.useContext)(InputContext);
109
110
  const localRef = (0, react.useRef)(null);
@@ -128,7 +129,7 @@ const TextArea = (0, react.forwardRef)(({ css: cssProp, autoResize = true, ...pr
128
129
  ...props
129
130
  });
130
131
  });
131
- const FieldTextArea = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.Field.Textarea, {
132
+ const FieldTextArea = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_field.Field.Textarea, {
132
133
  asChild: true,
133
134
  ...props,
134
135
  ref,
package/lib/Input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","names":["css","ark","Field"],"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,gBAAA,GAAA,MAAA,eAA2D,KAAA,EAAU;AAE3E,MAAM,WAAWA,wBAAAA,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,wBAAA,GAAA,wBAAA,QACJC,cAAAA,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,kBAAA,GAAA,MAAA,aACV,EAAE,UAAU,KAAK,SAAS,GAAG,QAAQ,QACpC,iBAAA,GAAA,kBAAA,KAAC,aAAa,UAAd;C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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/factory\";\nimport { Field } from \"@ark-ui/react/field\";\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":";;;;;;;;;;;;;;;AAkBA,MAAM,gBAAA,GAAA,MAAA,eAA2D,KAAA,CAAS;AAE1E,MAAM,WAAWA,wBAAAA,IAAI,IAAI;CACvB,gBAAgB;CAChB,WAAW;CACX,YAAY;CACZ,cAAc;CACd,cAAc;EACZ,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,eAClB;EACA,cAAc;GACZ,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,eAClB;EACF;CACF;CACA,QAAQ,EACN,gBAAgB,eAClB;CACA,cAAc;EACZ,WAAW;EACX,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,iBAClB;CACF;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,gBAClB;CACF;AACF,CAAC;AAED,MAAM,wBAAA,GAAA,wBAAA,QACJC,sBAAAA,IAAI,KACJ,EACE,MAAM;CACJ,OAAO;CACP,SAAS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EL,CACF;AAEA,MAAa,iBAAA,GAAA,MAAA,aAAgE,OAAO,QAClF,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,MAAM,UAAP;CAAgB,SAAA;CAAQ,GAAI;CAAY;WACtC,iBAAA,GAAA,kBAAA,KAAC,UAAD,CAAW,CAAA;AACG,CAAA,CACjB"}
package/lib/Label.d.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { Fieldset, type HTMLArkProps } from "@ark-ui/react";
8
+ import { type HTMLArkProps } from "@ark-ui/react/factory";
9
+ import { Fieldset } from "@ark-ui/react/fieldset";
9
10
  import type { StyledProps } from "@ndla/styled-system/types";
10
11
  import { type TextProps } from "./Text";
11
12
  export interface LegendProps extends Omit<HTMLArkProps<"legend">, "color">, StyledProps, TextProps {
package/lib/Label.js CHANGED
@@ -1,8 +1,10 @@
1
- let _ark_ui_react = require("@ark-ui/react");
2
1
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
3
2
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
5
5
  let react = require("react");
6
+ let _ark_ui_react_field = require("@ark-ui/react/field");
7
+ let _ark_ui_react_fieldset = require("@ark-ui/react/fieldset");
6
8
  //#region src/Label.tsx
7
9
  /**
8
10
  * Copyright (c) 2024-present, NDLA.
@@ -11,7 +13,7 @@ let react = require("react");
11
13
  * LICENSE file in the root directory of this source tree.
12
14
  *
13
15
  */
14
- const StyledLegend = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.legend, { base: {
16
+ const StyledLegend = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.legend, { base: {
15
17
  float: "left",
16
18
  width: "inherit",
17
19
  _disabled: { color: "text.subtle" }
@@ -26,13 +28,13 @@ const Legend = (0, react.forwardRef)(({ textStyle = "label.medium", fontWeight =
26
28
  ...rest,
27
29
  ref
28
30
  }));
29
- const FieldsetLegend = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.Fieldset.Legend, {
31
+ const FieldsetLegend = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_fieldset.Fieldset.Legend, {
30
32
  asChild: true,
31
33
  ...props,
32
34
  ref,
33
35
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Legend, { children })
34
36
  }));
35
- const StyledLabel = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.label, { base: {
37
+ const StyledLabel = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.label, { base: {
36
38
  display: "inline-block",
37
39
  _disabled: { color: "text.subtle" }
38
40
  } }, { baseComponent: true });
@@ -46,7 +48,7 @@ const Label = (0, react.forwardRef)(({ textStyle = "label.medium", fontWeight =
46
48
  ...rest,
47
49
  ref
48
50
  }));
49
- const FieldLabel = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.Field.Label, {
51
+ const FieldLabel = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_field.Field.Label, {
50
52
  asChild: true,
51
53
  ...props,
52
54
  ref,
package/lib/Label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","names":["ark","css","Fieldset","Field"],"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,gBAAA,GAAA,wBAAA,QACJA,cAAAA,IAAI,QACJ,EACE,MAAM;CACJ,OAAO;CACP,OAAO;CACP,WAAW,EACT,OAAO,eACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,UAAA,GAAA,MAAA,aACV,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,iBAAA,GAAA,kBAAA,KAAC,cAAD;CAAc,KAAKC,wBAAAA,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;EAAO,EAAE,QAAQ;CAAE,GAAI;CAAW;CAAO,CAAA,CAExG;AAID,MAAa,kBAAA,GAAA,MAAA,aAA6D,EAAE,UAAU,GAAG,SAAS,QAChG,iBAAA,GAAA,kBAAA,KAACC,cAAAA,SAAS,QAAV;CAAiB,SAAA;CAAQ,GAAI;CAAY;WACvC,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAS,UAAkB,CAAA;CACX,CAAA,CAClB;AAEF,MAAM,eAAA,GAAA,wBAAA,QACJF,cAAAA,IAAI,OACJ,EACE,MAAM;CACJ,SAAS;CACT,WAAW,EACT,OAAO,eACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAID,MAAa,SAAA,GAAA,MAAA,aACV,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,iBAAA,GAAA,kBAAA,KAAC,aAAD;CAAa,KAAKC,wBAAAA,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;EAAO,EAAE,QAAQ;CAAE,GAAI;CAAW;CAAO,CAAA,CAEvG;AAED,MAAa,cAAA,GAAA,MAAA,aAAuD,EAAE,UAAU,GAAG,SAAS,QAC1F,iBAAA,GAAA,kBAAA,KAACE,cAAAA,MAAM,OAAP;CAAa,SAAA;CAAQ,GAAI;CAAY;WACnC,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAQ,UAAiB,CAAA;CACb,CAAA,CACd"}
1
+ {"version":3,"file":"Label.js","names":["ark","css","Fieldset","Field"],"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 { type HTMLArkProps, ark } from \"@ark-ui/react/factory\";\nimport { Field } from \"@ark-ui/react/field\";\nimport { Fieldset } from \"@ark-ui/react/fieldset\";\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, 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KAACE,oBAAAA,MAAM,OAAP;CAAa,SAAA;CAAQ,GAAI;CAAY;WACnC,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAQ,SAAgB,CAAA;AACb,CAAA,CACd"}
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { type HTMLArkProps } from "@ark-ui/react";
8
+ import { type HTMLArkProps } from "@ark-ui/react/factory";
9
9
  import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  import { type PageContentVariantProps } from "./PageContent";
11
11
  declare const pageContainerRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
@@ -1,7 +1,7 @@
1
1
  const require_PageContent = require("./PageContent.js");
2
- require("@ark-ui/react");
3
2
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
+ require("@ark-ui/react/factory");
5
5
  let react = require("react");
6
6
  //#region src/Layout/PageContainer.tsx
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PageContainer.js","names":["PageContent","css"],"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,uBAAA,GAAA,wBAAA,KAA0B;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,iBAAA,GAAA,MAAA,aACV,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QACpC,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,aAAD;CAAa,KAAKC,wBAAAA,IAAI,IAAI,oBAAoB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;CAAO,CAAA,CAEpG"}
1
+ {"version":3,"file":"PageContainer.js","names":["PageContent","css"],"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/factory\";\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,uBAAA,GAAA,wBAAA,KAA0B;CAC9B,iBAAiB,EACf,SAAS,SACX;CACA,UAAU,EACR,SAAS;EACP,MAAM,CAAC;EACP,OAAO;GACL,mBAAmB;GACnB,iBAAiB;EACnB;EACA,QAAQ;GACN,mBAAmB;GACnB,iBAAiB;EACnB;EACA,OAAO;GACL,mBAAmB;GACnB,iBAAiB;EACnB;CACF,EACF;AACF,CAAC;AAOD,MAAa,iBAAA,GAAA,MAAA,aACV,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QACpC,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,aAAD;CAAa,KAAKC,wBAAAA,IAAI,IAAI,oBAAoB,IAAI,EAAE,QAAQ,CAAC,GAAG,OAAO;CAAG,GAAI;CAAY;AAAM,CAAA,CAEpG"}
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { type HTMLArkProps } from "@ark-ui/react";
8
+ import { type HTMLArkProps } from "@ark-ui/react/factory";
9
9
  import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  declare const pageRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
11
11
  variant: {
@@ -50,5 +50,5 @@ export type PageContentVariantProps = NonNullable<RecipeVariantProps<typeof page
50
50
  export interface PageContentProps extends HTMLArkProps<"div">, StyledProps, PageContentVariantProps {
51
51
  }
52
52
  export declare const PageContent: import("react").ForwardRefExoticComponent<PageContentProps & import("react").RefAttributes<HTMLDivElement>>;
53
- export declare const BleedPageContent: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
53
+ export declare const BleedPageContent: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>, {}>;
54
54
  export {};
@@ -1,7 +1,7 @@
1
- let _ark_ui_react = require("@ark-ui/react");
2
1
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
3
2
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
5
5
  let react = require("react");
6
6
  //#region src/Layout/PageContent.tsx
7
7
  /**
@@ -58,7 +58,7 @@ const pageRecipe = (0, _ndla_styled_system_css.cva)({
58
58
  }
59
59
  }
60
60
  });
61
- const StyledPageContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.div, {}, { baseComponent: true });
61
+ const StyledPageContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, {}, { baseComponent: true });
62
62
  const PageContent = (0, react.forwardRef)(({ variant, gutters, css: cssProp, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledPageContent, {
63
63
  css: _ndla_styled_system_css.css.raw(pageRecipe.raw({
64
64
  variant,
@@ -67,7 +67,7 @@ const PageContent = (0, react.forwardRef)(({ variant, gutters, css: cssProp, ...
67
67
  ref,
68
68
  ...props
69
69
  }));
70
- const BleedPageContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.div, { base: { "& ": {
70
+ const BleedPageContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, { base: { "& ": {
71
71
  width: "100%",
72
72
  gridColumnStart: "1",
73
73
  gridColumnEnd: "-1"
@@ -1 +1 @@
1
- {"version":3,"file":"PageContent.js","names":["ark","css"],"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,cAAA,GAAA,wBAAA,KAAiB;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,qBAAA,GAAA,wBAAA,QAA2BA,cAAAA,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAMtE,MAAa,eAAA,GAAA,MAAA,aACV,EAAE,SAAS,SAAS,KAAK,SAAS,GAAG,SAAS,QAC7C,iBAAA,GAAA,kBAAA,KAAC,mBAAD;CAAmB,KAAKC,wBAAAA,IAAI,IAAI,WAAW,IAAI;EAAE;EAAS;EAAS,CAAC,EAAE,QAAQ;CAAO;CAAK,GAAI;CAAS,CAAA,CAE1G;AAED,MAAa,oBAAA,GAAA,wBAAA,QACXD,cAAAA,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.js","names":["ark","css"],"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/factory\";\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,cAAA,GAAA,wBAAA,KAAiB;CACrB,MAAM;EACJ,SAAS;EACT,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;;;;;;EAMd,eAAe;EACf,qBAAqB;EACrB,SAAS;GACP,iBAAiB;GACjB,eAAe;EACjB;CACF;CACA,iBAAiB;EACf,SAAS;EACT,SAAS;CACX;CACA,UAAU;EACR,SAAS;GACP,SAAS,EACP,UAAU,2BACZ;GACA,SAAS,EACP,UAAU,2BACZ;GACA,MAAM,EACJ,UAAU,wBACZ;GACA,MAAM,EACJ,UAAU,wBACZ;EACF;EACA,SAAS;GACP,OAAO,EACL,YAAY,MACd;GACA,UAAU;IACR,YAAY;IACZ,YAAY,EACV,YAAY,iBACd;GACF;GACA,UAAU;IACR,YAAY;IACZ,QAAQ,EACN,YAAY,iBACd;GACF;GACA,QAAQ;IACN,YAAY;IACZ,QAAQ,EACN,YAAY,iBACd;GACF;EACF;CACF;AACF,CAAC;AAED,MAAM,qBAAA,GAAA,wBAAA,QAA2BA,sBAAAA,IAAI,KAAK,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAMrE,MAAa,eAAA,GAAA,MAAA,aACV,EAAE,SAAS,SAAS,KAAK,SAAS,GAAG,SAAS,QAC7C,iBAAA,GAAA,kBAAA,KAAC,mBAAD;CAAmB,KAAKC,wBAAAA,IAAI,IAAI,WAAW,IAAI;EAAE;EAAS;CAAQ,CAAC,GAAG,OAAO;CAAQ;CAAK,GAAI;AAAQ,CAAA,CAE1G;AAEA,MAAa,oBAAA,GAAA,wBAAA,QACXD,sBAAAA,IAAI,KACJ,EACE,MAAM,EACJ,MAAM;CACJ,OAAO;CACP,iBAAiB;CACjB,eAAe;AACjB,EACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB"}
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { type HTMLArkProps } from "@ark-ui/react";
8
+ import { type HTMLArkProps } from "@ark-ui/react/factory";
9
9
  import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  import { type ImageProps } from "../Image";
11
11
  import { type TextProps } from "../Text";
@@ -38,7 +38,7 @@ export declare const listItemRecipe: import("@ndla/styled-system/types").SlotRec
38
38
  export type ListItemVariantProps = NonNullable<RecipeVariantProps<typeof listItemRecipe>>;
39
39
  export interface ListItemProps extends HTMLArkProps<"div">, StyledProps, ListItemVariantProps {
40
40
  }
41
- export declare const ListItemRoot: import("@ndla/styled-system/jsx").StyleContextProvider<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>, import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "content" | "title" | "image", {
41
+ export declare const ListItemRoot: import("@ndla/styled-system/jsx").StyleContextProvider<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>, import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "content" | "title" | "image", {
42
42
  nonInteractive: {
43
43
  false: {
44
44
  root: {
@@ -67,6 +67,6 @@ export declare const ListItemRoot: import("@ndla/styled-system/jsx").StyleContex
67
67
  interface ListItemHeadingProps extends Omit<HTMLArkProps<"p">, "color">, TextProps {
68
68
  }
69
69
  export declare const ListItemHeading: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<ListItemHeadingProps & import("react").RefAttributes<HTMLHeadingElement>>>;
70
- export declare const ListItemContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>>;
70
+ export declare const ListItemContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>>;
71
71
  export declare const ListItemImage: import("react").ForwardRefExoticComponent<Omit<ImageProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
72
72
  export {};
@@ -1,9 +1,9 @@
1
1
  const require_Image = require("../Image.js");
2
2
  const require_Text = require("../Text.js");
3
- let _ark_ui_react = require("@ark-ui/react");
4
3
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
5
4
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
6
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
7
7
  let react = require("react");
8
8
  //#region src/ListItem/ListItem.tsx
9
9
  /**
@@ -77,14 +77,14 @@ const listItemRecipe = (0, _ndla_styled_system_css.sva)({
77
77
  } } }
78
78
  });
79
79
  const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)(listItemRecipe);
80
- const ListItemRoot = withProvider(_ark_ui_react.ark.div, "root", { baseComponent: true });
80
+ const ListItemRoot = withProvider(_ark_ui_react_factory.ark.div, "root", { baseComponent: true });
81
81
  const ListItemHeading = withContext((0, react.forwardRef)(({ textStyle = "label.medium", fontWeight = "bold", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Heading, {
82
82
  textStyle,
83
83
  fontWeight,
84
84
  ...props,
85
85
  ref
86
86
  })), "title");
87
- const ListItemContent = withContext(_ark_ui_react.ark.div, "content", { baseComponent: true });
87
+ const ListItemContent = withContext(_ark_ui_react_factory.ark.div, "content", { baseComponent: true });
88
88
  const InternalListItemImage = withContext(require_Image.Image, "image");
89
89
  const ListItemImage = (0, react.forwardRef)(({ variant = "rounded", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalListItemImage, {
90
90
  variant,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","names":["ark","Heading","Image"],"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,kBAAA,GAAA,wBAAA,KAAqB;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,iBAAA,GAAA,wBAAA,oBAAmC,eAAe;AAMxE,MAAa,eAAe,aAAaA,cAAAA,IAAI,KAAK,QAAQ,EAAE,eAAe,MAAM,CAAC;AAUlF,MAAa,kBAAkB,aANzB,GAAA,MAAA,aACH,EAAE,YAAY,gBAAgB,aAAa,QAAQ,GAAG,SAAS,QAC9D,iBAAA,GAAA,kBAAA,KAACC,aAAAA,SAAD;CAAoB;CAAuB;CAAY,GAAI;CAAY;CAAO,CAAA,CAIvC,EAAyB,QAAQ;AAE5E,MAAa,kBAAkB,YAAYD,cAAAA,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC;AAEvF,MAAM,wBAAwB,YAAYE,cAAAA,OAAO,QAAQ;AAEzD,MAAa,iBAAA,GAAA,MAAA,aAA0D,EAAE,UAAU,WAAW,GAAG,SAAS,QACxG,iBAAA,GAAA,kBAAA,KAAC,uBAAD;CAAgC;CAAS,GAAI;CAAY;CAAO,CAAA,CAChE"}
1
+ {"version":3,"file":"ListItem.js","names":["ark","Heading","Image"],"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/factory\";\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,kBAAA,GAAA,wBAAA,KAAqB;CAChC,OAAO;EAAC;EAAQ;EAAS;EAAW;CAAO;CAC3C,MAAM;EACJ,MAAM;GACJ,WAAW;GACX,aAAa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ChE"}
package/lib/Menu.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { Menu } from "@ark-ui/react";
8
+ import { Menu } from "@ark-ui/react/menu";
9
9
  import type { RecipeVariantProps, StyledProps } from "@ndla/styled-system/types";
10
10
  import { type RefAttributes } from "react";
11
11
  import { type TextProps } from "./Text";
package/lib/Menu.js CHANGED
@@ -1,9 +1,9 @@
1
1
  const require_Text = require("./Text.js");
2
- let _ark_ui_react = require("@ark-ui/react");
3
2
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
4
3
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
4
  let react_jsx_runtime = require("react/jsx-runtime");
6
5
  let react = require("react");
6
+ let _ark_ui_react_menu = require("@ark-ui/react/menu");
7
7
  //#region src/Menu.tsx
8
8
  /**
9
9
  * Copyright (c) 2024-present, NDLA.
@@ -65,7 +65,7 @@ const itemCva = (0, _ndla_styled_system_css.cva)({
65
65
  } }
66
66
  });
67
67
  const { withRootProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)((0, _ndla_styled_system_css.sva)({
68
- slots: _ark_ui_react.menuAnatomy.keys(),
68
+ slots: _ark_ui_react_menu.menuAnatomy.keys(),
69
69
  base: {
70
70
  item: itemStyle,
71
71
  triggerItem: itemStyle,
@@ -99,18 +99,18 @@ const { withRootProvider, withContext } = (0, _ndla_styled_system_jsx.createStyl
99
99
  positioner: { zIndex: "dropdown" }
100
100
  }
101
101
  }));
102
- const InternalMenuRoot = withRootProvider(_ark_ui_react.Menu.Root);
102
+ const InternalMenuRoot = withRootProvider(_ark_ui_react_menu.Menu.Root);
103
103
  const MenuRoot = ({ lazyMount = true, unmountOnExit = true, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalMenuRoot, {
104
104
  lazyMount,
105
105
  unmountOnExit,
106
106
  ...props
107
107
  });
108
- const MenuContentStandalone = withContext(_ark_ui_react.Menu.Content, "content", { baseComponent: true });
108
+ const MenuContentStandalone = withContext(_ark_ui_react_menu.Menu.Content, "content", { baseComponent: true });
109
109
  const MenuContent = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MenuPositioner, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MenuContentStandalone, {
110
110
  ref,
111
111
  ...props
112
112
  }) }));
113
- const InternalMenuItemGroupLabel = withContext(_ark_ui_react.Menu.ItemGroupLabel, "itemGroupLabel");
113
+ const InternalMenuItemGroupLabel = withContext(_ark_ui_react_menu.Menu.ItemGroupLabel, "itemGroupLabel");
114
114
  const MenuItemGroupLabel = ({ textStyle = "label.medium", fontWeight = "bold", children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalMenuItemGroupLabel, {
115
115
  ...props,
116
116
  asChild: true,
@@ -120,23 +120,23 @@ const MenuItemGroupLabel = ({ textStyle = "label.medium", fontWeight = "bold", c
120
120
  children
121
121
  })
122
122
  });
123
- const MenuItemGroup = withContext(_ark_ui_react.Menu.ItemGroup, "itemGroup", { baseComponent: true });
124
- const InternalMenuItem = withContext(_ark_ui_react.Menu.Item, "item", { baseComponent: true });
123
+ const MenuItemGroup = withContext(_ark_ui_react_menu.Menu.ItemGroup, "itemGroup", { baseComponent: true });
124
+ const InternalMenuItem = withContext(_ark_ui_react_menu.Menu.Item, "item", { baseComponent: true });
125
125
  const MenuItem = (0, react.forwardRef)(({ css: cssProp = {}, variant, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalMenuItem, {
126
126
  css: [itemCva.raw({ variant }), ...Array.isArray(cssProp) ? cssProp : [cssProp]],
127
127
  ...props,
128
128
  ref
129
129
  }));
130
- const MenuPositioner = withContext(_ark_ui_react.Menu.Positioner, "positioner", { baseComponent: true });
131
- const InternalMenuTriggerItem = withContext(_ark_ui_react.Menu.TriggerItem, "triggerItem", { baseComponent: true });
130
+ const MenuPositioner = withContext(_ark_ui_react_menu.Menu.Positioner, "positioner", { baseComponent: true });
131
+ const InternalMenuTriggerItem = withContext(_ark_ui_react_menu.Menu.TriggerItem, "triggerItem", { baseComponent: true });
132
132
  const MenuTriggerItem = (0, react.forwardRef)(({ css: cssProp = {}, variant, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalMenuTriggerItem, {
133
133
  css: [itemCva.raw({ variant }), ...Array.isArray(cssProp) ? cssProp : [cssProp]],
134
134
  ...props,
135
135
  ref
136
136
  }));
137
- const MenuTrigger = withContext(_ark_ui_react.Menu.Trigger, "trigger", { baseComponent: true });
138
- const MenuSeparator = withContext(_ark_ui_react.Menu.Separator, "separator", { baseComponent: true });
139
- const MenuItemText = withContext(_ark_ui_react.Menu.ItemText, "itemText", { baseComponent: true });
137
+ const MenuTrigger = withContext(_ark_ui_react_menu.Menu.Trigger, "trigger", { baseComponent: true });
138
+ const MenuSeparator = withContext(_ark_ui_react_menu.Menu.Separator, "separator", { baseComponent: true });
139
+ const MenuItemText = withContext(_ark_ui_react_menu.Menu.ItemText, "itemText", { baseComponent: true });
140
140
  //#endregion
141
141
  exports.MenuContent = MenuContent;
142
142
  exports.MenuContentStandalone = MenuContentStandalone;