Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 9, 2024
2 parents 1713338 + 54298ce commit 1bc80bd
Show file tree
Hide file tree
Showing 57 changed files with 3,155 additions and 2,737 deletions.
13 changes: 12 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@ module.exports = {
'error',
'type',
],
'smarthr/a11y-delegate-element-has-role-presentation': 'error',
'smarthr/require-barrel-import': 'off',
'smarthr/a11y-anchor-has-href-attribute': [
'error',
{
checkType: 'allow-spread-attributes',
}
],
'smarthr/a11y-input-has-name-attribute': [
'error',
{
checkType: 'allow-spread-attributes',
}
],
},
}
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.17.0
20.18.0
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"commitmsg": "commitlint -e $GIT_PARAMS",
"prepare": "husky"
},
"packageManager": "pnpm@9.11.0",
"packageManager": "pnpm@9.12.0",
"pnpm": {
"overrides": {
"@babel/helper-compilation-targets": "^7.25.2",
"@types/react": "^18.3.10",
"@babel/helper-compilation-targets": "^7.25.7",
"@types/react": "^18.3.11",
"minimist": "1.2.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
50 changes: 26 additions & 24 deletions packages/smarthr-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@
"tailwindcss": "^3.4.13"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@storybook/addon-a11y": "^8.3.4",
"@storybook/addon-actions": "^8.3.4",
"@storybook/addon-essentials": "^8.3.4",
"@storybook/addon-interactions": "^8.3.4",
"@storybook/addon-storysource": "^8.3.4",
"@babel/core": "^7.25.7",
"@babel/preset-env": "^7.25.7",
"@babel/preset-react": "^7.25.7",
"@babel/preset-typescript": "^7.25.7",
"@storybook/addon-a11y": "^8.3.5",
"@storybook/addon-actions": "^8.3.5",
"@storybook/addon-essentials": "^8.3.5",
"@storybook/addon-interactions": "^8.3.5",
"@storybook/addon-storysource": "^8.3.5",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-styling-webpack": "^1.0.0",
"@storybook/addon-viewport": "^8.3.4",
"@storybook/addon-viewport": "^8.3.5",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/blocks": "^8.3.4",
"@storybook/cli": "^8.3.4",
"@storybook/manager-api": "^8.3.4",
"@storybook/react": "^8.3.4",
"@storybook/react-webpack5": "^8.3.4",
"@storybook/source-loader": "^8.3.4",
"@storybook/test": "^8.3.4",
"@storybook/blocks": "^8.3.5",
"@storybook/cli": "^8.3.5",
"@storybook/manager-api": "^8.3.5",
"@storybook/react": "^8.3.5",
"@storybook/react-webpack5": "^8.3.5",
"@storybook/source-loader": "^8.3.5",
"@storybook/test": "^8.3.5",
"@storybook/test-runner": "^0.19.1",
"@storybook/theming": "^8.3.4",
"@storybook/theming": "^8.3.5",
"@swc/core": "^1.7.26",
"@testing-library/react": "^16.0.1",
"@types/lodash.merge": "^4.6.9",
"@types/lodash.range": "^3.2.9",
"@types/node": "^20.16.10",
"@types/react": "^18.3.10",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/react-test-renderer": "^17.0.9",
"@types/react-transition-group": "^4.4.11",
Expand All @@ -55,7 +55,7 @@
"babel-plugin-polyfill-corejs2": "^0.4.11",
"babel-plugin-polyfill-regenerator": "^0.6.2",
"css-loader": "^7.1.2",
"chromatic": "^11.10.4",
"chromatic": "^11.11.0",
"ecma-version-validator-webpack-plugin": "^1.2.1",
"fs-extra": "^11.2.0",
"glob": "11.0.0",
Expand All @@ -64,6 +64,7 @@
"memory-fs": "^0.5.0",
"npm-run-all": "^4.1.5",
"playwright": "^1.47.2",
"plop": "^4.0.1",
"postcss": "^8.4.47",
"postcss-loader": "^8.1.1",
"postcss-styled-syntax": "^0.6.4",
Expand All @@ -75,15 +76,15 @@
"react-test-renderer": "^18.3.1",
"rimraf": "^6.0.1",
"standard-version": "^9.3.2",
"storybook": "^8.3.4",
"storybook": "^8.3.5",
"storybook-addon-pseudo-states": "^4.0.2",
"style-loader": "^4.0.0",
"styled-components": "^5.3.11",
"testcafe": "3.6.2",
"ts-loader": "^9.5.1",
"ttypescript": "^1.5.15",
"typescript-plugin-styled-components": "^3.0.0",
"vitest": "^2.1.1",
"vitest": "^2.1.2",
"wait-on": "^8.0.1",
"webpack": "^5.95.0"
},
Expand Down Expand Up @@ -149,13 +150,14 @@
"dev": "run-s storybook",
"test": "vitest",
"test:build-assets": "node scripts/build-test.ts",
"test-storybook:ci": "wait-on tcp:6006 && pnpm test-storybook --maxWorkers=2 --junit",
"test-storybook:ci": "wait-on tcp:6006 && pnpm test-storybook --maxWorkers=2 --junit --skipTags='skip-test-runner'",
"testcafe": "testcafe",
"e2e": "ts-node scripts/e2e.ts",
"e2e:dev": "testcafe chrome --hostname localhost --skip-js-errors --live",
"chromatic": "chromatic",
"write:ui-props": "ts-node scripts/exportUIProps.ts",
"export:ui-props": "run-s build:lib write:ui-props"
"export:ui-props": "run-s build:lib write:ui-props",
"scaffold:storybook": "plop"
},
"sideEffects": [
"*.css"
Expand Down
33 changes: 33 additions & 0 deletions packages/smarthr-ui/plopfile.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// src/components 配下のコンポーネントを取得得する
import fs from 'fs'

const components = fs
.readdirSync('src/components')
.map((name) => ({ name, value: name }))
.sort()

export default (
/** @type {import('plop').NodePlopAPI} */
plop,
) => {
plop.setGenerator('story', {
description: 'Story の雛形を作ります。',
prompts: [
{
type: 'list',
name: 'name',
message: '作成対象コンポーネントを選択してください。',
choices: components,
loop: false,
},
],
actions: [
{
type: 'addMany',
destination: 'src/components/{{name}}/stories',
base: 'scaffold/templates/stories',
templateFiles: 'scaffold/templates/stories/*.hbs',
},
],
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { fireEvent, within } from '@storybook/test'
import React from 'react'

import { Stack } from '../../Layout'
import { {{ name }} } from '../{{ name }}'

import type { StoryObj } from '@storybook/react'

export default {
title: 'SomeCategory(カテゴリ)/{{ name }}/VRT',
/* ペアワイズ法による網羅 */
render: (args: any) => (
<Stack {...args}>
<{{ name }} />
<{{ name }} />
</Stack>
),
parameters: {
chromatic: { disableSnapshot: false },
},
tags: ['!autodocs'],
}

export const VRT = {}

export const VRTHover = {
...VRT,
args: {
id: 'hover',
},
parameters: {
pseudo: {
hover: ['#hover .smarthr-ui-{{ name }}'],
},
// MEMO: VRT として機能していないので、解決するまでスナップショットを無効化
chromatic: { disableSnapshot: true },
},
}

export const VRTKeyboardFocus: StoryObj = {
...VRT,
play: async ({ canvasElement }) => {
const canvas = within(canvasElement)
// FIXME: ここにフォーカス処理を書いて
},
}

export const VRTForcedColors: StoryObj = {
...VRT,
parameters: {
chromatic: { forcedColors: 'active' },
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react'

import { {{ name }} } from '../{{ name }}'

import type { Meta, StoryObj } from '@storybook/react'

export default {
title: 'SomeCategory(カテゴリ)/{{ name }}',
component: {{ name }},
render: (args) => <{{ name }} {...args} />,
args: {
},
parameters: {
chromatic: { disableSnapshot: true },
},
} as Meta<typeof {{ name }}>

export const Default: StoryObj<typeof {{ name }}> = {
args: {
},
}

export const {{ name }}Control: StoryObj<typeof {{ name }}> = {
name: 'Playground',
args: {
},
}

export const SomeProps: StoryObj<typeof {{ name }}> = {
name: 'someProps',
args: {
someProps: someValue,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const Link: FC<{ to: string; children: ReactNode; disabled?: boolean; className?
className = '',
...props
}) => (
// eslint-disable-next-line smarthr/a11y-anchor-has-href-attribute
<a {...props} {...(disabled ? {} : { href: to })} className={className}>
{children}
</a>
Expand Down
1 change: 0 additions & 1 deletion packages/smarthr-ui/src/components/AppNavi/AppNavi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const AppNavi: FC<Props & ElementProps> = ({
if ('href' in button) {
return (
<li key={i} className={listItemStyle}>
{/* eslint-disable-next-line smarthr/a11y-anchor-has-href-attribute */}
<AppNaviAnchor {...button} />
</li>
)
Expand Down
Loading

0 comments on commit 1bc80bd

Please sign in to comment.