@commercetools-uikit/date-range-field 0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 commercetools GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ <!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
2
+ <!-- This file is created by the `yarn generate-readme` script. -->
3
+
4
+ # DateRangeField
5
+
6
+ ## Description
7
+
8
+ A controlled date input component for a date range, with validation states and a label.
9
+
10
+ ## Installation
11
+
12
+ ```
13
+ yarn add @commercetools-uikit/date-range-field
14
+ ```
15
+
16
+ ```
17
+ npm --save install @commercetools-uikit/date-range-field
18
+ ```
19
+
20
+ Additionally install the peer dependencies (if not present)
21
+
22
+ ```
23
+ yarn add react
24
+ ```
25
+
26
+ ```
27
+ npm --save install react
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```jsx
33
+ import DateRangeField from '@commercetools-uikit/date-range-field';
34
+
35
+ const Example = () => (
36
+ <DateRangeField
37
+ title="Release Date"
38
+ value={['2018-09-20', '2018-09-24']}
39
+ onChange={(event) => alert(event.target.value)}
40
+ />
41
+ );
42
+
43
+ export default Example;
44
+ ```
45
+
46
+ ## Properties
47
+
48
+ | Props | Type | Required | Default | Description |
49
+ | ---------------------- | -------------------------------------------------------------------------------------------- | :------: | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50
+ | `id` | `string` | | | Used as HTML id property. An id is auto-generated when it is not specified. |
51
+ | `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | `'scale'` | Horizontal size limit of the input fields. |
52
+ | `errors` | `Record` | | | A map of errors. Error messages for known errors are rendered automatically.&#xA;<br />&#xA;Unknown errors will be forwarded to `renderError` |
53
+ | `renderError` | `Function`<br/>[See signature.](#signature-rendererror) | | | Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error. |
54
+ | `warnings` | `Record` | | | A map of warnings. Warning messages for known warnings are rendered automatically.&#xA;<br/>&#xA;Unknown warnings will be forwarded to renderWarning. |
55
+ | `renderWarning` | `Function`<br/>[See signature.](#signature-renderwarning) | | | Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.&#xA;<br />&#xA;It can also return null to show no warning. |
56
+ | `isRequired` | `boolean` | | | Indicates if the value is required. Shows an the "required asterisk" if so. |
57
+ | `touched` | `boolean` | | | Indicates whether the field was touched. Errors will only be shown when the field was touched. |
58
+ | `name` | `string` | | | Used as HTML name of the input component. |
59
+ | `value` | `Array: string[]` | ✅ | | The selected date range. Must either be an empty array or an array of two strings holding dates formatted as "YYYY-MM-DD". |
60
+ | `onChange` | `Function`<br/>[See signature.](#signature-onchange) | | | Called when the date range changes, with an event containing either an empty array (no value) or an array holding two string in this format: "YYYY-MM-DD".&#xA;<br/>&#xA;Required when input is not read only. |
61
+ | `onBlur` | `Function`<br/>[See signature.](#signature-onblur) | | | Called when input is blurred |
62
+ | `onFocus` | `Function`<br/>[See signature.](#signature-onfocus) | | | Called when input is focused |
63
+ | `isDisabled` | `boolean` | | | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
64
+ | `isReadOnly` | `boolean` | | | Indicates that the field is displaying read-only content |
65
+ | `placeholder` | `string` | | | Placeholder text for the input |
66
+ | `isCondensed` | `boolean` | | | Use this property to reduce the paddings of the component for a ui compact variant |
67
+ | `title` | `union`<br/>Possible values:<br/>`string , ReactNode` | ✅ | | Title of the label |
68
+ | `hint` | `union`<br/>Possible values:<br/>`string , 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`. |
69
+ | `description` | `union`<br/>Possible values:<br/>`string , ReactNode` | | | Provides a description for the title. |
70
+ | `onInfoButtonClick` | `Function`<br/>[See signature.](#signature-oninfobuttonclick) | | | Function called when info button is pressed.&#xA;<br />&#xA;Info button will only be visible when this prop is passed. |
71
+ | `hintIcon` | `ReactElement` | | | Icon to be displayed beside the hint text.&#xA;<br />&#xA;Will only get rendered when `hint` is passed as well. |
72
+ | `badge` | `ReactNode` | | | Badge to be displayed beside the label.&#xA;<br />&#xA;Might be used to display additional information about the content of the field (E.g verified email) |
73
+
74
+ ## Signatures
75
+
76
+ ### Signature `renderError`
77
+
78
+ ```ts
79
+ (key: string, error?: boolean) => ReactNode;
80
+ ```
81
+
82
+ ### Signature `renderWarning`
83
+
84
+ ```ts
85
+ (key: string, warning?: boolean) => ReactNode;
86
+ ```
87
+
88
+ ### Signature `onChange`
89
+
90
+ ```ts
91
+ (event: TCustomEvent) => void
92
+ ```
93
+
94
+ ### Signature `onBlur`
95
+
96
+ ```ts
97
+ (event: TCustomEvent) => void
98
+ ```
99
+
100
+ ### Signature `onFocus`
101
+
102
+ ```ts
103
+ (event: TCustomEvent) => void
104
+ ```
105
+
106
+ ### Signature `onInfoButtonClick`
107
+
108
+ ```ts
109
+ () => void
110
+ ```
111
+
112
+ ## `data-*` props
113
+
114
+ The component further forwards all `data-` attributes to the underlying `input` component.
115
+
116
+ ## `errors`
117
+
118
+ This object is a key-value map. The `renderError` prop will be called for each entry with the key and the value. The return value will be rendered inside an `ErrorMessage` component underneath the input.
119
+
120
+ The `DateRangeField` supports some errors out of the box. Return `undefined` from `renderError` for these and the default errors will be shown instead. This prevents consumers from having to reimplement the same error messages for known errors while still keeping the flexibility of showing custom error messages for them.
121
+
122
+ When the `key` is known, and when the value is truthy, and when `renderError` returned `undefined` for that error entry, then the `DateRangeField` will render an appropriate error automatically.
123
+
124
+ Known error keys are:
125
+
126
+ - `missing`: tells the user that this field is required
127
+
128
+ ## Main Functions and use cases are:
129
+
130
+ - Input field for a single date
131
+
132
+ ## Static methods
133
+
134
+ ### `DateRangeField.toFieldErrors`
135
+
136
+ Use this function to convert the Formik `errors` object type to our custom field errors type. This is primarily useful when using TypeScript.
137
+
138
+ ```ts
139
+ type FormValues = {
140
+ myField: string;
141
+ };
142
+
143
+ <DateRangeField
144
+ // ...
145
+ name="my-field"
146
+ errors={DateRangeField.toFieldErrors<FormValues>(formik.errors).myField}
147
+ />;
148
+ ```
@@ -0,0 +1,3 @@
1
+ export * from "./declarations/src/index.js";
2
+ export { default } from "./declarations/src/index.js";
3
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy11aWtpdC1kYXRlLXJhbmdlLWZpZWxkLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
@@ -0,0 +1,191 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
7
+ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
8
+ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
9
+ var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
10
+ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
11
+ var _pt = require('prop-types');
12
+ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
13
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
14
+ var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
15
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
16
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
17
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
18
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
19
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
20
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
21
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
22
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
23
+ var react = require('react');
24
+ var utils = require('@commercetools-uikit/utils');
25
+ var Constraints = require('@commercetools-uikit/constraints');
26
+ var Spacings = require('@commercetools-uikit/spacings');
27
+ var FieldLabel = require('@commercetools-uikit/field-label');
28
+ var DateRangeInput = require('@commercetools-uikit/date-range-input');
29
+ var FieldErrors = require('@commercetools-uikit/field-errors');
30
+ var FieldWarnings = require('@commercetools-uikit/field-warnings');
31
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
32
+
33
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
34
+
35
+ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
36
+ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
37
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
38
+ var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
39
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
40
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
41
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
42
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
43
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
44
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
45
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
46
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
47
+ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
48
+ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
49
+ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
50
+ var DateRangeInput__default = /*#__PURE__*/_interopDefault(DateRangeInput);
51
+ var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
52
+ var FieldWarnings__default = /*#__PURE__*/_interopDefault(FieldWarnings);
53
+
54
+ function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
55
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
56
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
57
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
58
+ const sequentialId = utils.createSequentialId('date-range-field-');
59
+ const hasErrors = errors => {
60
+ var _context;
61
+ return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
62
+ };
63
+ const hasWarnings = warnings => {
64
+ var _context2;
65
+ return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
66
+ };
67
+ let DateRangeField = /*#__PURE__*/function (_Component) {
68
+ function DateRangeField() {
69
+ var _this;
70
+ _classCallCheck(this, DateRangeField);
71
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
72
+ args[_key] = arguments[_key];
73
+ }
74
+ _this = _callSuper(this, DateRangeField, [...args]);
75
+ _this.state = {
76
+ // We generate an id in case no id is provided by the parent to attach the
77
+ // label to the input component.
78
+ id: _this.props.id
79
+ };
80
+ return _this;
81
+ }
82
+ _inherits(DateRangeField, _Component);
83
+ return _createClass(DateRangeField, [{
84
+ key: "render",
85
+ value: function render() {
86
+ const hasError = this.props.touched && hasErrors(this.props.errors);
87
+ const hasWarning = this.props.touched && hasWarnings(this.props.warnings);
88
+ if (!this.props.isReadOnly) {
89
+ process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.onChange === 'function', 'DateRangeField: `onChange` is required when field is not read only.') : void 0;
90
+ }
91
+ if (this.props.hintIcon) {
92
+ process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'DateRangeField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
93
+ }
94
+ const errorsContainerId = `${this.state.id}-errors`;
95
+ const warningsContainerId = `${this.state.id}-warnings`;
96
+ return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
97
+ max: this.props.horizontalConstraint,
98
+ children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
99
+ scale: "xs",
100
+ children: [jsxRuntime.jsx(FieldLabel__default["default"], {
101
+ title: this.props.title,
102
+ hint: this.props.hint,
103
+ description: this.props.description,
104
+ onInfoButtonClick: this.props.onInfoButtonClick,
105
+ hintIcon: this.props.hintIcon,
106
+ badge: this.props.badge,
107
+ hasRequiredIndicator: this.props.isRequired,
108
+ htmlFor: this.state.id
109
+ }), jsxRuntime.jsx(DateRangeInput__default["default"], _objectSpread(_objectSpread({
110
+ id: this.state.id,
111
+ name: this.props.name,
112
+ value: this.props.value,
113
+ onChange: this.props.onChange,
114
+ onFocus: this.props.onFocus,
115
+ onBlur: this.props.onBlur,
116
+ isCondensed: this.props.isCondensed,
117
+ isDisabled: this.props.isDisabled,
118
+ isReadOnly: this.props.isReadOnly,
119
+ hasError: hasError,
120
+ hasWarning: hasWarning,
121
+ placeholder: this.props.placeholder,
122
+ horizontalConstraint: "scale"
123
+ }, utils.filterDataAttributes(this.props)), {}, {
124
+ "aria-invalid": hasError,
125
+ "aria-errormessage": errorsContainerId
126
+ })), jsxRuntime.jsx(FieldErrors__default["default"], {
127
+ id: errorsContainerId,
128
+ errors: this.props.errors,
129
+ isVisible: hasError,
130
+ renderError: this.props.renderError
131
+ }), jsxRuntime.jsx(FieldWarnings__default["default"], {
132
+ id: warningsContainerId,
133
+ warnings: this.props.warnings,
134
+ isVisible: hasWarning,
135
+ renderWarning: this.props.renderWarning
136
+ })]
137
+ })
138
+ });
139
+ }
140
+ }], [{
141
+ key: "toFieldErrors",
142
+ value:
143
+ /**
144
+ * Use this function to convert the Formik `errors` object type to
145
+ * our custom field errors type.
146
+ * This is primarly useful when using TypeScript.
147
+ */
148
+ function toFieldErrors(errors) {
149
+ return errors;
150
+ }
151
+ }]);
152
+ }(react.Component);
153
+ DateRangeField.displayName = 'DateRangeField';
154
+ DateRangeField.defaultProps = {
155
+ horizontalConstraint: 'scale'
156
+ };
157
+ DateRangeField.getDerivedStateFromProps = (props, state) => ({
158
+ id: utils.getFieldId(props, state, sequentialId)
159
+ });
160
+ DateRangeField.propTypes = process.env.NODE_ENV !== "production" ? {
161
+ id: _pt__default["default"].string,
162
+ horizontalConstraint: _pt__default["default"].oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
163
+ errors: _pt__default["default"].objectOf(_pt__default["default"].bool),
164
+ renderError: _pt__default["default"].func,
165
+ warnings: _pt__default["default"].objectOf(_pt__default["default"].bool),
166
+ renderWarning: _pt__default["default"].func,
167
+ isRequired: _pt__default["default"].bool,
168
+ touched: _pt__default["default"].bool,
169
+ name: _pt__default["default"].string,
170
+ value: _pt__default["default"].arrayOf(_pt__default["default"].string).isRequired,
171
+ onChange: _pt__default["default"].func,
172
+ onBlur: _pt__default["default"].func,
173
+ onFocus: _pt__default["default"].func,
174
+ isDisabled: _pt__default["default"].bool,
175
+ isReadOnly: _pt__default["default"].bool,
176
+ placeholder: _pt__default["default"].string,
177
+ isCondensed: _pt__default["default"].bool,
178
+ title: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]).isRequired,
179
+ hint: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
180
+ description: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
181
+ onInfoButtonClick: _pt__default["default"].func,
182
+ hintIcon: _pt__default["default"].element,
183
+ badge: _pt__default["default"].node
184
+ } : {};
185
+ var DateRangeField$1 = DateRangeField;
186
+
187
+ // NOTE: This string will be replaced on build time with the package version.
188
+ var version = "19.25.1";
189
+
190
+ exports["default"] = DateRangeField$1;
191
+ exports.version = version;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./commercetools-uikit-date-range-field.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./commercetools-uikit-date-range-field.cjs.dev.js");
7
+ }
@@ -0,0 +1,162 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
7
+ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
8
+ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
9
+ var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
10
+ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
11
+ require('prop-types');
12
+ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
13
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
14
+ var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
15
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
16
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
17
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
18
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
19
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
20
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
21
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
22
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
23
+ var react = require('react');
24
+ var utils = require('@commercetools-uikit/utils');
25
+ var Constraints = require('@commercetools-uikit/constraints');
26
+ var Spacings = require('@commercetools-uikit/spacings');
27
+ var FieldLabel = require('@commercetools-uikit/field-label');
28
+ var DateRangeInput = require('@commercetools-uikit/date-range-input');
29
+ var FieldErrors = require('@commercetools-uikit/field-errors');
30
+ var FieldWarnings = require('@commercetools-uikit/field-warnings');
31
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
32
+
33
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
34
+
35
+ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
36
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
37
+ var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
38
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
39
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
40
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
41
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
42
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
43
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
44
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
45
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
46
+ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
47
+ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
48
+ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
49
+ var DateRangeInput__default = /*#__PURE__*/_interopDefault(DateRangeInput);
50
+ var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
51
+ var FieldWarnings__default = /*#__PURE__*/_interopDefault(FieldWarnings);
52
+
53
+ function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
55
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
56
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
57
+ const sequentialId = utils.createSequentialId('date-range-field-');
58
+ const hasErrors = errors => {
59
+ var _context;
60
+ return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
61
+ };
62
+ const hasWarnings = warnings => {
63
+ var _context2;
64
+ return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
65
+ };
66
+ let DateRangeField = /*#__PURE__*/function (_Component) {
67
+ function DateRangeField() {
68
+ var _this;
69
+ _classCallCheck(this, DateRangeField);
70
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
71
+ args[_key] = arguments[_key];
72
+ }
73
+ _this = _callSuper(this, DateRangeField, [...args]);
74
+ _this.state = {
75
+ // We generate an id in case no id is provided by the parent to attach the
76
+ // label to the input component.
77
+ id: _this.props.id
78
+ };
79
+ return _this;
80
+ }
81
+ _inherits(DateRangeField, _Component);
82
+ return _createClass(DateRangeField, [{
83
+ key: "render",
84
+ value: function render() {
85
+ const hasError = this.props.touched && hasErrors(this.props.errors);
86
+ const hasWarning = this.props.touched && hasWarnings(this.props.warnings);
87
+ if (!this.props.isReadOnly) ;
88
+ if (this.props.hintIcon) ;
89
+ const errorsContainerId = `${this.state.id}-errors`;
90
+ const warningsContainerId = `${this.state.id}-warnings`;
91
+ return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
92
+ max: this.props.horizontalConstraint,
93
+ children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
94
+ scale: "xs",
95
+ children: [jsxRuntime.jsx(FieldLabel__default["default"], {
96
+ title: this.props.title,
97
+ hint: this.props.hint,
98
+ description: this.props.description,
99
+ onInfoButtonClick: this.props.onInfoButtonClick,
100
+ hintIcon: this.props.hintIcon,
101
+ badge: this.props.badge,
102
+ hasRequiredIndicator: this.props.isRequired,
103
+ htmlFor: this.state.id
104
+ }), jsxRuntime.jsx(DateRangeInput__default["default"], _objectSpread(_objectSpread({
105
+ id: this.state.id,
106
+ name: this.props.name,
107
+ value: this.props.value,
108
+ onChange: this.props.onChange,
109
+ onFocus: this.props.onFocus,
110
+ onBlur: this.props.onBlur,
111
+ isCondensed: this.props.isCondensed,
112
+ isDisabled: this.props.isDisabled,
113
+ isReadOnly: this.props.isReadOnly,
114
+ hasError: hasError,
115
+ hasWarning: hasWarning,
116
+ placeholder: this.props.placeholder,
117
+ horizontalConstraint: "scale"
118
+ }, utils.filterDataAttributes(this.props)), {}, {
119
+ "aria-invalid": hasError,
120
+ "aria-errormessage": errorsContainerId
121
+ })), jsxRuntime.jsx(FieldErrors__default["default"], {
122
+ id: errorsContainerId,
123
+ errors: this.props.errors,
124
+ isVisible: hasError,
125
+ renderError: this.props.renderError
126
+ }), jsxRuntime.jsx(FieldWarnings__default["default"], {
127
+ id: warningsContainerId,
128
+ warnings: this.props.warnings,
129
+ isVisible: hasWarning,
130
+ renderWarning: this.props.renderWarning
131
+ })]
132
+ })
133
+ });
134
+ }
135
+ }], [{
136
+ key: "toFieldErrors",
137
+ value:
138
+ /**
139
+ * Use this function to convert the Formik `errors` object type to
140
+ * our custom field errors type.
141
+ * This is primarly useful when using TypeScript.
142
+ */
143
+ function toFieldErrors(errors) {
144
+ return errors;
145
+ }
146
+ }]);
147
+ }(react.Component);
148
+ DateRangeField.displayName = 'DateRangeField';
149
+ DateRangeField.defaultProps = {
150
+ horizontalConstraint: 'scale'
151
+ };
152
+ DateRangeField.getDerivedStateFromProps = (props, state) => ({
153
+ id: utils.getFieldId(props, state, sequentialId)
154
+ });
155
+ DateRangeField.propTypes = {};
156
+ var DateRangeField$1 = DateRangeField;
157
+
158
+ // NOTE: This string will be replaced on build time with the package version.
159
+ var version = "19.25.1";
160
+
161
+ exports["default"] = DateRangeField$1;
162
+ exports.version = version;
@@ -0,0 +1,165 @@
1
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
2
+ import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
3
+ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
4
+ import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
5
+ import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
6
+ import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
7
+ import _pt from 'prop-types';
8
+ import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
9
+ import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
10
+ import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
11
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
12
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
13
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
14
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
15
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
16
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
17
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
18
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
19
+ import { isValidElement, Component } from 'react';
20
+ import { createSequentialId, warning, filterDataAttributes, getFieldId } from '@commercetools-uikit/utils';
21
+ import Constraints from '@commercetools-uikit/constraints';
22
+ import Spacings from '@commercetools-uikit/spacings';
23
+ import FieldLabel from '@commercetools-uikit/field-label';
24
+ import DateRangeInput from '@commercetools-uikit/date-range-input';
25
+ import FieldErrors from '@commercetools-uikit/field-errors';
26
+ import FieldWarnings from '@commercetools-uikit/field-warnings';
27
+ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
28
+
29
+ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
31
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
32
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
33
+ const sequentialId = createSequentialId('date-range-field-');
34
+ const hasErrors = errors => {
35
+ var _context;
36
+ return errors && _someInstanceProperty(_context = _Object$values(errors)).call(_context, Boolean);
37
+ };
38
+ const hasWarnings = warnings => {
39
+ var _context2;
40
+ return warnings && _someInstanceProperty(_context2 = _Object$values(warnings)).call(_context2, Boolean);
41
+ };
42
+ let DateRangeField = /*#__PURE__*/function (_Component) {
43
+ function DateRangeField() {
44
+ var _this;
45
+ _classCallCheck(this, DateRangeField);
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
+ args[_key] = arguments[_key];
48
+ }
49
+ _this = _callSuper(this, DateRangeField, [...args]);
50
+ _this.state = {
51
+ // We generate an id in case no id is provided by the parent to attach the
52
+ // label to the input component.
53
+ id: _this.props.id
54
+ };
55
+ return _this;
56
+ }
57
+ _inherits(DateRangeField, _Component);
58
+ return _createClass(DateRangeField, [{
59
+ key: "render",
60
+ value: function render() {
61
+ const hasError = this.props.touched && hasErrors(this.props.errors);
62
+ const hasWarning = this.props.touched && hasWarnings(this.props.warnings);
63
+ if (!this.props.isReadOnly) {
64
+ process.env.NODE_ENV !== "production" ? warning(typeof this.props.onChange === 'function', 'DateRangeField: `onChange` is required when field is not read only.') : void 0;
65
+ }
66
+ if (this.props.hintIcon) {
67
+ process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'DateRangeField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
68
+ }
69
+ const errorsContainerId = `${this.state.id}-errors`;
70
+ const warningsContainerId = `${this.state.id}-warnings`;
71
+ return jsx(Constraints.Horizontal, {
72
+ max: this.props.horizontalConstraint,
73
+ children: jsxs(Spacings.Stack, {
74
+ scale: "xs",
75
+ children: [jsx(FieldLabel, {
76
+ title: this.props.title,
77
+ hint: this.props.hint,
78
+ description: this.props.description,
79
+ onInfoButtonClick: this.props.onInfoButtonClick,
80
+ hintIcon: this.props.hintIcon,
81
+ badge: this.props.badge,
82
+ hasRequiredIndicator: this.props.isRequired,
83
+ htmlFor: this.state.id
84
+ }), jsx(DateRangeInput, _objectSpread(_objectSpread({
85
+ id: this.state.id,
86
+ name: this.props.name,
87
+ value: this.props.value,
88
+ onChange: this.props.onChange,
89
+ onFocus: this.props.onFocus,
90
+ onBlur: this.props.onBlur,
91
+ isCondensed: this.props.isCondensed,
92
+ isDisabled: this.props.isDisabled,
93
+ isReadOnly: this.props.isReadOnly,
94
+ hasError: hasError,
95
+ hasWarning: hasWarning,
96
+ placeholder: this.props.placeholder,
97
+ horizontalConstraint: "scale"
98
+ }, filterDataAttributes(this.props)), {}, {
99
+ "aria-invalid": hasError,
100
+ "aria-errormessage": errorsContainerId
101
+ })), jsx(FieldErrors, {
102
+ id: errorsContainerId,
103
+ errors: this.props.errors,
104
+ isVisible: hasError,
105
+ renderError: this.props.renderError
106
+ }), jsx(FieldWarnings, {
107
+ id: warningsContainerId,
108
+ warnings: this.props.warnings,
109
+ isVisible: hasWarning,
110
+ renderWarning: this.props.renderWarning
111
+ })]
112
+ })
113
+ });
114
+ }
115
+ }], [{
116
+ key: "toFieldErrors",
117
+ value:
118
+ /**
119
+ * Use this function to convert the Formik `errors` object type to
120
+ * our custom field errors type.
121
+ * This is primarly useful when using TypeScript.
122
+ */
123
+ function toFieldErrors(errors) {
124
+ return errors;
125
+ }
126
+ }]);
127
+ }(Component);
128
+ DateRangeField.displayName = 'DateRangeField';
129
+ DateRangeField.defaultProps = {
130
+ horizontalConstraint: 'scale'
131
+ };
132
+ DateRangeField.getDerivedStateFromProps = (props, state) => ({
133
+ id: getFieldId(props, state, sequentialId)
134
+ });
135
+ DateRangeField.propTypes = process.env.NODE_ENV !== "production" ? {
136
+ id: _pt.string,
137
+ horizontalConstraint: _pt.oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
138
+ errors: _pt.objectOf(_pt.bool),
139
+ renderError: _pt.func,
140
+ warnings: _pt.objectOf(_pt.bool),
141
+ renderWarning: _pt.func,
142
+ isRequired: _pt.bool,
143
+ touched: _pt.bool,
144
+ name: _pt.string,
145
+ value: _pt.arrayOf(_pt.string).isRequired,
146
+ onChange: _pt.func,
147
+ onBlur: _pt.func,
148
+ onFocus: _pt.func,
149
+ isDisabled: _pt.bool,
150
+ isReadOnly: _pt.bool,
151
+ placeholder: _pt.string,
152
+ isCondensed: _pt.bool,
153
+ title: _pt.oneOfType([_pt.string, _pt.node]).isRequired,
154
+ hint: _pt.oneOfType([_pt.string, _pt.node]),
155
+ description: _pt.oneOfType([_pt.string, _pt.node]),
156
+ onInfoButtonClick: _pt.func,
157
+ hintIcon: _pt.element,
158
+ badge: _pt.node
159
+ } : {};
160
+ var DateRangeField$1 = DateRangeField;
161
+
162
+ // NOTE: This string will be replaced on build time with the package version.
163
+ var version = "19.25.1";
164
+
165
+ export { DateRangeField$1 as default, version };
@@ -0,0 +1,142 @@
1
+ import { Component, type ReactElement, type ReactNode } from 'react';
2
+ import type { MomentInput } from 'moment';
3
+ type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
4
+ type TFieldWarnings = Record<string, boolean>;
5
+ type TFieldErrors = Record<string, boolean>;
6
+ type TCustomFormErrors<Values> = {
7
+ [K in keyof Values]?: TFieldErrors;
8
+ };
9
+ type TCustomEvent = {
10
+ target: {
11
+ id?: string;
12
+ name?: string;
13
+ value?: MomentInput[];
14
+ };
15
+ };
16
+ export type TDateRangeFieldProps = {
17
+ /**
18
+ * Used as HTML id property. An id is auto-generated when it is not specified.
19
+ */
20
+ id?: string;
21
+ /**
22
+ * Horizontal size limit of the input fields.
23
+ */
24
+ horizontalConstraint?: 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
25
+ /**
26
+ * A map of errors. Error messages for known errors are rendered automatically.
27
+ * <br />
28
+ * Unknown errors will be forwarded to `renderError`
29
+ */
30
+ errors?: TFieldErrors;
31
+ /**
32
+ * Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
33
+ */
34
+ renderError?: TErrorRenderer;
35
+ /**
36
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
37
+ * <br/>
38
+ * Unknown warnings will be forwarded to renderWarning.
39
+ */
40
+ warnings?: TFieldWarnings;
41
+ /**
42
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
43
+ * <br />
44
+ * It can also return null to show no warning.
45
+ */
46
+ renderWarning?: (key: string, warning?: boolean) => ReactNode;
47
+ /**
48
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
49
+ */
50
+ isRequired?: boolean;
51
+ /**
52
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
53
+ */
54
+ touched?: boolean;
55
+ /**
56
+ * Used as HTML name of the input component.
57
+ */
58
+ name?: string;
59
+ /**
60
+ * The selected date range. Must either be an empty array or an array of two strings holding dates formatted as "YYYY-MM-DD".
61
+ */
62
+ value: string[];
63
+ /**
64
+ * Called when the date range changes, with an event containing either an empty array (no value) or an array holding two string in this format: "YYYY-MM-DD".
65
+ * <br/>
66
+ * Required when input is not read only.
67
+ */
68
+ onChange?: (event: TCustomEvent) => void;
69
+ /**
70
+ * Called when input is blurred
71
+ */
72
+ onBlur?: (event: TCustomEvent) => void;
73
+ /**
74
+ * Called when input is focused
75
+ */
76
+ onFocus?: (event: TCustomEvent) => void;
77
+ /**
78
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
79
+ */
80
+ isDisabled?: boolean;
81
+ /**
82
+ * Indicates that the field is displaying read-only content
83
+ */
84
+ isReadOnly?: boolean;
85
+ /**
86
+ * Placeholder text for the input
87
+ */
88
+ placeholder?: string;
89
+ /**
90
+ * Use this property to reduce the paddings of the component for a ui compact variant
91
+ */
92
+ isCondensed?: boolean;
93
+ /**
94
+ * Title of the label
95
+ */
96
+ title: string | ReactNode;
97
+ /**
98
+ * 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`.
99
+ */
100
+ hint?: string | ReactNode;
101
+ /**
102
+ * Provides a description for the title.
103
+ */
104
+ description?: string | ReactNode;
105
+ /**
106
+ * Function called when info button is pressed.
107
+ * <br />
108
+ * Info button will only be visible when this prop is passed.
109
+ */
110
+ onInfoButtonClick?: () => void;
111
+ /**
112
+ * Icon to be displayed beside the hint text.
113
+ * <br />
114
+ * Will only get rendered when `hint` is passed as well.
115
+ */
116
+ hintIcon?: ReactElement;
117
+ /**
118
+ * Badge to be displayed beside the label.
119
+ * <br />
120
+ * Might be used to display additional information about the content of the field (E.g verified email)
121
+ */
122
+ badge?: ReactNode;
123
+ };
124
+ type TDateRangeFieldState = Pick<TDateRangeFieldProps, 'id'>;
125
+ declare class DateRangeField extends Component<TDateRangeFieldProps, TDateRangeFieldState> {
126
+ static displayName: string;
127
+ static defaultProps: Pick<TDateRangeFieldProps, 'horizontalConstraint'>;
128
+ state: {
129
+ id: string | undefined;
130
+ };
131
+ static getDerivedStateFromProps: (props: TDateRangeFieldProps, state: TDateRangeFieldState) => {
132
+ id: string;
133
+ };
134
+ /**
135
+ * Use this function to convert the Formik `errors` object type to
136
+ * our custom field errors type.
137
+ * This is primarly useful when using TypeScript.
138
+ */
139
+ static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
140
+ render(): import("@emotion/react/jsx-runtime").JSX.Element;
141
+ }
142
+ export default DateRangeField;
@@ -0,0 +1 @@
1
+ export type { TDateRangeFieldProps } from "./date-range-field.js";
@@ -0,0 +1,3 @@
1
+ export { default } from "./date-range-field.js";
2
+ export { default as version } from "./version.js";
3
+ export * from "./export-types.js";
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@commercetools-uikit/date-range-field",
3
+ "description": "A controlled date input component for a date range, with validation states and a label.",
4
+ "version": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
5
+ "bugs": "https://github.com/commercetools/ui-kit/issues",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/commercetools/ui-kit.git",
9
+ "directory": "packages/components/fields/date-range-field"
10
+ },
11
+ "homepage": "https://uikit.commercetools.com",
12
+ "keywords": [
13
+ "javascript",
14
+ "typescript",
15
+ "design-system",
16
+ "react",
17
+ "uikit"
18
+ ],
19
+ "license": "MIT",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "sideEffects": false,
24
+ "main": "dist/commercetools-uikit-date-range-field.cjs.js",
25
+ "module": "dist/commercetools-uikit-date-range-field.esm.js",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "dependencies": {
30
+ "@babel/runtime": "^7.20.13",
31
+ "@babel/runtime-corejs3": "^7.20.13",
32
+ "@commercetools-uikit/constraints": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
33
+ "@commercetools-uikit/date-range-input": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
34
+ "@commercetools-uikit/design-system": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
35
+ "@commercetools-uikit/field-errors": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
36
+ "@commercetools-uikit/field-label": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
37
+ "@commercetools-uikit/field-warnings": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
38
+ "@commercetools-uikit/spacings": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
39
+ "@commercetools-uikit/utils": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
40
+ "@emotion/react": "^11.10.5",
41
+ "@emotion/styled": "^11.10.5",
42
+ "prop-types": "15.8.1",
43
+ "react-intl": "^6.3.2"
44
+ },
45
+ "devDependencies": {
46
+ "react": "17.0.2"
47
+ },
48
+ "peerDependencies": {
49
+ "react": "17.x"
50
+ }
51
+ }