@panneau/display-text-description 3.0.223 → 3.0.228

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.
Files changed (2) hide show
  1. package/package.json +8 -5
  2. package/lib/index.js +0 -72
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/display-text-description",
3
- "version": "3.0.223",
3
+ "version": "3.0.228",
4
4
  "description": "Text with description in list",
5
5
  "keywords": [
6
6
  "javascript"
@@ -25,8 +25,11 @@
25
25
  }
26
26
  ],
27
27
  "license": "ISC",
28
- "main": "lib/index.js",
28
+ "type": "module",
29
29
  "module": "es/index.js",
30
+ "exports": {
31
+ ".": "./es/index.js"
32
+ },
30
33
  "files": [
31
34
  "lib",
32
35
  "es",
@@ -46,8 +49,8 @@
46
49
  },
47
50
  "dependencies": {
48
51
  "@babel/runtime": "^7.12.5",
49
- "@panneau/core": "^3.0.223",
50
- "@panneau/themes": "^3.0.223",
52
+ "@panneau/core": "^3.0.228",
53
+ "@panneau/themes": "^3.0.228",
51
54
  "classnames": "^2.5.1",
52
55
  "lodash": "^4.17.21",
53
56
  "prop-types": "^15.7.2",
@@ -56,5 +59,5 @@
56
59
  "publishConfig": {
57
60
  "access": "public"
58
61
  },
59
- "gitHead": "14196bd955b0e44cbc214e00f3189b3216f3fa53"
62
+ "gitHead": "2adf72884fb88052c6a6822e6f32169bb1dfe18b"
60
63
  }
package/lib/index.js DELETED
@@ -1,72 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- var classNames = require('classnames');
7
- var get = require('lodash/get');
8
- var isObject = require('lodash/isObject');
9
- var PropTypes = require('prop-types');
10
- var React = require('react');
11
- var reactIntl = require('react-intl');
12
-
13
- var propTypes = {
14
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
15
- placeholder: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
16
- item: PropTypes.shape({
17
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
18
- }),
19
- descriptionPath: PropTypes.string,
20
- // eslint-disable-next-line react/forbid-prop-types
21
- descriptionValues: PropTypes.object,
22
- locale: PropTypes.string,
23
- selected: PropTypes.bool,
24
- className: PropTypes.string
25
- };
26
- var defaultProps = {
27
- value: null,
28
- placeholder: null,
29
- item: null,
30
- descriptionPath: null,
31
- descriptionValues: null,
32
- locale: null,
33
- selected: false,
34
- className: null
35
- };
36
- var TextDescription = function TextDescription(_ref) {
37
- var initialValue = _ref.value,
38
- placeholder = _ref.placeholder,
39
- parentLocale = _ref.locale,
40
- item = _ref.item,
41
- descriptionPath = _ref.descriptionPath,
42
- descriptionValues = _ref.descriptionValues,
43
- selected = _ref.selected,
44
- className = _ref.className;
45
- var _useIntl = reactIntl.useIntl(),
46
- locale = _useIntl.locale;
47
- var _useMemo = React.useMemo(function () {
48
- var partialValue = initialValue !== null && isObject(initialValue) ? initialValue[parentLocale || locale] || null : initialValue;
49
- var labelValue = get(item, descriptionPath);
50
- var partialLabel = labelValue !== null && isObject(descriptionValues) ? descriptionValues[labelValue] || null : labelValue;
51
- return {
52
- value: partialValue,
53
- label: partialLabel
54
- };
55
- }, [initialValue, descriptionPath, descriptionValues, item, locale, parentLocale]),
56
- value = _useMemo.value,
57
- label = _useMemo.label;
58
- return label !== null ? /*#__PURE__*/React.createElement("div", {
59
- className: classNames([_defineProperty({}, className, className !== null)])
60
- }, /*#__PURE__*/React.createElement("p", {
61
- className: "d-block m-0 p-0 lh-sm"
62
- }, value || placeholder), /*#__PURE__*/React.createElement("p", {
63
- className: classNames(['d-block m-0 p-0 text-opacity-50 lh-sm', {
64
- 'text-body': !selected
65
- }])
66
- }, /*#__PURE__*/React.createElement("small", null, label))) : /*#__PURE__*/React.createElement(React.Fragment, null, value || placeholder);
67
- };
68
- TextDescription.propTypes = propTypes;
69
- TextDescription.defaultProps = defaultProps;
70
- var TextDescription$1 = TextDescription;
71
-
72
- exports.default = TextDescription$1;