@vectara/vectara-ui 10.0.1 → 11.0.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/lib/components/app/AppHeader.d.ts +2 -1
- package/lib/components/app/AppHeader.js +4 -2
- package/lib/components/button/IconButton.d.ts +5 -0
- package/lib/components/button/IconButton.js +2 -2
- package/lib/components/image/ImagePreview.js +11 -2
- package/lib/components/tabs/_enclosed.scss +5 -5
- package/lib/components/tabs/_index.scss +2 -2
- package/lib/components/tabs/_open.scss +1 -1
- package/lib/components/tooltip/Tooltip.d.ts +5 -3
- package/lib/components/tooltip/Tooltip.js +6 -2
- package/lib/components/tooltip/_index.scss +2 -1
- package/lib/sassUtils/_colors.scss +2 -2
- package/lib/styles/index.css +16 -15
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ type ContentProps = {
|
|
|
12
12
|
};
|
|
13
13
|
type Props = (SidedProps | ContentProps) & {
|
|
14
14
|
className?: string;
|
|
15
|
+
darkTheme?: boolean;
|
|
15
16
|
};
|
|
16
|
-
export declare const VuiAppHeader: ({ left, right, content, growRight, className, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const VuiAppHeader: ({ left, right, content, growRight, className, darkTheme, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -14,7 +14,9 @@ import classNames from "classnames";
|
|
|
14
14
|
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
15
15
|
import { VuiFlexItem } from "../flex/FlexItem";
|
|
16
16
|
export const VuiAppHeader = (_a) => {
|
|
17
|
-
var { left, right, content, growRight, className } = _a, rest = __rest(_a, ["left", "right", "content", "growRight", "className"]);
|
|
18
|
-
const classes = classNames("vuiAppHeader", className
|
|
17
|
+
var { left, right, content, growRight, className, darkTheme } = _a, rest = __rest(_a, ["left", "right", "content", "growRight", "className", "darkTheme"]);
|
|
18
|
+
const classes = classNames("vuiAppHeader", className, {
|
|
19
|
+
vuiThemeDark: darkTheme
|
|
20
|
+
});
|
|
19
21
|
return (_jsx("div", Object.assign({ className: classes }, rest, { children: content ? (content) : (_jsxs(VuiFlexContainer, Object.assign({ className: "vuiAppHeader__inner", justifyContent: "spaceBetween", alignItems: "center" }, { children: [Boolean(left) && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: left }))), Boolean(right) && (_jsx(VuiFlexItem, Object.assign({ grow: growRight ? 1 : false, shrink: false }, { children: right })))] }))) })));
|
|
20
22
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import { ButtonColor, BUTTON_SIZE } from "./types";
|
|
3
3
|
import { LinkProps } from "../link/types";
|
|
4
|
+
import { Props as TooltipProps } from "../tooltip/Tooltip";
|
|
4
5
|
type Props = {
|
|
5
6
|
className?: string;
|
|
6
7
|
icon: ReactElement;
|
|
@@ -17,6 +18,10 @@ type Props = {
|
|
|
17
18
|
tabIndex?: number;
|
|
18
19
|
isSelected?: boolean;
|
|
19
20
|
isDisabled?: boolean;
|
|
21
|
+
tooltip?: {
|
|
22
|
+
darkTheme?: TooltipProps["darkTheme"];
|
|
23
|
+
position?: TooltipProps["position"];
|
|
24
|
+
};
|
|
20
25
|
};
|
|
21
26
|
export declare const VuiIconButton: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLButtonElement | null>>;
|
|
22
27
|
export {};
|
|
@@ -17,7 +17,7 @@ import { createButtonIcon } from "./createButtonIcon";
|
|
|
17
17
|
import { useVuiContext } from "../context/Context";
|
|
18
18
|
import { VuiTooltip } from "../tooltip/Tooltip";
|
|
19
19
|
export const VuiIconButton = forwardRef((_a, ref) => {
|
|
20
|
-
var { className, icon, color = "primary", size = "m", onClick, onMouseOver, onMouseOut, onMouseMove, href, target, track, tabIndex, isSelected = false, isDisabled = false } = _a, rest = __rest(_a, ["className", "icon", "color", "size", "onClick", "onMouseOver", "onMouseOut", "onMouseMove", "href", "target", "track", "tabIndex", "isSelected", "isDisabled"]);
|
|
20
|
+
var { className, icon, color = "primary", size = "m", onClick, onMouseOver, onMouseOut, onMouseMove, href, target, track, tabIndex, tooltip = {}, isSelected = false, isDisabled = false } = _a, rest = __rest(_a, ["className", "icon", "color", "size", "onClick", "onMouseOver", "onMouseOut", "onMouseMove", "href", "target", "track", "tabIndex", "tooltip", "isSelected", "isDisabled"]);
|
|
21
21
|
const { createLink } = useVuiContext();
|
|
22
22
|
const props = Object.assign({ className: classNames("vuiIconButton", className, `vuiIconButton--${color}`, `vuiIconButton--${size}`, {
|
|
23
23
|
[`vuiIconButton--${color}-isSelected`]: isSelected,
|
|
@@ -36,5 +36,5 @@ export const VuiIconButton = forwardRef((_a, ref) => {
|
|
|
36
36
|
else {
|
|
37
37
|
iconButton = (_jsx("button", Object.assign({ type: "button" }, props, { ref: ref, disabled: isDisabled }, { children: buttonIcon })));
|
|
38
38
|
}
|
|
39
|
-
return _jsx(VuiTooltip, Object.assign({ tip: rest["aria-label"] }, { children: iconButton }));
|
|
39
|
+
return (_jsx(VuiTooltip, Object.assign({}, tooltip, { tip: rest["aria-label"] }, { children: iconButton })));
|
|
40
40
|
});
|
|
@@ -52,8 +52,17 @@ export const VuiImagePreview = ({ images, initialIndex = 0, isOpen, onClose, cla
|
|
|
52
52
|
return (_jsx(VuiPortal, { children: isOpen && (_jsx("div", Object.assign({ className: className }, { children: _jsx(FocusOn, Object.assign({ onEscapeKey: handleOnClose, returnFocus: false, autoFocus: isOpen }, { children: _jsx("figure", { children: _jsx("div", Object.assign({ className: "vuiImagePreview__container" }, { children: _jsxs("div", Object.assign({ className: "vuiImagePreview__mask", onClick: handleOnClose }, { children: [_jsx("div", Object.assign({ onClick: (e) => e.stopPropagation() }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", justifyContent: "spaceBetween", className: "vuiImagePreview__header" }, { children: [_jsx(VuiFlexItem, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xs" }, { children: [isCarousel && (_jsxs(_Fragment, { children: [_jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "aria-label": "Previous image", onClick: (e) => {
|
|
53
53
|
e.stopPropagation();
|
|
54
54
|
handlePrevious();
|
|
55
|
-
}, color: "neutral", size: "s", icon: _jsx(VuiIcon, Object.assign({ size: "m", color: "empty" }, { children: _jsx(BiChevronLeft, {}) }))
|
|
55
|
+
}, color: "neutral", size: "s", icon: _jsx(VuiIcon, Object.assign({ size: "m", color: "empty" }, { children: _jsx(BiChevronLeft, {}) })), tooltip: {
|
|
56
|
+
darkTheme: true,
|
|
57
|
+
position: "bottom-end"
|
|
58
|
+
} }) }), _jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "aria-label": "Next image", onClick: (e) => {
|
|
56
59
|
e.stopPropagation();
|
|
57
60
|
handleNext();
|
|
58
|
-
}, color: "neutral", size: "s", icon: _jsx(VuiIcon, Object.assign({ size: "m", color: "empty" }, { children: _jsx(BiChevronRight, {}) }))
|
|
61
|
+
}, color: "neutral", size: "s", icon: _jsx(VuiIcon, Object.assign({ size: "m", color: "empty" }, { children: _jsx(BiChevronRight, {}) })), tooltip: {
|
|
62
|
+
darkTheme: true,
|
|
63
|
+
position: "bottom"
|
|
64
|
+
} }) })] })), _jsx(VuiFlexItem, { children: _jsx(VuiText, Object.assign({ size: "s" }, { children: _jsx(VuiTextColor, Object.assign({ color: "empty" }, { children: _jsxs("figcaption", { children: [isCarousel && `Image ${currentIndex + 1} of ${images.length}: `, images[currentIndex].caption] }) })) })) })] })) }), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx("div", Object.assign({ className: "vuiImagePreview__closeButton" }, { children: _jsx(VuiIconButton, { "aria-label": "Close preview", onClick: handleOnClose, color: "neutral", icon: _jsx(VuiIcon, Object.assign({ size: "l", color: "empty" }, { children: _jsx(BiX, {}) })), tooltip: {
|
|
65
|
+
darkTheme: true,
|
|
66
|
+
position: "bottom-end"
|
|
67
|
+
} }) })) }))] })) })), _jsx("div", Object.assign({ className: "vuiImagePreview__imageContainer" }, { children: _jsx("img", { src: images[currentIndex].src, alt: images[currentIndex].alt, className: "vuiImagePreview__image", draggable: false }) }))] })) })) }) })) }))) }));
|
|
59
68
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.vuiTabs--enclosed {
|
|
2
2
|
display: inline-flex;
|
|
3
|
-
background-color:
|
|
3
|
+
background-color: var(--color-light-shade);
|
|
4
4
|
border-radius: $sizeXxs;
|
|
5
5
|
padding: $sizeXxxs $sizeXs;
|
|
6
6
|
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
.vuiTab {
|
|
24
24
|
&:hover {
|
|
25
25
|
.vuiTab__inner {
|
|
26
|
-
color:
|
|
27
|
-
background-color:
|
|
26
|
+
color: var(--color-full-shade);
|
|
27
|
+
background-color: rgba(var(--color-empty-shade-rgb), 0.75);
|
|
28
28
|
|
|
29
29
|
.vuiIcon__inner {
|
|
30
|
-
color:
|
|
30
|
+
color: var(--color-full-shade) !important;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&.vuiTab-isActive {
|
|
36
36
|
.vuiTab__inner {
|
|
37
|
-
background-color:
|
|
37
|
+
background-color: var(--color-empty-shade);
|
|
38
38
|
box-shadow: $shadowSmallEnd;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
white-space: nowrap;
|
|
66
66
|
flex-grow: 0;
|
|
67
67
|
flex-shrink: 0;
|
|
68
|
-
color:
|
|
68
|
+
color: var(--color-subdued);
|
|
69
69
|
text-decoration: none;
|
|
70
70
|
cursor: pointer;
|
|
71
71
|
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
|
|
80
80
|
&.vuiTab-isActive {
|
|
81
81
|
pointer-events: none;
|
|
82
|
-
color:
|
|
82
|
+
color: var(--color-full-shade);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { TooltipRefProps } from "react-tooltip";
|
|
2
|
+
export type Props = {
|
|
2
3
|
children: React.ReactNode;
|
|
3
4
|
tip: React.ReactNode;
|
|
5
|
+
darkTheme?: boolean;
|
|
6
|
+
position?: TooltipRefProps["place"];
|
|
4
7
|
};
|
|
5
|
-
export declare const VuiTooltip: ({ children, tip }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
8
|
+
export declare const VuiTooltip: ({ children, darkTheme, position, tip }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
2
3
|
import { useState, cloneElement } from "react";
|
|
3
4
|
import { Tooltip } from "react-tooltip";
|
|
4
5
|
const generateTooltipId = () => {
|
|
5
6
|
return `tooltip-${Math.random().toString(36).slice(2, 9)}`;
|
|
6
7
|
};
|
|
7
|
-
export const VuiTooltip = ({ children, tip }) => {
|
|
8
|
+
export const VuiTooltip = ({ children, darkTheme, position, tip }) => {
|
|
8
9
|
const [id] = useState(generateTooltipId());
|
|
9
10
|
const target = cloneElement(children, {
|
|
10
11
|
"data-tooltip-id": id
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
+
const classes = classNames("vuiTooltip", {
|
|
14
|
+
vuiThemeDark: darkTheme
|
|
15
|
+
});
|
|
16
|
+
return (_jsxs(_Fragment, { children: [target, _jsx(Tooltip, Object.assign({ id: id, offset: 10, className: classes, opacity: 1, place: position }, { children: tip }))] }));
|
|
13
17
|
};
|
|
14
18
|
// This is a workaround for the issue with ResizeObserver in ReactTooltip.
|
|
15
19
|
// Without this, uncaught runtime errors are thrown: "ResizeObserver loop
|
|
@@ -39,7 +39,7 @@ $colorDarkerShade: #1c1d22 !default;
|
|
|
39
39
|
$colorFullShade: #0b0c0e !default;
|
|
40
40
|
|
|
41
41
|
:root,
|
|
42
|
-
.
|
|
42
|
+
.vuiThemeLight {
|
|
43
43
|
// Semantic colors
|
|
44
44
|
--color-accent: #{$colorAccent};
|
|
45
45
|
--color-accent-rgb: #{toRgb($colorAccent)};
|
|
@@ -105,7 +105,7 @@ $colorFullShade: #0b0c0e !default;
|
|
|
105
105
|
--color-border-light: #e3e4f3;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.
|
|
108
|
+
.vuiThemeDark {
|
|
109
109
|
// // Semantic colors
|
|
110
110
|
// --color-accent: #{$colorAccentLighterShade};
|
|
111
111
|
// --color-accent-light-shade: #{$colorAccentLightShade};
|
package/lib/styles/index.css
CHANGED
|
@@ -186,7 +186,7 @@ fieldset {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
:root,
|
|
189
|
-
.
|
|
189
|
+
.vuiThemeLight {
|
|
190
190
|
--color-accent: #5f30c3;
|
|
191
191
|
--color-accent-rgb: 95, 48, 195;
|
|
192
192
|
--color-accent-light-shade: rgba(95, 48, 195, 0.5);
|
|
@@ -239,7 +239,7 @@ fieldset {
|
|
|
239
239
|
--color-border-light: #e3e4f3;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
.
|
|
242
|
+
.vuiThemeDark {
|
|
243
243
|
--color-primary-highlight: #d9e2ff;
|
|
244
244
|
--color-primary-highlight-rgb: 217, 226, 255;
|
|
245
245
|
--color-subdued: #6d7686;
|
|
@@ -2226,7 +2226,7 @@ h2.react-datepicker__current-month {
|
|
|
2226
2226
|
}
|
|
2227
2227
|
|
|
2228
2228
|
:root,
|
|
2229
|
-
.
|
|
2229
|
+
.vuiThemeLight {
|
|
2230
2230
|
--color-accent: #5f30c3;
|
|
2231
2231
|
--color-accent-rgb: 95, 48, 195;
|
|
2232
2232
|
--color-accent-light-shade: rgba(95, 48, 195, 0.5);
|
|
@@ -2279,7 +2279,7 @@ h2.react-datepicker__current-month {
|
|
|
2279
2279
|
--color-border-light: #e3e4f3;
|
|
2280
2280
|
}
|
|
2281
2281
|
|
|
2282
|
-
.
|
|
2282
|
+
.vuiThemeDark {
|
|
2283
2283
|
--color-primary-highlight: #d9e2ff;
|
|
2284
2284
|
--color-primary-highlight-rgb: 217, 226, 255;
|
|
2285
2285
|
--color-subdued: #6d7686;
|
|
@@ -4266,7 +4266,7 @@ h2.react-datepicker__current-month {
|
|
|
4266
4266
|
}
|
|
4267
4267
|
|
|
4268
4268
|
:root,
|
|
4269
|
-
.
|
|
4269
|
+
.vuiThemeLight {
|
|
4270
4270
|
--color-accent: #5f30c3;
|
|
4271
4271
|
--color-accent-rgb: 95, 48, 195;
|
|
4272
4272
|
--color-accent-light-shade: rgba(95, 48, 195, 0.5);
|
|
@@ -4319,7 +4319,7 @@ h2.react-datepicker__current-month {
|
|
|
4319
4319
|
--color-border-light: #e3e4f3;
|
|
4320
4320
|
}
|
|
4321
4321
|
|
|
4322
|
-
.
|
|
4322
|
+
.vuiThemeDark {
|
|
4323
4323
|
--color-primary-highlight: #d9e2ff;
|
|
4324
4324
|
--color-primary-highlight-rgb: 217, 226, 255;
|
|
4325
4325
|
--color-subdued: #6d7686;
|
|
@@ -4741,12 +4741,12 @@ h2.react-datepicker__current-month {
|
|
|
4741
4741
|
box-shadow: var(--color-border) 0px 1px 0px;
|
|
4742
4742
|
}
|
|
4743
4743
|
.vuiTabs--open .vuiTab.vuiTab-isActive .vuiTab__inner {
|
|
4744
|
-
background-color:
|
|
4744
|
+
background-color: var(--color-light-shade);
|
|
4745
4745
|
}
|
|
4746
4746
|
|
|
4747
4747
|
.vuiTabs--enclosed {
|
|
4748
4748
|
display: inline-flex;
|
|
4749
|
-
background-color:
|
|
4749
|
+
background-color: var(--color-light-shade);
|
|
4750
4750
|
border-radius: 4px;
|
|
4751
4751
|
padding: 2px 8px;
|
|
4752
4752
|
}
|
|
@@ -4757,14 +4757,14 @@ h2.react-datepicker__current-month {
|
|
|
4757
4757
|
padding: 8px 16px;
|
|
4758
4758
|
}
|
|
4759
4759
|
.vuiTabs--enclosed .vuiTab:hover .vuiTab__inner {
|
|
4760
|
-
color:
|
|
4761
|
-
background-color: rgba(
|
|
4760
|
+
color: var(--color-full-shade);
|
|
4761
|
+
background-color: rgba(var(--color-empty-shade-rgb), 0.75);
|
|
4762
4762
|
}
|
|
4763
4763
|
.vuiTabs--enclosed .vuiTab:hover .vuiTab__inner .vuiIcon__inner {
|
|
4764
|
-
color:
|
|
4764
|
+
color: var(--color-full-shade) !important;
|
|
4765
4765
|
}
|
|
4766
4766
|
.vuiTabs--enclosed .vuiTab.vuiTab-isActive .vuiTab__inner {
|
|
4767
|
-
background-color:
|
|
4767
|
+
background-color: var(--color-empty-shade);
|
|
4768
4768
|
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
|
|
4769
4769
|
}
|
|
4770
4770
|
|
|
@@ -4820,7 +4820,7 @@ h2.react-datepicker__current-month {
|
|
|
4820
4820
|
white-space: nowrap;
|
|
4821
4821
|
flex-grow: 0;
|
|
4822
4822
|
flex-shrink: 0;
|
|
4823
|
-
color:
|
|
4823
|
+
color: var(--color-subdued);
|
|
4824
4824
|
text-decoration: none;
|
|
4825
4825
|
cursor: pointer;
|
|
4826
4826
|
}
|
|
@@ -4832,7 +4832,7 @@ h2.react-datepicker__current-month {
|
|
|
4832
4832
|
}
|
|
4833
4833
|
.vuiTab.vuiTab-isActive {
|
|
4834
4834
|
pointer-events: none;
|
|
4835
|
-
color:
|
|
4835
|
+
color: var(--color-full-shade);
|
|
4836
4836
|
}
|
|
4837
4837
|
|
|
4838
4838
|
.vuiTimelineContainer {
|
|
@@ -4923,7 +4923,8 @@ h2.react-datepicker__current-month {
|
|
|
4923
4923
|
}
|
|
4924
4924
|
|
|
4925
4925
|
.vuiTooltip {
|
|
4926
|
-
background-color:
|
|
4926
|
+
background-color: var(--color-darker-shade) !important;
|
|
4927
|
+
color: var(--color-empty-shade) !important;
|
|
4927
4928
|
z-index: 2000 !important;
|
|
4928
4929
|
}
|
|
4929
4930
|
|