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 May 14, 2024
2 parents 0d4056d + 76c152d commit f1a35db
Show file tree
Hide file tree
Showing 23 changed files with 2,691 additions and 2,347 deletions.
11 changes: 6 additions & 5 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:21.7.3
- image: cimg/node:22.1.0
auth:
username: smarthrinc
password: $DOCKER_HUB_ACCESS_TOKEN
node-active-lts:
docker:
- image: cimg/node:21.7.3
- image: cimg/node:22.1.0
auth:
username: smarthrinc
password: $DOCKER_HUB_ACCESS_TOKEN
node-active-lts-browsers:
docker:
- image: cimg/node:21.7.3-browsers
- image: cimg/node:22.1.0-browsers
auth:
username: smarthrinc
password: $DOCKER_HUB_ACCESS_TOKEN
Expand Down Expand Up @@ -49,6 +49,7 @@ commands:
keys:
- pnpm-packages-reg-{{ checksum "pnpm-lock.yaml" }}
- run: pnpm ui install
- run: pnpm ui exec playwright install
- save_cache:
paths:
- ~/.cache/pnpm
Expand All @@ -65,11 +66,11 @@ commands:
run-chromatic:
steps:
- checkout
- run: pnpm ui run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --only-changed
- run: pnpm ui run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --only-changed --storybook-base-dir=packages/smarthr-ui
run-chromatic-master:
steps:
- checkout
- run: STORYBOOK_NODE_ENV="production" pnpm ui run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --auto-accept-changes --only-changed
- run: STORYBOOK_NODE_ENV="production" pnpm ui run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --auto-accept-changes --only-changed --storybook-base-dir=packages/smarthr-ui
install-noto-sans-cjk-jp:
steps:
- run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publishRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
if: ${{ env.IS_PRERELEASE == 'false' }}
- run: pnpm ui release --prerelease
if: ${{ env.IS_PRERELEASE == 'true' }}
- run: pnpm publish --filter smarthr-ui
- run: pnpm publish --filter smarthr-ui --no-git-checks
if: ${{ env.IS_PRERELEASE == 'false' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm publish --filter smarthr-ui --tag prerelease
- run: pnpm publish --filter smarthr-ui --tag prerelease --no-git-checks
if: ${{ env.IS_PRERELEASE == 'true' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.12.2
20.13.0
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"description": "SmartHR ui components built with React.",
"author": "SmartHR-UI Team",
"devDependencies": {
"@commitlint/cli": "^19.2.2",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"eslint": "^8.57.0",
"eslint-config-smarthr": "^6.28.0",
"eslint-config-smarthr": "^6.30.0",
"eslint-plugin-storybook": "^0.8.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-config-smarthr": "^1.0.0",
"prettier-plugin-tailwindcss": "^0.5.14",
"stylelint": "^16.3.1",
"stylelint": "^16.5.0",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-smarthr": "^3.0.0",
"stylelint-config-standard": "^36.0.0",
Expand All @@ -30,7 +30,7 @@
"pnpm": {
"overrides": {
"@babel/helper-compilation-targets": "^7.23.6",
"@types/react": "^18.3.1",
"@types/react": "^18.3.2",
"minimist": "1.2.8",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
85 changes: 85 additions & 0 deletions packages/smarthr-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<h1 align="center"><img src ="https://user-images.githubusercontent.com/44044475/70201779-f994de80-175a-11ea-90e1-8a69f5b13ff0.png" alt="SmartHR UI" title="SmartHR UI"></h1>

<div align="center">

SmartHR は、SmartHR 基本機能からはじまり、今では多くのオプション機能を提供しています。
SmartHR UI はそのすべてのアプリケーションの UI コンポーネントを共通化して、開発生産性や完成度を向上させるための UI コンポーネントライブラリです。

[![npm version](https://badge.fury.io/js/smarthr-ui.svg)](https://badge.fury.io/js/smarthr-ui)
[![CircleCI](https://circleci.com/gh/kufu/smarthr-ui.svg?style=shield)](https://circleci.com/gh/kufu/smarthr-ui)
![e2e](https://github.com/kufu/smarthr-ui/workflows/e2e/badge.svg)

</div>

## コンポーネント

`master`ブランチのコンポーネント一覧は Storybook から確認できます。
https://story.smarthr-ui.dev

## インストール

SmartHR-UI は[npm package](https://www.npmjs.com/package/smarthr-ui)として提供しています。

```sh
// with npm
npm install smarthr-ui

// with yarn
yarn add smarthr-ui

// with pnpm
pnpm add smarthr-ui
```

peerDependencies として React, React-DOM, styled-components が必要です。

```sh
// with npm
npm install react react-dom styled-components

// with yarn
yarn add react react-dom styled-components

// with pnpm
pnpm add react react-dom styled-components
```

## 使いかた

最もシンプルで簡単な使用例を紹介します。

```tsx
import React from 'react'
import { createRoot } from 'react-dom/client'
import { createTheme, ThemeProvider, Button } from 'smarthr-ui'
import 'smarthr-ui/smarthr-ui.css'

const theme = createTheme()

const App: React.FC = () => (
<ThemeProvider theme={theme}>
<Button variant="primary">Hello World</Button>
</ThemeProvider>
)

const container = document.getElementById('app')
const root = createRoot(container)
root.render(<App />)
```

## コントリビュート

SmartHR UI は OSS です。[コントリビュート](https://github.com/kufu/smarthr-ui/blob/master/CONTRIBUTING.md)をお待ちしています。

## 更新履歴

更新履歴は[Releases](https://github.com/kufu/smarthr-ui/releases)を確認してください。

## デザイン・ロゴの利用について

- SmartHR UI のデザインデータは[Figma](https://www.figma.com/community/file/978607227374353992/SmartHR-UI)で公開しています。
- SmartHR のロゴを利用する場合は[SmartHR Design System](https://smarthr.design/)の利用規約を確認してください。

## ライセンス

このプロダクトは[MIT](https://github.com/kufu/smarthr-ui/blob/master/LICENSE)の条件に従ってライセンスされています。
33 changes: 17 additions & 16 deletions packages/smarthr-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"dependencies": {
"@smarthr/wareki": "^1.2.0",
"css-loader": "^7.1.1",
"dayjs": "^1.11.10",
"dayjs": "^1.11.11",
"lodash.merge": "^4.6.2",
"lodash.range": "^3.2.0",
"polished": "^4.3.0",
"postcss-loader": "^8.1.1",
"react-draggable": "^4.4.6",
"react-icons": "^5.1.0",
"react-icons": "^5.2.1",
"react-innertext": "^1.1.5",
"react-transition-group": "^4.4.5",
"style-loader": "^4.0.0",
Expand All @@ -30,6 +30,7 @@
"@storybook/addon-interactions": "^8.0.10",
"@storybook/addon-storysource": "^8.0.10",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-styling-webpack": "^1.0.0",
"@storybook/addon-viewport": "^8.0.10",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/blocks": "^8.0.10",
Expand All @@ -39,18 +40,17 @@
"@storybook/react-webpack5": "^8.0.10",
"@storybook/source-loader": "^8.0.10",
"@storybook/test": "^8.0.10",
"@storybook/addon-styling-webpack": "^1.0.0",
"@storybook/test-runner": "^0.17.0",
"@storybook/test-runner": "^0.18.0",
"@storybook/theming": "^8.0.10",
"@swc/core": "^1.4.17",
"@swc/core": "^1.5.5",
"@swc/jest": "^0.2.36",
"@testing-library/react": "^15.0.6",
"@testing-library/react": "^15.0.7",
"@types/jest": "^29.5.12",
"@types/lodash.merge": "^4.6.9",
"@types/lodash.range": "^3.2.9",
"@types/node": "^20.12.8",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.2.25",
"@types/node": "^20.12.11",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@types/react-test-renderer": "^17.0.9",
"@types/react-transition-group": "^4.4.10",
"@types/styled-components": "^5.1.34",
Expand All @@ -59,31 +59,32 @@
"babel-loader": "^9.1.3",
"babel-plugin-polyfill-corejs2": "^0.4.11",
"babel-plugin-polyfill-regenerator": "^0.6.2",
"chromatic": "^11.3.0",
"chromatic": "^11.3.2",
"ecma-version-validator-webpack-plugin": "^1.2.1",
"fs-extra": "^11.2.0",
"glob": "10.3.12",
"glob": "10.3.15",
"http-server": "^14.1.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-styled-components": "^7.2.0",
"memory-fs": "^0.5.0",
"npm-run-all": "^4.1.5",
"playwright": "^1.44.0",
"postcss": "^8.4.38",
"postcss-styled-syntax": "^0.6.4",
"postcss-syntax": "^0.36.2",
"puppeteer": "^22.6.5",
"puppeteer": "^22.8.0",
"react": "^18.3.1",
"react-docgen-typescript": "^2.2.2",
"react-dom": "^18.3.1",
"react-ga4": "^2.1.0",
"react-test-renderer": "^18.2.0",
"rimraf": "^5.0.5",
"react-test-renderer": "^18.3.1",
"rimraf": "^5.0.7",
"standard-version": "^9.3.2",
"storybook": "^8.0.10",
"storybook-addon-pseudo-states": "^3.0.1",
"storybook-addon-pseudo-states": "^3.1.1",
"styled-components": "^5.3.11",
"testcafe": "3.5.0",
"testcafe": "3.6.0",
"ts-loader": "^9.5.1",
"ttypescript": "^1.5.15",
"typescript-plugin-styled-components": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ export const All: StoryFn = () => (
</>
),
description: '標準は subBlockTitle です。blockTitle と subBlockTitle があります。',
fullWidth: true,
},
{
term: '空文字の場合も line-height 込みの高さを保ちます。',
description: '',
},
{
term: 'undefined の場合',
},
]}
termStyleType="blockTitle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const definitionListItem = tv({
],
termEl: 'smarthr-ui-DefinitionListItem-term',
descriptionEl:
'smarthr-ui-DefinitionListItem-description shr-ms-[initial] shr-pb-0.25 min-h-[theme(lineHeight.normal)]',
'smarthr-ui-DefinitionListItem-description shr-ms-[initial] shr-pb-0.25 shr-min-h-[calc(1em*theme(lineHeight.normal))]',
},
variants: {
fullWidth: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const All: StoryFn = () => (
<Text>With children</Text>
<DropZone name="with_children" onSelectFiles={onSelectFiles}>
<DropZoneText>
<span>ここにドラッグ&ドロップ</span>
<span>ここにドラッグアンドドロップ</span>
<span>または</span>
</DropZoneText>
</DropZone>
Expand All @@ -36,7 +36,7 @@ export const All: StoryFn = () => (
<Text>Button accepting only image files</Text>
<DropZone name="accept" onSelectFiles={onSelectFiles} accept="image/*">
<DropZoneText>
<span>ここにドラッグ&ドロップ</span>
<span>ここにドラッグアンドドロップ</span>
<span>または</span>
</DropZoneText>
</DropZone>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Dropdown, DropdownContent, DropdownScrollArea, DropdownTrigger } from '
import { AnchorButton, Button, BaseProps as ButtonProps } from '../../Button'
import { RemoteDialogTrigger } from '../../Dialog'
import { FaCaretDownIcon, FaEllipsisIcon } from '../../Icon'
import { Stack } from '../../Layout'

type Actions = ActionItem | ActionItem[]

Expand Down Expand Up @@ -214,14 +213,12 @@ export const DropdownMenuButton: FC<Props & ElementProps> = ({
</Button>
</DropdownTrigger>
<DropdownContent>
<DropdownScrollArea>
<Stack as="ul" gap={0} ref={containerRef} className={actionListStyle}>
{React.Children.map(children, (item, i) =>
// MEMO: {flag && <Button/>}のような書き方に対応させる為、型を変換する
// itemの存在チェックでfalsyな値は弾かれている想定
item ? <li key={i}>{actionItem(item as ActionItemTruthyType)}</li> : null,
)}
</Stack>
<DropdownScrollArea as="ul" ref={containerRef} className={actionListStyle}>
{React.Children.map(children, (item, i) =>
// MEMO: {flag && <Button/>}のような書き方に対応させる為、型を変換する
// itemの存在チェックでfalsyな値は弾かれている想定
item ? <li key={i}>{actionItem(item as ActionItemTruthyType)}</li> : null,
)}
</DropdownScrollArea>
</DropdownContent>
</Dropdown>
Expand Down
16 changes: 10 additions & 6 deletions packages/smarthr-ui/src/components/Dropdown/DropdownScrollArea.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React, { ComponentProps, PropsWithChildren, useMemo } from 'react'
import React, { ComponentProps, ElementType, PropsWithChildren, forwardRef, useMemo } from 'react'
import { tv } from 'tailwind-variants'

type Props = PropsWithChildren<ComponentProps<'div'>>
type Props = PropsWithChildren<ComponentProps<'div'>> & {
as?: ElementType
}

const scrollArea = tv({
base: 'smarthr-ui-Dropdown-scrollArea shr-flex-auto shr-overflow-y-auto',
})

export const DropdownScrollArea: React.FC<Props> = ({ className, ...props }) => {
const styles = useMemo(() => scrollArea({ className }), [className])
export const DropdownScrollArea = forwardRef<HTMLDivElement, Props>(
({ as: Component = 'div', className, ...props }, ref) => {
const styles = useMemo(() => scrollArea({ className }), [className])

return <div {...props} className={styles} />
}
return <Component {...props} ref={ref} className={styles} />
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const All: StoryFn = () => (
title="氏名"
statusLabelProps={{ type: 'grey', children: '任意' }}
helpMessage="氏名を入力してください。"
errorMessages={'氏名が入力されていません。'}
errorMessages="氏名が入力されていません。"
>
<Input name="fullname" width="100%" />
</FormControl>
Expand Down
Loading

0 comments on commit f1a35db

Please sign in to comment.