### Development Setup and Scripts Source: https://github.com/madsb/dkfds-vue3/blob/main/README.md Provides commands for setting up the development environment, including installing dependencies, building the library, and running the demo site. ```bash # Install dependencies pnpm install # Build the library pnpm run build # Run demo site pnpm run dev ``` ```bash # Development pnpm run dev # Run demo site pnpm run build # Build library pnpm run test # Run tests pnpm run typecheck # Check TypeScript types pnpm run lint # Lint code pnpm run format # Format code ``` -------------------------------- ### Bash Command Example Source: https://github.com/madsb/dkfds-vue3/blob/main/document-vue-components.md An example bash command for importing a Vue component from a specific package (`@madsb/dkfds-vue3`). This is typically used within the installation section of component documentation. ```bash import { FdsComponentName } from '@madsb/dkfds-vue3' ``` -------------------------------- ### Start Documentation Site Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Starts the documentation site development server. Allows previewing documentation changes locally. ```shell pnpm docs:dev ``` -------------------------------- ### Vue Component Documentation Structure Source: https://github.com/madsb/dkfds-vue3/blob/main/document-vue-components.md Defines the standard markdown structure for documenting individual Vue components. It includes frontmatter with metadata, component name, installation, quick start, detailed API references for props, events, and slots, usage examples, accessibility information, DKFDS guidelines, best practices, related components, and testing examples. ```markdown --- title: FdsComponentName description: [Brief description from JSDoc] category: [forms|input|navigation|feedback|data-display|layout] dkfds: true accessibility: [wcag compliance level] tags: [dkfds, vue3, component, accessibility, additional, tags] --- # FdsComponentName [Brief description from JSDoc or component comments] ## Installation ```bash import { FdsComponentName } from '@madsb/dkfds-vue3' ``` ## Quick Start [Simple, working example with most common props following DKFDS patterns] ```vue ``` ## Props | Prop | Type | Default | Required | Description | | ---------- | ------------ | ---------------------- | ------------ | ------------------------------------------------- | | [propName] | [exact type] | [default value or '-'] | [true/false] | [JSDoc description or 'No description available'] | ## Events | Event | Payload | Description | | ----------- | ---------------------------- | ---------------------------- | | [eventName] | [payload type and structure] | [When this event is emitted] | ## Slots | Slot | Slot Props | Description | | ---------- | ---------------------- | ----------------------- | | [slotName] | [props passed to slot] | [What this slot is for] | ## Usage Examples ### Basic Usage ```vue [Complete working example with common use case] ``` ### With Form Validation ```vue [Example showing form integration if applicable] ``` ### Accessibility Features ```vue [Example highlighting accessibility features and WCAG compliance] ``` ## API Reference ### Props Details [Detailed explanation of complex props if needed] ### Component Methods [If component exposes methods via defineExpose] ### TypeScript Interfaces ```typescript [Any relevant type definitions from the component or types/ directory] ``` ## Accessibility - **WCAG Compliance**: [Level A/AA/AAA features] - **Keyboard Navigation**: [Supported keyboard interactions] - **Screen Reader**: [ARIA labels and descriptions provided] - **Focus Management**: [How focus is handled] ## DKFDS Guidelines - [Specific DKFDS design system requirements] - [Usage in government self-service solutions] - [Theme compatibility (VirkDK/BorgerDK)] ## Best Practices - Always provide meaningful `id` attributes for form elements - Use Danish labels and text for government solutions - Consider mobile-first responsive design - Follow DKFDS accessibility standards ## Related Components - [List of related components in the library by category] ## Testing ```typescript // Example test usage from __tests__ directory import { mount } from '@vue/test-utils' import FdsComponentName from '../FdsComponentName.vue' const wrapper = mount(FdsComponentName, { props: { /* example props */ } }) ``` ``` -------------------------------- ### ESLint Configuration Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md An example of an ESLint configuration file (`eslint.config.cjs`) used to define and adjust linting rules for the project. ```javascript module.exports = { // ... other configurations rules: { 'vue/html-indent': ['error', 2], '@typescript-eslint/explicit-function-return-type': 'warn', }, // ... overrides and settings }; ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Installs all project dependencies using the pnpm package manager. This is a foundational step for development. ```shell pnpm install ``` -------------------------------- ### Vue Test Example Source: https://github.com/madsb/dkfds-vue3/blob/main/document-vue-components.md An example of how to mount and test a Vue component using `@vue/test-utils`. It demonstrates importing the component and providing example props for testing purposes, commonly found in a component's `__tests__` directory. ```typescript // Example test usage from __tests__ directory import { mount } from '@vue/test-utils' import FdsComponentName from '../FdsComponentName.vue' const wrapper = mount(FdsComponentName, { props: { /* example props */ } }) ``` -------------------------------- ### Prepare Package Script Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Shell script used for preparing the package for publishing, potentially including build steps or configuration adjustments. ```shell #!/bin/bash # Exit immediately if a command exits with a non-zero status. set -e echo "Preparing package for publishing..." # Example: Run build script if not already done # pnpm build # Example: Copy necessary files # cp README.md dist/ echo "Package preparation complete." ``` -------------------------------- ### Install DKFDS Vue 3 Library Source: https://github.com/madsb/dkfds-vue3/blob/main/README.md Installs the @madsb/dkfds-vue3 package along with the core dkfds package using either npm or pnpm. ```bash npm install @madsb/dkfds-vue3 dkfds # or pnpm add @madsb/dkfds-vue3 dkfds ``` -------------------------------- ### FdsFunktionslink Usage Examples (Vue) Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/layout/Funktionslink.story.md Demonstrates various ways to use the FdsFunktionslink component, including basic links, buttons with icons, and external links with security attributes. It shows how to import and use the component within a Vue 3 setup script. ```Vue ``` -------------------------------- ### FdsTooltip Usage Example (Vue) Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/feedback/Tooltip.story.md Demonstrates how to import and use the FdsTooltip component in a Vue 3 application. It shows basic setup with content, trigger, and position props. ```vue ``` -------------------------------- ### Vitest Unit Test Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Example of a unit test file using Vitest and Testing Library. Tests are typically placed alongside their components in `src/__tests__/components`. ```typescript import { render } from '@testing-library/vue'; import FdsInput from '@/components/forms/fds-input.vue'; describe('FdsInput', () => { it('renders with a label', () => { const label = 'Username'; const { getByLabelText } = render(FdsInput, { props: { modelValue: '', label: label }, }); expect(getByLabelText(label)).toBeInTheDocument(); }); }); ``` -------------------------------- ### SCSS Stylesheet Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Example of SCSS styling, showing how styles extend DKFDS SCSS. Stylesheets are typically located in `src/assets` or `src/styles`. ```scss @import "src/styles/variables.scss"; .my-component { background-color: $primary-color; padding: $spacing-medium; } ``` -------------------------------- ### Run Local Development Sandbox Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Starts the Vite development server to locally run and test components. It's useful for quick smoke testing during development. ```shell pnpm dev ``` -------------------------------- ### Install DKFDS Vue 3 Package Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/Introduction.story.md Installs the necessary package for the DKFDS Vue 3 component library using pnpm. ```bash pnpm add @madsb/dkfds-vue3 ``` -------------------------------- ### Run Local Development Server Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/Introduction.story.md Commands to install dependencies and run local development servers for the DKFDS Vue 3 project, including the demo sandbox and documentation site. ```bash pnpm install pnpm dev # opens the demo sandbox pnpm docs:dev # starts the documentation site with these stories ``` -------------------------------- ### Vue Component Example Source: https://github.com/madsb/dkfds-vue3/blob/main/document-vue-components.md A basic Vue 3 component example demonstrating the usage of a custom component (`FdsComponentName`) with `v-model`, a `label`, and an `id` attribute. This snippet showcases a typical setup for integrating components within a Vue application. ```vue ``` -------------------------------- ### Conventional Commits Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Example of a commit message following the Conventional Commits specification. This ensures a standardized commit history. ```gitcommit feat(button): add loading state Implements a loading state for the FdsButton component, indicated by a spinner. - Added a new `loading` prop to FdsButton. - Integrated a spinner icon when `loading` is true. - Updated unit tests to cover the new state. Closes #123 ``` -------------------------------- ### Utility Function Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Example of a utility function following camelCase naming conventions. These functions are typically found in `src/utils`. ```typescript export function formatCurrency(amount: number, currency: string = 'DKK'): string { return `${amount.toFixed(2)} ${currency}`; } ``` -------------------------------- ### Run Development and Demo Site (pnpm) Source: https://github.com/madsb/dkfds-vue3/blob/main/CLAUDE.md Commands to start the development server for the DKFDS Vue 3 component library and to run the demo site. This allows for real-time development and viewing of components. ```bash pnpm run dev ``` -------------------------------- ### Install Dependencies and Build Library (pnpm) Source: https://github.com/madsb/dkfds-vue3/blob/main/CLAUDE.md Commands to install project dependencies using pnpm and to build the Vue 3 component library for production. These are essential steps for development and deployment. ```bash pnpm install pnpm run build ``` -------------------------------- ### Vue 3 Component File Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Example of a Vue 3 Single File Component (SFC) using TypeScript. Components follow kebab-case naming and use the `Fds` PascalCase prefix for exports. ```vue ``` -------------------------------- ### Usage Example for FdsDatoFelter Component Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/input/DatoFelter.story.md This snippet demonstrates how to use the FdsDatoFelter component within a Vue.js application. It shows the template setup with `v-model` binding and event handling for validation and dirty state changes. The script section imports the component and sets up reactive variables and handler functions. ```vue ``` -------------------------------- ### Format Code with Prettier Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Applies Prettier formatting rules across the project's source files, examples, and documentation to maintain consistent code style. ```shell pnpm format ``` -------------------------------- ### Vue Toast Component Usage and Composable Example Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/feedback/Toast.story.md Demonstrates how to use the FdsToast and FdsToastContainer components in a Vue template, and how to utilize the useToast composable for programmatic toast notifications. It shows setup for displaying a success toast manually and via a button click. ```vue ``` -------------------------------- ### Vue 3 Composable Function Example Source: https://github.com/madsb/dkfds-vue3/blob/main/AGENTS.md Example of a composable function following the `useX` pattern. These are typically placed in `src/composables`. ```typescript import { ref, computed } from 'vue'; export function useCounter(initialValue: number = 0) { const count = ref(initialValue); const doubleCount = computed(() => count.value * 2); function increment() { count.value++; } return { count, doubleCount, increment }; } ``` -------------------------------- ### FdsDetaljer FAQ Section Example Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/data-display/Detaljer.story.md Illustrates using the FdsDetaljer component to create a frequently asked questions (FAQ) section. Each question serves as a header for collapsible answer content. ```vue To create an account, click the "Sign Up" button... We accept credit cards, PayPal, and bank transfers... ``` -------------------------------- ### Usage Example for FdsNavLink Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/navigation/NavLink.story.md Demonstrates how to implement the FdsNavLink component in a Vue.js application. It shows how to pass props like 'href', 'current', 'icon', and 'hint', and how to handle the 'click' event for custom navigation logic. ```vue ``` -------------------------------- ### Image Gallery Example using FdsFileUpload Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/input/FileUpload.story.md Shows how to configure FdsFileUpload for an image gallery. It accepts any image format, allows multiple selections, limits the number of files to 5, and includes a hint for the user. ```vue ``` -------------------------------- ### FdsTilbageLink Usage Example (Vue) Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/navigation/TilbageLink.story.md Demonstrates how to use the FdsTilbageLink component in a Vue template, including importing the component and handling the click event for custom navigation logic. ```vue ``` -------------------------------- ### FdsBreadcrumb Component API Source: https://github.com/madsb/dkfds-vue3/blob/main/documentation/src/stories/navigation/Breadcrumb.story.md Documentation for the FdsBreadcrumb component, including its props, events, and usage examples. ```APIDOC ## FdsBreadcrumb Component Breadcrumb navigation component that provides hierarchical navigation with support for Vue Router integration, automatic current page detection, and full accessibility features. Follows DKFDS v11 breadcrumb design patterns. ### Usage ```vue ``` ### Props | Prop | Type | Default | Description | | ---------------- | ------------------ | -------------- | ----------------------------------------------------------- | | `items` | `BreadcrumbItem[]` | **required** | Array of breadcrumb items representing navigation hierarchy | | `ariaLabel` | `string` | `'Brødkrumme'` | ARIA label for the navigation element | | `container` | `boolean` | `false` | Add container class for standard DKFDS layout | | `useNativeLinks` | `boolean` | `false` | Force use of anchor tags even when Vue Router is available | ### BreadcrumbItem Interface ```typescript interface BreadcrumbItem { text: string // Display text for the breadcrumb href?: string // URL for standard navigation to?: string | Record // Vue Router location object external?: boolean // Force external link behavior data?: any // Custom data for event handlers } ``` ### Events | Event | Payload | Description | | ------------ | ---------------------------------------------------------- | ----------------------------------------- | | `item-click` | `(event: MouseEvent, item: BreadcrumbItem, index: number)` | Emitted when a breadcrumb link is clicked | ### Navigation Behavior - **Automatic Link Detection**: Items with `href` use standard anchor tags. Items with `to` use Vue Router links (when available). Items marked `external: true` always use anchor tags with `target="_blank"`. The last item is treated as the current page and rendered without a link. - **Vue Router Integration**: Automatically detects Vue Router availability. Uses `` for items with `to` property. Falls back to standard anchors when the router is unavailable. Respects `useNativeLinks` prop to force anchor tag usage. ### Accessibility - **Semantic Structure**: Uses semantic `