@ndla/primitives 1.0.121-alpha.0 → 1.0.123-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 (216) hide show
  1. package/dist/panda.buildinfo.json +3 -3
  2. package/dist/styles.css +6 -6
  3. package/es/Accordion.mjs +7 -0
  4. package/es/Accordion.mjs.map +1 -1
  5. package/es/ArticleLists.mjs +7 -0
  6. package/es/ArticleLists.mjs.map +1 -1
  7. package/es/Badge.mjs +7 -0
  8. package/es/Badge.mjs.map +1 -1
  9. package/es/BlockQuote.mjs +7 -0
  10. package/es/BlockQuote.mjs.map +1 -1
  11. package/es/Button.mjs +7 -0
  12. package/es/Button.mjs.map +1 -1
  13. package/es/Card/Card.mjs +7 -0
  14. package/es/Card/Card.mjs.map +1 -1
  15. package/es/Checkbox.mjs +7 -0
  16. package/es/Checkbox.mjs.map +1 -1
  17. package/es/Combobox.mjs +7 -0
  18. package/es/Combobox.mjs.map +1 -1
  19. package/es/DatePicker.mjs.map +1 -1
  20. package/es/Dialog.mjs +7 -0
  21. package/es/Dialog.mjs.map +1 -1
  22. package/es/ErrorMessage/ErrorMessage.mjs +7 -0
  23. package/es/ErrorMessage/ErrorMessage.mjs.map +1 -1
  24. package/es/ExpandableBox.mjs +7 -0
  25. package/es/ExpandableBox.mjs.map +1 -1
  26. package/es/Field.mjs +7 -0
  27. package/es/Field.mjs.map +1 -1
  28. package/es/FieldErrorMessage.mjs +7 -0
  29. package/es/FieldErrorMessage.mjs.map +1 -1
  30. package/es/FieldHelper.mjs +7 -0
  31. package/es/FieldHelper.mjs.map +1 -1
  32. package/es/Figure.mjs +7 -0
  33. package/es/Figure.mjs.map +1 -1
  34. package/es/FileUpload.mjs +7 -0
  35. package/es/FileUpload.mjs.map +1 -1
  36. package/es/FramedContent.mjs +7 -0
  37. package/es/FramedContent.mjs.map +1 -1
  38. package/es/Hero.mjs +8 -0
  39. package/es/Hero.mjs.map +1 -1
  40. package/es/Image.mjs +7 -0
  41. package/es/Image.mjs.map +1 -1
  42. package/es/Input.mjs +7 -0
  43. package/es/Input.mjs.map +1 -1
  44. package/es/Label.mjs +7 -0
  45. package/es/Label.mjs.map +1 -1
  46. package/es/Layout/PageContainer.mjs.map +1 -1
  47. package/es/Layout/PageContent.mjs +7 -0
  48. package/es/Layout/PageContent.mjs.map +1 -1
  49. package/es/ListItem/ListItem.mjs +7 -0
  50. package/es/ListItem/ListItem.mjs.map +1 -1
  51. package/es/Menu.mjs +10 -3
  52. package/es/Menu.mjs.map +1 -1
  53. package/es/MessageBox.mjs +7 -0
  54. package/es/MessageBox.mjs.map +1 -1
  55. package/es/NdlaLogo.mjs +7 -0
  56. package/es/NdlaLogo.mjs.map +1 -1
  57. package/es/Pagination.mjs +7 -0
  58. package/es/Pagination.mjs.map +1 -1
  59. package/es/Popover.mjs +7 -0
  60. package/es/Popover.mjs.map +1 -1
  61. package/es/RadioGroup.mjs +7 -0
  62. package/es/RadioGroup.mjs.map +1 -1
  63. package/es/Select.mjs +7 -0
  64. package/es/Select.mjs.map +1 -1
  65. package/es/Skeleton.mjs +7 -0
  66. package/es/Skeleton.mjs.map +1 -1
  67. package/es/Slider.mjs +7 -0
  68. package/es/Slider.mjs.map +1 -1
  69. package/es/Spinner.mjs +7 -0
  70. package/es/Spinner.mjs.map +1 -1
  71. package/es/Switch.mjs +7 -0
  72. package/es/Switch.mjs.map +1 -1
  73. package/es/Table.mjs +7 -0
  74. package/es/Table.mjs.map +1 -1
  75. package/es/Tabs.mjs +7 -0
  76. package/es/Tabs.mjs.map +1 -1
  77. package/es/TagsInput.mjs +7 -0
  78. package/es/TagsInput.mjs.map +1 -1
  79. package/es/Text.mjs +7 -0
  80. package/es/Text.mjs.map +1 -1
  81. package/es/Toast.mjs +7 -0
  82. package/es/Toast.mjs.map +1 -1
  83. package/es/ToggleGroup.mjs +7 -0
  84. package/es/ToggleGroup.mjs.map +1 -1
  85. package/es/Tooltip.mjs +7 -0
  86. package/es/Tooltip.mjs.map +1 -1
  87. package/es/Tree/Tree.mjs +7 -0
  88. package/es/Tree/Tree.mjs.map +1 -1
  89. package/lib/Accordion.d.ts +1 -1
  90. package/lib/Accordion.js +7 -0
  91. package/lib/Accordion.js.map +1 -1
  92. package/lib/ArticleLists.d.ts +1 -1
  93. package/lib/ArticleLists.js +7 -0
  94. package/lib/ArticleLists.js.map +1 -1
  95. package/lib/Badge.d.ts +1 -1
  96. package/lib/Badge.js +7 -0
  97. package/lib/Badge.js.map +1 -1
  98. package/lib/BlockQuote.d.ts +1 -1
  99. package/lib/BlockQuote.js +7 -0
  100. package/lib/BlockQuote.js.map +1 -1
  101. package/lib/Button.d.ts +1 -1
  102. package/lib/Button.js +7 -0
  103. package/lib/Button.js.map +1 -1
  104. package/lib/Card/Card.d.ts +1 -1
  105. package/lib/Card/Card.js +7 -0
  106. package/lib/Card/Card.js.map +1 -1
  107. package/lib/Checkbox.d.ts +1 -1
  108. package/lib/Checkbox.js +7 -0
  109. package/lib/Checkbox.js.map +1 -1
  110. package/lib/Combobox.d.ts +1 -1
  111. package/lib/Combobox.js +7 -0
  112. package/lib/Combobox.js.map +1 -1
  113. package/lib/DatePicker.js.map +1 -1
  114. package/lib/Dialog.d.ts +1 -1
  115. package/lib/Dialog.js +7 -0
  116. package/lib/Dialog.js.map +1 -1
  117. package/lib/ErrorMessage/ErrorMessage.d.ts +1 -1
  118. package/lib/ErrorMessage/ErrorMessage.js +7 -0
  119. package/lib/ErrorMessage/ErrorMessage.js.map +1 -1
  120. package/lib/ExpandableBox.d.ts +1 -1
  121. package/lib/ExpandableBox.js +7 -0
  122. package/lib/ExpandableBox.js.map +1 -1
  123. package/lib/Field.js +7 -0
  124. package/lib/Field.js.map +1 -1
  125. package/lib/FieldErrorMessage.d.ts +1 -1
  126. package/lib/FieldErrorMessage.js +7 -0
  127. package/lib/FieldErrorMessage.js.map +1 -1
  128. package/lib/FieldHelper.d.ts +1 -1
  129. package/lib/FieldHelper.js +7 -0
  130. package/lib/FieldHelper.js.map +1 -1
  131. package/lib/Figure.d.ts +1 -1
  132. package/lib/Figure.js +7 -0
  133. package/lib/Figure.js.map +1 -1
  134. package/lib/FileUpload.d.ts +1 -1
  135. package/lib/FileUpload.js +7 -0
  136. package/lib/FileUpload.js.map +1 -1
  137. package/lib/FramedContent.d.ts +1 -1
  138. package/lib/FramedContent.js +7 -0
  139. package/lib/FramedContent.js.map +1 -1
  140. package/lib/Hero.d.ts +11 -1
  141. package/lib/Hero.js +8 -0
  142. package/lib/Hero.js.map +1 -1
  143. package/lib/Image.js +7 -0
  144. package/lib/Image.js.map +1 -1
  145. package/lib/Input.d.ts +1 -1
  146. package/lib/Input.js +7 -0
  147. package/lib/Input.js.map +1 -1
  148. package/lib/Label.d.ts +1 -1
  149. package/lib/Label.js +7 -0
  150. package/lib/Label.js.map +1 -1
  151. package/lib/Layout/PageContainer.d.ts +1 -1
  152. package/lib/Layout/PageContainer.js +7 -0
  153. package/lib/Layout/PageContainer.js.map +1 -1
  154. package/lib/Layout/PageContent.d.ts +1 -1
  155. package/lib/Layout/PageContent.js +7 -0
  156. package/lib/Layout/PageContent.js.map +1 -1
  157. package/lib/ListItem/ListItem.d.ts +1 -1
  158. package/lib/ListItem/ListItem.js +7 -0
  159. package/lib/ListItem/ListItem.js.map +1 -1
  160. package/lib/Menu.d.ts +4 -4
  161. package/lib/Menu.js +10 -3
  162. package/lib/Menu.js.map +1 -1
  163. package/lib/MessageBox.d.ts +1 -1
  164. package/lib/MessageBox.js +7 -0
  165. package/lib/MessageBox.js.map +1 -1
  166. package/lib/NdlaLogo.js +7 -0
  167. package/lib/NdlaLogo.js.map +1 -1
  168. package/lib/Pagination.d.ts +1 -1
  169. package/lib/Pagination.js +7 -0
  170. package/lib/Pagination.js.map +1 -1
  171. package/lib/Popover.d.ts +1 -1
  172. package/lib/Popover.js +7 -0
  173. package/lib/Popover.js.map +1 -1
  174. package/lib/RadioGroup.d.ts +1 -1
  175. package/lib/RadioGroup.js +7 -0
  176. package/lib/RadioGroup.js.map +1 -1
  177. package/lib/Select.d.ts +1 -1
  178. package/lib/Select.js +7 -0
  179. package/lib/Select.js.map +1 -1
  180. package/lib/Skeleton.d.ts +1 -1
  181. package/lib/Skeleton.js +7 -0
  182. package/lib/Skeleton.js.map +1 -1
  183. package/lib/Slider.d.ts +1 -1
  184. package/lib/Slider.js +7 -0
  185. package/lib/Slider.js.map +1 -1
  186. package/lib/Spinner.d.ts +1 -1
  187. package/lib/Spinner.js +7 -0
  188. package/lib/Spinner.js.map +1 -1
  189. package/lib/Switch.d.ts +2 -2
  190. package/lib/Switch.js +7 -0
  191. package/lib/Switch.js.map +1 -1
  192. package/lib/Table.d.ts +1 -1
  193. package/lib/Table.js +7 -0
  194. package/lib/Table.js.map +1 -1
  195. package/lib/Tabs.d.ts +2 -2
  196. package/lib/Tabs.js +7 -0
  197. package/lib/Tabs.js.map +1 -1
  198. package/lib/TagsInput.d.ts +1 -1
  199. package/lib/TagsInput.js +7 -0
  200. package/lib/TagsInput.js.map +1 -1
  201. package/lib/Text.d.ts +1 -1
  202. package/lib/Text.js +7 -0
  203. package/lib/Text.js.map +1 -1
  204. package/lib/Toast.d.ts +1 -1
  205. package/lib/Toast.js +7 -0
  206. package/lib/Toast.js.map +1 -1
  207. package/lib/ToggleGroup.d.ts +1 -1
  208. package/lib/ToggleGroup.js +7 -0
  209. package/lib/ToggleGroup.js.map +1 -1
  210. package/lib/Tooltip.d.ts +1 -1
  211. package/lib/Tooltip.js +7 -0
  212. package/lib/Tooltip.js.map +1 -1
  213. package/lib/Tree/Tree.d.ts +1 -1
  214. package/lib/Tree/Tree.js +7 -0
  215. package/lib/Tree/Tree.js.map +1 -1
  216. package/package.json +3 -3
@@ -442,11 +442,11 @@
442
442
  "color]___[value:icon.error]___[cond:& svg",
443
443
  "color]___[value:text.default]___[cond:_hover",
444
444
  "color]___[value:icon.default]___[cond:_hover<___>& svg",
445
- "background]___[value:surface.errorSubtle.hover]___[cond:_hover",
445
+ "background]___[value:surface.dangerSubtle.hover]___[cond:_hover",
446
446
  "color]___[value:text.default]___[cond:_highlighted",
447
447
  "color]___[value:icon.default]___[cond:_highlighted<___>& svg",
448
- "background]___[value:surface.errorSubtle.hover]___[cond:_highlighted",
449
- "background]___[value:surface.errorSubtle.active]___[cond:_active",
448
+ "background]___[value:surface.dangerSubtle.hover]___[cond:_highlighted",
449
+ "background]___[value:surface.dangerSubtle.active]___[cond:_active",
450
450
  "minWidth]___[value:surface.xxsmall",
451
451
  "padding]___[value:3xsmall",
452
452
  "boxShadow]___[value:small",
package/dist/styles.css CHANGED
@@ -1601,8 +1601,8 @@
1601
1601
  padding: var(--spacing-medium);
1602
1602
  }
1603
1603
 
1604
- .highlighted\:bg_surface\.errorSubtle\.hover[data-highlighted] {
1605
- background: var(--colors-surface-error-subtle-hover);
1604
+ .highlighted\:bg_surface\.dangerSubtle\.hover[data-highlighted] {
1605
+ background: var(--colors-surface-danger-subtle-hover);
1606
1606
  }
1607
1607
 
1608
1608
  .open\:anim_fade-shift-in_0\.2s_ease-out:is([open], [data-open], [data-state="open"], :popover-open) {
@@ -2335,8 +2335,8 @@
2335
2335
  background: var(--colors-surface-hover);
2336
2336
  }
2337
2337
 
2338
- .hover\:bg_surface\.errorSubtle\.hover:is(:hover, [data-hover]) {
2339
- background: var(--colors-surface-error-subtle-hover);
2338
+ .hover\:bg_surface\.dangerSubtle\.hover:is(:hover, [data-hover]) {
2339
+ background: var(--colors-surface-danger-subtle-hover);
2340
2340
  }
2341
2341
 
2342
2342
  .hover\:td_none:is(:hover, [data-hover]) {
@@ -2427,8 +2427,8 @@
2427
2427
  background: var(--colors-surface-active);
2428
2428
  }
2429
2429
 
2430
- .active\:bg_surface\.errorSubtle\.active:is(:active, [data-active]) {
2431
- background: var(--colors-surface-error-subtle-active);
2430
+ .active\:bg_surface\.dangerSubtle\.active:is(:active, [data-active]) {
2431
+ background: var(--colors-surface-danger-subtle-active);
2432
2432
  }
2433
2433
 
2434
2434
  .active\:bd-c_stroke\.default:is(:active, [data-active]) {
package/es/Accordion.mjs CHANGED
@@ -4,6 +4,13 @@ import { createStyleContext } from "@ndla/styled-system/jsx";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
 
6
6
  //#region src/Accordion.tsx
7
+ /**
8
+ * Copyright (c) 2024-present, NDLA.
9
+ *
10
+ * This source code is licensed under the GPLv3 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
7
14
  const { withProvider, withContext } = createStyleContext(sva({
8
15
  slots: accordionAnatomy.keys(),
9
16
  base: {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.mjs","names":[],"sources":["../src/Accordion.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 { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport type { RefAttributes } from \"react\";\nimport { Accordion, accordionAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\n\nconst accordionRecipe = sva({\n slots: accordionAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n itemTrigger: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n background: \"surface.default\",\n cursor: \"pointer\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n transitionProperty: \"background, border-color, border, border-radius\",\n _closed: {\n transitionProperty: \"background, border-color, border, border-radius\",\n },\n _disabled: {\n cursor: \"not-allowed\",\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n _hover: {\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n },\n },\n },\n itemIndicator: {\n color: \"icon.strong\",\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _open: {\n transform: \"rotate(180deg)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n itemContent: {\n overflow: \"hidden\",\n // TODO: Is this needed?\n transitionProperty: \"padding-bottom\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"default\",\n paddingBlock: \"xsmall\",\n paddingInline: \"small\",\n _open: {\n animation: \"collapse-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"collapse-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n item: {\n width: \"100%\",\n },\n },\n defaultVariants: {\n variant: \"bordered\",\n },\n variants: {\n variant: {\n clean: {},\n bordered: {\n itemTrigger: {\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n width: \"100%\",\n borderRadius: \"xsmall\",\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n boxShadowColor: \"stroke.hover\",\n },\n _open: {\n background: \"surface.actionSubtle.active\",\n boxShadowColor: \"stroke.default\",\n borderBottomRadius: \"sharp\",\n },\n _focusVisible: {\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n boxShadow: \"inset 0 0 0 3px var(--shadow-color)\",\n },\n },\n itemContent: {\n borderBottomRadius: \"xsmall\",\n borderWidth: \"0 1px 1px\",\n borderStyle: \"solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(accordionRecipe);\n\nexport type AccordionVariantProps = NonNullable<RecipeVariantProps<typeof accordionRecipe>>;\n\nexport interface AccordionRootProps\n extends StyledProps, Accordion.RootProps, RefAttributes<HTMLDivElement>, AccordionVariantProps {}\n\nexport const InternalAccordionRoot = withProvider(Accordion.Root, \"root\", { baseComponent: true });\n\nexport const AccordionRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: AccordionRootProps) => (\n <InternalAccordionRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const AccordionItemContent = withContext(Accordion.ItemContent, \"itemContent\", { baseComponent: true });\n\nexport const AccordionItemIndicator = withContext(Accordion.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport interface AccordionItemProps extends StyledProps, Accordion.ItemProps {}\n\nexport const AccordionItem = withContext(Accordion.Item, \"item\", { baseComponent: true });\n\nexport const AccordionItemTrigger = withContext(Accordion.ItemTrigger, \"itemTrigger\", { baseComponent: true });\n"],"mappings":";;;;;;AA6HA,MAAM,EAAE,cAAc,gBAAgB,mBA/Gd,IAAI;CAC1B,OAAO,iBAAiB,MAAM;CAC9B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACD,aAAa;GACX,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,YAAY;GACZ,QAAQ;GACR,oBAAoB;GACpB,0BAA0B;GAC1B,oBAAoB;GACpB,SAAS,EACP,oBAAoB,mDACrB;GACD,WAAW;IACT,QAAQ;IACR,YAAY;IACZ,gBAAgB;IAChB,OAAO;IACP,QAAQ;KACN,YAAY;KACZ,gBAAgB;KAChB,OAAO;KACR;IACF;GACF;EACD,eAAe;GACb,OAAO;GACP,iBAAiB;GACjB,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,OAAO,EACL,WAAW,kBACZ;GACD,eAAe;IACb,YAAY;IACZ,oBAAoB;IACrB;GACF;EACD,aAAa;GACX,UAAU;GAEV,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,cAAc;GACd,eAAe;GACf,OAAO;IACL,WAAW;IACX,eAAe,EACb,WAAW,QACZ;IACF;GACD,SAAS;IACP,WAAW;IACX,eAAe,EACb,WAAW,QACZ;IACF;GACF;EACD,MAAM,EACJ,OAAO,QACR;EACF;CACD,iBAAiB,EACf,SAAS,YACV;CACD,UAAU,EACR,SAAS;EACP,OAAO,EAAE;EACT,UAAU;GACR,aAAa;IACX,eAAe;IACf,cAAc;IACd,OAAO;IACP,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,QAAQ;KACN,YAAY;KACZ,gBAAgB;KACjB;IACD,OAAO;KACL,YAAY;KACZ,gBAAgB;KAChB,oBAAoB;KACrB;IACD,eAAe;KACb,SAAS;KACT,gBAAgB;KAChB,WAAW;KACZ;IACF;GACD,aAAa;IACX,oBAAoB;IACpB,aAAa;IACb,aAAa;IACb,aAAa;IACd;GACF;EACF,EACF;CACF,CAAC,CAEuE;AAOzE,MAAa,wBAAwB,aAAa,UAAU,MAAM,QAAQ,EAAE,eAAe,MAAM,CAAC;AAElG,MAAa,iBAAiB,EAAE,YAAY,MAAM,gBAAgB,MAAM,GAAG,YACzE,oBAAC;CAAiC;CAA0B;CAAe,GAAI;EAAS;AAG1F,MAAa,uBAAuB,YAAY,UAAU,aAAa,eAAe,EAAE,eAAe,MAAM,CAAC;AAE9G,MAAa,yBAAyB,YAAY,UAAU,eAAe,iBAAiB,EAAE,eAAe,MAAM,CAAC;AAIpH,MAAa,gBAAgB,YAAY,UAAU,MAAM,QAAQ,EAAE,eAAe,MAAM,CAAC;AAEzF,MAAa,uBAAuB,YAAY,UAAU,aAAa,eAAe,EAAE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Accordion.mjs","names":[],"sources":["../src/Accordion.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 { Accordion, accordionAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport type { RefAttributes } from \"react\";\n\nconst accordionRecipe = sva({\n slots: accordionAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n itemTrigger: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n background: \"surface.default\",\n cursor: \"pointer\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n transitionProperty: \"background, border-color, border, border-radius\",\n _closed: {\n transitionProperty: \"background, border-color, border, border-radius\",\n },\n _disabled: {\n cursor: \"not-allowed\",\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n _hover: {\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n },\n },\n },\n itemIndicator: {\n color: \"icon.strong\",\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _open: {\n transform: \"rotate(180deg)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n itemContent: {\n overflow: \"hidden\",\n // TODO: Is this needed?\n transitionProperty: \"padding-bottom\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"default\",\n paddingBlock: \"xsmall\",\n paddingInline: \"small\",\n _open: {\n animation: \"collapse-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"collapse-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n item: {\n width: \"100%\",\n },\n },\n defaultVariants: {\n variant: \"bordered\",\n },\n variants: {\n variant: {\n clean: {},\n bordered: {\n itemTrigger: {\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n width: \"100%\",\n borderRadius: \"xsmall\",\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n boxShadowColor: \"stroke.hover\",\n },\n _open: {\n background: \"surface.actionSubtle.active\",\n boxShadowColor: \"stroke.default\",\n borderBottomRadius: \"sharp\",\n },\n _focusVisible: {\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n boxShadow: \"inset 0 0 0 3px var(--shadow-color)\",\n },\n },\n itemContent: {\n borderBottomRadius: \"xsmall\",\n borderWidth: \"0 1px 1px\",\n borderStyle: \"solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(accordionRecipe);\n\nexport type AccordionVariantProps = NonNullable<RecipeVariantProps<typeof accordionRecipe>>;\n\nexport interface AccordionRootProps\n extends StyledProps, Accordion.RootProps, RefAttributes<HTMLDivElement>, AccordionVariantProps {}\n\nexport const InternalAccordionRoot = withProvider(Accordion.Root, \"root\", { baseComponent: true });\n\nexport const AccordionRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: AccordionRootProps) => (\n <InternalAccordionRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const AccordionItemContent = withContext(Accordion.ItemContent, \"itemContent\", { baseComponent: true });\n\nexport const AccordionItemIndicator = withContext(Accordion.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport interface AccordionItemProps extends StyledProps, Accordion.ItemProps {}\n\nexport const AccordionItem = withContext(Accordion.Item, \"item\", { baseComponent: true });\n\nexport const AccordionItemTrigger = withContext(Accordion.ItemTrigger, \"itemTrigger\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;;AA6HA,MAAM,EAAE,cAAc,gBAAgB,mBA/Gd,IAAI;CAC1B,OAAO,iBAAiB,MAAM;CAC9B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACD,aAAa;GACX,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,YAAY;GACZ,QAAQ;GACR,oBAAoB;GACpB,0BAA0B;GAC1B,oBAAoB;GACpB,SAAS,EACP,oBAAoB,mDACrB;GACD,WAAW;IACT,QAAQ;IACR,YAAY;IACZ,gBAAgB;IAChB,OAAO;IACP,QAAQ;KACN,YAAY;KACZ,gBAAgB;KAChB,OAAO;KACR;IACF;GACF;EACD,eAAe;GACb,OAAO;GACP,iBAAiB;G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,6 +5,13 @@ import { jsx } from "react/jsx-runtime";
5
5
  import { createContext, forwardRef, useContext, useId, useMemo } from "react";
6
6
 
7
7
  //#region src/ArticleLists.tsx
8
+ /**
9
+ * Copyright (c) 2024-present, NDLA.
10
+ *
11
+ * This source code is licensed under the GPLv3 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ */
8
15
  const orderedListRecipe = cva({
9
16
  base: {
10
17
  paddingInlineStart: "large",
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleLists.mjs","names":[],"sources":["../src/ArticleLists.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 { HTMLStyledProps, RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { createContext, type CSSProperties, forwardRef, useContext, useId, useMemo } from \"react\";\n\nconst orderedListRecipe = cva({\n base: {\n paddingInlineStart: \"large\",\n \"& > li\": {\n marginBlock: \"small\",\n _before: {\n position: \"absolute\",\n transform: \"translateX(calc(-100% - token(spacing.small)))\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n },\n defaultVariants: {\n variant: \"numbers\",\n },\n variants: {\n variant: {\n numbers: {\n /** We utilize a CSS variable for the counter name to correctly reset counters when nested inside a letter list.\n * This way, the nested number list won't pick up on any other counters named \"numbers\" higher up in the DOM tree.\n * This fixes the following scenario\n * ol (numbers) -> 1.\n * ol(letters) -> A.\n * ol (numbers) -> 1. (Without the CSS variable, this would be 1.1)\n */\n counterReset: \"var(--counter-name) var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"var(--counter-name)\",\n _before: {\n content: `counters(var(--counter-name), \".\") \". \"`,\n },\n // If a nested OL is not a letters variant, it's a numbers variant. Keep increasing the margin to account for wider numbers.\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"small\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"large\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"xxlarge\",\n },\n },\n },\n },\n },\n letters: {\n counterReset: \"letters var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"letters\",\n _before: {\n content: `counter(letters, upper-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-roman) \". \"`,\n },\n },\n },\n },\n },\n },\n },\n});\n\nexport type OrderedListVariantProps = NonNullable<RecipeVariantProps<typeof orderedListRecipe>>;\n\nexport interface OrderedListProps extends StyledProps, HTMLArkProps<\"ol\">, OrderedListVariantProps {}\n\nconst StyledOrderedList = styled(ark.ol, {}, { baseComponent: true });\n\nconst ListContext = createContext<\"numbers\" | \"letters\" | undefined>(undefined);\n\nconst useCurrentListContext = () => {\n const ctx = useContext(ListContext);\n return ctx;\n};\n\nexport const OrderedList = forwardRef<HTMLOListElement, OrderedListProps>(\n ({ variant = \"numbers\", css: cssProp, start, ...props }, ref) => {\n const counterId = useId();\n const currentContext = useCurrentListContext();\n\n const style = useMemo(() => {\n const css: Record<string, any> = { \"--start\": start ? start - 1 : 0 };\n if (variant !== currentContext) {\n css[\"--counter-name\"] = counterId;\n }\n return css as CSSProperties;\n }, [start, variant, currentContext, counterId]);\n\n return (\n <ListContext.Provider value={variant ?? \"numbers\"}>\n <StyledOrderedList\n data-embed-type=\"ordered-list\"\n data-variant={variant}\n start={start}\n type={variant === \"letters\" ? \"A\" : undefined}\n css={css.raw(orderedListRecipe.raw({ variant }), cssProp)}\n style={style}\n ref={ref}\n {...props}\n />\n </ListContext.Provider>\n );\n },\n);\n\nexport interface UnOrderedListProps extends StyledProps, HTMLArkProps<\"ul\"> {}\n\nexport const StyledUnOrderedList = styled(\"ul\", {\n base: {\n listStyle: \"revert\",\n marginInlineStart: \"medium\",\n paddingInlineStart: \"small\",\n \"& ul\": {\n marginInlineStart: \"0\",\n },\n \"& li\": {\n marginBlock: \"small\",\n paddingInlineStart: \"small\",\n _marker: {\n color: \"icon.strong\",\n },\n\n \"& > ol\": {\n marginInlineStart: \"0 !important\",\n },\n },\n\n listStyleType: \"disc\",\n \"& > li > ul\": {\n listStyleType: \"circle\",\n \"& > li > ul\": {\n listStyleType: \"square\",\n },\n },\n },\n});\n\nexport const UnOrderedList = forwardRef<HTMLUListElement, UnOrderedListProps>((props, ref) => {\n const counterId = useId();\n\n const style = useMemo(\n () =>\n ({\n \"--counter-name\": counterId,\n }) as CSSProperties,\n [counterId],\n );\n\n return <StyledUnOrderedList ref={ref} style={style} {...props} />;\n});\n\nexport const DefinitionList = styled(\"dl\", {\n base: {\n \"& dt\": {\n fontWeight: \"bold\",\n },\n \"& dd\": {\n marginInlineStart: \"medium\",\n },\n },\n});\n\nexport type DefinitionListProps = HTMLStyledProps<\"dl\">;\n"],"mappings":";;;;;;;AAcA,MAAM,oBAAoB,IAAI;CAC5B,MAAM;EACJ,oBAAoB;EACpB,UAAU;GACR,aAAa;GACb,SAAS;IACP,UAAU;IACV,WAAW;IACX,oBAAoB;IACrB;GACF;EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,SAAS;GAQP,cAAc;GACd,UAAU;IACR,kBAAkB;IAClB,SAAS,EACP,SAAS,2CACV;IAED,6CAA6C;KAC3C,oBAAoB;KACpB,6CAA6C;MAC3C,oBAAoB;MACpB,6CAA6C,EAC3C,oBAAoB,WACrB;MACF;KACF;IACF;GACF;EACD,SAAS;GACP,cAAc;GACd,UAAU;IACR,kBAAkB;IAClB,SAAS,EACP,SAAS,sCACV;IACD,uCAAuC;KACrC,SAAS,EACP,SAAS,sCACV;KACD,uCAAuC,EACrC,SAAS,EACP,SAAS,sCACV,EACF;KACF;IACF;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AAM;CACJ,QAAQ,EACN,YAAY,QACb;CACD,QAAQ,EACN,mBAAmB,UACpB;CACF,EACF,CAAC"}
1
+ {"version":3,"file":"ArticleLists.mjs","names":[],"sources":["../src/ArticleLists.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 { HTMLStyledProps, RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { createContext, type CSSProperties, forwardRef, useContext, useId, useMemo } from \"react\";\n\nconst orderedListRecipe = cva({\n base: {\n paddingInlineStart: \"large\",\n \"& > li\": {\n marginBlock: \"small\",\n _before: {\n position: \"absolute\",\n transform: \"translateX(calc(-100% - token(spacing.small)))\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n },\n defaultVariants: {\n variant: \"numbers\",\n },\n variants: {\n variant: {\n numbers: {\n /** We utilize a CSS variable for the counter name to correctly reset counters when nested inside a letter list.\n * This way, the nested number list won't pick up on any other counters named \"numbers\" higher up in the DOM tree.\n * This fixes the following scenario\n * ol (numbers) -> 1.\n * ol(letters) -> A.\n * ol (numbers) -> 1. (Without the CSS variable, this would be 1.1)\n */\n counterReset: \"var(--counter-name) var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"var(--counter-name)\",\n _before: {\n content: `counters(var(--counter-name), \".\") \". \"`,\n },\n // If a nested OL is not a letters variant, it's a numbers variant. Keep increasing the margin to account for wider numbers.\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"small\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"large\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"xxlarge\",\n },\n },\n },\n },\n },\n letters: {\n counterReset: \"letters var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"letters\",\n _before: {\n content: `counter(letters, upper-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-roman) \". \"`,\n },\n },\n },\n },\n },\n },\n },\n});\n\nexport type OrderedListVariantProps = NonNullable<RecipeVariantProps<typeof orderedListRecipe>>;\n\nexport interface OrderedListProps extends StyledProps, HTMLArkProps<\"ol\">, OrderedListVariantProps {}\n\nconst StyledOrderedList = styled(ark.ol, {}, { baseComponent: true });\n\nconst ListContext = createContext<\"numbers\" | \"letters\" | undefined>(undefined);\n\nconst useCurrentListContext = () => {\n const ctx = useContext(ListContext);\n return ctx;\n};\n\nexport const OrderedList = forwardRef<HTMLOListElement, OrderedListProps>(\n ({ variant = \"numbers\", css: cssProp, start, ...props }, ref) => {\n const counterId = useId();\n const currentContext = useCurrentListContext();\n\n const style = useMemo(() => {\n const css: Record<string, any> = { \"--start\": start ? start - 1 : 0 };\n if (variant !== currentContext) {\n css[\"--counter-name\"] = counterId;\n }\n return css as CSSProperties;\n }, [start, variant, currentContext, counterId]);\n\n return (\n <ListContext.Provider value={variant ?? \"numbers\"}>\n <StyledOrderedList\n data-embed-type=\"ordered-list\"\n data-variant={variant}\n start={start}\n type={variant === \"letters\" ? \"A\" : undefined}\n css={css.raw(orderedListRecipe.raw({ variant }), cssProp)}\n style={style}\n ref={ref}\n {...props}\n />\n </ListContext.Provider>\n );\n },\n);\n\nexport interface UnOrderedListProps extends StyledProps, HTMLArkProps<\"ul\"> {}\n\nexport const StyledUnOrderedList = styled(\"ul\", {\n base: {\n listStyle: \"revert\",\n marginInlineStart: \"medium\",\n paddingInlineStart: \"small\",\n \"& ul\": {\n marginInlineStart: \"0\",\n },\n \"& li\": {\n marginBlock: \"small\",\n paddingInlineStart: \"small\",\n _marker: {\n color: \"icon.strong\",\n },\n\n \"& > ol\": {\n marginInlineStart: \"0 !important\",\n },\n },\n\n listStyleType: \"disc\",\n \"& > li > ul\": {\n listStyleType: \"circle\",\n \"& > li > ul\": {\n listStyleType: \"square\",\n },\n },\n },\n});\n\nexport const UnOrderedList = forwardRef<HTMLUListElement, UnOrderedListProps>((props, ref) => {\n const counterId = useId();\n\n const style = useMemo(\n () =>\n ({\n \"--counter-name\": counterId,\n }) as CSSProperties,\n [counterId],\n );\n\n return <StyledUnOrderedList ref={ref} style={style} {...props} />;\n});\n\nexport const DefinitionList = styled(\"dl\", {\n base: {\n \"& dt\": {\n fontWeight: \"bold\",\n },\n \"& dd\": {\n marginInlineStart: \"medium\",\n },\n },\n});\n\nexport type DefinitionListProps = HTMLStyledProps<\"dl\">;\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,oBAAoB,IAAI;CAC5B,MAAM;EACJ,oBAAoB;EACpB,UAAU;GACR,aAAa;GACb,SAAS;IACP,UAAU;IACV,WAAW;IACX,oBAAoB;IACrB;GACF;EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,SAAS;GAQP,cAAc;GACd,UAAU;IACR,kBAAkB;IAClB,SAAS,EACP,SAAS,2CACV;IAED,6CAA6C;KAC3C,oBAAoB;KACpB,6CAA6C;MAC3C,oBAAoB;MACpB,6CAA6C,EAC3C,oBAAoB,WACrB;MACF;KACF;IACF;GACF;EACD,SAAS;GACP,cAAc;GACd,UAAU;IACR,kBAAkB;IAClB,SAAS,EACP,SAAS,sCACV;IACD,uCAAuC;KACrC,SAAS,EACP,SAAS,sCACV;KACD,uCAAuC,EACrC,SAAS,EACP,SAAS,sCACV,EACF;KACF;IACF;GACF;EACF,EACF;CACF,CAAC;AAMF,MAAM,oBAAoB,OAAO,IAAI,IAAI,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAErE,MAAM,cAAc,cAAiD,OAAU;AAE/E,MAAM,8BAA8B;AAElC,QADY,WAAW,YAAY;;AAIrC,MAAa,cAAc,YACxB,EAAE,UAAU,WAAW,KAAK,SAAS,OAAO,GAAG,SAAS,QAAQ;CAC/D,MAAM,YAAY,OAAO;CACzB,MAAM,iBAAiB,uBAAuB;CAE9C,MAAM,QAAQ,cAAc;EAC1B,MAAM,MAA2B,EAAE,WAAW,QAAQ,QAAQ,IAAI,GAAG;AACrE,MAAI,YAAY,eACd,KAAI,oBAAoB;AAE1B,SAAO;IACN;EAAC;EAAO;EAAS;EAAgB;EAAU,CAAC;AAE/C,QACE,oBAAC,YAAY;EAAS,OAAO,WAAW;YACtC,oBAAC;GACC,mBAAgB;GAChB,gBAAc;GACP;GACP,MAAM,YAAY,YAAY,MAAM;GACpC,KAAK,IAAI,IAAI,kBAAkB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;GAClD;GACF;GACL,GAAI;IACJ;GACmB;EAG5B;AAID,MAAa,sBAAsB,OAAO,MAAM,EAC9C,MAAM;CACJ,WAAW;CACX,mBAAmB;CACnB,oBAAoB;CACpB,QAAQ,EACN,mBAAmB,KACpB;CACD,QAAQ;EACN,aAAa;EACb,oBAAoB;EACpB,SAAS,EACP,OAAO,eACR;EAED,UAAU,EACR,mBAAmB,gBACpB;EACF;CAED,eAAe;CACf,eAAe;EACb,eAAe;EACf,eAAe,EACb,eAAe,UAChB;EACF;CACF,EACF,CAAC;AAEF,MAAa,gBAAgB,YAAkD,OAAO,QAAQ;CAC5F,MAAM,YAAY,OAAO;AAUzB,QAAO,oBAAC;EAAyB;EAAK,OARxB,eAET,EACC,kBAAkB,WACnB,GACH,CAAC,UAAU,CACZ;EAEmD,GAAI;GAAS;EACjE;AAEF,MAAa,iBAAiB,OAAO,MAAM,EACzC,MAAM;CACJ,QAAQ,EACN,YAAY,QACb;CACD,QAAQ,EACN,mBAAmB,UACpB;CACF,EACF,CAAC"}
package/es/Badge.mjs CHANGED
@@ -5,6 +5,13 @@ import { jsx } from "react/jsx-runtime";
5
5
  import { forwardRef } from "react";
6
6
 
7
7
  //#region src/Badge.tsx
8
+ /**
9
+ * Copyright (c) 2024-present, NDLA.
10
+ *
11
+ * This source code is licensed under the GPLv3 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ */
8
15
  const badgeRecipe = cva({
9
16
  base: {
10
17
  paddingInline: "xsmall",
package/es/Badge.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.mjs","names":[],"sources":["../src/Badge.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 { StyledProps } from \"@ndla/styled-system/types\";\nimport { type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { forwardRef } from \"react\";\n\nconst badgeRecipe = cva({\n base: {\n paddingInline: \"xsmall\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n width: \"fit-content\",\n color: \"text.default\",\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n size: \"medium\",\n },\n variants: {\n size: {\n small: {\n textStyle: \"label.small\",\n },\n medium: {\n textStyle: \"label.medium\",\n },\n },\n colorTheme: {\n brand1: {\n backgroundColor: \"surface.brand.1.moderate\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.moderate\",\n borderColor: \"surface.brand.2.strong\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3.subtle\",\n borderColor: \"surface.brand.3.strong\",\n },\n neutral: {\n backgroundColor: \"surface.infoSubtle\",\n borderColor: \"stroke.info\",\n },\n danger: {\n backgroundColor: \"surface.dangerSubtle\",\n borderColor: \"surface.danger\",\n },\n success: {\n backgroundColor: \"surface.successSubtle\",\n borderColor: \"surface.success\",\n },\n warning: {\n backgroundColor: \"surface.warningSubtle\",\n borderColor: \"surface.warning\",\n },\n },\n },\n});\n\nexport type BadgeVariantProps = NonNullable<RecipeVariantProps<typeof badgeRecipe>>;\n\nexport type BadgeVariant = NonNullable<BadgeVariantProps>[\"colorTheme\"];\n\nexport interface BadgeProps extends StyledProps, HTMLArkProps<\"div\">, BadgeVariantProps {}\n\nconst StyledBadge = styled(ark.div, {}, { baseComponent: true });\n\nexport const Badge = forwardRef<HTMLDivElement, BadgeProps>(({ colorTheme, size, css: cssProp, ...props }, ref) => (\n <StyledBadge css={css.raw(badgeRecipe.raw({ colorTheme, size }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;AAcA,MAAM,cAAc,IAAI;CACtB,MAAM;EACJ,eAAe;EACf,cAAc;EACd,QAAQ;EACR,OAAO;EACP,OAAO;EACR;CACD,iBAAiB;EACf,YAAY;EACZ,MAAM;EACP;CACD,UAAU;EACR,MAAM;GACJ,OAAO,EACL,WAAW,eACZ;GACD,QAAQ,EACN,WAAW,gBACZ;GACF;EACD,YAAY;GACV,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,SAAS;IACP,iBAAiB;IACjB,aAAa;IACd;GACD,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,SAAS;IACP,iBAAiB;IACjB,aAAa;IACd;GACD,SAAS;IACP,iBAAiB;IACjB,aAAa;IACd;GACF;EACF;CACF,CAAC;AAQF,MAAM,cAAc,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAEhE,MAAa,QAAQ,YAAwC,EAAE,YAAY,MAAM,KAAK,SAAS,GAAG,SAAS,QACzG,oBAAC;CAAY,KAAK,IAAI,IAAI,YAAY,IAAI;EAAE;EAAY;EAAM,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;EAAO,CAClG"}
1
+ {"version":3,"file":"Badge.mjs","names":[],"sources":["../src/Badge.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, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst badgeRecipe = cva({\n base: {\n paddingInline: \"xsmall\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n width: \"fit-content\",\n color: \"text.default\",\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n size: \"medium\",\n },\n variants: {\n size: {\n small: {\n textStyle: \"label.small\",\n },\n medium: {\n textStyle: \"label.medium\",\n },\n },\n colorTheme: {\n brand1: {\n backgroundColor: \"surface.brand.1.moderate\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.moderate\",\n borderColor: \"surface.brand.2.strong\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3.subtle\",\n borderColor: \"surface.brand.3.strong\",\n },\n neutral: {\n backgroundColor: \"surface.infoSubtle\",\n borderColor: \"stroke.info\",\n },\n danger: {\n backgroundColor: \"surface.dangerSubtle\",\n borderColor: \"surface.danger\",\n },\n success: {\n backgroundColor: \"surface.successSubtle\",\n borderColor: \"surface.success\",\n },\n warning: {\n backgroundColor: \"surface.warningSubtle\",\n borderColor: \"surface.warning\",\n },\n },\n },\n});\n\nexport type BadgeVariantProps = NonNullable<RecipeVariantProps<typeof badgeRecipe>>;\n\nexport type BadgeVariant = NonNullable<BadgeVariantProps>[\"colorTheme\"];\n\nexport interface BadgeProps extends StyledProps, HTMLArkProps<\"div\">, BadgeVariantProps {}\n\nconst StyledBadge = styled(ark.div, {}, { baseComponent: true });\n\nexport const Badge = forwardRef<HTMLDivElement, BadgeProps>(({ colorTheme, size, css: cssProp, ...props }, ref) => (\n <StyledBadge css={css.raw(badgeRecipe.raw({ colorTheme, size }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,cAAc,IAAI;CACtB,MAAM;EACJ,eAAe;EACf,cAAc;EACd,QAAQ;EACR,OAAO;EACP,OAAO;EACR;CACD,iBAAiB;EACf,YAAY;EACZ,MAAM;EACP;CACD,UAAU;EACR,MAAM;GACJ,OAAO,EACL,WAAW,eACZ;GACD,QAAQ,EACN,WAAW,gBACZ;GACF;EACD,YAAY;GACV,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,SAAS;IACP,iBAAiB;IACjB,aAAa;IACd;GACD,QAAQ;IACN,iBAAiB;IACjB,aAAa;IACd;GACD,SAAS;IACP,iBAAiB;IACjB,aAAa;IACd;GACD,SAAS;IACP,iBAAiB;IACjB,aAAa;IACd;GACF;EACF;CACF,CAAC;AAQF,MAAM,cAAc,OAAO,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAEhE,MAAa,QAAQ,YAAwC,EAAE,YAAY,MAAM,KAAK,SAAS,GAAG,SAAS,QACzG,oBAAC;CAAY,KAAK,IAAI,IAAI,YAAY,IAAI;EAAE;EAAY;EAAM,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;EAAO,CAClG"}
package/es/BlockQuote.mjs CHANGED
@@ -5,6 +5,13 @@ import { jsx } from "react/jsx-runtime";
5
5
  import { forwardRef } from "react";
6
6
 
7
7
  //#region src/BlockQuote.tsx
8
+ /**
9
+ * Copyright (c) 2024-present, NDLA.
10
+ *
11
+ * This source code is licensed under the GPLv3 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ */
8
15
  const blockQuoteRecipe = cva({
9
16
  base: {
10
17
  borderInlineStart: "4px solid",
@@ -1 +1 @@
1
- {"version":3,"file":"BlockQuote.mjs","names":[],"sources":["../src/BlockQuote.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 { StyledProps } from \"@ndla/styled-system/types\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { forwardRef } from \"react\";\n\nconst blockQuoteRecipe = cva({\n base: {\n borderInlineStart: \"4px solid\",\n paddingInline: \"medium\",\n },\n variants: {\n variant: {\n neutral: {\n borderColor: \"stroke.subtle\",\n background: \"surface.default\",\n },\n brand1: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n background: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n variant: \"neutral\",\n },\n});\n\nexport type BlockQuoteVariantProps = NonNullable<RecipeVariantProps<typeof blockQuoteRecipe>>;\n\nexport interface BlockQuoteProps extends HTMLArkProps<\"blockquote\">, StyledProps, BlockQuoteVariantProps {}\n\nconst StyledBlockQuote = styled(ark.blockquote, {}, { baseComponent: true });\n\nexport const BlockQuote = forwardRef<HTMLQuoteElement, BlockQuoteProps>(({ variant, css: cssProp, ...props }, ref) => (\n <StyledBlockQuote css={css.raw(blockQuoteRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;AAcA,MAAM,mBAAmB,IAAI;CAC3B,MAAM;EACJ,mBAAmB;EACnB,eAAe;EAChB;CACD,UAAU,EACR,SAAS;EACP,SAAS;GACP,aAAa;GACb,YAAY;GACb;EACD,QAAQ;GACN,YAAY;GACZ,aAAa;GACd;EACD,QAAQ;GACN,YAAY;GACZ,aAAa;GACd;EACF,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CAAC;AAMF,MAAM,mBAAmB,OAAO,IAAI,YAAY,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAE5E,MAAa,aAAa,YAA+C,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QAC5G,oBAAC;CAAiB,KAAK,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;EAAO,CACnG"}
1
+ {"version":3,"file":"BlockQuote.mjs","names":[],"sources":["../src/BlockQuote.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, type HTMLArkProps } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst blockQuoteRecipe = cva({\n base: {\n borderInlineStart: \"4px solid\",\n paddingInline: \"medium\",\n },\n variants: {\n variant: {\n neutral: {\n borderColor: \"stroke.subtle\",\n background: \"surface.default\",\n },\n brand1: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n background: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n variant: \"neutral\",\n },\n});\n\nexport type BlockQuoteVariantProps = NonNullable<RecipeVariantProps<typeof blockQuoteRecipe>>;\n\nexport interface BlockQuoteProps extends HTMLArkProps<\"blockquote\">, StyledProps, BlockQuoteVariantProps {}\n\nconst StyledBlockQuote = styled(ark.blockquote, {}, { baseComponent: true });\n\nexport const BlockQuote = forwardRef<HTMLQuoteElement, BlockQuoteProps>(({ variant, css: cssProp, ...props }, ref) => (\n <StyledBlockQuote css={css.raw(blockQuoteRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,mBAAmB,IAAI;CAC3B,MAAM;EACJ,mBAAmB;EACnB,eAAe;EAChB;CACD,UAAU,EACR,SAAS;EACP,SAAS;GACP,aAAa;GACb,YAAY;GACb;EACD,QAAQ;GACN,YAAY;GACZ,aAAa;GACd;EACD,QAAQ;GACN,YAAY;GACZ,aAAa;GACd;EACF,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CAAC;AAMF,MAAM,mBAAmB,OAAO,IAAI,YAAY,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAE5E,MAAa,aAAa,YAA+C,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QAC5G,oBAAC;CAAiB,KAAK,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAAE,GAAI;CAAY;EAAO,CACnG"}
package/es/Button.mjs CHANGED
@@ -6,6 +6,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef, useMemo } from "react";
7
7
 
8
8
  //#region src/Button.tsx
9
+ /**
10
+ * Copyright (c) 2024-present, NDLA.
11
+ *
12
+ * This source code is licensed under the GPLv3 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ */
9
16
  const buttonBaseRecipe = cva({
10
17
  base: {
11
18
  display: "inline-flex",
package/es/Button.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","names":[],"sources":["../src/Button.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 { RecipeVariant, StyledProps } from \"@ndla/styled-system/types\";\nimport { type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode, forwardRef, useMemo } from \"react\";\nimport { Spinner } from \"./Spinner\";\n\nexport const buttonBaseRecipe = cva({\n base: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"xxsmall\",\n cursor: \"pointer\",\n textDecoration: \"none\",\n fontWeight: \"bold\",\n transitionProperty: \"all\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n textAlign: \"center\",\n borderRadius: \"xsmall\",\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n _disabled: {\n cursor: \"not-allowed\",\n color: \"text.onAction\",\n background: \"surface.disabled\",\n boxShadowColor: \"surface.disabled\",\n \"& svg\": {\n color: \"text.onAction\",\n },\n _hover: {\n color: \"text.onAction\",\n background: \"surface.disabled\",\n },\n },\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n },\n variants: {\n variant: {\n primary: {\n color: \"text.onAction\",\n background: \"surface.action\",\n _hover: {\n color: \"text.onAction\",\n background: \"surface.action.hover\",\n },\n _active: {\n color: \"text.onAction\",\n background: \"surface.action.active\",\n },\n _focusVisible: {\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n _on: {\n background: \"surface.action.selected\",\n },\n },\n secondary: {\n color: \"text.strong\",\n background: \"surface.default\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n },\n },\n tertiary: {\n color: \"text.strong\",\n background: \"transparent\",\n _hover: {\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"surface.actionSubtle.hover\",\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n },\n _active: {\n borderColor: \"stroke.default\",\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n },\n },\n clear: {\n background: \"transparent\",\n color: \"text.strong\",\n _hover: {\n color: \"stroke.hover\",\n },\n },\n clearSubtle: {\n background: \"transparent\",\n color: \"text.onAction\",\n _hover: {\n color: \"surface.actionSubtle.hover.strong\",\n },\n },\n danger: {\n background: \"surface.danger\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.danger.hover\",\n },\n _active: {\n background: \"surface.danger.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.danger\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n success: {\n background: \"surface.success\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.success.hover\",\n },\n _active: {\n background: \"surface.success.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.success\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n link: {\n background: \"transparent\",\n color: \"text.link\",\n fontWeight: \"normal\",\n textDecoration: \"underline\",\n transitionProperty: \"unset\",\n transitionTimingFunction: \"unset\",\n transitionDuration: \"unset\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n boxShadow: \"none\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n },\n});\n\nexport const buttonRecipe = cva({\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n textStyle: \"label.medium\",\n paddingInline: \"small\",\n paddingBlock: \"xxsmall\",\n minHeight: \"24\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n },\n small: {\n textStyle: \"label.small\",\n minHeight: \"large\",\n paddingInline: \"xsmall\",\n paddingBlock: \"4xsmall\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n },\n },\n },\n});\n\nexport const iconButtonRecipe = cva({\n base: {\n lineHeight: \"1\",\n minHeight: \"unset\",\n },\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n \"--shadow-width\": \"3px\",\n height: \"xxlarge\",\n width: \"xxlarge\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n paddingInline: \"xsmall\",\n paddingBlock: \"xsmall\",\n },\n small: {\n \"--shadow-width\": \"2px\",\n height: \"large\",\n width: \"large\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n paddingInline: \"xxsmall\",\n paddingBlock: \"xxsmall\",\n },\n },\n },\n});\n\ntype Variant = RecipeVariant<typeof buttonBaseRecipe>[\"variant\"];\n\ntype ButtonVariant = Exclude<Variant, \"clear\" | \"clearSubtle\">;\n\nexport interface ButtonVariantProps extends NonNullable<RecipeVariantProps<typeof buttonRecipe>> {\n variant?: ButtonVariant;\n}\n\nexport interface BaseButtonProps extends HTMLArkProps<\"button\">, StyledProps {\n loading?: boolean;\n loadingContent?: ReactNode;\n replaceContent?: boolean;\n}\n\nexport interface ButtonProps extends BaseButtonProps, ButtonVariantProps {}\n\nconst StyledButton = styled(ark.button, {}, { baseComponent: true, defaultProps: { type: \"button\" } });\n\nexport const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(\n ({ loading, loadingContent: loadingContentProp, replaceContent, onClick: _onClick, children, ...props }, ref) => {\n const ariaDisabled = loading ? { \"aria-disabled\": true } : {};\n\n const onClick = useMemo(() => (loading ? undefined : _onClick), [_onClick, loading]);\n\n const loadingContent = useMemo(() => {\n return replaceContent ? (\n loadingContentProp\n ) : (\n <>\n {loadingContentProp}\n {children}\n </>\n );\n }, [children, loadingContentProp, replaceContent]);\n\n return (\n <StyledButton onClick={onClick} {...ariaDisabled} {...props} ref={ref}>\n {loading ? loadingContent : children}\n </StyledButton>\n );\n },\n);\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ variant, loadingContent, size, css: cssProp, ...props }, ref) => (\n <BaseButton\n {...props}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n css={css.raw(\n buttonBaseRecipe.raw({ variant }),\n variant !== \"link\" ? buttonRecipe.raw({ size }) : undefined,\n cssProp,\n )}\n ref={ref}\n />\n ),\n);\n\ntype IconButtonVariant = Exclude<Variant, \"link\">;\n\nexport interface IconButtonVariantProps extends NonNullable<RecipeVariantProps<typeof iconButtonRecipe>> {\n variant?: IconButtonVariant;\n}\n\nexport interface IconButtonProps extends BaseButtonProps, IconButtonVariantProps {}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ variant, css: cssProp, loadingContent, size, replaceContent = true, ...props }, ref) => (\n <BaseButton\n {...props}\n css={css.raw(buttonBaseRecipe.raw({ variant }), iconButtonRecipe.raw({ size }), cssProp)}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n replaceContent={replaceContent}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;AAeA,MAAa,mBAAmB,IAAI;CAClC,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,KAAK;EACL,QAAQ;EACR,gBAAgB;EAChB,YAAY;EACZ,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,WAAW;EACX,cAAc;EACd,SAAS;EACT,gBAAgB;EAChB,WAAW;GACT,QAAQ;GACR,OAAO;GACP,YAAY;GACZ,gBAAgB;GAChB,SAAS,EACP,OAAO,iBACR;GACD,QAAQ;IACN,OAAO;IACP,YAAY;IACb;GACF;EACD,eAAe,EACb,WAAW,4DACZ;EACD,eAAe;GACb,YAAY;GACZ,oBAAoB;GACrB;EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,SA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S,GAAG,SAAS,QAC1D,oBAAC;CACC,GAAI;CACJ,gBAAgB,kBAAkB,oBAAC,WAAQ,MAAK,UAAU;CAC1D,KAAK,IAAI,IACP,iBAAiB,IAAI,EAAE,SAAS,CAAC,EACjC,YAAY,SAAS,aAAa,IAAI,EAAE,MAAM,CAAC,GAAG,QAClD,QACD;CACI;EACL,CAEL;AAUD,MAAa,aAAa,YACvB,EAAE,SAAS,KAAK,SAAS,gBAAgB,MAAM,iBAAiB,MAAM,GAAG,SAAS,QACjF,oBAAC;CACC,GAAI;CACJ,KAAK,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,iBAAiB,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ;CACxF,gBAAgB,kBAAkB,oBAAC,WAAQ,MAAK,UAAU;CAC1C;CACX;EACL,CAEL"}
1
+ {"version":3,"file":"Button.mjs","names":[],"sources":["../src/Button.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, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariant, StyledProps } from \"@ndla/styled-system/types\";\nimport { type ReactNode, forwardRef, useMemo } from \"react\";\nimport { Spinner } from \"./Spinner\";\n\nexport const buttonBaseRecipe = cva({\n base: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"xxsmall\",\n cursor: \"pointer\",\n textDecoration: \"none\",\n fontWeight: \"bold\",\n transitionProperty: \"all\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n textAlign: \"center\",\n borderRadius: \"xsmall\",\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n _disabled: {\n cursor: \"not-allowed\",\n color: \"text.onAction\",\n background: \"surface.disabled\",\n boxShadowColor: \"surface.disabled\",\n \"& svg\": {\n color: \"text.onAction\",\n },\n _hover: {\n color: \"text.onAction\",\n background: \"surface.disabled\",\n },\n },\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n },\n variants: {\n variant: {\n primary: {\n color: \"text.onAction\",\n background: \"surface.action\",\n _hover: {\n color: \"text.onAction\",\n background: \"surface.action.hover\",\n },\n _active: {\n color: \"text.onAction\",\n background: \"surface.action.active\",\n },\n _focusVisible: {\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n _on: {\n background: \"surface.action.selected\",\n },\n },\n secondary: {\n color: \"text.strong\",\n background: \"surface.default\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n },\n },\n tertiary: {\n color: \"text.strong\",\n background: \"transparent\",\n _hover: {\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"surface.actionSubtle.hover\",\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n },\n _active: {\n borderColor: \"stroke.default\",\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n },\n },\n clear: {\n background: \"transparent\",\n color: \"text.strong\",\n _hover: {\n color: \"stroke.hover\",\n },\n },\n clearSubtle: {\n background: \"transparent\",\n color: \"text.onAction\",\n _hover: {\n color: \"surface.actionSubtle.hover.strong\",\n },\n },\n danger: {\n background: \"surface.danger\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.danger.hover\",\n },\n _active: {\n background: \"surface.danger.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.danger\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n success: {\n background: \"surface.success\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.success.hover\",\n },\n _active: {\n background: \"surface.success.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.success\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n link: {\n background: \"transparent\",\n color: \"text.link\",\n fontWeight: \"normal\",\n textDecoration: \"underline\",\n transitionProperty: \"unset\",\n transitionTimingFunction: \"unset\",\n transitionDuration: \"unset\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n boxShadow: \"none\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n },\n});\n\nexport const buttonRecipe = cva({\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n textStyle: \"label.medium\",\n paddingInline: \"small\",\n paddingBlock: \"xxsmall\",\n minHeight: \"24\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n },\n small: {\n textStyle: \"label.small\",\n minHeight: \"large\",\n paddingInline: \"xsmall\",\n paddingBlock: \"4xsmall\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n },\n },\n },\n});\n\nexport const iconButtonRecipe = cva({\n base: {\n lineHeight: \"1\",\n minHeight: \"unset\",\n },\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n \"--shadow-width\": \"3px\",\n height: \"xxlarge\",\n width: \"xxlarge\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n paddingInline: \"xsmall\",\n paddingBlock: \"xsmall\",\n },\n small: {\n \"--shadow-width\": \"2px\",\n height: \"large\",\n width: \"large\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n paddingInline: \"xxsmall\",\n paddingBlock: \"xxsmall\",\n },\n },\n },\n});\n\ntype Variant = RecipeVariant<typeof buttonBaseRecipe>[\"variant\"];\n\ntype ButtonVariant = Exclude<Variant, \"clear\" | \"clearSubtle\">;\n\nexport interface ButtonVariantProps extends NonNullable<RecipeVariantProps<typeof buttonRecipe>> {\n variant?: ButtonVariant;\n}\n\nexport interface BaseButtonProps extends HTMLArkProps<\"button\">, StyledProps {\n loading?: boolean;\n loadingContent?: ReactNode;\n replaceContent?: boolean;\n}\n\nexport interface ButtonProps extends BaseButtonProps, ButtonVariantProps {}\n\nconst StyledButton = styled(ark.button, {}, { baseComponent: true, defaultProps: { type: \"button\" } });\n\nexport const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(\n ({ loading, loadingContent: loadingContentProp, replaceContent, onClick: _onClick, children, ...props }, ref) => {\n const ariaDisabled = loading ? { \"aria-disabled\": true } : {};\n\n const onClick = useMemo(() => (loading ? undefined : _onClick), [_onClick, loading]);\n\n const loadingContent = useMemo(() => {\n return replaceContent ? (\n loadingContentProp\n ) : (\n <>\n {loadingContentProp}\n {children}\n </>\n );\n }, [children, loadingContentProp, replaceContent]);\n\n return (\n <StyledButton onClick={onClick} {...ariaDisabled} {...props} ref={ref}>\n {loading ? loadingContent : children}\n </StyledButton>\n );\n },\n);\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ variant, loadingContent, size, css: cssProp, ...props }, ref) => (\n <BaseButton\n {...props}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n css={css.raw(\n buttonBaseRecipe.raw({ variant }),\n variant !== \"link\" ? buttonRecipe.raw({ size }) : undefined,\n cssProp,\n )}\n ref={ref}\n />\n ),\n);\n\ntype IconButtonVariant = Exclude<Variant, \"link\">;\n\nexport interface IconButtonVariantProps extends NonNullable<RecipeVariantProps<typeof iconButtonRecipe>> {\n variant?: IconButtonVariant;\n}\n\nexport interface IconButtonProps extends BaseButtonProps, IconButtonVariantProps {}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ variant, css: cssProp, loadingContent, size, replaceContent = true, ...props }, ref) => (\n <BaseButton\n {...props}\n css={css.raw(buttonBaseRecipe.raw({ variant }), iconButtonRecipe.raw({ size }), cssProp)}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n replaceContent={replaceContent}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,mBAAmB,IAAI;CAClC,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,KAAK;EACL,QAAQ;EACR,gBAAgB;EAChB,YAAY;EACZ,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,WAAW;EACX,cAAc;EACd,SAAS;EACT,gBAAgB;EAChB,WAAW;GACT,QAAQ;GACR,OAAO;GACP,YAAY;GACZ,gBAAgB;GAChB,SAAS,EACP,OAAO,iBACR;GACD,QAAQ;IACN,OAAO;IACP,YAAY;IACb;GACF;EACD,eAAe,EACb,WAAW,4DACZ;EACD,eAAe;GACb,YAAY;GACZ,oBAAoB;GACrB;EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,SAAS;GACP,OAAO;GACP,YAAY;GACZ,QAAQ;IACN,OAAO;IACP,YAAY;IACb;GACD,SAAS;IACP,OAAO;IACP,YAAY;IACb;GACD,eAAe,EACb,WACE,+HACH;GACD,KAAK,EACH,YAAY,2BACb;GACF;EACD,WAAW;GACT,OAAO;GACP,YAAY;GACZ,WAAW;GACX,QAAQ,EACN,YAAY,8BACb;GACD,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AAa,YACvB,EAAE,SAAS,KAAK,SAAS,gBAAgB,MAAM,iBAAiB,MAAM,GAAG,SAAS,QACjF,oBAAC;CACC,GAAI;CACJ,KAAK,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,iBAAiB,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ;CACxF,gBAAgB,kBAAkB,oBAAC,WAAQ,MAAK,UAAU;CAC1C;CACX;EACL,CAEL"}
package/es/Card/Card.mjs CHANGED
@@ -7,6 +7,13 @@ import { jsx } from "react/jsx-runtime";
7
7
  import { forwardRef } from "react";
8
8
 
9
9
  //#region src/Card/Card.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
+ */
10
17
  const { withProvider, withContext } = createStyleContext(sva({
11
18
  slots: [
12
19
  "root",
@@ -1 +1 @@
1
- {"version":3,"file":"Card.mjs","names":[],"sources":["../../src/Card/Card.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 { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport { forwardRef } from \"react\";\nimport { Image } from \"../Image\";\nimport { Heading, type TextProps } from \"../Text\";\n\nconst cardRecipe = sva({\n slots: [\"root\", \"title\", \"content\", \"image\"],\n base: {\n root: {\n position: \"relative\",\n outline: \"1px solid\",\n borderRadius: \"xsmall\",\n outlineColor: \"transparent\",\n outlineOffset: \"-1px\",\n height: \"100%\",\n boxShadow: \"xsmall\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color, outline-color\",\n transitionTimingFunction: \"default\",\n background: \"surface.default\",\n overflow: \"hidden\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n paddingInline: \"small\",\n },\n title: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n image: {\n height: \"200px\",\n objectFit: \"cover\",\n width: \"100%\",\n },\n },\n defaultVariants: {\n nonInteractive: false,\n },\n variants: {\n nonInteractive: {\n true: {},\n false: {\n root: {\n _hover: {\n background: \"surface.hover\",\n outlineColor: \"stroke.hover\",\n },\n _active: {\n background: \"surface.active\",\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(cardRecipe);\n\nexport type CardVariantProps = NonNullable<RecipeVariantProps<typeof cardRecipe>>;\n\nexport interface CardRootProps extends HTMLArkProps<\"article\">, StyledProps, CardVariantProps {}\n\nexport const CardRoot = withProvider(ark.article, \"root\", { baseComponent: true });\n\ninterface CardHeadingProps extends StyledProps, Omit<HTMLArkProps<\"p\">, \"color\">, TextProps {}\n\nconst InternalCardHeading = forwardRef<HTMLHeadingElement, CardHeadingProps>(\n ({ textStyle = \"label.large\", fontWeight = \"bold\", ...props }, ref) => (\n <Heading textStyle={textStyle} fontWeight={fontWeight} {...props} ref={ref} />\n ),\n);\n\nexport const CardHeading = withContext(InternalCardHeading, \"title\");\n\nexport const CardContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nexport const CardImage = withContext(Image, \"image\");\n"],"mappings":";;;;;;;;;AA0EA,MAAM,EAAE,cAAc,gBAAgB,mBA1DnB,IAAI;CACrB,OAAO;EAAC;EAAQ;EAAS;EAAW;EAAQ;CAC5C,MAAM;EACJ,MAAM;GACJ,UAAU;GACV,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,QAAQ;GACR,WAAW;GACX,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,YAAY;GACZ,UAAU;GACX;EACD,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,mBAAmB;GACnB,iBAAiB;GACjB,eAAe;GAChB;EACD,OAAO;GACL,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,QACjB;GACF;EACD,OAAO;GACL,QAAQ;GACR,WAAW;GACX,OAAO;GACR;EACF;CACD,iBAAiB,EACf,gBAAgB,OACjB;CACD,UAAU,EACR,gBAAgB;EACd,MAAM,EAAE;EACR,OAAO,EACL,MAAM;GACJ,QAAQ;IACN,YAAY;IACZ,cAAc;IACf;GACD,SAAS,EACP,YAAY,kBACb;GACF,EACF;EACF,EACF;CACF,CAAC,CAEkE;AAMpE,MAAa,WAAW,aAAa,IAAI,SAAS,QAAQ,EAAE,eAAe,MAAM,CAAC;AAIlF,MAAM,sBAAsB,YACzB,EAAE,YAAY,eAAe,aAAa,QAAQ,GAAG,SAAS,QAC7D,oBAAC;CAAmB;CAAuB;CAAY,GAAI;CAAY;EAAO,CAEjF;AAED,MAAa,cAAc,YAAY,qBAAqB,QAAQ;AAEpE,MAAa,cAAc,YAAY,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC;AAEnF,MAAa,YAAY,YAAY,OAAO,QAAQ"}
1
+ {"version":3,"file":"Card.mjs","names":[],"sources":["../../src/Card/Card.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, type HTMLArkProps } 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 } from \"../Image\";\nimport { Heading, type TextProps } from \"../Text\";\n\nconst cardRecipe = sva({\n slots: [\"root\", \"title\", \"content\", \"image\"],\n base: {\n root: {\n position: \"relative\",\n outline: \"1px solid\",\n borderRadius: \"xsmall\",\n outlineColor: \"transparent\",\n outlineOffset: \"-1px\",\n height: \"100%\",\n boxShadow: \"xsmall\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color, outline-color\",\n transitionTimingFunction: \"default\",\n background: \"surface.default\",\n overflow: \"hidden\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n paddingInline: \"small\",\n },\n title: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n image: {\n height: \"200px\",\n objectFit: \"cover\",\n width: \"100%\",\n },\n },\n defaultVariants: {\n nonInteractive: false,\n },\n variants: {\n nonInteractive: {\n true: {},\n false: {\n root: {\n _hover: {\n background: \"surface.hover\",\n outlineColor: \"stroke.hover\",\n },\n _active: {\n background: \"surface.active\",\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(cardRecipe);\n\nexport type CardVariantProps = NonNullable<RecipeVariantProps<typeof cardRecipe>>;\n\nexport interface CardRootProps extends HTMLArkProps<\"article\">, StyledProps, CardVariantProps {}\n\nexport const CardRoot = withProvider(ark.article, \"root\", { baseComponent: true });\n\ninterface CardHeadingProps extends StyledProps, Omit<HTMLArkProps<\"p\">, \"color\">, TextProps {}\n\nconst InternalCardHeading = forwardRef<HTMLHeadingElement, CardHeadingProps>(\n ({ textStyle = \"label.large\", fontWeight = \"bold\", ...props }, ref) => (\n <Heading textStyle={textStyle} fontWeight={fontWeight} {...props} ref={ref} />\n ),\n);\n\nexport const CardHeading = withContext(InternalCardHeading, \"title\");\n\nexport const CardContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nexport const CardImage = withContext(Image, \"image\");\n"],"mappings":";;;;;;;;;;;;;;;;AA0EA,MAAM,EAAE,cAAc,gBAAgB,mBA1DnB,IAAI;CACrB,OAAO;EAAC;EAAQ;EAAS;EAAW;EAAQ;CAC5C,MAAM;EACJ,MAAM;GACJ,UAAU;GACV,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,QAAQ;GACR,WAAW;GACX,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,YAAY;GACZ,UAAU;GACX;EACD,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,mBAAmB;GACnB,iBAAiB;GACjB,eAAe;GAChB;EACD,OAAO;GACL,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,QACjB;GACF;EACD,OAAO;GACL,QAAQ;GACR,WAAW;GACX,OAAO;GACR;EACF;CACD,iBAAiB,EACf,gBAAgB,OACjB;CACD,UAAU,EACR,gBAAgB;EACd,MAAM,EAAE;EACR,OAAO,EACL,MAAM;GACJ,QAAQ;IACN,YAAY;IACZ,cAAc;IACf;GACD,SAAS,EACP,YAAY,kBACb;GACF,EACF;EACF,EACF;CACF,CAAC,CAEkE;AAMpE,MAAa,WAAW,aAAa,IAAI,SAAS,QAAQ,EAAE,eAAe,MAAM,CAAC;AAIlF,MAAM,sBAAsB,YACzB,EAAE,YAAY,eAAe,aAAa,QAAQ,GAAG,SAAS,QAC7D,oBAAC;CAAmB;CAAuB;CAAY,GAAI;CAAY;EAAO,CAEjF;AAED,MAAa,cAAc,YAAY,qBAAqB,QAAQ;AAEpE,MAAa,cAAc,YAAY,IAAI,KAAK,WAAW,EAAE,eAAe,MAAM,CAAC;AAEnF,MAAa,YAAY,YAAY,OAAO,QAAQ"}
package/es/Checkbox.mjs CHANGED
@@ -5,6 +5,13 @@ import { createStyleContext } from "@ndla/styled-system/jsx";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/Checkbox.tsx
8
+ /**
9
+ * Copyright (c) 2024-present, NDLA.
10
+ *
11
+ * This source code is licensed under the GPLv3 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ */
8
15
  const { withProvider, withContext } = createStyleContext(sva({
9
16
  slots: checkboxAnatomy.keys(),
10
17
  base: {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","names":[],"sources":["../src/Checkbox.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 { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport type { RefAttributes } from \"react\";\nimport { Checkbox, checkboxAnatomy, type HTMLArkProps } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport { Text, type TextProps } from \"./Text\";\n\nconst checkboxRecipe = sva({\n slots: checkboxAnatomy.keys(),\n base: {\n root: {\n userSelect: \"none\",\n display: \"flex\",\n alignItems: \"center\",\n width: \"fit-content\",\n cursor: \"pointer\",\n _disabled: {\n color: \"text.disabled\",\n cursor: \"not-allowed\",\n _hover: {\n color: \"text.disabled\",\n },\n },\n },\n group: {\n display: \"flex\",\n gap: \"xxsmall\",\n flexDirection: \"column\",\n },\n control: {\n flexShrink: \"0\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n width: \"medium\",\n height: \"medium\",\n color: \"text.strong\",\n transitionDuration: \"normal\",\n transitionProperty: \"border-color, background, box-shadow, color\",\n transitionTimingFunction: \"default\",\n _disabled: {\n cursor: \"not-allowed\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n },\n defaultVariants: {\n variant: \"checkbox\",\n },\n variants: {\n variant: {\n checkbox: {\n root: {\n gap: \"xxsmall\",\n _hover: {\n color: \"text.action\",\n },\n _focusVisible: {\n outline: \"2px solid\",\n outlineOffset: \"4xsmall\",\n outlineColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n },\n },\n control: {\n border: \"2px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n background: \"surface.default\",\n _hover: {\n boxShadow: \"0 0 0 4px var(--shadow-color)\",\n boxShadowColor: \"surface.actionSubtle.hover.strong\",\n },\n _checked: {\n backgroundColor: \"surface.action\",\n borderColor: \"surface.action\",\n color: \"icon.onAction\",\n },\n _disabled: {\n borderColor: \"stroke.disabled\",\n _hover: {\n borderColor: \"stroke.disabled\",\n boxShadow: \"none\",\n },\n _checked: {\n background: \"surface.disabled\",\n borderColor: \"stroke.disabled\",\n },\n },\n _invalid: {\n borderColor: \"stroke.error\",\n _checked: {\n color: \"stroke.error\",\n borderColor: \"stroke.error\",\n backgroundColor: \"surface.default\",\n },\n },\n },\n },\n chip: {\n root: {\n width: \"fit-content\",\n color: \"text.default\",\n gap: \"4xsmall\",\n background: \"surface.actionSubtle\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n outlineColor: \"stroke.subtle\",\n paddingInline: \"xsmall\",\n paddingBlock: \"4xsmall\",\n borderRadius: \"large\",\n minHeight: \"large\",\n transitionDuration: \"normal\",\n transitionProperty: \"border-color, background, box-shadow, color\",\n transitionTimingFunction: \"default\",\n _disabled: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n _hover: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n },\n _checked: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n _hover: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n },\n },\n },\n _hover: {\n background: \"surface.actionSubtle.hover\",\n borderColor: \"stroke.hover\",\n outlineColor: \"stroke.hover\",\n _invalid: {\n backgroundColor: \"surface.dangerSubtle\",\n },\n },\n _checked: {\n color: \"text.onAction\",\n background: \"surface.action.selected\",\n borderColor: \"surface.action.selected\",\n outlineColor: \"icon.onAction\",\n _focus: {\n outlineOffset: \"-4px\",\n },\n _hover: {\n outlineOffset: \"-2px\",\n background: \"surface.actionSubtle.hover\",\n color: \"text.default\",\n borderColor: \"stroke.hover\",\n outlineColor: \"stroke.hover\",\n },\n },\n _invalid: {\n borderColor: \"stroke.error\",\n outlineColor: \"stroke.error\",\n background: \"surface.dangerSubtle\",\n outlineOffset: \"-2px\",\n _checked: {\n color: \"text.default\",\n borderColor: \"stroke.error\",\n outlineColor: \"stroke.error\",\n background: \"surface.dangerSubtle\",\n outlineOffset: \"-2px\",\n _hover: {\n borderColor: \"stroke.hover\",\n outlineColor: \"stroke.hover\",\n },\n },\n },\n _focus: {\n outlineStyle: \"solid\",\n outlineWidth: \"2px\",\n outlineOffset: \"-2px\",\n },\n },\n control: {\n display: \"none\",\n _checked: {\n display: \"flex\",\n color: \"text.onAction\",\n _hover: {\n color: \"stroke.hover\",\n },\n },\n _disabled: {\n color: \"stroke.disabled\",\n _hover: {\n color: \"stroke.disabled\",\n },\n },\n _invalid: {\n _checked: {\n color: \"stroke.error\",\n },\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(checkboxRecipe);\n\nexport type CheckboxVariantProps = NonNullable<RecipeVariantProps<typeof checkboxRecipe>>;\n\nexport interface CheckboxRootProps extends StyledProps, HTMLArkProps<\"label\">, CheckboxVariantProps {}\n\nexport const CheckboxRoot = withProvider(Checkbox.Root, \"root\", { baseComponent: true });\n\nexport const CheckboxIndicator = withContext(Checkbox.Indicator, \"indicator\", { baseComponent: true });\n\nconst InternalCheckboxLabel = withContext(Checkbox.Label, \"label\");\n\ninterface CheckboxLabelProps\n extends StyledProps, Omit<Checkbox.LabelProps, \"color\">, TextProps, RefAttributes<HTMLSpanElement> {}\n\nexport const CheckboxLabel = ({ textStyle = \"label.medium\", children, ...props }: CheckboxLabelProps) => (\n <InternalCheckboxLabel {...props} asChild>\n <Text textStyle={textStyle}>{children}</Text>\n </InternalCheckboxLabel>\n);\n\nexport const CheckboxControl = withContext(Checkbox.Control, \"control\", { baseComponent: true });\n\nexport const CheckboxGroup = withProvider(Checkbox.Group, \"group\", { baseComponent: true });\n\nexport const CheckboxHiddenInput = Checkbox.HiddenInput;\n"],"mappings":";;;;;;;AA4NA,MAAM,EAAE,cAAc,gBAAgB,mBA7Mf,IAAI;CACzB,OAAO,gBAAgB,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,EAAE,eAAe,MAAM,CAAC;AAE3F,MAAa,sBAAsB,SAAS"}
1
+ {"version":3,"file":"Checkbox.mjs","names":[],"sources":["../src/Checkbox.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 { Checkbox, checkboxAnatomy, type HTMLArkProps } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport type { RefAttributes } from \"react\";\nimport { Text, type TextProps } from \"./Text\";\n\nconst checkboxRecipe = sva({\n slots: checkboxAnatomy.keys(),\n base: {\n root: {\n userSelect: \"none\",\n display: \"flex\",\n alignItems: \"center\",\n width: \"fit-content\",\n cursor: \"pointer\",\n _disabled: {\n color: \"text.disabled\",\n cursor: \"not-allowed\",\n _hover: {\n color: \"text.disabled\",\n },\n },\n },\n group: {\n display: \"flex\",\n gap: \"xxsmall\",\n flexDirection: \"column\",\n },\n control: {\n flexShrink: \"0\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n width: \"medium\",\n height: \"medium\",\n color: \"text.strong\",\n transitionDuration: \"normal\",\n transitionProperty: \"border-color, background, box-shadow, color\",\n transitionTimingFunction: \"default\",\n _disabled: {\n cursor: \"not-allowed\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n },\n defaultVariants: {\n variant: \"checkbox\",\n },\n variants: {\n variant: {\n checkbox: {\n root: {\n gap: \"xxsmall\",\n _hover: {\n color: \"text.action\",\n },\n _focusVisible: {\n outline: \"2px solid\",\n outlineOffset: \"4xsmall\",\n outlineColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n },\n },\n control: {\n border: \"2px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n background: \"surface.default\",\n _hover: {\n boxShadow: \"0 0 0 4px var(--shadow-color)\",\n boxShadowColor: \"surface.actionSubtle.hover.strong\",\n },\n _checked: {\n backgroundColor: \"surface.action\",\n borderColor: \"surface.action\",\n color: \"icon.onAction\",\n },\n _disabled: {\n borderColor: \"stroke.disabled\",\n _hover: {\n borderColor: \"stroke.disabled\",\n boxShadow: \"none\",\n },\n _checked: {\n background: \"surface.disabled\",\n borderColor: \"stroke.disabled\",\n },\n },\n _invalid: {\n borderColor: \"stroke.error\",\n _checked: {\n color: \"stroke.error\",\n borderColor: \"stroke.error\",\n backgroundColor: \"surface.default\",\n },\n },\n },\n },\n chip: {\n root: {\n width: \"fit-content\",\n color: \"text.default\",\n gap: \"4xsmall\",\n background: \"surface.actionSubtle\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n outlineColor: \"stroke.subtle\",\n paddingInline: \"xsmall\",\n paddingBlock: \"4xsmall\",\n borderRadius: \"large\",\n minHeight: \"large\",\n transitionDuration: \"normal\",\n transitionProperty: \"border-color, background, box-shadow, color\",\n transitionTimingFunction: \"default\",\n _disabled: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n _hover: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n },\n _checked: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n _hover: {\n color: \"text.disabled\",\n borderColor: \"stroke.disabled\",\n background: \"surface.disabled\",\n },\n },\n },\n _hover: {\n background: \"surface.actionSubtle.hover\",\n borderColor: \"stroke.hover\",\n outlineColor: \"stroke.hover\",\n _invalid: {\n backgroundColor: \"surface.dangerSubtle\",\n },\n },\n _checked: {\n color: \"text.onAction\",\n background: \"surface.action.selected\",\n borderColor: \"surface.action.selected\",\n outlineColor: \"icon.onAction\",\n _focus: {\n outlineOffset: \"-4px\",\n },\n _hover: {\n outlineOffset: \"-2px\",\n background: \"surface.actionSubtle.hover\",\n color: \"text.default\",\n borderColor: \"stroke.hover\",\n outlineColor: \"stroke.hover\",\n },\n },\n _invalid: {\n borderColor: \"stroke.error\",\n outlineColor: \"stroke.error\",\n background: \"surface.dangerSubtle\",\n outlineOffset: \"-2px\",\n _checked: {\n color: \"text.default\",\n borderColor: \"stroke.error\",\n outlineColor: \"stroke.error\",\n background: \"surface.dangerSubtle\",\n outlineOffset: \"-2px\",\n _hover: {\n borderColor: \"stroke.hover\",\n outlineColor: \"stroke.hover\",\n },\n },\n },\n _focus: {\n outlineStyle: \"solid\",\n outlineWidth: \"2px\",\n outlineOffset: \"-2px\",\n },\n },\n control: {\n display: \"none\",\n _checked: {\n display: \"flex\",\n color: \"text.onAction\",\n _hover: {\n color: \"stroke.hover\",\n },\n },\n _disabled: {\n color: \"stroke.disabled\",\n _hover: {\n color: \"stroke.disabled\",\n },\n },\n _invalid: {\n _checked: {\n color: \"stroke.error\",\n },\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(checkboxRecipe);\n\nexport type CheckboxVariantProps = NonNullable<RecipeVariantProps<typeof checkboxRecipe>>;\n\nexport interface CheckboxRootProps extends StyledProps, HTMLArkProps<\"label\">, CheckboxVariantProps {}\n\nexport const CheckboxRoot = withProvider(Checkbox.Root, \"root\", { baseComponent: true });\n\nexport const CheckboxIndicator = withContext(Checkbox.Indicator, \"indicator\", { baseComponent: true });\n\nconst InternalCheckboxLabel = withContext(Checkbox.Label, \"label\");\n\ninterface CheckboxLabelProps\n extends StyledProps, Omit<Checkbox.LabelProps, \"color\">, TextProps, RefAttributes<HTMLSpanElement> {}\n\nexport const CheckboxLabel = ({ textStyle = \"label.medium\", children, ...props }: CheckboxLabelProps) => (\n <InternalCheckboxLabel {...props} asChild>\n <Text textStyle={textStyle}>{children}</Text>\n </InternalCheckboxLabel>\n);\n\nexport const CheckboxControl = withContext(Checkbox.Control, \"control\", { baseComponent: true });\n\nexport const CheckboxGroup = withProvider(Checkbox.Group, \"group\", { baseComponent: true });\n\nexport const CheckboxHiddenInput = Checkbox.HiddenInput;\n"],"mappings":";;;;;;;;;;;;;;AA4NA,MAAM,EAAE,cAAc,gBAAgB,mBA7Mf,IAAI;CACzB,OAAO,gBAAgB,MAAM;CAC7B,MAAM;EACJ,MAAM;GACJ,YAAY;GACZ,SAAS;GACT,YAAY;GACZ,OAAO;GACP,QAAQ;GACR,WAAW;IACT,OAAO;IACP,QAAQ;IACR,QAAQ,EACN,OAAO,iBACR;IACF;GACF;EACD,OAAO;GACL,SAAS;GACT,KAAK;GACL,eAAe;GAChB;EACD,SAAS;GACP,YAAY;GACZ,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,QAAQ;GACR,OAAO;GACP,QAAQ;GACR,OAAO;GACP,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,WAAW,EACT,QAAQ,eACT;GACD,eAAe;IACb,YAAY;IACZ,oBAAoB;IACrB;GACF;EACF;CACD,iBAAiB,EACf,SAAS,YACV;CACD,UAAU,EACR,SAAS;EACP,UAAU;GACR,MAAM;IACJ,KAAK;IACL,QAAQ,EACN,OAAO,eACR;IACD,eAAe;KACb,SAAS;KACT,eAAe;KACf,cAAc;KACd,cAAc;KACf;IACF;GACD,SAAS;IACP,QAAQ;IACR,aAAa;IACb,cAAc;IACd,YAAY;IACZ,QAAQ;KACN,WAAW;KACX,gBAAgB;KACjB;IACD,UAAU;KACR,iBAAiB;KACjB,aAAa;KACb,OAAO;KACR;IACD,WAAW;KACT,aAAa;KACb,QAAQ;MACN,aAAa;MACb,WAAW;MACZ;KACD,UAAU;MACR,YAAY;MACZ,aAAa;MACd;KACF;IACD,UAAU;KACR,aAAa;KACb,UAAU;MACR,OAAO;MACP,aAAa;MACb,iBAAiB;MAClB;KACF;IACF;GACF;EACD,MAAM;GACJ,MAAM;IACJ,OAAO;IACP,OAAO;IACP,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,aAAa;IACb,cAAc;IACd,eAAe;IACf,cAAc;IACd,cAAc;IACd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EAAY;GAAgB;EACvB;AAG1B,MAAa,kBAAkB,YAAY,SAAS,SAAS,WAAW,EAAE,eAAe,MAAM,CAAC;AAEhG,MAAa,gBAAgB,aAAa,SAAS,OAAO,SAAS,EAAE,eAAe,MAAM,CAAC;AAE3F,MAAa,sBAAsB,SAAS"}
package/es/Combobox.mjs CHANGED
@@ -7,6 +7,13 @@ import { jsx } from "react/jsx-runtime";
7
7
  import { forwardRef } from "react";
8
8
 
9
9
  //#region src/Combobox.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
+ */
10
17
  const { withProvider, withContext } = createStyleContext(sva({
11
18
  slots: comboboxAnatomy.keys(),
12
19
  base: {
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.mjs","names":[],"sources":["../src/Combobox.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 { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { Combobox, comboboxAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport { forwardRef, type ElementType, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport { Text, type TextProps } from \"./Text\";\n\nconst comboboxRecipe = sva({\n slots: comboboxAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n control: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4xsmall\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n zIndex: \"dropdown\",\n background: \"surface.default\",\n overflowY: \"auto\",\n maxHeight: \"min(token(spacing.surface.xsmall), 45vh)\",\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 item: {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n cursor: \"pointer\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color, border-color\",\n transitionTimingFunction: \"default\",\n background: \"surface.default\",\n _disabled: {\n cursor: \"not-allowed\",\n background: \"surface.disabled\",\n color: \"text.disabled\",\n _hover: {\n background: \"surface.disabled\",\n color: \"text.disabled\",\n },\n },\n _hover: {\n background: \"surface.hover\",\n },\n _highlighted: {\n background: \"surface.hover\",\n },\n _checked: {\n background: \"surface.selected\",\n _highlighted: {\n background: \"surface.hover\",\n },\n },\n },\n trigger: {\n \"& svg\": {\n color: \"icon.default\",\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n _open: {\n \"& svg\": {\n transform: \"rotate(180deg)\",\n },\n },\n },\n itemIndicator: {\n color: \"stroke.default\",\n },\n itemText: {\n _checked: {\n textDecoration: \"underline\",\n },\n _highlighted: {\n textDecoration: \"underline\",\n },\n },\n itemGroup: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4xsmall\",\n },\n },\n defaultVariants: {\n context: \"standalone\",\n variant: \"simple\",\n },\n variants: {\n context: {\n standalone: {\n content: {\n boxShadow: \"large\",\n borderRadius: \"xsmall\",\n padding: \"xsmall\",\n },\n },\n composite: {},\n },\n variant: {\n simple: {\n item: {\n padding: \"xsmall\",\n borderRadius: \"xsmall\",\n },\n content: {\n gap: \"4xsmall\",\n },\n },\n complex: {},\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(comboboxRecipe);\n\nexport type ComboboxVariantProps = NonNullable<RecipeVariantProps<typeof comboboxRecipe>>;\n\nexport interface ComboboxRootProps<T extends Combobox.CollectionItem>\n extends StyledProps, Combobox.RootProps<T>, ComboboxVariantProps, RefAttributes<HTMLDivElement> {\n translations: Combobox.RootProps<T>[\"translations\"];\n}\n\nconst InternalComboboxRoot = withProvider<ElementType<ComboboxRootProps<Combobox.CollectionItem>>>(\n Combobox.Root,\n \"root\",\n { baseComponent: true },\n);\n\nexport const ComboboxRoot = <T extends Combobox.CollectionItem>({\n lazyMount = true,\n unmountOnExit = true,\n ...props\n}: ComboboxRootProps<T>) => {\n return <InternalComboboxRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />;\n};\n\nexport interface ComboboxClearTriggerProps extends Combobox.ClearTriggerProps, StyledProps {}\n\nexport const ComboboxClearTrigger = withContext(Combobox.ClearTrigger, \"clearTrigger\", { baseComponent: true });\n\nexport interface ComboboxContentProps extends Combobox.ContentProps, StyledProps {}\n\nexport const ComboboxContentStandalone = withContext(Combobox.Content, \"content\", { baseComponent: true });\n\nexport const ComboboxContent = forwardRef<HTMLDivElement, ComboboxContentProps>((props, ref) => (\n <ComboboxPositioner>\n <ComboboxContentStandalone ref={ref} {...props} />\n </ComboboxPositioner>\n));\n\nexport interface ComboboxControlProps extends Combobox.ControlProps, StyledProps {}\n\nexport const ComboboxControl = withContext(Combobox.Control, \"control\", { baseComponent: true });\n\nexport interface ComboboxInputProps extends Combobox.InputProps, StyledProps {}\n\nexport const ComboboxInput = withContext(Combobox.Input, \"input\", { baseComponent: true });\n\nconst InternalComboboxItemGroupLabel = withContext(Combobox.ItemGroupLabel, \"itemGroupLabel\");\n\nexport interface ComboboxItemGroupLabelProps\n extends Omit<Combobox.ItemGroupLabelProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const ComboboxItemGroupLabel = ({\n children,\n textStyle = \"label.small\",\n fontWeight = \"bold\",\n ...props\n}: ComboboxItemGroupLabelProps) => (\n <InternalComboboxItemGroupLabel asChild>\n <Text asChild consumeCss textStyle={textStyle} fontWeight={fontWeight} {...props}>\n <div>{children}</div>\n </Text>\n </InternalComboboxItemGroupLabel>\n);\n\nexport interface ComboboxItemGroupProps extends Combobox.ItemGroupProps, StyledProps {}\n\nexport const ComboboxItemGroup = withContext(Combobox.ItemGroup, \"itemGroup\", { baseComponent: true });\n\nexport interface ComboboxItemIndicatorProps extends Combobox.ItemIndicatorProps, StyledProps {}\n\nexport const ComboboxItemIndicator = withContext(Combobox.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport interface ComboboxItemProps extends Combobox.ItemProps, StyledProps {}\n\nexport const ComboboxItem = withContext(Combobox.Item, \"item\", { baseComponent: true });\n\nconst InternalComboboxItemText = withContext(Combobox.ItemText, \"itemText\");\n\nexport interface ComboboxItemTextProps\n extends Omit<Combobox.ItemTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const ComboboxItemText = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n children,\n ...props\n}: ComboboxItemTextProps) => (\n <InternalComboboxItemText asChild>\n <Text {...props} textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalComboboxItemText>\n);\n\nconst InternalComboboxLabel = withContext(Combobox.Label, \"label\");\n\nexport interface ComboboxLabelProps\n extends Omit<Combobox.LabelProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLLabelElement> {}\n\nexport const ComboboxLabel = ({ textStyle = \"label.medium\", fontWeight = \"bold\", ...props }: ComboboxLabelProps) => (\n <InternalComboboxLabel asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props} />\n </InternalComboboxLabel>\n);\n\nexport interface ComboboxPositionerProps extends Combobox.PositionerProps, StyledProps {}\n\nexport const ComboboxPositioner = withContext(Combobox.Positioner, \"positioner\", { baseComponent: true });\n\nexport interface ComboboxTriggerProps extends Combobox.TriggerProps, StyledProps {}\n\nexport const ComboboxTrigger = withContext(Combobox.Trigger, \"trigger\", { baseComponent: true });\n\nexport interface ComboboxListProps extends Combobox.ListProps, StyledProps {}\n\nexport const ComboboxList = withContext(Combobox.List, \"list\", { baseComponent: true });\n"],"mappings":";;;;;;;;;AAiJA,MAAM,EAAE,cAAc,gBAAgB,mBAjIf,IAAI;CACzB,OAAO,gBAAgB,MAAM;CAC7B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACD,SAAS;GACP,SAAS;GACT,YAAY;GACZ,KAAK;GACN;EACD,SAAS;GACP,SAAS;GACT,eAAe;GACf,QAAQ;GACR,YAAY;GACZ,WAAW;GACX,WAAW;GACX,OAAO;IACL,WAAW;IACX,eAAe,EACb,WAAW,QACZ;IACF;GACD,SAAS;IACP,WAAW;IACX,eAAe,EACb,WAAW,QACZ;IACF;GACF;EACD,MAAM;GACJ,SAAS;GACT,gBAAgB;GAChB,YAAY;GACZ,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,YAAY;GACZ,WAAW;IACT,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,QAAQ;KACN,YAAY;KACZ,OAAO;KACR;IACF;GACD,QAAQ,EACN,YAAY,iBACb;GACD,cAAc,EACZ,YAAY,iBACb;GACD,UAAU;IACR,YAAY;IACZ,cAAc,EACZ,YAAY,iBACb;IACF;GACF;EACD,SAAS;GACP,SAAS;IACP,OAAO;IACP,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,eAAe;KACb,YAAY;KACZ,oBAAoB;KACrB;IACF;GACD,OAAO,EACL,SAAS,EACP,WAAW,kBACZ,EACF;GACF;EACD,eAAe,EACb,OAAO,kBACR;EACD,UAAU;GACR,UAAU,EACR,gBAAgB,aACjB;GACD,cAAc,EACZ,gBAAgB,aACjB;GACF;EACD,WAAW;GACT,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACF;CACD,iBAAiB;EACf,SAAS;EACT,SAAS;EACV;CACD,UAAU;EACR,SAAS;GACP,YAAY,EACV,SAAS;IACP,WAAW;IACX,cAAc;IACd,SAAS;IACV,EACF;GACD,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AY,gBACZ,aAAa,QACb,UACA,GAAG,YAEH,oBAAC;CAAyB;WACxB,oBAAC;EAAK,GAAI;EAAkB;EAAuB;EAAY;EAAQ;YACrE,oBAAC,SAAK,WAAe;GAChB;EACkB;AAG7B,MAAM,wBAAwB,YAAY,SAAS,OAAO,QAAQ;AAKlE,MAAa,iBAAiB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,GAAG,YAClF,oBAAC;CAAsB;WACrB,oBAAC;EAAiB;EAAuB;EAAY,GAAI;GAAS;EAC5C;AAK1B,MAAa,qBAAqB,YAAY,SAAS,YAAY,cAAc,EAAE,eAAe,MAAM,CAAC;AAIzG,MAAa,kBAAkB,YAAY,SAAS,SAAS,WAAW,EAAE,eAAe,MAAM,CAAC;AAIhG,MAAa,eAAe,YAAY,SAAS,MAAM,QAAQ,EAAE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Combobox.mjs","names":[],"sources":["../src/Combobox.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 { Combobox, comboboxAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, type ElementType, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport { Text, type TextProps } from \"./Text\";\n\nconst comboboxRecipe = sva({\n slots: comboboxAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n control: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4xsmall\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n zIndex: \"dropdown\",\n background: \"surface.default\",\n overflowY: \"auto\",\n maxHeight: \"min(token(spacing.surface.xsmall), 45vh)\",\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 item: {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n cursor: \"pointer\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color, border-color\",\n transitionTimingFunction: \"default\",\n background: \"surface.default\",\n _disabled: {\n cursor: \"not-allowed\",\n background: \"surface.disabled\",\n color: \"text.disabled\",\n _hover: {\n background: \"surface.disabled\",\n color: \"text.disabled\",\n },\n },\n _hover: {\n background: \"surface.hover\",\n },\n _highlighted: {\n background: \"surface.hover\",\n },\n _checked: {\n background: \"surface.selected\",\n _highlighted: {\n background: \"surface.hover\",\n },\n },\n },\n trigger: {\n \"& svg\": {\n color: \"icon.default\",\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n _open: {\n \"& svg\": {\n transform: \"rotate(180deg)\",\n },\n },\n },\n itemIndicator: {\n color: \"stroke.default\",\n },\n itemText: {\n _checked: {\n textDecoration: \"underline\",\n },\n _highlighted: {\n textDecoration: \"underline\",\n },\n },\n itemGroup: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4xsmall\",\n },\n },\n defaultVariants: {\n context: \"standalone\",\n variant: \"simple\",\n },\n variants: {\n context: {\n standalone: {\n content: {\n boxShadow: \"large\",\n borderRadius: \"xsmall\",\n padding: \"xsmall\",\n },\n },\n composite: {},\n },\n variant: {\n simple: {\n item: {\n padding: \"xsmall\",\n borderRadius: \"xsmall\",\n },\n content: {\n gap: \"4xsmall\",\n },\n },\n complex: {},\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(comboboxRecipe);\n\nexport type ComboboxVariantProps = NonNullable<RecipeVariantProps<typeof comboboxRecipe>>;\n\nexport interface ComboboxRootProps<T extends Combobox.CollectionItem>\n extends StyledProps, Combobox.RootProps<T>, ComboboxVariantProps, RefAttributes<HTMLDivElement> {\n translations: Combobox.RootProps<T>[\"translations\"];\n}\n\nconst InternalComboboxRoot = withProvider<ElementType<ComboboxRootProps<Combobox.CollectionItem>>>(\n Combobox.Root,\n \"root\",\n { baseComponent: true },\n);\n\nexport const ComboboxRoot = <T extends Combobox.CollectionItem>({\n lazyMount = true,\n unmountOnExit = true,\n ...props\n}: ComboboxRootProps<T>) => {\n return <InternalComboboxRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />;\n};\n\nexport interface ComboboxClearTriggerProps extends Combobox.ClearTriggerProps, StyledProps {}\n\nexport const ComboboxClearTrigger = withContext(Combobox.ClearTrigger, \"clearTrigger\", { baseComponent: true });\n\nexport interface ComboboxContentProps extends Combobox.ContentProps, StyledProps {}\n\nexport const ComboboxContentStandalone = withContext(Combobox.Content, \"content\", { baseComponent: true });\n\nexport const ComboboxContent = forwardRef<HTMLDivElement, ComboboxContentProps>((props, ref) => (\n <ComboboxPositioner>\n <ComboboxContentStandalone ref={ref} {...props} />\n </ComboboxPositioner>\n));\n\nexport interface ComboboxControlProps extends Combobox.ControlProps, StyledProps {}\n\nexport const ComboboxControl = withContext(Combobox.Control, \"control\", { baseComponent: true });\n\nexport interface ComboboxInputProps extends Combobox.InputProps, StyledProps {}\n\nexport const ComboboxInput = withContext(Combobox.Input, \"input\", { baseComponent: true });\n\nconst InternalComboboxItemGroupLabel = withContext(Combobox.ItemGroupLabel, \"itemGroupLabel\");\n\nexport interface ComboboxItemGroupLabelProps\n extends Omit<Combobox.ItemGroupLabelProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const ComboboxItemGroupLabel = ({\n children,\n textStyle = \"label.small\",\n fontWeight = \"bold\",\n ...props\n}: ComboboxItemGroupLabelProps) => (\n <InternalComboboxItemGroupLabel asChild>\n <Text asChild consumeCss textStyle={textStyle} fontWeight={fontWeight} {...props}>\n <div>{children}</div>\n </Text>\n </InternalComboboxItemGroupLabel>\n);\n\nexport interface ComboboxItemGroupProps extends Combobox.ItemGroupProps, StyledProps {}\n\nexport const ComboboxItemGroup = withContext(Combobox.ItemGroup, \"itemGroup\", { baseComponent: true });\n\nexport interface ComboboxItemIndicatorProps extends Combobox.ItemIndicatorProps, StyledProps {}\n\nexport const ComboboxItemIndicator = withContext(Combobox.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport interface ComboboxItemProps extends Combobox.ItemProps, StyledProps {}\n\nexport const ComboboxItem = withContext(Combobox.Item, \"item\", { baseComponent: true });\n\nconst InternalComboboxItemText = withContext(Combobox.ItemText, \"itemText\");\n\nexport interface ComboboxItemTextProps\n extends Omit<Combobox.ItemTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const ComboboxItemText = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n children,\n ...props\n}: ComboboxItemTextProps) => (\n <InternalComboboxItemText asChild>\n <Text {...props} textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalComboboxItemText>\n);\n\nconst InternalComboboxLabel = withContext(Combobox.Label, \"label\");\n\nexport interface ComboboxLabelProps\n extends Omit<Combobox.LabelProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLLabelElement> {}\n\nexport const ComboboxLabel = ({ textStyle = \"label.medium\", fontWeight = \"bold\", ...props }: ComboboxLabelProps) => (\n <InternalComboboxLabel asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props} />\n </InternalComboboxLabel>\n);\n\nexport interface ComboboxPositionerProps extends Combobox.PositionerProps, StyledProps {}\n\nexport const ComboboxPositioner = withContext(Combobox.Positioner, \"positioner\", { baseComponent: true });\n\nexport interface ComboboxTriggerProps extends Combobox.TriggerProps, StyledProps {}\n\nexport const ComboboxTrigger = withContext(Combobox.Trigger, \"trigger\", { baseComponent: true });\n\nexport interface ComboboxListProps extends Combobox.ListProps, StyledProps {}\n\nexport const ComboboxList = withContext(Combobox.List, \"list\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;;;;;AAiJA,MAAM,EAAE,cAAc,gBAAgB,mBAjIf,IAAI;CACzB,OAAO,gBAAgB,MAAM;CAC7B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACD,SAAS;GACP,SAAS;GACT,YAAY;GACZ,KAAK;GACN;EACD,SAAS;GACP,SAAS;GACT,eAAe;GACf,QAAQ;GACR,YAAY;GACZ,WAAW;GACX,WAAW;GACX,OAAO;IACL,WAAW;IACX,eAAe,EACb,WAAW,QACZ;IACF;GACD,SAAS;IACP,WAAW;IACX,eAAe,EACb,WAAW,QACZ;IACF;GACF;EACD,MAAM;GACJ,SAAS;GACT,gBAAgB;GAChB,YAAY;GACZ,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,YAAY;GACZ,WAAW;IACT,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,QAAQ;KACN,YAAY;KACZ,OAAO;KACR;IACF;GACD,QAAQ,EACN,YAAY,iBACb;GACD,cAAc,EACZ,YAAY,iBACb;GACD,UAAU;IACR,YAAY;IACZ,cAAc,EACZ,YAAY,iBACb;IACF;GACF;EACD,SAAS;GACP,SAAS;IACP,OAAO;IACP,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,eAAe;KACb,YAAY;KACZ,oBAAoB;KACrB;IACF;GACD,OAAO,EACL,SAAS,EACP,WAAW,kBACZ,EACF;GACF;EACD,eAAe,EACb,OAAO,kBACR;EACD,UAAU;GACR,UAAU,EACR,gBAAgB,aACjB;GACD,cAAc,EACZ,gBAAgB,aACjB;GACF;EACD,WAAW;GACT,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACF;CACD,iBAAiB;EACf,SAAS;EACT,SAAS;EACV;CACD,UAAU;EACR,SAAS;GACP,YAAY,EACV,SAAS;IACP,WAAW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WAAW;AAK3E,MAAa,oBAAoB,EAC/B,YAAY,gBACZ,aAAa,QACb,UACA,GAAG,YAEH,oBAAC;CAAyB;WACxB,oBAAC;EAAK,GAAI;EAAkB;EAAuB;EAAY;EAAQ;YACrE,oBAAC,SAAK,WAAe;GAChB;EACkB;AAG7B,MAAM,wBAAwB,YAAY,SAAS,OAAO,QAAQ;AAKlE,MAAa,iBAAiB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,GAAG,YAClF,oBAAC;CAAsB;WACrB,oBAAC;EAAiB;EAAuB;EAAY,GAAI;GAAS;EAC5C;AAK1B,MAAa,qBAAqB,YAAY,SAAS,YAAY,cAAc,EAAE,eAAe,MAAM,CAAC;AAIzG,MAAa,kBAAkB,YAAY,SAAS,SAAS,WAAW,EAAE,eAAe,MAAM,CAAC;AAIhG,MAAa,eAAe,YAAY,SAAS,MAAM,QAAQ,EAAE,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.mjs","names":[],"sources":["../src/DatePicker.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 { DatePicker, datePickerAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext, type StyledProps } from \"@ndla/styled-system/jsx\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport type { TextProps } from \"./Text\";\nimport { Label } from \"./Label\";\n\nconst datePickerRecipe = sva({\n slots: datePickerAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n content: {\n background: \"surface.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"large\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n zIndex: \"dropdown\",\n _open: {\n animation: \"fade-shift-in 0.25s ease-in-out\",\n },\n _closed: {\n animation: \"fade-shift-out 0.25s ease-in-out\",\n },\n },\n control: {\n display: \"flex\",\n width: \"fit-content\",\n gap: \"xsmall\",\n },\n label: {},\n tableHeader: {},\n viewControl: {\n display: \"flex\",\n gap: \"5xsmall\",\n justifyContent: \"space-between\",\n },\n table: {\n width: \"100%\",\n borderCollapse: \"separate\",\n borderSpacing: \"5xsmall\",\n margin: \"-5xsmall\",\n },\n tableCell: {\n textAlign: \"center\",\n },\n tableCellTrigger: {\n width: \"100%\",\n \"&[data-today]\": {\n _before: {\n content: \"'-'\",\n color: \"stroke.default\",\n position: \"absolute\",\n marginBlockStart: \"medium\",\n },\n },\n \"&[data-outside-range]\": {\n color: \"text.subtle\",\n fontWeight: \"normal\",\n },\n },\n view: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n },\n});\nconst { withProvider, withContext } = createStyleContext(datePickerRecipe);\n\nexport interface DatePickerRootProps extends DatePicker.RootProps, StyledProps {\n translations: DatePicker.RootProps[\"translations\"];\n locale: DatePicker.RootProps[\"locale\"];\n}\n\nexport const DatePickerRoot = withProvider(DatePicker.Root, \"root\", { baseComponent: true });\n\nexport const DatePickerClearTrigger = withContext(DatePicker.ClearTrigger, \"clearTrigger\", {\n baseComponent: true,\n});\n\ninterface DatePickerContentProps extends DatePicker.ContentProps, StyledProps {}\n\nexport const DatePickerContent = forwardRef<HTMLDivElement, DatePickerContentProps>((props, ref) => (\n <DatePickerPositioner>\n <DatePickerStandaloneContent {...props} ref={ref} />\n </DatePickerPositioner>\n));\n\nexport const DatePickerStandaloneContent = withContext(DatePicker.Content, \"content\", { baseComponent: true });\n\nexport const DatePickerControl = withContext(DatePicker.Control, \"control\", { baseComponent: true });\n\nexport const DatePickerInput = withContext(DatePicker.Input, \"input\", { baseComponent: true });\n\ninterface DatePickerLabelProps\n extends Omit<DatePicker.LabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLLabelElement> {}\n\nconst InternalDatePickerLabel = withContext(DatePicker.Label, \"label\");\n\nexport const DatePickerLabel = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n ...props\n}: DatePickerLabelProps) => (\n <InternalDatePickerLabel asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props} />\n </InternalDatePickerLabel>\n);\n\nexport const DatePickerMonthSelect = withContext(DatePicker.MonthSelect, \"monthSelect\", { baseComponent: true });\n\ninterface DatePickerNextTrigger extends DatePicker.NextTriggerProps, StyledProps {}\n\nexport const DatePickerNextTrigger = withContext(DatePicker.NextTrigger, \"nextTrigger\", { baseComponent: true });\n\nexport const DatePickerPositioner = withContext(DatePicker.Positioner, \"positioner\", { baseComponent: true });\n\nexport const DatePickerPresetTrigger = withContext(DatePicker.PresetTrigger, \"presetTrigger\", { baseComponent: true });\n\nexport const DatePickerPrevTrigger = withContext(DatePicker.PrevTrigger, \"prevTrigger\", { baseComponent: true });\n\nexport const DatePickerRangeText = withContext(DatePicker.RangeText, \"rangeText\", { baseComponent: true });\n\nexport const DatePickerTableBody = withContext(DatePicker.TableBody, \"tableBody\", { baseComponent: true });\n\nexport const DatePickerTableCell = withContext(DatePicker.TableCell, \"tableCell\", { baseComponent: true });\n\nexport const DatePickerTableCellTrigger = withContext(DatePicker.TableCellTrigger, \"tableCellTrigger\", {\n baseComponent: true,\n});\n\nexport const DatePickerTableHead = withContext(DatePicker.TableHead, \"tableHead\", { baseComponent: true });\n\nexport const DatePickerTableHeader = withContext(DatePicker.TableHeader, \"tableHeader\", { baseComponent: true });\n\nexport const DatePickerTable = withContext(DatePicker.Table, \"table\", { baseComponent: true });\n\nexport const DatePickerTableRow = withContext(DatePicker.TableRow, \"tableRow\", { baseComponent: true });\n\nexport const DatePickerTrigger = withContext(DatePicker.Trigger, \"trigger\", { baseComponent: true });\n\nexport const DatePickerViewControl = withContext(DatePicker.ViewControl, \"viewControl\", { baseComponent: true });\n\nexport const DatePickerView = withContext(DatePicker.View, \"view\", { baseComponent: true });\n\nexport const DatePickerViewTrigger = withContext(DatePicker.ViewTrigger, \"viewTrigger\", { baseComponent: true });\n\nexport const DatePickerYearSelect = withContext(DatePicker.YearSelect, \"yearSelect\", { baseComponent: true });\n\nexport { DatePickerContext } from \"@ark-ui/react\";\n"],"mappings":";;;;;;;;;;;;;;;AAkFA,MAAM,EAAE,cAAc,gBAAgB,mBAnEb,IAAI;CAC3B,OAAO,kBAAkB,MAAM;CAC/B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACD,SAAS;GACP,YAAY;GACZ,cAAc;GACd,WAAW;GACX,SAAS;GACT,eAAe;GACf,KAAK;GACL,SAAS;GACT,QAAQ;GACR,OAAO,EACL,WAAW,mCACZ;GACD,SAAS,EACP,WAAW,oCACZ;GACF;EACD,SAAS;GACP,SAAS;GACT,OAAO;GACP,KAAK;GACN;EACD,OAAO,EAAE;EACT,aAAa,EAAE;EACf,aAAa;GACX,SAAS;GACT,KAAK;GACL,gBAAgB;GACjB;EACD,OAAO;GACL,OAAO;GACP,gBAAgB;GAChB,eAAe;GACf,QAAQ;GACT;EACD,WAAW,EACT,WAAW,UACZ;EACD,kBAAkB;GAChB,OAAO;GACP,iBAAiB,EACf,SAAS;IACP,SAAS;IACT,OAAO;IACP,UAAU;IACV,kBAAkB;IACnB,EACF;GACD,yBAAyB;IACvB,OAAO;IACP,YAAY;IACb;GACF;EACD,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACN;EACF;CACF,CAAC,CACwE;AAO1E,MAAa,iBAAiB,aAAa,WAAW,MAAM,QAAQ,EAAE,eAAe,MAAM,CAAC;AAE5F,MAAa,yBAAyB,YAAY,WAAW,cAAc,gBAAgB,EACzF,eAAe,MAChB,CAAC;AAIF,MAAa,oBAAoB,YAAoD,OAAO,QAC1F,oBAAC,kCACC,oBAAC;CAA4B,GAAI;CAAY;EAAO,GAC/B,CACvB;AAEF,MAAa,8BAA8B,YAAY,WAAW,SAAS,WAAW,EAAE,eAAe,MAAM,CAAC;AAE9G,MAAa,oBAAoB,Y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AAY,WAAW,SAAS,WAAW,EAAE,eAAe,MAAM,CAAC;AAEpG,MAAa,wBAAwB,YAAY,WAAW,aAAa,eAAe,EAAE,eAAe,MAAM,CAAC;AAEhH,MAAa,iBAAiB,YAAY,WAAW,MAAM,QAAQ,EAAE,eAAe,MAAM,CAAC;AAE3F,MAAa,wBAAwB,YAAY,WAAW,aAAa,eAAe,EAAE,eAAe,MAAM,CAAC;AAEhH,MAAa,uBAAuB,YAAY,WAAW,YAAY,cAAc,EAAE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"DatePicker.mjs","names":[],"sources":["../src/DatePicker.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 { DatePicker, datePickerAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext, type StyledProps } from \"@ndla/styled-system/jsx\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport type { TextProps } from \"./Text\";\n\nconst datePickerRecipe = sva({\n slots: datePickerAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n content: {\n background: \"surface.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"large\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n zIndex: \"dropdown\",\n _open: {\n animation: \"fade-shift-in 0.25s ease-in-out\",\n },\n _closed: {\n animation: \"fade-shift-out 0.25s ease-in-out\",\n },\n },\n control: {\n display: \"flex\",\n width: \"fit-content\",\n gap: \"xsmall\",\n },\n label: {},\n tableHeader: {},\n viewControl: {\n display: \"flex\",\n gap: \"5xsmall\",\n justifyContent: \"space-between\",\n },\n table: {\n width: \"100%\",\n borderCollapse: \"separate\",\n borderSpacing: \"5xsmall\",\n margin: \"-5xsmall\",\n },\n tableCell: {\n textAlign: \"center\",\n },\n tableCellTrigger: {\n width: \"100%\",\n \"&[data-today]\": {\n _before: {\n content: \"'-'\",\n color: \"stroke.default\",\n position: \"absolute\",\n marginBlockStart: \"medium\",\n },\n },\n \"&[data-outside-range]\": {\n color: \"text.subtle\",\n fontWeight: \"normal\",\n },\n },\n view: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n },\n});\nconst { withProvider, withContext } = createStyleContext(datePickerRecipe);\n\nexport interface DatePickerRootProps extends DatePicker.RootProps, StyledProps {\n translations: DatePicker.RootProps[\"translations\"];\n locale: DatePicker.RootProps[\"locale\"];\n}\n\nexport const DatePickerRoot = withProvider(DatePicker.Root, \"root\", { baseComponent: true });\n\nexport const DatePickerClearTrigger = withContext(DatePicker.ClearTrigger, \"clearTrigger\", {\n baseComponent: true,\n});\n\ninterface DatePickerContentProps extends DatePicker.ContentProps, StyledProps {}\n\nexport const DatePickerContent = forwardRef<HTMLDivElement, DatePickerContentProps>((props, ref) => (\n <DatePickerPositioner>\n <DatePickerStandaloneContent {...props} ref={ref} />\n </DatePickerPositioner>\n));\n\nexport const DatePickerStandaloneContent = withContext(DatePicker.Content, \"content\", { baseComponent: true });\n\nexport const DatePickerControl = withContext(DatePicker.Control, \"control\", { baseComponent: true });\n\nexport const DatePickerInput = withContext(DatePicker.Input, \"input\", { baseComponent: true });\n\ninterface DatePickerLabelProps\n extends Omit<DatePicker.LabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLLabelElement> {}\n\nconst InternalDatePickerLabel = withContext(DatePicker.Label, \"label\");\n\nexport const DatePickerLabel = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n ...props\n}: DatePickerLabelProps) => (\n <InternalDatePickerLabel asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props} />\n </InternalDatePickerLabel>\n);\n\nexport const DatePickerMonthSelect = withContext(DatePicker.MonthSelect, \"monthSelect\", { baseComponent: true });\n\ninterface DatePickerNextTrigger extends DatePicker.NextTriggerProps, StyledProps {}\n\nexport const DatePickerNextTrigger = withContext(DatePicker.NextTrigger, \"nextTrigger\", { baseComponent: true });\n\nexport const DatePickerPositioner = withContext(DatePicker.Positioner, \"positioner\", { baseComponent: true });\n\nexport const DatePickerPresetTrigger = withContext(DatePicker.PresetTrigger, \"presetTrigger\", { baseComponent: true });\n\nexport const DatePickerPrevTrigger = withContext(DatePicker.PrevTrigger, \"prevTrigger\", { baseComponent: true });\n\nexport const DatePickerRangeText = withContext(DatePicker.RangeText, \"rangeText\", { baseComponent: true });\n\nexport const DatePickerTableBody = withContext(DatePicker.TableBody, \"tableBody\", { baseComponent: true });\n\nexport const DatePickerTableCell = withContext(DatePicker.TableCell, \"tableCell\", { baseComponent: true });\n\nexport const DatePickerTableCellTrigger = withContext(DatePicker.TableCellTrigger, \"tableCellTrigger\", {\n baseComponent: true,\n});\n\nexport const DatePickerTableHead = withContext(DatePicker.TableHead, \"tableHead\", { baseComponent: true });\n\nexport const DatePickerTableHeader = withContext(DatePicker.TableHeader, \"tableHeader\", { baseComponent: true });\n\nexport const DatePickerTable = withContext(DatePicker.Table, \"table\", { baseComponent: true });\n\nexport const DatePickerTableRow = withContext(DatePicker.TableRow, \"tableRow\", { baseComponent: true });\n\nexport const DatePickerTrigger = withContext(DatePicker.Trigger, \"trigger\", { baseComponent: true });\n\nexport const DatePickerViewControl = withContext(DatePicker.ViewControl, \"viewControl\", { baseComponent: true });\n\nexport const DatePickerView = withContext(DatePicker.View, \"view\", { baseComponent: true });\n\nexport const DatePickerViewTrigger = withContext(DatePicker.ViewTrigger, \"viewTrigger\", { baseComponent: true });\n\nexport const DatePickerYearSelect = withContext(DatePicker.YearSelect, \"yearSelect\", { baseComponent: true });\n\nexport { DatePickerContext } from \"@ark-ui/react\";\n"],"mappings":";;;;;;;;;;;;;;;AAkFA,MAAM,EAAE,cAAc,gBAAgB,mBAnEb,IAAI;CAC3B,OAAO,kBAAkB,MAAM;CAC/B,MAAM;EACJ,MAAM;GACJ,S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;AAEhH,MAAa,uBAAuB,YAAY,WAAW,YAAY,cAAc,EAAE,eAAe,MAAM,CAAC"}
package/es/Dialog.mjs CHANGED
@@ -6,6 +6,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef } from "react";
7
7
 
8
8
  //#region src/Dialog.tsx
9
+ /**
10
+ * Copyright (c) 2024-present, NDLA.
11
+ *
12
+ * This source code is licensed under the GPLv3 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ */
9
16
  const { withRootProvider, withContext } = createStyleContext(sva({
10
17
  slots: dialogAnatomy.keys(),
11
18
  base: {