td-stylekit 28.35.0 → 28.36.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 +14 -0
- package/dist/es/ActionBar/ActionBar.js +6 -5
- package/dist/es/DateControl/DateControl.js +2 -2
- package/dist/es/DateControl/index.d.ts +1 -1
- package/dist/es/DateControl/index.js +6 -0
- package/dist/es/DateField/DateField.js +3 -2
- package/dist/es/DatePicker/utils.d.ts +1 -1
- package/dist/es/DatePicker/utils.js +13 -4
- package/dist/es/Icon/staticTypes.d.ts +4 -0
- package/dist/es/Icon/types.js +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [28.36.0](https://github.com/treasure-data/td-stylekit/compare/v28.35.1...v28.36.0) (2024-03-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **CON-14928:** Add GoalDraft and FolderDraft icons ([#1533](https://github.com/treasure-data/td-stylekit/issues/1533)) ([cbfae0d](https://github.com/treasure-data/td-stylekit/commit/cbfae0d))
|
|
7
|
+
|
|
8
|
+
## [28.35.1](https://github.com/treasure-data/td-stylekit/compare/v28.35.0...v28.35.1) (2024-02-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **CON-15052:** Pass through locale to isStringCorrectFormat check ([#1530](https://github.com/treasure-data/td-stylekit/issues/1530)) ([be0b850](https://github.com/treasure-data/td-stylekit/commit/be0b850))
|
|
14
|
+
|
|
1
15
|
# [28.35.0](https://github.com/treasure-data/td-stylekit/compare/v28.34.1...v28.35.0) (2024-02-12)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -74,6 +74,11 @@ var ActionBar = function ActionBar(props) {
|
|
|
74
74
|
menuLabel = _props$menuLabel === void 0 ? 'More Menu Items' : _props$menuLabel,
|
|
75
75
|
children = props.children,
|
|
76
76
|
dataInstrumentation = props['data-instrumentation'];
|
|
77
|
+
var allSubmenuActionsHidden = actions === null || actions === void 0 ? void 0 : actions.filter(function (a) {
|
|
78
|
+
return a.visibility !== 'bar';
|
|
79
|
+
}).every(function (a) {
|
|
80
|
+
return a.hidden;
|
|
81
|
+
});
|
|
77
82
|
return (0, _jsxRuntime.jsxs)(_components.Container, {
|
|
78
83
|
"data-gs": gs("src", "actionbar", "actionbar.tsx", "container"),
|
|
79
84
|
"data-instrumentation": "".concat(dataInstrumentation, "-container"),
|
|
@@ -85,11 +90,7 @@ var ActionBar = function ActionBar(props) {
|
|
|
85
90
|
}), children, (0, _jsxRuntime.jsx)(_components.ActionMenu, {
|
|
86
91
|
"data-gs": gs("src", "actionbar", "actionbar.tsx", "container", "action-menu"),
|
|
87
92
|
actions: actions,
|
|
88
|
-
hidden: menu === false ||
|
|
89
|
-
return a.visibility !== 'bar';
|
|
90
|
-
}).every(function (a) {
|
|
91
|
-
return a.hidden;
|
|
92
|
-
})),
|
|
93
|
+
hidden: menu === false || allSubmenuActionsHidden,
|
|
93
94
|
"data-instrumentation": "".concat(dataInstrumentation, "-menu"),
|
|
94
95
|
menuLabel: menuLabel
|
|
95
96
|
})]
|
|
@@ -294,7 +294,7 @@ var UnstyledDateControl = function UnstyledDateControl(_ref) {
|
|
|
294
294
|
var onInputChange = function onInputChange(_ref2) {
|
|
295
295
|
var name = _ref2.name,
|
|
296
296
|
value = _ref2.value;
|
|
297
|
-
var date = typeof value === 'string' && isStringCorrectFormat(value, [resolvedDisplayFormat].concat(DATE_FORMATS)) ? stringToDate(value, [resolvedDisplayFormat].concat(DATE_FORMATS), locale) : null;
|
|
297
|
+
var date = typeof value === 'string' && isStringCorrectFormat(value, [resolvedDisplayFormat].concat(DATE_FORMATS), locale) ? stringToDate(value, [resolvedDisplayFormat].concat(DATE_FORMATS), locale) : null;
|
|
298
298
|
setInputValue(String(value)); // If we have a validation function and it's test doesn't pass then
|
|
299
299
|
// we don't want to call onChange, but we want to keep local state
|
|
300
300
|
// up to date so that the input respects the users inputs
|
|
@@ -345,7 +345,7 @@ var UnstyledDateControl = function UnstyledDateControl(_ref) {
|
|
|
345
345
|
|
|
346
346
|
(0, _react.useEffect)(function () {
|
|
347
347
|
var errorList = error ? (0, _utils.getErrorList)(error) : [];
|
|
348
|
-
var date = isStringCorrectFormat(inputValue, [resolvedDisplayFormat].concat(DATE_FORMATS)) ? stringToDate(inputValue, [resolvedDisplayFormat].concat(DATE_FORMATS), locale) : undefined;
|
|
348
|
+
var date = isStringCorrectFormat(inputValue, [resolvedDisplayFormat].concat(DATE_FORMATS), locale) ? stringToDate(inputValue, [resolvedDisplayFormat].concat(DATE_FORMATS), locale) : undefined;
|
|
349
349
|
|
|
350
350
|
if (inputValue && !date) {
|
|
351
351
|
errorList.unshift(errorMessage);
|
|
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "CLOSE_KEYS", {
|
|
|
11
11
|
return _DateControl.CLOSE_KEYS;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
+
Object.defineProperty(exports, "DATE_FORMATS", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _DateControl.DATE_FORMATS;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
14
20
|
Object.defineProperty(exports, "default", {
|
|
15
21
|
enumerable: true,
|
|
16
22
|
get: function get() {
|
|
@@ -71,7 +71,8 @@ if (typeof window !== "undefined" && !window.gsC) window.gsC = function () {};
|
|
|
71
71
|
|
|
72
72
|
var dateToString = _DatePicker.DatePickerUtils.dateToString,
|
|
73
73
|
stringToDate = _DatePicker.DatePickerUtils.stringToDate,
|
|
74
|
-
isStringCorrectFormat = _DatePicker.DatePickerUtils.isStringCorrectFormat
|
|
74
|
+
isStringCorrectFormat = _DatePicker.DatePickerUtils.isStringCorrectFormat,
|
|
75
|
+
DEFAULT_FORMAT = _DatePicker.DatePickerUtils.DEFAULT_FORMAT;
|
|
75
76
|
var CLOSE_KEYS = [String.fromCharCode(25), // Gets sent when you press shift+tab with Chrome...
|
|
76
77
|
'Enter', 'Escape', 'Tab']; // @TODO: Change to YYYY-MM-DD?
|
|
77
78
|
|
|
@@ -164,7 +165,7 @@ var UnstyledDateField = /*#__PURE__*/function (_Component) {
|
|
|
164
165
|
_defineProperty(_assertThisInitialized(_this), "_onInputChange", function (_ref) {
|
|
165
166
|
var name = _ref.name,
|
|
166
167
|
value = _ref.value;
|
|
167
|
-
var date = typeof value === 'string' && isStringCorrectFormat(value) ? stringToDate(value) : null;
|
|
168
|
+
var date = typeof value === 'string' && isStringCorrectFormat(value, DEFAULT_FORMAT, _this.props.locale) ? stringToDate(value) : null;
|
|
168
169
|
var _this$props2 = _this.props,
|
|
169
170
|
onChange = _this$props2.onChange,
|
|
170
171
|
disabledDays = _this$props2.disabledDays,
|
|
@@ -7,7 +7,7 @@ export declare function isDateValid(value: Value, format?: string | string[], lo
|
|
|
7
7
|
/** Convert the String specified into a Date if it valid */
|
|
8
8
|
export declare function stringToDate(string: Value, format?: string | string[], locale?: string): Date | undefined;
|
|
9
9
|
/** Verify that the length of the provided string value matches the length of one of the provided formats */
|
|
10
|
-
export declare function isStringCorrectFormat(string: string, format?: string | string[]): boolean;
|
|
10
|
+
export declare function isStringCorrectFormat(string: string, format?: string | string[], locale?: string): boolean;
|
|
11
11
|
/** Convert the specified Date to a String */
|
|
12
12
|
export declare function dateToString(date: Value, format?: string, locale?: string): string;
|
|
13
13
|
/** Custom locale utils used to override day headers */
|
|
@@ -112,19 +112,28 @@ function stringToDate(string) {
|
|
|
112
112
|
|
|
113
113
|
function isStringCorrectFormat(string) {
|
|
114
114
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FORMAT;
|
|
115
|
+
var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'en';
|
|
115
116
|
|
|
116
117
|
if (Array.isArray(format)) {
|
|
117
118
|
for (var i = 0; i < format.length; i++) {
|
|
118
|
-
var date = (0, _dateFns.parse)(string.toString(), format[i], Date.now()
|
|
119
|
+
var date = (0, _dateFns.parse)(string.toString(), format[i], Date.now(), {
|
|
120
|
+
locale: getLocale(locale)
|
|
121
|
+
});
|
|
119
122
|
|
|
120
|
-
if (date.toString() !== 'Invalid Date' && (0, _dateFns.format)(date, format[i]
|
|
123
|
+
if (date.toString() !== 'Invalid Date' && (0, _dateFns.format)(date, format[i], {
|
|
124
|
+
locale: getLocale(locale)
|
|
125
|
+
}) === string) {
|
|
121
126
|
return true;
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
} else {
|
|
125
|
-
var _date = (0, _dateFns.parse)(string.toString(), format, Date.now()
|
|
130
|
+
var _date = (0, _dateFns.parse)(string.toString(), format, Date.now(), {
|
|
131
|
+
locale: getLocale(locale)
|
|
132
|
+
});
|
|
126
133
|
|
|
127
|
-
if (_date.toString() !== 'Invalid Date' && (0, _dateFns.format)(_date, format
|
|
134
|
+
if (_date.toString() !== 'Invalid Date' && (0, _dateFns.format)(_date, format, {
|
|
135
|
+
locale: getLocale(locale)
|
|
136
|
+
}) === string) {
|
|
128
137
|
return true;
|
|
129
138
|
}
|
|
130
139
|
}
|
|
@@ -492,6 +492,8 @@ export type IconTypes = {
|
|
|
492
492
|
FilterNavIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
493
493
|
FolderClosed: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
494
494
|
FolderClosedIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
495
|
+
FolderDraft: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
496
|
+
FolderDraftIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
495
497
|
FolderOpened: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
496
498
|
FolderOpenedIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
497
499
|
FolderTagPerson: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
@@ -504,6 +506,8 @@ export type IconTypes = {
|
|
|
504
506
|
GoToTopIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
505
507
|
Goal: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
506
508
|
GoalIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
509
|
+
GoalDraft: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
510
|
+
GoalDraftIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
507
511
|
Grid: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
508
512
|
GridIcon: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
|
509
513
|
GridGroup: React.ComponentType<JSX.IntrinsicElements['svg']>;
|
package/dist/es/Icon/types.js
CHANGED
|
@@ -963,6 +963,10 @@ React.createElement("path", {
|
|
|
963
963
|
}),FolderClosed: /*#__PURE__*/
|
|
964
964
|
React.createElement("path", {
|
|
965
965
|
d: "M4 7.5a2 2 0 012-2h4.07a1 1 0 01.668.255l1.79 1.604a2 2 0 00.625.141H18a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-9z"
|
|
966
|
+
}),FolderDraft: /*#__PURE__*/
|
|
967
|
+
React.createElement("path", {
|
|
968
|
+
d: "M17.163 7.932a1.962 1.962 0 00-1.348-.534h-.176l1.746 1.746h.386a1.962 1.962 0 00-.521-1.125l-.087-.087zm-.768 1.212l-1.746-1.746h-.99l1.746 1.746h.99zm.744 1.734h.99l1.695 1.695-.236.754-2.45-2.45zm-2.724-1.734l-1.746-1.746h-.66a1.967 1.967 0 01-.394-.064l1.81 1.81h.99zm.744 1.734h.99l3.203 3.203-.236.754-3.957-3.957zm-2.724-1.734L8.723 5.432h-.99l3.712 3.712h.99zm.744 1.734h.99l4.712 4.711-.236.754-5.466-5.465zm-2.724-1.734L6.743 5.432h-.777a1.99 1.99 0 00-.202.01l3.701 3.702h.99zm.744 1.734h.99l6.22 6.22-.236.753-6.974-6.973zM8.501 9.169L5.01 5.68a1.975 1.975 0 00-.544.446l3.287 3.287c.23-.12.483-.204.747-.243zm.718 1.709h.99l7.54 7.54a.983.983 0 01-.524.15h-.315l-7.69-7.69zM7.182 9.83L4.107 6.756c-.07.2-.107.417-.107.642v.24L6.76 10.4c.113-.212.256-.403.422-.568zm.896 1.885l.053-.16a.982.982 0 01.317-.46l7.472 7.472h-.99l-6.852-6.852zm-1.589-.599L4 8.628v.99l2.245 2.245.244-.746zm1.1 2.09l.244-.746 6.107 6.107h-.99L7.59 13.207zM6 12.608l-2-2v.99l1.756 1.756.244-.746zm1.1 2.09l.244-.745 4.616 4.615h-.99l-3.87-3.87zm-1.589-.599L4 12.588v.99l1.267 1.267.244-.746zm1.1 2.09l.245-.745 3.124 3.124h-.99l-2.379-2.38zm-1.589-.599L4 14.568v.99l.778.778.244-.746zm1.203 2.193a.97.97 0 01.03-.506l.112-.343L8 18.568H7.19a1 1 0 01-.2-.02l-.765-.765zm-1.616-.627l-.581-.58c.076.448.304.846.63 1.136a2.327 2.327 0 01-.05-.556zm15.385-5.403l-.87-.87c.469.052.82.426.87.87z",
|
|
969
|
+
fillRule: "evenodd"
|
|
966
970
|
}),FolderOpened: /*#__PURE__*/
|
|
967
971
|
React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
968
972
|
d: "M4 7.398c0-1.086.88-1.966 1.966-1.966h3.179c.265 0 .519.106.704.296l1.464 1.497c.219.1.455.158.696.173h3.806a1.97 1.97 0 011.957 1.746H8.848a2.363 2.363 0 00-2.245 1.626l-1.876 5.722a2.345 2.345 0 00-.07 1.22A1.964 1.964 0 014 16.244V7.398z"
|
|
@@ -1012,7 +1016,11 @@ React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
|
1012
1016
|
d: "M19.752 10.017a.079.079 0 00-.132-.036l-1.117 1.117a.757.757 0 01-.245.163.135.135 0 00-.087.135 6.2 6.2 0 11-5.574-5.568.139.139 0 00.138-.089.757.757 0 01.164-.246l1.131-1.13a.065.065 0 00-.03-.11 8 8 0 105.752 5.764z"
|
|
1013
1017
|
}), /*#__PURE__*/React.createElement("path", {
|
|
1014
1018
|
d: "M16.681 11.576a.287.287 0 00-.29-.258h-.688a.3.3 0 00-.213.089l-.503.506a.318.318 0 00-.09.212 2.9 2.9 0 11-3.039-3.022.318.318 0 00.211-.09l.522-.524a.3.3 0 00.087-.211v-.67c0-.149-.11-.276-.258-.29a4.7 4.7 0 104.26 4.257z"
|
|
1015
|
-
})),
|
|
1019
|
+
})),GoalDraft: /*#__PURE__*/
|
|
1020
|
+
React.createElement("path", {
|
|
1021
|
+
d: "M19.976 7.616a.492.492 0 00-.025-.306.5.5 0 00-.463-.31h-.127l.614.616zM18.37 7l1.163 1.163-.495.495L17.38 7h.99zm-1.383-2.372V4.5a.5.5 0 00-.615-.488l.615.616zm-1.162-.173l1.162 1.163v.99L15.331 4.95l.495-.495zM13.54 4.15l.346.346-.495.495-.98-.98c.384.02.761.067 1.13.14zm-2.11-.13c-.299.02-.593.057-.88.11l1.674 1.674c.122.005.242.013.362.024a.139.139 0 00.138-.089.757.757 0 01.164-.246l.008-.007-1.467-1.467zm2.559 2.559v.99L16.42 10h.99l-3.423-3.422zm4.51 4.51l-.007.009a.757.757 0 01-.246.163.135.135 0 00-.086.135c.012.121.02.244.024.368l1.675 1.676c.053-.289.09-.582.11-.88l-1.47-1.47zm1.479.489l-.983-.983.495-.495.348.348c.073.368.12.746.14 1.13zm-1.434-2.424l-.495.495L14.34 5.94l.495-.495 3.708 3.708zm1.127 5.087l-1.523-1.523a6.18 6.18 0 01-.155.835l1.424 1.423c.096-.24.18-.485.254-.735zm-.565 1.415L17.75 14.3a6.18 6.18 0 01-.317.672l1.313 1.314c.13-.203.25-.413.361-.629zm-.768 1.212L17.05 15.58a6.22 6.22 0 01-.44.55l1.275 1.275c.158-.173.31-.352.452-.538zM17.39 17.9l-1.274-1.275c-.176.156-.36.303-.552.439l1.287 1.287c.187-.143.366-.293.539-.451zm-1.121.858l-1.314-1.314a6.182 6.182 0 01-.674.317l1.358 1.358a7.99 7.99 0 00.63-.36zm-1.31.67l-1.424-1.424a6.17 6.17 0 01-.836.155l1.524 1.523c.25-.072.496-.157.736-.253zm-1.538.443l-1.676-1.677a6.199 6.199 0 01-1.14-.15l1.936 1.936c.298-.02.592-.057.88-.11zm-1.863.117l-2.55-2.55a6.23 6.23 0 01-2.459-2.46L4 12.43c.02.385.068.762.14 1.13l6.289 6.289c.368.073.746.12 1.13.14zm-2.536-.557l-4.467-4.466a8.027 8.027 0 004.467 4.466zm-5.015-7.985l1.935 1.936a6.205 6.205 0 01-.15-1.14l-1.676-1.677a8.006 8.006 0 00-.11.88zm.297-1.682l1.524 1.524c.033-.285.084-.564.154-.836L4.56 9.028a7.94 7.94 0 00-.254.737zm.564-1.417l1.358 1.358a6.17 6.17 0 01.316-.673L5.23 7.719c-.129.204-.25.414-.36.63zm.768-1.212l1.287 1.287a6.23 6.23 0 01.438-.55L6.088 6.597a8.044 8.044 0 00-.451.538zm.946-1.033l1.274 1.274c.175-.156.36-.303.551-.44L7.121 5.652a8.044 8.044 0 00-.538.452zm1.12-.86l1.314 1.314c.217-.118.442-.225.673-.317L8.333 4.882a7.988 7.988 0 00-.63.361zm1.31-.67l1.423 1.423c.272-.07.55-.122.835-.155L9.748 4.318a7.94 7.94 0 00-.736.254zm4.976 3.985v.246l-.373.372 1.202 1.202.378-.377h.235l-1.442-1.443zm.334 2.315l-1.202-1.202-.495.495 1.202 1.202.495-.495zm.538 1.528c.013-.09.021-.183.025-.276a.318.318 0 01.09-.212l.193-.194 1.389 1.388a4.673 4.673 0 01-.247.743l-1.45-1.449zm-1.528-.538l-1.202-1.202-.042.043a1.294 1.294 0 00-.74.164l1.771 1.772a1.295 1.295 0 00.166-.729l.047-.048zm.937 1.927c.149-.188.274-.396.372-.618l1.328 1.327c-.126.2-.267.391-.421.57L14.27 13.79zm-1.645-.656l-1.77-1.77a1.294 1.294 0 00-.15.84l1.08 1.08a1.309 1.309 0 00.84-.15zm.53 1.522a2.9 2.9 0 00.62-.371l1.279 1.278a4.71 4.71 0 01-.57.42l-1.328-1.327zm-3.822-3.823c.098-.223.223-.43.371-.62L8.425 8.936c-.153.179-.294.37-.42.57l1.328 1.328zm-1.668-.679l1.45 1.45a2.926 2.926 0 00.044 1.035l-1.74-1.74c.061-.258.144-.506.246-.745zm-.37 1.61a4.787 4.787 0 00.065 1.055l3.81 3.81a4.724 4.724 0 001.055.065l-4.93-4.93zm5.796 4.806c.256-.061.505-.144.743-.246l-1.45-1.45a2.926 2.926 0 01-1.034-.045l1.74 1.741zm-3.493-.522L7.941 14.39a4.723 4.723 0 001.657 1.658zM8.92 8.44L10.2 9.718c.188-.148.396-.273.618-.371L9.489 8.019c-.2.126-.39.267-.569.42zm1.218-.762l1.45 1.45a2.92 2.92 0 01.26-.025.318.318 0 00.21-.09l.202-.203-1.379-1.379a4.667 4.667 0 00-.743.247zm1.608-.372l.921.92v-.618c0-.149-.11-.276-.258-.29a4.764 4.764 0 00-.663-.012zm4.937 4.936l-.925-.924h.622c.149 0 .277.11.29.258a4.756 4.756 0 01.012.666z",
|
|
1022
|
+
fillRule: "evenodd"
|
|
1023
|
+
}),Grid: /*#__PURE__*/
|
|
1016
1024
|
React.createElement("path", {
|
|
1017
1025
|
d: "M6 20a2 2 0 01-2-2v-2.583h4.25V20H6zM9.75 20v-4.583h4.5V20h-4.5zM15.75 20v-4.583H20V18a2 2 0 01-2 2h-2.25zM20 13.917h-4.25v-3.834H20v3.834zM20 8.583h-4.25V4H18a2 2 0 012 2v2.583zM14.25 4v4.583h-4.5V4h4.5zM8.25 4v4.583H4V6a2 2 0 012-2h2.25zM4 10.083h4.25v3.834H4v-3.834zM9.75 10.083v3.834h4.5v-3.834h-4.5z"
|
|
1018
1026
|
}),GridGroup: /*#__PURE__*/
|