@atlaskit/datetime-picker 10.4.2 → 11.1.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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "10.4.2",
3
+ "version": "11.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,22 +1,25 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
- import React from 'react';
4
- import styled from '@emotion/styled'; // eslint-disable-next-line no-restricted-imports
5
3
 
6
- import { format, isValid, lastDayOfMonth, parse } from 'date-fns';
4
+ /** @jsx jsx */
5
+ import { Component } from 'react';
6
+ import { css, jsx } from '@emotion/core'; // eslint-disable-next-line no-restricted-imports
7
+
8
+ import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
7
9
  import pick from 'lodash/pick';
8
10
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
9
11
  import Calendar from '@atlaskit/calendar';
10
12
  import CalendarIcon from '@atlaskit/icon/glyph/calendar';
11
13
  import { createLocalizationProvider } from '@atlaskit/locale';
12
14
  import Select, { mergeStyles } from '@atlaskit/select';
13
- import { B100, N20 } from '@atlaskit/theme/colors';
15
+ import { B100, N20, N50A, N60A } from '@atlaskit/theme/colors';
14
16
  import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
15
- import { e200 } from '@atlaskit/theme/elevation';
17
+ import { token } from '@atlaskit/tokens';
16
18
  import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
17
19
  import FixedLayer from '../internal/FixedLayer';
20
+ import { convertTokens } from './utils';
18
21
  const packageName = "@atlaskit/datetime-picker";
19
- const packageVersion = "10.4.2";
22
+ const packageVersion = "11.1.0";
20
23
  /* eslint-disable react/no-unused-prop-types */
21
24
 
22
25
  function getDateObj(date) {
@@ -28,24 +31,26 @@ function getDateObj(date) {
28
31
  }
29
32
 
30
33
  function getValidDate(iso) {
31
- const date = parse(iso);
34
+ const date = parseISO(iso);
32
35
  return isValid(date) ? getDateObj(date) : {};
33
36
  }
34
37
 
35
- const StyledMenu = styled.div`
36
- background-color: ${N20};
37
- border-radius: ${borderRadius()}px;
38
- z-index: ${layers.dialog};
39
- ${e200()};
40
- `;
38
+ const menuStyles = css({
39
+ zIndex: layers.dialog(),
40
+ backgroundColor: token('color.background.default', N20),
41
+ borderRadius: `${borderRadius()}px`,
42
+ boxShadow: token('shadow.overlay', `0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`)
43
+ });
41
44
 
42
45
  const Menu = ({
43
46
  selectProps,
44
47
  innerProps
45
- }) => /*#__PURE__*/React.createElement(FixedLayer, {
48
+ }) => jsx(FixedLayer, {
46
49
  inputValue: selectProps.inputValue,
47
50
  containerRef: selectProps.calendarContainerRef,
48
- content: /*#__PURE__*/React.createElement(StyledMenu, innerProps, /*#__PURE__*/React.createElement(Calendar, _extends({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
51
+ content: jsx("div", _extends({
52
+ css: menuStyles
53
+ }, innerProps), jsx(Calendar, _extends({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
49
54
  disabled: selectProps.calendarDisabled,
50
55
  disabledDateFilter: selectProps.calendarDisabledDateFilter,
51
56
  minDate: selectProps.calendarMinDate,
@@ -85,7 +90,7 @@ const datePickerDefaultProps = {
85
90
 
86
91
  };
87
92
 
88
- class DatePicker extends React.Component {
93
+ class DatePicker extends Component {
89
94
  constructor(props) {
90
95
  super(props);
91
96
 
@@ -192,7 +197,7 @@ class DatePicker extends React.Component {
192
197
  // We format the parsed date to YYYY-MM-DD here because
193
198
  // this is the format expected by the @atlaskit/calendar component
194
199
  this.setState({
195
- view: format(parsed, 'YYYY-MM-DD')
200
+ view: format(parsed, convertTokens('YYYY-MM-DD'))
196
201
  });
197
202
  }
198
203
  }
@@ -274,7 +279,7 @@ class DatePicker extends React.Component {
274
279
  let changedState = {
275
280
  selectedValue: '',
276
281
  value: '',
277
- view: this.props.defaultValue || format(new Date(), 'YYYY-MM-DD')
282
+ view: this.props.defaultValue || format(new Date(), convertTokens('YYYY-MM-DD'))
278
283
  };
279
284
 
280
285
  if (!this.props.hideIcon) {
@@ -324,7 +329,7 @@ class DatePicker extends React.Component {
324
329
  });
325
330
 
326
331
  _defineProperty(this, "getSubtleControlStyles", isOpen => ({
327
- border: `2px solid ${isOpen ? B100 : `transparent`}`,
332
+ border: `2px solid ${isOpen ? token('color.border.focus', B100) : `transparent`}`,
328
333
  backgroundColor: 'transparent',
329
334
  padding: '1px'
330
335
  }));
@@ -358,13 +363,8 @@ class DatePicker extends React.Component {
358
363
  return formatDisplayLabel(value, dateFormat || defaultDateFormat);
359
364
  }
360
365
 
361
- const date = parse(value);
362
-
363
- if (dateFormat) {
364
- return format(date, dateFormat);
365
- }
366
-
367
- return l10n.formatDate(date);
366
+ const date = parseISO(value);
367
+ return dateFormat ? format(date, convertTokens(dateFormat)) : l10n.formatDate(date);
368
368
  });
369
369
 
370
370
  _defineProperty(this, "getPlaceholder", () => {
@@ -463,26 +463,26 @@ class DatePicker extends React.Component {
463
463
  calendarDisabledDateFilter: disabledDateFilter,
464
464
  calendarMaxDate: maxDate,
465
465
  calendarMinDate: minDate,
466
- calendarValue: value && format(parse(value), 'YYYY-MM-DD'),
466
+ calendarValue: value && format(parseISO(value), convertTokens('YYYY-MM-DD')),
467
467
  calendarView: view,
468
468
  onCalendarChange: this.onCalendarChange,
469
469
  onCalendarSelect: this.onCalendarSelect,
470
470
  calendarLocale: locale,
471
471
  calendarWeekStartDay: weekStartDay
472
472
  };
473
- return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
473
+ return jsx("div", _extends({}, innerProps, {
474
474
  role: "presentation",
475
475
  onClick: this.onInputClick,
476
476
  onInput: this.onSelectInput,
477
477
  onKeyDown: this.onSelectKeyDown,
478
478
  ref: this.getContainerRef,
479
479
  "data-testid": testId && `${testId}--container`
480
- }), /*#__PURE__*/React.createElement("input", {
480
+ }), jsx("input", {
481
481
  name: name,
482
482
  type: "hidden",
483
483
  value: value,
484
484
  "data-testid": testId && `${testId}--input`
485
- }), /*#__PURE__*/React.createElement(Select, _extends({
485
+ }), jsx(Select, _extends({
486
486
  enableAnimation: false,
487
487
  menuIsOpen: menuIsOpen,
488
488
  closeMenuOnSelect: true,
@@ -1,135 +1,92 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+
4
+ /** @jsx jsx */
3
5
  import React from 'react';
4
- import styled from '@emotion/styled'; // eslint-disable-next-line no-restricted-imports
6
+ import { css, jsx } from '@emotion/core'; // eslint-disable-next-line no-restricted-imports
5
7
 
6
- import { format, isValid, parse } from 'date-fns';
8
+ import { format, isValid, parseISO } from 'date-fns';
7
9
  import pick from 'lodash/pick';
8
10
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
9
11
  import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
10
12
  import { mergeStyles } from '@atlaskit/select';
11
- import * as colors from '@atlaskit/theme/colors';
13
+ import { B100, N0, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
12
14
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
15
+ import { token } from '@atlaskit/tokens';
13
16
  import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
14
17
  import DatePicker from './DatePicker';
15
18
  import TimePicker from './TimePicker';
19
+ import { convertTokens } from './utils';
16
20
  const packageName = "@atlaskit/datetime-picker";
17
- const packageVersion = "10.4.2";
21
+ const packageVersion = "11.1.0";
18
22
  /* eslint-disable react/no-unused-prop-types */
19
23
 
20
- const getBorder = ({
21
- appearance,
22
- isFocused,
23
- isInvalid
24
- }) => {
25
- let color = colors.N20;
26
-
27
- if (appearance === 'subtle') {
28
- color = 'transparent';
24
+ const isInvalidBorderStyles = css({
25
+ borderColor: token('color.iconBorder.danger', R400)
26
+ });
27
+ const isFocusedBorderStyles = css({
28
+ borderColor: token('color.border.focus', B100)
29
+ });
30
+ const isFocusedStyles = css({
31
+ backgroundColor: token('color.background.default', N0)
32
+ });
33
+ const subtleBgStyles = css({
34
+ backgroundColor: 'transparent',
35
+ borderColor: 'transparent'
36
+ });
37
+ const hoverStyles = css({
38
+ '&:hover': {
39
+ backgroundColor: token('color.background.default', N30),
40
+ borderColor: token('color.border.neutral', N30)
29
41
  }
30
-
31
- if (isFocused) {
32
- color = colors.B100;
42
+ });
43
+ const isInvalidHoverStyles = css({
44
+ '&:hover': {
45
+ backgroundColor: token('color.background.default', N0),
46
+ borderColor: token('color.iconBorder.danger', R400)
33
47
  }
34
-
35
- if (isInvalid) {
36
- color = colors.R400;
48
+ });
49
+ const isDisabledStyles = css({
50
+ '&:hover': {
51
+ cursor: 'default'
37
52
  }
38
-
39
- return `border: 2px solid ${color};`;
40
- };
41
-
42
- const getBorderColorHover = ({
43
- isFocused,
44
- isInvalid,
45
- isDisabled
46
- }) => {
47
- let color = colors.N30;
48
-
49
- if (isFocused || isDisabled) {
50
- return ``;
51
- }
52
-
53
- if (isInvalid) {
54
- color = colors.R400;
55
- }
56
-
57
- return `border-color: ${color};`;
58
- };
59
-
60
- const getBackgroundColor = ({
61
- appearance,
62
- isFocused
63
- }) => {
64
- let color = colors.N20;
65
-
66
- if (isFocused) {
67
- color = colors.N0;
53
+ });
54
+ const baseContainerStyles = css({
55
+ display: 'flex',
56
+ backgroundColor: token('color.background.subtleNeutral.resting', N20),
57
+ border: `2px solid ${token('color.border.neutral', N20)}`,
58
+ borderRadius: `${borderRadius()}px`,
59
+ transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
60
+ '&:hover': {
61
+ cursor: 'pointer'
68
62
  }
69
-
70
- if (appearance === 'subtle') {
71
- color = 'transparent';
72
- }
73
-
74
- return `background-color: ${color};`;
75
- };
76
-
77
- const getBackgroundColorHover = ({
78
- isFocused,
79
- isInvalid,
80
- isDisabled
81
- }) => {
82
- let color = colors.N30;
83
-
84
- if (isFocused || isDisabled) {
85
- return ``;
86
- }
87
-
88
- if (isInvalid) {
89
- color = colors.N0;
90
- }
91
-
92
- return `background-color: ${color};`;
93
- };
94
-
95
- const Flex = styled.div`
96
- ${getBackgroundColor}
97
- ${getBorder}
98
- border-radius: ${borderRadius()}px;
99
- display: flex;
100
- transition: background-color 200ms ease-in-out, border-color 200ms ease-in-out;
101
- &:hover {
102
- cursor: ${props => props.isDisabled ? 'default' : 'pointer'};
103
- ${getBackgroundColorHover}
104
- ${getBorderColorHover}
105
- }
106
- `; // Make DatePicker 50% the width of DateTimePicker
63
+ }); // Make DatePicker 50% the width of DateTimePicker
107
64
  // If rendering an icon container, shrink the TimePicker
108
65
 
109
- const DatePickerContainer = styled.div`
110
- flex-basis: 50%;
111
- flex-grow: 1;
112
- flex-shrink: 0;
113
- `;
114
- const TimePickerContainer = styled.div`
115
- flex-basis: 50%;
116
- flex-grow: 1;
117
- `;
66
+ const datePickerContainerStyles = css({
67
+ flexBasis: '50%',
68
+ flexGrow: 1,
69
+ flexShrink: 0
70
+ });
71
+ const timePickerContainerStyles = css({
72
+ flexBasis: '50%',
73
+ flexGrow: 1
74
+ });
118
75
  const ICON_PADDING = 2;
119
- const IconContainer = styled.div`
120
- flex-basis: inherit;
121
- padding-left: ${ICON_PADDING * 2}px;
122
- padding-right: ${gridSize()}px;
123
- padding-top: 6px;
124
- padding-bottom: 6px;
125
- display: flex;
126
- align-items: center;
127
- color: ${colors.N70};
128
- transition: color 150ms;
129
- &:hover {
130
- color: ${colors.N500};
76
+ const iconContainerStyles = css({
77
+ display: 'flex',
78
+ paddingTop: `6px`,
79
+ paddingRight: `${gridSize()}px`,
80
+ paddingBottom: `6px`,
81
+ paddingLeft: `${ICON_PADDING * 2}px`,
82
+ alignItems: 'center',
83
+ flexBasis: 'inherit',
84
+ color: token('color.text.lowEmphasis', N70),
85
+ transition: `color 150ms`,
86
+ '&:hover': {
87
+ color: token('color.text.mediumEmphasis', N500)
131
88
  }
132
- `; // react-select overrides (via @atlaskit/select).
89
+ }); // react-select overrides (via @atlaskit/select).
133
90
 
134
91
  const styles = {
135
92
  control: style => ({ ...style,
@@ -228,12 +185,11 @@ class DateTimePicker extends React.Component {
228
185
  return this.props.parseValue(value, dateValue, timeValue, zoneValue);
229
186
  }
230
187
 
231
- const parsed = parse(value);
232
- const valid = isValid(parsed);
233
- return valid ? {
234
- dateValue: format(parsed, 'YYYY-MM-DD'),
235
- timeValue: format(parsed, 'HH:mm'),
236
- zoneValue: format(parsed, 'ZZ')
188
+ const parsed = parseISO(value);
189
+ return isValid(parsed) ? {
190
+ dateValue: format(parsed, convertTokens('YYYY-MM-DD')),
191
+ timeValue: format(parsed, convertTokens('HH:mm')),
192
+ zoneValue: format(parsed, convertTokens('ZZ'))
237
193
  } : {
238
194
  dateValue,
239
195
  timeValue,
@@ -317,16 +273,18 @@ class DateTimePicker extends React.Component {
317
273
  // Don't use Date or TimePicker's because they can't be customised
318
274
 
319
275
  const isClearable = Boolean(dateValue || timeValue);
320
- return /*#__PURE__*/React.createElement(Flex, _extends({}, innerProps, {
321
- isFocused: isFocused,
322
- isDisabled: isDisabled,
323
- isInvalid: this.props.isInvalid,
324
- appearance: this.props.appearance
325
- }), /*#__PURE__*/React.createElement("input", {
276
+ const notFocusedOrIsDisabled = !(isFocused || isDisabled);
277
+ return jsx("div", _extends({
278
+ css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
279
+ }, innerProps, {
280
+ "data-testid": testId
281
+ }), jsx("input", {
326
282
  name: name,
327
283
  type: "hidden",
328
284
  value: value
329
- }), /*#__PURE__*/React.createElement(DatePickerContainer, null, /*#__PURE__*/React.createElement(DatePicker, _extends({}, bothProps, {
285
+ }), jsx("div", {
286
+ css: datePickerContainerStyles
287
+ }, jsx(DatePicker, _extends({}, bothProps, {
330
288
  autoFocus: autoFocus,
331
289
  dateFormat: dateFormat,
332
290
  hideIcon: true,
@@ -336,7 +294,9 @@ class DateTimePicker extends React.Component {
336
294
  value: dateValue,
337
295
  locale: locale,
338
296
  testId: testId && `${testId}--datepicker`
339
- }, datePickerProps))), /*#__PURE__*/React.createElement(TimePickerContainer, null, /*#__PURE__*/React.createElement(TimePicker, _extends({}, bothProps, {
297
+ }, datePickerProps))), jsx("div", {
298
+ css: timePickerContainerStyles
299
+ }, jsx(TimePicker, _extends({}, bothProps, {
340
300
  hideIcon: true,
341
301
  onChange: this.onTimeChange,
342
302
  selectProps: mergedTimePickerSelectProps,
@@ -346,13 +306,12 @@ class DateTimePicker extends React.Component {
346
306
  timeFormat: timeFormat,
347
307
  locale: locale,
348
308
  testId: testId && `${testId}--timepicker`
349
- }, timePickerProps))), isClearable && !isDisabled ?
350
- /*#__PURE__*/
351
- // eslint-disable-next-line styled-components-a11y/click-events-have-key-events,styled-components-a11y/no-static-element-interactions
352
- React.createElement(IconContainer, {
309
+ }, timePickerProps))), isClearable && !isDisabled ? // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
310
+ jsx("div", {
311
+ css: iconContainerStyles,
353
312
  onClick: this.onClear,
354
313
  "data-testid": testId && `${testId}--icon--container`
355
- }, /*#__PURE__*/React.createElement(SelectClearIcon, {
314
+ }, jsx(SelectClearIcon, {
356
315
  size: "small",
357
316
  primaryColor: "inherit",
358
317
  label: "clear"
@@ -9,11 +9,13 @@ import { createLocalizationProvider } from '@atlaskit/locale';
9
9
  import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
10
10
  import { B100 } from '@atlaskit/theme/colors';
11
11
  import { gridSize } from '@atlaskit/theme/constants';
12
+ import { token } from '@atlaskit/tokens';
12
13
  import { defaultTimeFormat, defaultTimes, DropdownIndicator, EmptyClearIndicator, placeholderDatetime } from '../internal';
13
14
  import FixedLayer from '../internal/FixedLayer';
14
15
  import parseTime from '../internal/parseTime';
16
+ import { convertTokens } from './utils';
15
17
  const packageName = "@atlaskit/datetime-picker";
16
- const packageVersion = "10.4.2";
18
+ const packageVersion = "11.1.0";
17
19
  const menuStyles = {
18
20
  /* Need to remove default absolute positioning as that causes issues with position fixed */
19
21
  position: 'static',
@@ -102,13 +104,12 @@ class TimePicker extends React.Component {
102
104
  const {
103
105
  parseInputValue,
104
106
  timeFormat
105
- } = this.props; // TODO parseInputValue doesn't accept `timeFormat` as an function arg yet...
106
-
107
- const value = format(parseInputValue(inputValue, timeFormat || defaultTimeFormat), 'HH:mm') || '';
107
+ } = this.props;
108
+ const formattedValue = format(parseInputValue(inputValue, timeFormat || defaultTimeFormat), 'HH:mm') || '';
108
109
  this.setState({
109
- value
110
+ value: formattedValue
110
111
  });
111
- this.props.onChange(value);
112
+ this.props.onChange(formattedValue);
112
113
  } else {
113
114
  this.onChange(inputValue);
114
115
  }
@@ -179,7 +180,7 @@ class TimePicker extends React.Component {
179
180
  });
180
181
 
181
182
  _defineProperty(this, "getSubtleControlStyles", selectStyles => !selectStyles.control ? {
182
- border: `2px solid ${this.getSafeState().isFocused ? `${B100}` : `transparent`}`,
183
+ border: `2px solid ${this.getSafeState().isFocused ? token('color.border.focus', B100) : `transparent`}`,
183
184
  backgroundColor: 'transparent',
184
185
  padding: '1px'
185
186
  } : {});
@@ -208,7 +209,7 @@ class TimePicker extends React.Component {
208
209
  }
209
210
 
210
211
  if (timeFormat) {
211
- return format(date, timeFormat);
212
+ return format(date, convertTokens(timeFormat));
212
213
  }
213
214
 
214
215
  return l10n.formatTime(date);
@@ -294,11 +295,9 @@ class TimePicker extends React.Component {
294
295
  }),
295
296
  menu: base => ({ ...base,
296
297
  ...menuStyles,
297
- ...{
298
- // Fixed positioned elements no longer inherit width from their parent, so we must explicitly set the
299
- // menu width to the width of our container
300
- width: this.containerRef ? this.containerRef.getBoundingClientRect().width : 'auto'
301
- }
298
+ // Fixed positioned elements no longer inherit width from their parent, so we must explicitly set the
299
+ // menu width to the width of our container
300
+ width: this.containerRef ? this.containerRef.getBoundingClientRect().width : 'auto'
302
301
  }),
303
302
  indicatorsContainer: base => ({ ...base,
304
303
  paddingLeft: renderIconContainer ? ICON_PADDING : 0,
@@ -0,0 +1,89 @@
1
+ // https://github.com/date-fns/date-fns-upgrade/blob/master/src/v2/convertTokens/index.ts
2
+ const tokensMap = {
3
+ // 'D MMMM': '',
4
+ // 'Do MMMM': '',
5
+ // 'DD MMMM': '',
6
+ M: 'L',
7
+ Mo: 'Mo',
8
+ MM: 'LL',
9
+ MMM: 'LLL',
10
+ MMMM: 'LLLL',
11
+ Q: 'q',
12
+ Qo: 'qo',
13
+ D: 'd',
14
+ Do: 'do',
15
+ DD: 'dd',
16
+ DDD: 'D',
17
+ DDDo: 'Do',
18
+ DDDD: 'DDD',
19
+ d: 'i',
20
+ do: 'io',
21
+ dd: 'iiiiii',
22
+ ddd: 'iii',
23
+ dddd: 'iiii',
24
+ A: 'a',
25
+ a: 'a',
26
+ aa: 'aaaa',
27
+ E: 'i',
28
+ W: 'I',
29
+ Wo: 'Io',
30
+ WW: 'II',
31
+ YY: 'yy',
32
+ YYYY: 'yyyy',
33
+ GG: 'RR',
34
+ GGGG: 'RRRR',
35
+ H: 'H',
36
+ HH: 'HH',
37
+ h: 'h',
38
+ hh: 'hh',
39
+ m: 'm',
40
+ mm: 'mm',
41
+ s: 's',
42
+ ss: 'ss',
43
+ S: 'S',
44
+ SS: 'SS',
45
+ SSS: 'SSS',
46
+ Z: 'xxx',
47
+ ZZ: 'xx',
48
+ X: 't',
49
+ x: 'T'
50
+ };
51
+ const v1tokens = Object.keys(tokensMap).sort().reverse();
52
+ const tokensRegExp = new RegExp('(\\[[^\\[]*\\])|(\\\\)?' + '(' + v1tokens.join('|') + '|.)', 'g');
53
+ export function convertTokens(format) {
54
+ const tokensCaptures = format.match(tokensRegExp);
55
+
56
+ if (tokensCaptures) {
57
+ return tokensCaptures.reduce((acc, tokenString, index) => {
58
+ const v2token = tokensMap[tokenString];
59
+
60
+ if (!v2token) {
61
+ const escapedCaptures = tokenString.match(/^\[(.+)\]$/);
62
+
63
+ if (escapedCaptures) {
64
+ acc.textBuffer.push(escapedCaptures[1]);
65
+ } else {
66
+ acc.textBuffer.push(tokenString);
67
+ }
68
+ }
69
+
70
+ const endOfString = index === tokensCaptures.length - 1;
71
+
72
+ if (acc.textBuffer.length && (v2token || endOfString)) {
73
+ acc.formatBuffer.push(`'${acc.textBuffer.join('')}'`);
74
+ acc.textBuffer = [];
75
+ }
76
+
77
+ if (v2token) {
78
+ acc.formatBuffer.push(v2token);
79
+ }
80
+
81
+ return acc;
82
+ }, {
83
+ formatBuffer: [],
84
+ textBuffer: []
85
+ }).formatBuffer.join('');
86
+ } else {
87
+ return format;
88
+ }
89
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "10.4.2",
3
+ "version": "11.1.0",
4
4
  "sideEffects": false
5
5
  }