@okam/next-component 0.0.1 → 0.1.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/.eslintrc.js +21 -0
- package/.storybook/main.ts +33 -0
- package/.storybook/preview.ts +0 -0
- package/CHANGELOG.md +16 -0
- package/images/image.png +0 -0
- package/package.json +1 -4
- package/project.json +75 -0
- package/src/components/Img/index.tsx +30 -0
- package/src/components/Img/interface.ts +9 -0
- package/src/index.ts +3 -0
- package/src/lib/hello-server.tsx +4 -0
- package/src/lib/next-component.tsx +16 -0
- package/src/server.ts +2 -0
- package/tsconfig.json +20 -0
- package/tsconfig.lib.json +29 -0
- package/tsconfig.storybook.json +31 -0
- package/index.esm.d.ts +0 -1
- package/index.esm.js +0 -3742
- package/src/components/Img/index.d.ts +0 -3
- package/src/components/Img/interface.d.ts +0 -6
- package/src/index.d.ts +0 -1
- package/src/lib/hello-server.d.ts +0 -1
- package/src/lib/next-component.d.ts +0 -4
- package/src/server.d.ts +0 -1
- /package/{index.esm.css → src/lib/next-component.module.css} +0 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const { getDefaultIgnorePatterns } = require("../../../linter/helpers");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ['plugin:@nx/react', '../../../.eslintrc.js', '../../../linter/bases/typescript', '../../../linter/bases/regexp', '../../../linter/bases/jest', '../../../linter/bases/rtl', '../../../linter/bases/storybook', '../../../linter/bases/react', '../../../linter/bases/prettier', 'plugin:storybook/recommended'],
|
|
5
|
+
ignorePatterns: ['!**/*', ...getDefaultIgnorePatterns()],
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
9
|
+
// We set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting
|
|
10
|
+
parserOptions: {
|
|
11
|
+
project: `${__dirname}/tsconfig.*?.json`,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
"@nx/dependency-checks": "error"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
rules: {
|
|
19
|
+
'react/react-in-jsx-scope': 'off',
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
import type { StorybookConfig } from '@storybook/nextjs'
|
|
3
|
+
|
|
4
|
+
const config: StorybookConfig = {
|
|
5
|
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
6
|
+
addons: [
|
|
7
|
+
'@storybook/addon-a11y',
|
|
8
|
+
'@storybook/addon-links',
|
|
9
|
+
'@storybook/addon-essentials',
|
|
10
|
+
'@storybook/addon-interactions',
|
|
11
|
+
{
|
|
12
|
+
name: '@storybook/addon-styling',
|
|
13
|
+
options: {
|
|
14
|
+
// Check out https://github.com/storybookjs/addon-styling/blob/main/docs/api.md
|
|
15
|
+
// For more details on this addon's options.
|
|
16
|
+
postCss: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
framework: {
|
|
21
|
+
name: '@storybook/nextjs',
|
|
22
|
+
options: {},
|
|
23
|
+
},
|
|
24
|
+
docs: {
|
|
25
|
+
autodocs: 'tag',
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default config
|
|
30
|
+
|
|
31
|
+
// To customize your Vite configuration you can use the viteFinal field.
|
|
32
|
+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
|
|
33
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
File without changes
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## 0.1.0 (2024-06-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🚀 Features
|
|
5
|
+
|
|
6
|
+
- add new libs ([#71](https://github.com/OKAMca/stack/pull/71))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 🩹 Fixes
|
|
10
|
+
|
|
11
|
+
- publishing for new libs ([#125](https://github.com/OKAMca/stack/pull/125))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ❤️ Thank You
|
|
15
|
+
|
|
16
|
+
- Marie-Maxime Tanguay @marie-maxime
|
package/images/image.png
ADDED
|
Binary file
|
package/package.json
CHANGED
package/project.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "next-component",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "libs/stack/next-component/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"lint": {
|
|
9
|
+
"executor": "@nx/eslint:lint"
|
|
10
|
+
},
|
|
11
|
+
"build": {
|
|
12
|
+
"executor": "@nx/rollup:rollup",
|
|
13
|
+
"outputs": ["{options.outputPath}"],
|
|
14
|
+
"options": {
|
|
15
|
+
"outputPath": "dist/libs/stack/next-component",
|
|
16
|
+
"tsConfig": "libs/stack/next-component/tsconfig.lib.json",
|
|
17
|
+
"project": "libs/stack/next-component/package.json",
|
|
18
|
+
"entryFile": "libs/stack/next-component/src/index.ts",
|
|
19
|
+
"external": "all",
|
|
20
|
+
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
|
21
|
+
"compiler": "swc",
|
|
22
|
+
"assets": [
|
|
23
|
+
{
|
|
24
|
+
"glob": "libs/stack/next-component/README.md",
|
|
25
|
+
"input": ".",
|
|
26
|
+
"output": "."
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"storybook": {
|
|
32
|
+
"executor": "@nx/storybook:storybook",
|
|
33
|
+
"options": {
|
|
34
|
+
"port": 4400,
|
|
35
|
+
"configDir": "libs/stack/next-component/.storybook"
|
|
36
|
+
},
|
|
37
|
+
"configurations": {
|
|
38
|
+
"ci": {
|
|
39
|
+
"quiet": true
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"build-storybook": {
|
|
44
|
+
"executor": "@nx/storybook:build",
|
|
45
|
+
"outputs": ["{options.outputDir}"],
|
|
46
|
+
"options": {
|
|
47
|
+
"outputDir": "dist/storybook/next-component",
|
|
48
|
+
"configDir": "libs/stack/next-component/.storybook"
|
|
49
|
+
},
|
|
50
|
+
"configurations": {
|
|
51
|
+
"ci": {
|
|
52
|
+
"quiet": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"test-storybook": {
|
|
57
|
+
"executor": "nx:run-commands",
|
|
58
|
+
"options": {
|
|
59
|
+
"command": "test-storybook -c libs/stack/next-component/.storybook --url=http://localhost:4400"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"static-storybook": {
|
|
63
|
+
"executor": "@nx/web:file-server",
|
|
64
|
+
"options": {
|
|
65
|
+
"buildTarget": "next-component:build-storybook",
|
|
66
|
+
"staticFilePath": "dist/storybook/next-component"
|
|
67
|
+
},
|
|
68
|
+
"configurations": {
|
|
69
|
+
"ci": {
|
|
70
|
+
"buildTarget": "next-component:build-storybook:ci"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useThemeContext } from '@okam/stack-ui'
|
|
2
|
+
import Image from 'next/image'
|
|
3
|
+
import type TImgProps from './interface'
|
|
4
|
+
|
|
5
|
+
const Img = (props: TImgProps) => {
|
|
6
|
+
const { src, width, height, themeName = 'img', tokens, customTheme, ...rest } = props
|
|
7
|
+
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
8
|
+
|
|
9
|
+
if (typeof src === 'object') {
|
|
10
|
+
const { blurWidth, blurHeight, width: srcWidth, height: srcHeight, ...withoutBlurDimensions } = src
|
|
11
|
+
const blur = {
|
|
12
|
+
blurwidth: blurWidth,
|
|
13
|
+
blurheight: blurHeight,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Image
|
|
18
|
+
className={theme}
|
|
19
|
+
{...withoutBlurDimensions}
|
|
20
|
+
{...rest}
|
|
21
|
+
{...blur}
|
|
22
|
+
width={srcWidth ?? width}
|
|
23
|
+
height={srcHeight ?? height}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
return <Image width={width} height={height} className={theme} src={src} {...rest} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default Img
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import styles from './next-component.module.css'
|
|
4
|
+
|
|
5
|
+
/* eslint-disable-next-line */
|
|
6
|
+
export interface NextComponentProps {}
|
|
7
|
+
|
|
8
|
+
export function NextComponent(props: NextComponentProps) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.container}>
|
|
11
|
+
<h1>Hello Client Component!</h1>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default NextComponent
|
package/src/server.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"allowJs": false,
|
|
5
|
+
"esModuleInterop": false,
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"strict": true
|
|
8
|
+
},
|
|
9
|
+
"files": [],
|
|
10
|
+
"include": [],
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"path": "./tsconfig.lib.json"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "./tsconfig.storybook.json"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"extends": "../../../tsconfig.base.json"
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
8
|
+
"@nx/react/typings/image.d.ts",
|
|
9
|
+
"next",
|
|
10
|
+
"@nx/next/typings/image.d.ts"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"exclude": [
|
|
14
|
+
"jest.config.ts",
|
|
15
|
+
"src/**/*.spec.ts",
|
|
16
|
+
"src/**/*.test.ts",
|
|
17
|
+
"src/**/*.spec.tsx",
|
|
18
|
+
"src/**/*.test.tsx",
|
|
19
|
+
"src/**/*.spec.js",
|
|
20
|
+
"src/**/*.test.js",
|
|
21
|
+
"src/**/*.spec.jsx",
|
|
22
|
+
"src/**/*.test.jsx",
|
|
23
|
+
"**/*.stories.ts",
|
|
24
|
+
"**/*.stories.js",
|
|
25
|
+
"**/*.stories.jsx",
|
|
26
|
+
"**/*.stories.tsx"
|
|
27
|
+
],
|
|
28
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"emitDecoratorMetadata": true,
|
|
5
|
+
"outDir": ""
|
|
6
|
+
},
|
|
7
|
+
"files": [
|
|
8
|
+
"../../../node_modules/@nx/react/typings/styled-jsx.d.ts",
|
|
9
|
+
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
10
|
+
"../../../node_modules/@nx/react/typings/image.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.test.ts",
|
|
15
|
+
"src/**/*.spec.js",
|
|
16
|
+
"src/**/*.test.js",
|
|
17
|
+
"src/**/*.spec.tsx",
|
|
18
|
+
"src/**/*.test.tsx",
|
|
19
|
+
"src/**/*.spec.jsx",
|
|
20
|
+
"src/**/*.test.js"
|
|
21
|
+
],
|
|
22
|
+
"include": [
|
|
23
|
+
"src/**/*.stories.ts",
|
|
24
|
+
"src/**/*.stories.js",
|
|
25
|
+
"src/**/*.stories.jsx",
|
|
26
|
+
"src/**/*.stories.tsx",
|
|
27
|
+
"src/**/*.stories.mdx",
|
|
28
|
+
".storybook/*.js",
|
|
29
|
+
".storybook/*.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
package/index.esm.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/index";
|