### Initial Project Setup Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Clone the repository, install dependencies, and start the development server. ```bash git clone https://github.com/kufu/smarthr-design-system.git cd smarthr-design-system pnpm install pnpm dev ``` -------------------------------- ### Install Git Hooks Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Enables pre-commit hooks managed by husky. ```bash husky install ``` -------------------------------- ### Start Local Development Server Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Use this command to start the local development server with Hot Module Replacement (HMR). The server typically runs on http://localhost:3000. ```bash pnpm dev ``` -------------------------------- ### Example Article Frontmatter Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/configuration.md Illustrates a complete frontmatter block for an article, including title, description, and order. ```mdx --- title: Button Component description: Guide to using the Button component with examples and best practices order: 1 deprecated: false --- # Button Component Content... ``` -------------------------------- ### Construct URLs with URL Object Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/configuration.md Examples demonstrating how to construct various URLs using the URL constructor with predefined constants. ```typescript // Fetch pattern code from GitHub const patternUrl = new URL(`${patternName}/${patternName}.tsx`, PATTERNS_GITHUB_RAW); // Link to specific SmartHR UI version on GitHub const uiSourceUrl = new URL(`smarthr-ui-v${version}/${filePath}`, SHRUI_GITHUB_RAW); // Storybook story URL const storybookUrl = new URL(`?path=/story/${storyId}`, storybookBaseUrl); // Chromatic iframe (using Storybook version from cache) const iframeUrl = new URL('/iframe.html', `https://${commitHash}--${SHRUI_CHROMATIC_ID}.chromatic.com/`); ``` -------------------------------- ### Example 3: F-Pattern with Pagination Considerations Source: https://github.com/kufu/smarthr-design-system/blob/main/plugins/smarthr-design-system/skills/design-pattern-guidelines/patterns/visual-guidance.mdx Shows an F-pattern layout for object lists, highlighting potential issues with pagination visibility and primary action placement. This example emphasizes how layout can affect user flow and element discoverability. ```astro Do F型の視線移動を考慮した配置になっている Dont オブジェクトの一覧画面からF型の視線移動を期待するレイアウトだが、視線の流れが途切れやすい配置になっている
  • 検索フォームがなく空白であるため、視線を横に移動する起点がなくPaginationが見逃される可能性がある
  • [オブジェクトを追加]は一覧画面における主要なアクションにはなりえないため、目立たせる目的で使われている結果、このボタンで視線の流れが途切れる可能性がある
  • オブジェクトの操作が行の途中に設置されており、項目2に視線が流れない可能性がある
  • ``` -------------------------------- ### Add Editable Code Example Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Create an editable code example with the CodeBlock component. Provide the code, language, and scope for interactive elements like Buttons. ```mdx ( );`} language="tsx" editable scope={{ Button }} /> ``` -------------------------------- ### Install Plugin for Claude Code Source: https://github.com/kufu/smarthr-design-system/blob/main/plugins/smarthr-design-system/README.md Use these commands to add and install the smarthr-design-system plugin for Claude Code. ```sh /plugin marketplace add kufu/smarthr-design-system /plugin install smarthr-design-system@smarthr-design-system ``` -------------------------------- ### Troubleshoot Dependency Conflicts Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Commands to check for peer dependency warnings and update the lock file to resolve installation issues. ```bash # Check for peer dependency warnings pnpm install --strict-peer-dependencies # Update lock file pnpm install --frozen-lockfile=false ``` -------------------------------- ### Accessibility Guidelines Example Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Include an accessibility section to outline important guidelines for users. This ensures inclusivity and usability. ```mdx ## Accessibility - ARIA labels required for icon-only buttons - Color alone must not convey information - Keyboard navigation must work - Screen readers must announce purpose ``` -------------------------------- ### DefinitionList - Basic Usage Source: https://github.com/kufu/smarthr-design-system/blob/main/plugins/smarthr-design-system/skills/component-guidelines/components/DefinitionList.md A basic example of using DefinitionList with DefinitionListItem to display a single term and its content. ```jsx 内容1 ``` -------------------------------- ### Navigation Link Example Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Use this format for linking to related articles within the site. URLs are relative to the site root. ```mdx [Related Article](/products/design-patterns/button-states) ``` -------------------------------- ### Chip Component Example Source: https://github.com/kufu/smarthr-design-system/blob/main/src/content/articles/products/components/chip/index.mdx Demonstrates the basic usage of the Chip component. This component is suitable for displaying text that functions as tags or categories. ```astro import ComponentStory from '@/components/article/ComponentStory.astro' import ComponentPropsTable from '@/components/article/ComponentPropsTable.astro' import Checklist from '@/components/article/Checklist/Checklist.astro' import { Chip, Cluster, FaCircleXmarkIcon, Stack, UnstyledButton } from 'smarthr-ui' ``` -------------------------------- ### Dialog Trigger - OK Example Source: https://github.com/kufu/smarthr-design-system/blob/main/plugins/smarthr-design-system/skills/component-guidelines/components/Dialog.md Demonstrates the correct usage of DialogTrigger, ensuring its child is a button element. ```jsx ``` -------------------------------- ### Button Component Example Source: https://github.com/kufu/smarthr-design-system/blob/main/src/content/articles/operational-guideline/page-template/style-template.mdx Demonstrates the usage of the Button component with different variants. Use one code snippet per component. ```tsx ``` -------------------------------- ### FloatArea Layout - Do Example Source: https://github.com/kufu/smarthr-design-system/blob/main/src/content/articles/products/components/float-area/index.mdx Demonstrates the correct placement of FloatArea, ensuring it visually indicates its target area by overlapping only the relevant column. ```jsx Do FloatAreaが右側のカラムだけに重なっているため、右側のカラムだけがFloatAreaの対象の領域であることがわかる ``` -------------------------------- ### Preview Production Build Locally Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Serves the production build ('dist/') locally for preview. ```bash pnpm preview ``` -------------------------------- ### Detailed Operation Guide Link Pattern Source: https://github.com/kufu/smarthr-design-system/blob/main/src/content/articles/products/contents/ui-text/help-link.mdx Use this pattern to link to detailed instructions for a specific operation. It starts with the operation name and 'の詳しい操作方法は、' followed by the help page title. ```text {hoge}の詳しい操作方法は、{ヘルプページタイトル}を参照してください。 ``` -------------------------------- ### Build Static Site for Production Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Builds the static site for production, creating a 'dist/' directory. ```bash pnpm build ``` -------------------------------- ### Example 2: Z-Pattern Visual Guidance Source: https://github.com/kufu/smarthr-design-system/blob/main/plugins/smarthr-design-system/skills/design-pattern-guidelines/patterns/visual-guidance.mdx Illustrates a Z-pattern layout for guiding the eye through key information and actions. This pattern is effective for interfaces where a clear path is needed to direct user attention. ```astro Do Z型の視線移動を考慮した配置になっており、主要な情報とアクションが見逃されにくい Dont FloatAreaの採用からZ型の視線移動を期待するレイアウトだが、[操作ボタン1][目的となるボタン]が「Z」の視線上に配置されていない ``` -------------------------------- ### Retrieve and Filter Astro Articles Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/api-reference-lib.md Use this snippet to fetch articles from an Astro content collection based on a base path and optional exclusion patterns. It demonstrates how to get all component pages and how to exclude specific pages, such as deprecated ones. The example also shows how to iterate through the retrieved entries and render their content. ```typescript import { getSubPageCollection } from '@/lib/getSubPageCollection'; // Get all component pages const components = await getSubPageCollection('products/components'); // Get all component pages except deprecated ones const activeComponents = await getSubPageCollection( 'products/components', ['deprecated'] // Excludes any page with 'deprecated' in its path ); // Iterate and render for (const entry of components) { const { title, order } = entry.data; const { Content } = await entry.render(); console.log(`${order}: ${title}`); } ``` -------------------------------- ### Create New Article Directory and File Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Use these bash commands to create the necessary directory structure and the index.mdx file for a new article. ```bash mkdir -p src/content/articles/products/my-section/my-page touch src/content/articles/products/my-section/my-page/index.mdx ``` -------------------------------- ### Grammar Simplification Example Source: https://github.com/kufu/smarthr-design-system/blob/main/src/content/articles/accessibility/insight/yasashii-nihongo/method.mdx Simplifies complex grammar to intermediate or lower levels. This example replaces the N1 grammar 'いずれ' with N5 grammar '〜か〜'. ```Japanese 下記のいずれかに該当する扶養家族はいますか? ``` ```Japanese あなたの 扶養になっている 家族で 次の 1か 2の人は いますか? ``` -------------------------------- ### Create Component Checklist File Source: https://github.com/kufu/smarthr-design-system/blob/main/_autodocs/development-guide.md Use bash to create a `checklist.yaml` file within a component's directory to define its checklist items. ```bash touch src/content/articles/products/components/button/checklist.yaml ``` -------------------------------- ### Coverage Baseline JSON Example Source: https://github.com/kufu/smarthr-design-system/blob/main/scripts/generate-skills/README.md An example structure for `coverage-baseline.json`, used to list known violations in coverage checks. Refer to the README for operational details. ```json { "$comment": "coverage チェックの既知違反リスト。運用方法は scripts/generate-skills/README.md の「coverage-baseline.json の運用」を参照。", "newComponents": ["Balloon"], "orphanDirs": [], "missingDescriptions": [], "unknownRelatedNames": [] } ``` -------------------------------- ### Example 1: F-Pattern Visual Guidance Source: https://github.com/kufu/smarthr-design-system/blob/main/plugins/smarthr-design-system/skills/design-pattern-guidelines/patterns/visual-guidance.mdx Demonstrates an F-pattern layout for optimal reading flow. Use this when content is primarily text-based and requires a predictable reading order. ```astro Do F型の視線移動を考慮した配置になっている Dont F型の視線移動を考慮した配置になっていない
  • 見出しがフォーム領域(Base)に対して左側に配置されていない
  • フォームが入力してほしい順序に上から下に並んでいない
  • 見出しの直後に[目的となるボタン]が配置されており、「フォームの入力後にボタンを押す」という視線の流れにならない
  • ``` -------------------------------- ### Select Component - Bad Implementation Example Source: https://github.com/kufu/smarthr-design-system/blob/main/src/content/articles/products/components/select/index.mdx An example of an incorrect implementation where the label is not associated with the Select component. This can lead to accessibility issues, as screen readers may not convey the selection's purpose. ```tsx // ❌ ラベルとSelectが関連付けられていない 都道府県