@prokodo/ui 0.0.36 → 0.0.38

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.
@@ -2,7 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
4
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
5
- import { Link } from "../link/Link.js";
5
+ import LinkClient from "../link/Link.client.js";
6
6
  import { ButtonView } from "./Button.view.js";
7
7
  import { Loading } from "../loading/Loading.js";
8
8
  function ButtonClient(props) {
@@ -17,7 +17,7 @@ function ButtonClient(props) {
17
17
  ...rest,
18
18
  iconProps: finalIconProps,
19
19
  isIconOnly: Boolean(isIconOnly),
20
- LinkComponent: Link
20
+ LinkComponent: LinkClient
21
21
  }
22
22
  )
23
23
  ] });
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { jsx } from "react/jsx-runtime";
4
- import { Link } from "../link/Link.js";
4
+ import LinkServer from "../link/Link.server.js";
5
5
  import { ButtonView } from "./Button.view.js";
6
6
  function ButtonServer(p) {
7
7
  var _a;
@@ -11,7 +11,7 @@ function ButtonServer(p) {
11
11
  {
12
12
  ...p,
13
13
  isIconOnly: Boolean(isIconOnly),
14
- LinkComponent: Link
14
+ LinkComponent: LinkServer
15
15
  }
16
16
  );
17
17
  }
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { memo } from "react";
4
+ import { LinkView } from "./Link.view.js";
5
+ const LinkClient = memo((props) => {
6
+ const { href, onClick } = props;
7
+ const linkTag = onClick && !href ? "span" : "a";
8
+ const hasHandlers = Boolean(onClick) || Boolean(props.onKeyDown);
9
+ return /* @__PURE__ */ jsx(
10
+ LinkView,
11
+ {
12
+ ...props,
13
+ hasHandlers,
14
+ LinkTag: linkTag
15
+ }
16
+ );
17
+ });
18
+ LinkClient.displayName = "LinkClient";
19
+ export {
20
+ LinkClient as default
21
+ };
@@ -1,63 +1,14 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { memo } from "react";
3
- import { create } from "../../helpers/bem.js";
4
- import { isString } from "../../helpers/validations.js";
5
- import styles from "./Link.module.scss.js";
6
- import { BaseLink } from "../base-link/BaseLink.js";
7
- const bem = create(styles, "Link");
8
- const Link = memo(
9
- ({
10
- variant = "inherit",
11
- href,
12
- children,
13
- className,
14
- style,
15
- target,
16
- itemProp,
17
- hasBackground,
18
- onMouseEnter,
19
- onClick,
20
- onKeyDown,
21
- ariaLabel
22
- }) => {
23
- const linkModifier = {
24
- "has-no-background": hasBackground === false,
25
- [`has-no-background--${variant}`]: hasBackground === false
26
- };
27
- const defaultProps = {
28
- className: bem(void 0, linkModifier, className),
29
- style,
30
- onMouseEnter
31
- };
32
- if (onClick && !isString(href)) {
33
- return /* @__PURE__ */ jsx(
34
- "span",
35
- {
36
- "aria-label": ariaLabel,
37
- role: "button",
38
- tabIndex: 0,
39
- onClick,
40
- onKeyDown,
41
- ...defaultProps,
42
- children
43
- }
44
- );
45
- }
46
- return /* @__PURE__ */ jsx(
47
- BaseLink,
48
- {
49
- ...defaultProps,
50
- "aria-label": ariaLabel,
51
- href,
52
- itemProp,
53
- target: target ?? void 0,
54
- onClick,
55
- children
56
- }
57
- );
58
- }
59
- );
60
- Link.displayName = "Link";
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { createIsland } from "../../helpers/createIsland.js";
4
+ import LinkServer from "./Link.server.js";
5
+ const Link = createIsland({
6
+ name: "Link",
7
+ Server: LinkServer,
8
+ loadLazy: /* @__PURE__ */ __name(() => import("./Link.lazy.js"), "loadLazy"),
9
+ // optional: custom predicate (e.g. always interactive if target="_blank")
10
+ isInteractive: /* @__PURE__ */ __name((p) => typeof p.onClick === "function" || typeof p.onKeyDown === "function" || p.target === "_blank", "isInteractive")
11
+ });
61
12
  export {
62
13
  Link
63
14
  };
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { createLazyWrapper } from "../../helpers/createLazyWrapper.js";
3
+ import LinkClient from "./Link.client.js";
4
+ import LinkServer from "./Link.server.js";
5
+ const Link_lazy = createLazyWrapper({
6
+ name: "Link",
7
+ Client: LinkClient,
8
+ Server: LinkServer
9
+ });
10
+ export {
11
+ Link_lazy as default
12
+ };
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { LinkView } from "./Link.view.js";
5
+ function LinkServer(props) {
6
+ const hasHandlers = false;
7
+ const linkTag = props.onClick && !props.href ? "span" : "a";
8
+ return /* @__PURE__ */ jsx(
9
+ LinkView,
10
+ {
11
+ ...props,
12
+ hasHandlers,
13
+ LinkTag: linkTag
14
+ }
15
+ );
16
+ }
17
+ __name(LinkServer, "LinkServer");
18
+ export {
19
+ LinkServer as default
20
+ };
@@ -0,0 +1,58 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { create } from "../../helpers/bem.js";
5
+ import styles from "./Link.module.scss.js";
6
+ import { BaseLink } from "../base-link/BaseLink.js";
7
+ const bem = create(styles, "Link");
8
+ function LinkView({
9
+ variant = "inherit",
10
+ href,
11
+ children,
12
+ className,
13
+ style,
14
+ target,
15
+ itemProp,
16
+ hasBackground,
17
+ ariaLabel,
18
+ LinkTag,
19
+ hasHandlers,
20
+ onClick,
21
+ ...props
22
+ }) {
23
+ const cleanedProps = { ...props };
24
+ delete cleanedProps.linkComponent;
25
+ const linkMod = {
26
+ "has-no-background": hasBackground === false,
27
+ [`has-no-background--${variant}`]: hasBackground === false
28
+ };
29
+ const common = {
30
+ className: bem(void 0, linkMod, className),
31
+ style,
32
+ "aria-label": ariaLabel,
33
+ itemProp
34
+ };
35
+ return LinkTag === "span" ? /* @__PURE__ */ jsx(
36
+ "span",
37
+ {
38
+ ...common,
39
+ role: "button",
40
+ tabIndex: 0,
41
+ ...cleanedProps,
42
+ children
43
+ }
44
+ ) : /* @__PURE__ */ jsx(
45
+ BaseLink,
46
+ {
47
+ ...common,
48
+ href,
49
+ target: target ?? void 0,
50
+ ...hasHandlers ? { onClick } : null,
51
+ children
52
+ }
53
+ );
54
+ }
55
+ __name(LinkView, "LinkView");
56
+ export {
57
+ LinkView
58
+ };
@@ -1,4 +1,4 @@
1
- const PROKODO_UI_VERSION = "0.0.36";
1
+ const PROKODO_UI_VERSION = "0.0.38";
2
2
  export {
3
3
  PROKODO_UI_VERSION
4
4
  };
@@ -8,7 +8,6 @@ function createIsland({
8
8
  loadLazy,
9
9
  isInteractive: customInteractive
10
10
  }) {
11
- if (typeof window !== "undefined") void loadLazy();
12
11
  const LazyWrapper = typeof window !== "undefined" ? lazy(() => loadLazy().then((m) => ({ default: m.default }))) : null;
13
12
  const Island = /* @__PURE__ */ __name(({
14
13
  priority = false,