@ndla/primitives 1.0.89-alpha.0 → 1.0.90-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 (186) hide show
  1. package/es/Accordion.js +106 -136
  2. package/es/Accordion.js.map +1 -0
  3. package/es/ArticleLists.js +112 -176
  4. package/es/ArticleLists.js.map +1 -0
  5. package/es/Badge.js +64 -80
  6. package/es/Badge.js.map +1 -0
  7. package/es/BlockQuote.js +33 -50
  8. package/es/BlockQuote.js.map +1 -0
  9. package/es/Button.js +226 -311
  10. package/es/Button.js.map +1 -0
  11. package/es/Card/Card.js +63 -88
  12. package/es/Card/Card.js.map +1 -0
  13. package/es/Checkbox.js +202 -244
  14. package/es/Checkbox.js.map +1 -0
  15. package/es/Combobox.js +163 -248
  16. package/es/Combobox.js.map +1 -0
  17. package/es/DatePicker.js +105 -174
  18. package/es/DatePicker.js.map +1 -0
  19. package/es/Dialog.js +270 -400
  20. package/es/Dialog.js.map +1 -0
  21. package/es/ErrorMessage/ErrorMessage.js +55 -76
  22. package/es/ErrorMessage/ErrorMessage.js.map +1 -0
  23. package/es/ExpandableBox.js +43 -57
  24. package/es/ExpandableBox.js.map +1 -0
  25. package/es/Field.js +11 -21
  26. package/es/Field.js.map +1 -0
  27. package/es/FieldErrorMessage.js +33 -63
  28. package/es/FieldErrorMessage.js.map +1 -0
  29. package/es/FieldHelper.js +32 -54
  30. package/es/FieldHelper.js.map +1 -0
  31. package/es/Figure.js +98 -119
  32. package/es/Figure.js.map +1 -0
  33. package/es/FileUpload.js +121 -169
  34. package/es/FileUpload.js.map +1 -0
  35. package/es/FramedContent.js +37 -54
  36. package/es/FramedContent.js.map +1 -0
  37. package/es/Hero.js +61 -116
  38. package/es/Hero.js.map +1 -0
  39. package/es/Image.js +111 -154
  40. package/es/Image.js.map +1 -0
  41. package/es/Input.js +117 -175
  42. package/es/Input.js.map +1 -0
  43. package/es/Label.js +49 -99
  44. package/es/Label.js.map +1 -0
  45. package/es/Layout/PageContainer.js +31 -45
  46. package/es/Layout/PageContainer.js.map +1 -0
  47. package/es/Layout/PageContent.js +62 -101
  48. package/es/Layout/PageContent.js.map +1 -0
  49. package/es/ListItem/ListItem.js +145 -211
  50. package/es/ListItem/ListItem.js.map +1 -0
  51. package/es/Menu.js +126 -214
  52. package/es/Menu.js.map +1 -0
  53. package/es/MessageBox.js +41 -58
  54. package/es/MessageBox.js.map +1 -0
  55. package/es/NdlaLogo.js +201 -283
  56. package/es/NdlaLogo.js.map +1 -0
  57. package/es/Pagination.js +27 -44
  58. package/es/Pagination.js.map +1 -0
  59. package/es/Popover.js +68 -119
  60. package/es/Popover.js.map +1 -0
  61. package/es/RadioGroup.js +114 -160
  62. package/es/RadioGroup.js.map +1 -0
  63. package/es/Select.js +151 -233
  64. package/es/Select.js.map +1 -0
  65. package/es/Skeleton.js +18 -28
  66. package/es/Skeleton.js.map +1 -0
  67. package/es/Slider.js +75 -110
  68. package/es/Slider.js.map +1 -0
  69. package/es/Spinner.js +44 -63
  70. package/es/Spinner.js.map +1 -0
  71. package/es/Switch.js +104 -138
  72. package/es/Switch.js.map +1 -0
  73. package/es/Table.js +61 -79
  74. package/es/Table.js.map +1 -0
  75. package/es/Tabs.js +183 -251
  76. package/es/Tabs.js.map +1 -0
  77. package/es/TagsInput.js +98 -141
  78. package/es/TagsInput.js.map +1 -0
  79. package/es/Text.js +30 -56
  80. package/es/Text.js.map +1 -0
  81. package/es/Toast.js +77 -119
  82. package/es/Toast.js.map +1 -0
  83. package/es/ToggleGroup.js +17 -28
  84. package/es/ToggleGroup.js.map +1 -0
  85. package/es/Tooltip.js +39 -70
  86. package/es/Tooltip.js.map +1 -0
  87. package/es/Tree/Tree.js +139 -216
  88. package/es/Tree/Tree.js.map +1 -0
  89. package/es/createStyleContext.js +52 -68
  90. package/es/createStyleContext.js.map +1 -0
  91. package/es/index.js +47 -53
  92. package/lib/Accordion.js +112 -143
  93. package/lib/Accordion.js.map +1 -0
  94. package/lib/ArticleLists.js +118 -185
  95. package/lib/ArticleLists.js.map +1 -0
  96. package/lib/Badge.js +67 -88
  97. package/lib/Badge.js.map +1 -0
  98. package/lib/BlockQuote.js +36 -58
  99. package/lib/BlockQuote.js.map +1 -0
  100. package/lib/Button.js +234 -320
  101. package/lib/Button.js.map +1 -0
  102. package/lib/Card/Card.js +68 -95
  103. package/lib/Card/Card.js.map +1 -0
  104. package/lib/Checkbox.js +210 -253
  105. package/lib/Checkbox.js.map +1 -0
  106. package/lib/Combobox.js +179 -259
  107. package/lib/Combobox.js.map +1 -0
  108. package/lib/DatePicker.js +130 -187
  109. package/lib/DatePicker.js.map +1 -0
  110. package/lib/Dialog.js +286 -411
  111. package/lib/Dialog.js.map +1 -0
  112. package/lib/ErrorMessage/ErrorMessage.js +61 -83
  113. package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
  114. package/lib/ExpandableBox.js +46 -64
  115. package/lib/ExpandableBox.js.map +1 -0
  116. package/lib/Field.js +14 -28
  117. package/lib/Field.js.map +1 -0
  118. package/lib/FieldErrorMessage.js +37 -71
  119. package/lib/FieldErrorMessage.js.map +1 -0
  120. package/lib/FieldHelper.js +36 -62
  121. package/lib/FieldHelper.js.map +1 -0
  122. package/lib/Figure.js +102 -128
  123. package/lib/Figure.js.map +1 -0
  124. package/lib/FileUpload.js +137 -178
  125. package/lib/FileUpload.js.map +1 -0
  126. package/lib/FramedContent.js +40 -62
  127. package/lib/FramedContent.js.map +1 -0
  128. package/lib/Hero.js +65 -123
  129. package/lib/Hero.js.map +1 -0
  130. package/lib/Image.js +118 -164
  131. package/lib/Image.js.map +1 -0
  132. package/lib/Input.js +129 -188
  133. package/lib/Input.js.map +1 -0
  134. package/lib/Label.js +54 -106
  135. package/lib/Label.js.map +1 -0
  136. package/lib/Layout/PageContainer.js +32 -51
  137. package/lib/Layout/PageContainer.js.map +1 -0
  138. package/lib/Layout/PageContent.js +66 -109
  139. package/lib/Layout/PageContent.js.map +1 -0
  140. package/lib/ListItem/ListItem.js +151 -219
  141. package/lib/ListItem/ListItem.js.map +1 -0
  142. package/lib/Menu.js +140 -226
  143. package/lib/Menu.js.map +1 -0
  144. package/lib/MessageBox.js +44 -66
  145. package/lib/MessageBox.js.map +1 -0
  146. package/lib/NdlaLogo.js +203 -291
  147. package/lib/NdlaLogo.js.map +1 -0
  148. package/lib/Pagination.js +34 -51
  149. package/lib/Pagination.js.map +1 -0
  150. package/lib/Popover.js +83 -128
  151. package/lib/Popover.js.map +1 -0
  152. package/lib/RadioGroup.js +123 -169
  153. package/lib/RadioGroup.js.map +1 -0
  154. package/lib/Select.js +171 -243
  155. package/lib/Select.js.map +1 -0
  156. package/lib/Skeleton.js +19 -34
  157. package/lib/Skeleton.js.map +1 -0
  158. package/lib/Slider.js +83 -118
  159. package/lib/Slider.js.map +1 -0
  160. package/lib/Spinner.js +46 -70
  161. package/lib/Spinner.js.map +1 -0
  162. package/lib/Switch.js +110 -146
  163. package/lib/Switch.js.map +1 -0
  164. package/lib/Table.js +61 -84
  165. package/lib/Table.js.map +1 -0
  166. package/lib/Tabs.js +189 -260
  167. package/lib/Tabs.js.map +1 -0
  168. package/lib/TagsInput.js +110 -149
  169. package/lib/TagsInput.js.map +1 -0
  170. package/lib/Text.js +33 -63
  171. package/lib/Text.js.map +1 -0
  172. package/lib/Toast.js +83 -128
  173. package/lib/Toast.js.map +1 -0
  174. package/lib/ToggleGroup.js +19 -34
  175. package/lib/ToggleGroup.js.map +1 -0
  176. package/lib/Tooltip.js +47 -77
  177. package/lib/Tooltip.js.map +1 -0
  178. package/lib/Tree/Tree.js +155 -223
  179. package/lib/Tree/Tree.js.map +1 -0
  180. package/lib/_virtual/rolldown_runtime.js +30 -0
  181. package/lib/createStyleContext.js +54 -76
  182. package/lib/createStyleContext.js.map +1 -0
  183. package/lib/index.js +313 -1586
  184. package/package.json +7 -6
  185. package/es/storybookHelpers/data.js +0 -212
  186. package/lib/storybookHelpers/data.js +0 -218
package/es/Accordion.js CHANGED
@@ -1,140 +1,110 @@
1
- /**
2
- * Copyright (c) 2024-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
1
+ import { createStyleContext } from "./createStyleContext.js";
9
2
  import { Accordion, accordionAnatomy } from "@ark-ui/react";
10
3
  import { sva } from "@ndla/styled-system/css";
11
- import { createStyleContext } from "./createStyleContext";
4
+
5
+ //#region src/Accordion.tsx
12
6
  const accordionRecipe = sva({
13
- slots: accordionAnatomy.keys(),
14
- base: {
15
- root: {
16
- display: "flex",
17
- flexDirection: "column",
18
- gap: "3xsmall"
19
- },
20
- itemTrigger: {
21
- display: "flex",
22
- alignItems: "center",
23
- justifyContent: "space-between",
24
- background: "surface.default",
25
- cursor: "pointer",
26
- transitionDuration: "fast",
27
- transitionTimingFunction: "default",
28
- transitionProperty: "background, border-color, border, border-radius",
29
- _closed: {
30
- transitionProperty: "background, border-color, border, border-radius"
31
- },
32
- _disabled: {
33
- cursor: "not-allowed",
34
- background: "surface.disabled.subtle",
35
- boxShadowColor: "stroke.disabled",
36
- color: "text.disabled",
37
- _hover: {
38
- background: "surface.disabled.subtle",
39
- boxShadowColor: "stroke.disabled",
40
- color: "text.disabled"
41
- }
42
- }
43
- },
44
- itemIndicator: {
45
- color: "icon.strong",
46
- transformOrigin: "center",
47
- transitionDuration: "normal",
48
- transitionProperty: "transform",
49
- transitionTimingFunction: "default",
50
- _open: {
51
- transform: "rotate(180deg)"
52
- },
53
- _motionReduce: {
54
- transition: "none",
55
- transitionDuration: "0s"
56
- }
57
- },
58
- itemContent: {
59
- overflow: "hidden",
60
- // TODO: Is this needed?
61
- transitionProperty: "padding-bottom",
62
- transitionDuration: "normal",
63
- transitionTimingFunction: "default",
64
- paddingBlock: "xsmall",
65
- paddingInline: "small",
66
- _open: {
67
- animation: "collapse-in",
68
- _motionReduce: {
69
- animation: "none"
70
- }
71
- },
72
- _closed: {
73
- animation: "collapse-out",
74
- _motionReduce: {
75
- animation: "none"
76
- }
77
- }
78
- },
79
- item: {
80
- width: "100%"
81
- }
82
- },
83
- defaultVariants: {
84
- variant: "bordered"
85
- },
86
- variants: {
87
- variant: {
88
- clean: {},
89
- bordered: {
90
- itemTrigger: {
91
- paddingInline: "medium",
92
- paddingBlock: "medium",
93
- width: "100%",
94
- borderRadius: "xsmall",
95
- boxShadowColor: "stroke.subtle",
96
- boxShadow: "inset 0 0 0 1px var(--shadow-color)",
97
- _hover: {
98
- background: "surface.actionSubtle.hover",
99
- boxShadowColor: "stroke.hover"
100
- },
101
- _open: {
102
- background: "surface.actionSubtle.active",
103
- boxShadowColor: "stroke.default",
104
- borderBottomRadius: "sharp"
105
- },
106
- _focusVisible: {
107
- outline: "none",
108
- boxShadowColor: "stroke.default",
109
- boxShadow: "inset 0 0 0 3px var(--shadow-color)"
110
- }
111
- },
112
- itemContent: {
113
- borderBottomRadius: "xsmall",
114
- borderWidth: "0 1px 1px",
115
- borderStyle: "solid",
116
- borderColor: "stroke.default"
117
- }
118
- }
119
- }
120
- }
121
- });
122
- const {
123
- withProvider,
124
- withContext
125
- } = createStyleContext(accordionRecipe);
126
- export const AccordionRoot = withProvider(Accordion.Root, "root", {
127
- baseComponent: true
128
- });
129
- export const AccordionItemContent = withContext(Accordion.ItemContent, "itemContent", {
130
- baseComponent: true
7
+ slots: accordionAnatomy.keys(),
8
+ base: {
9
+ root: {
10
+ display: "flex",
11
+ flexDirection: "column",
12
+ gap: "3xsmall"
13
+ },
14
+ itemTrigger: {
15
+ display: "flex",
16
+ alignItems: "center",
17
+ justifyContent: "space-between",
18
+ background: "surface.default",
19
+ cursor: "pointer",
20
+ transitionDuration: "fast",
21
+ transitionTimingFunction: "default",
22
+ transitionProperty: "background, border-color, border, border-radius",
23
+ _closed: { transitionProperty: "background, border-color, border, border-radius" },
24
+ _disabled: {
25
+ cursor: "not-allowed",
26
+ background: "surface.disabled.subtle",
27
+ boxShadowColor: "stroke.disabled",
28
+ color: "text.disabled",
29
+ _hover: {
30
+ background: "surface.disabled.subtle",
31
+ boxShadowColor: "stroke.disabled",
32
+ color: "text.disabled"
33
+ }
34
+ }
35
+ },
36
+ itemIndicator: {
37
+ color: "icon.strong",
38
+ transformOrigin: "center",
39
+ transitionDuration: "normal",
40
+ transitionProperty: "transform",
41
+ transitionTimingFunction: "default",
42
+ _open: { transform: "rotate(180deg)" },
43
+ _motionReduce: {
44
+ transition: "none",
45
+ transitionDuration: "0s"
46
+ }
47
+ },
48
+ itemContent: {
49
+ overflow: "hidden",
50
+ transitionProperty: "padding-bottom",
51
+ transitionDuration: "normal",
52
+ transitionTimingFunction: "default",
53
+ paddingBlock: "xsmall",
54
+ paddingInline: "small",
55
+ _open: {
56
+ animation: "collapse-in",
57
+ _motionReduce: { animation: "none" }
58
+ },
59
+ _closed: {
60
+ animation: "collapse-out",
61
+ _motionReduce: { animation: "none" }
62
+ }
63
+ },
64
+ item: { width: "100%" }
65
+ },
66
+ defaultVariants: { variant: "bordered" },
67
+ variants: { variant: {
68
+ clean: {},
69
+ bordered: {
70
+ itemTrigger: {
71
+ paddingInline: "medium",
72
+ paddingBlock: "medium",
73
+ width: "100%",
74
+ borderRadius: "xsmall",
75
+ boxShadowColor: "stroke.subtle",
76
+ boxShadow: "inset 0 0 0 1px var(--shadow-color)",
77
+ _hover: {
78
+ background: "surface.actionSubtle.hover",
79
+ boxShadowColor: "stroke.hover"
80
+ },
81
+ _open: {
82
+ background: "surface.actionSubtle.active",
83
+ boxShadowColor: "stroke.default",
84
+ borderBottomRadius: "sharp"
85
+ },
86
+ _focusVisible: {
87
+ outline: "none",
88
+ boxShadowColor: "stroke.default",
89
+ boxShadow: "inset 0 0 0 3px var(--shadow-color)"
90
+ }
91
+ },
92
+ itemContent: {
93
+ borderBottomRadius: "xsmall",
94
+ borderWidth: "0 1px 1px",
95
+ borderStyle: "solid",
96
+ borderColor: "stroke.default"
97
+ }
98
+ }
99
+ } }
131
100
  });
132
- export const AccordionItemIndicator = withContext(Accordion.ItemIndicator, "itemIndicator", {
133
- baseComponent: true
134
- });
135
- export const AccordionItem = withContext(Accordion.Item, "item", {
136
- baseComponent: true
137
- });
138
- export const AccordionItemTrigger = withContext(Accordion.ItemTrigger, "itemTrigger", {
139
- baseComponent: true
140
- });
101
+ const { withProvider, withContext } = createStyleContext(accordionRecipe);
102
+ const AccordionRoot = withProvider(Accordion.Root, "root", { baseComponent: true });
103
+ const AccordionItemContent = withContext(Accordion.ItemContent, "itemContent", { baseComponent: true });
104
+ const AccordionItemIndicator = withContext(Accordion.ItemIndicator, "itemIndicator", { baseComponent: true });
105
+ const AccordionItem = withContext(Accordion.Item, "item", { baseComponent: true });
106
+ const AccordionItemTrigger = withContext(Accordion.ItemTrigger, "itemTrigger", { baseComponent: true });
107
+
108
+ //#endregion
109
+ export { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot };
110
+ //# sourceMappingURL=Accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.js","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 type { JsxStyleProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { createStyleContext } from \"./createStyleContext\";\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 = RecipeVariantProps<typeof accordionRecipe>;\n\nexport interface AccordionRootProps extends JsxStyleProps, Accordion.RootProps {}\n\nexport const AccordionRoot = withProvider<HTMLDivElement, AccordionRootProps & AccordionVariantProps>(\n Accordion.Root,\n \"root\",\n { baseComponent: true },\n);\n\nexport const AccordionItemContent = withContext<HTMLDivElement, JsxStyleProps & Accordion.ItemContentProps>(\n Accordion.ItemContent,\n \"itemContent\",\n { baseComponent: true },\n);\n\nexport const AccordionItemIndicator = withContext<HTMLDivElement, JsxStyleProps & Accordion.ItemIndicatorProps>(\n Accordion.ItemIndicator,\n \"itemIndicator\",\n { baseComponent: true },\n);\n\nexport interface AccordionItemProps extends JsxStyleProps, Accordion.ItemProps {}\n\nexport const AccordionItem = withContext<HTMLDivElement, AccordionItemProps>(Accordion.Item, \"item\", {\n baseComponent: true,\n});\n\nexport const AccordionItemTrigger = withContext<HTMLButtonElement, JsxStyleProps & Accordion.ItemTriggerProps>(\n Accordion.ItemTrigger,\n \"itemTrigger\",\n { baseComponent: true },\n);\n"],"mappings":";;;;;AAaA,MAAM,kBAAkB,IAAI;CAC1B,OAAO,iBAAiB,MAAM;CAC9B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;EACN;EACD,aAAa;GACX,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,YAAY;GACZ,QAAQ;GACR,oBAAoB;GACpB,0BAA0B;GAC1B,oBAAoB;GACpB,SAAS,EACP,oBAAoB,kDACrB;GACD,WAAW;IACT,QAAQ;IACR,YAAY;IACZ,gBAAgB;IAChB,OAAO;IACP,QAAQ;KACN,YAAY;KACZ,gBAAgB;KAChB,OAAO;IACR;GACF;EACF;EACD,eAAe;GACb,OAAO;GACP,iBAAiB;GACjB,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,OAAO,EACL,WAAW,iBACZ;GACD,eAAe;IACb,YAAY;IACZ,oBAAoB;GACrB;EACF;EACD,aAAa;GACX,UAAU;GAEV,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,cAAc;GACd,eAAe;GACf,OAAO;IACL,WAAW;IACX,eAAe,EACb,WAAW,OACZ;GACF;GACD,SAAS;IACP,WAAW;IACX,eAAe,EACb,WAAW,OACZ;GACF;EACF;EACD,MAAM,EACJ,OAAO,OACR;CACF;CACD,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,OAAO,CAAE;EACT,UAAU;GACR,aAAa;IACX,eAAe;IACf,cAAc;IACd,OAAO;IACP,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,QAAQ;KACN,YAAY;KACZ,gBAAgB;IACjB;IACD,OAAO;KACL,YAAY;KACZ,gBAAgB;KAChB,oBAAoB;IACrB;IACD,eAAe;KACb,SAAS;KACT,gBAAgB;KAChB,WAAW;IACZ;GACF;GACD,aAAa;IACX,oBAAoB;IACpB,aAAa;IACb,aAAa;IACb,aAAa;GACd;EACF;CACF,EACF;AACF,EAAC;AAEF,MAAM,EAAE,cAAc,aAAa,GAAG,mBAAmB,gBAAgB;AAMzE,MAAa,gBAAgB,aAC3B,UAAU,MACV,QACA,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,uBAAuB,YAClC,UAAU,aACV,eACA,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,yBAAyB,YACpC,UAAU,eACV,iBACA,EAAE,eAAe,KAAM,EACxB;AAID,MAAa,gBAAgB,YAAgD,UAAU,MAAM,QAAQ,EACnG,eAAe,KAChB,EAAC;AAEF,MAAa,uBAAuB,YAClC,UAAU,aACV,eACA,EAAE,eAAe,KAAM,EACxB"}
@@ -1,186 +1,122 @@
1
- /**
2
- * Copyright (c) 2024-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import { forwardRef, useMemo } from "react";
10
1
  import { ark } from "@ark-ui/react";
11
2
  import { css, cva } from "@ndla/styled-system/css";
3
+ import { forwardRef, useMemo } from "react";
12
4
  import { styled } from "@ndla/styled-system/jsx";
13
- import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/ArticleLists.tsx
14
8
  const LIST_ITEM = "& > li";
15
9
  const LETTER_LIST = "& > ol[data-variant='letters']";
16
10
  const NUMBER_LIST = "& > ol:not([data-variant='letters'])";
17
11
  const LETTER_LIST_ITEM = `${LETTER_LIST} > li`;
18
12
  const orderedListRecipe = cva({
19
- base: {
20
- marginInlineStart: "small",
21
- paddingInlineStart: "small",
22
- [LIST_ITEM]: {
23
- "& > ul": {
24
- marginInlineStart: "0 !important"
25
- },
26
- _before: {
27
- position: "absolute",
28
- transform: "translateX(calc(-100% + (token(spacing.small) * -1)))",
29
- fontVariantNumeric: "tabular-nums"
30
- }
31
- },
32
- "& li": {
33
- marginBlock: "small"
34
- }
35
- },
36
- defaultVariants: {
37
- variant: "numbers"
38
- },
39
- variants: {
40
- variant: {
41
- numbers: {
42
- [NUMBER_LIST]: {
43
- marginInlineStart: "0",
44
- paddingInlineStart: "0"
45
- },
46
- counterReset: "level1",
47
- "&[data-count='true']": {
48
- counterReset: "level1 var(--start, 0)"
49
- },
50
- [LIST_ITEM]: {
51
- counterIncrement: "level1",
52
- _before: {
53
- content: "counter(level1, decimal) '. '"
54
- },
55
- [NUMBER_LIST]: {
56
- counterReset: "level2",
57
- "&[data-count='true']": {
58
- counterReset: "level2 var(--start, 0)"
59
- },
60
- [LIST_ITEM]: {
61
- marginInlineStart: "small",
62
- counterIncrement: "level2",
63
- _before: {
64
- content: "counter(level1, decimal) '.' counter(level2, decimal) '. '"
65
- },
66
- [NUMBER_LIST]: {
67
- counterReset: "level3",
68
- "&[data-count='true']": {
69
- counterReset: "level3 var(--start, 0)"
70
- },
71
- [LIST_ITEM]: {
72
- marginInlineStart: "calc(1.5ch + token(spacing.small))",
73
- counterIncrement: "level3",
74
- _before: {
75
- content: "counter(level1, decimal) '.' counter(level2, decimal) '.' counter(level3, decimal) '. '"
76
- },
77
- [NUMBER_LIST]: {
78
- counterReset: "level4",
79
- "&[data-count='true']": {
80
- counterReset: "level4 var(--start, 0)"
81
- },
82
- [LIST_ITEM]: {
83
- marginInlineStart: "calc(3ch + token(spacing.small))",
84
- counterIncrement: "level4",
85
- _before: {
86
- content: "counter(level1, decimal) '.' counter(level2, decimal) '.' counter(level3, decimal) '.' counter(level4, decimal) '. '"
87
- }
88
- }
89
- }
90
- }
91
- }
92
- }
93
- }
94
- }
95
- },
96
- letters: {
97
- counterReset: "level1",
98
- "&[data-count='true']": {
99
- counterReset: "level1 var(--start, 0)"
100
- },
101
- [LETTER_LIST]: {
102
- marginInlineStart: "0",
103
- paddingInlineStart: "0"
104
- },
105
- [LIST_ITEM]: {
106
- counterIncrement: "level1",
107
- _before: {
108
- content: "counter(level1, upper-alpha) '. '"
109
- },
110
- [LETTER_LIST_ITEM]: {
111
- _before: {
112
- content: "counter(level1, lower-alpha) '. '"
113
- },
114
- [LETTER_LIST_ITEM]: {
115
- _before: {
116
- content: "counter(level1, lower-roman) '. '"
117
- }
118
- }
119
- }
120
- }
121
- }
122
- }
123
- }
13
+ base: {
14
+ marginInlineStart: "small",
15
+ paddingInlineStart: "small",
16
+ [LIST_ITEM]: {
17
+ "& > ul": { marginInlineStart: "0 !important" },
18
+ _before: {
19
+ position: "absolute",
20
+ transform: "translateX(calc(-100% + (token(spacing.small) * -1)))",
21
+ fontVariantNumeric: "tabular-nums"
22
+ }
23
+ },
24
+ "& li": { marginBlock: "small" }
25
+ },
26
+ defaultVariants: { variant: "numbers" },
27
+ variants: { variant: {
28
+ numbers: {
29
+ [NUMBER_LIST]: {
30
+ marginInlineStart: "0",
31
+ paddingInlineStart: "0"
32
+ },
33
+ counterReset: "level1",
34
+ "&[data-count='true']": { counterReset: "level1 var(--start, 0)" },
35
+ [LIST_ITEM]: {
36
+ counterIncrement: "level1",
37
+ _before: { content: "counter(level1, decimal) '. '" },
38
+ [NUMBER_LIST]: {
39
+ counterReset: "level2",
40
+ "&[data-count='true']": { counterReset: "level2 var(--start, 0)" },
41
+ [LIST_ITEM]: {
42
+ marginInlineStart: "small",
43
+ counterIncrement: "level2",
44
+ _before: { content: "counter(level1, decimal) '.' counter(level2, decimal) '. '" },
45
+ [NUMBER_LIST]: {
46
+ counterReset: "level3",
47
+ "&[data-count='true']": { counterReset: "level3 var(--start, 0)" },
48
+ [LIST_ITEM]: {
49
+ marginInlineStart: "calc(1.5ch + token(spacing.small))",
50
+ counterIncrement: "level3",
51
+ _before: { content: "counter(level1, decimal) '.' counter(level2, decimal) '.' counter(level3, decimal) '. '" },
52
+ [NUMBER_LIST]: {
53
+ counterReset: "level4",
54
+ "&[data-count='true']": { counterReset: "level4 var(--start, 0)" },
55
+ [LIST_ITEM]: {
56
+ marginInlineStart: "calc(3ch + token(spacing.small))",
57
+ counterIncrement: "level4",
58
+ _before: { content: "counter(level1, decimal) '.' counter(level2, decimal) '.' counter(level3, decimal) '.' counter(level4, decimal) '. '" }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ },
67
+ letters: {
68
+ counterReset: "level1",
69
+ "&[data-count='true']": { counterReset: "level1 var(--start, 0)" },
70
+ [LETTER_LIST]: {
71
+ marginInlineStart: "0",
72
+ paddingInlineStart: "0"
73
+ },
74
+ [LIST_ITEM]: {
75
+ counterIncrement: "level1",
76
+ _before: { content: "counter(level1, upper-alpha) '. '" },
77
+ [LETTER_LIST_ITEM]: {
78
+ _before: { content: "counter(level1, lower-alpha) '. '" },
79
+ [LETTER_LIST_ITEM]: { _before: { content: "counter(level1, lower-roman) '. '" } }
80
+ }
81
+ }
82
+ }
83
+ } }
124
84
  });
125
- const StyledOrderedList = styled(ark.ol, {}, {
126
- baseComponent: true
85
+ const StyledOrderedList = styled(ark.ol, {}, { baseComponent: true });
86
+ const OrderedList = forwardRef(({ variant, css: cssProp, start,...props }, ref) => {
87
+ const style = useMemo(() => ({ "--start": start ? start - 1 : void 0 }), [start]);
88
+ return /* @__PURE__ */ jsx(StyledOrderedList, {
89
+ "data-embed-type": "ordered-list",
90
+ "data-variant": variant,
91
+ "data-count": start !== void 0,
92
+ css: css.raw(orderedListRecipe.raw({ variant }), cssProp),
93
+ style,
94
+ ref,
95
+ ...props
96
+ });
127
97
  });
128
- export const OrderedList = /*#__PURE__*/forwardRef((_ref, ref) => {
129
- let {
130
- variant,
131
- css: cssProp,
132
- start,
133
- ...props
134
- } = _ref;
135
- const style = useMemo(() => ({
136
- "--start": start ? start - 1 : undefined
137
- }), [start]);
138
- return /*#__PURE__*/_jsx(StyledOrderedList, {
139
- "data-embed-type": "ordered-list",
140
- "data-variant": variant,
141
- "data-count": start !== undefined,
142
- css: css.raw(orderedListRecipe.raw({
143
- variant
144
- }), cssProp),
145
- style: style,
146
- ref: ref,
147
- ...props
148
- });
149
- });
150
- export const UnOrderedList = styled("ul", {
151
- base: {
152
- listStyle: "revert",
153
- marginInlineStart: "medium",
154
- paddingInlineStart: "small",
155
- "& ul": {
156
- marginInlineStart: "0"
157
- },
158
- "& li": {
159
- marginBlock: "small",
160
- paddingInlineStart: "small",
161
- _marker: {
162
- color: "icon.strong"
163
- },
164
- "& > ol": {
165
- marginInlineStart: "0 !important"
166
- }
167
- },
168
- listStyleType: "disc",
169
- "& > li > ul": {
170
- listStyleType: "circle",
171
- "& > li > ul": {
172
- listStyleType: "square"
173
- }
174
- }
175
- }
176
- });
177
- export const DefinitionList = styled("dl", {
178
- base: {
179
- "& dt": {
180
- fontWeight: "bold"
181
- },
182
- "& dd": {
183
- marginInlineStart: "medium"
184
- }
185
- }
186
- });
98
+ const UnOrderedList = styled("ul", { base: {
99
+ listStyle: "revert",
100
+ marginInlineStart: "medium",
101
+ paddingInlineStart: "small",
102
+ "& ul": { marginInlineStart: "0" },
103
+ "& li": {
104
+ marginBlock: "small",
105
+ paddingInlineStart: "small",
106
+ _marker: { color: "icon.strong" },
107
+ "& > ol": { marginInlineStart: "0 !important" }
108
+ },
109
+ listStyleType: "disc",
110
+ "& > li > ul": {
111
+ listStyleType: "circle",
112
+ "& > li > ul": { listStyleType: "square" }
113
+ }
114
+ } });
115
+ const DefinitionList = styled("dl", { base: {
116
+ "& dt": { fontWeight: "bold" },
117
+ "& dd": { marginInlineStart: "medium" }
118
+ } });
119
+
120
+ //#endregion
121
+ export { DefinitionList, OrderedList, UnOrderedList };
122
+ //# sourceMappingURL=ArticleLists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArticleLists.js","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 CSSProperties, forwardRef, useMemo } from \"react\";\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 { JsxStyleProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\n\nconst LIST_ITEM = \"& > li\";\nconst LETTER_LIST = \"& > ol[data-variant='letters']\";\nconst NUMBER_LIST = \"& > ol:not([data-variant='letters'])\";\nconst LETTER_LIST_ITEM = `${LETTER_LIST} > li`;\n\nconst orderedListRecipe = cva({\n base: {\n marginInlineStart: \"small\",\n paddingInlineStart: \"small\",\n [LIST_ITEM]: {\n \"& > ul\": {\n marginInlineStart: \"0 !important\",\n },\n _before: {\n position: \"absolute\",\n transform: \"translateX(calc(-100% + (token(spacing.small) * -1)))\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n \"& li\": {\n marginBlock: \"small\",\n },\n },\n defaultVariants: {\n variant: \"numbers\",\n },\n variants: {\n variant: {\n numbers: {\n [NUMBER_LIST]: {\n marginInlineStart: \"0\",\n paddingInlineStart: \"0\",\n },\n counterReset: \"level1\",\n \"&[data-count='true']\": {\n counterReset: \"level1 var(--start, 0)\",\n },\n [LIST_ITEM]: {\n counterIncrement: \"level1\",\n _before: {\n content: \"counter(level1, decimal) '. '\",\n },\n [NUMBER_LIST]: {\n counterReset: \"level2\",\n \"&[data-count='true']\": {\n counterReset: \"level2 var(--start, 0)\",\n },\n [LIST_ITEM]: {\n marginInlineStart: \"small\",\n counterIncrement: \"level2\",\n _before: {\n content: \"counter(level1, decimal) '.' counter(level2, decimal) '. '\",\n },\n [NUMBER_LIST]: {\n counterReset: \"level3\",\n \"&[data-count='true']\": {\n counterReset: \"level3 var(--start, 0)\",\n },\n [LIST_ITEM]: {\n marginInlineStart: \"calc(1.5ch + token(spacing.small))\",\n counterIncrement: \"level3\",\n _before: {\n content: \"counter(level1, decimal) '.' counter(level2, decimal) '.' counter(level3, decimal) '. '\",\n },\n [NUMBER_LIST]: {\n counterReset: \"level4\",\n \"&[data-count='true']\": {\n counterReset: \"level4 var(--start, 0)\",\n },\n [LIST_ITEM]: {\n marginInlineStart: \"calc(3ch + token(spacing.small))\",\n counterIncrement: \"level4\",\n _before: {\n content:\n \"counter(level1, decimal) '.' counter(level2, decimal) '.' counter(level3, decimal) '.' counter(level4, decimal) '. '\",\n },\n },\n },\n },\n },\n },\n },\n },\n },\n letters: {\n counterReset: \"level1\",\n \"&[data-count='true']\": {\n counterReset: \"level1 var(--start, 0)\",\n },\n [LETTER_LIST]: {\n marginInlineStart: \"0\",\n paddingInlineStart: \"0\",\n },\n [LIST_ITEM]: {\n counterIncrement: \"level1\",\n _before: {\n content: \"counter(level1, upper-alpha) '. '\",\n },\n [LETTER_LIST_ITEM]: {\n _before: {\n content: \"counter(level1, lower-alpha) '. '\",\n },\n [LETTER_LIST_ITEM]: {\n _before: {\n content: \"counter(level1, lower-roman) '. '\",\n },\n },\n },\n },\n },\n },\n },\n});\n\nexport type OrderedListVariantProps = RecipeVariantProps<typeof orderedListRecipe>;\n\nexport type OrderedListProps = HTMLArkProps<\"ol\"> & JsxStyleProps & OrderedListVariantProps;\n\nconst StyledOrderedList = styled(ark.ol, {}, { baseComponent: true });\n\nexport const OrderedList = forwardRef<HTMLOListElement, OrderedListProps>(\n ({ variant, css: cssProp, start, ...props }, ref) => {\n const style = useMemo(() => ({ \"--start\": start ? start - 1 : undefined }) as CSSProperties, [start]);\n return (\n <StyledOrderedList\n data-embed-type=\"ordered-list\"\n data-variant={variant}\n data-count={start !== undefined}\n css={css.raw(orderedListRecipe.raw({ variant }), cssProp)}\n style={style}\n ref={ref}\n {...props}\n />\n );\n },\n);\n\nexport type UnOrderedListProps = HTMLArkProps<\"ul\"> & JsxStyleProps;\n\nexport const UnOrderedList = 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 DefinitionList = styled(\"dl\", {\n base: {\n \"& dt\": {\n fontWeight: \"bold\",\n },\n \"& dd\": {\n marginInlineStart: \"medium\",\n },\n },\n});\n\nexport type DefinitionListProps = HTMLArkProps<\"dl\"> & JsxStyleProps;\n"],"mappings":";;;;;;;AAcA,MAAM,YAAY;AAClB,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,oBAAoB,EAAE,YAAY;AAExC,MAAM,oBAAoB,IAAI;CAC5B,MAAM;EACJ,mBAAmB;EACnB,oBAAoB;GACnB,YAAY;GACX,UAAU,EACR,mBAAmB,eACpB;GACD,SAAS;IACP,UAAU;IACV,WAAW;IACX,oBAAoB;GACrB;EACF;EACD,QAAQ,EACN,aAAa,QACd;CACF;CACD,iBAAiB,EACf,SAAS,UACV;CACD,UAAU,EACR,SAAS;EACP,SAAS;IACN,cAAc;IACb,mBAAmB;IACnB,oBAAoB;GACrB;GACD,cAAc;GACd,wBAAwB,EACtB,cAAc,yBACf;IACA,YAAY;IACX,kBAAkB;IAClB,SAAS,EACP,SAAS,gCACV;KACA,cAAc;KACb,cAAc;KACd,wBAAwB,EACtB,cAAc,yBACf;MACA,YAAY;MACX,mBAAmB;MACnB,kBAAkB;MAClB,SAAS,EACP,SAAS,6DACV;OACA,cAAc;OACb,cAAc;OACd,wBAAwB,EACtB,cAAc,yBACf;QACA,YAAY;QACX,mBAAmB;QACnB,kBAAkB;QAClB,SAAS,EACP,SAAS,0FACV;SACA,cAAc;SACb,cAAc;SACd,wBAAwB,EACtB,cAAc,yBACf;UACA,YAAY;UACX,mBAAmB;UACnB,kBAAkB;UAClB,SAAS,EACP,SACE,wHACH;SACF;QACF;OACF;MACF;KACF;IACF;GACF;EACF;EACD,SAAS;GACP,cAAc;GACd,wBAAwB,EACtB,cAAc,yBACf;IACA,cAAc;IACb,mBAAmB;IACnB,oBAAoB;GACrB;IACA,YAAY;IACX,kBAAkB;IAClB,SAAS,EACP,SAAS,oCACV;KACA,mBAAmB;KAClB,SAAS,EACP,SAAS,oCACV;MACA,mBAAmB,EAClB,SAAS,EACP,SAAS,oCACV,EACF;IACF;GACF;EACF;CACF,EACF;AACF,EAAC;AAMF,MAAM,oBAAoB,OAAO,IAAI,IAAI,CAAE,GAAE,EAAE,eAAe,KAAM,EAAC;AAErE,MAAa,cAAc,WACzB,CAAC,EAAE,SAAS,KAAK,SAAS,MAAO,GAAG,OAAO,EAAE,QAAQ;CACnD,MAAM,QAAQ,QAAQ,OAAO,EAAE,WAAW,QAAQ,QAAQ,WAAe,IAAoB,CAAC,KAAM,EAAC;AACrG,wBACE,IAAC;EACC,mBAAgB;EAChB,gBAAc;EACd,cAAY;EACZ,KAAK,IAAI,IAAI,kBAAkB,IAAI,EAAE,QAAS,EAAC,EAAE,QAAQ;EAClD;EACF;EACL,GAAI;GACJ;AAEL,EACF;AAID,MAAa,gBAAgB,OAAO,MAAM,EACxC,MAAM;CACJ,WAAW;CACX,mBAAmB;CACnB,oBAAoB;CACpB,QAAQ,EACN,mBAAmB,IACpB;CACD,QAAQ;EACN,aAAa;EACb,oBAAoB;EACpB,SAAS,EACP,OAAO,cACR;EAED,UAAU,EACR,mBAAmB,eACpB;CACF;CAED,eAAe;CACf,eAAe;EACb,eAAe;EACf,eAAe,EACb,eAAe,SAChB;CACF;AACF,EACF,EAAC;AAEF,MAAa,iBAAiB,OAAO,MAAM,EACzC,MAAM;CACJ,QAAQ,EACN,YAAY,OACb;CACD,QAAQ,EACN,mBAAmB,SACpB;AACF,EACF,EAAC"}