@ndla/primitives 1.0.20-alpha.0 → 1.0.22-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": "0.45.2",
2
+ "schemaVersion": "0.46.0",
3
3
  "styles": {
4
4
  "atomic": [
5
5
  "display]___[value:flex",
package/es/Button.js CHANGED
@@ -171,7 +171,7 @@ export const buttonRecipe = cva({
171
171
  size: {
172
172
  medium: {
173
173
  textStyle: "label.medium",
174
- paddingInline: "medium",
174
+ paddingInline: "small",
175
175
  paddingBlock: "xxsmall",
176
176
  minHeight: "24"
177
177
  },
package/es/Image.js CHANGED
@@ -44,6 +44,19 @@ export const Picture = /*#__PURE__*/forwardRef((_ref, ref) => {
44
44
  }), children]
45
45
  });
46
46
  });
47
+ const StyledImage = styled("img", {
48
+ defaultVariants: {
49
+ variant: "regular"
50
+ },
51
+ variants: {
52
+ variant: {
53
+ regular: {},
54
+ rounded: {
55
+ borderRadius: "xsmall"
56
+ }
57
+ }
58
+ }
59
+ });
47
60
  export const Img = /*#__PURE__*/forwardRef((_ref2, ref) => {
48
61
  let {
49
62
  fallbackWidth = FALLBACK_WIDTH,
@@ -55,7 +68,7 @@ export const Img = /*#__PURE__*/forwardRef((_ref2, ref) => {
55
68
  ...props
56
69
  } = _ref2;
57
70
  const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
58
- return /*#__PURE__*/_jsx(styled.img, {
71
+ return /*#__PURE__*/_jsx(StyledImage, {
59
72
  alt: alt,
60
73
  src: contentType === "image/gif" ? src : `${src}?${queryString}`,
61
74
  ...props,
@@ -83,7 +96,7 @@ export const Image = /*#__PURE__*/forwardRef((_ref3, ref) => {
83
96
  type: contentType,
84
97
  srcSet: srcSet,
85
98
  sizes: sizes
86
- }), /*#__PURE__*/_jsx(styled.img, {
99
+ }), /*#__PURE__*/_jsx(StyledImage, {
87
100
  alt: alt,
88
101
  src: contentType === "image/gif" ? src : fallbackSrc,
89
102
  ...props,
@@ -49,7 +49,6 @@ export const listItemRecipe = sva({
49
49
  maxHeight: "40px",
50
50
  minWidth: "56px",
51
51
  maxWidth: "56px",
52
- borderRadius: "xsmall",
53
52
  objectFit: "cover"
54
53
  }
55
54
  },
@@ -215,4 +214,15 @@ export const ListItemHeading = withContext(InternalListItemHeading, "title");
215
214
  export const ListItemContent = withContext(ark.div, "content", {
216
215
  baseComponent: true
217
216
  });
218
- export const ListItemImage = withContext(Image, "image");
217
+ const InternalListItemImage = withContext(Image, "image");
218
+ export const ListItemImage = /*#__PURE__*/forwardRef((_ref2, ref) => {
219
+ let {
220
+ variant = "rounded",
221
+ ...props
222
+ } = _ref2;
223
+ return /*#__PURE__*/_jsx(InternalListItemImage, {
224
+ variant: variant,
225
+ ...props,
226
+ ref: ref
227
+ });
228
+ });
package/lib/Button.d.ts CHANGED
@@ -120,7 +120,7 @@ export declare const buttonRecipe: import("@ndla/styled-system/types").RecipeRun
120
120
  size: {
121
121
  medium: {
122
122
  textStyle: "label.medium";
123
- paddingInline: "medium";
123
+ paddingInline: "small";
124
124
  paddingBlock: "xxsmall";
125
125
  minHeight: "24";
126
126
  };
package/lib/Button.js CHANGED
@@ -176,7 +176,7 @@ const buttonRecipe = exports.buttonRecipe = (0, _css.cva)({
176
176
  size: {
177
177
  medium: {
178
178
  textStyle: "label.medium",
179
- paddingInline: "medium",
179
+ paddingInline: "small",
180
180
  paddingBlock: "xxsmall",
181
181
  minHeight: "24"
182
182
  },
package/lib/Image.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  import { ComponentPropsWithRef } from "react";
9
- import { JsxStyleProps } from "@ndla/styled-system/types";
9
+ import { JsxStyleProps, StyledVariantProps } from "@ndla/styled-system/types";
10
10
  export interface ImageCrop {
11
11
  startX: number;
12
12
  startY: number;
@@ -28,7 +28,11 @@ export interface PictureProps extends JsxStyleProps, ComponentPropsWithRef<"pict
28
28
  focalPoint?: ImageFocalPoint;
29
29
  }
30
30
  export declare const Picture: import("react").ForwardRefExoticComponent<Omit<PictureProps, "ref"> & import("react").RefAttributes<HTMLPictureElement>>;
31
- export interface ImgProps extends JsxStyleProps, ComponentPropsWithRef<"img"> {
31
+ declare const StyledImage: import("@ndla/styled-system/types").StyledComponent<"img", {
32
+ variant?: "regular" | "rounded" | undefined;
33
+ }>;
34
+ type ImageVariantProps = StyledVariantProps<typeof StyledImage>;
35
+ export interface ImgProps extends JsxStyleProps, ComponentPropsWithRef<"img">, ImageVariantProps {
32
36
  alt: string;
33
37
  src: string;
34
38
  fallbackWidth?: number;
@@ -37,7 +41,7 @@ export interface ImgProps extends JsxStyleProps, ComponentPropsWithRef<"img"> {
37
41
  focalPoint?: ImageFocalPoint;
38
42
  }
39
43
  export declare const Img: import("react").ForwardRefExoticComponent<Omit<ImgProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
40
- export interface ImageProps extends JsxStyleProps, ComponentPropsWithRef<"img"> {
44
+ export interface ImageProps extends JsxStyleProps, ComponentPropsWithRef<"img">, ImageVariantProps {
41
45
  alt: string;
42
46
  src: string;
43
47
  sizes?: string;
@@ -47,3 +51,4 @@ export interface ImageProps extends JsxStyleProps, ComponentPropsWithRef<"img">
47
51
  focalPoint?: ImageFocalPoint;
48
52
  }
49
53
  export declare const Image: import("react").ForwardRefExoticComponent<Omit<ImageProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
54
+ export {};
package/lib/Image.js CHANGED
@@ -52,6 +52,19 @@ const Picture = exports.Picture = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref
52
52
  }), children]
53
53
  });
54
54
  });
55
+ const StyledImage = (0, _jsx2.styled)("img", {
56
+ defaultVariants: {
57
+ variant: "regular"
58
+ },
59
+ variants: {
60
+ variant: {
61
+ regular: {},
62
+ rounded: {
63
+ borderRadius: "xsmall"
64
+ }
65
+ }
66
+ }
67
+ });
55
68
  const Img = exports.Img = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
56
69
  let {
57
70
  fallbackWidth = FALLBACK_WIDTH,
@@ -63,7 +76,7 @@ const Img = exports.Img = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
63
76
  ...props
64
77
  } = _ref2;
65
78
  const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
66
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.img, {
79
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImage, {
67
80
  alt: alt,
68
81
  src: contentType === "image/gif" ? src : `${src}?${queryString}`,
69
82
  ...props,
@@ -91,7 +104,7 @@ const Image = exports.Image = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
91
104
  type: contentType,
92
105
  srcSet: srcSet,
93
106
  sizes: sizes
94
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.img, {
107
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImage, {
95
108
  alt: alt,
96
109
  src: contentType === "image/gif" ? src : fallbackSrc,
97
110
  ...props,
@@ -55,7 +55,6 @@ const listItemRecipe = exports.listItemRecipe = (0, _css.sva)({
55
55
  maxHeight: "40px",
56
56
  minWidth: "56px",
57
57
  maxWidth: "56px",
58
- borderRadius: "xsmall",
59
58
  objectFit: "cover"
60
59
  }
61
60
  },
@@ -221,4 +220,15 @@ const ListItemHeading = exports.ListItemHeading = withContext(InternalListItemHe
221
220
  const ListItemContent = exports.ListItemContent = withContext(_react2.ark.div, "content", {
222
221
  baseComponent: true
223
222
  });
224
- const ListItemImage = exports.ListItemImage = withContext(_Image.Image, "image");
223
+ const InternalListItemImage = withContext(_Image.Image, "image");
224
+ const ListItemImage = exports.ListItemImage = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
225
+ let {
226
+ variant = "rounded",
227
+ ...props
228
+ } = _ref2;
229
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalListItemImage, {
230
+ variant: variant,
231
+ ...props,
232
+ ref: ref
233
+ });
234
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/primitives",
3
- "version": "1.0.20-alpha.0",
3
+ "version": "1.0.22-alpha.0",
4
4
  "description": "Primitive components for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -29,12 +29,12 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@ark-ui/react": "^3.9.0",
32
- "@ndla/styled-system": "^0.0.17",
32
+ "@ndla/styled-system": "^0.0.18",
33
33
  "@ndla/util": "^4.1.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ndla/preset-panda": "^0.0.25",
37
- "@pandacss/dev": "^0.45.2"
36
+ "@ndla/preset-panda": "^0.0.26",
37
+ "@pandacss/dev": "^0.46.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": ">= 18",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "d40977f8ad6f9927572a6a62bf6a397189d0cfa4"
46
+ "gitHead": "7713c89290c9b308be47bce300ad7db4a52a42dd"
47
47
  }