From 0b6d096fd48d843dfea25bc1415853a63faa4bf2 Mon Sep 17 00:00:00 2001 From: Marcus Kernohan <135075821+mkernohanbc@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:51:24 -0700 Subject: [PATCH 01/33] basic scaffold and styling of RAC TextField component --- .../src/components/TextField/TextField.css | 52 +++++++++++++++++++ .../src/components/TextField/TextField.tsx | 23 ++++++++ 2 files changed, 75 insertions(+) create mode 100644 packages/react-components/src/components/TextField/TextField.css create mode 100644 packages/react-components/src/components/TextField/TextField.tsx diff --git a/packages/react-components/src/components/TextField/TextField.css b/packages/react-components/src/components/TextField/TextField.css new file mode 100644 index 00000000..1d5304df --- /dev/null +++ b/packages/react-components/src/components/TextField/TextField.css @@ -0,0 +1,52 @@ +.bcds-react-aria-TextField { + display: flex; + align-items: center; + align-self: stretch; + gap: var(--layout-margin-small); + background: var(--surface-color-forms-default); + height: var(--layout-margin-xxlarge); + padding: var(--layout-padding-small); + border-radius: var(--layout-borderRadius-default); + border: 1px solid var(--surface-color-border-default); +} + +.bcds-react-aria-Label { + font: var(--typography-regular-small-body); + color: var(--typography-color-secondary); +} + +.bcds-react-aria-Input { + font: var(--typography-regular-body); + color: var(--typography-color-primary); +} + +/* Sizes */ +.bcds-react-aria-TextField.small { + min-height: var(--layout-margin-xlarge); +} + +.bcds-react-aria-TextField.medium { + min-height: var(--layout-margin-xxlarge); +} + +/* States */ +.bcds-react-aria-TextField[data-disabled] { + background: var(--surface-color-forms-disabled); + cursor: not-allowed; +} + +.bcds-react-aria-TextField[data-hovered] { + background: var (--surface-color-menus-hover); +} + +.bcds-react-aria-TextField[data-focused] { + border-radius: --layout-border-radius-large; + border: var(--layout-borderWidth-small) solid + var(--surface-color-border-active); +} + +.bcds-react-aria-TextField[data-invalid] { + border-radius: var(--layout-borderRadius-default); + border: 1px solid var(--typography-color-danger); + background: var(--surface-color-forms-default); +} diff --git a/packages/react-components/src/components/TextField/TextField.tsx b/packages/react-components/src/components/TextField/TextField.tsx new file mode 100644 index 00000000..97692f6f --- /dev/null +++ b/packages/react-components/src/components/TextField/TextField.tsx @@ -0,0 +1,23 @@ +import { + TextField as ReactAriaTextField, + TextFieldProps as ReactAriaTextFieldProps, +} from "react-aria-components"; + +import "./TextField.css"; + +export interface TextFieldProps extends ReactAriaTextFieldProps { + /** Sets size of input field */ + size?: "medium" | "small"; +} + +export default function TextField({ + size = "medium", + ...props +}: TextFieldProps) { + return ( + + ); +} From 039d77d095614d9743cd239f656a6717e8f7adec Mon Sep 17 00:00:00 2001 From: Marcus Kernohan <135075821+mkernohanbc@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:01:40 -0700 Subject: [PATCH 02/33] styling tweaks --- .../src/components/TextField/TextField.css | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/react-components/src/components/TextField/TextField.css b/packages/react-components/src/components/TextField/TextField.css index 1d5304df..6af8e5c6 100644 --- a/packages/react-components/src/components/TextField/TextField.css +++ b/packages/react-components/src/components/TextField/TextField.css @@ -10,12 +10,12 @@ border: 1px solid var(--surface-color-border-default); } -.bcds-react-aria-Label { +.bcds-react-aria-TextField--Label { font: var(--typography-regular-small-body); color: var(--typography-color-secondary); } -.bcds-react-aria-Input { +.bcds-react-aria-TextField--Input { font: var(--typography-regular-body); color: var(--typography-color-primary); } @@ -30,23 +30,23 @@ } /* States */ -.bcds-react-aria-TextField[data-disabled] { - background: var(--surface-color-forms-disabled); - cursor: not-allowed; -} - .bcds-react-aria-TextField[data-hovered] { - background: var (--surface-color-menus-hover); + background: var(--surface-color-menus-hover); } .bcds-react-aria-TextField[data-focused] { - border-radius: --layout-border-radius-large; + border-radius: var(--layout-border-radius-large); border: var(--layout-borderWidth-small) solid var(--surface-color-border-active); } .bcds-react-aria-TextField[data-invalid] { border-radius: var(--layout-borderRadius-default); - border: 1px solid var(--typography-color-danger); + border: 1px solid var(--support-border-color-danger); background: var(--surface-color-forms-default); } + +.bcds-react-aria-TextField[data-disabled] { + background: var(--surface-color-forms-disabled); + cursor: not-allowed; +} From 8660993343977c6ef4426eab41cf79d2672e6b38 Mon Sep 17 00:00:00 2001 From: Marcus Kernohan <135075821+mkernohanbc@users.noreply.github.com> Date: Fri, 14 Jun 2024 13:49:33 -0700 Subject: [PATCH 03/33] flesh out default TextField configuration and styling and stage on vite --- packages/react-components/src/App.tsx | 9 ++++++++- .../src/components/TextField/TextField.css | 13 +++++++------ .../src/components/TextField/TextField.tsx | 18 +++++++++++++++++- .../src/components/TextField/index.ts | 2 ++ .../react-components/src/components/index.ts | 1 + .../src/pages/TextField/TextField.tsx | 10 ++++++++++ .../src/pages/TextField/index.ts | 3 +++ packages/react-components/src/pages/index.ts | 3 ++- 8 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 packages/react-components/src/components/TextField/index.ts create mode 100644 packages/react-components/src/pages/TextField/TextField.tsx create mode 100644 packages/react-components/src/pages/TextField/index.ts diff --git a/packages/react-components/src/App.tsx b/packages/react-components/src/App.tsx index 9e718c67..e34a595a 100644 --- a/packages/react-components/src/App.tsx +++ b/packages/react-components/src/App.tsx @@ -6,7 +6,13 @@ import "@bcgov/bc-sans/css/BC_Sans.css"; import { Button, Footer, FooterLinks, Header } from "@/components"; import useWindowDimensions from "@/hooks/useWindowDimensions"; -import { ButtonPage, SelectPage, TagGroupPage, TooltipPage } from "@/pages"; +import { + ButtonPage, + SelectPage, + TagGroupPage, + TooltipPage, + TextFieldPage, +} from "@/pages"; // This icon is available as a plain SVG at src/assets/icon-menu.svg function SvgMenuIcon() { @@ -142,6 +148,7 @@ function App() { +