From 4ad6cfbc2759cca5cbc6d6c0451ab811732afbc5 Mon Sep 17 00:00:00 2001 From: Raunak Bhagat Date: Fri, 11 Sep 2026 02:16:53 +0000 Subject: [PATCH] feat(opal): add `@opal/AttachmentItemButton` (#14629) --- web/lib/opal/src/components/README.md | 1 + .../AttachmentItemButton.stories.tsx | 159 +++++++++ .../buttons/attachment-item-button/README.md | 80 +++++ .../attachment-item-button/components.tsx | 301 ++++++++++++++++++ .../buttons/attachment-item-button/styles.css | 53 +++ .../buttons/line-item-button/components.tsx | 57 +--- .../buttons/open-button/components.tsx | 2 +- .../src/components/buttons/row-interaction.ts | 99 ++++++ web/lib/opal/src/components/index.ts | 6 + web/lib/opal/src/core/index.ts | 1 + .../src/core/interactive/stateful/README.md | 7 +- .../core/interactive/stateful/components.tsx | 25 +- .../src/core/interactive/stateful/styles.css | 118 ++----- 13 files changed, 751 insertions(+), 158 deletions(-) create mode 100644 web/lib/opal/src/components/buttons/attachment-item-button/AttachmentItemButton.stories.tsx create mode 100644 web/lib/opal/src/components/buttons/attachment-item-button/README.md create mode 100644 web/lib/opal/src/components/buttons/attachment-item-button/components.tsx create mode 100644 web/lib/opal/src/components/buttons/attachment-item-button/styles.css create mode 100644 web/lib/opal/src/components/buttons/row-interaction.ts diff --git a/web/lib/opal/src/components/README.md b/web/lib/opal/src/components/README.md index 6427b6e8de..7d70fe105c 100644 --- a/web/lib/opal/src/components/README.md +++ b/web/lib/opal/src/components/README.md @@ -17,6 +17,7 @@ The barrel file at `index.ts` re-exports each component and its prop types. Each | Component | Description | Docs | | ---------------------------------------------- | ------------------------------------------------------------ | ---------------------------------------------- | | [Button](./buttons/button/) | Label and/or icon-only stateless button | [README](./buttons/button/README.md) | +| [AttachmentItemButton](./buttons/attachment-item-button/) | File-like resource row: icon/image tile, content, center and action slots | [README](./buttons/attachment-item-button/README.md) | | [SelectButton](./buttons/select-button/) | Stateful toggle button with optional foldable content | [README](./buttons/select-button/README.md) | | [OpenButton](./buttons/open-button/) | Trigger button with rotating chevron for popovers | [README](./buttons/open-button/README.md) | | [Tag](./tag/) | Small colored label for status/category metadata | [README](./tag/README.md) | diff --git a/web/lib/opal/src/components/buttons/attachment-item-button/AttachmentItemButton.stories.tsx b/web/lib/opal/src/components/buttons/attachment-item-button/AttachmentItemButton.stories.tsx new file mode 100644 index 0000000000..f983813c83 --- /dev/null +++ b/web/lib/opal/src/components/buttons/attachment-item-button/AttachmentItemButton.stories.tsx @@ -0,0 +1,159 @@ +import type { Meta, StoryObj } from "@storybook/react-vite"; +import { AttachmentItemButton, Button, Text } from "@opal/components"; +import SvgFileText from "@opal/icons/file-text"; +import SvgKey from "@opal/icons/key"; +import SvgTrash from "@opal/icons/trash"; +import SvgExternalLink from "@opal/icons/external-link"; + +const meta: Meta = { + title: "opal/components/AttachmentItemButton", + component: AttachmentItemButton, + tags: ["autodocs"], +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + render: () => ( +
+ +
+ ), +}; + +export const States: Story = { + render: () => ( +
+ + + +
+ ), +}; + +/** + * Prominence sets only the rest intensity; hover and selected palettes come + * from `Interactive.Stateful` in all three. + */ +export const Prominences: Story = { + render: () => ( +
+ + + +
+ ), +}; + +export const Image: Story = { + render: () => ( +
+ +
+ ), +}; + +/** + * The center slot expands between the title group and the action slot; the + * action slot keeps its minimum width even when it has no children, so rows + * with and without actions stay aligned. + */ +export const Slots: Story = { + render: () => ( +
+ + + 2 days ago + +
+ } + rightChildren={ + <> +