From 41dff2a36f02a393d09117dd75f519ceb7fcdfcd Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 14 Dec 2023 09:14:55 -0500 Subject: [PATCH 01/10] feat: Allow Tag to support custom bg and text color via xss (#981) --- src/components/Tag.stories.tsx | 1 + src/components/Tag.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Tag.stories.tsx b/src/components/Tag.stories.tsx index 23c62fe65..21f292a3e 100644 --- a/src/components/Tag.stories.tsx +++ b/src/components/Tag.stories.tsx @@ -23,6 +23,7 @@ export function NoIcon() {
+ ); } diff --git a/src/components/Tag.tsx b/src/components/Tag.tsx index 30298c295..92ab0bce3 100644 --- a/src/components/Tag.tsx +++ b/src/components/Tag.tsx @@ -2,7 +2,7 @@ import { Icon, IconKey } from "src/components"; import { Css, Margin, Only, Xss } from "src/Css"; import { useTestIds } from "src/utils"; -type TagXss = Margin; +type TagXss = Margin | "backgroundColor" | "color"; export type TagType = "info" | "caution" | "warning" | "success" | "neutral"; interface TagProps { text: string; From 2e6738f55debfc2d0d8d8a1257c5e86922a1dec9 Mon Sep 17 00:00:00 2001 From: Homebound Bot Date: Thu, 14 Dec 2023 14:17:45 +0000 Subject: [PATCH 02/10] chore(release): 2.328.0 [skip ci] ## [2.328.0](https://github.com/homebound-team/beam/compare/v2.327.1...v2.328.0) (2023-12-14) ### Features * Allow Tag to support custom bg and text color via xss ([#981](https://github.com/homebound-team/beam/issues/981)) ([41dff2a](https://github.com/homebound-team/beam/commit/41dff2a36f02a393d09117dd75f519ceb7fcdfcd)) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3c9334e4e..2c1b2748a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@homebound/beam", - "version": "2.327.1", + "version": "2.328.0", "author": "Homebound", "license": "MIT", "main": "dist/index.js", From 8bc5dc0719c3d827808e8ca4bcaabbdd18ca870f Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 14 Dec 2023 11:15:43 -0500 Subject: [PATCH 03/10] feat: Update Switch component styling (#982) Adds new 'labelStyle: "centered"'. This will stack the label on top of the switch and center both elements in the column. Updates how tooltips are rendered for Switches. Now includes an icon to denote there is a tooltip, rather than requiring the user to discover it by hovering over it. Adds this tooltip functionality to the Label component, though it is only currently used by Switch. At some point it would be good to move all Tooltips to this sort of UX. --- src/components/Label.tsx | 35 ++++++++--- src/inputs/Switch.stories.tsx | 8 +++ src/inputs/Switch.tsx | 115 ++++++++++++++++------------------ 3 files changed, 90 insertions(+), 68 deletions(-) diff --git a/src/components/Label.tsx b/src/components/Label.tsx index 84e817edc..1f96b1ea2 100644 --- a/src/components/Label.tsx +++ b/src/components/Label.tsx @@ -1,8 +1,11 @@ -import React, { LabelHTMLAttributes } from "react"; +import React, { LabelHTMLAttributes, ReactNode } from "react"; import { VisuallyHidden } from "react-aria"; -import { Css } from "src/Css"; +import { Css, Font, Only, Palette, Xss } from "src/Css"; +import { Icon } from "src"; -interface LabelProps { +type LabelXss = Font | "color"; + +interface LabelProps { // We don't usually have `fooProps`-style props, but this is for/from react-aria labelProps?: LabelHTMLAttributes; label: string; @@ -11,22 +14,38 @@ interface LabelProps { hidden?: boolean; contrast?: boolean; multiline?: boolean; + tooltip?: ReactNode; + // Removes margin bottom if true - This is different from InlineLabel. InlineLabel expects to be rendered visually within the field element. Rather just on the same line. + inline?: boolean; + xss?: X; } /** An internal helper component for rendering form labels. */ -export const Label = React.memo((props: LabelProps) => { - const { labelProps, label, hidden, suffix, contrast = false, ...others } = props; +function LabelComponent, X>>(props: LabelProps) { + const { labelProps, label, hidden, suffix, contrast = false, tooltip, inline, xss, ...others } = props; const labelEl = ( -