@panneau/display-link 4.0.7 → 4.0.11

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.
package/es/index.js CHANGED
@@ -20,7 +20,7 @@ function Link(_ref) {
20
20
  _ref$placeholder = _ref.placeholder,
21
21
  placeholder = _ref$placeholder === void 0 ? null : _ref$placeholder;
22
22
  var itemLabel = get(item, labelPath);
23
- var finalValue = itemLabel || label || placeholder || /*#__PURE__*/jsx(FormattedMessage, {
23
+ var finalLabel = itemLabel || label || placeholder || /*#__PURE__*/jsx(FormattedMessage, {
24
24
  id: "e0xuLo",
25
25
  defaultMessage: [{
26
26
  "type": 0,
@@ -28,15 +28,17 @@ function Link(_ref) {
28
28
  }]
29
29
  });
30
30
  var isExternal = value !== null && isString(value) ? value.indexOf('http') === 0 : false;
31
- return external || isExternal ? /*#__PURE__*/jsx("a", {
31
+ var link = value !== null ? /*#__PURE__*/jsx(Link$1, {
32
+ href: value,
33
+ children: finalLabel
34
+ }) : finalLabel;
35
+ var element = value !== null && (external || isExternal) ? /*#__PURE__*/jsx("a", {
32
36
  href: value,
33
37
  target: target || '_blank',
34
38
  rel: "noopener noreferrer",
35
- children: finalValue
36
- }) : /*#__PURE__*/jsx(Link$1, {
37
- href: value,
38
- children: finalValue
39
- });
39
+ children: finalLabel
40
+ }) : link;
41
+ return value !== null ? element : null;
40
42
  }
41
43
 
42
44
  export { Link as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/display-link",
3
- "version": "4.0.7",
3
+ "version": "4.0.11",
4
4
  "description": "Link item value in list",
5
5
  "keywords": [
6
6
  "javascript"
@@ -27,30 +27,37 @@
27
27
  "license": "ISC",
28
28
  "type": "module",
29
29
  "module": "es/index.js",
30
+ "types": "types/index.d.ts",
30
31
  "exports": {
31
- ".": "./es/index.js"
32
+ ".": {
33
+ "import": {
34
+ "default": "./es/index.js",
35
+ "types": "./types/index.d.ts"
36
+ }
37
+ }
32
38
  },
33
39
  "files": [
34
40
  "lib",
35
41
  "es",
36
- "assets"
42
+ "assets",
43
+ "types"
37
44
  ],
38
45
  "scripts": {
39
46
  "prepublishOnly": "npm run build",
40
- "build": "../../scripts/prepare-package.sh"
47
+ "build": "../../scripts/prepare-package.sh --types"
41
48
  },
42
49
  "devDependencies": {
43
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
44
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
50
+ "react": "^19.0.0",
51
+ "react-dom": "^19.0.0"
45
52
  },
46
53
  "peerDependencies": {
47
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
48
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
54
+ "react": "^19.0.0",
55
+ "react-dom": "^19.0.0"
49
56
  },
50
57
  "dependencies": {
51
58
  "@babel/runtime": "^7.12.5",
52
- "@panneau/core": "^4.0.7",
53
- "@panneau/themes": "^4.0.7",
59
+ "@panneau/core": "^4.0.11",
60
+ "@panneau/themes": "^4.0.11",
54
61
  "lodash-es": "^4.17.21",
55
62
  "prop-types": "^15.7.2",
56
63
  "react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0",
@@ -59,5 +66,5 @@
59
66
  "publishConfig": {
60
67
  "access": "public"
61
68
  },
62
- "gitHead": "8d44fb7aa253ad3ef23c1aca2e7f1a4884c357a6"
69
+ "gitHead": "fe8264ed2815da0b5a40339dec99999c6fe70751"
63
70
  }
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from 'react';
2
+ interface LinkProps {
3
+ item?: {
4
+ id: string | number;
5
+ } | null;
6
+ value?: string | null;
7
+ label?: string | null;
8
+ labelPath?: string | null;
9
+ external?: boolean;
10
+ target?: string | null;
11
+ placeholder?: ReactNode | null;
12
+ }
13
+ declare function Link({ item, label, labelPath, value, external, target, placeholder, }: LinkProps): any;
14
+ export default Link;
@@ -0,0 +1,2 @@
1
+ export default Link;
2
+ import Link from './Link';