@indico-data/design-system 3.6.3 → 3.7.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/lib/components/truncate/Truncate.d.ts +1 -1
- package/lib/components/truncate/types.d.ts +2 -3
- package/lib/index.d.ts +3 -4
- package/lib/index.esm.js +22 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +22 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/forms/date/datePicker/DatePicker.tsx +26 -1
- package/src/components/truncate/Truncate.stories.tsx +7 -7
- package/src/components/truncate/Truncate.tsx +4 -4
- package/src/components/truncate/__tests__/Truncate.test.tsx +2 -2
- package/src/components/truncate/types.ts +2 -3
package/lib/index.js
CHANGED
|
@@ -13674,7 +13674,26 @@ const DatePicker = (props) => {
|
|
|
13674
13674
|
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
13675
13675
|
};
|
|
13676
13676
|
const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
|
|
13677
|
-
|
|
13677
|
+
const wrapperRef = React.useRef(null);
|
|
13678
|
+
// Disable tab focus on all date picker elements
|
|
13679
|
+
React.useEffect(() => {
|
|
13680
|
+
const disableTabFocus = () => {
|
|
13681
|
+
if (wrapperRef.current) {
|
|
13682
|
+
const focusableElements = wrapperRef.current.querySelectorAll('button, input, select, textarea, a, [tabindex]:not([tabindex="-1"])');
|
|
13683
|
+
focusableElements.forEach((element) => {
|
|
13684
|
+
element.tabIndex = -1;
|
|
13685
|
+
});
|
|
13686
|
+
}
|
|
13687
|
+
};
|
|
13688
|
+
// Run immediately and set up observer for dynamic elements
|
|
13689
|
+
disableTabFocus();
|
|
13690
|
+
const observer = new MutationObserver(disableTabFocus);
|
|
13691
|
+
if (wrapperRef.current) {
|
|
13692
|
+
observer.observe(wrapperRef.current, { childList: true, subtree: true });
|
|
13693
|
+
}
|
|
13694
|
+
return () => observer.disconnect();
|
|
13695
|
+
}, []);
|
|
13696
|
+
return (jsxRuntime.jsxs("div", { className: "date-picker-wrapper", tabIndex: -1, ref: wrapperRef, children: [hasTimePicker && (jsxRuntime.jsx("div", { className: "time-picker-wrapper", children: jsxRuntime.jsxs(Row, { align: "center", children: [jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx("p", { className: "ma-0", children: "Select Time" }) }), jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(TimePicker, { ref: ref, timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange, readonly: isReadOnly, tabIndex: timeTabIndex }) })] }) })), jsxRuntime.jsx(DayPicker, Object.assign({}, finalProps))] }));
|
|
13678
13697
|
};
|
|
13679
13698
|
|
|
13680
13699
|
const IconTriggerDatePicker = (props) => {
|
|
@@ -43263,7 +43282,7 @@ function v4(options, buf, offset) {
|
|
|
43263
43282
|
}
|
|
43264
43283
|
|
|
43265
43284
|
const Truncate = (_a) => {
|
|
43266
|
-
var { numLines = 1,
|
|
43285
|
+
var { numLines = 1, tooltipOptions = {}, children } = _a, rest = __rest(_a, ["numLines", "tooltipOptions", "children"]);
|
|
43267
43286
|
const [isTruncated, setIsTruncated] = React.useState(false);
|
|
43268
43287
|
const id = React.useMemo(() => v4().replace(/[^a-zA-Z0-9-_]/g, '_'), []);
|
|
43269
43288
|
const ref = React.useRef(null);
|
|
@@ -43289,7 +43308,7 @@ const Truncate = (_a) => {
|
|
|
43289
43308
|
return (jsxRuntime.jsxs("div", { className: "truncate-wrapper", style: truncateStyle, children: [jsxRuntime.jsx("span", Object.assign({ ref: ref, "data-testid": `truncate-${id}-${isTruncated ? 'truncated' : 'not-truncated'}`, "data-tooltip-id": id, className: classNames('truncate', {
|
|
43290
43309
|
'truncate--multi-line': numLines > 1,
|
|
43291
43310
|
'truncate--single-line': numLines === 1,
|
|
43292
|
-
}) }, rest, { children:
|
|
43311
|
+
}) }, rest, { children: children })), isTruncated && children && !tooltipOptions.disabled && (jsxRuntime.jsx(Tooltip, Object.assign({}, tooltipOptions, { id: id, children: children })))] }));
|
|
43293
43312
|
};
|
|
43294
43313
|
|
|
43295
43314
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|