@atlaskit/datetime-picker 13.11.2 → 14.0.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/CHANGELOG.md +19 -0
- package/codemods/14.0.0-remove-duplicate-and-unused-props.tsx +432 -0
- package/codemods/__tests__/next-remove-duplicate-and-unused-props.tsx +1225 -0
- package/codemods/utils/helpers.tsx +306 -0
- package/dist/cjs/components/date-picker.js +22 -24
- package/dist/cjs/components/date-time-picker.js +73 -68
- package/dist/cjs/components/time-picker.js +13 -11
- package/dist/es2019/components/date-picker.js +21 -22
- package/dist/es2019/components/date-time-picker.js +66 -72
- package/dist/es2019/components/time-picker.js +13 -14
- package/dist/esm/components/date-picker.js +22 -24
- package/dist/esm/components/date-time-picker.js +73 -68
- package/dist/esm/components/time-picker.js +13 -11
- package/dist/types/components/date-picker.d.ts +2 -12
- package/dist/types/components/date-time-picker.d.ts +3 -6
- package/dist/types/components/time-picker.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +43 -31
- package/dist/types-ts4.5/components/date-picker.d.ts +2 -12
- package/dist/types-ts4.5/components/date-time-picker.d.ts +3 -6
- package/dist/types-ts4.5/components/time-picker.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +43 -31
- package/package.json +6 -5
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ASTPath,
|
|
3
|
+
CallExpression,
|
|
4
|
+
default as core,
|
|
5
|
+
Identifier,
|
|
6
|
+
ImportDeclaration,
|
|
7
|
+
ImportSpecifier,
|
|
8
|
+
JSCodeshift,
|
|
9
|
+
JSXAttribute,
|
|
10
|
+
JSXElement,
|
|
11
|
+
ObjectProperty,
|
|
12
|
+
StringLiteral,
|
|
13
|
+
} from 'jscodeshift';
|
|
14
|
+
import { type Collection } from 'jscodeshift/src/Collection';
|
|
15
|
+
|
|
16
|
+
import { addCommentToStartOfFile, getNamedSpecifier } from '@atlaskit/codemod-utils';
|
|
17
|
+
|
|
18
|
+
export function hasImportDeclaration(
|
|
19
|
+
j: JSCodeshift,
|
|
20
|
+
collection: Collection<any>,
|
|
21
|
+
importPath: string,
|
|
22
|
+
) {
|
|
23
|
+
return getImportDeclarationCollection(j, collection, importPath).length > 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getImportDeclarationCollection(
|
|
27
|
+
j: JSCodeshift,
|
|
28
|
+
collection: Collection<any>,
|
|
29
|
+
importPath: string,
|
|
30
|
+
) {
|
|
31
|
+
return collection
|
|
32
|
+
.find(j.ImportDeclaration)
|
|
33
|
+
.filter((importDeclarationPath) => importDeclarationPath.node.source.value === importPath);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function hasDynamicImport(j: JSCodeshift, collection: Collection<any>, importPath: string) {
|
|
37
|
+
return getDynamicImportCollection(j, collection, importPath).length > 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getDynamicImportCollection(
|
|
41
|
+
j: JSCodeshift,
|
|
42
|
+
collection: Collection<any>,
|
|
43
|
+
importPath: string,
|
|
44
|
+
) {
|
|
45
|
+
return collection.find(j.CallExpression).filter((callExpressionPath) => {
|
|
46
|
+
const { callee, arguments: callExpressionArguments } = callExpressionPath.node;
|
|
47
|
+
|
|
48
|
+
return !!(
|
|
49
|
+
isCallExpressionCalleeImportType(callee) &&
|
|
50
|
+
isCallExpressionArgumentStringLiteralType(callExpressionArguments) &&
|
|
51
|
+
isCallExpressionArgumentValueMatches(callExpressionArguments[0], j, importPath)
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function isCallExpressionCalleeImportType(callee: CallExpression['callee']) {
|
|
56
|
+
return callee && callee.type === 'Import';
|
|
57
|
+
}
|
|
58
|
+
function isCallExpressionArgumentStringLiteralType(
|
|
59
|
+
callExpressionArguments: CallExpression['arguments'],
|
|
60
|
+
) {
|
|
61
|
+
return (
|
|
62
|
+
callExpressionArguments &&
|
|
63
|
+
callExpressionArguments.length &&
|
|
64
|
+
callExpressionArguments[0].type === 'StringLiteral'
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function isCallExpressionArgumentValueMatches(
|
|
68
|
+
callExpressionArgument: CallExpression['arguments'][0],
|
|
69
|
+
j: JSCodeshift,
|
|
70
|
+
value: string,
|
|
71
|
+
) {
|
|
72
|
+
return j(callExpressionArgument).some((path) => path.node.value === value);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function getImportSpecifierCollection(
|
|
76
|
+
j: JSCodeshift,
|
|
77
|
+
importDeclarationCollection: Collection<ImportDeclaration>,
|
|
78
|
+
importName: string,
|
|
79
|
+
) {
|
|
80
|
+
return importDeclarationCollection
|
|
81
|
+
.find(j.ImportSpecifier)
|
|
82
|
+
.filter((importSpecifierPath) => importSpecifierPath.node.imported.name === importName);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function getImportSpecifierName(importSpecifierCollection: Collection<ImportSpecifier>) {
|
|
86
|
+
if (importSpecifierCollection.length === 0) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return importSpecifierCollection.nodes()[0]!.local!.name;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function isVariableDeclaratorIdentifierPresent(
|
|
94
|
+
j: JSCodeshift,
|
|
95
|
+
collection: Collection<any>,
|
|
96
|
+
variableName: string,
|
|
97
|
+
) {
|
|
98
|
+
return collection
|
|
99
|
+
.find(j.VariableDeclaration)
|
|
100
|
+
.find(j.VariableDeclarator)
|
|
101
|
+
.some((variableDeclaratorPath) => {
|
|
102
|
+
const { id } = variableDeclaratorPath.node;
|
|
103
|
+
|
|
104
|
+
return !!(id && id.type === 'Identifier' && (id as Identifier).name === variableName);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function isFunctionDeclarationIdentifierPresent(
|
|
109
|
+
j: JSCodeshift,
|
|
110
|
+
collection: Collection<any>,
|
|
111
|
+
variableName: string,
|
|
112
|
+
) {
|
|
113
|
+
return collection.find(j.FunctionDeclaration).some((functionDeclarationPath) => {
|
|
114
|
+
const { id } = functionDeclarationPath.node;
|
|
115
|
+
|
|
116
|
+
return !!(id && id.type === 'Identifier' && (id as Identifier).name === variableName);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function isClassDeclarationIdentifierPresent(
|
|
121
|
+
j: JSCodeshift,
|
|
122
|
+
collection: Collection<any>,
|
|
123
|
+
variableName: string,
|
|
124
|
+
) {
|
|
125
|
+
return collection.find(j.ClassDeclaration).some((classDeclarationPath) => {
|
|
126
|
+
const { id } = classDeclarationPath.node;
|
|
127
|
+
|
|
128
|
+
return !!(id && id.type === 'Identifier' && (id as Identifier).name === variableName);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function isImportDeclarationIdentifierPresent(
|
|
133
|
+
j: JSCodeshift,
|
|
134
|
+
collection: Collection<any>,
|
|
135
|
+
variableName: string,
|
|
136
|
+
) {
|
|
137
|
+
return collection
|
|
138
|
+
.find(j.ImportDeclaration)
|
|
139
|
+
.find(j.Identifier)
|
|
140
|
+
.some((identifierPath) => identifierPath.node.name === variableName);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function getJSXAttributesByName(
|
|
144
|
+
j: JSCodeshift,
|
|
145
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
146
|
+
attributeName: string,
|
|
147
|
+
): Collection<JSXAttribute> {
|
|
148
|
+
return j(jsxElementPath)
|
|
149
|
+
.find(j.JSXOpeningElement)
|
|
150
|
+
.find(j.JSXAttribute)
|
|
151
|
+
.filter((jsxAttributePath) =>
|
|
152
|
+
j(jsxAttributePath)
|
|
153
|
+
.find(j.JSXIdentifier)
|
|
154
|
+
.some((jsxIdentifierPath) => jsxIdentifierPath.node.name === attributeName),
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function getJSXSpreadIdentifierAttributesByName(
|
|
159
|
+
j: JSCodeshift,
|
|
160
|
+
collection: Collection<any>,
|
|
161
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
162
|
+
attributeName: string,
|
|
163
|
+
): Collection<ObjectProperty> | null {
|
|
164
|
+
const identifierCollection = j(jsxElementPath)
|
|
165
|
+
.find(j.JSXOpeningElement)
|
|
166
|
+
.find(j.JSXSpreadAttribute)
|
|
167
|
+
.filter((jsxSpreadAttributePath) => jsxSpreadAttributePath.node.argument.type === 'Identifier')
|
|
168
|
+
.find(j.Identifier);
|
|
169
|
+
|
|
170
|
+
if (identifierCollection.length === 0) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return collection
|
|
175
|
+
.find(j.VariableDeclarator)
|
|
176
|
+
.filter((variableDeclaratorPath) => {
|
|
177
|
+
const { id } = variableDeclaratorPath.node;
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
id.type === 'Identifier' &&
|
|
181
|
+
identifierCollection.some((identifierPath) => identifierPath.node.name === id.name)
|
|
182
|
+
);
|
|
183
|
+
})
|
|
184
|
+
.find(j.ObjectExpression)
|
|
185
|
+
.find(j.ObjectProperty)
|
|
186
|
+
.filter((objectPropertyPath) =>
|
|
187
|
+
j(objectPropertyPath)
|
|
188
|
+
.find(j.Identifier)
|
|
189
|
+
.some((identifierPath) => identifierPath.node.name === attributeName),
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function getJSXSpreadObjectExpressionAttributesByName(
|
|
194
|
+
j: JSCodeshift,
|
|
195
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
196
|
+
attributeName: string,
|
|
197
|
+
) {
|
|
198
|
+
return j(jsxElementPath)
|
|
199
|
+
.find(j.JSXOpeningElement)
|
|
200
|
+
.find(j.JSXSpreadAttribute)
|
|
201
|
+
.find(j.ObjectExpression)
|
|
202
|
+
.find(j.ObjectProperty)
|
|
203
|
+
.filter((objectPropertyPath) =>
|
|
204
|
+
j(objectPropertyPath)
|
|
205
|
+
.find(j.Identifier)
|
|
206
|
+
.some((identifierPath) => identifierPath.node.name === attributeName),
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const createRemoveFuncFor =
|
|
211
|
+
(component: string, importName: string, prop: string, comment?: string) =>
|
|
212
|
+
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
213
|
+
const specifier = getNamedSpecifier(j, source, component, importName);
|
|
214
|
+
|
|
215
|
+
if (!specifier) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
220
|
+
getJSXAttributesByName(j, element, prop).forEach((attribute: any) => {
|
|
221
|
+
j(attribute).remove();
|
|
222
|
+
if (comment) {
|
|
223
|
+
addCommentToStartOfFile({ j, base: source, message: comment });
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export const getJSXAttributeByName = (
|
|
230
|
+
j: JSCodeshift,
|
|
231
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
232
|
+
attributeName: string,
|
|
233
|
+
): JSXAttribute | undefined => {
|
|
234
|
+
const attributes: JSXAttribute[] = j(jsxElementPath).find(j.JSXAttribute).nodes();
|
|
235
|
+
|
|
236
|
+
return attributes?.find((attr) => attr.name && attr.name.name === attributeName);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const addJSXAttributeToJSXElement = (
|
|
240
|
+
j: JSCodeshift,
|
|
241
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
242
|
+
jsxAttribute: JSXAttribute,
|
|
243
|
+
) => {
|
|
244
|
+
j(jsxElementPath)
|
|
245
|
+
.find(j.JSXOpeningElement)
|
|
246
|
+
.forEach((openingElement) => {
|
|
247
|
+
openingElement.node.attributes?.push(jsxAttribute);
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const removeJSXAttributeByName = (
|
|
252
|
+
j: JSCodeshift,
|
|
253
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
254
|
+
attrName: string,
|
|
255
|
+
) => {
|
|
256
|
+
const attributes = getJSXAttributes(jsxElementPath);
|
|
257
|
+
const attr = getJSXAttributeByName(j, jsxElementPath, attrName);
|
|
258
|
+
if (attr) {
|
|
259
|
+
attributes?.splice(attributes.indexOf(attr), 1);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export const getJSXAttributes = (jsxElementPath: ASTPath<JSXElement>) =>
|
|
264
|
+
jsxElementPath.node.openingElement.attributes as JSXAttribute[];
|
|
265
|
+
|
|
266
|
+
export const removeJSXAttributeObjectPropertyByName = (
|
|
267
|
+
j: JSCodeshift,
|
|
268
|
+
jsxElementPath: ASTPath<JSXElement>,
|
|
269
|
+
attrName: string,
|
|
270
|
+
propertyToRemove: string,
|
|
271
|
+
) => {
|
|
272
|
+
const attr = getJSXAttributeByName(j, jsxElementPath, attrName);
|
|
273
|
+
|
|
274
|
+
if (!attr) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const attrCollection = getJSXAttributesByName(j, jsxElementPath, attrName);
|
|
279
|
+
|
|
280
|
+
const removeMatchingNodes = (p: ASTPath<Identifier | StringLiteral>) => {
|
|
281
|
+
const name = p.node.type === 'Identifier' ? p.node?.name : p.node?.value;
|
|
282
|
+
// Need to account for quoted properties
|
|
283
|
+
const nameMatches = propertyToRemove.match(new RegExp(`['"]?${name}['"]?`));
|
|
284
|
+
// This will otherwise try to remove values of properties since they are literals
|
|
285
|
+
const isKey = p.parent.value?.type === 'ObjectProperty';
|
|
286
|
+
// Sorry about all the parents. This is the easiest way to get the name
|
|
287
|
+
// of the attribute name. And I always know the depth of the object
|
|
288
|
+
// property here.
|
|
289
|
+
const parentNameMatches = attrName === p.parent.parent.parent.parent.node?.name?.name;
|
|
290
|
+
if (isKey && nameMatches && parentNameMatches) {
|
|
291
|
+
j(p.parent).remove();
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Remove all the now migrated object properties
|
|
296
|
+
const objectProperties = attrCollection.find(j.ObjectProperty);
|
|
297
|
+
objectProperties.find(j.Identifier).forEach(removeMatchingNodes);
|
|
298
|
+
objectProperties.find(j.StringLiteral).forEach(removeMatchingNodes);
|
|
299
|
+
|
|
300
|
+
// @ts-ignore -- Property 'expression' does not exist on type 'LiteralKind | JSXElement | JSXExpressionContainer | JSXFragment'. Property 'expression' does not exist on type 'Literal'.
|
|
301
|
+
const attrProperties = attr.value?.expression.properties;
|
|
302
|
+
|
|
303
|
+
if (attrProperties && attrProperties?.length === 0) {
|
|
304
|
+
removeJSXAttributeByName(j, jsxElementPath, attrName);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
@@ -18,7 +18,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
18
18
|
var _react = require("react");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
20
|
var _dateFns = require("date-fns");
|
|
21
|
-
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
22
21
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
23
22
|
var _calendar = _interopRequireDefault(require("@atlaskit/icon/glyph/calendar"));
|
|
24
23
|
var _locale = require("@atlaskit/locale");
|
|
@@ -38,7 +37,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
38
37
|
* @jsx jsx
|
|
39
38
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
40
39
|
var packageName = "@atlaskit/datetime-picker";
|
|
41
|
-
var packageVersion = "
|
|
40
|
+
var packageVersion = "14.0.0";
|
|
42
41
|
var datePickerDefaultProps = {
|
|
43
42
|
appearance: 'default',
|
|
44
43
|
autoFocus: false,
|
|
@@ -80,8 +79,13 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
80
79
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "containerRef", null);
|
|
81
80
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
82
81
|
// correctly to allow controlled/uncontrolled usage.
|
|
83
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
84
|
-
|
|
82
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getValue", function () {
|
|
83
|
+
var _this$props$value;
|
|
84
|
+
return (_this$props$value = _this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : _this.state.value;
|
|
85
|
+
});
|
|
86
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getIsOpen", function () {
|
|
87
|
+
var _this$props$isOpen;
|
|
88
|
+
return (_this$props$isOpen = _this.props.isOpen) !== null && _this$props$isOpen !== void 0 ? _this$props$isOpen : _this.state.isOpen;
|
|
85
89
|
});
|
|
86
90
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDateDisabled", function (date) {
|
|
87
91
|
return _this.props.disabled.indexOf(date) > -1;
|
|
@@ -131,7 +135,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
131
135
|
});
|
|
132
136
|
});
|
|
133
137
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputClick", function () {
|
|
134
|
-
if (!_this.props.isDisabled && !_this.
|
|
138
|
+
if (!_this.props.isDisabled && !_this.getIsOpen()) {
|
|
135
139
|
_this.setState({
|
|
136
140
|
isOpen: true
|
|
137
141
|
});
|
|
@@ -156,7 +160,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
156
160
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectBlur", function (event) {
|
|
157
161
|
var _this$containerRef3;
|
|
158
162
|
var newlyFocusedElement = event.relatedTarget;
|
|
159
|
-
if (_this.
|
|
163
|
+
if (_this.state.clearingFromIcon) {
|
|
160
164
|
// Don't close menu if blurring after the user has clicked clear
|
|
161
165
|
_this.setState({
|
|
162
166
|
clearingFromIcon: false
|
|
@@ -171,9 +175,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
171
175
|
}
|
|
172
176
|
});
|
|
173
177
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectFocus", function (event) {
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
value = _this$getSafeState.value;
|
|
178
|
+
var clearingFromIcon = _this.state.clearingFromIcon;
|
|
179
|
+
var value = _this.getValue();
|
|
177
180
|
if (clearingFromIcon) {
|
|
178
181
|
// Don't open menu if focussing after the user has clicked clear
|
|
179
182
|
_this.setState({
|
|
@@ -207,9 +210,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
207
210
|
});
|
|
208
211
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputKeyDown", function (event) {
|
|
209
212
|
var _this$containerRef4;
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
calendarValue = _this$getSafeState2.calendarValue;
|
|
213
|
+
var calendarValue = _this.state.calendarValue;
|
|
214
|
+
var value = _this.getValue();
|
|
213
215
|
var keyPressed = event.key.toLowerCase();
|
|
214
216
|
|
|
215
217
|
// If the input is focused and the calendar is not visible, handle space and enter clicks
|
|
@@ -337,8 +339,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
337
339
|
if (parseInputValue) {
|
|
338
340
|
return parseInputValue(date, dateFormat || _internal.defaultDateFormat);
|
|
339
341
|
}
|
|
340
|
-
var
|
|
341
|
-
l10n = _this$getSafeState3.l10n;
|
|
342
|
+
var l10n = _this.state.l10n;
|
|
342
343
|
return l10n.parseDate(date);
|
|
343
344
|
});
|
|
344
345
|
/**
|
|
@@ -352,8 +353,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
352
353
|
var _this$props2 = _this.props,
|
|
353
354
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
354
355
|
dateFormat = _this$props2.dateFormat;
|
|
355
|
-
var
|
|
356
|
-
l10n = _this$getSafeState4.l10n;
|
|
356
|
+
var l10n = _this.state.l10n;
|
|
357
357
|
if (formatDisplayLabel) {
|
|
358
358
|
return formatDisplayLabel(value, dateFormat || _internal.defaultDateFormat);
|
|
359
359
|
}
|
|
@@ -365,8 +365,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
365
365
|
if (placeholder) {
|
|
366
366
|
return placeholder;
|
|
367
367
|
}
|
|
368
|
-
var
|
|
369
|
-
l10n = _this$getSafeState5.l10n;
|
|
368
|
+
var l10n = _this.state.l10n;
|
|
370
369
|
return l10n.formatDate(_internal.placeholderDatetime);
|
|
371
370
|
});
|
|
372
371
|
_this.state = {
|
|
@@ -408,14 +407,13 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
408
407
|
locale = _this$props3.locale,
|
|
409
408
|
testId = _this$props3.testId,
|
|
410
409
|
weekStartDay = _this$props3.weekStartDay;
|
|
411
|
-
var _this$
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
selectInputValue = _this$getSafeState6.selectInputValue;
|
|
410
|
+
var _this$state = this.state,
|
|
411
|
+
calendarValue = _this$state.calendarValue,
|
|
412
|
+
selectInputValue = _this$state.selectInputValue;
|
|
413
|
+
var value = this.getValue();
|
|
416
414
|
var actualSelectInputValue;
|
|
417
415
|
actualSelectInputValue = selectInputValue;
|
|
418
|
-
var menuIsOpen =
|
|
416
|
+
var menuIsOpen = this.getIsOpen() && !isDisabled;
|
|
419
417
|
var showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
|
|
420
418
|
var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
|
|
421
419
|
var SingleValue = (0, _singleValue.makeSingleValue)({
|