@ndla/primitives 0.0.2 → 0.0.4

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 (89) hide show
  1. package/dist/panda.buildinfo.json +95 -25
  2. package/dist/styles.css +340 -50
  3. package/es/ArticleLists.js +4 -32
  4. package/es/Badge.js +4 -16
  5. package/es/BlockQuote.js +5 -17
  6. package/es/Button.js +40 -33
  7. package/es/Checkbox.js +160 -51
  8. package/es/Dialog.js +6 -7
  9. package/es/ExpandableBox.js +4 -17
  10. package/es/Field.js +17 -0
  11. package/es/FieldErrorMessage.js +12 -16
  12. package/es/FieldHelper.js +9 -12
  13. package/es/FramedContent.js +3 -15
  14. package/es/Icon.js +9 -6
  15. package/es/Input.js +25 -23
  16. package/es/Label.js +15 -39
  17. package/es/Menu.js +32 -6
  18. package/es/MessageBox.js +3 -15
  19. package/es/NdlaLogo.js +6 -5
  20. package/es/RadioGroup.js +7 -11
  21. package/es/Skeleton.js +2 -8
  22. package/es/Spinner.js +3 -15
  23. package/es/Switch.js +8 -15
  24. package/es/Table.js +2 -5
  25. package/es/Tabs.js +231 -0
  26. package/es/Text.js +33 -32
  27. package/es/Toast.js +14 -6
  28. package/es/createStyleContext.js +15 -7
  29. package/lib/Accordion.d.ts +14 -7
  30. package/lib/ArticleLists.d.ts +9 -11
  31. package/lib/ArticleLists.js +5 -36
  32. package/lib/Badge.d.ts +9 -4
  33. package/lib/Badge.js +4 -17
  34. package/lib/BlockQuote.d.ts +9 -3
  35. package/lib/BlockQuote.js +5 -18
  36. package/lib/Button.d.ts +24 -11
  37. package/lib/Button.js +39 -32
  38. package/lib/Checkbox.d.ts +172 -5
  39. package/lib/Checkbox.js +165 -56
  40. package/lib/Dialog.d.ts +18 -10
  41. package/lib/Dialog.js +6 -7
  42. package/lib/ExpandableBox.d.ts +8 -5
  43. package/lib/ExpandableBox.js +5 -20
  44. package/lib/Field.d.ts +9 -0
  45. package/lib/Field.js +23 -0
  46. package/lib/FieldErrorMessage.d.ts +3 -3
  47. package/lib/FieldErrorMessage.js +11 -15
  48. package/lib/FieldHelper.d.ts +3 -3
  49. package/lib/FieldHelper.js +8 -11
  50. package/lib/FramedContent.d.ts +8 -4
  51. package/lib/FramedContent.js +3 -16
  52. package/lib/Icon.d.ts +3 -2
  53. package/lib/Icon.js +8 -5
  54. package/lib/Input.d.ts +12 -11
  55. package/lib/Input.js +25 -23
  56. package/lib/Label.d.ts +13 -7
  57. package/lib/Label.js +15 -39
  58. package/lib/Menu.d.ts +66 -13
  59. package/lib/Menu.js +41 -15
  60. package/lib/MessageBox.d.ts +8 -4
  61. package/lib/MessageBox.js +3 -16
  62. package/lib/NdlaLogo.d.ts +5 -4
  63. package/lib/NdlaLogo.js +5 -4
  64. package/lib/Pagination.d.ts +17 -6
  65. package/lib/Popover.d.ts +34 -13
  66. package/lib/RadioGroup.d.ts +18 -7
  67. package/lib/RadioGroup.js +7 -11
  68. package/lib/Skeleton.d.ts +5 -2
  69. package/lib/Skeleton.js +3 -10
  70. package/lib/Slider.d.ts +18 -7
  71. package/lib/Spinner.d.ts +8 -3
  72. package/lib/Spinner.js +3 -16
  73. package/lib/Switch.d.ts +12 -7
  74. package/lib/Switch.js +13 -20
  75. package/lib/Table.d.ts +6 -3
  76. package/lib/Table.js +4 -8
  77. package/lib/Tabs.d.ts +145 -0
  78. package/lib/Tabs.js +239 -0
  79. package/lib/Text.d.ts +6 -9
  80. package/lib/Text.js +32 -33
  81. package/lib/Toast.d.ts +10 -7
  82. package/lib/Toast.js +15 -7
  83. package/lib/Tooltip.d.ts +19 -7
  84. package/lib/createStyleContext.d.ts +5 -3
  85. package/lib/createStyleContext.js +14 -6
  86. package/package.json +5 -5
  87. package/es/FormControl.js +0 -163
  88. package/lib/FormControl.d.ts +0 -65
  89. package/lib/FormControl.js +0 -173
package/es/Badge.js CHANGED
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { cva, cx } from "@ndla/styled-system/css";
9
+ import { ark } from "@ark-ui/react";
10
+ import { cva } from "@ndla/styled-system/css";
10
11
  import { styled } from "@ndla/styled-system/jsx";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const badgeRecipe = cva({
13
13
  base: {
14
14
  paddingInline: "xsmall",
@@ -26,7 +26,7 @@ const badgeRecipe = cva({
26
26
  borderColor: "surface.brand.1.strong"
27
27
  },
28
28
  brand2: {
29
- backgroundColor: "surface.brand.2.subtle",
29
+ backgroundColor: "surface.brand.2.moderate",
30
30
  borderColor: "surface.brand.2.strong"
31
31
  },
32
32
  brand3: {
@@ -40,16 +40,4 @@ const badgeRecipe = cva({
40
40
  }
41
41
  }
42
42
  });
43
- export const Badge = _ref => {
44
- let {
45
- colorTheme,
46
- className,
47
- ...rest
48
- } = _ref;
49
- return /*#__PURE__*/_jsx(styled.div, {
50
- className: cx(badgeRecipe({
51
- colorTheme
52
- }), className),
53
- ...rest
54
- });
55
- };
43
+ export const Badge = styled(ark.div, badgeRecipe);
package/es/BlockQuote.js CHANGED
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { cva, cx } from "@ndla/styled-system/css";
9
+ import { ark } from "@ark-ui/react";
10
+ import { cva } from "@ndla/styled-system/css";
10
11
  import { styled } from "@ndla/styled-system/jsx";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const blockQuoteRecipe = cva({
13
13
  base: {
14
14
  borderInlineStart: "4px solid",
@@ -17,8 +17,8 @@ const blockQuoteRecipe = cva({
17
17
  variants: {
18
18
  variant: {
19
19
  neutral: {
20
- borderColor: "stroke.subtle"
21
- // TODO: Figure out if this should have a background color.
20
+ borderColor: "stroke.subtle",
21
+ background: "surface.default"
22
22
  },
23
23
  brand1: {
24
24
  background: "surface.brand.1.subtle",
@@ -34,16 +34,4 @@ const blockQuoteRecipe = cva({
34
34
  variant: "neutral"
35
35
  }
36
36
  });
37
- export const BlockQuote = _ref => {
38
- let {
39
- className,
40
- variant,
41
- ...rest
42
- } = _ref;
43
- return /*#__PURE__*/_jsx(styled.blockquote, {
44
- className: cx(blockQuoteRecipe({
45
- variant
46
- }), className),
47
- ...rest
48
- });
49
- };
37
+ export const BlockQuote = styled(ark.blockquote, blockQuoteRecipe);
package/es/Button.js CHANGED
@@ -7,7 +7,8 @@
7
7
  */
8
8
 
9
9
  import { forwardRef } from "react";
10
- import { css, cva, cx } from "@ndla/styled-system/css";
10
+ import { ark } from "@ark-ui/react";
11
+ import { css, cva } from "@ndla/styled-system/css";
11
12
  import { styled } from "@ndla/styled-system/jsx";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  export const buttonBaseRecipe = cva({
@@ -160,53 +161,59 @@ export const buttonRecipe = cva({
160
161
  }
161
162
  }
162
163
  });
164
+ export const iconButtonRecipe = cva({
165
+ base: {
166
+ lineHeight: "1",
167
+ minHeight: "unset",
168
+ height: "fit-content",
169
+ "& svg": {
170
+ marginInline: "0",
171
+ marginBlock: "0",
172
+ width: "medium",
173
+ height: "medium"
174
+ },
175
+ paddingInline: "xsmall",
176
+ paddingBlock: "xsmall"
177
+ }
178
+ });
179
+ const StyledButton = styled(ark.button, {}, {
180
+ defaultProps: {
181
+ type: "button"
182
+ }
183
+ });
163
184
  export const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
164
185
  let {
165
- type,
166
- size,
167
- className,
168
186
  variant,
169
- ...rest
187
+ size,
188
+ css: cssProp,
189
+ ...props
170
190
  } = _ref;
171
- return /*#__PURE__*/_jsx(styled.button, {
172
- type: type !== null && type !== void 0 ? type : "button",
173
- className: cx(css(buttonBaseRecipe.raw({
191
+ return /*#__PURE__*/_jsx(StyledButton, {
192
+ ...props,
193
+ css: css.raw(buttonBaseRecipe.raw({
174
194
  variant
175
195
  }), buttonRecipe.raw({
176
196
  size
177
- })), className),
178
- ...rest,
197
+ }), cssProp),
179
198
  ref: ref
180
199
  });
181
200
  });
201
+ const StyledIconButton = styled(ark.button, {}, {
202
+ defaultProps: {
203
+ type: "button"
204
+ }
205
+ });
182
206
  export const IconButton = /*#__PURE__*/forwardRef((_ref2, ref) => {
183
207
  let {
184
- type,
185
- className,
186
208
  variant,
187
- ...rest
209
+ css: cssProp,
210
+ ...props
188
211
  } = _ref2;
189
- return /*#__PURE__*/_jsx(styled.button, {
190
- type: type !== null && type !== void 0 ? type : "button",
191
- className: cx(css(buttonBaseRecipe.raw({
212
+ return /*#__PURE__*/_jsx(StyledIconButton, {
213
+ ...props,
214
+ css: css.raw(buttonBaseRecipe.raw({
192
215
  variant
193
- }), iconButtonRecipe.raw()), className),
194
- ...rest,
216
+ }), iconButtonRecipe.raw(), cssProp),
195
217
  ref: ref
196
218
  });
197
- });
198
- export const iconButtonRecipe = cva({
199
- base: {
200
- lineHeight: "1",
201
- minHeight: "unset",
202
- height: "fit-content",
203
- "& svg": {
204
- marginInline: "0",
205
- marginBlock: "0",
206
- width: "medium",
207
- height: "medium"
208
- },
209
- paddingInline: "xsmall",
210
- paddingBlock: "xsmall"
211
- }
212
219
  });
package/es/Checkbox.js CHANGED
@@ -6,12 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import { forwardRef } from "react";
10
9
  import { checkboxAnatomy } from "@ark-ui/anatomy";
11
10
  import { Checkbox } from "@ark-ui/react";
12
11
  import { sva } from "@ndla/styled-system/css";
13
12
  import { createStyleContext } from "./createStyleContext";
14
- import { useFormControl } from "./FormControl";
15
13
  import { Text } from "./Text";
16
14
  import { jsx as _jsx } from "react/jsx-runtime";
17
15
  const checkboxRecipe = sva({
@@ -22,19 +20,12 @@ const checkboxRecipe = sva({
22
20
  display: "flex",
23
21
  alignItems: "center",
24
22
  cursor: "pointer",
25
- gap: "xxsmall",
26
23
  _disabled: {
27
24
  color: "text.disabled",
28
- cursor: "not-allowed"
29
- },
30
- _hover: {
31
- color: "text.action"
32
- },
33
- _focus: {
34
- outline: "2px solid",
35
- outlineOffset: "4xsmall",
36
- outlineColor: "stroke.default",
37
- borderRadius: "xsmall"
25
+ cursor: "not-allowed",
26
+ _hover: {
27
+ color: "text.disabled"
28
+ }
38
29
  }
39
30
  },
40
31
  control: {
@@ -44,39 +35,167 @@ const checkboxRecipe = sva({
44
35
  cursor: "pointer",
45
36
  width: "medium",
46
37
  height: "medium",
47
- background: "surface.default",
48
- borderRadius: "xsmall",
49
- border: "2px solid",
50
- borderColor: "stroke.subtle",
51
38
  color: "text.strong",
52
39
  transitionDuration: "normal",
53
40
  transitionProperty: "border-color, background, box-shadow, color",
54
- transitionTimingFunction: "default",
55
- _hover: {
56
- boxShadow: "0 0 0 4px var(--shadow-color)",
57
- boxShadowColor: "surface.actionSubtle.hover.strong"
58
- },
59
- _checked: {
60
- color: "icon.onAction",
61
- backgroundColor: "surface.action",
62
- borderColor: "surface.action"
63
- },
64
- _disabled: {
65
- borderColor: "stroke.disabled",
66
- _hover: {
67
- borderColor: "stroke.disabled",
68
- boxShadow: "none"
41
+ transitionTimingFunction: "default"
42
+ }
43
+ },
44
+ defaultVariants: {
45
+ variant: "checkbox"
46
+ },
47
+ variants: {
48
+ variant: {
49
+ checkbox: {
50
+ root: {
51
+ gap: "xxsmall",
52
+ _hover: {
53
+ color: "text.action"
54
+ },
55
+ _focus: {
56
+ outline: "2px solid",
57
+ outlineOffset: "4xsmall",
58
+ outlineColor: "stroke.default",
59
+ borderRadius: "xsmall"
60
+ }
69
61
  },
70
- _checked: {
71
- background: "surface.disabled"
62
+ control: {
63
+ border: "2px solid",
64
+ borderColor: "stroke.subtle",
65
+ borderRadius: "xsmall",
66
+ background: "surface.default",
67
+ _hover: {
68
+ boxShadow: "0 0 0 4px var(--shadow-color)",
69
+ boxShadowColor: "surface.actionSubtle.hover.strong"
70
+ },
71
+ _checked: {
72
+ backgroundColor: "surface.action",
73
+ borderColor: "surface.action",
74
+ color: "icon.onAction"
75
+ },
76
+ _disabled: {
77
+ borderColor: "stroke.disabled",
78
+ _hover: {
79
+ borderColor: "stroke.disabled",
80
+ boxShadow: "none"
81
+ },
82
+ _checked: {
83
+ background: "surface.disabled"
84
+ }
85
+ },
86
+ _invalid: {
87
+ borderColor: "stroke.error",
88
+ _checked: {
89
+ color: "stroke.error",
90
+ borderColor: "stroke.error",
91
+ backgroundColor: "surface.default"
92
+ }
93
+ }
72
94
  }
73
95
  },
74
- _invalid: {
75
- borderColor: "stroke.error",
76
- _checked: {
77
- color: "stroke.error",
78
- borderColor: "stroke.error",
79
- backgroundColor: "surface.default"
96
+ chip: {
97
+ root: {
98
+ width: "fit-content",
99
+ color: "text.default",
100
+ gap: "4xsmall",
101
+ background: "surface.actionSubtle",
102
+ border: "1px solid",
103
+ borderColor: "stroke.subtle",
104
+ outlineColor: "stroke.subtle",
105
+ paddingInline: "xsmall",
106
+ paddingBlock: "4xsmall",
107
+ borderRadius: "large",
108
+ minHeight: "large",
109
+ transitionDuration: "normal",
110
+ transitionProperty: "border-color, background, box-shadow, color",
111
+ transitionTimingFunction: "default",
112
+ _disabled: {
113
+ color: "text.disabled",
114
+ borderColor: "stroke.disabled",
115
+ background: "surface.disabled",
116
+ _hover: {
117
+ color: "text.disabled",
118
+ borderColor: "stroke.disabled",
119
+ background: "surface.disabled"
120
+ },
121
+ _checked: {
122
+ color: "text.disabled",
123
+ borderColor: "stroke.disabled",
124
+ background: "surface.disabled",
125
+ _hover: {
126
+ color: "text.disabled",
127
+ borderColor: "stroke.disabled",
128
+ background: "surface.disabled"
129
+ }
130
+ }
131
+ },
132
+ _hover: {
133
+ background: "surface.actionSubtle.hover",
134
+ borderColor: "stroke.hover",
135
+ outlineColor: "stroke.hover",
136
+ _invalid: {
137
+ backgroundColor: "surface.dangerSubtle"
138
+ }
139
+ },
140
+ _checked: {
141
+ color: "text.onAction",
142
+ background: "surface.actionSubtle.selected",
143
+ borderColor: "surface.actionSubtle.selected",
144
+ outlineColor: "icon.onAction",
145
+ _focus: {
146
+ outlineOffset: "-4px"
147
+ },
148
+ _hover: {
149
+ outlineOffset: "-2px",
150
+ background: "surface.actionSubtle.hover",
151
+ color: "text.default",
152
+ borderColor: "stroke.hover",
153
+ outlineColor: "stroke.hover"
154
+ }
155
+ },
156
+ _invalid: {
157
+ borderColor: "stroke.error",
158
+ outlineColor: "stroke.error",
159
+ background: "surface.dangerSubtle",
160
+ outlineOffset: "-2px",
161
+ _checked: {
162
+ color: "text.default",
163
+ borderColor: "stroke.error",
164
+ outlineColor: "stroke.error",
165
+ background: "surface.dangerSubtle",
166
+ outlineOffset: "-2px",
167
+ _hover: {
168
+ borderColor: "stroke.hover",
169
+ outlineColor: "stroke.hover"
170
+ }
171
+ }
172
+ },
173
+ _focus: {
174
+ outlineStyle: "solid",
175
+ outlineWidth: "2px",
176
+ outlineOffset: "-2px"
177
+ }
178
+ },
179
+ control: {
180
+ display: "none",
181
+ _checked: {
182
+ display: "flex",
183
+ color: "text.onAction",
184
+ _hover: {
185
+ color: "stroke.hover"
186
+ }
187
+ },
188
+ _disabled: {
189
+ color: "stroke.disabled",
190
+ _hover: {
191
+ color: "stroke.disabled"
192
+ }
193
+ },
194
+ _invalid: {
195
+ _checked: {
196
+ color: "stroke.error"
197
+ }
198
+ }
80
199
  }
81
200
  }
82
201
  }
@@ -86,17 +205,7 @@ const {
86
205
  withProvider,
87
206
  withContext
88
207
  } = createStyleContext(checkboxRecipe);
89
- const InternalCheckboxRoot = withProvider(Checkbox.Root, "root");
90
- export const CheckboxRoot = /*#__PURE__*/forwardRef((props, ref) => {
91
- var _field$invalid;
92
- const field = useFormControl(props);
93
- return /*#__PURE__*/_jsx(InternalCheckboxRoot, {
94
- ...field,
95
- invalid: (_field$invalid = field.invalid) !== null && _field$invalid !== void 0 ? _field$invalid : !!field["aria-invalid"],
96
- ref: ref,
97
- "aria-invalid": undefined
98
- });
99
- });
208
+ export const CheckboxRoot = withProvider(Checkbox.Root, "root");
100
209
  export const CheckboxIndicator = withContext(Checkbox.Indicator, "indicator");
101
210
  const InternalCheckboxLabel = withContext(Checkbox.Label, "label");
102
211
  export const CheckboxLabel = _ref => {
package/es/Dialog.js CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import { forwardRef } from "react";
10
+ import { dialogAnatomy } from "@ark-ui/anatomy";
10
11
  import { Dialog } from "@ark-ui/react";
11
12
  import { sva } from "@ndla/styled-system/css";
12
13
  import { styled } from "@ndla/styled-system/jsx";
@@ -14,9 +15,7 @@ import { createStyleContext } from "./createStyleContext";
14
15
  import { Heading, Text } from "./Text";
15
16
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const dialogRecipe = sva({
17
- // We only use a subset of the dialog components, so we roll our own slots instead of relying on @ark/anatomy.
18
- slots: ["positioner", "backdrop", "content"],
19
- className: "dialog",
18
+ slots: dialogAnatomy.keys(),
20
19
  base: {
21
20
  backdrop: {
22
21
  position: "fixed",
@@ -278,29 +277,29 @@ export const DialogContent = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__
278
277
  })
279
278
  })]
280
279
  }));
280
+ const InternalDialogDescription = withContext(Dialog.Description, "description");
281
281
  export const DialogDescription = _ref2 => {
282
282
  let {
283
283
  textStyle = "body.large",
284
284
  ...rest
285
285
  } = _ref2;
286
- return /*#__PURE__*/_jsx(Dialog.Description, {
286
+ return /*#__PURE__*/_jsx(InternalDialogDescription, {
287
287
  asChild: true,
288
288
  children: /*#__PURE__*/_jsx(Text, {
289
- as: "p",
290
289
  textStyle: textStyle,
291
290
  ...rest
292
291
  })
293
292
  });
294
293
  };
294
+ const InternalDialogTitle = withContext(Dialog.Title, "title");
295
295
  export const DialogTitle = _ref3 => {
296
296
  let {
297
297
  textStyle = "title.medium",
298
298
  ...rest
299
299
  } = _ref3;
300
- return /*#__PURE__*/_jsx(Dialog.Title, {
300
+ return /*#__PURE__*/_jsx(InternalDialogTitle, {
301
301
  asChild: true,
302
302
  children: /*#__PURE__*/_jsx(Heading, {
303
- as: "h1",
304
303
  textStyle: textStyle,
305
304
  ...rest
306
305
  })
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
+ import { ark } from "@ark-ui/react";
9
10
  import { styled } from "@ndla/styled-system/jsx";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const StyledExpandableBox = styled("details", {
11
+ export const ExpandableBox = styled("details", {
12
12
  base: {
13
13
  transitionDuration: "fast",
14
14
  width: "100%",
@@ -25,10 +25,7 @@ const StyledExpandableBox = styled("details", {
25
25
  }
26
26
  }
27
27
  });
28
- export const ExpandableBox = props => /*#__PURE__*/_jsx(StyledExpandableBox, {
29
- ...props
30
- });
31
- const StyledExpandableBoxSummary = styled("summary", {
28
+ export const ExpandableBoxSummary = styled(ark.summary, {
32
29
  base: {
33
30
  cursor: "pointer",
34
31
  margin: "-medium",
@@ -42,14 +39,4 @@ const StyledExpandableBoxSummary = styled("summary", {
42
39
  textStyle: "label.large!"
43
40
  }
44
41
  }
45
- });
46
- export const ExpandableBoxSummary = _ref => {
47
- let {
48
- children,
49
- ...rest
50
- } = _ref;
51
- return /*#__PURE__*/_jsx(StyledExpandableBoxSummary, {
52
- ...rest,
53
- children: children
54
- });
55
- };
42
+ });
package/es/Field.js ADDED
@@ -0,0 +1,17 @@
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 { Field } from "@ark-ui/react";
10
+ import { styled } from "@ndla/styled-system/jsx";
11
+ export const FieldRoot = styled(Field.Root, {
12
+ base: {
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ gap: "3xsmall"
16
+ }
17
+ });
@@ -7,38 +7,34 @@
7
7
  */
8
8
 
9
9
  import { forwardRef } from "react";
10
- import { css, cx } from "@ndla/styled-system/css";
10
+ import { Field } from "@ark-ui/react";
11
+ import { css } from "@ndla/styled-system/css";
11
12
  import { styled } from "@ndla/styled-system/jsx";
12
- import { useFormControlContext } from "./FormControl";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- const StyledErrorMessage = styled("div", {
14
+ const StyledErrorText = styled(Field.ErrorText, {
15
15
  base: {
16
16
  color: "text.error",
17
- whiteSpace: "pre-line"
17
+ whiteSpace: "pre-line",
18
+ justifyContent: "center"
18
19
  }
19
20
  });
20
21
  export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
21
- var _field$getErrorMessag;
22
22
  let {
23
23
  textStyle = "label.small",
24
24
  fontWeight,
25
+ css: cssProp,
25
26
  color,
26
27
  srOnly,
27
- className,
28
28
  ...props
29
29
  } = _ref;
30
- const field = useFormControlContext();
31
- if (field && !field.isInvalid) return null;
32
- return /*#__PURE__*/_jsx(StyledErrorMessage, {
33
- ...((_field$getErrorMessag = field === null || field === void 0 ? void 0 : field.getErrorMessageProps(props, ref)) !== null && _field$getErrorMessag !== void 0 ? _field$getErrorMessag : {
34
- ref,
35
- ...props
36
- }),
37
- className: cx(css({
30
+ return /*#__PURE__*/_jsx(StyledErrorText, {
31
+ css: css.raw({
38
32
  textStyle,
39
33
  fontWeight,
40
34
  color,
41
- srOnly: srOnly
42
- }), className)
35
+ srOnly
36
+ }, cssProp),
37
+ ...props,
38
+ ref: ref
43
39
  });
44
40
  });
package/es/FieldHelper.js CHANGED
@@ -7,31 +7,28 @@
7
7
  */
8
8
 
9
9
  import { forwardRef } from "react";
10
- import { css, cx } from "@ndla/styled-system/css";
10
+ import { Field } from "@ark-ui/react";
11
+ import { css } from "@ndla/styled-system/css";
11
12
  import { styled } from "@ndla/styled-system/jsx";
12
- import { useFormControlContext } from "./FormControl";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
+ const StyledFieldHelper = styled(Field.HelperText);
14
15
  export const FieldHelper = /*#__PURE__*/forwardRef((_ref, ref) => {
15
- var _field$getHelpTextPro;
16
16
  let {
17
17
  textStyle = "label.small",
18
18
  fontWeight,
19
19
  color,
20
20
  srOnly,
21
- className,
21
+ css: cssProp,
22
22
  ...props
23
23
  } = _ref;
24
- const field = useFormControlContext();
25
- return /*#__PURE__*/_jsx(styled.div, {
26
- ...((_field$getHelpTextPro = field === null || field === void 0 ? void 0 : field.getHelpTextProps(props, ref)) !== null && _field$getHelpTextPro !== void 0 ? _field$getHelpTextPro : {
27
- ref,
28
- ...props
29
- }),
30
- className: cx(css({
24
+ return /*#__PURE__*/_jsx(StyledFieldHelper, {
25
+ css: css.raw({
31
26
  textStyle,
32
27
  fontWeight,
33
28
  color,
34
29
  srOnly
35
- }), className)
30
+ }, cssProp),
31
+ ...props,
32
+ ref: ref
36
33
  });
37
34
  });
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { cva, cx } from "@ndla/styled-system/css";
9
+ import { ark } from "@ark-ui/react";
10
+ import { cva } from "@ndla/styled-system/css";
10
11
  import { styled } from "@ndla/styled-system/jsx";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const framedContentRecipe = cva({
13
13
  base: {
14
14
  padding: "medium",
@@ -39,16 +39,4 @@ const framedContentRecipe = cva({
39
39
  colorTheme: "neutral"
40
40
  }
41
41
  });
42
- export const FramedContent = _ref => {
43
- let {
44
- className,
45
- colorTheme,
46
- ...rest
47
- } = _ref;
48
- return /*#__PURE__*/_jsx(styled.div, {
49
- className: cx(framedContentRecipe({
50
- colorTheme
51
- }), className),
52
- ...rest
53
- });
54
- };
42
+ export const FramedContent = styled(ark.div, framedContentRecipe);