letalkui 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +11 -0
- package/.github/workflows/check.yml +33 -0
- package/.github/workflows/lint.yaml +25 -0
- package/.github/workflows/npm-publish.yml +19 -19
- package/.nvmrc +1 -0
- package/eslint.config.js +65 -25
- package/package.json +9 -1
- package/src/components/Button/Button.stories.ts +42 -43
- package/src/components/Button/index.tsx +26 -31
- package/src/index.ts +1 -1
- package/tsconfig.app.json +2 -1
- package/tsconfig.build.json +4 -3
- package/tsconfig.eslint.json +4 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = tab
|
|
5
|
+
indent_size = 4
|
|
6
|
+
# LF (Line Feed) and CRLF (Carriage Return + Line Feed) are different line-ending conventions used to mark the end of a line in text files:
|
|
7
|
+
# More information in this post: https://medium.com/@feldy7k/understanding-line-break-types-cr-lf-and-crlf-278069b8da29
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
charset = utf-8
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
on:
|
|
2
|
+
push:
|
|
3
|
+
branches:
|
|
4
|
+
- master
|
|
5
|
+
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
name: Check
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
check:
|
|
14
|
+
name: Check
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: actions/checkout@v2
|
|
20
|
+
|
|
21
|
+
- name: Setup NodeJS
|
|
22
|
+
uses: actions/setup-node@v1
|
|
23
|
+
with:
|
|
24
|
+
node-version: "18.20.3"
|
|
25
|
+
|
|
26
|
+
- name: Install All Dependencies
|
|
27
|
+
run: npm i -f
|
|
28
|
+
|
|
29
|
+
- name: Build
|
|
30
|
+
env:
|
|
31
|
+
CI: true
|
|
32
|
+
NODE_OPTIONS: --max-old-space-size=4096
|
|
33
|
+
run: npm run build
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
on: pull_request
|
|
2
|
+
|
|
3
|
+
name: Lint
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
check:
|
|
7
|
+
name: Lint
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
container:
|
|
10
|
+
image: node:18.20.3
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
|
|
16
|
+
- name: Setup NodeJS
|
|
17
|
+
uses: actions/setup-node@v2
|
|
18
|
+
with:
|
|
19
|
+
node-version: "18.20.3"
|
|
20
|
+
|
|
21
|
+
- name: Install packages
|
|
22
|
+
run: npm ci
|
|
23
|
+
|
|
24
|
+
- name: Check Lint
|
|
25
|
+
run: npx eslint 'src/**'
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
name: Release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v3
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
- name: Setup Node.js
|
|
16
|
+
uses: actions/setup-node@v3
|
|
17
|
+
with:
|
|
18
|
+
node-version: "18.20.3"
|
|
19
|
+
registry-url: 'https://registry.npmjs.org'
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: npm i -f
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
- name: Release
|
|
25
|
+
run: npm publish
|
|
26
|
+
env:
|
|
27
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
14.18.1
|
package/eslint.config.js
CHANGED
|
@@ -1,28 +1,68 @@
|
|
|
1
|
-
import js from
|
|
2
|
-
import globals from
|
|
3
|
-
import reactHooks from
|
|
4
|
-
import reactRefresh from
|
|
5
|
-
import
|
|
1
|
+
import js from "@eslint/js"
|
|
2
|
+
import globals from "globals"
|
|
3
|
+
import reactHooks from "eslint-plugin-react-hooks"
|
|
4
|
+
import reactRefresh from "eslint-plugin-react-refresh"
|
|
5
|
+
import react from "eslint-plugin-react"
|
|
6
|
+
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
|
7
|
+
import jsxA11Y from "eslint-plugin-jsx-a11y"
|
|
8
|
+
import _import from "eslint-plugin-import"
|
|
9
|
+
import tsParser from "@typescript-eslint/parser"
|
|
6
10
|
|
|
7
|
-
export default
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
-
files: ['**/*.{ts,tsx}'],
|
|
12
|
-
languageOptions: {
|
|
13
|
-
ecmaVersion: 2020,
|
|
14
|
-
globals: globals.browser,
|
|
11
|
+
export default [
|
|
12
|
+
{
|
|
13
|
+
ignores: ["dist", ".storybook", "vite.config.ts", "tsup.config.ts"],
|
|
15
14
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
js.configs.recommended,
|
|
16
|
+
{
|
|
17
|
+
files: ["**/*.{ts,tsx}"],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
sourceType: "module",
|
|
21
|
+
globals: {
|
|
22
|
+
...globals.browser,
|
|
23
|
+
...globals.node,
|
|
24
|
+
...globals.jest,
|
|
25
|
+
},
|
|
26
|
+
parser: tsParser,
|
|
27
|
+
parserOptions: {
|
|
28
|
+
project: "./tsconfig.eslint.json",
|
|
29
|
+
ecmaFeatures: {
|
|
30
|
+
jsx: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
plugins: {
|
|
35
|
+
"react-hooks": reactHooks,
|
|
36
|
+
"react-refresh": reactRefresh,
|
|
37
|
+
react,
|
|
38
|
+
"@typescript-eslint": typescriptEslint,
|
|
39
|
+
"jsx-a11y": jsxA11Y,
|
|
40
|
+
import: _import,
|
|
41
|
+
},
|
|
42
|
+
rules: {
|
|
43
|
+
...reactHooks.configs.recommended.rules,
|
|
44
|
+
"react-refresh/only-export-components": [
|
|
45
|
+
"warn",
|
|
46
|
+
{ allowConstantExport: true },
|
|
47
|
+
],
|
|
48
|
+
...typescriptEslint.configs.recommended.rules,
|
|
49
|
+
...react.configs.recommended.rules,
|
|
50
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
51
|
+
indent: ["error", "tab"],
|
|
52
|
+
quotes: ["error", "double"],
|
|
53
|
+
semi: ["error", "never"],
|
|
54
|
+
"object-curly-spacing": ["error", "always"],
|
|
55
|
+
"comma-dangle": ["error", "never"]
|
|
56
|
+
},
|
|
57
|
+
settings: {
|
|
58
|
+
"import/resolver": {
|
|
59
|
+
typescript: {
|
|
60
|
+
project: ["./tsconfig.json"],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
react: {
|
|
64
|
+
version: "detect",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
19
67
|
},
|
|
20
|
-
|
|
21
|
-
...reactHooks.configs.recommended.rules,
|
|
22
|
-
'react-refresh/only-export-components': [
|
|
23
|
-
'warn',
|
|
24
|
-
{ allowConstantExport: true },
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
)
|
|
68
|
+
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "letalkui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"lint": "eslint .",
|
|
7
8
|
"dev": "storybook dev -p 6006",
|
|
@@ -13,6 +14,8 @@
|
|
|
13
14
|
"react-dom": "^18.3.1"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
17
|
+
"@eslint/compat": "^1.2.5",
|
|
18
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
16
19
|
"@eslint/js": "^9.17.0",
|
|
17
20
|
"@storybook/addon-essentials": "^8.4.7",
|
|
18
21
|
"@storybook/blocks": "^8.4.7",
|
|
@@ -22,8 +25,13 @@
|
|
|
22
25
|
"@types/node": "18.19",
|
|
23
26
|
"@types/react": "^18.3.18",
|
|
24
27
|
"@types/react-dom": "^18.3.5",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
29
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
25
30
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
26
31
|
"eslint": "^9.17.0",
|
|
32
|
+
"eslint-plugin-import": "^2.31.0",
|
|
33
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
34
|
+
"eslint-plugin-react": "^7.37.4",
|
|
27
35
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
28
36
|
"eslint-plugin-react-refresh": "^0.4.16",
|
|
29
37
|
"eslint-plugin-storybook": "^0.11.2",
|
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import { fn } from
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { fn } from "@storybook/test"
|
|
3
3
|
|
|
4
|
-
import { Button } from
|
|
4
|
+
import { Button } from "@/components/Button"
|
|
5
5
|
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
7
6
|
const meta = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} satisfies Meta<typeof Button
|
|
23
|
-
|
|
24
|
-
export default meta
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
title: "Example/Button",
|
|
8
|
+
component: Button,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered"
|
|
11
|
+
},
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
argTypes: {
|
|
14
|
+
backgroundColor: {
|
|
15
|
+
control: "color"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
onClick: fn()
|
|
20
|
+
}
|
|
21
|
+
} satisfies Meta<typeof Button>
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
|
|
28
27
|
export const Primary: Story = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
28
|
+
args: {
|
|
29
|
+
primary: true,
|
|
30
|
+
label: "Button"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
34
33
|
|
|
35
34
|
export const Secondary: Story = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
35
|
+
args: {
|
|
36
|
+
label: "Button"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
40
39
|
|
|
41
40
|
export const Large: Story = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
41
|
+
args: {
|
|
42
|
+
size: "large",
|
|
43
|
+
label: "Button"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
47
46
|
|
|
48
47
|
export const Small: Story = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
args: {
|
|
49
|
+
size: "small",
|
|
50
|
+
label: "Button"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react"
|
|
2
2
|
|
|
3
3
|
export interface ButtonProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
size?: 'small' | 'medium' | 'large';
|
|
10
|
-
/** Button contents */
|
|
11
|
-
label: string;
|
|
12
|
-
/** Optional click handler */
|
|
13
|
-
onClick?: () => void;
|
|
4
|
+
primary?: boolean
|
|
5
|
+
backgroundColor?: string
|
|
6
|
+
size?: "small" | "medium" | "large"
|
|
7
|
+
label: string
|
|
8
|
+
onClick?: () => void
|
|
14
9
|
}
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
11
|
+
export const Button = (props: ButtonProps) => {
|
|
12
|
+
const {
|
|
13
|
+
backgroundColor,
|
|
14
|
+
label,
|
|
15
|
+
size,
|
|
16
|
+
primary
|
|
17
|
+
} = props
|
|
18
|
+
|
|
19
|
+
const mode = primary ? "storybook-button--primary" : "storybook-button--secondary"
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
className={["storybook-button", `storybook-button--${size}`, mode].join("")}
|
|
24
|
+
style={{ backgroundColor }}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
{label}
|
|
28
|
+
</button>
|
|
29
|
+
)
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "@/components/Button"
|
package/tsconfig.app.json
CHANGED
package/tsconfig.build.json
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
"jsx": "react-jsx",
|
|
4
4
|
"target": "ES2022",
|
|
5
5
|
"esModuleInterop": true,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"module": "ESNext",
|
|
8
9
|
"sourceMap": true,
|
|
9
10
|
"declaration": true,
|
|
10
11
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
@@ -14,4 +15,4 @@
|
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
"include": ["src"]
|
|
17
|
-
}
|
|
18
|
+
}
|