letalkui 0.0.0
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/.github/workflows/publish.yml +26 -0
- package/.storybook/main.ts +13 -0
- package/.storybook/preview.ts +14 -0
- package/README.md +1 -0
- package/eslint.config.js +28 -0
- package/index.html +13 -0
- package/package.json +45 -0
- package/src/components/Button/Button.stories.ts +53 -0
- package/src/components/Button/index.tsx +35 -0
- package/src/index.ts +1 -0
- package/tsconfig.app.json +30 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +24 -0
- package/tsup.config.ts +12 -0
- package/vite.config.ts +13 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish Package to npmjs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Release
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout
|
|
12
|
+
uses: actions/checkout@v3
|
|
13
|
+
|
|
14
|
+
- name: Setup Node.js
|
|
15
|
+
uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: "18.20.3"
|
|
18
|
+
registry-url: 'https://registry.npmjs.org'
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: npm i -f
|
|
22
|
+
|
|
23
|
+
- name: Publish to NPM
|
|
24
|
+
run: npm publish --provenance --access public
|
|
25
|
+
env:
|
|
26
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ["../src/**/*.mdx", "../src/components/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
5
|
+
addons: [
|
|
6
|
+
"@storybook/addon-essentials"
|
|
7
|
+
],
|
|
8
|
+
framework: {
|
|
9
|
+
name: "@storybook/react-vite",
|
|
10
|
+
options: {},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export default config;
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# letalk-ui
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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 tseslint from 'typescript-eslint'
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
{ ignores: ['dist'] },
|
|
9
|
+
{
|
|
10
|
+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
globals: globals.browser,
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
'react-hooks': reactHooks,
|
|
18
|
+
'react-refresh': reactRefresh,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...reactHooks.configs.recommended.rules,
|
|
22
|
+
'react-refresh/only-export-components': [
|
|
23
|
+
'warn',
|
|
24
|
+
{ allowConstantExport: true },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
)
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "letalkui",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"lint": "eslint .",
|
|
7
|
+
"dev": "storybook dev -p 6006",
|
|
8
|
+
"build": "tsup",
|
|
9
|
+
"build:storybook": "storybook build"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"react": "^18.3.1",
|
|
13
|
+
"react-dom": "^18.3.1"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@eslint/js": "^9.17.0",
|
|
17
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
18
|
+
"@storybook/blocks": "^8.4.7",
|
|
19
|
+
"@storybook/react": "^8.4.7",
|
|
20
|
+
"@storybook/react-vite": "^8.4.7",
|
|
21
|
+
"@storybook/test": "^8.4.7",
|
|
22
|
+
"@types/node": "18.19",
|
|
23
|
+
"@types/react": "^18.3.18",
|
|
24
|
+
"@types/react-dom": "^18.3.5",
|
|
25
|
+
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
26
|
+
"eslint": "^9.17.0",
|
|
27
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
28
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
29
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
30
|
+
"globals": "^15.14.0",
|
|
31
|
+
"storybook": "^8.4.7",
|
|
32
|
+
"tsup": "^8.3.5",
|
|
33
|
+
"typescript": "~5.6.2",
|
|
34
|
+
"typescript-eslint": "^8.18.2",
|
|
35
|
+
"vite": "^6.0.5"
|
|
36
|
+
},
|
|
37
|
+
"eslintConfig": {
|
|
38
|
+
"extends": [
|
|
39
|
+
"plugin:storybook/recommended"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": "18.20.3"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import { Button } from '.';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Example/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
parameters: {
|
|
11
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
17
|
+
argTypes: {
|
|
18
|
+
backgroundColor: { control: 'color' },
|
|
19
|
+
},
|
|
20
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
21
|
+
args: { onClick: fn() },
|
|
22
|
+
} satisfies Meta<typeof Button>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
28
|
+
export const Primary: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
primary: true,
|
|
31
|
+
label: 'Button',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Secondary: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
label: 'Button',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Large: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
size: 'large',
|
|
44
|
+
label: 'Button',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Small: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
size: 'small',
|
|
51
|
+
label: 'Button',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
/** Is this the principal call to action on the page? */
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
/** What background color to use */
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
/** How large should the button be? */
|
|
9
|
+
size?: 'small' | 'medium' | 'large';
|
|
10
|
+
/** Button contents */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Optional click handler */
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Primary UI component for user interaction */
|
|
17
|
+
export const Button = ({
|
|
18
|
+
primary = false,
|
|
19
|
+
size = 'medium',
|
|
20
|
+
backgroundColor,
|
|
21
|
+
label,
|
|
22
|
+
...props
|
|
23
|
+
}: ButtonProps) => {
|
|
24
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
25
|
+
return (
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
29
|
+
style={{ backgroundColor }}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
{label}
|
|
33
|
+
</button>
|
|
34
|
+
);
|
|
35
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components/Button"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
|
|
18
|
+
/* Linting */
|
|
19
|
+
"strict": true,
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true,
|
|
24
|
+
"baseUrl": ".",
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": ["src/*"]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"include": ["src"]
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"module": "NodeNext",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
11
|
+
"baseUrl": ".",
|
|
12
|
+
"paths": {
|
|
13
|
+
"@/*": ["src/*"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"]
|
|
17
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedSideEffectImports": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["vite.config.ts"]
|
|
24
|
+
}
|
package/tsup.config.ts
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react-swc'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
|
|
5
|
+
// https://vite.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
"@": path.resolve(__dirname, "./src")
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
})
|