@janbox/storefront-ui 2.0.8 → 2.0.9

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 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/lib/link/link.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAuB,MAAM,SAAS,CAAC;AAQzD,eAAO,MAAM,IAAI,iCAAkC,SAAS,qDAmD3D,CAAC"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/lib/link/link.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAuB,MAAM,SAAS,CAAC;AAQzD,eAAO,MAAM,IAAI,iCAAkC,SAAS,qDAuD3D,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { ClassNames } from "@emotion/react";
2
3
  import { isNil } from "lodash-es";
3
4
  import { Link as Link$1 } from "react-router";
4
5
  import { getLinkProps } from "./helpers.js";
@@ -7,20 +8,8 @@ import { Booleanish } from "../../constants/index.js";
7
8
  import { mediaQuery } from "../../theme/screens.js";
8
9
  import "../../theme/palette.js";
9
10
  import { getTypographyVar } from "../../theme/typography.js";
10
- import { cn, createSxInterpolation } from "../../utils/stylesheet.js";
11
11
  const Link = ({ children, ref, ..._props }) => {
12
- const {
13
- sx,
14
- textVariant,
15
- sm,
16
- md,
17
- lg,
18
- dangerouslySetInnerHTML,
19
- to,
20
- underline = false,
21
- className,
22
- ...rest
23
- } = getLinkProps(_props);
12
+ const { sx, textVariant, sm, md, lg, to, underline = false, className, ...rest } = getLinkProps(_props);
24
13
  const hoverLineEffectProps = useHoverLineEffect({ enabled: underline });
25
14
  const onClick = (e) => {
26
15
  var _a;
@@ -32,37 +21,43 @@ const Link = ({ children, ref, ..._props }) => {
32
21
  }
33
22
  (_a = rest.onClick) == null ? void 0 : _a.call(rest, e);
34
23
  };
35
- return /* @__PURE__ */ jsx(
24
+ return /* @__PURE__ */ jsx(ClassNames, { children: ({ cx, css }) => /* @__PURE__ */ jsx(
36
25
  Link$1,
37
26
  {
38
27
  to: to ?? "#",
39
- css: [
40
- createStyle({ textVariant }),
41
- {
42
- [mediaQuery("sm")]: createStyle(sm),
43
- [mediaQuery("md")]: createStyle(md),
44
- [mediaQuery("lg")]: createStyle(lg)
45
- },
46
- createSxInterpolation(sx),
47
- rest["aria-disabled"] && { pointerEvents: "none" }
48
- ],
49
- dangerouslySetInnerHTML: isNil(children) ? dangerouslySetInnerHTML : void 0,
50
28
  ...hoverLineEffectProps,
51
- className: cn(className, hoverLineEffectProps.className),
29
+ className: cx(
30
+ className,
31
+ hoverLineEffectProps.className,
32
+ css({
33
+ '&[aria-disabled="true"]': {
34
+ pointerEvents: "none"
35
+ },
36
+ ...createStyle({ textVariant }),
37
+ ...sx,
38
+ [mediaQuery("sm")]: {
39
+ ...createStyle(sm),
40
+ ...sx == null ? void 0 : sx.sm
41
+ },
42
+ [mediaQuery("md")]: {
43
+ ...createStyle(md),
44
+ ...sx == null ? void 0 : sx.md
45
+ },
46
+ [mediaQuery("lg")]: {
47
+ ...createStyle(lg),
48
+ ...sx == null ? void 0 : sx.lg
49
+ }
50
+ })
51
+ ),
52
52
  ...rest,
53
53
  onClick,
54
54
  ref,
55
- children: isNil(dangerouslySetInnerHTML) ? children : null
55
+ children
56
56
  }
57
- );
57
+ ) });
58
58
  };
59
59
  const createStyle = ({ textVariant } = {}) => {
60
- return [
61
- textVariant && {
62
- fontSize: getTypographyVar(textVariant).fontSize,
63
- lineHeight: getTypographyVar(textVariant).lineHeight
64
- }
65
- ];
60
+ return textVariant ? { fontSize: getTypographyVar(textVariant).fontSize, lineHeight: getTypographyVar(textVariant).lineHeight } : {};
66
61
  };
67
62
  export {
68
63
  Link
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [