td-stylekit 28.41.0 → 28.42.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
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [28.42.1](https://github.com/treasure-data/td-stylekit/compare/v28.42.0...v28.42.1) (2024-07-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **CON-16406:** Vendor and fix react-middle-ellipsis ([#1580](https://github.com/treasure-data/td-stylekit/issues/1580)) ([21c4aa4](https://github.com/treasure-data/td-stylekit/commit/21c4aa4843cb8da35119f1c734912edba689fcb1))
|
|
7
|
+
|
|
8
|
+
# [28.42.0](https://github.com/treasure-data/td-stylekit/compare/v28.41.0...v28.42.0) (2024-06-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **CON-14986:** Allow typing in DateControl time fields ([#1575](https://github.com/treasure-data/td-stylekit/issues/1575)) ([a184312](https://github.com/treasure-data/td-stylekit/commit/a1843124080ed7fbd4958d3ace18606487a90786))
|
|
14
|
+
|
|
1
15
|
# [28.41.0](https://github.com/treasure-data/td-stylekit/compare/v28.40.5...v28.41.0) (2024-06-19)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -172,7 +172,7 @@ var UnstyledDateControl = exports.UnstyledDateControl = function UnstyledDateCon
|
|
|
172
172
|
}, [previousValue, value, displayTimePart, resolvedDisplayFormat, previousEditor, editor, locale]);
|
|
173
173
|
var onFocus = function onFocus() {
|
|
174
174
|
window.setTimeout(function () {
|
|
175
|
-
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
175
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current && editor !== 'date-time') {
|
|
176
176
|
inputRef.current.select();
|
|
177
177
|
}
|
|
178
178
|
}, 0);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
/** Only accepts one html element child and the text must be the direct child of that */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** In order to update when the children change a key is required */
|
|
6
|
+
key: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function MiddleEllipsis(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MiddleEllipsis.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MiddleEllipsis = MiddleEllipsis;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
9
|
+
if (typeof window !== "undefined" && !window.gs) window.gs = function () {};
|
|
10
|
+
if (typeof window !== "undefined" && !window.gsC) window.gsC = function () {};
|
|
11
|
+
/**
|
|
12
|
+
MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2019 Peter Bray
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
|
33
|
+
|
|
34
|
+
Copied & modified from https://github.com/bluepeter/react-middle-ellipsis/blob/88bc58d855fb3b47cee2c54b8d5a3c9a736debb7/src/index.js
|
|
35
|
+
*/
|
|
36
|
+
function ellipse(parentNode, childNode, txtNode) {
|
|
37
|
+
var childWidth = childNode.offsetWidth;
|
|
38
|
+
var containerWidth = parentNode.offsetWidth;
|
|
39
|
+
var txtWidth = txtNode.offsetWidth;
|
|
40
|
+
var targetWidth = childWidth > txtWidth ? childWidth : txtWidth;
|
|
41
|
+
if (targetWidth > containerWidth) {
|
|
42
|
+
var _txtNode$textContent;
|
|
43
|
+
var str = (_txtNode$textContent = txtNode.textContent) !== null && _txtNode$textContent !== void 0 ? _txtNode$textContent : '';
|
|
44
|
+
var txtChars = str.length;
|
|
45
|
+
var avgLetterSize = txtWidth / txtChars;
|
|
46
|
+
var canFit = (containerWidth - (targetWidth - txtWidth)) / avgLetterSize;
|
|
47
|
+
var delEachSide = (txtChars - canFit + 5) / 2;
|
|
48
|
+
var endLeft = Math.floor(txtChars / 2 - delEachSide);
|
|
49
|
+
var startRight = Math.ceil(txtChars / 2 + delEachSide);
|
|
50
|
+
txtNode.setAttribute('data-original', str);
|
|
51
|
+
txtNode.textContent = str.substring(0, endLeft) + '...' + str.substring(startRight);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function isHTMLElement(node) {
|
|
55
|
+
if (!node) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
59
|
+
}
|
|
60
|
+
function prepEllipse(node) {
|
|
61
|
+
var parent = node.parentNode;
|
|
62
|
+
var child = node.childNodes[0];
|
|
63
|
+
var txtToEllipse = child;
|
|
64
|
+
if (isHTMLElement(parent) && isHTMLElement(child) && isHTMLElement(txtToEllipse)) {
|
|
65
|
+
// (Re)-set text back to data-original-text if it exists.
|
|
66
|
+
if (txtToEllipse.hasAttribute('data-original')) {
|
|
67
|
+
txtToEllipse.textContent = txtToEllipse.getAttribute('data-original');
|
|
68
|
+
}
|
|
69
|
+
var parentOffsetWidth = isHTMLElement(parent) ? parent.offsetWidth : 0;
|
|
70
|
+
ellipse(
|
|
71
|
+
// Use the smaller width.
|
|
72
|
+
node.offsetWidth > parentOffsetWidth ? parent : node, child, txtToEllipse);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function MiddleEllipsis(props) {
|
|
76
|
+
var measuredParentRef = (0, _react.useRef)(null);
|
|
77
|
+
(0, _react.useEffect)(function () {
|
|
78
|
+
function onResize() {
|
|
79
|
+
if (measuredParentRef.current) {
|
|
80
|
+
prepEllipse(measuredParentRef.current);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Run initially
|
|
85
|
+
onResize();
|
|
86
|
+
window.addEventListener('resize', onResize);
|
|
87
|
+
return function () {
|
|
88
|
+
window.removeEventListener('resize', onResize);
|
|
89
|
+
};
|
|
90
|
+
}, []);
|
|
91
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
92
|
+
"data-gs-c": gsC(props.children),
|
|
93
|
+
"data-gs": gs("src", "middletruncatedtext", "middleellipsis.tsx", "middle-ellipsis", "div"),
|
|
94
|
+
ref: measuredParentRef,
|
|
95
|
+
style: {
|
|
96
|
+
wordBreak: 'keep-all',
|
|
97
|
+
overflowWrap: 'normal'
|
|
98
|
+
},
|
|
99
|
+
children: props.children
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
8
|
-
var
|
|
8
|
+
var _MiddleEllipsis = require("./MiddleEllipsis");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
@@ -31,7 +31,7 @@ var Container = /*#__PURE__*/(0, _base["default"])('div', process.env.NODE_ENV =
|
|
|
31
31
|
} : {
|
|
32
32
|
name: "1bmnxg7",
|
|
33
33
|
styles: "white-space:nowrap",
|
|
34
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
34
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9NaWRkbGVUcnVuY2F0ZWRUZXh0L01pZGRsZVRydW5jYXRlZFRleHQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVlrQiIsImZpbGUiOiIuLi8uLi8uLi9zcmMvTWlkZGxlVHJ1bmNhdGVkVGV4dC9NaWRkbGVUcnVuY2F0ZWRUZXh0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogSWYgYSBzdHJpbmcgb2YgdGV4dCBkb2VzIG5vdCBmaXQgd2l0aGluIHRoZSBhdmFpbGFibGUgd2lkdGggdGhpcyBjb21wb25lbnQgdHJ1bmNhdGVzIGl0IGluIHRoZSBtaWRkbGUgKGVnIFwiYWJjLi4ueHl6XCIpLlxuICpcbiAqIFByaW9yIGFydCBmcm9tIE9TIFggYW5kIGl0cyBzdHlsZSBndWlkZTpcbiAqIGh0dHBzOi8v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biAgaWQsXG4gIHRleHQsXG4gIHRpdGxlXG59OiBNaWRkbGVUcnVuY2F0ZWRUZXh0UHJvcHMpID0+IHtcbiAgcmV0dXJuIChcbiAgICA8Q29udGFpbmVyIGNsYXNzTmFtZT17Y2xhc3NOYW1lfSB0aXRsZT17dGl0bGUgfHwgdGV4dH0+XG4gICAgICA8TWlkZGxlRWxsaXBzaXMga2V5PXt0ZXh0fT5cbiAgICAgICAgPHNwYW4gaWQ9e2lkfT57dGV4dH08L3NwYW4+XG4gICAgICA8L01pZGRsZUVsbGlwc2lzPlxuICAgIDwvQ29udGFpbmVyPlxuICApXG59XG5cbmV4cG9ydCBkZWZhdWx0IE1pZGRsZVRydW5jYXRlZFRleHRcbiJdfQ== */",
|
|
35
35
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
36
36
|
});
|
|
37
37
|
var MiddleTruncatedText = function MiddleTruncatedText(_ref) {
|
|
@@ -44,7 +44,7 @@ var MiddleTruncatedText = function MiddleTruncatedText(_ref) {
|
|
|
44
44
|
"data-gs": gs("src", "middletruncatedtext", "middletruncatedtext.tsx", "container"),
|
|
45
45
|
className: className,
|
|
46
46
|
title: title || text,
|
|
47
|
-
children: (0, _jsxRuntime.jsx)(
|
|
47
|
+
children: (0, _jsxRuntime.jsx)(_MiddleEllipsis.MiddleEllipsis, {
|
|
48
48
|
"data-gs": gs("src", "middletruncatedtext", "middletruncatedtext.tsx", "container", "middle-ellipsis"),
|
|
49
49
|
children: (0, _jsxRuntime.jsx)("span", {
|
|
50
50
|
"data-gs-c": gsC(text),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "td-stylekit",
|
|
3
|
-
"version": "28.
|
|
3
|
+
"version": "28.42.1",
|
|
4
4
|
"main": "dist/es/index.js",
|
|
5
5
|
"module": "dist/es/index.js",
|
|
6
6
|
"types": "dist/es/index.d.ts",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"react-colorful": "^5.5.1",
|
|
83
83
|
"react-day-picker": "7.3.2",
|
|
84
84
|
"react-highlight-words": "^0.16.0",
|
|
85
|
-
"react-middle-ellipsis": "^1.0.12",
|
|
86
85
|
"react-select": "4.3.1",
|
|
87
86
|
"react-sortable-tree": "^2.8.0",
|
|
88
87
|
"use-onclickoutside": "^0.3.1",
|