@micromag/element-text-input 0.3.541 → 0.3.547

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 +4 -5
  2. package/lib/index.js +0 -112
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-text-input",
3
- "version": "0.3.541",
3
+ "version": "0.3.547",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -30,11 +30,10 @@
30
30
  }
31
31
  ],
32
32
  "license": "ISC",
33
- "main": "lib/index.js",
33
+ "type": "module",
34
34
  "module": "es/index.js",
35
35
  "exports": {
36
36
  ".": {
37
- "require": "./lib/index.js",
38
37
  "import": "./es/index.js"
39
38
  },
40
39
  "./assets/css/styles": "./assets/css/styles.css",
@@ -60,7 +59,7 @@
60
59
  },
61
60
  "dependencies": {
62
61
  "@babel/runtime": "^7.13.10",
63
- "@micromag/core": "^0.3.541",
62
+ "@micromag/core": "^0.3.547",
64
63
  "classnames": "^2.2.6",
65
64
  "prop-types": "^15.7.2"
66
65
  },
@@ -68,5 +67,5 @@
68
67
  "access": "public",
69
68
  "registry": "https://registry.npmjs.org/"
70
69
  },
71
- "gitHead": "6c04a7e327b5fbc096785c11320b3fbd3c5751c8"
70
+ "gitHead": "3c2f5904ce61fcfa61f673c38c2a5ec56e9e2b07"
72
71
  }
package/lib/index.js DELETED
@@ -1,112 +0,0 @@
1
- 'use strict';
2
-
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
5
- var classNames = require('classnames');
6
- var PropTypes = require('prop-types');
7
- var React = require('react');
8
- var core = require('@micromag/core');
9
- var utils = require('@micromag/core/utils');
10
-
11
- var styles = {"container":"micromag-element-text-input-container","element":"micromag-element-text-input-element"};
12
-
13
- var propTypes = {
14
- label: PropTypes.string,
15
- labelOutside: PropTypes.bool,
16
- labelClassName: PropTypes.string,
17
- textStyle: core.PropTypes.textStyle,
18
- buttonStyle: core.PropTypes.boxStyle,
19
- labelOutsideStyle: core.PropTypes.textStyle,
20
- margin: core.PropTypes.margin,
21
- multiline: PropTypes.bool,
22
- value: PropTypes.string,
23
- onChange: PropTypes.func,
24
- onFocus: PropTypes.func,
25
- onBlur: PropTypes.func,
26
- required: PropTypes.bool,
27
- disabled: PropTypes.bool,
28
- focusable: PropTypes.bool,
29
- className: PropTypes.string
30
- };
31
- var defaultProps = {
32
- label: null,
33
- labelOutside: false,
34
- labelClassName: null,
35
- textStyle: null,
36
- buttonStyle: null,
37
- labelOutsideStyle: null,
38
- margin: null,
39
- multiline: false,
40
- value: '',
41
- onChange: null,
42
- onFocus: null,
43
- onBlur: null,
44
- required: false,
45
- disabled: false,
46
- focusable: true,
47
- className: null
48
- };
49
- var TextInput = function TextInput(_ref) {
50
- var label = _ref.label,
51
- labelOutside = _ref.labelOutside,
52
- labelClassName = _ref.labelClassName,
53
- textStyle = _ref.textStyle,
54
- buttonStyle = _ref.buttonStyle,
55
- labelOutsideStyle = _ref.labelOutsideStyle,
56
- margin = _ref.margin,
57
- multiline = _ref.multiline,
58
- value = _ref.value,
59
- onChange = _ref.onChange,
60
- onFocus = _ref.onFocus,
61
- onBlur = _ref.onBlur,
62
- required = _ref.required,
63
- disabled = _ref.disabled,
64
- focusable = _ref.focusable,
65
- className = _ref.className;
66
- var containerStyle = {};
67
- var labelStyle = {};
68
- var elementStyle = {};
69
- if (margin !== null) {
70
- containerStyle = _objectSpread(_objectSpread({}, containerStyle), utils.getStyleFromMargin(margin));
71
- }
72
- if (labelOutsideStyle !== null) {
73
- labelStyle = _objectSpread(_objectSpread({}, labelStyle), utils.getStyleFromText(labelOutsideStyle));
74
- }
75
- if (textStyle !== null) {
76
- elementStyle = _objectSpread(_objectSpread({}, elementStyle), utils.getStyleFromText(textStyle));
77
- }
78
- if (buttonStyle !== null) {
79
- elementStyle = _objectSpread(_objectSpread({}, elementStyle), utils.getStyleFromBox(buttonStyle));
80
- }
81
- var containerProps = {
82
- className: classNames([styles.container, _defineProperty(_defineProperty({}, className, className !== null), styles.element, !labelOutside)]),
83
- style: containerStyle
84
- };
85
- var elementProps = _objectSpread(_objectSpread({
86
- className: styles.element
87
- }, !labelOutside ? containerProps : null), {}, {
88
- style: elementStyle,
89
- placeholder: !labelOutside ? label : undefined,
90
- value: value,
91
- onChange: onChange,
92
- onFocus: onFocus,
93
- onBlur: onBlur,
94
- required: required,
95
- disabled: disabled
96
- });
97
- var element = multiline ? /*#__PURE__*/React.createElement("textarea", Object.assign({}, elementProps, {
98
- tabIndex: focusable ? '0' : '-1'
99
- })) : /*#__PURE__*/React.createElement("input", Object.assign({}, elementProps, {
100
- type: "text",
101
- tabIndex: focusable ? '0' : '-1'
102
- }));
103
- return !labelOutside ? element : /*#__PURE__*/React.createElement("label", containerProps, /*#__PURE__*/React.createElement("div", {
104
- className: labelClassName,
105
- style: labelStyle
106
- }, label), element);
107
- };
108
- TextInput.propTypes = propTypes;
109
- TextInput.defaultProps = defaultProps;
110
- var TextInput$1 = TextInput;
111
-
112
- module.exports = TextInput$1;