@fiscozen/alert
v3.0.0
Published
Design System Alert component
Keywords
Readme
@fiscozen/alert
Alert component: callout for timely information (info, error, warning, success, danger).
For usage documentation and examples, see Storybook Documentation – Messages / FzAlert.
Development
Setup
From the repo root: install dependencies with pnpm install. Run unit tests with pnpm --filter @fiscozen/alert test:unit. Run Storybook from the repo root to try the component.
Architecture
- Variants:
background(always expanded, optional title and actions),accordion(collapsible),text(description only, no title/actions/dismiss, transparent background, tone ignored). - Tone: Drives icon, background and border for
backgroundandaccordion; ignored fortext(transparent background; icon still reflects tone for semantics). - Environment:
frontoffice(default) vsbackoffice. Affects padding (p-12vsp-6) and is passed toFzButton/FzIconButton. For varianttext+environment: 'backoffice', the leading icon uses sizesm; otherwisemd.
Code organization
src/FzAlert.vue: main component; computedsafeVariant,safeEnvironment,isTextVariant,iconSize,containerClass, etc.src/types.ts:AlertProps,AlertVariant; deprecated propsalertStyle,size.src/index.ts: exports component and types.
Key concepts
Text variant: No title, no button/link actions, not collapsible, not dismissible. Container uses bg-transparent (tone-based background and border are not applied). Icon size is sm when environment === 'backoffice', md otherwise (iconSize computed).
Environment and padding: Root div gets p-6 only in backoffice. Inner FzContainer uses p-6 (backoffice) or p-12 (frontoffice).
Testing
- Unit tests:
pnpm --filter @fiscozen/alert test:unit(ortest:unit --run -uto update snapshots). - Tests cover rendering, props (all variants including
text), events, CSS classes, accessibility expectations, edge cases, and snapshots (includingtextandtext+ backoffice).
Build
pnpm --filter @fiscozen/alert build: runsvue-tscandvite build.
