import type { Meta, StoryObj } from '@storybook/vue3-vite' import type { Token } from '@/stories/tokenUtils' import { copyableClass, copyableCopiedClass, readTokens, sortTokensBySize, tokenTableClass, useCopier, } from '@/stories/tokenUtils' const meta: Meta = { title: 'Foundations/Shadows', tags: ['!dev'], parameters: { layout: 'padded', controls: { disable: true }, docs: { source: { code: null } }, }, } export default meta type Story = StoryObj const previewStyle = (tokenName: string): string => `width: 160px; height: 80px; background: #ffffff; border-radius: 8px; box-shadow: var(${tokenName});` const makeSectionStory = (loader: () => Token[]): Story => ({ render: () => ({ setup() { const { copiedKey, copy } = useCopier() return { tokens: loader(), copiedKey, copy, tableClass: tokenTableClass, copyClass: copyableClass, copiedClass: copyableCopiedClass, preview: (tokenName: string) => previewStyle(tokenName), } }, template: `
Token Value Preview
{{ copiedKey === token.name ? 'Copied!' : token.name }} {{ token.value }}
No tokens
`, }), }) /** * Drop shadows ordered from the most to the least prominent. Use them to * lift cards, popovers and menus off the surface. */ export const DropShadows: Story = makeSectionStory(() => sortTokensBySize(readTokens(['--cp-shadows-'], [/-inset$/, /^--cp-shadows-overlay$/, /^--cp-shadows-side-panel$/])), ) /** * Inset shadows sit inside the element. Useful for pressed states and * recessed surfaces like form fields. */ export const InsetShadows: Story = makeSectionStory(() => sortTokensBySize(readTokens([/^--cp-shadows-.*-inset$/]))) /** * Dedicated shadow for the side panel container. */ export const SidePanel: Story = makeSectionStory(() => readTokens(['--cp-shadows-side-panel'])) /** * Multi-layered shadow used for modals and full-screen overlays. */ export const Overlay: Story = makeSectionStory(() => readTokens(['--cp-shadows-overlay']))