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 Dec 10, 2024
2 parents 06b8bc7 + fd654f3 commit 6086099
Show file tree
Hide file tree
Showing 82 changed files with 3,767 additions and 2,803 deletions.
10 changes: 6 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ version: 2.1
executors:
node-maintenance:
docker:
- image: cimg/node:18.20.4
- image: cimg/node:20.18.0
auth:
username: smarthrinc
password: $DOCKER_HUB_ACCESS_TOKEN
node-active-lts:
docker:
- image: cimg/node:20.17.0
- image: cimg/node:22.11.0
auth:
username: smarthrinc
password: $DOCKER_HUB_ACCESS_TOKEN
node-active-lts-browsers:
docker:
- image: cimg/node:20.17.0-browsers
- image: cimg/node:22.11.0-browsers
auth:
username: smarthrinc
password: $DOCKER_HUB_ACCESS_TOKEN
Expand Down Expand Up @@ -103,12 +103,14 @@ commands:
jobs:
node-maintenance:
executor: node-maintenance
resource_class: medium
steps:
- setup-for-test
- check-source
- run-npm-test
node-active-lts:
executor: node-active-lts
resource_class: medium
steps:
- setup-for-test
- check-source
Expand All @@ -124,7 +126,7 @@ jobs:
e2e-test:
executor: node-active-lts-browsers
working_directory: ~/repo
resource_class: large
resource_class: medium+
steps:
- setup-for-test
- run-e2e-test
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@
"description": "SmartHR ui components built with React.",
"author": "SmartHR-UI Team",
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"eslint": "^8.57.0",
"eslint-config-smarthr": "^7.3.0",
"eslint-plugin-storybook": "^0.11.1",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"prettier-config-smarthr": "^1.0.1",
"prettier-plugin-tailwindcss": "^0.6.9",
"stylelint": "^16.10.0",
"stylelint": "^16.11.0",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-smarthr": "^3.0.2",
"stylelint-config-standard": "^36.0.1",
"stylelint-config-styled-components": "^0.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
"typescript": "^5.7.2"
},
"scripts": {
"ui": "pnpm -F smarthr-ui",
"commitmsg": "commitlint -e $GIT_PARAMS",
"prepare": "husky"
},
"packageManager": "pnpm@9.13.2",
"packageManager": "pnpm@9.15.0",
"pnpm": {
"overrides": {
"@babel/helper-compilation-targets": "^7.25.9",
"@types/react": "^18.3.12",
"@types/react": "^18.3.14",
"minimist": "1.2.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"micromatch@<4.0.8": ">=4.0.8",
"cross-spawn@<7.0.5": ">=7.0.5"
}
Expand Down
68 changes: 34 additions & 34 deletions packages/smarthr-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,57 @@
"version": "62.1.1",
"author": "SmartHR-UI Team",
"dependencies": {
"@smarthr/wareki": "^1.2.0",
"@smarthr/wareki": "^1.3.0",
"dayjs": "^1.11.13",
"lodash.merge": "^4.6.2",
"lodash.range": "^3.2.0",
"polished": "^4.3.0",
"react-draggable": "^4.4.6",
"react-icons": "^5.3.0",
"react-icons": "^5.4.0",
"react-innertext": "^1.1.5",
"react-transition-group": "^4.4.5",
"tailwind-variants": "^0.3.0",
"tailwindcss": "^3.4.15"
"tailwindcss": "^3.4.16"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@storybook/addon-a11y": "^8.4.6",
"@storybook/addon-actions": "^8.4.6",
"@storybook/addon-essentials": "^8.4.6",
"@storybook/addon-interactions": "^8.4.6",
"@storybook/addon-storysource": "^8.4.6",
"@storybook/addon-a11y": "^8.4.7",
"@storybook/addon-actions": "^8.4.7",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/addon-storysource": "^8.4.7",
"@storybook/addon-styling-webpack": "^1.0.1",
"@storybook/addon-viewport": "^8.4.6",
"@storybook/addon-viewport": "^8.4.7",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/blocks": "^8.4.6",
"@storybook/cli": "^8.4.6",
"@storybook/manager-api": "^8.4.6",
"@storybook/react": "^8.4.6",
"@storybook/react-webpack5": "^8.4.6",
"@storybook/source-loader": "^8.4.6",
"@storybook/test": "^8.4.6",
"@storybook/test-runner": "^0.19.1",
"@storybook/theming": "^8.4.6",
"@swc/core": "^1.9.3",
"@storybook/blocks": "^8.4.7",
"@storybook/cli": "^8.4.7",
"@storybook/manager-api": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-webpack5": "^8.4.7",
"@storybook/source-loader": "^8.4.7",
"@storybook/test": "^8.4.7",
"@storybook/test-runner": "^0.20.1",
"@storybook/theming": "^8.4.7",
"@swc/core": "^1.10.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/react": "^16.1.0",
"@types/lodash.merge": "^4.6.9",
"@types/lodash.range": "^3.2.9",
"@types/node": "^20.17.9",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-test-renderer": "^18.3.0",
"@types/react": "^18.3.14",
"@types/react-dom": "^19.0.2",
"@types/react-test-renderer": "^19.0.0",
"@types/react-transition-group": "^4.4.11",
"@types/styled-components": "^5.1.34",
"autoprefixer": "^10.4.20",
"axe-playwright": "^2.0.3",
"babel-loader": "^9.2.1",
"babel-plugin-polyfill-corejs2": "^0.4.12",
"babel-plugin-polyfill-regenerator": "^0.6.3",
"chromatic": "^11.18.1",
"chromatic": "^11.20.0",
"css-loader": "^7.1.2",
"ecma-version-validator-webpack-plugin": "^1.2.1",
"fs-extra": "^11.2.0",
Expand All @@ -63,33 +63,33 @@
"jsdom": "^25.0.1",
"memory-fs": "^0.5.0",
"npm-run-all": "^4.1.5",
"playwright": "^1.48.2",
"playwright": "^1.49.0",
"plop": "^4.0.1",
"postcss": "^8.4.49",
"postcss-loader": "^8.1.1",
"postcss-styled-syntax": "^0.7.0",
"postcss-syntax": "^0.36.2",
"react": "^18.3.1",
"react": "^19.0.0",
"react-docgen-typescript": "^2.2.2",
"react-dom": "^18.3.1",
"react-dom": "^19.0.0",
"react-ga4": "^2.1.0",
"react-test-renderer": "^18.3.1",
"react-test-renderer": "^19.0.0",
"rimraf": "^6.0.1",
"standard-version": "^9.3.2",
"storybook": "^8.4.6",
"storybook": "^8.4.7",
"storybook-addon-pseudo-states": "^4.0.2",
"style-loader": "^4.0.0",
"styled-components": "^5.3.11",
"ts-loader": "^9.5.1",
"ttypescript": "^1.5.15",
"typescript-plugin-styled-components": "^3.0.0",
"vitest": "^2.1.6",
"vitest": "^2.1.8",
"wait-on": "^8.0.1",
"webpack": "^5.96.1"
"webpack": "^5.97.1"
},
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0",
"styled-components": "^5.0.1"
},
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/smarthr-ui/scripts/exportUIProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ glob(SRC_PATH).then(
const propItem = props[name]
const declarations = propItem.declarations

if (!declarations) {
if (!declarations || declarations.length === 0) {
return propItem
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import React, {
ComponentProps,
PropsWithChildren,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import React, {
ComponentPropsWithoutRef,
FC,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import React, {
ComponentPropsWithoutRef,
FC,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import React, {
ComponentPropsWithoutRef,
FC,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import React, {
ComponentProps,
ComponentPropsWithRef,
Expand Down
99 changes: 99 additions & 0 deletions packages/smarthr-ui/src/components/Browser/Browser.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { userEvent } from '@storybook/test'
import { render, screen } from '@testing-library/react'
import React from 'react'

import { Browser } from './Browser'

describe('Browser', () => {
test('アイテムが空のとき', () => {
render(<Browser items={[]} />)
expect(screen.getByText(/該当する項目がありません/)).toBeInTheDocument()
})

test('アイテムが存在するとき、最初の要素がタブストップになる', async () => {
const onSelectItem = vi.fn()
render(
<>
<Browser
items={[
{ value: '1', label: 'アイテム1' },
{ value: '2', label: 'アイテム2' },
{ value: '3', label: 'アイテム3' },
]}
onSelectItem={onSelectItem}
/>
<a href="/">次の要素</a>
</>,
)
await userEvent.keyboard('[Tab]')
expect(screen.getByRole('radio', { name: 'アイテム1' })).toHaveFocus()
await userEvent.keyboard('[Tab]')
expect(screen.getByRole('link', { name: '次の要素' })).toHaveFocus()
})

test('値を指定すると、ラジオボタンがチェックされ、タブストップになる', async () => {
render(
<>
<Browser
items={[
{ value: '1', label: 'アイテム1' },
{ value: '2', label: 'アイテム2' },
{ value: '3', label: 'アイテム3' },
]}
value="2"
/>
<a href="/">次の要素</a>
</>,
)
expect(screen.getByRole('radio', { name: 'アイテム2' })).toBeChecked()
await userEvent.keyboard('[Tab]')
expect(screen.getByRole('radio', { name: 'アイテム2' })).toHaveFocus()
await userEvent.keyboard('[Tab]')
expect(screen.getByRole('link', { name: '次の要素' })).toHaveFocus()
})

test.each([
['ArrowUp', '2-1'],
['ArrowDown', '2-3'],
['ArrowRight', '3-1'],
['ArrowLeft', '1-1'],
])('%sを押すと、%sが選択される', async (key, expected) => {
const onSelectItem = vi.fn()
render(
<Browser
items={[
{
value: '1-1',
label: 'アイテム1-1',
children: [
{
value: '2-1',
label: 'アイテム2-1',
},
{
value: '2-2',
label: 'アイテム2-2',
children: [{ value: '3-1', label: 'アイテム3-1' }],
},
{
value: '2-3',
label: 'アイテム2-3',
},
],
},
{
value: '1-2',
label: 'アイテム1-2',
},
{ value: '1-3', label: 'アイテム1-3' },
]}
value="2-2"
onSelectItem={onSelectItem}
/>,
)

await userEvent.click(screen.getByRole('radio', { name: 'アイテム2-1' }))
await userEvent.keyboard(`[${key}]`)
expect(onSelectItem).toHaveBeenCalledWith(expected)
})
})
Loading

0 comments on commit 6086099

Please sign in to comment.