@telia/teddy 0.4.2 → 0.4.4

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.
@@ -8,24 +8,26 @@ const components_flex_flex = require("../flex/flex.cjs");
8
8
  const components_text_text = require("../text/text.cjs");
9
9
  const tokens_color_variables = require("../../tokens/color/variables.cjs");
10
10
  const Price = React.forwardRef(
11
- ({ className, pricePrefix, priceText, variant = "default", textAbovePrice, textBelowPrice }, forwardRef) => {
11
+ ({ className, pricePrefix, priceSuffix, priceText, variant = "default", textAbovePrice, textBelowPrice }, forwardRef) => {
12
12
  const rootColorDotsClass = `${components_card_card.rootClassName}__price`;
13
13
  const classes = clsx([components_card_card.styles[rootColorDotsClass]], className);
14
14
  return /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexGrow: "1", mt: "auto", mb: "100", ref: forwardRef, className: classes, direction: "column", gap: "10", children: [
15
15
  textAbovePrice ? /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "additional-100", as: "p", faded: true, children: textAbovePrice }) : null,
16
16
  /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { direction: "row", align: "baseline", flexGrow: "1", wrap: "nowrap", children: [
17
- /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "paragraph-200", as: "p", faded: true, children: pricePrefix ? `${pricePrefix} ` : null }),
17
+ pricePrefix && /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "paragraph-200", as: "p", faded: true, children: pricePrefix }),
18
18
  /* @__PURE__ */ jsxRuntime.jsx(
19
19
  components_text_text.Text,
20
20
  {
21
21
  variant: "paragraph-100-bold",
22
22
  as: "span",
23
23
  ml: "100",
24
+ mr: "100",
24
25
  color: variant === "purple" ? tokens_color_variables.teddyColorBrandCorePurple : void 0,
25
26
  className: components_card_card.styles[`${rootColorDotsClass}--big`],
26
27
  children: priceText
27
28
  }
28
- )
29
+ ),
30
+ priceSuffix && /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "paragraph-200", as: "p", faded: true, children: priceSuffix })
29
31
  ] }),
30
32
  textBelowPrice ? /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "additional-100", as: "p", faded: true, children: textBelowPrice }) : null
31
33
  ] });
@@ -5,6 +5,7 @@ export type PriceProps = {
5
5
  textAbovePrice?: string;
6
6
  textBelowPrice?: string;
7
7
  pricePrefix?: string;
8
+ priceSuffix?: string;
8
9
  priceText: string;
9
10
  className?: string;
10
11
  };
@@ -6,24 +6,26 @@ import { Flex } from "../flex/flex.js";
6
6
  import { Text } from "../text/text.js";
7
7
  import { teddyColorBrandCorePurple } from "../../tokens/color/variables.js";
8
8
  const Price = React__default.forwardRef(
9
- ({ className, pricePrefix, priceText, variant = "default", textAbovePrice, textBelowPrice }, forwardRef) => {
9
+ ({ className, pricePrefix, priceSuffix, priceText, variant = "default", textAbovePrice, textBelowPrice }, forwardRef) => {
10
10
  const rootColorDotsClass = `${rootClassName}__price`;
11
11
  const classes = clsx([styles[rootColorDotsClass]], className);
12
12
  return /* @__PURE__ */ jsxs(Flex, { flexGrow: "1", mt: "auto", mb: "100", ref: forwardRef, className: classes, direction: "column", gap: "10", children: [
13
13
  textAbovePrice ? /* @__PURE__ */ jsx(Text, { variant: "additional-100", as: "p", faded: true, children: textAbovePrice }) : null,
14
14
  /* @__PURE__ */ jsxs(Flex, { direction: "row", align: "baseline", flexGrow: "1", wrap: "nowrap", children: [
15
- /* @__PURE__ */ jsx(Text, { variant: "paragraph-200", as: "p", faded: true, children: pricePrefix ? `${pricePrefix} ` : null }),
15
+ pricePrefix && /* @__PURE__ */ jsx(Text, { variant: "paragraph-200", as: "p", faded: true, children: pricePrefix }),
16
16
  /* @__PURE__ */ jsx(
17
17
  Text,
18
18
  {
19
19
  variant: "paragraph-100-bold",
20
20
  as: "span",
21
21
  ml: "100",
22
+ mr: "100",
22
23
  color: variant === "purple" ? teddyColorBrandCorePurple : void 0,
23
24
  className: styles[`${rootColorDotsClass}--big`],
24
25
  children: priceText
25
26
  }
26
- )
27
+ ),
28
+ priceSuffix && /* @__PURE__ */ jsx(Text, { variant: "paragraph-200", as: "p", faded: true, children: priceSuffix })
27
29
  ] }),
28
30
  textBelowPrice ? /* @__PURE__ */ jsx(Text, { variant: "additional-100", as: "p", faded: true, children: textBelowPrice }) : null
29
31
  ] });
@@ -768,6 +768,10 @@ const Desktop = React.forwardRef(() => {
768
768
  });
769
769
  const topMenuSize = utils_useSize.useSize(topMenuRef.current);
770
770
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
771
+ const [isClientSide, setIsClientSide] = React.useState(false);
772
+ React.useEffect(() => {
773
+ setIsClientSide(true);
774
+ }, []);
771
775
  if (!rootContext)
772
776
  return null;
773
777
  const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
@@ -882,13 +886,13 @@ const Desktop = React.forwardRef(() => {
882
886
  )
883
887
  }
884
888
  ),
885
- typeof window !== "undefined" && /* @__PURE__ */ jsxRuntime.jsx(
889
+ /* @__PURE__ */ jsxRuntime.jsx(
886
890
  "div",
887
891
  {
888
892
  style: utils_generateStyling_index.mergeStyles({ ["--teddy-viewport-wrapper-height"]: viewPortHeight }),
889
893
  className: styles[`${rootClassName}__viewport-wrapper`],
890
894
  "data-state": showMenu ? "open" : "closed",
891
- children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
895
+ children: isClientSide && /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
892
896
  ((_a2 = subLink.links) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
893
897
  HightlightedLinksDesktop,
894
898
  {
@@ -747,6 +747,10 @@ const Desktop = React__default.forwardRef(() => {
747
747
  });
748
748
  const topMenuSize = useSize(topMenuRef.current);
749
749
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
750
+ const [isClientSide, setIsClientSide] = React__default.useState(false);
751
+ React__default.useEffect(() => {
752
+ setIsClientSide(true);
753
+ }, []);
750
754
  if (!rootContext)
751
755
  return null;
752
756
  const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
@@ -861,13 +865,13 @@ const Desktop = React__default.forwardRef(() => {
861
865
  )
862
866
  }
863
867
  ),
864
- typeof window !== "undefined" && /* @__PURE__ */ jsx(
868
+ /* @__PURE__ */ jsx(
865
869
  "div",
866
870
  {
867
871
  style: mergeStyles({ ["--teddy-viewport-wrapper-height"]: viewPortHeight }),
868
872
  className: styles[`${rootClassName}__viewport-wrapper`],
869
873
  "data-state": showMenu ? "open" : "closed",
870
- children: /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
874
+ children: isClientSide && /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
871
875
  ((_a2 = subLink.links) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsx(
872
876
  HightlightedLinksDesktop,
873
877
  {
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.4.2",
23
+ "version": "0.4.4",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"