@ndla/primitives 0.0.21 → 0.0.23

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.
package/es/Spinner.js CHANGED
@@ -19,15 +19,18 @@ export const spinnerRecipe = cva({
19
19
  borderStyle: "solid",
20
20
  borderBlockColor: "background.subtle",
21
21
  borderInlineStartColor: "background.subtle",
22
- borderInlineEndColor: "stroke.default",
23
- marginBlock: "medium",
24
- marginInline: "auto"
22
+ borderInlineEndColor: "stroke.default"
25
23
  },
26
24
  defaultVariants: {
27
25
  size: "large"
28
26
  },
29
27
  variants: {
30
28
  size: {
29
+ small: {
30
+ borderWidth: "4px",
31
+ height: "medium",
32
+ width: "medium"
33
+ },
31
34
  medium: {
32
35
  borderWidth: "4px",
33
36
  height: "large",
package/es/index.js CHANGED
@@ -16,15 +16,15 @@ export { CheckboxRoot, CheckboxIndicator, CheckboxLabel, CheckboxControl, Checkb
16
16
  export { ComboboxRoot, ComboboxClearTrigger, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItemGroupLabel, ComboboxItemGroup, ComboboxItemIndicator, ComboboxItem, ComboboxItemText, ComboboxLabel, ComboboxPositioner, ComboboxTrigger, ComboboxList } from "./Combobox";
17
17
  export { DialogRoot, DialogBackdrop, DialogStandaloneContent, DialogPositioner, DialogContent, DialogDescription, DialogTitle, DialogTrigger, DialogCloseTrigger, DialogHeader, DialogBody } from "./Dialog";
18
18
  export { ExpandableBox, ExpandableBoxSummary } from "./ExpandableBox";
19
- export { FieldRoot } from "./Field";
20
- export { FieldErrorMessage } from "./FieldErrorMessage";
21
- export { FieldHelper } from "./FieldHelper";
19
+ export { FieldRoot, FieldsetRoot } from "./Field";
20
+ export { FieldErrorMessage, FieldsetErrorText } from "./FieldErrorMessage";
21
+ export { FieldHelper, FieldsetHelper } from "./FieldHelper";
22
22
  export { Figure } from "./Figure";
23
23
  export { FramedContent } from "./FramedContent";
24
24
  export { Hero, HeroBackground, HeroContent } from "./Hero";
25
25
  export { Picture, Img, Image, makeSrcQueryString, getSrcSet } from "./Image";
26
26
  export { Input, FieldInput, InputContainer, TextArea, FieldTextArea } from "./Input";
27
- export { Label, FieldLabel } from "./Label";
27
+ export { Label, FieldLabel, Legend, FieldsetLegend } from "./Label";
28
28
  export { MenuRoot, MenuContent, MenuItemGroupLabel, MenuItemGroup, MenuItem, MenuPositioner, MenuTriggerItem, MenuTrigger, MenuSeparator } from "./Menu";
29
29
  export { MessageBox } from "./MessageBox";
30
30
  export { NdlaLogoEn, NdlaLogoNb, NdlaLogoText } from "./NdlaLogo";
package/lib/Button.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ import { ReactNode } from "react";
8
9
  import { HTMLArkProps } from "@ark-ui/react";
9
10
  import { RecipeVariantProps } from "@ndla/styled-system/css";
10
11
  import { JsxStyleProps, RecipeVariant } from "@ndla/styled-system/types";
@@ -125,10 +126,14 @@ type ButtonVariant = Exclude<Variant, "clear" | "clearSubtle">;
125
126
  export type ButtonVariantProps = {
126
127
  variant?: ButtonVariant;
127
128
  } & RecipeVariantProps<typeof buttonRecipe>;
128
- export type ButtonProps = HTMLArkProps<"button"> & JsxStyleProps & ButtonVariantProps;
129
- export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
130
- consumeCss?: boolean | undefined;
131
- } & import("@ndla/styled-system/types").WithCss & {
129
+ interface BaseButtonProps extends HTMLArkProps<"button">, JsxStyleProps {
130
+ loading?: boolean;
131
+ loadingContent?: ReactNode;
132
+ replaceContent?: boolean;
133
+ }
134
+ export type ButtonProps = BaseButtonProps & ButtonVariantProps;
135
+ export declare const BaseButton: import("react").ForwardRefExoticComponent<BaseButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
136
+ export declare const Button: import("react").ForwardRefExoticComponent<BaseButtonProps & {
132
137
  variant?: ButtonVariant | undefined;
133
138
  } & {
134
139
  size?: "small" | "default" | undefined;
@@ -137,8 +142,6 @@ type IconButtonVariant = Exclude<Variant, "link">;
137
142
  export type IconButtonVariantProps = {
138
143
  variant?: IconButtonVariant;
139
144
  };
140
- export type IconButtonProps = HTMLArkProps<"button"> & IconButtonVariantProps & JsxStyleProps;
141
- export declare const IconButton: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & IconButtonVariantProps & {
142
- consumeCss?: boolean | undefined;
143
- } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
145
+ export type IconButtonProps = BaseButtonProps & IconButtonVariantProps;
146
+ export declare const IconButton: import("react").ForwardRefExoticComponent<BaseButtonProps & IconButtonVariantProps & import("react").RefAttributes<HTMLButtonElement>>;
144
147
  export {};
package/lib/Button.js CHANGED
@@ -3,11 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.iconButtonRecipe = exports.buttonRecipe = exports.buttonBaseRecipe = exports.IconButton = exports.Button = void 0;
6
+ exports.iconButtonRecipe = exports.buttonRecipe = exports.buttonBaseRecipe = exports.IconButton = exports.Button = exports.BaseButton = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@ark-ui/react");
9
9
  var _css = require("@ndla/styled-system/css");
10
10
  var _jsx2 = require("@ndla/styled-system/jsx");
11
+ var _Spinner = require("./Spinner");
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  /**
13
14
  * Copyright (c) 2024-present, NDLA.
@@ -194,15 +195,42 @@ const StyledButton = (0, _jsx2.styled)(_react2.ark.button, {}, {
194
195
  type: "button"
195
196
  }
196
197
  });
197
- const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
198
+ const BaseButton = exports.BaseButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
199
+ let {
200
+ loading,
201
+ loadingContent: loadingContentProp,
202
+ replaceContent,
203
+ onClick,
204
+ children,
205
+ ...props
206
+ } = _ref;
207
+ const ariaDisabled = loading ? {
208
+ "aria-disabled": true
209
+ } : {};
210
+ const loadingContent = replaceContent ? loadingContentProp : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
211
+ children: [loadingContentProp, children]
212
+ });
213
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledButton, {
214
+ onClick: loading ? undefined : onClick,
215
+ ...ariaDisabled,
216
+ ...props,
217
+ ref: ref,
218
+ children: loading ? loadingContent : children
219
+ });
220
+ });
221
+ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
198
222
  let {
199
223
  variant,
224
+ loadingContent,
200
225
  size,
201
226
  css: cssProp,
202
227
  ...props
203
- } = _ref;
204
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledButton, {
228
+ } = _ref2;
229
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseButton, {
205
230
  ...props,
231
+ loadingContent: loadingContent ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.Spinner, {
232
+ size: "small"
233
+ }),
206
234
  css: _css.css.raw(buttonBaseRecipe.raw({
207
235
  variant
208
236
  }), buttonRecipe.raw({
@@ -211,23 +239,23 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref)
211
239
  ref: ref
212
240
  });
213
241
  });
214
- const StyledIconButton = (0, _jsx2.styled)(_react2.ark.button, {}, {
215
- baseComponent: true,
216
- defaultProps: {
217
- type: "button"
218
- }
219
- });
220
- const IconButton = exports.IconButton = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
242
+ const IconButton = exports.IconButton = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
221
243
  let {
222
244
  variant,
223
245
  css: cssProp,
246
+ loadingContent,
247
+ replaceContent = true,
224
248
  ...props
225
- } = _ref2;
226
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIconButton, {
249
+ } = _ref3;
250
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseButton, {
227
251
  ...props,
228
252
  css: _css.css.raw(buttonBaseRecipe.raw({
229
253
  variant
230
254
  }), iconButtonRecipe.raw(), cssProp),
255
+ loadingContent: loadingContent ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.Spinner, {
256
+ size: "small"
257
+ }),
258
+ replaceContent: replaceContent,
231
259
  ref: ref
232
260
  });
233
261
  });
package/lib/Field.d.ts CHANGED
@@ -5,5 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { Field } from "@ark-ui/react";
8
+ import { Field, Fieldset } from "@ark-ui/react";
9
9
  export declare const FieldRoot: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<Field.RootProps & import("react").RefAttributes<HTMLDivElement>>, {}>;
10
+ export declare const FieldsetRoot: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<Fieldset.RootProps & import("react").RefAttributes<HTMLFieldSetElement>>, {}>;
package/lib/Field.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FieldRoot = void 0;
6
+ exports.FieldsetRoot = exports.FieldRoot = void 0;
7
7
  var _react = require("@ark-ui/react");
8
8
  var _jsx = require("@ndla/styled-system/jsx");
9
9
  /**
@@ -14,12 +14,18 @@ var _jsx = require("@ndla/styled-system/jsx");
14
14
  *
15
15
  */
16
16
 
17
+ const rootStyle = {
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ gap: "3xsmall"
21
+ };
17
22
  const FieldRoot = exports.FieldRoot = (0, _jsx.styled)(_react.Field.Root, {
18
- base: {
19
- display: "flex",
20
- flexDirection: "column",
21
- gap: "3xsmall"
22
- }
23
+ base: rootStyle
24
+ }, {
25
+ baseComponent: true
26
+ });
27
+ const FieldsetRoot = exports.FieldsetRoot = (0, _jsx.styled)(_react.Fieldset.Root, {
28
+ base: rootStyle
23
29
  }, {
24
30
  baseComponent: true
25
31
  });
@@ -5,7 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { TextProps } from "./Text";
9
- export declare const FieldErrorMessage: import("react").ForwardRefExoticComponent<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
8
+ import { Field, Fieldset } from "@ark-ui/react";
9
+ import type { TextProps } from "./Text";
10
+ export declare const FieldErrorMessage: import("react").ForwardRefExoticComponent<Field.ErrorTextProps & TextProps & {
11
+ consumeCss?: boolean | undefined;
12
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
13
+ export declare const FieldsetErrorText: import("react").ForwardRefExoticComponent<Fieldset.ErrorTextProps & TextProps & {
10
14
  consumeCss?: boolean | undefined;
11
15
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FieldErrorMessage = void 0;
6
+ exports.FieldsetErrorText = exports.FieldErrorMessage = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@ark-ui/react");
9
9
  var _css = require("@ndla/styled-system/css");
@@ -17,12 +17,13 @@ var _jsxRuntime = require("react/jsx-runtime");
17
17
  *
18
18
  */
19
19
 
20
- const StyledErrorText = (0, _jsx2.styled)(_react2.Field.ErrorText, {
21
- base: {
22
- color: "text.error",
23
- whiteSpace: "pre-line",
24
- justifyContent: "center"
25
- }
20
+ const errorTextStyling = {
21
+ color: "text.error",
22
+ whiteSpace: "pre-line",
23
+ justifyContent: "center"
24
+ };
25
+ const StyledFieldErrorText = (0, _jsx2.styled)(_react2.Field.ErrorText, {
26
+ base: errorTextStyling
26
27
  }, {
27
28
  baseComponent: true
28
29
  });
@@ -35,7 +36,32 @@ const FieldErrorMessage = exports.FieldErrorMessage = /*#__PURE__*/(0, _react.fo
35
36
  srOnly,
36
37
  ...props
37
38
  } = _ref;
38
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledErrorText, {
39
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFieldErrorText, {
40
+ css: _css.css.raw({
41
+ textStyle,
42
+ fontWeight,
43
+ color,
44
+ srOnly
45
+ }, cssProp),
46
+ ...props,
47
+ ref: ref
48
+ });
49
+ });
50
+ const StyledFieldsetErrorText = (0, _jsx2.styled)(_react2.Fieldset.ErrorText, {
51
+ base: errorTextStyling
52
+ }, {
53
+ baseComponent: true
54
+ });
55
+ const FieldsetErrorText = exports.FieldsetErrorText = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
56
+ let {
57
+ textStyle = "label.small",
58
+ fontWeight,
59
+ css: cssProp,
60
+ color,
61
+ srOnly,
62
+ ...props
63
+ } = _ref2;
64
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFieldsetErrorText, {
39
65
  css: _css.css.raw({
40
66
  textStyle,
41
67
  fontWeight,
@@ -5,7 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { TextProps } from "./Text";
9
- export declare const FieldHelper: import("react").ForwardRefExoticComponent<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
8
+ import { Field, Fieldset } from "@ark-ui/react";
9
+ import type { TextProps } from "./Text";
10
+ export declare const FieldHelper: import("react").ForwardRefExoticComponent<Field.HelperTextProps & TextProps & {
10
11
  consumeCss?: boolean | undefined;
11
- } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
12
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
13
+ export declare const FieldsetHelper: import("react").ForwardRefExoticComponent<Fieldset.HelperTextProps & TextProps & {
14
+ consumeCss?: boolean | undefined;
15
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FieldHelper = void 0;
6
+ exports.FieldsetHelper = exports.FieldHelper = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@ark-ui/react");
9
9
  var _css = require("@ndla/styled-system/css");
@@ -39,4 +39,27 @@ const FieldHelper = exports.FieldHelper = /*#__PURE__*/(0, _react.forwardRef)((_
39
39
  ...props,
40
40
  ref: ref
41
41
  });
42
+ });
43
+ const StyledFieldsetHelper = (0, _jsx2.styled)(_react2.Fieldset.HelperText, {}, {
44
+ baseComponent: true
45
+ });
46
+ const FieldsetHelper = exports.FieldsetHelper = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
47
+ let {
48
+ textStyle = "label.small",
49
+ fontWeight,
50
+ color,
51
+ srOnly,
52
+ css: cssProp,
53
+ ...props
54
+ } = _ref2;
55
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFieldsetHelper, {
56
+ css: _css.css.raw({
57
+ textStyle,
58
+ fontWeight,
59
+ color,
60
+ srOnly
61
+ }, cssProp),
62
+ ...props,
63
+ ref: ref
64
+ });
42
65
  });
@@ -53,6 +53,7 @@ const FramedContent = exports.FramedContent = /*#__PURE__*/(0, _react.forwardRef
53
53
  ...props
54
54
  } = _ref;
55
55
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFramedContent, {
56
+ "data-embed-type": "framed-content",
56
57
  css: _css.css.raw(framedContentRecipe.raw({
57
58
  colorTheme
58
59
  }), cssProp),
package/lib/Hero.js CHANGED
@@ -28,7 +28,7 @@ const heroRecipe = (0, _css.sva)({
28
28
  width: "100%",
29
29
  zIndex: "hide",
30
30
  overflow: "hidden",
31
- clipPath: "polygon(0 0, 100% 0, 100% 65%, 0 100%)"
31
+ clipPath: "polygon(0 0, 100% 0, 100% calc(100% - 5vw), 0 100%)"
32
32
  },
33
33
  content: {
34
34
  display: "flex",
package/lib/Input.js CHANGED
@@ -127,10 +127,9 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =
127
127
  });
128
128
  const FieldInput = exports.FieldInput = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Input, {
129
129
  asChild: true,
130
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {
131
- ...props,
132
- ref: ref
133
- })
130
+ ...props,
131
+ ref: ref,
132
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {})
134
133
  }));
135
134
  const StyledTextArea = (0, _jsx2.styled)(_react2.ark.textarea, {}, {
136
135
  baseComponent: true
@@ -166,8 +165,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((_ref3,
166
165
  });
167
166
  const FieldTextArea = exports.FieldTextArea = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Textarea, {
168
167
  asChild: true,
169
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TextArea, {
170
- ...props,
171
- ref: ref
172
- })
168
+ ...props,
169
+ ref: ref,
170
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TextArea, {})
173
171
  }));
package/lib/Label.d.ts CHANGED
@@ -5,13 +5,17 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { HTMLArkProps } from "@ark-ui/react";
8
+ import { Fieldset, HTMLArkProps } from "@ark-ui/react";
9
9
  import { JsxStyleProps } from "@ndla/styled-system/types";
10
10
  import { TextProps } from "./Text";
11
11
  export type LegendProps = HTMLArkProps<"legend"> & JsxStyleProps & TextProps;
12
12
  export declare const Legend: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
13
13
  consumeCss?: boolean | undefined;
14
14
  } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLLegendElement>>;
15
+ export type FieldsetLegendProps = Fieldset.LegendProps & TextProps & JsxStyleProps;
16
+ export declare const FieldsetLegend: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
17
+ consumeCss?: boolean | undefined;
18
+ } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLLegendElement>>;
15
19
  export type LabelProps = HTMLArkProps<"label"> & TextProps & JsxStyleProps;
16
20
  export declare const Label: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & TextProps & {
17
21
  consumeCss?: boolean | undefined;
@@ -19,4 +23,3 @@ export declare const Label: import("react").ForwardRefExoticComponent<Omit<impor
19
23
  export declare const FieldLabel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & TextProps & {
20
24
  consumeCss?: boolean | undefined;
21
25
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLLabelElement>>;
22
- export declare const Fieldset: import("@ndla/styled-system/types").StyledComponent<"fieldset", {}>;
package/lib/Label.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Legend = exports.Label = exports.Fieldset = exports.FieldLabel = void 0;
6
+ exports.Legend = exports.Label = exports.FieldsetLegend = exports.FieldLabel = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@ark-ui/react");
9
9
  var _css = require("@ndla/styled-system/css");
@@ -19,7 +19,7 @@ var _jsxRuntime = require("react/jsx-runtime");
19
19
 
20
20
  const StyledLegend = (0, _jsx2.styled)(_react2.ark.legend, {
21
21
  base: {
22
- float: "none",
22
+ float: "left",
23
23
  width: "inherit",
24
24
  _disabled: {
25
25
  color: "text.subtle"
@@ -28,7 +28,6 @@ const StyledLegend = (0, _jsx2.styled)(_react2.ark.legend, {
28
28
  }, {
29
29
  baseComponent: true
30
30
  });
31
- // TODO: This is not exported for now. Let's wait and see when ark decides to release their legend and fieldset.
32
31
  const Legend = exports.Legend = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
33
32
  let {
34
33
  textStyle = "label.medium",
@@ -49,6 +48,12 @@ const Legend = exports.Legend = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref)
49
48
  ref: ref
50
49
  });
51
50
  });
51
+ const FieldsetLegend = exports.FieldsetLegend = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Fieldset.Legend, {
52
+ asChild: true,
53
+ ...props,
54
+ ref: ref,
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Legend, {})
56
+ }));
52
57
  const StyledLabel = (0, _jsx2.styled)(_react2.ark.label, {
53
58
  base: {
54
59
  display: "inline-block",
@@ -81,15 +86,7 @@ const Label = exports.Label = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =
81
86
  });
82
87
  const FieldLabel = exports.FieldLabel = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Label, {
83
88
  asChild: true,
84
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, {
85
- ...props,
86
- ref: ref
87
- })
88
- }));
89
- const Fieldset = exports.Fieldset = (0, _jsx2.styled)("fieldset", {
90
- base: {
91
- border: "none",
92
- padding: "0",
93
- margin: "0"
94
- }
95
- });
89
+ ...props,
90
+ ref: ref,
91
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, {})
92
+ }));
package/lib/RadioGroup.js CHANGED
@@ -137,10 +137,10 @@ const RadioGroupLabel = exports.RadioGroupLabel = /*#__PURE__*/(0, _react.forwar
137
137
  } = _ref2;
138
138
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalRadioGroupLabel, {
139
139
  ref: ref,
140
+ ...props,
140
141
  asChild: true,
141
142
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
142
- textStyle: textStyle,
143
- ...props
143
+ textStyle: textStyle
144
144
  })
145
145
  });
146
146
  });
package/lib/Spinner.d.ts CHANGED
@@ -10,6 +10,11 @@ import { RecipeVariantProps } from "@ndla/styled-system/css";
10
10
  import { JsxStyleProps } from "@ndla/styled-system/types";
11
11
  export declare const spinnerRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
12
12
  size: {
13
+ small: {
14
+ borderWidth: "4px";
15
+ height: "medium";
16
+ width: "medium";
17
+ };
13
18
  medium: {
14
19
  borderWidth: "4px";
15
20
  height: "large";
@@ -27,5 +32,5 @@ export type SpinnerProps = HTMLArkProps<"div"> & JsxStyleProps & SpinnerVariantP
27
32
  export declare const Spinner: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
28
33
  consumeCss?: boolean | undefined;
29
34
  } & import("@ndla/styled-system/types").WithCss & {
30
- size?: "medium" | "large" | undefined;
35
+ size?: "small" | "medium" | "large" | undefined;
31
36
  } & import("react").RefAttributes<HTMLDivElement>>;
package/lib/Spinner.js CHANGED
@@ -25,15 +25,18 @@ const spinnerRecipe = exports.spinnerRecipe = (0, _css.cva)({
25
25
  borderStyle: "solid",
26
26
  borderBlockColor: "background.subtle",
27
27
  borderInlineStartColor: "background.subtle",
28
- borderInlineEndColor: "stroke.default",
29
- marginBlock: "medium",
30
- marginInline: "auto"
28
+ borderInlineEndColor: "stroke.default"
31
29
  },
32
30
  defaultVariants: {
33
31
  size: "large"
34
32
  },
35
33
  variants: {
36
34
  size: {
35
+ small: {
36
+ borderWidth: "4px",
37
+ height: "medium",
38
+ width: "medium"
39
+ },
37
40
  medium: {
38
41
  borderWidth: "4px",
39
42
  height: "large",
package/lib/index.d.ts CHANGED
@@ -24,9 +24,9 @@ export type { DialogVariantProps, DialogRootProps } from "./Dialog";
24
24
  export { DialogRoot, DialogBackdrop, DialogStandaloneContent, DialogPositioner, DialogContent, DialogDescription, DialogTitle, DialogTrigger, DialogCloseTrigger, DialogHeader, DialogBody, } from "./Dialog";
25
25
  export type { ExpandableBoxProps, ExpandableBoxSummaryProps } from "./ExpandableBox";
26
26
  export { ExpandableBox, ExpandableBoxSummary } from "./ExpandableBox";
27
- export { FieldRoot } from "./Field";
28
- export { FieldErrorMessage } from "./FieldErrorMessage";
29
- export { FieldHelper } from "./FieldHelper";
27
+ export { FieldRoot, FieldsetRoot } from "./Field";
28
+ export { FieldErrorMessage, FieldsetErrorText } from "./FieldErrorMessage";
29
+ export { FieldHelper, FieldsetHelper } from "./FieldHelper";
30
30
  export type { FigureSize, FigureVariantProps, FigureProps, FigureFloat } from "./Figure";
31
31
  export { Figure } from "./Figure";
32
32
  export type { FramedContentVariantProps, FramedContentProps } from "./FramedContent";
@@ -36,8 +36,8 @@ export { Hero, HeroBackground, HeroContent } from "./Hero";
36
36
  export type { ImageCrop, ImageFocalPoint, PictureProps, ImgProps, ImageProps } from "./Image";
37
37
  export { Picture, Img, Image, makeSrcQueryString, getSrcSet } from "./Image";
38
38
  export { Input, FieldInput, InputContainer, TextArea, FieldTextArea } from "./Input";
39
- export type { LabelProps } from "./Label";
40
- export { Label, FieldLabel } from "./Label";
39
+ export type { LabelProps, LegendProps, FieldsetLegendProps } from "./Label";
40
+ export { Label, FieldLabel, Legend, FieldsetLegend } from "./Label";
41
41
  export type { MenuRootProps, MenuItemVariantProps, MenuItemProps } from "./Menu";
42
42
  export { MenuRoot, MenuContent, MenuItemGroupLabel, MenuItemGroup, MenuItem, MenuPositioner, MenuTriggerItem, MenuTrigger, MenuSeparator, } from "./Menu";
43
43
  export type { MessageBoxVariantProps, MessageBoxProps } from "./MessageBox";
package/lib/index.js CHANGED
@@ -315,6 +315,30 @@ Object.defineProperty(exports, "FieldTextArea", {
315
315
  return _Input.FieldTextArea;
316
316
  }
317
317
  });
318
+ Object.defineProperty(exports, "FieldsetErrorText", {
319
+ enumerable: true,
320
+ get: function () {
321
+ return _FieldErrorMessage.FieldsetErrorText;
322
+ }
323
+ });
324
+ Object.defineProperty(exports, "FieldsetHelper", {
325
+ enumerable: true,
326
+ get: function () {
327
+ return _FieldHelper.FieldsetHelper;
328
+ }
329
+ });
330
+ Object.defineProperty(exports, "FieldsetLegend", {
331
+ enumerable: true,
332
+ get: function () {
333
+ return _Label.FieldsetLegend;
334
+ }
335
+ });
336
+ Object.defineProperty(exports, "FieldsetRoot", {
337
+ enumerable: true,
338
+ get: function () {
339
+ return _Field.FieldsetRoot;
340
+ }
341
+ });
318
342
  Object.defineProperty(exports, "Figure", {
319
343
  enumerable: true,
320
344
  get: function () {
@@ -387,6 +411,12 @@ Object.defineProperty(exports, "Label", {
387
411
  return _Label.Label;
388
412
  }
389
413
  });
414
+ Object.defineProperty(exports, "Legend", {
415
+ enumerable: true,
416
+ get: function () {
417
+ return _Label.Legend;
418
+ }
419
+ });
390
420
  Object.defineProperty(exports, "MenuContent", {
391
421
  enumerable: true,
392
422
  get: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/primitives",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "Primitive components for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -28,12 +28,12 @@
28
28
  "lib"
29
29
  ],
30
30
  "dependencies": {
31
- "@ark-ui/react": "^3.5.0",
32
- "@ndla/styled-system": "^0.0.8",
31
+ "@ark-ui/react": "^3.6.2",
32
+ "@ndla/styled-system": "^0.0.9",
33
33
  "@ndla/util": "^4.1.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ndla/preset-panda": "^0.0.12",
36
+ "@ndla/preset-panda": "^0.0.13",
37
37
  "@pandacss/dev": "^0.42.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "a5f4f60d7a65d6f0aa91e357e080584cda8a70f3"
46
+ "gitHead": "35713120e2a004be81a62f17e29af74707b21dc4"
47
47
  }