@vectara/vectara-ui 16.9.0 → 16.10.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.
|
@@ -11,6 +11,7 @@ type Props = {
|
|
|
11
11
|
target?: LinkProps["target"];
|
|
12
12
|
track?: LinkProps["track"];
|
|
13
13
|
isSelected?: boolean;
|
|
14
|
+
size?: "s" | "m" | "l";
|
|
14
15
|
};
|
|
15
|
-
export declare const VuiBadge: ({ children, className, color, onClick, onClose, href, target, track, isSelected, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const VuiBadge: ({ children, className, color, onClick, onClose, href, target, track, isSelected, size, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -21,10 +21,10 @@ import { VuiFlexItem } from "../flex/FlexItem";
|
|
|
21
21
|
import { createId } from "../../utils/createId";
|
|
22
22
|
export const BADGE_COLOR = ["accent", "primary", "danger", "warning", "success", "neutral"];
|
|
23
23
|
export const VuiBadge = (_a) => {
|
|
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
|
+
var { children, className, color, onClick, onClose, href, target, track, isSelected, size = "m" } = _a, rest = __rest(_a, ["children", "className", "color", "onClick", "onClose", "href", "target", "track", "isSelected", "size"]);
|
|
25
25
|
const { createLink } = useVuiContext();
|
|
26
26
|
const id = onClose ? createId() : undefined;
|
|
27
|
-
const classes = classNames(className, "vuiBadge", `vuiBadge--${color}`, {
|
|
27
|
+
const classes = classNames(className, "vuiBadge", `vuiBadge--${size}`, `vuiBadge--${color}`, {
|
|
28
28
|
"vuiBadge--clickable": onClick !== null && onClick !== void 0 ? onClick : href
|
|
29
29
|
});
|
|
30
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: _jsx("div", Object.assign({ className: "vuiBadge__content" }, { children: children })) })), onClose && (_jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "aria-label": "Remove", "aria-describedby": id, size: "xs", color: "subdued", className: "vuiBadge__icon", onClick: (e) => {
|
|
@@ -2,13 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
.vuiBadge {
|
|
4
4
|
display: inline-block;
|
|
5
|
+
font-family: inherit;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuiBadge--l {
|
|
11
|
+
font-size: $fontSizeMedium;
|
|
12
|
+
line-height: 1.25;
|
|
13
|
+
padding: $sizeXs $sizeS;
|
|
14
|
+
border-radius: $sizeL;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.vuiBadge--m {
|
|
5
18
|
font-size: $fontSizeSmall;
|
|
6
19
|
line-height: 1.25;
|
|
7
20
|
padding: $sizeXxs $sizeXs;
|
|
8
21
|
border-radius: $sizeS;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.vuiBadge--s {
|
|
25
|
+
font-size: $fontSizeXsmall;
|
|
26
|
+
line-height: 1.25;
|
|
27
|
+
padding: $sizeXxxs $sizeXs;
|
|
28
|
+
border-radius: $sizeS;
|
|
12
29
|
}
|
|
13
30
|
|
|
14
31
|
.vuiBadge--clickable {
|
package/lib/styles/index.css
CHANGED
|
@@ -592,13 +592,30 @@ fieldset {
|
|
|
592
592
|
|
|
593
593
|
.vuiBadge {
|
|
594
594
|
display: inline-block;
|
|
595
|
+
font-family: inherit;
|
|
596
|
+
white-space: nowrap;
|
|
597
|
+
text-decoration: none;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.vuiBadge--l {
|
|
601
|
+
font-size: 16px;
|
|
602
|
+
line-height: 1.25;
|
|
603
|
+
padding: 8px 12px;
|
|
604
|
+
border-radius: 24px;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.vuiBadge--m {
|
|
595
608
|
font-size: 12px;
|
|
596
609
|
line-height: 1.25;
|
|
597
610
|
padding: 4px 8px;
|
|
598
611
|
border-radius: 12px;
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.vuiBadge--s {
|
|
615
|
+
font-size: 10px;
|
|
616
|
+
line-height: 1.25;
|
|
617
|
+
padding: 2px 8px;
|
|
618
|
+
border-radius: 12px;
|
|
602
619
|
}
|
|
603
620
|
|
|
604
621
|
.vuiBadge--clickable {
|
package/package.json
CHANGED
|
@@ -1,13 +1,44 @@
|
|
|
1
1
|
import { BADGE_COLOR, VuiBadge, VuiFlexContainer, VuiFlexItem } from "../../../lib";
|
|
2
|
+
import { Subsection } from "../../components/Subsection";
|
|
2
3
|
|
|
3
4
|
export const BadgeColors = () => {
|
|
4
5
|
return (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
<>
|
|
7
|
+
<Subsection title="Large">
|
|
8
|
+
<VuiFlexContainer>
|
|
9
|
+
{BADGE_COLOR.map((color) => (
|
|
10
|
+
<VuiFlexItem grow={false} key={color}>
|
|
11
|
+
<VuiBadge size="l" color={color}>
|
|
12
|
+
Color {color}
|
|
13
|
+
</VuiBadge>
|
|
14
|
+
</VuiFlexItem>
|
|
15
|
+
))}
|
|
16
|
+
</VuiFlexContainer>
|
|
17
|
+
</Subsection>
|
|
18
|
+
|
|
19
|
+
<Subsection title="Medium">
|
|
20
|
+
<VuiFlexContainer>
|
|
21
|
+
{BADGE_COLOR.map((color) => (
|
|
22
|
+
<VuiFlexItem grow={false} key={color}>
|
|
23
|
+
<VuiBadge size="m" color={color}>
|
|
24
|
+
Color {color}
|
|
25
|
+
</VuiBadge>
|
|
26
|
+
</VuiFlexItem>
|
|
27
|
+
))}
|
|
28
|
+
</VuiFlexContainer>
|
|
29
|
+
</Subsection>
|
|
30
|
+
|
|
31
|
+
<Subsection title="Small">
|
|
32
|
+
<VuiFlexContainer>
|
|
33
|
+
{BADGE_COLOR.map((color) => (
|
|
34
|
+
<VuiFlexItem grow={false} key={color}>
|
|
35
|
+
<VuiBadge size="s" color={color}>
|
|
36
|
+
Color {color}
|
|
37
|
+
</VuiBadge>
|
|
38
|
+
</VuiFlexItem>
|
|
39
|
+
))}
|
|
40
|
+
</VuiFlexContainer>
|
|
41
|
+
</Subsection>
|
|
42
|
+
</>
|
|
12
43
|
);
|
|
13
44
|
};
|