From 55f13354b6f97167b6d0784076f5f93997a3a39f Mon Sep 17 00:00:00 2001 From: mrderyk Date: Wed, 8 Jan 2025 01:55:11 -0800 Subject: [PATCH] chore: migrate vui-source changes to v3.10.0 (#195) --- package.json | 2 +- src/docs/pages/button/Link.tsx | 36 ++++++++++++++++-------- src/lib/components/button/BaseButton.tsx | 4 ++- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index d21ed76..caf4e2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vectara/vectara-ui", - "version": "3.9.0", + "version": "3.10.0", "homepage": "https://vectara.github.io/vectara-ui/", "description": "Vectara's design system, codified as a React and Sass component library", "author": "Vectara", diff --git a/src/docs/pages/button/Link.tsx b/src/docs/pages/button/Link.tsx index 07f0cfa..55c491d 100644 --- a/src/docs/pages/button/Link.tsx +++ b/src/docs/pages/button/Link.tsx @@ -1,16 +1,30 @@ -import { VuiButtonPrimary } from "../../../lib"; +import { useState } from "react"; +import { VuiButtonPrimary, VuiSpacer, VuiToggle } from "../../../lib"; export const Link = () => { + const [isDisabled, setIsDisabled] = useState(false); + return ( - console.log("click")} - onMouseOver={() => console.log("mouse over")} - onMouseOut={() => console.log("mouse out")} - > - Visit Vectara.com - + <> + setIsDisabled(!isDisabled)} + /> + + + + console.log("click")} + onMouseOver={() => console.log("mouse over")} + onMouseOut={() => console.log("mouse out")} + isDisabled={isDisabled} + > + Visit Vectara.com + + ); }; diff --git a/src/lib/components/button/BaseButton.tsx b/src/lib/components/button/BaseButton.tsx index 32b81a2..3e9e2cf 100644 --- a/src/lib/components/button/BaseButton.tsx +++ b/src/lib/components/button/BaseButton.tsx @@ -109,7 +109,9 @@ export const BaseButton = forwardRef( ); } - if (href) { + // Anchor tags can't be disabled, so we'll just render a button instead + // if isDisabled is true. + if (href && !isDisabled) { const wrapperClasses = classNames("vuiBaseButtonLinkWrapper", { "vuiBaseButtonLinkWrapper--fullWidth": fullWidth });