@commercetools-uikit/date-field 19.10.0 → 19.12.0
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/README.md
CHANGED
|
@@ -66,9 +66,9 @@ export default Example;
|
|
|
66
66
|
| `isCondensed` | `boolean` | | | Use this property to reduce the paddings of the component for a ui compact variant |
|
|
67
67
|
| `minValue` | `string` | | | A minimum selectable date. Must either be an empty string or a date formatted as "YYYY-MM-DD". |
|
|
68
68
|
| `maxValue` | `string` | | | A maximum selectable date. Must either be an empty string or a date formatted as "YYYY-MM-DD". |
|
|
69
|
-
| `title` | `
|
|
70
|
-
| `hint` | `
|
|
71
|
-
| `description` | `
|
|
69
|
+
| `title` | `ReactNode` | ✅ | | Title of the label |
|
|
70
|
+
| `hint` | `ReactNode` | | | Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`. |
|
|
71
|
+
| `description` | `ReactNode` | | | Provides a description for the title. |
|
|
72
72
|
| `onInfoButtonClick` | `Function`<br/>[See signature.](#signature-onInfoButtonClick) | | | Function called when info button is pressed.
<br />
Info button will only be visible when this prop is passed. |
|
|
73
73
|
| `hintIcon` | `ReactElement` | | | Icon to be displayed beside the hint text.
<br />
Will only get rendered when `hint` is passed as well. |
|
|
74
74
|
| `badge` | `ReactNode` | | | Badge to be displayed beside the label.
<br />
Might be used to display additional information about the content of the field (E.g verified email) |
|
|
@@ -102,7 +102,9 @@ export default Example;
|
|
|
102
102
|
### Signature `onInfoButtonClick`
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
|
-
(
|
|
105
|
+
(
|
|
106
|
+
event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>
|
|
107
|
+
) => void
|
|
106
108
|
```
|
|
107
109
|
|
|
108
110
|
## `data-*` props
|
|
@@ -70,7 +70,6 @@ const hasWarnings = warnings => {
|
|
|
70
70
|
return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
|
|
71
71
|
};
|
|
72
72
|
let DateField = /*#__PURE__*/function (_Component) {
|
|
73
|
-
_inherits(DateField, _Component);
|
|
74
73
|
function DateField() {
|
|
75
74
|
var _this;
|
|
76
75
|
_classCallCheck(this, DateField);
|
|
@@ -85,7 +84,8 @@ let DateField = /*#__PURE__*/function (_Component) {
|
|
|
85
84
|
};
|
|
86
85
|
return _this;
|
|
87
86
|
}
|
|
88
|
-
|
|
87
|
+
_inherits(DateField, _Component);
|
|
88
|
+
return _createClass(DateField, [{
|
|
89
89
|
key: "render",
|
|
90
90
|
value: function render() {
|
|
91
91
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
@@ -155,7 +155,6 @@ let DateField = /*#__PURE__*/function (_Component) {
|
|
|
155
155
|
return errors;
|
|
156
156
|
}
|
|
157
157
|
}]);
|
|
158
|
-
return DateField;
|
|
159
158
|
}(react.Component);
|
|
160
159
|
DateField.displayName = 'DateField';
|
|
161
160
|
DateField.defaultProps = {
|
|
@@ -184,9 +183,9 @@ DateField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
184
183
|
isCondensed: _pt__default["default"].bool,
|
|
185
184
|
minValue: _pt__default["default"].string,
|
|
186
185
|
maxValue: _pt__default["default"].string,
|
|
187
|
-
title: _pt__default["default"].
|
|
188
|
-
hint: _pt__default["default"].
|
|
189
|
-
description: _pt__default["default"].
|
|
186
|
+
title: _pt__default["default"].node.isRequired,
|
|
187
|
+
hint: _pt__default["default"].node,
|
|
188
|
+
description: _pt__default["default"].node,
|
|
190
189
|
onInfoButtonClick: _pt__default["default"].func,
|
|
191
190
|
hintIcon: _pt__default["default"].element,
|
|
192
191
|
badge: _pt__default["default"].node
|
|
@@ -194,7 +193,7 @@ DateField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
194
193
|
var DateField$1 = DateField;
|
|
195
194
|
|
|
196
195
|
// NOTE: This string will be replaced on build time with the package version.
|
|
197
|
-
var version = "19.
|
|
196
|
+
var version = "19.11.0";
|
|
198
197
|
|
|
199
198
|
exports["default"] = DateField$1;
|
|
200
199
|
exports.version = version;
|
|
@@ -69,7 +69,6 @@ const hasWarnings = warnings => {
|
|
|
69
69
|
return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
|
|
70
70
|
};
|
|
71
71
|
let DateField = /*#__PURE__*/function (_Component) {
|
|
72
|
-
_inherits(DateField, _Component);
|
|
73
72
|
function DateField() {
|
|
74
73
|
var _this;
|
|
75
74
|
_classCallCheck(this, DateField);
|
|
@@ -84,7 +83,8 @@ let DateField = /*#__PURE__*/function (_Component) {
|
|
|
84
83
|
};
|
|
85
84
|
return _this;
|
|
86
85
|
}
|
|
87
|
-
|
|
86
|
+
_inherits(DateField, _Component);
|
|
87
|
+
return _createClass(DateField, [{
|
|
88
88
|
key: "render",
|
|
89
89
|
value: function render() {
|
|
90
90
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
@@ -150,7 +150,6 @@ let DateField = /*#__PURE__*/function (_Component) {
|
|
|
150
150
|
return errors;
|
|
151
151
|
}
|
|
152
152
|
}]);
|
|
153
|
-
return DateField;
|
|
154
153
|
}(react.Component);
|
|
155
154
|
DateField.displayName = 'DateField';
|
|
156
155
|
DateField.defaultProps = {
|
|
@@ -163,7 +162,7 @@ DateField.propTypes = {};
|
|
|
163
162
|
var DateField$1 = DateField;
|
|
164
163
|
|
|
165
164
|
// NOTE: This string will be replaced on build time with the package version.
|
|
166
|
-
var version = "19.
|
|
165
|
+
var version = "19.11.0";
|
|
167
166
|
|
|
168
167
|
exports["default"] = DateField$1;
|
|
169
168
|
exports.version = version;
|
|
@@ -45,7 +45,6 @@ const hasWarnings = warnings => {
|
|
|
45
45
|
return warnings && _someInstanceProperty(_context2 = _Object$values(warnings)).call(_context2, Boolean);
|
|
46
46
|
};
|
|
47
47
|
let DateField = /*#__PURE__*/function (_Component) {
|
|
48
|
-
_inherits(DateField, _Component);
|
|
49
48
|
function DateField() {
|
|
50
49
|
var _this;
|
|
51
50
|
_classCallCheck(this, DateField);
|
|
@@ -60,7 +59,8 @@ let DateField = /*#__PURE__*/function (_Component) {
|
|
|
60
59
|
};
|
|
61
60
|
return _this;
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
_inherits(DateField, _Component);
|
|
63
|
+
return _createClass(DateField, [{
|
|
64
64
|
key: "render",
|
|
65
65
|
value: function render() {
|
|
66
66
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
@@ -130,7 +130,6 @@ let DateField = /*#__PURE__*/function (_Component) {
|
|
|
130
130
|
return errors;
|
|
131
131
|
}
|
|
132
132
|
}]);
|
|
133
|
-
return DateField;
|
|
134
133
|
}(Component);
|
|
135
134
|
DateField.displayName = 'DateField';
|
|
136
135
|
DateField.defaultProps = {
|
|
@@ -159,9 +158,9 @@ DateField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
159
158
|
isCondensed: _pt.bool,
|
|
160
159
|
minValue: _pt.string,
|
|
161
160
|
maxValue: _pt.string,
|
|
162
|
-
title: _pt.
|
|
163
|
-
hint: _pt.
|
|
164
|
-
description: _pt.
|
|
161
|
+
title: _pt.node.isRequired,
|
|
162
|
+
hint: _pt.node,
|
|
163
|
+
description: _pt.node,
|
|
165
164
|
onInfoButtonClick: _pt.func,
|
|
166
165
|
hintIcon: _pt.element,
|
|
167
166
|
badge: _pt.node
|
|
@@ -169,6 +168,6 @@ DateField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
169
168
|
var DateField$1 = DateField;
|
|
170
169
|
|
|
171
170
|
// NOTE: This string will be replaced on build time with the package version.
|
|
172
|
-
var version = "19.
|
|
171
|
+
var version = "19.11.0";
|
|
173
172
|
|
|
174
173
|
export { DateField$1 as default, version };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, type FocusEventHandler, type ReactElement, type ReactNode } from 'react';
|
|
1
|
+
import { Component, type MouseEvent, type KeyboardEvent, type FocusEventHandler, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
3
3
|
type TWarningRenderer = (key: string, warning?: boolean) => ReactNode;
|
|
4
4
|
type TFieldErrors = Record<string, boolean>;
|
|
@@ -100,21 +100,21 @@ export type TDateFieldProps = {
|
|
|
100
100
|
/**
|
|
101
101
|
* Title of the label
|
|
102
102
|
*/
|
|
103
|
-
title:
|
|
103
|
+
title: ReactNode;
|
|
104
104
|
/**
|
|
105
105
|
* Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
|
|
106
106
|
*/
|
|
107
|
-
hint?:
|
|
107
|
+
hint?: ReactNode;
|
|
108
108
|
/**
|
|
109
109
|
* Provides a description for the title.
|
|
110
110
|
*/
|
|
111
|
-
description?:
|
|
111
|
+
description?: ReactNode;
|
|
112
112
|
/**
|
|
113
113
|
* Function called when info button is pressed.
|
|
114
114
|
* <br />
|
|
115
115
|
* Info button will only be visible when this prop is passed.
|
|
116
116
|
*/
|
|
117
|
-
onInfoButtonClick?: () => void;
|
|
117
|
+
onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
|
|
118
118
|
/**
|
|
119
119
|
* Icon to be displayed beside the hint text.
|
|
120
120
|
* <br />
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/date-field",
|
|
3
3
|
"description": "A controlled date input component for single date, with validation states and a label.",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.12.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "19.
|
|
25
|
-
"@commercetools-uikit/date-input": "19.
|
|
26
|
-
"@commercetools-uikit/design-system": "19.
|
|
27
|
-
"@commercetools-uikit/field-errors": "19.
|
|
28
|
-
"@commercetools-uikit/field-label": "19.
|
|
29
|
-
"@commercetools-uikit/field-warnings": "19.
|
|
30
|
-
"@commercetools-uikit/spacings": "19.
|
|
31
|
-
"@commercetools-uikit/utils": "19.
|
|
24
|
+
"@commercetools-uikit/constraints": "19.12.0",
|
|
25
|
+
"@commercetools-uikit/date-input": "19.12.0",
|
|
26
|
+
"@commercetools-uikit/design-system": "19.12.0",
|
|
27
|
+
"@commercetools-uikit/field-errors": "19.12.0",
|
|
28
|
+
"@commercetools-uikit/field-label": "19.12.0",
|
|
29
|
+
"@commercetools-uikit/field-warnings": "19.12.0",
|
|
30
|
+
"@commercetools-uikit/spacings": "19.12.0",
|
|
31
|
+
"@commercetools-uikit/utils": "19.12.0",
|
|
32
32
|
"@emotion/react": "^11.10.5",
|
|
33
33
|
"@emotion/styled": "^11.10.5",
|
|
34
34
|
"prop-types": "15.8.1",
|