From 8886fe6e2ca3dd6ac0521f22fc81ae141c7e1516 Mon Sep 17 00:00:00 2001 From: Jake Ruesink Date: Mon, 22 Sep 2025 23:49:13 -0500 Subject: [PATCH 1/2] Enhance: add contentProps to Select component for customizable Popover alignment and offset Introduced a new prop, contentProps, to the Select component, allowing users to customize the alignment and side offset of the Popover. This change improves flexibility in the component's usage, enabling better control over its presentation in various contexts. --- .changeset/align-select-popover-end.md | 5 + apps/docs/src/ui/select-alignment.stories.tsx | 100 ++++++++++++++++++ packages/components/src/ui/select.tsx | 10 +- 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 .changeset/align-select-popover-end.md create mode 100644 apps/docs/src/ui/select-alignment.stories.tsx diff --git a/.changeset/align-select-popover-end.md b/.changeset/align-select-popover-end.md new file mode 100644 index 00000000..7bae6a38 --- /dev/null +++ b/.changeset/align-select-popover-end.md @@ -0,0 +1,5 @@ +--- +'@lambdacurry/forms': patch +--- + +Allow Select popover content alignment overrides through `contentProps` and document right-aligned usage. diff --git a/apps/docs/src/ui/select-alignment.stories.tsx b/apps/docs/src/ui/select-alignment.stories.tsx new file mode 100644 index 00000000..955af9d5 --- /dev/null +++ b/apps/docs/src/ui/select-alignment.stories.tsx @@ -0,0 +1,100 @@ +import type { Meta, StoryObj } from '@storybook/react-vite'; +import { expect, userEvent, waitFor, within } from '@storybook/test'; +import { useState } from 'react'; +import { Select } from '@lambdacurry/forms/ui/select'; + +const meta = { + title: 'UI/Select/Alignment', + component: Select, + parameters: { + layout: 'centered', + docs: { + description: { + story: + 'Use `contentProps` to align the popover with right-aligned triggers, such as when a Select sits near the edge of a container.', + }, + }, + }, + tags: ['autodocs'], +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +const fruits = [ + { label: 'Apple', value: 'apple' }, + { label: 'Banana', value: 'banana' }, + { label: 'Cherry', value: 'cherry' }, +]; + +const RightAlignedSelectExample = () => { + const [value, setValue] = useState(''); + + return ( +
+
+
+
+