@digital-ai/dot-components 5.11.0 → 5.12.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/index.esm.js
CHANGED
|
@@ -30,6 +30,63 @@ function useStylesWithRootClass(name, className, ...args) {
|
|
|
30
30
|
return [name, ...(className ? [className] : [])].concat(args).join(' ').trim();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/******************************************************************************
|
|
34
|
+
Copyright (c) Microsoft Corporation.
|
|
35
|
+
|
|
36
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
+
purpose with or without fee is hereby granted.
|
|
38
|
+
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
+
***************************************************************************** */
|
|
47
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
function __rest(s, e) {
|
|
51
|
+
var t = {};
|
|
52
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
53
|
+
t[p] = s[p];
|
|
54
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
55
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
56
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
57
|
+
t[p[i]] = s[p[i]];
|
|
58
|
+
}
|
|
59
|
+
return t;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
63
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
64
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
65
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
66
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
67
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
68
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
73
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
74
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
75
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
79
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
80
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
81
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
82
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
86
|
+
var e = new Error(message);
|
|
87
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
88
|
+
};
|
|
89
|
+
|
|
33
90
|
const checkIfOverflowPresentInElementTree = element => {
|
|
34
91
|
if (element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight) {
|
|
35
92
|
return true;
|
|
@@ -1319,10 +1376,12 @@ const DotTooltip = ({
|
|
|
1319
1376
|
open,
|
|
1320
1377
|
placement = 'bottom',
|
|
1321
1378
|
popperClassName,
|
|
1379
|
+
popperOptions,
|
|
1322
1380
|
slotProps,
|
|
1323
1381
|
title,
|
|
1324
1382
|
childrenDisplayStyle
|
|
1325
1383
|
}) => {
|
|
1384
|
+
var _a;
|
|
1326
1385
|
const rootClasses = useStylesWithRootClass('dot-tooltip', className);
|
|
1327
1386
|
const [hasTooltipOnHover, setHasTooltipOnHover] = useState(false);
|
|
1328
1387
|
const childrenWrapperRef = useRef(undefined);
|
|
@@ -1347,6 +1406,16 @@ const DotTooltip = ({
|
|
|
1347
1406
|
if (!title) {
|
|
1348
1407
|
return children;
|
|
1349
1408
|
}
|
|
1409
|
+
// MUI v5 Tooltip reads popperOptions exclusively from PopperProps.popperOptions —
|
|
1410
|
+
// it overrides any popperOptions in slotProps.popper at render time (see Tooltip.js:573).
|
|
1411
|
+
// To ensure both the popperOptions prop and any consumer-provided slotProps.popper.popperOptions
|
|
1412
|
+
// are forwarded to createPopper, we merge them here and pass via PopperProps.
|
|
1413
|
+
const _b = (_a = slotProps === null || slotProps === void 0 ? void 0 : slotProps.popper) !== null && _a !== void 0 ? _a : {},
|
|
1414
|
+
{
|
|
1415
|
+
popperOptions: slotPopperOptions
|
|
1416
|
+
} = _b,
|
|
1417
|
+
restPopperSlotProps = __rest(_b, ["popperOptions"]);
|
|
1418
|
+
const resolvedPopperOptions = popperOptions || slotPopperOptions ? Object.assign(Object.assign({}, popperOptions), slotPopperOptions) : undefined;
|
|
1350
1419
|
return jsx(Tooltip, {
|
|
1351
1420
|
"aria-hidden": false,
|
|
1352
1421
|
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : isString$2(title) ? title.toString() : 'Information tooltip',
|
|
@@ -1362,10 +1431,14 @@ const DotTooltip = ({
|
|
|
1362
1431
|
open: open,
|
|
1363
1432
|
placement: placement,
|
|
1364
1433
|
PopperProps: {
|
|
1365
|
-
|
|
1366
|
-
className: popperClassName
|
|
1434
|
+
popperOptions: resolvedPopperOptions
|
|
1367
1435
|
},
|
|
1368
|
-
slotProps: slotProps,
|
|
1436
|
+
slotProps: Object.assign(Object.assign({}, slotProps), {
|
|
1437
|
+
popper: Object.assign({
|
|
1438
|
+
disablePortal,
|
|
1439
|
+
className: popperClassName
|
|
1440
|
+
}, restPopperSlotProps)
|
|
1441
|
+
}),
|
|
1369
1442
|
role: ariaRole,
|
|
1370
1443
|
title: title,
|
|
1371
1444
|
followCursor: followCursor,
|
|
@@ -2082,63 +2155,6 @@ const DotAnnotation = ({
|
|
|
2082
2155
|
});
|
|
2083
2156
|
};
|
|
2084
2157
|
|
|
2085
|
-
/******************************************************************************
|
|
2086
|
-
Copyright (c) Microsoft Corporation.
|
|
2087
|
-
|
|
2088
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2089
|
-
purpose with or without fee is hereby granted.
|
|
2090
|
-
|
|
2091
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2092
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2093
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2094
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2095
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2096
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2097
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2098
|
-
***************************************************************************** */
|
|
2099
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
function __rest(s, e) {
|
|
2103
|
-
var t = {};
|
|
2104
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2105
|
-
t[p] = s[p];
|
|
2106
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2107
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2108
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2109
|
-
t[p[i]] = s[p[i]];
|
|
2110
|
-
}
|
|
2111
|
-
return t;
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2115
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2116
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2117
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2118
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2119
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2120
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2121
|
-
});
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2125
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2126
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2127
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2131
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2132
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2133
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2134
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2138
|
-
var e = new Error(message);
|
|
2139
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2140
|
-
};
|
|
2141
|
-
|
|
2142
2158
|
const OpenAPI$1 = {
|
|
2143
2159
|
BASE: '',
|
|
2144
2160
|
TOKEN: undefined,
|
|
@@ -15860,6 +15876,20 @@ const StyledNavigationRail = styled.div`
|
|
|
15860
15876
|
}
|
|
15861
15877
|
}
|
|
15862
15878
|
|
|
15879
|
+
&.ai-rail {
|
|
15880
|
+
&.selected,
|
|
15881
|
+
&:focus-visible,
|
|
15882
|
+
&:hover {
|
|
15883
|
+
background-color: ${theme.palette.figma.aiPink.light} !important;
|
|
15884
|
+
}
|
|
15885
|
+
&.selected {
|
|
15886
|
+
border-image: ${theme.palette.figma.gradient.active} 1;
|
|
15887
|
+
}
|
|
15888
|
+
.dot-icon {
|
|
15889
|
+
color: transparent !important;
|
|
15890
|
+
}
|
|
15891
|
+
}
|
|
15892
|
+
|
|
15863
15893
|
.rail-item-text {
|
|
15864
15894
|
word-break: break-word;
|
|
15865
15895
|
padding: ${theme.spacing(0, 0.5)};
|
|
@@ -15869,7 +15899,7 @@ const StyledNavigationRail = styled.div`
|
|
|
15869
15899
|
`}
|
|
15870
15900
|
`;
|
|
15871
15901
|
|
|
15872
|
-
const MAX_ALLOWED_ITEMS =
|
|
15902
|
+
const MAX_ALLOWED_ITEMS = 8;
|
|
15873
15903
|
const DotNavigationRail = ({
|
|
15874
15904
|
ariaLabel,
|
|
15875
15905
|
className,
|
|
@@ -15891,8 +15921,9 @@ const DotNavigationRail = ({
|
|
|
15891
15921
|
onChange && onChange(index);
|
|
15892
15922
|
};
|
|
15893
15923
|
const checkIfSelected = index => selectedItemIndex === index;
|
|
15894
|
-
const renderIcon = (iconId, railIconBadge) => {
|
|
15924
|
+
const renderIcon = (ai, iconId, railIconBadge) => {
|
|
15895
15925
|
const icon = jsx(DotIcon, {
|
|
15926
|
+
ai: ai,
|
|
15896
15927
|
className: "rail-item-button-icon",
|
|
15897
15928
|
iconId: iconId
|
|
15898
15929
|
});
|
|
@@ -15904,18 +15935,20 @@ const DotNavigationRail = ({
|
|
|
15904
15935
|
};
|
|
15905
15936
|
const renderRailItems = () => {
|
|
15906
15937
|
return railItems === null || railItems === void 0 ? void 0 : railItems.slice(0, MAX_ALLOWED_ITEMS).map(({
|
|
15938
|
+
ai,
|
|
15907
15939
|
ariaLabel: itemAriaLabel,
|
|
15908
15940
|
iconBadge,
|
|
15909
15941
|
iconId,
|
|
15910
15942
|
title
|
|
15911
15943
|
}, index) => jsxs(DotButton, {
|
|
15912
15944
|
ariaLabel: itemAriaLabel,
|
|
15913
|
-
className: useStylesWithRootClass('rail-item-button', checkIfSelected(index) && 'selected'),
|
|
15945
|
+
className: useStylesWithRootClass('rail-item-button', ai ? 'ai-rail' : '', checkIfSelected(index) && 'selected'),
|
|
15914
15946
|
"data-testid": `rail-item-${index}`,
|
|
15915
15947
|
disableRipple: true,
|
|
15916
15948
|
onClick: onItemSelect(index),
|
|
15917
15949
|
type: "text",
|
|
15918
|
-
children: [iconId && renderIcon(iconId, iconBadge), jsx(DotTypography, {
|
|
15950
|
+
children: [iconId && renderIcon(ai, iconId, iconBadge), jsx(DotTypography, {
|
|
15951
|
+
ai: ai,
|
|
15919
15952
|
className: "rail-item-text",
|
|
15920
15953
|
variant: "body2",
|
|
15921
15954
|
children: title
|
package/package.json
CHANGED
|
@@ -3,6 +3,8 @@ import { BadgeProps } from '../badge';
|
|
|
3
3
|
export type RailItemsPosition = 'flex-start' | 'center' | 'flex-end';
|
|
4
4
|
export type RailIconBadge = Omit<BadgeProps, 'children'>;
|
|
5
5
|
export interface RailItem {
|
|
6
|
+
/** If true, applies AI color scheme on the elements */
|
|
7
|
+
ai?: boolean;
|
|
6
8
|
/** Defines a string value that labels the current element **/
|
|
7
9
|
ariaLabel?: string;
|
|
8
10
|
/** Optional badge which will be displayed over an icon **/
|
|
@@ -33,8 +33,10 @@ export interface TooltipProps extends CommonProps {
|
|
|
33
33
|
open?: boolean;
|
|
34
34
|
placement?: TooltipPlacement;
|
|
35
35
|
popperClassName?: string;
|
|
36
|
+
/** Options forwarded to the underlying Popper.js instance (e.g. strategy, modifiers). */
|
|
37
|
+
popperOptions?: PopperProps['popperOptions'];
|
|
36
38
|
/** The extra props for the slot components, like popper. It allows to override the existing props or add new ones. */
|
|
37
39
|
slotProps?: SlotProps;
|
|
38
40
|
title?: ReactNode | string | number;
|
|
39
41
|
}
|
|
40
|
-
export declare const DotTooltip: ({ ariaLabel, ariaRole, arrow, children, className, "data-testid": dataTestId, disablePortal, disableInteractive, followCursor, enterDelay, enterNextDelay, hoverVisibility, leaveDelay, onClose, open, placement, popperClassName, slotProps, title, childrenDisplayStyle, }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare const DotTooltip: ({ ariaLabel, ariaRole, arrow, children, className, "data-testid": dataTestId, disablePortal, disableInteractive, followCursor, enterDelay, enterNextDelay, hoverVisibility, leaveDelay, onClose, open, placement, popperClassName, popperOptions, slotProps, title, childrenDisplayStyle, }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|