@ndla/ui 56.0.47-alpha.0 → 56.0.49-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.
@@ -224,6 +224,8 @@
224
224
  "width]___[value:5xlarge]___[cond:& svg",
225
225
  "fill]___[value:stroke.default]___[cond:& svg",
226
226
  "marginBlockStart]___[value:3xsmall]___[cond:& > *:not(:first-child)",
227
+ "clear]___[value:both]___[cond:& + [data-embed-wrapper]",
228
+ "clear]___[value:both",
227
229
  "height]___[value:auto]___[cond:& iframe",
228
230
  "width]___[value:100%]___[cond:& iframe",
229
231
  "textStyle]___[value:label.xsmall]___[cond:& a",
@@ -285,7 +287,6 @@
285
287
  "transitionDuration]___[value:slow",
286
288
  "transitionTimingFunction]___[value:ease-in-out",
287
289
  "justifyItems]___[value:center",
288
- "clear]___[value:both",
289
290
  "gridTemplateRows]___[value:1fr]___[cond:_open",
290
291
  "overflow]___[value:visible]___[cond:_closed<___>_print",
291
292
  "maxHeight]___[value:500vh]___[cond:_closed<___>_print",
package/dist/styles.css CHANGED
@@ -489,6 +489,10 @@
489
489
  background: var(--colors-background-subtle);
490
490
  }
491
491
 
492
+ .clear_both {
493
+ clear: both;
494
+ }
495
+
492
496
  .z_docked {
493
497
  z-index: var(--z-index-docked);
494
498
  }
@@ -545,10 +549,6 @@
545
549
  margin-block: var(--spacing-xxlarge);
546
550
  }
547
551
 
548
- .clear_both {
549
- clear: both;
550
- }
551
-
552
552
  .tu-o_2px {
553
553
  text-underline-offset: 2px;
554
554
  }
@@ -986,6 +986,10 @@
986
986
  margin-block-start: var(--spacing-3xsmall);
987
987
  }
988
988
 
989
+ .\[\&_\+_\[data-embed-wrapper\]\]\:clear_both + [data-embed-wrapper] {
990
+ clear: both;
991
+ }
992
+
989
993
  .\[\&_iframe\]\:h_auto iframe {
990
994
  height: auto;
991
995
  }
@@ -8,17 +8,44 @@
8
8
 
9
9
  import { forwardRef } from "react";
10
10
  import { ark } from "@ark-ui/react";
11
+ import { css, cva } from "@ndla/styled-system/css";
11
12
  import { styled } from "@ndla/styled-system/jsx";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
- const StyledEmbedWrapper = styled(ark.div, {
14
+ const embedWrapperRecipe = cva({
14
15
  base: {
15
16
  position: "relative"
17
+ },
18
+ defaultVariants: {
19
+ noClear: false
20
+ },
21
+ variants: {
22
+ noClear: {
23
+ true: {
24
+ "& + [data-embed-wrapper]": {
25
+ clear: "both"
26
+ }
27
+ },
28
+ false: {
29
+ clear: "both"
30
+ }
31
+ }
16
32
  }
17
- }, {
33
+ });
34
+ const StyledEmbedWrapper = styled(ark.div, {}, {
18
35
  baseComponent: true
19
36
  });
20
- export const EmbedWrapper = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(StyledEmbedWrapper, {
21
- "data-embed-wrapper": "",
22
- ...props,
23
- ref: ref
24
- }));
37
+ export const EmbedWrapper = /*#__PURE__*/forwardRef((_ref, ref) => {
38
+ let {
39
+ noClear,
40
+ css: cssProp,
41
+ ...props
42
+ } = _ref;
43
+ return /*#__PURE__*/_jsx(StyledEmbedWrapper, {
44
+ css: css.raw(embedWrapperRecipe.raw({
45
+ noClear
46
+ }), cssProp),
47
+ "data-embed-wrapper": "",
48
+ ...props,
49
+ ref: ref
50
+ });
51
+ });
@@ -6,6 +6,25 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- export declare const EmbedWrapper: import("react").ForwardRefExoticComponent<Omit<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
+ import { type HTMLArkProps } from "@ark-ui/react";
10
+ import { JsxStyleProps, RecipeVariantProps } from "@ndla/styled-system/types";
11
+ declare const embedWrapperRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
12
+ noClear: {
13
+ true: {
14
+ "& + [data-embed-wrapper]": {
15
+ clear: "both";
16
+ };
17
+ };
18
+ false: {
19
+ clear: "both";
20
+ };
21
+ };
22
+ }>;
23
+ export type EmbedWrapperVariantProps = RecipeVariantProps<typeof embedWrapperRecipe>;
24
+ export type EmbedWrapperProps = HTMLArkProps<"div"> & JsxStyleProps & EmbedWrapperVariantProps;
25
+ export declare const EmbedWrapper: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
26
+ consumeCss?: boolean | undefined;
27
+ } & import("@ndla/styled-system/types").WithCss & {
28
+ noClear?: boolean | undefined;
29
+ } & import("react").RefAttributes<HTMLDivElement>>;
30
+ export {};
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.EmbedWrapper = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@ark-ui/react");
9
+ var _css = require("@ndla/styled-system/css");
9
10
  var _jsx2 = require("@ndla/styled-system/jsx");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  /**
@@ -16,15 +17,41 @@ var _jsxRuntime = require("react/jsx-runtime");
16
17
  *
17
18
  */
18
19
 
19
- const StyledEmbedWrapper = (0, _jsx2.styled)(_react2.ark.div, {
20
+ const embedWrapperRecipe = (0, _css.cva)({
20
21
  base: {
21
22
  position: "relative"
23
+ },
24
+ defaultVariants: {
25
+ noClear: false
26
+ },
27
+ variants: {
28
+ noClear: {
29
+ true: {
30
+ "& + [data-embed-wrapper]": {
31
+ clear: "both"
32
+ }
33
+ },
34
+ false: {
35
+ clear: "both"
36
+ }
37
+ }
22
38
  }
23
- }, {
39
+ });
40
+ const StyledEmbedWrapper = (0, _jsx2.styled)(_react2.ark.div, {}, {
24
41
  baseComponent: true
25
42
  });
26
- const EmbedWrapper = exports.EmbedWrapper = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledEmbedWrapper, {
27
- "data-embed-wrapper": "",
28
- ...props,
29
- ref: ref
30
- }));
43
+ const EmbedWrapper = exports.EmbedWrapper = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
44
+ let {
45
+ noClear,
46
+ css: cssProp,
47
+ ...props
48
+ } = _ref;
49
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledEmbedWrapper, {
50
+ css: _css.css.raw(embedWrapperRecipe.raw({
51
+ noClear
52
+ }), cssProp),
53
+ "data-embed-wrapper": "",
54
+ ...props,
55
+ ref: ref
56
+ });
57
+ });
@@ -23,3 +23,4 @@ export { default as CopyrightEmbed } from "./CopyrightEmbed";
23
23
  export { default as CodeEmbed } from "./CodeEmbed";
24
24
  export type { HeartButtonType, CanonicalUrlFuncs, RenderContext } from "./types";
25
25
  export { EmbedWrapper } from "./EmbedWrapper";
26
+ export type { EmbedWrapperVariantProps, EmbedWrapperProps } from "./EmbedWrapper";
package/lib/index.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  export { Concept } from "./Concept/Concept";
9
9
  export { ImageEmbed, getCrop, getFocalPoint, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, CopyrightEmbed, CodeEmbed, InlineTriggerButton, EmbedWrapper, } from "./Embed";
10
+ export type { EmbedWrapperProps, EmbedWrapperVariantProps } from "./Embed";
10
11
  export { LicenseLink, EmbedByline } from "./LicenseByline";
11
12
  export { ArticleByline, ArticleBylineAccordionItem, ArticleFootNotes, ArticleWrapper, Article, ArticleFooter, ArticleHeader, ArticleContent, ArticleHGroup, ArticleTitle, } from "./Article";
12
13
  export { getPossiblyRelativeUrl } from "./utils/relativeUrl";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.47-alpha.0",
3
+ "version": "56.0.49-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -35,8 +35,8 @@
35
35
  "@ndla/core": "^5.0.2",
36
36
  "@ndla/icons": "^8.0.29-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.42-alpha.0",
39
- "@ndla/safelink": "^7.0.42-alpha.0",
38
+ "@ndla/primitives": "^1.0.43-alpha.0",
39
+ "@ndla/safelink": "^7.0.43-alpha.0",
40
40
  "@ndla/styled-system": "^0.0.23",
41
41
  "@ndla/util": "^5.0.0-alpha.0",
42
42
  "html-react-parser": "^5.1.8",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "6624b001872035e31fccb09592e57dcc5facc8a0"
61
+ "gitHead": "9ca9ed7bc019cd83efb458401a63f5523dde325a"
62
62
  }
@@ -6,20 +6,46 @@
6
6
  *
7
7
  */
8
8
 
9
- import { ComponentPropsWithRef, forwardRef } from "react";
10
- import { ark } from "@ark-ui/react";
9
+ import { forwardRef } from "react";
10
+ import { ark, type HTMLArkProps } from "@ark-ui/react";
11
+ import { css, cva } from "@ndla/styled-system/css";
11
12
  import { styled } from "@ndla/styled-system/jsx";
13
+ import { JsxStyleProps, RecipeVariantProps } from "@ndla/styled-system/types";
12
14
 
13
- const StyledEmbedWrapper = styled(
14
- ark.div,
15
- {
16
- base: {
17
- position: "relative",
15
+ const embedWrapperRecipe = cva({
16
+ base: {
17
+ position: "relative",
18
+ },
19
+ defaultVariants: {
20
+ noClear: false,
21
+ },
22
+ variants: {
23
+ noClear: {
24
+ true: {
25
+ "& + [data-embed-wrapper]": {
26
+ clear: "both",
27
+ },
28
+ },
29
+ false: {
30
+ clear: "both",
31
+ },
18
32
  },
19
33
  },
20
- { baseComponent: true },
21
- );
34
+ });
35
+
36
+ export type EmbedWrapperVariantProps = RecipeVariantProps<typeof embedWrapperRecipe>;
22
37
 
23
- export const EmbedWrapper = forwardRef<HTMLDivElement, ComponentPropsWithRef<"div">>((props, ref) => (
24
- <StyledEmbedWrapper data-embed-wrapper="" {...props} ref={ref} />
25
- ));
38
+ export type EmbedWrapperProps = HTMLArkProps<"div"> & JsxStyleProps & EmbedWrapperVariantProps;
39
+
40
+ const StyledEmbedWrapper = styled(ark.div, {}, { baseComponent: true });
41
+
42
+ export const EmbedWrapper = forwardRef<HTMLDivElement, EmbedWrapperProps>(
43
+ ({ noClear, css: cssProp, ...props }, ref) => (
44
+ <StyledEmbedWrapper
45
+ css={css.raw(embedWrapperRecipe.raw({ noClear }), cssProp)}
46
+ data-embed-wrapper=""
47
+ {...props}
48
+ ref={ref}
49
+ />
50
+ ),
51
+ );
@@ -24,3 +24,4 @@ export { default as CopyrightEmbed } from "./CopyrightEmbed";
24
24
  export { default as CodeEmbed } from "./CodeEmbed";
25
25
  export type { HeartButtonType, CanonicalUrlFuncs, RenderContext } from "./types";
26
26
  export { EmbedWrapper } from "./EmbedWrapper";
27
+ export type { EmbedWrapperVariantProps, EmbedWrapperProps } from "./EmbedWrapper";
package/src/index.ts CHANGED
@@ -34,6 +34,8 @@ export {
34
34
  EmbedWrapper,
35
35
  } from "./Embed";
36
36
 
37
+ export type { EmbedWrapperProps, EmbedWrapperVariantProps } from "./Embed";
38
+
37
39
  export { LicenseLink, EmbedByline } from "./LicenseByline";
38
40
 
39
41
  export {