@atlaskit/datetime-picker 13.11.3 → 14.0.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.
- 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 +1 -1
- package/dist/cjs/components/date-time-picker.js +24 -25
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/es2019/components/date-picker.js +1 -1
- package/dist/es2019/components/date-time-picker.js +24 -26
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-time-picker.js +24 -25
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/types/components/date-time-picker.d.ts +1 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +47 -31
- package/dist/types-ts4.5/components/date-time-picker.d.ts +1 -3
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +47 -31
- package/package.json +4 -2
|
@@ -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
|
+
};
|
|
@@ -37,7 +37,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
37
37
|
* @jsx jsx
|
|
38
38
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
39
39
|
var packageName = "@atlaskit/datetime-picker";
|
|
40
|
-
var packageVersion = "
|
|
40
|
+
var packageVersion = "14.0.1";
|
|
41
41
|
var datePickerDefaultProps = {
|
|
42
42
|
appearance: 'default',
|
|
43
43
|
autoFocus: false,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.timePickerDefaultAriaLabel = exports.default = exports.datePickerDefaultAriaLabel = exports.DateTimePickerWithoutAnalytics = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
8
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -24,6 +25,8 @@ var _dateTimePickerContainer = require("../internal/date-time-picker-container")
|
|
|
24
25
|
var _parseTokens = require("../internal/parse-tokens");
|
|
25
26
|
var _datePicker = _interopRequireDefault(require("./date-picker"));
|
|
26
27
|
var _timePicker = _interopRequireDefault(require("./time-picker"));
|
|
28
|
+
var _excluded = ["selectProps"],
|
|
29
|
+
_excluded2 = ["selectProps"];
|
|
27
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
28
31
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
32
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -32,7 +35,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
32
35
|
* @jsx jsx
|
|
33
36
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
34
37
|
var packageName = "@atlaskit/datetime-picker";
|
|
35
|
-
var packageVersion = "
|
|
38
|
+
var packageVersion = "14.0.1";
|
|
36
39
|
// Make DatePicker 50% the width of DateTimePicker
|
|
37
40
|
// If rendering an icon container, shrink the TimePicker
|
|
38
41
|
var datePickerContainerStyles = (0, _react2.css)({
|
|
@@ -96,8 +99,6 @@ var dateTimePickerDefaultProps = {
|
|
|
96
99
|
isInvalid: false,
|
|
97
100
|
datePickerProps: {},
|
|
98
101
|
timePickerProps: {},
|
|
99
|
-
datePickerSelectProps: {},
|
|
100
|
-
timePickerSelectProps: {},
|
|
101
102
|
times: _internal.defaultTimes,
|
|
102
103
|
spacing: 'default',
|
|
103
104
|
locale: 'en-US'
|
|
@@ -233,9 +234,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
233
234
|
ariaDescribedBy = _this$props['aria-describedby'],
|
|
234
235
|
appearance = _this$props.appearance,
|
|
235
236
|
autoFocus = _this$props.autoFocus,
|
|
236
|
-
|
|
237
|
-
datePickerProps = _this$props.datePickerProps,
|
|
238
|
-
datePickerSelectProps = _this$props.datePickerSelectProps,
|
|
237
|
+
datePickerPropsWithSelectProps = _this$props.datePickerProps,
|
|
239
238
|
id = _this$props.id,
|
|
240
239
|
innerProps = _this$props.innerProps,
|
|
241
240
|
isDisabled = _this$props.isDisabled,
|
|
@@ -244,29 +243,25 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
244
243
|
name = _this$props.name,
|
|
245
244
|
spacing = _this$props.spacing,
|
|
246
245
|
testId = _this$props.testId,
|
|
247
|
-
|
|
248
|
-
timeIsEditable = _this$props.timeIsEditable,
|
|
249
|
-
timePickerProps = _this$props.timePickerProps,
|
|
250
|
-
timePickerSelectProps = _this$props.timePickerSelectProps,
|
|
251
|
-
times = _this$props.times;
|
|
246
|
+
timePickerPropsWithSelectProps = _this$props.timePickerProps;
|
|
252
247
|
var value = this.getValue();
|
|
253
248
|
var isFocused = this.state.isFocused;
|
|
254
249
|
var parsedValues = this.getParsedValues();
|
|
255
250
|
var dateValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.dateValue;
|
|
256
251
|
var timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
var
|
|
260
|
-
|
|
252
|
+
var datePickerSelectProps = datePickerPropsWithSelectProps.selectProps,
|
|
253
|
+
datePickerProps = (0, _objectWithoutProperties2.default)(datePickerPropsWithSelectProps, _excluded);
|
|
254
|
+
var datePickerAriaDescribedBy = datePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
255
|
+
var datePickerLabel = datePickerProps.label || datePickerDefaultAriaLabel;
|
|
261
256
|
var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
|
|
262
|
-
|
|
263
|
-
'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
264
|
-
styles: (0, _select.mergeStyles)(styles, datePickerStyles)
|
|
257
|
+
styles: (0, _select.mergeStyles)(styles, datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.styles)
|
|
265
258
|
});
|
|
259
|
+
var timePickerSelectProps = timePickerPropsWithSelectProps.selectProps,
|
|
260
|
+
timePickerProps = (0, _objectWithoutProperties2.default)(timePickerPropsWithSelectProps, _excluded2);
|
|
261
|
+
var timePickerAriaDescribedBy = timePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
262
|
+
var timePickerLabel = timePickerProps.label || timePickerDefaultAriaLabel;
|
|
266
263
|
var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
|
|
267
|
-
|
|
268
|
-
'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
269
|
-
styles: (0, _select.mergeStyles)(styles, timePickerStyles)
|
|
264
|
+
styles: (0, _select.mergeStyles)(styles, timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.styles)
|
|
270
265
|
});
|
|
271
266
|
|
|
272
267
|
// Render DateTimePicker's IconContainer when a value has been filled
|
|
@@ -288,8 +283,9 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
288
283
|
css: datePickerContainerStyles
|
|
289
284
|
}, (0, _react2.jsx)(_datePicker.default, {
|
|
290
285
|
appearance: appearance,
|
|
286
|
+
"aria-describedby": datePickerAriaDescribedBy,
|
|
291
287
|
autoFocus: datePickerProps.autoFocus || autoFocus,
|
|
292
|
-
dateFormat: datePickerProps.dateFormat
|
|
288
|
+
dateFormat: datePickerProps.dateFormat,
|
|
293
289
|
defaultIsOpen: datePickerProps.defaultIsOpen,
|
|
294
290
|
defaultValue: datePickerProps.defaultValue,
|
|
295
291
|
disabled: datePickerProps.disabled,
|
|
@@ -302,6 +298,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
302
298
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
303
299
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
304
300
|
isOpen: datePickerProps.isOpen,
|
|
301
|
+
label: datePickerLabel,
|
|
305
302
|
locale: datePickerProps.locale || locale,
|
|
306
303
|
maxDate: datePickerProps.maxDate,
|
|
307
304
|
minDate: datePickerProps.minDate,
|
|
@@ -322,6 +319,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
322
319
|
css: timePickerContainerStyles
|
|
323
320
|
}, (0, _react2.jsx)(_timePicker.default, {
|
|
324
321
|
appearance: timePickerProps.appearance || appearance,
|
|
322
|
+
"aria-describedby": timePickerAriaDescribedBy,
|
|
325
323
|
autoFocus: timePickerProps.autoFocus,
|
|
326
324
|
defaultIsOpen: timePickerProps.defaultIsOpen,
|
|
327
325
|
defaultValue: timePickerProps.defaultValue,
|
|
@@ -332,6 +330,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
332
330
|
isDisabled: timePickerProps.isDisabled || isDisabled,
|
|
333
331
|
isInvalid: timePickerProps.isInvalid || isInvalid,
|
|
334
332
|
isOpen: timePickerProps.isOpen,
|
|
333
|
+
label: timePickerLabel,
|
|
335
334
|
locale: timePickerProps.locale || locale,
|
|
336
335
|
name: timePickerProps.name,
|
|
337
336
|
onBlur: timePickerProps.onBlur || this.onBlur,
|
|
@@ -342,9 +341,9 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
342
341
|
selectProps: mergedTimePickerSelectProps,
|
|
343
342
|
spacing: timePickerProps.spacing || spacing,
|
|
344
343
|
testId: timePickerProps.testId || testId && "".concat(testId, "--timepicker"),
|
|
345
|
-
timeFormat: timePickerProps.timeFormat
|
|
346
|
-
timeIsEditable: timePickerProps.timeIsEditable
|
|
347
|
-
times: timePickerProps.times
|
|
344
|
+
timeFormat: timePickerProps.timeFormat,
|
|
345
|
+
timeIsEditable: timePickerProps.timeIsEditable,
|
|
346
|
+
times: timePickerProps.times,
|
|
348
347
|
value: timeValue
|
|
349
348
|
})), isClearable && !isDisabled ? (0, _react2.jsx)("button", {
|
|
350
349
|
css: iconContainerStyles,
|
|
@@ -35,7 +35,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
35
35
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line no-restricted-imports
|
|
36
36
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
37
37
|
var packageName = "@atlaskit/datetime-picker";
|
|
38
|
-
var packageVersion = "
|
|
38
|
+
var packageVersion = "14.0.1";
|
|
39
39
|
var menuStyles = {
|
|
40
40
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
41
41
|
position: 'static',
|
|
@@ -19,7 +19,7 @@ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date'
|
|
|
19
19
|
import { convertTokens } from '../internal/parse-tokens';
|
|
20
20
|
import { makeSingleValue } from '../internal/single-value';
|
|
21
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
const packageVersion = "
|
|
22
|
+
const packageVersion = "14.0.1";
|
|
23
23
|
const datePickerDefaultProps = {
|
|
24
24
|
appearance: 'default',
|
|
25
25
|
autoFocus: false,
|
|
@@ -18,7 +18,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
18
18
|
import DatePicker from './date-picker';
|
|
19
19
|
import TimePicker from './time-picker';
|
|
20
20
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "
|
|
21
|
+
const packageVersion = "14.0.1";
|
|
22
22
|
// Make DatePicker 50% the width of DateTimePicker
|
|
23
23
|
// If rendering an icon container, shrink the TimePicker
|
|
24
24
|
const datePickerContainerStyles = css({
|
|
@@ -81,8 +81,6 @@ const dateTimePickerDefaultProps = {
|
|
|
81
81
|
isInvalid: false,
|
|
82
82
|
datePickerProps: {},
|
|
83
83
|
timePickerProps: {},
|
|
84
|
-
datePickerSelectProps: {},
|
|
85
|
-
timePickerSelectProps: {},
|
|
86
84
|
times: defaultTimes,
|
|
87
85
|
spacing: 'default',
|
|
88
86
|
locale: 'en-US'
|
|
@@ -204,9 +202,7 @@ class DateTimePickerComponent extends React.Component {
|
|
|
204
202
|
'aria-describedby': ariaDescribedBy,
|
|
205
203
|
appearance,
|
|
206
204
|
autoFocus,
|
|
207
|
-
|
|
208
|
-
datePickerProps,
|
|
209
|
-
datePickerSelectProps,
|
|
205
|
+
datePickerProps: datePickerPropsWithSelectProps,
|
|
210
206
|
id,
|
|
211
207
|
innerProps,
|
|
212
208
|
isDisabled,
|
|
@@ -215,11 +211,7 @@ class DateTimePickerComponent extends React.Component {
|
|
|
215
211
|
name,
|
|
216
212
|
spacing,
|
|
217
213
|
testId,
|
|
218
|
-
|
|
219
|
-
timeIsEditable,
|
|
220
|
-
timePickerProps,
|
|
221
|
-
timePickerSelectProps,
|
|
222
|
-
times
|
|
214
|
+
timePickerProps: timePickerPropsWithSelectProps
|
|
223
215
|
} = this.props;
|
|
224
216
|
const value = this.getValue();
|
|
225
217
|
const {
|
|
@@ -229,22 +221,24 @@ class DateTimePickerComponent extends React.Component {
|
|
|
229
221
|
const dateValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.dateValue;
|
|
230
222
|
const timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
|
|
231
223
|
const {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
224
|
+
selectProps: datePickerSelectProps,
|
|
225
|
+
...datePickerProps
|
|
226
|
+
} = datePickerPropsWithSelectProps;
|
|
227
|
+
const datePickerAriaDescribedBy = datePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
228
|
+
const datePickerLabel = datePickerProps.label || datePickerDefaultAriaLabel;
|
|
237
229
|
const mergedDatePickerSelectProps = {
|
|
238
230
|
...datePickerSelectProps,
|
|
239
|
-
|
|
240
|
-
'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
241
|
-
styles: mergeStyles(styles, datePickerStyles)
|
|
231
|
+
styles: mergeStyles(styles, datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.styles)
|
|
242
232
|
};
|
|
233
|
+
const {
|
|
234
|
+
selectProps: timePickerSelectProps,
|
|
235
|
+
...timePickerProps
|
|
236
|
+
} = timePickerPropsWithSelectProps;
|
|
237
|
+
const timePickerAriaDescribedBy = timePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
238
|
+
const timePickerLabel = timePickerProps.label || timePickerDefaultAriaLabel;
|
|
243
239
|
const mergedTimePickerSelectProps = {
|
|
244
240
|
...timePickerSelectProps,
|
|
245
|
-
|
|
246
|
-
'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
247
|
-
styles: mergeStyles(styles, timePickerStyles)
|
|
241
|
+
styles: mergeStyles(styles, timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.styles)
|
|
248
242
|
};
|
|
249
243
|
|
|
250
244
|
// Render DateTimePicker's IconContainer when a value has been filled
|
|
@@ -266,8 +260,9 @@ class DateTimePickerComponent extends React.Component {
|
|
|
266
260
|
css: datePickerContainerStyles
|
|
267
261
|
}, jsx(DatePicker, {
|
|
268
262
|
appearance: appearance,
|
|
263
|
+
"aria-describedby": datePickerAriaDescribedBy,
|
|
269
264
|
autoFocus: datePickerProps.autoFocus || autoFocus,
|
|
270
|
-
dateFormat: datePickerProps.dateFormat
|
|
265
|
+
dateFormat: datePickerProps.dateFormat,
|
|
271
266
|
defaultIsOpen: datePickerProps.defaultIsOpen,
|
|
272
267
|
defaultValue: datePickerProps.defaultValue,
|
|
273
268
|
disabled: datePickerProps.disabled,
|
|
@@ -280,6 +275,7 @@ class DateTimePickerComponent extends React.Component {
|
|
|
280
275
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
281
276
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
282
277
|
isOpen: datePickerProps.isOpen,
|
|
278
|
+
label: datePickerLabel,
|
|
283
279
|
locale: datePickerProps.locale || locale,
|
|
284
280
|
maxDate: datePickerProps.maxDate,
|
|
285
281
|
minDate: datePickerProps.minDate,
|
|
@@ -300,6 +296,7 @@ class DateTimePickerComponent extends React.Component {
|
|
|
300
296
|
css: timePickerContainerStyles
|
|
301
297
|
}, jsx(TimePicker, {
|
|
302
298
|
appearance: timePickerProps.appearance || appearance,
|
|
299
|
+
"aria-describedby": timePickerAriaDescribedBy,
|
|
303
300
|
autoFocus: timePickerProps.autoFocus,
|
|
304
301
|
defaultIsOpen: timePickerProps.defaultIsOpen,
|
|
305
302
|
defaultValue: timePickerProps.defaultValue,
|
|
@@ -310,6 +307,7 @@ class DateTimePickerComponent extends React.Component {
|
|
|
310
307
|
isDisabled: timePickerProps.isDisabled || isDisabled,
|
|
311
308
|
isInvalid: timePickerProps.isInvalid || isInvalid,
|
|
312
309
|
isOpen: timePickerProps.isOpen,
|
|
310
|
+
label: timePickerLabel,
|
|
313
311
|
locale: timePickerProps.locale || locale,
|
|
314
312
|
name: timePickerProps.name,
|
|
315
313
|
onBlur: timePickerProps.onBlur || this.onBlur,
|
|
@@ -320,9 +318,9 @@ class DateTimePickerComponent extends React.Component {
|
|
|
320
318
|
selectProps: mergedTimePickerSelectProps,
|
|
321
319
|
spacing: timePickerProps.spacing || spacing,
|
|
322
320
|
testId: timePickerProps.testId || testId && `${testId}--timepicker`,
|
|
323
|
-
timeFormat: timePickerProps.timeFormat
|
|
324
|
-
timeIsEditable: timePickerProps.timeIsEditable
|
|
325
|
-
times: timePickerProps.times
|
|
321
|
+
timeFormat: timePickerProps.timeFormat,
|
|
322
|
+
timeIsEditable: timePickerProps.timeIsEditable,
|
|
323
|
+
times: timePickerProps.times,
|
|
326
324
|
value: timeValue
|
|
327
325
|
})), isClearable && !isDisabled ? jsx("button", {
|
|
328
326
|
css: iconContainerStyles,
|
|
@@ -15,7 +15,7 @@ import parseTime from '../internal/parse-time';
|
|
|
15
15
|
import { convertTokens } from '../internal/parse-tokens';
|
|
16
16
|
import { makeSingleValue } from '../internal/single-value';
|
|
17
17
|
const packageName = "@atlaskit/datetime-picker";
|
|
18
|
-
const packageVersion = "
|
|
18
|
+
const packageVersion = "14.0.1";
|
|
19
19
|
const menuStyles = {
|
|
20
20
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
21
21
|
position: 'static',
|
|
@@ -30,7 +30,7 @@ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date'
|
|
|
30
30
|
import { convertTokens } from '../internal/parse-tokens';
|
|
31
31
|
import { makeSingleValue } from '../internal/single-value';
|
|
32
32
|
var packageName = "@atlaskit/datetime-picker";
|
|
33
|
-
var packageVersion = "
|
|
33
|
+
var packageVersion = "14.0.1";
|
|
34
34
|
var datePickerDefaultProps = {
|
|
35
35
|
appearance: 'default',
|
|
36
36
|
autoFocus: false,
|