@panneau/display-link 4.0.8 → 4.0.14

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.
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface LinkProps {
4
+ item?: {
5
+ id: string | number;
6
+ } | null;
7
+ value?: string | null;
8
+ label?: string | null;
9
+ labelPath?: string | null;
10
+ external?: boolean;
11
+ target?: string | null;
12
+ placeholder?: ReactNode | null;
13
+ }
14
+ declare function Link({ item, label, labelPath, value, external, target, placeholder, }: LinkProps): any;
15
+
16
+ export { Link as default };
@@ -1,5 +1,5 @@
1
- import get from 'lodash-es/get';
2
- import isString from 'lodash-es/isString';
1
+ import get from 'lodash/get';
2
+ import isString from 'lodash/isString';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { Link as Link$1 } from 'wouter';
5
5
  import { jsx } from 'react/jsx-runtime';
@@ -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.8",
3
+ "version": "4.0.14",
4
4
  "description": "Link item value in list",
5
5
  "keywords": [
6
6
  "javascript"
@@ -26,38 +26,40 @@
26
26
  ],
27
27
  "license": "ISC",
28
28
  "type": "module",
29
- "module": "es/index.js",
29
+ "module": "dist/index.js",
30
+ "types": "dist/index.d.ts",
30
31
  "exports": {
31
- ".": "./es/index.js"
32
+ ".": {
33
+ "default": "./dist/index.js",
34
+ "types": "./dist/index.d.ts"
35
+ }
32
36
  },
33
37
  "files": [
34
- "lib",
35
- "es",
38
+ "dist",
36
39
  "assets"
37
40
  ],
38
41
  "scripts": {
39
42
  "prepublishOnly": "npm run build",
40
- "build": "../../scripts/prepare-package.sh"
43
+ "build": "../../scripts/prepare-package.sh --types"
41
44
  },
42
45
  "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"
46
+ "react": "^19.0.0",
47
+ "react-dom": "^19.0.0"
45
48
  },
46
49
  "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"
50
+ "react": "^19.0.0",
51
+ "react-dom": "^19.0.0"
49
52
  },
50
53
  "dependencies": {
51
54
  "@babel/runtime": "^7.12.5",
52
- "@panneau/core": "^4.0.8",
53
- "@panneau/themes": "^4.0.8",
54
- "lodash-es": "^4.17.21",
55
- "prop-types": "^15.7.2",
55
+ "@panneau/core": "^4.0.14",
56
+ "@panneau/themes": "^4.0.14",
57
+ "lodash": "^4.17.21",
56
58
  "react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0",
57
59
  "wouter": "^3.1.2"
58
60
  },
59
61
  "publishConfig": {
60
62
  "access": "public"
61
63
  },
62
- "gitHead": "c9fa22382cc63416e2bfaac780f31794b11c8c64"
64
+ "gitHead": "ce35c2ddb30a7be2efe951882d9826dca577f5d4"
63
65
  }