td-stylekit 26.8.0 → 26.9.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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [26.9.0](https://github.com/treasure-data/td-stylekit/compare/v26.8.0...v26.9.0) (2022-05-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **CON-9970:** Allow hiding seconds in the DateControl input ([#1274](https://github.com/treasure-data/td-stylekit/issues/1274)) ([41019e4](https://github.com/treasure-data/td-stylekit/commit/41019e4))
|
|
7
|
+
|
|
1
8
|
# [26.8.0](https://github.com/treasure-data/td-stylekit/compare/v26.7.0...v26.8.0) (2022-05-11)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -6,10 +6,7 @@ import type { Theme } from '../ThemeProvider';
|
|
|
6
6
|
import type { TimeEditorFormat } from '../TimePicker';
|
|
7
7
|
export declare const CLOSE_KEYS: string[];
|
|
8
8
|
export declare const DATE_FORMATS: string[];
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const FORMAT_HOUR24_ERROR_MESSAGE: string;
|
|
11
|
-
export declare const HOUR12_DATE_FORMAT = "MMM DD, YYYY hh:mm:ss A";
|
|
12
|
-
export declare const FORMAT_HOUR12_ERROR_MESSAGE: string;
|
|
9
|
+
export declare const DATETIME_FORMAT: (timeFormat: string) => string[];
|
|
13
10
|
export declare const DISABLED_DAY_ERROR_MESSAGE = "That date is disabled";
|
|
14
11
|
export declare type DateControlProps = Omit<FormControlProps<'text'>, 'blockLabel' | 'label' | 'labelWidth' | 'onChange' | 'type' | 'value'> & Pick<DatePickerProps, 'variant' | 'disabledDays'> & {
|
|
15
12
|
blockLabel?: boolean;
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.UnstyledDateControl = exports.
|
|
8
|
+
exports.UnstyledDateControl = exports.DISABLED_DAY_ERROR_MESSAGE = exports.DATE_FORMATS = exports.DATETIME_FORMAT = exports.CLOSE_KEYS = void 0;
|
|
9
9
|
exports["default"] = DateControl;
|
|
10
10
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -71,14 +71,16 @@ var CLOSE_KEYS = [String.fromCharCode(25), // Gets sent when you press shift+tab
|
|
|
71
71
|
exports.CLOSE_KEYS = CLOSE_KEYS;
|
|
72
72
|
var DATE_FORMATS = ['MMM DD, YYYY', 'MMM DD YYYY', 'MMM D, YYYY', 'MMM D YYYY', 'MMMM D, YYYY', 'MMMM D YYYY', 'MMMM DD, YYYY', 'MMMM DD YYYY', 'MM/DD/YYYY', 'l'];
|
|
73
73
|
exports.DATE_FORMATS = DATE_FORMATS;
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
var TIME_FORMAT_24 = 'HH:mm:ss';
|
|
75
|
+
var TIME_FORMAT_12 = 'hh:mm:ss A';
|
|
76
|
+
var TIME_FORMAT_MS = ':mm:ss';
|
|
77
|
+
var TIME_FORMAT_HM = 'hh:mm';
|
|
78
|
+
|
|
79
|
+
var DATETIME_FORMAT = function DATETIME_FORMAT(timeFormat) {
|
|
80
|
+
return ["MMM DD, YYYY ".concat(timeFormat), "Format MMM DD, YYYY ".concat(timeFormat)];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.DATETIME_FORMAT = DATETIME_FORMAT;
|
|
82
84
|
var DISABLED_DAY_ERROR_MESSAGE = 'That date is disabled';
|
|
83
85
|
exports.DISABLED_DAY_ERROR_MESSAGE = DISABLED_DAY_ERROR_MESSAGE;
|
|
84
86
|
|
|
@@ -101,12 +103,22 @@ var usePreviousValue = function usePreviousValue(value) {
|
|
|
101
103
|
return ref.current;
|
|
102
104
|
};
|
|
103
105
|
|
|
104
|
-
var resolveDisplayFormat = function resolveDisplayFormat(hasTime, timePeriod, defaultDisplayFormat) {
|
|
106
|
+
var resolveDisplayFormat = function resolveDisplayFormat(hasTime, timePeriod, defaultDisplayFormat, timeEditor) {
|
|
105
107
|
if (!hasTime) {
|
|
106
108
|
return [defaultDisplayFormat, "Format ".concat(defaultDisplayFormat)];
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
var timeFormat;
|
|
112
|
+
|
|
113
|
+
if (timeEditor === 'minutes-seconds') {
|
|
114
|
+
timeFormat = TIME_FORMAT_MS;
|
|
115
|
+
} else if (timeEditor === 'hours-minutes' || timeEditor === 'minutes') {
|
|
116
|
+
timeFormat = TIME_FORMAT_HM;
|
|
117
|
+
} else {
|
|
118
|
+
timeFormat = timePeriod === '24' ? TIME_FORMAT_24 : TIME_FORMAT_12;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return DATETIME_FORMAT(timeFormat);
|
|
110
122
|
};
|
|
111
123
|
|
|
112
124
|
/**
|
|
@@ -158,7 +170,7 @@ var UnstyledDateControl = function UnstyledDateControl(_ref) {
|
|
|
158
170
|
|
|
159
171
|
var displayTimePart = editor === 'date-time';
|
|
160
172
|
|
|
161
|
-
var _resolveDisplayFormat = resolveDisplayFormat(displayTimePart, period, dateDisplayFormat),
|
|
173
|
+
var _resolveDisplayFormat = resolveDisplayFormat(displayTimePart, period, dateDisplayFormat, timeEditor),
|
|
162
174
|
_resolveDisplayFormat2 = _slicedToArray(_resolveDisplayFormat, 2),
|
|
163
175
|
resolvedDisplayFormat = _resolveDisplayFormat2[0],
|
|
164
176
|
errorMessage = _resolveDisplayFormat2[1];
|