@ndla/primitives 1.0.16-alpha.0 → 1.0.18-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.
@@ -87,7 +87,7 @@
87
87
  "width]___[value:fit-content",
88
88
  "textStyle]___[value:label.medium",
89
89
  "color]___[value:text.default",
90
- "backgroundColor]___[value:surface.brand.1.subtle",
90
+ "backgroundColor]___[value:surface.brand.1.moderate",
91
91
  "borderColor]___[value:surface.brand.1.strong",
92
92
  "backgroundColor]___[value:surface.brand.2.moderate",
93
93
  "borderColor]___[value:surface.brand.2.strong",
@@ -357,6 +357,7 @@
357
357
  "height]___[value:100%",
358
358
  "borderRadius]___[value:small",
359
359
  "backgroundColor]___[value:surface.default",
360
+ "backgroundColor]___[value:surface.brand.1.subtle",
360
361
  "backgroundColor]___[value:surface.brand.2.subtle",
361
362
  "height]___[value:350px",
362
363
  "zIndex]___[value:hide",
@@ -367,7 +368,6 @@
367
368
  "background]___[value:surface.brand.2",
368
369
  "background]___[value:surface.brand.1",
369
370
  "background]___[value:surface.infoSubtle",
370
- "background]___[value:surface.brand.4",
371
371
  "flexWrap]___[value:wrap",
372
372
  "alignItems]___[value:flex-end",
373
373
  "paddingBlockStart]___[value:xxlarge]___[cond:tablet",
@@ -611,12 +611,16 @@
611
611
  "zIndex]___[value:var(--z-index)",
612
612
  "transitionDuration]___[value:slow",
613
613
  "transitionProperty]___[value:translate, scale, opacity, height",
614
+ "background]___[value:surface.brand.1.moderate",
615
+ "background]___[value:surface.brand.1.strong",
614
616
  "paddingInlineEnd]___[value:xxlarge",
615
617
  "top]___[value:xxsmall",
616
618
  "right]___[value:xxsmall",
617
619
  "--arrow-size]___[value:spacing.xxsmall",
618
620
  "--arrow-background]___[value:colors.surface.action",
619
621
  "height]___[value:200px",
622
+ "gap]___[value:xxlarge",
623
+ "gap]___[value:medium",
620
624
  "transitionDuration]___[value:default",
621
625
  "gridColumnGap]___[value:var(--gutter, 0)",
622
626
  "gridTemplateColumns]___[value:1fr min(var(--size), calc(100% - (var(--gutter, 0) * 2))) 1fr",
package/dist/styles.css CHANGED
@@ -641,10 +641,6 @@
641
641
  background: var(--colors-surface-info-subtle);
642
642
  }
643
643
 
644
- .bg_surface\.brand\.4 {
645
- background: var(--colors-surface-brand-4);
646
- }
647
-
648
644
  .ring_1px_solid {
649
645
  outline: 1px solid;
650
646
  }
@@ -897,6 +893,14 @@
897
893
  z-index: var(--z-index);
898
894
  }
899
895
 
896
+ .bg_surface\.brand\.1\.moderate {
897
+ background: var(--colors-surface-brand-1-moderate);
898
+ }
899
+
900
+ .bg_surface\.brand\.1\.strong {
901
+ background: var(--colors-surface-brand-1-strong);
902
+ }
903
+
900
904
  .pe_xxlarge {
901
905
  padding-inline-end: var(--spacing-xxlarge);
902
906
  }
@@ -913,6 +917,14 @@
913
917
  height: 200px;
914
918
  }
915
919
 
920
+ .gap_xxlarge {
921
+ gap: var(--spacing-xxlarge);
922
+ }
923
+
924
+ .gap_medium {
925
+ gap: var(--spacing-medium);
926
+ }
927
+
916
928
  .\--size_sizes\.surface\.contentMax {
917
929
  --size: var(--sizes-surface-content-max);
918
930
  }
@@ -1063,8 +1075,8 @@
1063
1075
  border-color: var(--colors-stroke-default);
1064
1076
  }
1065
1077
 
1066
- .bg-c_surface\.brand\.1\.subtle {
1067
- background-color: var(--colors-surface-brand-1-subtle);
1078
+ .bg-c_surface\.brand\.1\.moderate {
1079
+ background-color: var(--colors-surface-brand-1-moderate);
1068
1080
  }
1069
1081
 
1070
1082
  .bd-c_surface\.brand\.1\.strong {
@@ -1176,6 +1188,10 @@
1176
1188
  background-color: var(--colors-surface-default);
1177
1189
  }
1178
1190
 
1191
+ .bg-c_surface\.brand\.1\.subtle {
1192
+ background-color: var(--colors-surface-brand-1-subtle);
1193
+ }
1194
+
1179
1195
  .bg-c_surface\.brand\.2\.subtle {
1180
1196
  background-color: var(--colors-surface-brand-2-subtle);
1181
1197
  }
package/es/Badge.js CHANGED
@@ -26,7 +26,7 @@ const badgeRecipe = cva({
26
26
  variants: {
27
27
  colorTheme: {
28
28
  brand1: {
29
- backgroundColor: "surface.brand.1.subtle",
29
+ backgroundColor: "surface.brand.1.moderate",
30
30
  borderColor: "surface.brand.1.strong"
31
31
  },
32
32
  brand2: {
@@ -0,0 +1,80 @@
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 { forwardRef } from "react";
10
+ import { ark } from "@ark-ui/react";
11
+ import { sva } from "@ndla/styled-system/css";
12
+ import { createStyleContext } from "../createStyleContext";
13
+ import { Heading, Text } from "../Text";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ const errorMessageRecipe = sva({
16
+ slots: ["root", "content", "actions", "title", "description"],
17
+ base: {
18
+ root: {
19
+ display: "flex",
20
+ flexDirection: "column",
21
+ gap: "xxlarge",
22
+ alignItems: "center"
23
+ },
24
+ content: {
25
+ display: "flex",
26
+ flexDirection: "column",
27
+ gap: "medium",
28
+ alignItems: "center"
29
+ },
30
+ actions: {
31
+ display: "flex",
32
+ flexDirection: "column",
33
+ gap: "xsmall",
34
+ alignItems: "center"
35
+ },
36
+ title: {
37
+ textAlign: "center"
38
+ },
39
+ description: {
40
+ textAlign: "center"
41
+ }
42
+ }
43
+ });
44
+ const {
45
+ withProvider,
46
+ withContext
47
+ } = createStyleContext(errorMessageRecipe);
48
+ export const ErrorMessageRoot = withProvider(ark.article, "root", {
49
+ baseComponent: true
50
+ });
51
+ export const ErrorMessageContent = withContext(ark.div, "content", {
52
+ baseComponent: true
53
+ });
54
+ export const ErrorMessageActions = withContext(ark.div, "actions", {
55
+ baseComponent: true
56
+ });
57
+ const InternalErrorMessageTitle = /*#__PURE__*/forwardRef((_ref, ref) => {
58
+ let {
59
+ textStyle = "heading.small",
60
+ ...props
61
+ } = _ref;
62
+ return /*#__PURE__*/_jsx(Heading, {
63
+ textStyle: textStyle,
64
+ ...props,
65
+ ref: ref
66
+ });
67
+ });
68
+ export const ErrorMessageTitle = withContext(InternalErrorMessageTitle, "title");
69
+ const InternalErrorMessageDescription = /*#__PURE__*/forwardRef((_ref2, ref) => {
70
+ let {
71
+ textStyle = "body.xlarge",
72
+ ...props
73
+ } = _ref2;
74
+ return /*#__PURE__*/_jsx(Text, {
75
+ textStyle: textStyle,
76
+ ...props,
77
+ ref: ref
78
+ });
79
+ });
80
+ export const ErrorMessageDescription = withContext(InternalErrorMessageDescription, "description");
package/es/Hero.js CHANGED
@@ -54,7 +54,7 @@ const heroRecipe = sva({
54
54
  color: "text.onAction"
55
55
  }
56
56
  },
57
- brand2Strong: {
57
+ brand2Bold: {
58
58
  background: {
59
59
  background: "surface.brand.2.bold"
60
60
  },
@@ -81,12 +81,6 @@ const heroRecipe = sva({
81
81
  background: {
82
82
  background: "surface.infoSubtle"
83
83
  }
84
- },
85
- brand4: {
86
- background: {
87
- // TODO: This needs a proper color...
88
- background: "surface.brand.4"
89
- }
90
84
  }
91
85
  }
92
86
  }
package/es/Toast.js CHANGED
@@ -16,8 +16,6 @@ const toastRecipe = sva({
16
16
  base: {
17
17
  root: {
18
18
  position: "relative",
19
- background: "surface.action",
20
- color: "text.onAction",
21
19
  borderRadius: "xsmall",
22
20
  boxShadow: "medium",
23
21
  minWidth: "20rem",
@@ -49,6 +47,25 @@ const toastRecipe = sva({
49
47
  description: {
50
48
  paddingInlineEnd: "xxlarge"
51
49
  }
50
+ },
51
+ defaultVariants: {
52
+ variant: "light"
53
+ },
54
+ variants: {
55
+ variant: {
56
+ light: {
57
+ root: {
58
+ background: "surface.brand.1.moderate",
59
+ color: "text.default"
60
+ }
61
+ },
62
+ dark: {
63
+ root: {
64
+ background: "surface.brand.1.strong",
65
+ color: "text.onAction"
66
+ }
67
+ }
68
+ }
52
69
  }
53
70
  });
54
71
  const {
package/lib/Badge.d.ts CHANGED
@@ -11,7 +11,7 @@ import { JsxStyleProps } from "@ndla/styled-system/types";
11
11
  declare const badgeRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
12
12
  colorTheme: {
13
13
  brand1: {
14
- backgroundColor: "surface.brand.1.subtle";
14
+ backgroundColor: "surface.brand.1.moderate";
15
15
  borderColor: "surface.brand.1.strong";
16
16
  };
17
17
  brand2: {
package/lib/Badge.js CHANGED
@@ -32,7 +32,7 @@ const badgeRecipe = (0, _css.cva)({
32
32
  variants: {
33
33
  colorTheme: {
34
34
  brand1: {
35
- backgroundColor: "surface.brand.1.subtle",
35
+ backgroundColor: "surface.brand.1.moderate",
36
36
  borderColor: "surface.brand.1.strong"
37
37
  },
38
38
  brand2: {
@@ -0,0 +1,23 @@
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 { TextProps } from "../Text";
9
+ export declare const ErrorMessageRoot: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
10
+ consumeCss?: boolean | undefined;
11
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLElement>>;
12
+ export declare const ErrorMessageContent: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
13
+ consumeCss?: boolean | undefined;
14
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
15
+ export declare const ErrorMessageActions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
16
+ consumeCss?: boolean | undefined;
17
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
18
+ export declare const ErrorMessageTitle: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
19
+ consumeCss?: boolean | undefined;
20
+ } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLHeadingElement>>;
21
+ export declare const ErrorMessageDescription: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
22
+ consumeCss?: boolean | undefined;
23
+ } & import("@ndla/styled-system/types").WithCss & TextProps & import("react").RefAttributes<HTMLParagraphElement>>;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ErrorMessageTitle = exports.ErrorMessageRoot = exports.ErrorMessageDescription = exports.ErrorMessageContent = exports.ErrorMessageActions = void 0;
7
+ var _react = require("react");
8
+ var _react2 = require("@ark-ui/react");
9
+ var _css = require("@ndla/styled-system/css");
10
+ var _createStyleContext = require("../createStyleContext");
11
+ var _Text = require("../Text");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ /**
14
+ * Copyright (c) 2024-present, NDLA.
15
+ *
16
+ * This source code is licensed under the GPLv3 license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ *
19
+ */
20
+
21
+ const errorMessageRecipe = (0, _css.sva)({
22
+ slots: ["root", "content", "actions", "title", "description"],
23
+ base: {
24
+ root: {
25
+ display: "flex",
26
+ flexDirection: "column",
27
+ gap: "xxlarge",
28
+ alignItems: "center"
29
+ },
30
+ content: {
31
+ display: "flex",
32
+ flexDirection: "column",
33
+ gap: "medium",
34
+ alignItems: "center"
35
+ },
36
+ actions: {
37
+ display: "flex",
38
+ flexDirection: "column",
39
+ gap: "xsmall",
40
+ alignItems: "center"
41
+ },
42
+ title: {
43
+ textAlign: "center"
44
+ },
45
+ description: {
46
+ textAlign: "center"
47
+ }
48
+ }
49
+ });
50
+ const {
51
+ withProvider,
52
+ withContext
53
+ } = (0, _createStyleContext.createStyleContext)(errorMessageRecipe);
54
+ const ErrorMessageRoot = exports.ErrorMessageRoot = withProvider(_react2.ark.article, "root", {
55
+ baseComponent: true
56
+ });
57
+ const ErrorMessageContent = exports.ErrorMessageContent = withContext(_react2.ark.div, "content", {
58
+ baseComponent: true
59
+ });
60
+ const ErrorMessageActions = exports.ErrorMessageActions = withContext(_react2.ark.div, "actions", {
61
+ baseComponent: true
62
+ });
63
+ const InternalErrorMessageTitle = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
64
+ let {
65
+ textStyle = "heading.small",
66
+ ...props
67
+ } = _ref;
68
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Heading, {
69
+ textStyle: textStyle,
70
+ ...props,
71
+ ref: ref
72
+ });
73
+ });
74
+ const ErrorMessageTitle = exports.ErrorMessageTitle = withContext(InternalErrorMessageTitle, "title");
75
+ const InternalErrorMessageDescription = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
76
+ let {
77
+ textStyle = "body.xlarge",
78
+ ...props
79
+ } = _ref2;
80
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
81
+ textStyle: textStyle,
82
+ ...props,
83
+ ref: ref
84
+ });
85
+ });
86
+ const ErrorMessageDescription = exports.ErrorMessageDescription = withContext(InternalErrorMessageDescription, "description");
package/lib/Hero.d.ts CHANGED
@@ -25,7 +25,7 @@ declare const heroRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeF
25
25
  color: "text.onAction";
26
26
  };
27
27
  };
28
- brand2Strong: {
28
+ brand2Bold: {
29
29
  background: {
30
30
  background: "surface.brand.2.bold";
31
31
  };
@@ -53,11 +53,6 @@ declare const heroRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeF
53
53
  background: "surface.infoSubtle";
54
54
  };
55
55
  };
56
- brand4: {
57
- background: {
58
- background: "surface.brand.4";
59
- };
60
- };
61
56
  };
62
57
  }>;
63
58
  export type HeroVariantProps = RecipeVariantProps<typeof heroRecipe>;
@@ -67,7 +62,7 @@ export declare const Hero: import("react").ForwardRefExoticComponent<Omit<import
67
62
  consumeCss?: boolean | undefined;
68
63
  } & import("@ndla/styled-system/types").WithCss & {
69
64
  absolute?: boolean | undefined;
70
- variant?: "primary" | "neutral" | "brand1" | "brand2" | "brand2Strong" | "brand1Subtle" | "brand4" | undefined;
65
+ variant?: "primary" | "neutral" | "brand1" | "brand2" | "brand2Bold" | "brand1Subtle" | undefined;
71
66
  } & import("react").RefAttributes<HTMLDivElement>>;
72
67
  export type HeroBackgroundProps = HTMLArkProps<"div"> & JsxStyleProps;
73
68
  export declare const HeroBackground: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
package/lib/Hero.js CHANGED
@@ -60,7 +60,7 @@ const heroRecipe = (0, _css.sva)({
60
60
  color: "text.onAction"
61
61
  }
62
62
  },
63
- brand2Strong: {
63
+ brand2Bold: {
64
64
  background: {
65
65
  background: "surface.brand.2.bold"
66
66
  },
@@ -87,12 +87,6 @@ const heroRecipe = (0, _css.sva)({
87
87
  background: {
88
88
  background: "surface.infoSubtle"
89
89
  }
90
- },
91
- brand4: {
92
- background: {
93
- // TODO: This needs a proper color...
94
- background: "surface.brand.4"
95
- }
96
90
  }
97
91
  }
98
92
  }
package/lib/Toast.d.ts CHANGED
@@ -6,9 +6,26 @@
6
6
  *
7
7
  */
8
8
  import { Toast } from "@ark-ui/react";
9
- import { JsxStyleProps } from "@ndla/styled-system/types";
9
+ import { JsxStyleProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  import { TextProps } from "./Text";
11
- export interface ToastRootProps extends Toast.RootProps, JsxStyleProps {
11
+ declare const toastRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"title" | "description" | "group" | "root" | "closeTrigger" | "actionTrigger", {
12
+ variant: {
13
+ light: {
14
+ root: {
15
+ background: "surface.brand.1.moderate";
16
+ color: "text.default";
17
+ };
18
+ };
19
+ dark: {
20
+ root: {
21
+ background: "surface.brand.1.strong";
22
+ color: "text.onAction";
23
+ };
24
+ };
25
+ };
26
+ }>;
27
+ export type ToastRootVariantProps = NonNullable<RecipeVariantProps<typeof toastRecipe>>;
28
+ export interface ToastRootProps extends Toast.RootProps, JsxStyleProps, ToastRootVariantProps {
12
29
  }
13
30
  export declare const ToastRoot: import("react").ForwardRefExoticComponent<ToastRootProps & import("react").RefAttributes<HTMLDivElement>>;
14
31
  export declare const ToastActionTrigger: import("react").ForwardRefExoticComponent<{
@@ -19,3 +36,4 @@ export declare const ToastCloseTrigger: import("react").ForwardRefExoticComponen
19
36
  } & import("@ndla/styled-system/types").WithCss & Toast.CloseTriggerProps & import("react").RefAttributes<HTMLDivElement>>;
20
37
  export declare const ToastDescription: ({ textStyle, children, ...props }: Toast.DescriptionProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
21
38
  export declare const ToastTitle: ({ textStyle, fontWeight, children, ...props }: JsxStyleProps & Toast.TitleProps & TextProps) => import("react/jsx-runtime").JSX.Element;
39
+ export {};
package/lib/Toast.js CHANGED
@@ -22,8 +22,6 @@ const toastRecipe = (0, _css.sva)({
22
22
  base: {
23
23
  root: {
24
24
  position: "relative",
25
- background: "surface.action",
26
- color: "text.onAction",
27
25
  borderRadius: "xsmall",
28
26
  boxShadow: "medium",
29
27
  minWidth: "20rem",
@@ -55,6 +53,25 @@ const toastRecipe = (0, _css.sva)({
55
53
  description: {
56
54
  paddingInlineEnd: "xxlarge"
57
55
  }
56
+ },
57
+ defaultVariants: {
58
+ variant: "light"
59
+ },
60
+ variants: {
61
+ variant: {
62
+ light: {
63
+ root: {
64
+ background: "surface.brand.1.moderate",
65
+ color: "text.default"
66
+ }
67
+ },
68
+ dark: {
69
+ root: {
70
+ background: "surface.brand.1.strong",
71
+ color: "text.onAction"
72
+ }
73
+ }
74
+ }
58
75
  }
59
76
  });
60
77
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/primitives",
3
- "version": "1.0.16-alpha.0",
3
+ "version": "1.0.18-alpha.0",
4
4
  "description": "Primitive components for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -29,11 +29,11 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@ark-ui/react": "^3.9.0",
32
- "@ndla/styled-system": "^0.0.14",
32
+ "@ndla/styled-system": "^0.0.16",
33
33
  "@ndla/util": "^4.1.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ndla/preset-panda": "^0.0.22",
36
+ "@ndla/preset-panda": "^0.0.24",
37
37
  "@pandacss/dev": "^0.45.2"
38
38
  },
39
39
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "a8a6f11eab7a7a254fff6fb062289dc413035d81"
46
+ "gitHead": "66b3b382188ec1730fa409d4adb3672942f00670"
47
47
  }