@panneau/field-text 4.0.38 → 4.0.40-alpha.1

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/dist/index.js +125 -98
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
+ import { c } from 'react/compiler-runtime';
4
2
  import classNames from 'classnames';
5
3
  import isEmpty from 'lodash/isEmpty';
6
4
  import { useMemo } from 'react';
@@ -27,66 +25,44 @@ var definition = [{
27
25
 
28
26
  var styles = {"inputElement":"panneau-field-text-inputElement"};
29
27
 
30
- var _excluded = ["horizontal"];
31
- function InputField(_ref) {
32
- var _ref$feedback = _ref.feedback,
33
- feedback = _ref$feedback === void 0 ? null : _ref$feedback,
34
- _ref$value = _ref.value,
35
- value = _ref$value === void 0 ? null : _ref$value,
36
- _ref$errors = _ref.errors,
37
- errors = _ref$errors === void 0 ? null : _ref$errors,
38
- _ref$required = _ref.required,
39
- required = _ref$required === void 0 ? false : _ref$required,
40
- _ref$disabled = _ref.disabled,
41
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
42
- _ref$readOnly = _ref.readOnly,
43
- readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
44
- _ref$nativeOnChange = _ref.nativeOnChange,
45
- nativeOnChange = _ref$nativeOnChange === void 0 ? false : _ref$nativeOnChange,
46
- _ref$pattern = _ref.pattern,
47
- pattern = _ref$pattern === void 0 ? null : _ref$pattern,
48
- _ref$title = _ref.title,
49
- title = _ref$title === void 0 ? null : _ref$title,
50
- _ref$type = _ref.type,
51
- type = _ref$type === void 0 ? null : _ref$type,
52
- _ref$placeholder = _ref.placeholder,
53
- placeholder = _ref$placeholder === void 0 ? null : _ref$placeholder,
54
- _ref$onChange = _ref.onChange,
55
- onChange = _ref$onChange === void 0 ? null : _ref$onChange,
56
- _ref$onFocus = _ref.onFocus,
57
- onFocus = _ref$onFocus === void 0 ? null : _ref$onFocus,
58
- _ref$onBlur = _ref.onBlur,
59
- onBlur = _ref$onBlur === void 0 ? null : _ref$onBlur,
60
- _ref$align = _ref.align,
61
- align = _ref$align === void 0 ? null : _ref$align,
62
- _ref$size = _ref.size,
63
- size = _ref$size === void 0 ? null : _ref$size,
64
- _ref$maxLength = _ref.maxLength,
65
- maxLength = _ref$maxLength === void 0 ? null : _ref$maxLength,
66
- _ref$prepend = _ref.prepend,
67
- prepend = _ref$prepend === void 0 ? null : _ref$prepend,
68
- _ref$append = _ref.append,
69
- append = _ref$append === void 0 ? null : _ref$append,
70
- _ref$min = _ref.min,
71
- min = _ref$min === void 0 ? null : _ref$min,
72
- _ref$max = _ref.max,
73
- max = _ref$max === void 0 ? null : _ref$max,
74
- _ref$dataList = _ref.dataList,
75
- dataList = _ref$dataList === void 0 ? null : _ref$dataList,
76
- _ref$inputRef = _ref.inputRef,
77
- inputRef = _ref$inputRef === void 0 ? null : _ref$inputRef,
78
- _ref$style = _ref.style,
79
- style = _ref$style === void 0 ? null : _ref$style,
80
- _ref$className = _ref.className,
81
- className = _ref$className === void 0 ? null : _ref$className;
82
- var dataListId = useMemo(function () {
83
- return dataList !== null ? v1() : null;
84
- }, [dataList]);
85
- var elProps = {
28
+ function InputField({
29
+ feedback = null,
30
+ value = null,
31
+ errors = null,
32
+ required = false,
33
+ disabled = false,
34
+ readOnly = false,
35
+ nativeOnChange = false,
36
+ pattern = null,
37
+ title = null,
38
+ type = null,
39
+ placeholder = null,
40
+ onChange = null,
41
+ onFocus = null,
42
+ onBlur = null,
43
+ align = null,
44
+ size = null,
45
+ maxLength = null,
46
+ prepend = null,
47
+ append = null,
48
+ min = null,
49
+ max = null,
50
+ dataList = null,
51
+ inputRef = null,
52
+ style = null,
53
+ className = null
54
+ }) {
55
+ const dataListId = useMemo(() => dataList !== null ? v1() : null, [dataList]);
56
+ const elProps = {
86
57
  ref: inputRef,
87
- className: classNames([styles.inputElement, 'form-control', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "form-control-".concat(size), size !== null), 'is-valid', feedback === 'valid'), 'is-invalid', feedback === 'invalid' || errors !== null), className, className !== null)]),
88
- onFocus: onFocus,
89
- onBlur: onBlur,
58
+ className: classNames([styles.inputElement, 'form-control', {
59
+ [`form-control-${size}`]: size !== null,
60
+ 'is-valid': feedback === 'valid',
61
+ 'is-invalid': feedback === 'invalid' || errors !== null,
62
+ [className]: className !== null
63
+ }]),
64
+ onFocus,
65
+ onBlur,
90
66
  value: value !== null ? value : '',
91
67
  style: {
92
68
  textAlign: align || undefined
@@ -96,27 +72,30 @@ function InputField(_ref) {
96
72
  maxLength: maxLength || undefined,
97
73
  min: min || undefined,
98
74
  max: max || undefined,
99
- required: required,
100
- disabled: disabled,
101
- readOnly: readOnly,
75
+ required,
76
+ disabled,
77
+ readOnly,
102
78
  list: dataListId || undefined,
103
79
  pattern: pattern || undefined,
104
80
  title: title || undefined,
105
- onChange: nativeOnChange ? onChange : function (_ref3) {
106
- var _ref3$target$value = _ref3.target.value,
107
- newValue = _ref3$target$value === void 0 ? '' : _ref3$target$value;
108
- return onChange !== null ? onChange(!isEmpty(newValue) ? newValue : null) : null;
109
- }
81
+ onChange: nativeOnChange ? onChange : ({
82
+ target: {
83
+ value: newValue = ''
84
+ }
85
+ }) => onChange !== null ? onChange(!isEmpty(newValue) ? newValue : null) : null
110
86
  };
111
- var _ref4 = elProps;
112
- _ref4.horizontal;
113
- var cleanProps = _objectWithoutProperties(_ref4, _excluded);
114
- var inputElement = type !== 'textarea' ? /*#__PURE__*/jsx("input", _objectSpread(_objectSpread({}, cleanProps), {}, {
87
+ const {
88
+ horizontal,
89
+ ...cleanProps
90
+ } = elProps;
91
+ const inputElement = type !== 'textarea' ? /*#__PURE__*/jsx("input", {
92
+ ...cleanProps,
115
93
  style: style || undefined
116
- })) : /*#__PURE__*/jsx("textarea", _objectSpread({
117
- style: style || undefined
118
- }, cleanProps));
119
- var withInputGroup = prepend !== null || append !== null;
94
+ }) : /*#__PURE__*/jsx("textarea", {
95
+ style: style || undefined,
96
+ ...cleanProps
97
+ });
98
+ const withInputGroup = prepend !== null || append !== null;
120
99
  return /*#__PURE__*/jsxs(Fragment, {
121
100
  children: [withInputGroup ? /*#__PURE__*/jsx(InputGroup, {
122
101
  prepend: prepend,
@@ -124,43 +103,91 @@ function InputField(_ref) {
124
103
  children: inputElement
125
104
  }) : inputElement, dataListId !== null ? /*#__PURE__*/jsx("datalist", {
126
105
  id: dataListId,
127
- children: dataList.map(function (data, dataIndex) {
128
- return /*#__PURE__*/jsx("option", {
129
- children: data
130
- }, "option-".concat(dataIndex));
131
- })
106
+ children: dataList.map((data, dataIndex) => /*#__PURE__*/jsx("option", {
107
+ children: data
108
+ }, `option-${dataIndex}`))
132
109
  }) : null]
133
110
  });
134
111
  }
135
112
 
136
113
  function EmailField(props) {
137
- return /*#__PURE__*/jsx(InputField, _objectSpread(_objectSpread({}, props), {}, {
138
- type: "email"
139
- }));
114
+ const $ = c(2);
115
+ let t0;
116
+ if ($[0] !== props) {
117
+ t0 = /*#__PURE__*/jsx(InputField, {
118
+ ...props,
119
+ type: "email"
120
+ });
121
+ $[0] = props;
122
+ $[1] = t0;
123
+ } else {
124
+ t0 = $[1];
125
+ }
126
+ return t0;
140
127
  }
141
128
 
142
129
  function PasswordField(props) {
143
- return /*#__PURE__*/jsx(InputField, _objectSpread(_objectSpread({}, props), {}, {
144
- type: "password"
145
- }));
130
+ const $ = c(2);
131
+ let t0;
132
+ if ($[0] !== props) {
133
+ t0 = /*#__PURE__*/jsx(InputField, {
134
+ ...props,
135
+ type: "password"
136
+ });
137
+ $[0] = props;
138
+ $[1] = t0;
139
+ } else {
140
+ t0 = $[1];
141
+ }
142
+ return t0;
146
143
  }
147
144
 
148
145
  function TelephoneField(props) {
149
- return /*#__PURE__*/jsx(InputField, _objectSpread(_objectSpread({}, props), {}, {
150
- type: "tel"
151
- }));
146
+ const $ = c(2);
147
+ let t0;
148
+ if ($[0] !== props) {
149
+ t0 = /*#__PURE__*/jsx(InputField, {
150
+ ...props,
151
+ type: "tel"
152
+ });
153
+ $[0] = props;
154
+ $[1] = t0;
155
+ } else {
156
+ t0 = $[1];
157
+ }
158
+ return t0;
152
159
  }
153
160
 
154
161
  function TextareaField(props) {
155
- return /*#__PURE__*/jsx(InputField, _objectSpread(_objectSpread({}, props), {}, {
156
- type: "textarea"
157
- }));
162
+ const $ = c(2);
163
+ let t0;
164
+ if ($[0] !== props) {
165
+ t0 = /*#__PURE__*/jsx(InputField, {
166
+ ...props,
167
+ type: "textarea"
168
+ });
169
+ $[0] = props;
170
+ $[1] = t0;
171
+ } else {
172
+ t0 = $[1];
173
+ }
174
+ return t0;
158
175
  }
159
176
 
160
177
  function TextField(props) {
161
- return /*#__PURE__*/jsx(InputField, _objectSpread(_objectSpread({}, props), {}, {
162
- type: "text"
163
- }));
178
+ const $ = c(2);
179
+ let t0;
180
+ if ($[0] !== props) {
181
+ t0 = /*#__PURE__*/jsx(InputField, {
182
+ ...props,
183
+ type: "text"
184
+ });
185
+ $[0] = props;
186
+ $[1] = t0;
187
+ } else {
188
+ t0 = $[1];
189
+ }
190
+ return t0;
164
191
  }
165
192
 
166
193
  export { EmailField as Email, PasswordField as Password, TelephoneField as Telephone, TextareaField as Textarea, TextField as default, definition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/field-text",
3
- "version": "4.0.38",
3
+ "version": "4.0.40-alpha.1",
4
4
  "description": "A text field",
5
5
  "keywords": [
6
6
  "javascript"
@@ -64,9 +64,9 @@
64
64
  },
65
65
  "dependencies": {
66
66
  "@babel/runtime": "^7.28.6",
67
- "@panneau/core": "^4.0.38",
68
- "@panneau/field-input-group": "^4.0.38",
69
- "@panneau/themes": "^4.0.38",
67
+ "@panneau/core": "^4.0.40-alpha.1",
68
+ "@panneau/field-input-group": "^4.0.40-alpha.1",
69
+ "@panneau/themes": "^4.0.40-alpha.1",
70
70
  "classnames": "^2.5.1",
71
71
  "lodash": "^4.17.21",
72
72
  "uuid": "^9.0.1"
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "fa4b9c4ec7fe5c0e360dda5a40f8b5d8c7ada651"
77
+ "gitHead": "66520f92373b3aa371222b354d60ed3cf3d20c96"
78
78
  }