@ndla/primitives 0.0.12 → 0.0.13

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 (91) hide show
  1. package/dist/panda.buildinfo.json +5 -15
  2. package/dist/styles.css +18 -58
  3. package/es/ArticleLists.js +22 -1
  4. package/es/Badge.js +20 -2
  5. package/es/BlockQuote.js +20 -2
  6. package/es/Button.js +2 -0
  7. package/es/Checkbox.js +0 -1
  8. package/es/Combobox.js +8 -4
  9. package/es/Dialog.js +6 -4
  10. package/es/ExpandableBox.js +2 -0
  11. package/es/Field.js +2 -0
  12. package/es/FieldErrorMessage.js +2 -0
  13. package/es/FieldHelper.js +3 -1
  14. package/es/Figure.js +24 -1
  15. package/es/FramedContent.js +24 -10
  16. package/es/Input.js +8 -2
  17. package/es/Label.js +10 -2
  18. package/es/Menu.js +1 -2
  19. package/es/MessageBox.js +20 -2
  20. package/es/RadioGroup.js +1 -2
  21. package/es/Select.js +1 -2
  22. package/es/Skeleton.js +2 -0
  23. package/es/Slider.js +0 -1
  24. package/es/Spinner.js +20 -2
  25. package/es/Switch.js +2 -2
  26. package/es/Table.js +2 -0
  27. package/es/TagsInput.js +0 -1
  28. package/es/Text.js +6 -2
  29. package/es/Toast.js +2 -2
  30. package/es/createStyleContext.js +10 -3
  31. package/lib/Accordion.d.ts +4 -4
  32. package/lib/ArticleLists.d.ts +40 -4
  33. package/lib/ArticleLists.js +25 -4
  34. package/lib/Badge.d.ts +4 -4
  35. package/lib/Badge.js +21 -3
  36. package/lib/BlockQuote.d.ts +4 -4
  37. package/lib/BlockQuote.js +21 -3
  38. package/lib/Button.d.ts +2 -2
  39. package/lib/Button.js +2 -0
  40. package/lib/Checkbox.d.ts +4 -4
  41. package/lib/Checkbox.js +0 -1
  42. package/lib/Combobox.d.ts +2 -2
  43. package/lib/Combobox.js +8 -4
  44. package/lib/Dialog.d.ts +7 -7
  45. package/lib/Dialog.js +6 -4
  46. package/lib/ExpandableBox.js +2 -0
  47. package/lib/Field.js +2 -0
  48. package/lib/FieldErrorMessage.d.ts +1 -1
  49. package/lib/FieldErrorMessage.js +2 -0
  50. package/lib/FieldHelper.d.ts +1 -1
  51. package/lib/FieldHelper.js +3 -1
  52. package/lib/Figure.d.ts +57 -2
  53. package/lib/Figure.js +25 -2
  54. package/lib/FramedContent.d.ts +4 -7
  55. package/lib/FramedContent.js +25 -11
  56. package/lib/Input.d.ts +1 -1
  57. package/lib/Input.js +8 -2
  58. package/lib/Label.d.ts +3 -3
  59. package/lib/Label.js +10 -2
  60. package/lib/Menu.d.ts +7 -7
  61. package/lib/Menu.js +1 -2
  62. package/lib/MessageBox.d.ts +4 -4
  63. package/lib/MessageBox.js +21 -3
  64. package/lib/Pagination.d.ts +5 -5
  65. package/lib/Popover.d.ts +10 -10
  66. package/lib/RadioGroup.d.ts +5 -5
  67. package/lib/RadioGroup.js +1 -2
  68. package/lib/Select.d.ts +13 -13
  69. package/lib/Select.js +1 -2
  70. package/lib/Skeleton.js +2 -0
  71. package/lib/Slider.d.ts +5 -5
  72. package/lib/Slider.js +0 -1
  73. package/lib/Spinner.d.ts +5 -5
  74. package/lib/Spinner.js +21 -3
  75. package/lib/Switch.d.ts +3 -3
  76. package/lib/Switch.js +2 -2
  77. package/lib/Table.js +2 -0
  78. package/lib/Tabs.d.ts +4 -4
  79. package/lib/TagsInput.d.ts +10 -10
  80. package/lib/TagsInput.js +0 -1
  81. package/lib/Text.d.ts +2 -2
  82. package/lib/Text.js +6 -2
  83. package/lib/Toast.d.ts +2 -2
  84. package/lib/Toast.js +2 -2
  85. package/lib/Tooltip.d.ts +6 -6
  86. package/lib/createStyleContext.d.ts +6 -6
  87. package/lib/createStyleContext.js +9 -2
  88. package/package.json +5 -5
  89. package/es/Icon.js +0 -74
  90. package/lib/Icon.d.ts +0 -38
  91. package/lib/Icon.js +0 -81
package/lib/Select.d.ts CHANGED
@@ -11,41 +11,41 @@ import { TextProps } from "./Text";
11
11
  export type SelectRootProps<T extends Select.CollectionItem> = Select.RootProps<T> & JsxStyleProps;
12
12
  export declare const SelectRoot: <T extends Select.CollectionItem>({ lazyMount, unmountOnExit, ...props }: SelectRootProps<T>) => import("react/jsx-runtime").JSX.Element;
13
13
  export declare const SelectClearTrigger: import("react").ForwardRefExoticComponent<Select.ClearTriggerProps & {
14
- forwardCssProp?: boolean | undefined;
14
+ consumeCss?: boolean | undefined;
15
15
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
16
16
  export declare const SelectContent: import("react").ForwardRefExoticComponent<Select.ContentProps & {
17
- forwardCssProp?: boolean | undefined;
17
+ consumeCss?: boolean | undefined;
18
18
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
19
19
  export declare const SelectControl: import("react").ForwardRefExoticComponent<Select.ControlProps & {
20
- forwardCssProp?: boolean | undefined;
20
+ consumeCss?: boolean | undefined;
21
21
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
22
22
  export declare const SelectIndicator: import("react").ForwardRefExoticComponent<Select.IndicatorProps & {
23
- forwardCssProp?: boolean | undefined;
23
+ consumeCss?: boolean | undefined;
24
24
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
25
25
  export declare const SelectItemGroupLabel: import("react").ForwardRefExoticComponent<Select.ItemGroupLabelProps & {
26
- forwardCssProp?: boolean | undefined;
26
+ consumeCss?: boolean | undefined;
27
27
  } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLDivElement>>;
28
28
  export declare const SelectItemGroup: import("react").ForwardRefExoticComponent<Select.ItemGroupProps & {
29
- forwardCssProp?: boolean | undefined;
29
+ consumeCss?: boolean | undefined;
30
30
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
31
31
  export declare const SelectItemIndicator: import("react").ForwardRefExoticComponent<Select.ItemIndicatorProps & {
32
- forwardCssProp?: boolean | undefined;
32
+ consumeCss?: boolean | undefined;
33
33
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
34
34
  export declare const SelectItem: import("react").ForwardRefExoticComponent<Select.ItemProps & {
35
- forwardCssProp?: boolean | undefined;
35
+ consumeCss?: boolean | undefined;
36
36
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
37
37
  export declare const SelectItemText: import("react").ForwardRefExoticComponent<Select.ItemTextProps & {
38
- forwardCssProp?: boolean | undefined;
38
+ consumeCss?: boolean | undefined;
39
39
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
40
40
  export declare const SelectLabel: import("react").ForwardRefExoticComponent<Select.LabelProps & {
41
- forwardCssProp?: boolean | undefined;
41
+ consumeCss?: boolean | undefined;
42
42
  } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLLabelElement>>;
43
43
  export declare const SelectPositioner: import("react").ForwardRefExoticComponent<Select.PositionerProps & {
44
- forwardCssProp?: boolean | undefined;
44
+ consumeCss?: boolean | undefined;
45
45
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
46
46
  export declare const SelectTrigger: import("react").ForwardRefExoticComponent<Select.TriggerProps & {
47
- forwardCssProp?: boolean | undefined;
47
+ consumeCss?: boolean | undefined;
48
48
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
49
49
  export declare const SelectValueText: import("react").ForwardRefExoticComponent<Select.ValueTextProps & {
50
- forwardCssProp?: boolean | undefined;
50
+ consumeCss?: boolean | undefined;
51
51
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
package/lib/Select.js CHANGED
@@ -167,11 +167,11 @@ const SelectItemGroupLabel = exports.SelectItemGroupLabel = /*#__PURE__*/(0, _re
167
167
  } = _ref2;
168
168
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalSelectItemGroupLabel, {
169
169
  asChild: true,
170
- forwardCssProp: true,
171
170
  ref: ref,
172
171
  ...props,
173
172
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
174
173
  asChild: true,
174
+ consumeCss: true,
175
175
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
176
176
  children: children
177
177
  })
@@ -191,7 +191,6 @@ const SelectLabel = exports.SelectLabel = /*#__PURE__*/(0, _react.forwardRef)((_
191
191
  } = _ref3;
192
192
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalSelectLabel, {
193
193
  asChild: true,
194
- forwardCssProp: true,
195
194
  ref: ref,
196
195
  ...props,
197
196
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
package/lib/Skeleton.js CHANGED
@@ -28,4 +28,6 @@ const Skeleton = exports.Skeleton = (0, _jsx.styled)(_react.ark.div, {
28
28
  visibility: "hidden"
29
29
  }
30
30
  }
31
+ }, {
32
+ baseComponent: true
31
33
  });
package/lib/Slider.d.ts CHANGED
@@ -10,19 +10,19 @@ import { JsxStyleProps } from "@ndla/styled-system/types";
10
10
  import { TextProps } from "./Text";
11
11
  export type SliderRootProps = Slider.RootProps & JsxStyleProps;
12
12
  export declare const SliderRoot: import("react").ForwardRefExoticComponent<Slider.RootProps & {
13
- forwardCssProp?: boolean | undefined;
13
+ consumeCss?: boolean | undefined;
14
14
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
15
15
  export declare const SliderControl: import("react").ForwardRefExoticComponent<{
16
- forwardCssProp?: boolean | undefined;
16
+ consumeCss?: boolean | undefined;
17
17
  } & import("@ndla/styled-system/types").WithCss & Slider.ControlProps & import("react").RefAttributes<HTMLDivElement>>;
18
18
  export declare const SliderTrack: import("react").ForwardRefExoticComponent<{
19
- forwardCssProp?: boolean | undefined;
19
+ consumeCss?: boolean | undefined;
20
20
  } & import("@ndla/styled-system/types").WithCss & Slider.TrackProps & import("react").RefAttributes<HTMLDivElement>>;
21
21
  export declare const SliderRange: import("react").ForwardRefExoticComponent<{
22
- forwardCssProp?: boolean | undefined;
22
+ consumeCss?: boolean | undefined;
23
23
  } & import("@ndla/styled-system/types").WithCss & Slider.RangeProps & import("react").RefAttributes<HTMLDivElement>>;
24
24
  export declare const SliderThumb: import("react").ForwardRefExoticComponent<{
25
- forwardCssProp?: boolean | undefined;
25
+ consumeCss?: boolean | undefined;
26
26
  } & import("@ndla/styled-system/types").WithCss & Slider.ThumbProps & import("react").RefAttributes<HTMLDivElement>>;
27
27
  export declare const SliderLabel: ({ textStyle, ...props }: Slider.LabelProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
28
28
  export declare const SliderHiddenInput: import("react").ForwardRefExoticComponent<Slider.HiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
package/lib/Slider.js CHANGED
@@ -98,7 +98,6 @@ const SliderLabel = _ref => {
98
98
  } = _ref;
99
99
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalSliderLabel, {
100
100
  asChild: true,
101
- forwardCssProp: true,
102
101
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
103
102
  textStyle: textStyle,
104
103
  ...props
package/lib/Spinner.d.ts CHANGED
@@ -23,9 +23,9 @@ export declare const spinnerRecipe: import("@ndla/styled-system/types").RecipeRu
23
23
  };
24
24
  }>;
25
25
  export type SpinnerVariantProps = RecipeVariantProps<typeof spinnerRecipe>;
26
- export type SpinnerProps = HTMLArkProps<"div"> & SpinnerVariantProps & JsxStyleProps;
27
- export declare const Spinner: import("@ndla/styled-system/jsx").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
28
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
29
- } & import("@ark-ui/react").PolymorphicProps>, {
26
+ export type SpinnerProps = HTMLArkProps<"div"> & JsxStyleProps & SpinnerVariantProps;
27
+ export declare const Spinner: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
28
+ consumeCss?: boolean | undefined;
29
+ } & import("@ndla/styled-system/types").WithCss & {
30
30
  size?: "medium" | "large" | undefined;
31
- }>;
31
+ } & import("react").RefAttributes<HTMLDivElement>>;
package/lib/Spinner.js CHANGED
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.spinnerRecipe = exports.Spinner = void 0;
7
- var _react = require("@ark-ui/react");
7
+ var _react = require("react");
8
+ var _react2 = require("@ark-ui/react");
8
9
  var _css = require("@ndla/styled-system/css");
9
- var _jsx = require("@ndla/styled-system/jsx");
10
+ var _jsx2 = require("@ndla/styled-system/jsx");
11
+ var _jsxRuntime = require("react/jsx-runtime");
10
12
  /**
11
13
  * Copyright (c) 2024-present, NDLA.
12
14
  *
@@ -45,4 +47,20 @@ const spinnerRecipe = exports.spinnerRecipe = (0, _css.cva)({
45
47
  }
46
48
  }
47
49
  });
48
- const Spinner = exports.Spinner = (0, _jsx.styled)(_react.ark.div, spinnerRecipe);
50
+ const StyledSpinner = (0, _jsx2.styled)(_react2.ark.div, {}, {
51
+ baseComponent: true
52
+ });
53
+ const Spinner = exports.Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
54
+ let {
55
+ size,
56
+ css: cssProp,
57
+ ...props
58
+ } = _ref;
59
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSpinner, {
60
+ css: _css.css.raw(spinnerRecipe.raw({
61
+ size
62
+ }), cssProp),
63
+ ...props,
64
+ ref: ref
65
+ });
66
+ });
package/lib/Switch.d.ts CHANGED
@@ -13,13 +13,13 @@ declare const switchRecipe: import("@ndla/styled-system/types").SlotRecipeRuntim
13
13
  export type SwitchVariantProps = RecipeVariantProps<typeof switchRecipe>;
14
14
  export type SwitchRootProps = Switch.RootProps & JsxStyleProps & SwitchVariantProps;
15
15
  export declare const SwitchRoot: import("react").ForwardRefExoticComponent<Switch.RootProps & {
16
- forwardCssProp?: boolean | undefined;
16
+ consumeCss?: boolean | undefined;
17
17
  } & import("@ndla/styled-system/types").WithCss & {} & import("react").RefAttributes<HTMLLabelElement>>;
18
18
  export declare const SwitchControl: import("react").ForwardRefExoticComponent<{
19
- forwardCssProp?: boolean | undefined;
19
+ consumeCss?: boolean | undefined;
20
20
  } & import("@ndla/styled-system/types").WithCss & Switch.ControlProps & import("react").RefAttributes<HTMLSpanElement>>;
21
21
  export declare const SwitchThumb: import("react").ForwardRefExoticComponent<{
22
- forwardCssProp?: boolean | undefined;
22
+ consumeCss?: boolean | undefined;
23
23
  } & import("@ndla/styled-system/types").WithCss & Switch.ThumbProps & import("react").RefAttributes<HTMLSpanElement>>;
24
24
  export declare const SwitchLabel: ({ textStyle, children, ...props }: Switch.LabelProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
25
25
  export declare const SwitchHiddenInput: import("react").ForwardRefExoticComponent<Switch.HiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
package/lib/Switch.js CHANGED
@@ -58,7 +58,7 @@ const switchRecipe = (0, _css.sva)({
58
58
  justifyContent: "center",
59
59
  background: "icon.onAction",
60
60
  borderRadius: "full",
61
- boxShadow: "xsmall",
61
+ boxShadow: "small",
62
62
  transitionDuration: "fast",
63
63
  transitionProperty: "transform",
64
64
  transitionTimingFunction: "default",
@@ -115,9 +115,9 @@ const SwitchLabel = _ref => {
115
115
  } = _ref;
116
116
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalSwitchLabel, {
117
117
  asChild: true,
118
- forwardCssProp: true,
119
118
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
120
119
  asChild: true,
120
+ consumeCss: true,
121
121
  textStyle: textStyle,
122
122
  ...props,
123
123
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
package/lib/Table.js CHANGED
@@ -75,4 +75,6 @@ const Table = exports.Table = (0, _jsx.styled)(_react.ark.table, {
75
75
  }
76
76
  }
77
77
  }
78
+ }, {
79
+ baseComponent: true
78
80
  });
package/lib/Tabs.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  import { Tabs } from "@ark-ui/react";
9
9
  import { RecipeVariantProps } from "@ndla/styled-system/css";
10
10
  import { JsxStyleProps } from "@ndla/styled-system/types";
11
- declare const tabsRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"content" | "list" | "root" | "indicator" | "trigger", {
11
+ declare const tabsRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"list" | "content" | "root" | "indicator" | "trigger", {
12
12
  variant: {
13
13
  line: {
14
14
  trigger: {
@@ -133,13 +133,13 @@ export type TabsVariantProps = RecipeVariantProps<typeof tabsRecipe>;
133
133
  export type TabsRootProps = Tabs.RootProps & TabsVariantProps & JsxStyleProps;
134
134
  export declare const TabsRoot: ({ lazyMount, unmountOnExit, ...props }: TabsRootProps) => import("react/jsx-runtime").JSX.Element;
135
135
  export declare const TabsContent: import("react").ForwardRefExoticComponent<Tabs.ContentProps & {
136
- forwardCssProp?: boolean | undefined;
136
+ consumeCss?: boolean | undefined;
137
137
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
138
138
  export declare const TabsIndicator: import("react").ForwardRefExoticComponent<Tabs.IndicatorProps & {
139
- forwardCssProp?: boolean | undefined;
139
+ consumeCss?: boolean | undefined;
140
140
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
141
141
  export declare const TabsList: import("react").ForwardRefExoticComponent<Tabs.ListProps & {
142
- forwardCssProp?: boolean | undefined;
142
+ consumeCss?: boolean | undefined;
143
143
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
144
144
  export declare const TabsTrigger: ({ className, ...props }: Tabs.TriggerProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
145
145
  export {};
@@ -10,32 +10,32 @@ import { JsxStyleProps } from "@ndla/styled-system/types";
10
10
  import { TextProps } from "./Text";
11
11
  export type TagsInputRootProps = TagsInput.RootProps & JsxStyleProps;
12
12
  export declare const TagsInputRoot: import("react").ForwardRefExoticComponent<TagsInput.RootProps & {
13
- forwardCssProp?: boolean | undefined;
13
+ consumeCss?: boolean | undefined;
14
14
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
15
15
  export declare const TagsInputClearTrigger: import("react").ForwardRefExoticComponent<TagsInput.ClearTriggerProps & {
16
- forwardCssProp?: boolean | undefined;
16
+ consumeCss?: boolean | undefined;
17
17
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
18
18
  export declare const TagsInputControl: import("react").ForwardRefExoticComponent<TagsInput.ControlProps & {
19
- forwardCssProp?: boolean | undefined;
19
+ consumeCss?: boolean | undefined;
20
20
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
21
21
  export declare const TagsInputInput: import("react").ForwardRefExoticComponent<TagsInput.InputProps & {
22
- forwardCssProp?: boolean | undefined;
22
+ consumeCss?: boolean | undefined;
23
23
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLInputElement>>;
24
24
  export declare const TagsInputItemDeleteTrigger: import("react").ForwardRefExoticComponent<TagsInput.ItemDeleteTriggerProps & {
25
- forwardCssProp?: boolean | undefined;
25
+ consumeCss?: boolean | undefined;
26
26
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
27
27
  export declare const TagsInputItemInput: import("react").ForwardRefExoticComponent<TagsInput.ItemInputProps & {
28
- forwardCssProp?: boolean | undefined;
28
+ consumeCss?: boolean | undefined;
29
29
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLInputElement>>;
30
30
  export declare const TagsInputItemPreview: import("react").ForwardRefExoticComponent<TagsInput.ItemPreviewProps & {
31
- forwardCssProp?: boolean | undefined;
31
+ consumeCss?: boolean | undefined;
32
32
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
33
33
  export declare const TagsInputItem: import("react").ForwardRefExoticComponent<TagsInput.ItemProps & {
34
- forwardCssProp?: boolean | undefined;
34
+ consumeCss?: boolean | undefined;
35
35
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
36
36
  export declare const TagsInputItemText: import("react").ForwardRefExoticComponent<TagsInput.ItemTextProps & {
37
- forwardCssProp?: boolean | undefined;
37
+ consumeCss?: boolean | undefined;
38
38
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLSpanElement>>;
39
39
  export declare const TagsInputLabel: import("react").ForwardRefExoticComponent<TagsInput.LabelProps & {
40
- forwardCssProp?: boolean | undefined;
40
+ consumeCss?: boolean | undefined;
41
41
  } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLLabelElement>>;
package/lib/TagsInput.js CHANGED
@@ -117,7 +117,6 @@ const TagsInputLabel = exports.TagsInputLabel = /*#__PURE__*/(0, _react.forwardR
117
117
  } = _ref;
118
118
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalTagsInputLabel, {
119
119
  asChild: true,
120
- forwardCssProp: true,
121
120
  ref: ref,
122
121
  ...props,
123
122
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
package/lib/Text.d.ts CHANGED
@@ -14,8 +14,8 @@ export interface TextProps {
14
14
  srOnly?: boolean;
15
15
  }
16
16
  export declare const Text: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
17
- forwardCssProp?: boolean | undefined;
17
+ consumeCss?: boolean | undefined;
18
18
  } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLParagraphElement>>;
19
19
  export declare const Heading: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
20
- forwardCssProp?: boolean | undefined;
20
+ consumeCss?: boolean | undefined;
21
21
  } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLHeadingElement>>;
package/lib/Text.js CHANGED
@@ -17,7 +17,9 @@ var _jsxRuntime = require("react/jsx-runtime");
17
17
  *
18
18
  */
19
19
 
20
- const StyledP = (0, _jsx2.styled)(_react2.ark.p);
20
+ const StyledP = (0, _jsx2.styled)(_react2.ark.p, {}, {
21
+ baseComponent: true
22
+ });
21
23
  const Text = exports.Text = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
22
24
  let {
23
25
  textStyle = "body.medium",
@@ -38,7 +40,9 @@ const Text = exports.Text = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
38
40
  ...rest
39
41
  });
40
42
  });
41
- const StyledH1 = (0, _jsx2.styled)(_react2.ark.h1);
43
+ const StyledH1 = (0, _jsx2.styled)(_react2.ark.h1, {}, {
44
+ baseComponent: true
45
+ });
42
46
  const Heading = exports.Heading = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
43
47
  let {
44
48
  textStyle = "heading.medium",
package/lib/Toast.d.ts CHANGED
@@ -12,10 +12,10 @@ export interface ToastRootProps extends Toast.RootProps, JsxStyleProps {
12
12
  }
13
13
  export declare const ToastRoot: import("react").ForwardRefExoticComponent<ToastRootProps & import("react").RefAttributes<HTMLDivElement>>;
14
14
  export declare const ToastActionTrigger: import("react").ForwardRefExoticComponent<{
15
- forwardCssProp?: boolean | undefined;
15
+ consumeCss?: boolean | undefined;
16
16
  } & import("@ndla/styled-system/types").WithCss & Toast.ActionTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
17
17
  export declare const ToastCloseTrigger: import("react").ForwardRefExoticComponent<{
18
- forwardCssProp?: boolean | undefined;
18
+ consumeCss?: boolean | undefined;
19
19
  } & import("@ndla/styled-system/types").WithCss & Toast.CloseTriggerProps & import("react").RefAttributes<HTMLDivElement>>;
20
20
  export declare const ToastDescription: ({ textStyle, children, ...props }: Toast.DescriptionProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
21
21
  export declare const ToastTitle: ({ textStyle, fontWeight, children, ...props }: JsxStyleProps & Toast.TitleProps & TextProps) => import("react/jsx-runtime").JSX.Element;
package/lib/Toast.js CHANGED
@@ -62,9 +62,9 @@ const ToastDescription = _ref => {
62
62
  } = _ref;
63
63
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalToastDescription, {
64
64
  asChild: true,
65
- forwardCssProp: true,
66
65
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
67
66
  asChild: true,
67
+ consumeCss: true,
68
68
  textStyle: textStyle,
69
69
  ...props,
70
70
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -84,9 +84,9 @@ const ToastTitle = _ref2 => {
84
84
  } = _ref2;
85
85
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalToastTitle, {
86
86
  asChild: true,
87
- forwardCssProp: true,
88
87
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
89
88
  asChild: true,
89
+ consumeCss: true,
90
90
  fontWeight: fontWeight,
91
91
  textStyle: textStyle,
92
92
  ...props,
package/lib/Tooltip.d.ts CHANGED
@@ -9,20 +9,20 @@ import { Tooltip } from "@ark-ui/react";
9
9
  export type TooltipRootProps = Tooltip.RootProps;
10
10
  export declare const TooltipRoot: (props: Tooltip.RootProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export declare const TooltipArrow: import("react").ForwardRefExoticComponent<{
12
- forwardCssProp?: boolean | undefined;
12
+ consumeCss?: boolean | undefined;
13
13
  } & import("@ndla/styled-system/types").WithCss & Tooltip.ArrowProps & import("react").RefAttributes<HTMLDivElement>>;
14
14
  export declare const TooltipArrowTip: import("react").ForwardRefExoticComponent<{
15
- forwardCssProp?: boolean | undefined;
15
+ consumeCss?: boolean | undefined;
16
16
  } & import("@ndla/styled-system/types").WithCss & Tooltip.ArrowTipProps & import("react").RefAttributes<HTMLDivElement>>;
17
17
  export declare const TooltipContentStandalone: import("react").ForwardRefExoticComponent<{
18
- forwardCssProp?: boolean | undefined;
18
+ consumeCss?: boolean | undefined;
19
19
  } & import("@ndla/styled-system/types").WithCss & Tooltip.ContentProps & import("react").RefAttributes<HTMLDivElement>>;
20
20
  export declare const TooltipContent: import("react").ForwardRefExoticComponent<{
21
- forwardCssProp?: boolean | undefined;
21
+ consumeCss?: boolean | undefined;
22
22
  } & import("@ndla/styled-system/types").WithCss & Tooltip.ContentProps & import("react").RefAttributes<HTMLDivElement>>;
23
23
  export declare const TooltipPositioner: import("react").ForwardRefExoticComponent<{
24
- forwardCssProp?: boolean | undefined;
24
+ consumeCss?: boolean | undefined;
25
25
  } & import("@ndla/styled-system/types").WithCss & Tooltip.PositionerProps & import("react").RefAttributes<HTMLDivElement>>;
26
26
  export declare const TooltipTrigger: import("react").ForwardRefExoticComponent<{
27
- forwardCssProp?: boolean | undefined;
27
+ consumeCss?: boolean | undefined;
28
28
  } & import("@ndla/styled-system/types").WithCss & Tooltip.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -17,13 +17,13 @@ type Slot<R extends Recipe> = keyof ReturnType<R>;
17
17
  /**
18
18
  * A utility for creating a style context for a recipe, allowing one to change the styles of all parts of a component from the root component. Credit: https://github.com/cschroeter/park-ui/blob/main/website/src/lib/create-style-context.tsx.
19
19
  */
20
+ interface BaseStyleContextProps {
21
+ asChild?: boolean;
22
+ consumeCss?: boolean;
23
+ }
20
24
  export declare const createStyleContext: <R extends Recipe>(recipe: R) => {
21
25
  withRootProvider: <P extends {}>(Component: ElementType) => (props: P) => import("react/jsx-runtime").JSX.Element;
22
- withProvider: <T, P_1 extends {
23
- className?: string | undefined;
24
- } & WithCss>(Component: ElementType, slot: Slot<R>) => ForwardRefExoticComponent<PropsWithoutRef<P_1> & RefAttributes<T>>;
25
- withContext: <T_1, P_2 extends {
26
- className?: string | undefined;
27
- } & WithCss>(Component: ElementType, slot: Slot<R>) => ForwardRefExoticComponent<PropsWithoutRef<P_2> & RefAttributes<T_1>>;
26
+ withProvider: <T, P_1 extends BaseStyleContextProps & WithCss>(Component: ElementType, slot: Slot<R>) => ForwardRefExoticComponent<PropsWithoutRef<P_1> & RefAttributes<T>>;
27
+ withContext: <T_1, P_2 extends BaseStyleContextProps & WithCss>(Component: ElementType, slot: Slot<R>) => ForwardRefExoticComponent<PropsWithoutRef<P_2> & RefAttributes<T_1>>;
28
28
  };
29
29
  export {};
@@ -19,6 +19,7 @@ var _jsxRuntime = require("react/jsx-runtime");
19
19
  /**
20
20
  * A utility for creating a style context for a recipe, allowing one to change the styles of all parts of a component from the root component. Credit: https://github.com/cschroeter/park-ui/blob/main/website/src/lib/create-style-context.tsx.
21
21
  */
22
+
22
23
  const createStyleContext = recipe => {
23
24
  const StyleContext = /*#__PURE__*/(0, _react.createContext)(null);
24
25
  const withRootProvider = Component => {
@@ -35,7 +36,10 @@ const createStyleContext = recipe => {
35
36
  return StyledComponent;
36
37
  };
37
38
  const withProvider = (Component, slot) => {
38
- const StyledComponent = (0, _jsx2.styled)(Component);
39
+ const opts = typeof Component === "string" ? undefined : {
40
+ baseComponent: true
41
+ };
42
+ const StyledComponent = (0, _jsx2.styled)(Component, {}, opts);
39
43
  return /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
40
44
  let {
41
45
  css: cssProp,
@@ -54,7 +58,10 @@ const createStyleContext = recipe => {
54
58
  });
55
59
  };
56
60
  const withContext = (Component, slot) => {
57
- const StyledComponent = (0, _jsx2.styled)(Component);
61
+ const opts = typeof Component === "string" ? undefined : {
62
+ baseComponent: true
63
+ };
64
+ const StyledComponent = (0, _jsx2.styled)(Component, {}, opts);
58
65
  return /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
59
66
  let {
60
67
  css: cssProp,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ndla/primitives",
3
- "version": "0.0.12",
4
- "description": "Primitive components for NDLA",
3
+ "version": "0.0.13",
4
+ "description": "Primitive components for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -29,11 +29,11 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@ark-ui/react": "^3.5.0",
32
- "@ndla/styled-system": "^0.0.2",
32
+ "@ndla/styled-system": "^0.0.4",
33
33
  "@ndla/util": "^4.1.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ndla/preset-panda": "^0.0.6",
36
+ "@ndla/preset-panda": "^0.0.8-alpha.0",
37
37
  "@pandacss/dev": "^0.41.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "cd39d6776c53f6ac8c00a723b25c96f28cf465c0"
46
+ "gitHead": "937b25e89d29636e8709a6ce7d1189a7b57c34d5"
47
47
  }
package/es/Icon.js DELETED
@@ -1,74 +0,0 @@
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 { cva, css } from "@ndla/styled-system/css";
10
- import { styled } from "@ndla/styled-system/jsx";
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- export const iconRecipe = cva({
13
- base: {
14
- display: "inline-block",
15
- fill: "currentcolor",
16
- verticalAlign: "middle",
17
- lineHeight: "1em",
18
- flexShrink: "0"
19
- },
20
- defaultVariants: {
21
- size: "medium"
22
- },
23
- variants: {
24
- size: {
25
- xsmall: {
26
- width: "xsmall",
27
- height: "xsmall"
28
- },
29
- small: {
30
- width: "small",
31
- height: "small"
32
- },
33
- medium: {
34
- width: "medium",
35
- height: "medium"
36
- },
37
- large: {
38
- width: "large",
39
- height: "large"
40
- }
41
- }
42
- }
43
- });
44
- const StyledSvg = styled("svg");
45
-
46
- // TODO: Move this component over to ndla/icons
47
- export const Icon = _ref => {
48
- let {
49
- children,
50
- size,
51
- role,
52
- title,
53
- description,
54
- width,
55
- height,
56
- css: cssProp,
57
- "aria-hidden": ariaHidden = true,
58
- ...props
59
- } = _ref;
60
- return /*#__PURE__*/_jsxs(StyledSvg, {
61
- "data-icon": "",
62
- "aria-hidden": ariaHidden,
63
- preserveAspectRatio: "xMidYMid meet",
64
- css: css.raw(iconRecipe.raw({
65
- size
66
- }), cssProp),
67
- ...props,
68
- children: [title && /*#__PURE__*/_jsx("title", {
69
- children: title
70
- }), description && /*#__PURE__*/_jsx("desc", {
71
- children: description
72
- }), children]
73
- });
74
- };
package/lib/Icon.d.ts DELETED
@@ -1,38 +0,0 @@
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 { ComponentPropsWithRef } from "react";
9
- import { type RecipeVariantProps } from "@ndla/styled-system/css";
10
- import { JsxStyleProps } from "@ndla/styled-system/types";
11
- export declare const iconRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
12
- size: {
13
- xsmall: {
14
- width: "xsmall";
15
- height: "xsmall";
16
- };
17
- small: {
18
- width: "small";
19
- height: "small";
20
- };
21
- medium: {
22
- width: "medium";
23
- height: "medium";
24
- };
25
- large: {
26
- width: "large";
27
- height: "large";
28
- };
29
- };
30
- }>;
31
- export type IconVariantProps = RecipeVariantProps<typeof iconRecipe>;
32
- interface BaseIconProps extends ComponentPropsWithRef<"svg"> {
33
- title?: string;
34
- description?: string;
35
- }
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;
38
- export {};