@vectara/vectara-ui 18.2.1 → 18.2.2

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.
@@ -21,6 +21,7 @@ type Props = {
21
21
  buttonStyle?: TopicButtonStyle;
22
22
  badges?: TopicButtonBadge[];
23
23
  icon?: React.ReactNode;
24
+ isDisabled?: boolean;
24
25
  };
25
- export declare const VuiTopicButton: ({ children, className, href, onClick, title, fullWidth, color, buttonStyle, badges, icon, target, track, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const VuiTopicButton: ({ children, className, href, onClick, title, fullWidth, color, buttonStyle, badges, icon, isDisabled, target, track, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
26
27
  export {};
@@ -22,11 +22,12 @@ import { VuiFlexItem } from "../flex/FlexItem";
22
22
  export const TOPIC_BUTTON_COLOR = ["primary", "accent"];
23
23
  export const TOPIC_BUTTON_STYLE = ["compactRow", "compactGrid"];
24
24
  export const VuiTopicButton = (_a) => {
25
- var { children, className, href, onClick, title, fullWidth, color = "primary", buttonStyle, badges, icon, target, track } = _a, rest = __rest(_a, ["children", "className", "href", "onClick", "title", "fullWidth", "color", "buttonStyle", "badges", "icon", "target", "track"]);
25
+ var { children, className, href, onClick, title, fullWidth, color = "primary", buttonStyle, badges, icon, isDisabled, target, track } = _a, rest = __rest(_a, ["children", "className", "href", "onClick", "title", "fullWidth", "color", "buttonStyle", "badges", "icon", "isDisabled", "target", "track"]);
26
26
  const { createLink } = useVuiContext();
27
27
  const classes = classNames("vuiTopicButton", `vuiTopicButton--${color}`, className, {
28
28
  [`vuiTopicButton--${buttonStyle}`]: buttonStyle,
29
- "vuiTopicButton--fullWidth": fullWidth
29
+ "vuiTopicButton--fullWidth": fullWidth,
30
+ "vuiTopicButton--isDisabled": isDisabled
30
31
  });
31
32
  const titleNode = title && (_jsx(VuiTitle, Object.assign({ size: buttonStyle ? "xs" : "s" }, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: color }, { children: title })) }) })));
32
33
  const badgeNodes = badges === null || badges === void 0 ? void 0 : badges.map((badge, index) => (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiBadge, Object.assign({ color: badge.color, size: "s" }, { children: badge.label })) }), index)));
@@ -42,9 +43,10 @@ export const VuiTopicButton = (_a) => {
42
43
  else {
43
44
  content = (_jsx(VuiFlexContainer, Object.assign({ alignItems: "start", spacing: "m" }, { children: _jsxs(VuiFlexItem, Object.assign({ grow: true }, { children: [title && (_jsxs(_Fragment, { children: [_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "s" }, { children: [icon, _jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: titleNode })), badgeNodes] })), children && _jsx(VuiSpacer, { size: "xxs" })] })), children] })) })));
44
45
  }
45
- if (href) {
46
+ // Anchor tags can't be disabled, so we render a disabled button instead.
47
+ if (href && !isDisabled) {
46
48
  return createLink(Object.assign(Object.assign({ className: classes, href,
47
49
  onClick, children: content, target }, rest), getTrackingProps(track)));
48
50
  }
49
- return (_jsx("button", Object.assign({ className: classes, onClick: onClick, type: "button" }, rest, { children: content })));
51
+ return (_jsx("button", Object.assign({ className: classes, onClick: onClick, type: "button", disabled: isDisabled }, rest, { children: content })));
50
52
  };
@@ -19,6 +19,11 @@
19
19
  width: 100%;
20
20
  }
21
21
 
22
+ .vuiTopicButton--isDisabled {
23
+ cursor: not-allowed;
24
+ pointer-events: none;
25
+ }
26
+
22
27
  .vuiTopicButton--primary:hover {
23
28
  box-shadow: $shadowLargeEnd, var(--vui-color-primary-shade) 0 0 1px 1px;
24
29
  }
@@ -6007,6 +6007,11 @@ h2.react-datepicker__current-month {
6007
6007
  width: 100%;
6008
6008
  }
6009
6009
 
6010
+ .vuiTopicButton--isDisabled {
6011
+ cursor: not-allowed;
6012
+ pointer-events: none;
6013
+ }
6014
+
6010
6015
  .vuiTopicButton--primary:hover {
6011
6016
  box-shadow: rgba(50, 50, 93, 0.25) 0px 6px 12px -2px, rgba(0, 0, 0, 0.3) 0px 3px 7px -3px, var(--vui-color-primary-shade) 0 0 1px 1px;
6012
6017
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "18.2.1",
3
+ "version": "18.2.2",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",