diff --git a/package.json b/package.json index b3aabae7..f7579b8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vector-im/compound-web", - "version": "0.9.1", + "version": "0.9.2", "description": "Compound components for the Web", "type": "module", "main": "./dist/compound-web.js", diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx index 39261532..6ce5b008 100644 --- a/src/components/Alert/Alert.tsx +++ b/src/components/Alert/Alert.tsx @@ -24,7 +24,7 @@ import CloseIcon from "@vector-im/compound-design-tokens/icons/close.svg"; import styles from "./Alert.module.css"; import { Text } from "../Typography/Text"; -import { IconButton } from "../IconButton/IconButton"; +import { IconButton } from "../Button"; type AlertProps = { /** diff --git a/src/components/Alert/__snapshots__/Alert.test.tsx.snap b/src/components/Alert/__snapshots__/Alert.test.tsx.snap index 863dc3a1..d6c3e50e 100644 --- a/src/components/Alert/__snapshots__/Alert.test.tsx.snap +++ b/src/components/Alert/__snapshots__/Alert.test.tsx.snap @@ -72,9 +72,10 @@ exports[`Alert > renders actions 1`] = ` + +`; + +exports[`IconButton > renders a DefaultDisabled IconButton 1`] = ` +
+ +
+`; + +exports[`IconButton > renders a WithHighlightIndicator IconButton 1`] = ` +
+ +
+`; + +exports[`IconButton > renders a WithIndicator IconButton 1`] = ` +
+ +
+`; + +exports[`IconButton > renders a WithIndicatorDisabled IconButton 1`] = ` +
+ +
+`; diff --git a/src/components/IconButton/indicator-mask.svg b/src/components/Button/IconButton/indicator-mask.svg similarity index 100% rename from src/components/IconButton/indicator-mask.svg rename to src/components/Button/IconButton/indicator-mask.svg diff --git a/src/components/Button/UnstyledButton.tsx b/src/components/Button/UnstyledButton.tsx new file mode 100644 index 00000000..bce30306 --- /dev/null +++ b/src/components/Button/UnstyledButton.tsx @@ -0,0 +1,89 @@ +/* +Copyright 2023 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React, { PropsWithChildren, forwardRef, ForwardedRef, Ref } from "react"; + +interface ButtonComponent { + // With the explicit `as` prop + ( + props: { as: C } & UnstyledButtonPropsFor, + ): React.ReactElement; + // Without the explicit `as` prop, defaulting to a - -`; diff --git a/src/components/Tooltip/Tooltip.stories.tsx b/src/components/Tooltip/Tooltip.stories.tsx index eb1b6cf8..a32ed3e6 100644 --- a/src/components/Tooltip/Tooltip.stories.tsx +++ b/src/components/Tooltip/Tooltip.stories.tsx @@ -18,7 +18,7 @@ import React from "react"; import { Meta, StoryFn } from "@storybook/react"; import { Tooltip as TooltipComponent } from "./Tooltip"; -import { IconButton } from "../IconButton/IconButton"; +import { IconButton } from "../Button"; import UserIcon from "@vector-im/compound-design-tokens/icons/user-profile.svg"; diff --git a/src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap b/src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap index db0803a2..4024fa0d 100644 --- a/src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap +++ b/src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap @@ -20,10 +20,12 @@ exports[`Tooltip > opens tooltip on focus where trigger is non interactive 1`] = tabindex="0" >