@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/lib/Dialog.d.ts CHANGED
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import { Dialog } from "@ark-ui/react";
9
9
  import { RecipeVariantProps } from "@ndla/styled-system/css";
10
- import { SystemProperties } from "@ndla/styled-system/types";
10
+ import { JsxStyleProps } from "@ndla/styled-system/types";
11
11
  import { TextProps } from "./Text";
12
- declare const dialogRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"content" | "positioner" | "backdrop", {
12
+ declare const dialogRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"title" | "description" | "content" | "trigger" | "backdrop" | "positioner" | "closeTrigger", {
13
13
  variant: {
14
14
  drawer: {
15
15
  content: {
@@ -92,14 +92,22 @@ export declare const InternalDialogRoot: (props: Dialog.RootProps & {
92
92
  variant?: "dialog" | "drawer" | undefined;
93
93
  position?: "center" | "bottom" | "left" | "right" | "top" | undefined;
94
94
  size?: "small" | "xsmall" | "medium" | "large" | "full" | undefined;
95
- }) => import("@emotion/react/jsx-runtime").JSX.Element;
96
- export declare const DialogRoot: ({ lazyMount, unmountOnExit, ...props }: DialogRootProps) => import("@emotion/react/jsx-runtime").JSX.Element;
97
- export declare const DialogBackdrop: import("react").ForwardRefExoticComponent<Omit<SystemProperties, keyof Dialog.BackdropProps> & Dialog.BackdropProps & import("react").RefAttributes<HTMLDivElement>>;
98
- export declare const DialogStandaloneContent: import("react").ForwardRefExoticComponent<Omit<SystemProperties, keyof Dialog.ContentProps> & Dialog.ContentProps & import("react").RefAttributes<HTMLDivElement>>;
99
- export declare const DialogPositioner: import("react").ForwardRefExoticComponent<Omit<SystemProperties, keyof Dialog.PositionerProps> & Dialog.PositionerProps & import("react").RefAttributes<HTMLDivElement>>;
100
- export declare const DialogContent: import("react").ForwardRefExoticComponent<Omit<Omit<SystemProperties, keyof Dialog.ContentProps> & Dialog.ContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
101
- export declare const DialogDescription: ({ textStyle, ...rest }: Dialog.DescriptionProps & TextProps) => import("@emotion/react/jsx-runtime").JSX.Element;
102
- export declare const DialogTitle: ({ textStyle, ...rest }: Dialog.TitleProps & TextProps) => import("@emotion/react/jsx-runtime").JSX.Element;
95
+ }) => import("react/jsx-runtime").JSX.Element;
96
+ export declare const DialogRoot: ({ lazyMount, unmountOnExit, ...props }: DialogRootProps) => import("react/jsx-runtime").JSX.Element;
97
+ export declare const DialogBackdrop: import("react").ForwardRefExoticComponent<{
98
+ forwardCssProp?: boolean | undefined;
99
+ } & import("@ndla/styled-system/types").WithCss & Dialog.BackdropProps & import("react").RefAttributes<HTMLDivElement>>;
100
+ export declare const DialogStandaloneContent: import("react").ForwardRefExoticComponent<{
101
+ forwardCssProp?: boolean | undefined;
102
+ } & import("@ndla/styled-system/types").WithCss & Dialog.ContentProps & import("react").RefAttributes<HTMLDivElement>>;
103
+ export declare const DialogPositioner: import("react").ForwardRefExoticComponent<{
104
+ forwardCssProp?: boolean | undefined;
105
+ } & import("@ndla/styled-system/types").WithCss & Dialog.PositionerProps & import("react").RefAttributes<HTMLDivElement>>;
106
+ export declare const DialogContent: import("react").ForwardRefExoticComponent<Dialog.ContentProps & {
107
+ forwardCssProp?: boolean | undefined;
108
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
109
+ export declare const DialogDescription: ({ textStyle, ...rest }: Dialog.DescriptionProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
110
+ export declare const DialogTitle: ({ textStyle, ...rest }: Dialog.TitleProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
103
111
  export declare const DialogTrigger: import("react").ForwardRefExoticComponent<Dialog.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
104
112
  export declare const DialogCloseTrigger: import("react").ForwardRefExoticComponent<Dialog.CloseTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
105
113
  export declare const DialogHeader: import("@ndla/styled-system/jsx").StyledComponent<"div", {}>;
package/lib/Dialog.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.InternalDialogRoot = exports.DialogTrigger = exports.DialogTitle = exports.DialogStandaloneContent = exports.DialogRoot = exports.DialogPositioner = exports.DialogHeader = exports.DialogDescription = exports.DialogContent = exports.DialogCloseTrigger = exports.DialogBody = exports.DialogBackdrop = void 0;
7
7
  var _react = require("react");
8
+ var _anatomy = require("@ark-ui/anatomy");
8
9
  var _react2 = require("@ark-ui/react");
9
10
  var _css = require("@ndla/styled-system/css");
10
11
  var _jsx2 = require("@ndla/styled-system/jsx");
@@ -20,9 +21,7 @@ var _jsxRuntime = require("react/jsx-runtime");
20
21
  */
21
22
 
22
23
  const dialogRecipe = (0, _css.sva)({
23
- // We only use a subset of the dialog components, so we roll our own slots instead of relying on @ark/anatomy.
24
- slots: ["positioner", "backdrop", "content"],
25
- className: "dialog",
24
+ slots: _anatomy.dialogAnatomy.keys(),
26
25
  base: {
27
26
  backdrop: {
28
27
  position: "fixed",
@@ -285,30 +284,30 @@ const DialogContent = exports.DialogContent = /*#__PURE__*/(0, _react.forwardRef
285
284
  })
286
285
  })]
287
286
  }));
287
+ const InternalDialogDescription = withContext(_react2.Dialog.Description, "description");
288
288
  const DialogDescription = _ref2 => {
289
289
  let {
290
290
  textStyle = "body.large",
291
291
  ...rest
292
292
  } = _ref2;
293
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Dialog.Description, {
293
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalDialogDescription, {
294
294
  asChild: true,
295
295
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
296
- as: "p",
297
296
  textStyle: textStyle,
298
297
  ...rest
299
298
  })
300
299
  });
301
300
  };
302
301
  exports.DialogDescription = DialogDescription;
302
+ const InternalDialogTitle = withContext(_react2.Dialog.Title, "title");
303
303
  const DialogTitle = _ref3 => {
304
304
  let {
305
305
  textStyle = "title.medium",
306
306
  ...rest
307
307
  } = _ref3;
308
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Dialog.Title, {
308
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalDialogTitle, {
309
309
  asChild: true,
310
310
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Heading, {
311
- as: "h1",
312
311
  textStyle: textStyle,
313
312
  ...rest
314
313
  })
@@ -5,8 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { ComponentPropsWithoutRef } from "react";
9
- export type ExpandableBoxProps = ComponentPropsWithoutRef<"details">;
10
- export declare const ExpandableBox: (props: ExpandableBoxProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
- export type ExpandableBoxSummaryProps = ComponentPropsWithoutRef<"summary">;
12
- export declare const ExpandableBoxSummary: ({ children, ...rest }: ExpandableBoxSummaryProps) => import("@emotion/react/jsx-runtime").JSX.Element;
8
+ import { HTMLArkProps } from "@ark-ui/react";
9
+ import { JsxStyleProps } from "@ndla/styled-system/types";
10
+ export type ExpandableBoxProps = HTMLArkProps<"details"> & JsxStyleProps;
11
+ export declare const ExpandableBox: import("@ndla/styled-system/jsx").StyledComponent<"details", {}>;
12
+ export type ExpandableBoxSummaryProps = HTMLArkProps<"summary"> & JsxStyleProps;
13
+ export declare const ExpandableBoxSummary: import("@ndla/styled-system/jsx").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
14
+ ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
15
+ } & import("@ark-ui/react").PolymorphicProps>, {}>;
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExpandableBoxSummary = exports.ExpandableBox = void 0;
7
- var _jsx2 = require("@ndla/styled-system/jsx");
8
- var _jsxRuntime = require("react/jsx-runtime");
7
+ var _react = require("@ark-ui/react");
8
+ var _jsx = require("@ndla/styled-system/jsx");
9
9
  /**
10
10
  * Copyright (c) 2024-present, NDLA.
11
11
  *
@@ -14,7 +14,7 @@ var _jsxRuntime = require("react/jsx-runtime");
14
14
  *
15
15
  */
16
16
 
17
- const StyledExpandableBox = (0, _jsx2.styled)("details", {
17
+ const ExpandableBox = exports.ExpandableBox = (0, _jsx.styled)("details", {
18
18
  base: {
19
19
  transitionDuration: "fast",
20
20
  width: "100%",
@@ -31,11 +31,7 @@ const StyledExpandableBox = (0, _jsx2.styled)("details", {
31
31
  }
32
32
  }
33
33
  });
34
- const ExpandableBox = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledExpandableBox, {
35
- ...props
36
- });
37
- exports.ExpandableBox = ExpandableBox;
38
- const StyledExpandableBoxSummary = (0, _jsx2.styled)("summary", {
34
+ const ExpandableBoxSummary = exports.ExpandableBoxSummary = (0, _jsx.styled)(_react.ark.summary, {
39
35
  base: {
40
36
  cursor: "pointer",
41
37
  margin: "-medium",
@@ -49,15 +45,4 @@ const StyledExpandableBoxSummary = (0, _jsx2.styled)("summary", {
49
45
  textStyle: "label.large!"
50
46
  }
51
47
  }
52
- });
53
- const ExpandableBoxSummary = _ref => {
54
- let {
55
- children,
56
- ...rest
57
- } = _ref;
58
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledExpandableBoxSummary, {
59
- ...rest,
60
- children: children
61
- });
62
- };
63
- exports.ExpandableBoxSummary = ExpandableBoxSummary;
48
+ });
package/lib/Field.d.ts ADDED
@@ -0,0 +1,9 @@
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
+ import { Field } from "@ark-ui/react";
9
+ export declare const FieldRoot: import("@ndla/styled-system/jsx").StyledComponent<import("react").ForwardRefExoticComponent<Field.RootProps & import("react").RefAttributes<HTMLDivElement>>, {}>;
package/lib/Field.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FieldRoot = void 0;
7
+ var _react = require("@ark-ui/react");
8
+ var _jsx = require("@ndla/styled-system/jsx");
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
+ */
16
+
17
+ const FieldRoot = exports.FieldRoot = (0, _jsx.styled)(_react.Field.Root, {
18
+ base: {
19
+ display: "flex",
20
+ flexDirection: "column",
21
+ gap: "3xsmall"
22
+ }
23
+ });
@@ -6,6 +6,6 @@
6
6
  *
7
7
  */
8
8
  import { TextProps } from "./Text";
9
- export declare const FieldErrorMessage: import("react").ForwardRefExoticComponent<Omit<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
11
- }, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
9
+ export declare const FieldErrorMessage: import("react").ForwardRefExoticComponent<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
10
+ forwardCssProp?: boolean | undefined;
11
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FieldErrorMessage = void 0;
7
7
  var _react = require("react");
8
+ var _react2 = require("@ark-ui/react");
8
9
  var _css = require("@ndla/styled-system/css");
9
10
  var _jsx2 = require("@ndla/styled-system/jsx");
10
- var _FormControl = require("./FormControl");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  /**
13
13
  * Copyright (c) 2024-present, NDLA.
@@ -17,34 +17,30 @@ var _jsxRuntime = require("react/jsx-runtime");
17
17
  *
18
18
  */
19
19
 
20
- const StyledErrorMessage = (0, _jsx2.styled)("div", {
20
+ const StyledErrorText = (0, _jsx2.styled)(_react2.Field.ErrorText, {
21
21
  base: {
22
22
  color: "text.error",
23
- whiteSpace: "pre-line"
23
+ whiteSpace: "pre-line",
24
+ justifyContent: "center"
24
25
  }
25
26
  });
26
27
  const FieldErrorMessage = exports.FieldErrorMessage = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
27
- var _field$getErrorMessag;
28
28
  let {
29
29
  textStyle = "label.small",
30
30
  fontWeight,
31
+ css: cssProp,
31
32
  color,
32
33
  srOnly,
33
- className,
34
34
  ...props
35
35
  } = _ref;
36
- const field = (0, _FormControl.useFormControlContext)();
37
- if (field && !field.isInvalid) return null;
38
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledErrorMessage, {
39
- ...((_field$getErrorMessag = field === null || field === void 0 ? void 0 : field.getErrorMessageProps(props, ref)) !== null && _field$getErrorMessag !== void 0 ? _field$getErrorMessag : {
40
- ref,
41
- ...props
42
- }),
43
- className: (0, _css.cx)((0, _css.css)({
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledErrorText, {
37
+ css: _css.css.raw({
44
38
  textStyle,
45
39
  fontWeight,
46
40
  color,
47
- srOnly: srOnly
48
- }), className)
41
+ srOnly
42
+ }, cssProp),
43
+ ...props,
44
+ ref: ref
49
45
  });
50
46
  });
@@ -6,6 +6,6 @@
6
6
  *
7
7
  */
8
8
  import { TextProps } from "./Text";
9
- export declare const FieldHelper: import("react").ForwardRefExoticComponent<Omit<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
11
- }, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
+ export declare const FieldHelper: import("react").ForwardRefExoticComponent<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
10
+ forwardCssProp?: boolean | undefined;
11
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FieldHelper = void 0;
7
7
  var _react = require("react");
8
+ var _react2 = require("@ark-ui/react");
8
9
  var _css = require("@ndla/styled-system/css");
9
10
  var _jsx2 = require("@ndla/styled-system/jsx");
10
- var _FormControl = require("./FormControl");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  /**
13
13
  * Copyright (c) 2024-present, NDLA.
@@ -17,27 +17,24 @@ var _jsxRuntime = require("react/jsx-runtime");
17
17
  *
18
18
  */
19
19
 
20
+ const StyledFieldHelper = (0, _jsx2.styled)(_react2.Field.HelperText);
20
21
  const FieldHelper = exports.FieldHelper = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
21
- var _field$getHelpTextPro;
22
22
  let {
23
23
  textStyle = "label.small",
24
24
  fontWeight,
25
25
  color,
26
26
  srOnly,
27
- className,
27
+ css: cssProp,
28
28
  ...props
29
29
  } = _ref;
30
- const field = (0, _FormControl.useFormControlContext)();
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.div, {
32
- ...((_field$getHelpTextPro = field === null || field === void 0 ? void 0 : field.getHelpTextProps(props, ref)) !== null && _field$getHelpTextPro !== void 0 ? _field$getHelpTextPro : {
33
- ref,
34
- ...props
35
- }),
36
- className: (0, _css.cx)((0, _css.css)({
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFieldHelper, {
31
+ css: _css.css.raw({
37
32
  textStyle,
38
33
  fontWeight,
39
34
  color,
40
35
  srOnly
41
- }), className)
36
+ }, cssProp),
37
+ ...props,
38
+ ref: ref
42
39
  });
43
40
  });
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { ComponentPropsWithoutRef } from "react";
9
- import { RecipeVariantProps } from "@ndla/styled-system/types";
8
+ import { HTMLArkProps } from "@ark-ui/react";
9
+ import { JsxStyleProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  declare const framedContentRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
11
11
  colorTheme: {
12
12
  neutral: {
@@ -27,6 +27,10 @@ declare const framedContentRecipe: import("@ndla/styled-system/types").RecipeRun
27
27
  };
28
28
  }>;
29
29
  export type FramedContentVariantProps = RecipeVariantProps<typeof framedContentRecipe>;
30
- export type FramedContentProps = ComponentPropsWithoutRef<"div"> & FramedContentVariantProps;
31
- export declare const FramedContent: ({ className, colorTheme, ...rest }: FramedContentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
30
+ export type FramedContentProps = HTMLArkProps<"div"> & JsxStyleProps & FramedContentVariantProps;
31
+ export declare const FramedContent: import("@ndla/styled-system/jsx").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
32
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
33
+ } & import("@ark-ui/react").PolymorphicProps>, {
34
+ colorTheme?: "neutral" | "brand1" | "brand2" | undefined;
35
+ }>;
32
36
  export {};
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.FramedContent = void 0;
7
+ var _react = require("@ark-ui/react");
7
8
  var _css = require("@ndla/styled-system/css");
8
- var _jsx2 = require("@ndla/styled-system/jsx");
9
- var _jsxRuntime = require("react/jsx-runtime");
9
+ var _jsx = require("@ndla/styled-system/jsx");
10
10
  /**
11
11
  * Copyright (c) 2024-present, NDLA.
12
12
  *
@@ -45,17 +45,4 @@ const framedContentRecipe = (0, _css.cva)({
45
45
  colorTheme: "neutral"
46
46
  }
47
47
  });
48
- const FramedContent = _ref => {
49
- let {
50
- className,
51
- colorTheme,
52
- ...rest
53
- } = _ref;
54
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.div, {
55
- className: (0, _css.cx)(framedContentRecipe({
56
- colorTheme
57
- }), className),
58
- ...rest
59
- });
60
- };
61
- exports.FramedContent = FramedContent;
48
+ const FramedContent = exports.FramedContent = (0, _jsx.styled)(_react.ark.div, framedContentRecipe);
package/lib/Icon.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { ComponentPropsWithRef } from "react";
9
9
  import { type RecipeVariantProps } from "@ndla/styled-system/css";
10
+ import { JsxStyleProps } from "@ndla/styled-system/types";
10
11
  export declare const iconRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
11
12
  size: {
12
13
  xsmall: {
@@ -32,6 +33,6 @@ interface BaseIconProps extends ComponentPropsWithRef<"svg"> {
32
33
  title?: string;
33
34
  description?: string;
34
35
  }
35
- export type IconProps = BaseIconProps & IconVariantProps;
36
- export declare const Icon: ({ children, size, role, title, description, width, height, className, "aria-hidden": ariaHidden, ...props }: IconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
36
+ export type IconProps = BaseIconProps & IconVariantProps & JsxStyleProps;
37
+ export declare const Icon: ({ children, size, role, title, description, width, height, css: cssProp, "aria-hidden": ariaHidden, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
37
38
  export {};
package/lib/Icon.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.iconRecipe = exports.Icon = void 0;
7
7
  var _css = require("@ndla/styled-system/css");
8
+ var _jsx2 = require("@ndla/styled-system/jsx");
8
9
  var _jsxRuntime = require("react/jsx-runtime");
9
10
  /**
10
11
  * Copyright (c) 2024-present, NDLA.
@@ -46,6 +47,8 @@ const iconRecipe = exports.iconRecipe = (0, _css.cva)({
46
47
  }
47
48
  }
48
49
  });
50
+ const StyledSvg = (0, _jsx2.styled)("svg");
51
+
49
52
  // TODO: Move this component over to ndla/icons
50
53
  const Icon = _ref => {
51
54
  let {
@@ -56,18 +59,18 @@ const Icon = _ref => {
56
59
  description,
57
60
  width,
58
61
  height,
59
- className,
62
+ css: cssProp,
60
63
  "aria-hidden": ariaHidden = true,
61
64
  ...props
62
65
  } = _ref;
63
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
66
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSvg, {
64
67
  "data-icon": "",
65
68
  "aria-hidden": ariaHidden,
66
69
  preserveAspectRatio: "xMidYMid meet",
67
- ...props,
68
- className: (0, _css.cx)(iconRecipe({
70
+ css: _css.css.raw(iconRecipe.raw({
69
71
  size
70
- }), className),
72
+ }), cssProp),
73
+ ...props,
71
74
  children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
72
75
  children: title
73
76
  }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("desc", {
package/lib/Input.d.ts CHANGED
@@ -5,16 +5,17 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { ComponentPropsWithRef, HTMLAttributes } from "react";
9
- export declare const InputContainer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
10
- export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
11
- ref?: ((instance: HTMLInputElement | null) => void) | import("react").RefObject<HTMLInputElement> | null | undefined;
12
- }, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
13
- export declare const FormInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
14
- ref?: ((instance: HTMLInputElement | null) => void) | import("react").RefObject<HTMLInputElement> | null | undefined;
15
- }, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
16
- interface TextAreaProps extends ComponentPropsWithRef<"textarea"> {
8
+ import { HTMLArkProps } from "@ark-ui/react";
9
+ import { JsxStyleProps } from "@ndla/styled-system/types";
10
+ export declare const InputContainer: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
11
+ forwardCssProp?: boolean | undefined;
12
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
13
+ export interface InputProps extends HTMLArkProps<"input">, JsxStyleProps {
17
14
  }
18
- export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
19
- export declare const FormTextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
15
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
16
+ export declare const FieldInput: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
17
+ interface TextAreaProps extends HTMLArkProps<"textarea">, JsxStyleProps {
18
+ }
19
+ export declare const TextArea: import("react").ForwardRefExoticComponent<TextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
20
+ export declare const FieldTextArea: import("react").ForwardRefExoticComponent<TextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
20
21
  export {};
package/lib/Input.js CHANGED
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TextArea = exports.InputContainer = exports.Input = exports.FormTextArea = exports.FormInput = void 0;
6
+ exports.TextArea = exports.InputContainer = exports.Input = exports.FieldTextArea = exports.FieldInput = void 0;
7
7
  var _react = require("react");
8
+ var _react2 = require("@ark-ui/react");
8
9
  var _css = require("@ndla/styled-system/css");
9
10
  var _jsx2 = require("@ndla/styled-system/jsx");
10
11
  var _util = require("@ndla/util");
11
- var _FormControl = require("./FormControl");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  /**
14
14
  * Copyright (c) 2024-present, NDLA.
@@ -57,7 +57,7 @@ const inputCss = _css.css.raw({
57
57
  }
58
58
  }
59
59
  });
60
- const StyledInputContainer = (0, _jsx2.styled)("div", {
60
+ const StyledInputContainer = (0, _jsx2.styled)(_react2.ark.div, {
61
61
  base: {
62
62
  width: "100%",
63
63
  display: "flex",
@@ -71,13 +71,13 @@ const StyledInputContainer = (0, _jsx2.styled)("div", {
71
71
  const InputContainer = exports.InputContainer = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
72
72
  let {
73
73
  children,
74
- className,
74
+ css: cssProp,
75
75
  ...rest
76
76
  } = _ref;
77
77
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InputContext.Provider, {
78
78
  value: {},
79
79
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledInputContainer, {
80
- className: (0, _css.cx)((0, _css.css)(inputCss), className),
80
+ css: _css.css.raw(inputCss, cssProp),
81
81
  ...rest,
82
82
  ref: ref,
83
83
  children: children
@@ -108,28 +108,30 @@ const baseTextAreaCss = _css.css.raw({
108
108
  resize: "none",
109
109
  overflowY: "hidden"
110
110
  });
111
+ const StyledInput = (0, _jsx2.styled)(_react2.ark.input);
111
112
  const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
112
113
  let {
113
- className,
114
+ css: cssProp,
114
115
  ...props
115
116
  } = _ref2;
116
117
  const context = (0, _react.useContext)(InputContext);
117
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.input, {
118
- className: (0, _css.cx)((0, _css.css)(baseInputCss, context ? undefined : inputCss), className),
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledInput, {
119
+ css: _css.css.raw(baseInputCss, context ? undefined : inputCss, cssProp),
119
120
  ref: ref,
120
121
  ...props
121
122
  });
122
123
  });
123
- const FormInput = exports.FormInput = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
124
- const field = (0, _FormControl.useFormControl)(props);
125
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {
126
- ...field,
124
+ const FieldInput = exports.FieldInput = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Input, {
125
+ asChild: true,
126
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {
127
+ ...props,
127
128
  ref: ref
128
- });
129
- });
129
+ })
130
+ }));
131
+ const StyledTextArea = (0, _jsx2.styled)(_react2.ark.textarea);
130
132
  const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
131
133
  let {
132
- className,
134
+ css: cssProp,
133
135
  ...props
134
136
  } = _ref3;
135
137
  const context = (0, _react.useContext)(InputContext);
@@ -150,16 +152,16 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((_ref3,
150
152
  window.removeEventListener("resize", resize);
151
153
  };
152
154
  }, [resize]);
153
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.textarea, {
154
- className: (0, _css.cx)((0, _css.css)(baseInputCss, context ? undefined : inputCss, baseTextAreaCss), className),
155
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTextArea, {
156
+ css: _css.css.raw(baseInputCss, context ? undefined : inputCss, baseTextAreaCss, cssProp),
155
157
  ref: (0, _util.composeRefs)(ref, localRef),
156
158
  ...props
157
159
  });
158
160
  });
159
- const FormTextArea = exports.FormTextArea = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
160
- const field = (0, _FormControl.useFormControl)(props);
161
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextArea, {
162
- ...field,
161
+ const FieldTextArea = exports.FieldTextArea = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Textarea, {
162
+ asChild: true,
163
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TextArea, {
164
+ ...props,
163
165
  ref: ref
164
- });
165
- });
166
+ })
167
+ }));
package/lib/Label.d.ts CHANGED
@@ -5,12 +5,18 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { ComponentPropsWithRef } from "react";
8
+ import { HTMLArkProps } from "@ark-ui/react";
9
+ import { JsxStyleProps } from "@ndla/styled-system/types";
9
10
  import { TextProps } from "./Text";
10
- export type LegendProps = ComponentPropsWithRef<"legend"> & TextProps;
11
- export declare const Legend: import("react").ForwardRefExoticComponent<Omit<LegendProps, "ref"> & import("react").RefAttributes<HTMLLegendElement>>;
12
- export declare const FormLegend: import("react").ForwardRefExoticComponent<Omit<LegendProps, "ref"> & import("react").RefAttributes<HTMLLegendElement>>;
13
- export type LabelProps = ComponentPropsWithRef<"label"> & TextProps;
14
- export declare const Label: import("react").ForwardRefExoticComponent<Omit<LabelProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
15
- export declare const FormLabel: import("react").ForwardRefExoticComponent<Omit<LabelProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
11
+ export type LegendProps = HTMLArkProps<"legend"> & JsxStyleProps & TextProps;
12
+ export declare const Legend: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
13
+ forwardCssProp?: boolean | undefined;
14
+ } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLLegendElement>>;
15
+ export type LabelProps = HTMLArkProps<"label"> & TextProps & JsxStyleProps;
16
+ export declare const Label: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & TextProps & {
17
+ forwardCssProp?: boolean | undefined;
18
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLLabelElement>>;
19
+ export declare const FieldLabel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & TextProps & {
20
+ forwardCssProp?: boolean | undefined;
21
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLLabelElement>>;
16
22
  export declare const Fieldset: import("@ndla/styled-system/jsx").StyledComponent<"fieldset", {}>;