From 2a9ece59e293bec174f89b7e6e553ec23dbab2d4 Mon Sep 17 00:00:00 2001 From: Charles de Dreuille Date: Mon, 14 Jul 2025 10:38:44 +0200 Subject: [PATCH] Match style to React Aria Signed-off-by: Charles de Dreuille --- .../FieldError/FieldError.styles.css | 1 + .../Popover/Popover.styles.css} | 7 +- .../src/components/Select/Select.stories.tsx | 44 ++-- .../src/components/Select/Select.styles.css | 191 +++++++++--------- .../canon/src/components/Select/Select.tsx | 31 ++- packages/canon/src/css/components.css | 6 +- packages/canon/src/css/generic/list.css | 23 --- .../canon/src/utils/componentDefinitions.ts | 6 +- 8 files changed, 160 insertions(+), 149 deletions(-) rename packages/canon/src/{css/generic/popover.css => components/Popover/Popover.styles.css} (81%) delete mode 100644 packages/canon/src/css/generic/list.css diff --git a/packages/canon/src/components/FieldError/FieldError.styles.css b/packages/canon/src/components/FieldError/FieldError.styles.css index 30e305c826..e69e8637d3 100644 --- a/packages/canon/src/components/FieldError/FieldError.styles.css +++ b/packages/canon/src/components/FieldError/FieldError.styles.css @@ -1,4 +1,5 @@ .bui-FieldError { + display: inline-block; color: var(--bui-fg-danger); font-size: var(--bui-font-size-2); font-weight: var(--bui-font-weight-regular); diff --git a/packages/canon/src/css/generic/popover.css b/packages/canon/src/components/Popover/Popover.styles.css similarity index 81% rename from packages/canon/src/css/generic/popover.css rename to packages/canon/src/components/Popover/Popover.styles.css index 01953fbcc9..23ae5c1019 100644 --- a/packages/canon/src/css/generic/popover.css +++ b/packages/canon/src/components/Popover/Popover.styles.css @@ -15,8 +15,11 @@ */ .bui-Popover { + margin-right: 12px; + overflow: scroll; background-color: var(--bui-bg-surface-1); - padding: var(--bui-space-2); - border-radius: var(--bui-radius-2); border: 1px solid var(--bui-border); + border-radius: var(--bui-radius-3); + padding-block: var(--bui-space-1); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); } diff --git a/packages/canon/src/components/Select/Select.stories.tsx b/packages/canon/src/components/Select/Select.stories.tsx index 179959d649..eacf6763f3 100644 --- a/packages/canon/src/components/Select/Select.stories.tsx +++ b/packages/canon/src/components/Select/Select.stories.tsx @@ -16,9 +16,10 @@ import type { Meta, StoryObj } from '@storybook/react'; import { Select } from './Select'; import { Flex } from '../Flex'; +import { Form } from 'react-aria-components'; const meta = { - title: 'Components/Select', + title: 'Forms/Select', component: Select, } satisfies Meta; @@ -56,7 +57,7 @@ export const WithLabel: Story = { }, }; -export const WithDescription: Story = { +export const WithLabelAndDescription: Story = { args: { ...WithLabel.args, description: 'Choose a font family for your document', @@ -92,10 +93,7 @@ export const Disabled: Story = { export const DisabledOption: Story = { args: { ...Preview.args, - options: [ - ...fontOptions, - { value: 'comic-sans', label: 'Comic sans', disabled: true }, - ], + disabledKeys: ['cursive', 'serif'], }, }; @@ -253,14 +251,19 @@ export const WithManyOptions: Story = { }, }; -// export const WithErrorAndDescription: Story = { -// args: { -// ...Preview.args, -// error: 'Invalid font family', -// }, -// }; +export const WithError: Story = { + args: { + ...WithLabel.args, + name: 'font', + }, + render: args => ( +
+