@atlaskit/datetime-picker 12.7.2 → 12.7.4
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 +12 -0
- package/dist/cjs/components/date-picker.js +2 -2
- package/dist/cjs/components/date-time-picker.js +2 -3
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/components/utils.js +37 -26
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/date-picker.js +3 -3
- package/dist/es2019/components/date-time-picker.js +2 -3
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/components/utils.js +35 -26
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/date-picker.js +3 -3
- package/dist/esm/components/date-time-picker.js +2 -3
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/components/utils.js +37 -26
- package/dist/esm/version.json +1 -1
- package/package.json +4 -4
- package/extract-react-types/datetime-picker-props.tsx +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`599bfe90ee3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/599bfe90ee3) - Internal change to use shape tokens. There is no expected visual change.
|
|
8
|
+
|
|
9
|
+
## 12.7.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`758165c64f6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/758165c64f6) - Fixes bug that made escapes not work correctly in format strings.
|
|
14
|
+
|
|
3
15
|
## 12.7.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -37,7 +37,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
37
37
|
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); }; }
|
|
38
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
|
|
39
39
|
var packageName = "@atlaskit/datetime-picker";
|
|
40
|
-
var packageVersion = "12.7.
|
|
40
|
+
var packageVersion = "12.7.4";
|
|
41
41
|
|
|
42
42
|
/* eslint-disable react/no-unused-prop-types */
|
|
43
43
|
|
|
@@ -55,7 +55,7 @@ function getShortISOString(date) {
|
|
|
55
55
|
var menuStyles = (0, _react2.css)({
|
|
56
56
|
zIndex: _constants.layers.dialog(),
|
|
57
57
|
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
58
|
-
borderRadius: "
|
|
58
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
59
59
|
boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"),
|
|
60
60
|
overflow: 'hidden'
|
|
61
61
|
});
|
|
@@ -22,7 +22,6 @@ var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-c
|
|
|
22
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
23
|
var _select = require("@atlaskit/select");
|
|
24
24
|
var _colors = require("@atlaskit/theme/colors");
|
|
25
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
26
25
|
var _internal = require("../internal");
|
|
27
26
|
var _datePicker = _interopRequireDefault(require("./date-picker"));
|
|
28
27
|
var _timePicker = _interopRequireDefault(require("./time-picker"));
|
|
@@ -32,7 +31,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
32
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
|
|
34
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
35
|
-
var packageVersion = "12.7.
|
|
34
|
+
var packageVersion = "12.7.4";
|
|
36
35
|
|
|
37
36
|
/* eslint-disable react/no-unused-prop-types */
|
|
38
37
|
|
|
@@ -82,7 +81,7 @@ var baseContainerStyles = (0, _react2.css)({
|
|
|
82
81
|
display: 'flex',
|
|
83
82
|
backgroundColor: "var(--ds-background-input, ".concat(_colors.N20, ")"),
|
|
84
83
|
border: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "1px solid ".concat("var(--ds-border-input, ".concat(_colors.N100, ")")) : "2px solid ".concat("var(--ds-border-input, ".concat(_colors.N20, ")")),
|
|
85
|
-
borderRadius: "
|
|
84
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
86
85
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
87
86
|
'&:hover': {
|
|
88
87
|
cursor: 'pointer'
|
|
@@ -38,7 +38,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
38
38
|
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); }; }
|
|
39
39
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
40
40
|
var packageName = "@atlaskit/datetime-picker";
|
|
41
|
-
var packageVersion = "12.7.
|
|
41
|
+
var packageVersion = "12.7.4";
|
|
42
42
|
|
|
43
43
|
/* eslint-disable react/no-unused-prop-types */
|
|
44
44
|
|
|
@@ -56,34 +56,45 @@ var tokensMap = {
|
|
|
56
56
|
x: 'T'
|
|
57
57
|
};
|
|
58
58
|
var v1tokens = Object.keys(tokensMap).sort().reverse();
|
|
59
|
-
var tokensRegExp = new RegExp(
|
|
59
|
+
var tokensRegExp = new RegExp(
|
|
60
|
+
// v1 escape string (unsure the purpose of post-pipe capture group)
|
|
61
|
+
'(\\[[^\\[]*\\])|(\\\\)?' +
|
|
62
|
+
// v2 escape string
|
|
63
|
+
"((?<=').+(?=')|" +
|
|
64
|
+
// All v1 tokens
|
|
65
|
+
v1tokens.join('|') + '|.)', 'g');
|
|
60
66
|
function convertTokens(format) {
|
|
61
67
|
var tokensCaptures = format.match(tokensRegExp);
|
|
62
|
-
if (tokensCaptures) {
|
|
63
|
-
return tokensCaptures.reduce(function (acc, tokenString, index) {
|
|
64
|
-
var v2token = tokensMap[tokenString];
|
|
65
|
-
if (!v2token) {
|
|
66
|
-
var escapedCaptures = tokenString.match(/^\[(.+)\]$/);
|
|
67
|
-
if (escapedCaptures) {
|
|
68
|
-
acc.textBuffer.push(escapedCaptures[1]);
|
|
69
|
-
} else {
|
|
70
|
-
acc.textBuffer.push(tokenString);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
var endOfString = index === tokensCaptures.length - 1;
|
|
74
|
-
if (acc.textBuffer.length && (v2token || endOfString)) {
|
|
75
|
-
acc.formatBuffer.push("'".concat(acc.textBuffer.join(''), "'"));
|
|
76
|
-
acc.textBuffer = [];
|
|
77
|
-
}
|
|
78
|
-
if (v2token) {
|
|
79
|
-
acc.formatBuffer.push(v2token);
|
|
80
|
-
}
|
|
81
|
-
return acc;
|
|
82
|
-
}, {
|
|
83
|
-
formatBuffer: [],
|
|
84
|
-
textBuffer: []
|
|
85
|
-
}).formatBuffer.join('');
|
|
86
|
-
} else {
|
|
68
|
+
if (!tokensCaptures) {
|
|
87
69
|
return format;
|
|
88
70
|
}
|
|
71
|
+
return tokensCaptures.reduce(function (parsed, tokenString, index) {
|
|
72
|
+
var v2token = tokensMap[tokenString];
|
|
73
|
+
if (!v2token) {
|
|
74
|
+
var escapedCaptures = tokenString.match(/^\[(.+)\]$/);
|
|
75
|
+
if (escapedCaptures) {
|
|
76
|
+
parsed.escapedTextBuffer.push(escapedCaptures[1]);
|
|
77
|
+
} else {
|
|
78
|
+
parsed.escapedTextBuffer.push(tokenString);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
var endOfString = index === tokensCaptures.length - 1;
|
|
82
|
+
if (parsed.escapedTextBuffer.length && (v2token || endOfString)) {
|
|
83
|
+
// This allows double parentheses to be rendered correctly
|
|
84
|
+
// according to date-fns's spec.
|
|
85
|
+
// https://date-fns.org/v2.29.3/docs/format
|
|
86
|
+
var filteredEscapedTextBuffer = parsed.escapedTextBuffer.filter(function (token) {
|
|
87
|
+
return token !== "'";
|
|
88
|
+
}).join('');
|
|
89
|
+
parsed.formatBuffer.push("'".concat(filteredEscapedTextBuffer, "'"));
|
|
90
|
+
parsed.escapedTextBuffer = [];
|
|
91
|
+
}
|
|
92
|
+
if (v2token) {
|
|
93
|
+
parsed.formatBuffer.push(v2token);
|
|
94
|
+
}
|
|
95
|
+
return parsed;
|
|
96
|
+
}, {
|
|
97
|
+
formatBuffer: [],
|
|
98
|
+
escapedTextBuffer: []
|
|
99
|
+
}).formatBuffer.join('');
|
|
89
100
|
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -14,12 +14,12 @@ import { createLocalizationProvider } from '@atlaskit/locale';
|
|
|
14
14
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
16
16
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
17
|
-
import {
|
|
17
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
18
18
|
import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
|
|
19
19
|
import FixedLayer from '../internal/fixed-layer';
|
|
20
20
|
import { convertTokens } from './utils';
|
|
21
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
const packageVersion = "12.7.
|
|
22
|
+
const packageVersion = "12.7.4";
|
|
23
23
|
|
|
24
24
|
/* eslint-disable react/no-unused-prop-types */
|
|
25
25
|
|
|
@@ -37,7 +37,7 @@ function getShortISOString(date) {
|
|
|
37
37
|
const menuStyles = css({
|
|
38
38
|
zIndex: layers.dialog(),
|
|
39
39
|
backgroundColor: `var(--ds-surface-overlay, ${N0})`,
|
|
40
|
-
borderRadius:
|
|
40
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
41
41
|
boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
|
|
42
42
|
overflow: 'hidden'
|
|
43
43
|
});
|
|
@@ -12,13 +12,12 @@ import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
|
12
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { mergeStyles } from '@atlaskit/select';
|
|
14
14
|
import { B100, N0, N100, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
|
|
15
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
16
15
|
import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
|
|
17
16
|
import DatePicker from './date-picker';
|
|
18
17
|
import TimePicker from './time-picker';
|
|
19
18
|
import { convertTokens } from './utils';
|
|
20
19
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "12.7.
|
|
20
|
+
const packageVersion = "12.7.4";
|
|
22
21
|
|
|
23
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
24
23
|
|
|
@@ -68,7 +67,7 @@ const baseContainerStyles = css({
|
|
|
68
67
|
display: 'flex',
|
|
69
68
|
backgroundColor: `var(--ds-background-input, ${N20})`,
|
|
70
69
|
border: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `1px solid ${`var(--ds-border-input, ${N100})`}` : `2px solid ${`var(--ds-border-input, ${N20})`}`,
|
|
71
|
-
borderRadius:
|
|
70
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
72
71
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
73
72
|
'&:hover': {
|
|
74
73
|
cursor: 'pointer'
|
|
@@ -16,7 +16,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
16
16
|
import parseTime from '../internal/parse-time';
|
|
17
17
|
import { convertTokens } from './utils';
|
|
18
18
|
const packageName = "@atlaskit/datetime-picker";
|
|
19
|
-
const packageVersion = "12.7.
|
|
19
|
+
const packageVersion = "12.7.4";
|
|
20
20
|
|
|
21
21
|
/* eslint-disable react/no-unused-prop-types */
|
|
22
22
|
|
|
@@ -50,34 +50,43 @@ const tokensMap = {
|
|
|
50
50
|
x: 'T'
|
|
51
51
|
};
|
|
52
52
|
const v1tokens = Object.keys(tokensMap).sort().reverse();
|
|
53
|
-
const tokensRegExp = new RegExp(
|
|
53
|
+
const tokensRegExp = new RegExp(
|
|
54
|
+
// v1 escape string (unsure the purpose of post-pipe capture group)
|
|
55
|
+
'(\\[[^\\[]*\\])|(\\\\)?' +
|
|
56
|
+
// v2 escape string
|
|
57
|
+
"((?<=').+(?=')|" +
|
|
58
|
+
// All v1 tokens
|
|
59
|
+
v1tokens.join('|') + '|.)', 'g');
|
|
54
60
|
export function convertTokens(format) {
|
|
55
61
|
const tokensCaptures = format.match(tokensRegExp);
|
|
56
|
-
if (tokensCaptures) {
|
|
57
|
-
return tokensCaptures.reduce((acc, tokenString, index) => {
|
|
58
|
-
const v2token = tokensMap[tokenString];
|
|
59
|
-
if (!v2token) {
|
|
60
|
-
const escapedCaptures = tokenString.match(/^\[(.+)\]$/);
|
|
61
|
-
if (escapedCaptures) {
|
|
62
|
-
acc.textBuffer.push(escapedCaptures[1]);
|
|
63
|
-
} else {
|
|
64
|
-
acc.textBuffer.push(tokenString);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const endOfString = index === tokensCaptures.length - 1;
|
|
68
|
-
if (acc.textBuffer.length && (v2token || endOfString)) {
|
|
69
|
-
acc.formatBuffer.push(`'${acc.textBuffer.join('')}'`);
|
|
70
|
-
acc.textBuffer = [];
|
|
71
|
-
}
|
|
72
|
-
if (v2token) {
|
|
73
|
-
acc.formatBuffer.push(v2token);
|
|
74
|
-
}
|
|
75
|
-
return acc;
|
|
76
|
-
}, {
|
|
77
|
-
formatBuffer: [],
|
|
78
|
-
textBuffer: []
|
|
79
|
-
}).formatBuffer.join('');
|
|
80
|
-
} else {
|
|
62
|
+
if (!tokensCaptures) {
|
|
81
63
|
return format;
|
|
82
64
|
}
|
|
65
|
+
return tokensCaptures.reduce((parsed, tokenString, index) => {
|
|
66
|
+
const v2token = tokensMap[tokenString];
|
|
67
|
+
if (!v2token) {
|
|
68
|
+
const escapedCaptures = tokenString.match(/^\[(.+)\]$/);
|
|
69
|
+
if (escapedCaptures) {
|
|
70
|
+
parsed.escapedTextBuffer.push(escapedCaptures[1]);
|
|
71
|
+
} else {
|
|
72
|
+
parsed.escapedTextBuffer.push(tokenString);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const endOfString = index === tokensCaptures.length - 1;
|
|
76
|
+
if (parsed.escapedTextBuffer.length && (v2token || endOfString)) {
|
|
77
|
+
// This allows double parentheses to be rendered correctly
|
|
78
|
+
// according to date-fns's spec.
|
|
79
|
+
// https://date-fns.org/v2.29.3/docs/format
|
|
80
|
+
const filteredEscapedTextBuffer = parsed.escapedTextBuffer.filter(token => token !== "'").join('');
|
|
81
|
+
parsed.formatBuffer.push(`'${filteredEscapedTextBuffer}'`);
|
|
82
|
+
parsed.escapedTextBuffer = [];
|
|
83
|
+
}
|
|
84
|
+
if (v2token) {
|
|
85
|
+
parsed.formatBuffer.push(v2token);
|
|
86
|
+
}
|
|
87
|
+
return parsed;
|
|
88
|
+
}, {
|
|
89
|
+
formatBuffer: [],
|
|
90
|
+
escapedTextBuffer: []
|
|
91
|
+
}).formatBuffer.join('');
|
|
83
92
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -25,12 +25,12 @@ import { createLocalizationProvider } from '@atlaskit/locale';
|
|
|
25
25
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
26
26
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
27
27
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
28
|
-
import {
|
|
28
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
29
29
|
import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
|
|
30
30
|
import FixedLayer from '../internal/fixed-layer';
|
|
31
31
|
import { convertTokens } from './utils';
|
|
32
32
|
var packageName = "@atlaskit/datetime-picker";
|
|
33
|
-
var packageVersion = "12.7.
|
|
33
|
+
var packageVersion = "12.7.4";
|
|
34
34
|
|
|
35
35
|
/* eslint-disable react/no-unused-prop-types */
|
|
36
36
|
|
|
@@ -48,7 +48,7 @@ function getShortISOString(date) {
|
|
|
48
48
|
var menuStyles = css({
|
|
49
49
|
zIndex: layers.dialog(),
|
|
50
50
|
backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
51
|
-
borderRadius: "
|
|
51
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
52
52
|
boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")"),
|
|
53
53
|
overflow: 'hidden'
|
|
54
54
|
});
|
|
@@ -22,13 +22,12 @@ import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
|
22
22
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
23
23
|
import { mergeStyles } from '@atlaskit/select';
|
|
24
24
|
import { B100, N0, N100, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
|
|
25
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
26
25
|
import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
|
|
27
26
|
import DatePicker from './date-picker';
|
|
28
27
|
import TimePicker from './time-picker';
|
|
29
28
|
import { convertTokens } from './utils';
|
|
30
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
31
|
-
var packageVersion = "12.7.
|
|
30
|
+
var packageVersion = "12.7.4";
|
|
32
31
|
|
|
33
32
|
/* eslint-disable react/no-unused-prop-types */
|
|
34
33
|
|
|
@@ -78,7 +77,7 @@ var baseContainerStyles = css({
|
|
|
78
77
|
display: 'flex',
|
|
79
78
|
backgroundColor: "var(--ds-background-input, ".concat(N20, ")"),
|
|
80
79
|
border: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? "1px solid ".concat("var(--ds-border-input, ".concat(N100, ")")) : "2px solid ".concat("var(--ds-border-input, ".concat(N20, ")")),
|
|
81
|
-
borderRadius: "
|
|
80
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
82
81
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
83
82
|
'&:hover': {
|
|
84
83
|
cursor: 'pointer'
|
|
@@ -29,7 +29,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
29
29
|
import parseTime from '../internal/parse-time';
|
|
30
30
|
import { convertTokens } from './utils';
|
|
31
31
|
var packageName = "@atlaskit/datetime-picker";
|
|
32
|
-
var packageVersion = "12.7.
|
|
32
|
+
var packageVersion = "12.7.4";
|
|
33
33
|
|
|
34
34
|
/* eslint-disable react/no-unused-prop-types */
|
|
35
35
|
|
|
@@ -50,34 +50,45 @@ var tokensMap = {
|
|
|
50
50
|
x: 'T'
|
|
51
51
|
};
|
|
52
52
|
var v1tokens = Object.keys(tokensMap).sort().reverse();
|
|
53
|
-
var tokensRegExp = new RegExp(
|
|
53
|
+
var tokensRegExp = new RegExp(
|
|
54
|
+
// v1 escape string (unsure the purpose of post-pipe capture group)
|
|
55
|
+
'(\\[[^\\[]*\\])|(\\\\)?' +
|
|
56
|
+
// v2 escape string
|
|
57
|
+
"((?<=').+(?=')|" +
|
|
58
|
+
// All v1 tokens
|
|
59
|
+
v1tokens.join('|') + '|.)', 'g');
|
|
54
60
|
export function convertTokens(format) {
|
|
55
61
|
var tokensCaptures = format.match(tokensRegExp);
|
|
56
|
-
if (tokensCaptures) {
|
|
57
|
-
return tokensCaptures.reduce(function (acc, tokenString, index) {
|
|
58
|
-
var v2token = tokensMap[tokenString];
|
|
59
|
-
if (!v2token) {
|
|
60
|
-
var escapedCaptures = tokenString.match(/^\[(.+)\]$/);
|
|
61
|
-
if (escapedCaptures) {
|
|
62
|
-
acc.textBuffer.push(escapedCaptures[1]);
|
|
63
|
-
} else {
|
|
64
|
-
acc.textBuffer.push(tokenString);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
var endOfString = index === tokensCaptures.length - 1;
|
|
68
|
-
if (acc.textBuffer.length && (v2token || endOfString)) {
|
|
69
|
-
acc.formatBuffer.push("'".concat(acc.textBuffer.join(''), "'"));
|
|
70
|
-
acc.textBuffer = [];
|
|
71
|
-
}
|
|
72
|
-
if (v2token) {
|
|
73
|
-
acc.formatBuffer.push(v2token);
|
|
74
|
-
}
|
|
75
|
-
return acc;
|
|
76
|
-
}, {
|
|
77
|
-
formatBuffer: [],
|
|
78
|
-
textBuffer: []
|
|
79
|
-
}).formatBuffer.join('');
|
|
80
|
-
} else {
|
|
62
|
+
if (!tokensCaptures) {
|
|
81
63
|
return format;
|
|
82
64
|
}
|
|
65
|
+
return tokensCaptures.reduce(function (parsed, tokenString, index) {
|
|
66
|
+
var v2token = tokensMap[tokenString];
|
|
67
|
+
if (!v2token) {
|
|
68
|
+
var escapedCaptures = tokenString.match(/^\[(.+)\]$/);
|
|
69
|
+
if (escapedCaptures) {
|
|
70
|
+
parsed.escapedTextBuffer.push(escapedCaptures[1]);
|
|
71
|
+
} else {
|
|
72
|
+
parsed.escapedTextBuffer.push(tokenString);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
var endOfString = index === tokensCaptures.length - 1;
|
|
76
|
+
if (parsed.escapedTextBuffer.length && (v2token || endOfString)) {
|
|
77
|
+
// This allows double parentheses to be rendered correctly
|
|
78
|
+
// according to date-fns's spec.
|
|
79
|
+
// https://date-fns.org/v2.29.3/docs/format
|
|
80
|
+
var filteredEscapedTextBuffer = parsed.escapedTextBuffer.filter(function (token) {
|
|
81
|
+
return token !== "'";
|
|
82
|
+
}).join('');
|
|
83
|
+
parsed.formatBuffer.push("'".concat(filteredEscapedTextBuffer, "'"));
|
|
84
|
+
parsed.escapedTextBuffer = [];
|
|
85
|
+
}
|
|
86
|
+
if (v2token) {
|
|
87
|
+
parsed.formatBuffer.push(v2token);
|
|
88
|
+
}
|
|
89
|
+
return parsed;
|
|
90
|
+
}, {
|
|
91
|
+
formatBuffer: [],
|
|
92
|
+
escapedTextBuffer: []
|
|
93
|
+
}).formatBuffer.join('');
|
|
83
94
|
}
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "12.7.
|
|
3
|
+
"version": "12.7.4",
|
|
4
4
|
"description": "A date time picker allows the user to select an associated date and time.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/popper": "^5.5.0",
|
|
42
42
|
"@atlaskit/select": "^16.5.0",
|
|
43
43
|
"@atlaskit/theme": "^12.5.0",
|
|
44
|
-
"@atlaskit/tokens": "^1.
|
|
44
|
+
"@atlaskit/tokens": "^1.11.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"@emotion/react": "^11.7.1",
|
|
47
47
|
"date-fns": "^2.17.0",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"react": "^16.8.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@atlaskit/button": "^16.
|
|
55
|
+
"@atlaskit/button": "^16.8.0",
|
|
56
56
|
"@atlaskit/docs": "*",
|
|
57
57
|
"@atlaskit/form": "^8.11.0",
|
|
58
58
|
"@atlaskit/modal-dialog": "^12.6.0",
|
|
59
|
-
"@atlaskit/popup": "^1.
|
|
59
|
+
"@atlaskit/popup": "^1.8.0",
|
|
60
60
|
"@atlaskit/range": "^7.1.0",
|
|
61
61
|
"@atlaskit/section-message": "^6.4.0",
|
|
62
62
|
"@atlaskit/ssr": "*",
|