@vectara/vectara-ui 13.2.4 → 13.3.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/badge/Badge.d.ts +2 -1
- package/lib/components/badge/Badge.js +6 -4
- package/lib/components/badge/_index.scss +3 -3
- package/lib/components/flex/FlexItem.d.ts +1 -0
- package/lib/components/icon/types.d.ts +1 -1
- package/lib/components/icon/types.js +1 -1
- package/lib/styles/index.css +8 -8
- package/package.json +2 -2
|
@@ -10,6 +10,7 @@ type Props = {
|
|
|
10
10
|
href?: LinkProps["href"];
|
|
11
11
|
target?: LinkProps["target"];
|
|
12
12
|
track?: LinkProps["track"];
|
|
13
|
+
isSelected?: boolean;
|
|
13
14
|
};
|
|
14
|
-
export declare const VuiBadge: ({ children, className, color, onClick, onClose, href, target, track, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const VuiBadge: ({ children, className, color, onClick, onClose, href, target, track, isSelected, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -11,24 +11,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import classNames from "classnames";
|
|
14
|
-
import { BiX } from "react-icons/bi";
|
|
14
|
+
import { BiCheck, BiX } from "react-icons/bi";
|
|
15
15
|
import { getTrackingProps } from "../../utils/getTrackingProps";
|
|
16
16
|
import { useVuiContext } from "../context/Context";
|
|
17
17
|
import { VuiIconButton } from "../button/IconButton";
|
|
18
18
|
import { VuiIcon } from "../icon/Icon";
|
|
19
19
|
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
20
20
|
import { VuiFlexItem } from "../flex/FlexItem";
|
|
21
|
+
import { createId } from "../../utils/createId";
|
|
21
22
|
export const BADGE_COLOR = ["accent", "primary", "danger", "warning", "success", "neutral"];
|
|
22
23
|
export const VuiBadge = (_a) => {
|
|
23
|
-
var { children, className, color, onClick, onClose, href, target, track } = _a, rest = __rest(_a, ["children", "className", "color", "onClick", "onClose", "href", "target", "track"]);
|
|
24
|
+
var { children, className, color, onClick, onClose, href, target, track, isSelected } = _a, rest = __rest(_a, ["children", "className", "color", "onClick", "onClose", "href", "target", "track", "isSelected"]);
|
|
24
25
|
const { createLink } = useVuiContext();
|
|
26
|
+
const id = onClose ? createId() : undefined;
|
|
25
27
|
const classes = classNames(className, "vuiBadge", `vuiBadge--${color}`, {
|
|
26
28
|
"vuiBadge--clickable": onClick !== null && onClick !== void 0 ? onClick : href
|
|
27
29
|
});
|
|
28
|
-
const content =
|
|
30
|
+
const content = (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [isSelected && (_jsx(VuiFlexItem, { children: _jsx(VuiIcon, Object.assign({ size: "xs", color: "inherit", className: "vuiBadge__icon" }, { children: _jsx(BiCheck, {}) })) })), _jsx(VuiFlexItem, Object.assign({ id: id }, { children: children })), onClose && (_jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "aria-label": "Remove", "aria-describedby": id, size: "xs", color: "subdued", className: "vuiBadge__icon", onClick: (e) => {
|
|
29
31
|
e.stopPropagation();
|
|
30
32
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
31
|
-
}, icon: _jsx(VuiIcon, Object.assign({ size: "
|
|
33
|
+
}, icon: _jsx(VuiIcon, Object.assign({ size: "xs" }, { children: _jsx(BiX, {}) })) }) }))] })));
|
|
32
34
|
if (onClick) {
|
|
33
35
|
return (_jsx("button", Object.assign({ className: classes, onClick: onClick, type: "button" }, rest, { children: content })));
|
|
34
36
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
.vuiBadge {
|
|
4
4
|
display: inline-block;
|
|
5
5
|
font-size: $fontSizeSmall;
|
|
6
|
-
line-height: 1;
|
|
6
|
+
line-height: 1.25;
|
|
7
7
|
padding: $sizeXxs $sizeXs;
|
|
8
8
|
border-radius: $sizeS;
|
|
9
9
|
font-family: inherit;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.
|
|
18
|
+
.vuiBadge__icon {
|
|
19
19
|
padding: 0px !important;
|
|
20
20
|
height: min-content !important;
|
|
21
21
|
}
|
|
@@ -58,7 +58,7 @@ $color: (
|
|
|
58
58
|
.vuiBadge--#{$colorName} {
|
|
59
59
|
color: #{map.get($colorValue, "color")} !important;
|
|
60
60
|
background-color: #{map.get($colorValue, "background-color")};
|
|
61
|
-
border: 1px solid
|
|
61
|
+
border: 1px solid transparent;
|
|
62
62
|
transition: all $transitionSpeed;
|
|
63
63
|
|
|
64
64
|
&.vuiBadge--clickable:hover {
|
|
@@ -17,6 +17,7 @@ type Props = {
|
|
|
17
17
|
alignItems?: keyof typeof alignItemsToClassNameMap;
|
|
18
18
|
className?: string;
|
|
19
19
|
truncate?: boolean;
|
|
20
|
+
id?: string;
|
|
20
21
|
};
|
|
21
22
|
export declare const VuiFlexItem: ({ children, grow, shrink, basis, alignItems, className, truncate, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const ICON_COLOR: readonly ["inherit", "accent", "primary", "success", "warning", "danger", "subdued", "neutral", "empty"];
|
|
2
|
-
export declare const ICON_SIZE: readonly ["s", "m", "l", "xl", "xxl", "xxxl"];
|
|
2
|
+
export declare const ICON_SIZE: readonly ["xs", "s", "m", "l", "xl", "xxl", "xxxl"];
|
|
3
3
|
export declare const ICON_TYPE: readonly ["default", "enclosed", "token"];
|
package/lib/styles/index.css
CHANGED
|
@@ -553,7 +553,7 @@ fieldset {
|
|
|
553
553
|
.vuiBadge {
|
|
554
554
|
display: inline-block;
|
|
555
555
|
font-size: 12px;
|
|
556
|
-
line-height: 1;
|
|
556
|
+
line-height: 1.25;
|
|
557
557
|
padding: 4px 8px;
|
|
558
558
|
border-radius: 12px;
|
|
559
559
|
font-family: inherit;
|
|
@@ -565,7 +565,7 @@ fieldset {
|
|
|
565
565
|
cursor: pointer;
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
-
.
|
|
568
|
+
.vuiBadge__icon {
|
|
569
569
|
padding: 0px !important;
|
|
570
570
|
height: min-content !important;
|
|
571
571
|
}
|
|
@@ -573,7 +573,7 @@ fieldset {
|
|
|
573
573
|
.vuiBadge--accent {
|
|
574
574
|
color: var(--vui-color-accent-shade) !important;
|
|
575
575
|
background-color: rgba(var(--vui-color-accent-shade-rgb), 0.1);
|
|
576
|
-
border: 1px solid
|
|
576
|
+
border: 1px solid transparent;
|
|
577
577
|
transition: all 0.2s;
|
|
578
578
|
}
|
|
579
579
|
.vuiBadge--accent.vuiBadge--clickable:hover {
|
|
@@ -584,7 +584,7 @@ fieldset {
|
|
|
584
584
|
.vuiBadge--primary {
|
|
585
585
|
color: var(--vui-color-primary-shade) !important;
|
|
586
586
|
background-color: rgba(var(--vui-color-primary-shade-rgb), 0.1);
|
|
587
|
-
border: 1px solid
|
|
587
|
+
border: 1px solid transparent;
|
|
588
588
|
transition: all 0.2s;
|
|
589
589
|
}
|
|
590
590
|
.vuiBadge--primary.vuiBadge--clickable:hover {
|
|
@@ -595,7 +595,7 @@ fieldset {
|
|
|
595
595
|
.vuiBadge--success {
|
|
596
596
|
color: var(--vui-color-success-shade) !important;
|
|
597
597
|
background-color: rgba(var(--vui-color-success-shade-rgb), 0.1);
|
|
598
|
-
border: 1px solid
|
|
598
|
+
border: 1px solid transparent;
|
|
599
599
|
transition: all 0.2s;
|
|
600
600
|
}
|
|
601
601
|
.vuiBadge--success.vuiBadge--clickable:hover {
|
|
@@ -606,7 +606,7 @@ fieldset {
|
|
|
606
606
|
.vuiBadge--warning {
|
|
607
607
|
color: var(--vui-color-warning-shade) !important;
|
|
608
608
|
background-color: rgba(var(--vui-color-warning-shade-rgb), 0.1);
|
|
609
|
-
border: 1px solid
|
|
609
|
+
border: 1px solid transparent;
|
|
610
610
|
transition: all 0.2s;
|
|
611
611
|
}
|
|
612
612
|
.vuiBadge--warning.vuiBadge--clickable:hover {
|
|
@@ -617,7 +617,7 @@ fieldset {
|
|
|
617
617
|
.vuiBadge--danger {
|
|
618
618
|
color: var(--vui-color-danger-shade) !important;
|
|
619
619
|
background-color: rgba(var(--vui-color-danger-shade-rgb), 0.1);
|
|
620
|
-
border: 1px solid
|
|
620
|
+
border: 1px solid transparent;
|
|
621
621
|
transition: all 0.2s;
|
|
622
622
|
}
|
|
623
623
|
.vuiBadge--danger.vuiBadge--clickable:hover {
|
|
@@ -628,7 +628,7 @@ fieldset {
|
|
|
628
628
|
.vuiBadge--neutral {
|
|
629
629
|
color: var(--vui-color-text) !important;
|
|
630
630
|
background-color: var(--vui-color-light-shade);
|
|
631
|
-
border: 1px solid
|
|
631
|
+
border: 1px solid transparent;
|
|
632
632
|
transition: all 0.2s;
|
|
633
633
|
}
|
|
634
634
|
.vuiBadge--neutral.vuiBadge--clickable:hover {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectara/vectara-ui",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.1",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"description": "Vectara's design system, codified as a React and Sass component library",
|
|
6
6
|
"author": "Vectara",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react-focus-on": "^3.8.1",
|
|
54
54
|
"react-icons": "^4.10.1",
|
|
55
55
|
"react-scripts": "^5.0.1",
|
|
56
|
-
"react-tooltip": "^5.
|
|
56
|
+
"react-tooltip": "^5.30.0",
|
|
57
57
|
"sonner": "^2.0.6",
|
|
58
58
|
"web-vitals": "^2.1.4"
|
|
59
59
|
},
|