jamespot-react-components 1.3.67 → 1.3.69
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/LICENSE +21 -0
- package/dist/jamespot-react-components.cjs +1141 -1017
- package/dist/jamespot-react-components.js +13412 -12794
- package/dist/src/components/Common/SkipToContent.d.ts +1 -1
- package/dist/src/components/Drives/MicrosoftGraph/MSGraphGroups.d.ts +1 -1
- package/dist/src/components/Drives/components/EntityItem.d.ts +2 -2
- package/dist/src/components/Drives/drive.style.d.ts +3 -3
- package/dist/src/components/Editors/components/Editor.style.d.ts +7 -7
- package/dist/src/components/Editors/components/EditorInput.d.ts +2 -1
- package/dist/src/components/Editors/components/EditorInputNumber.d.ts +3 -1
- package/dist/src/components/Form/Input/Common/JRCFormFieldRenderer.d.ts +1 -1
- package/dist/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.d.ts +2 -2
- package/dist/src/components/Form/Input/JRCInputCheckbox/components/CheckboxOrToggle.d.ts +2 -2
- package/dist/src/components/Form/Input/JRCInputColor/JRCInputColor.styles.d.ts +4 -4
- package/dist/src/components/Form/Input/JRCInputColor/JRCInputColorRaw.d.ts +5 -1
- package/dist/src/components/Form/Input/JRCInputDateTime/DayPickerStyle.d.ts +1 -1
- package/dist/src/components/Form/Input/JRCInputFileAdvanced/File.styles.d.ts +4 -4
- package/dist/src/components/Form/Input/JRCInputImage/JRCInputImage.styles.d.ts +8 -8
- package/dist/src/components/Form/Input/JRCInputImage/types.d.ts +1 -0
- package/dist/src/components/Form/Input/JRCInputText/JRCInputText.style.d.ts +5 -5
- package/dist/src/components/Form/Input/JRCInputTextRaw/JRCInputTextRaw.style.d.ts +4 -4
- package/dist/src/components/Form/Input/JRCSelect/JRCInputSelect.style.d.ts +23 -23
- package/dist/src/components/Form/Input/JRCStyledInput.d.ts +1 -1
- package/dist/src/components/JRCAlbum/styles.d.ts +11 -11
- package/dist/src/components/JRCAppHeader/JRCAppHeader.styles.d.ts +2 -2
- package/dist/src/components/JRCAppLeftColumn/JRCAppLeftColumn.styles.d.ts +14 -14
- package/dist/src/components/JRCButton/Button.d.ts +1 -1
- package/dist/src/components/JRCButtonDropdown/JRCButtonDropdown.d.ts +1 -1
- package/dist/src/components/JRCButtonDropdown/JRCButtonDropdown.styles.d.ts +3 -3
- package/dist/src/components/JRCCalendar/CalendarStyle.d.ts +1 -1
- package/dist/src/components/JRCCard/JRCCardImg.d.ts +1 -1
- package/dist/src/components/JRCCommentsBloc/AvatarWrapper.d.ts +1 -1
- package/dist/src/components/JRCDragNDrop/OneLevelStyles.d.ts +9 -9
- package/dist/src/components/JRCDragNDrop/styles.d.ts +25 -25
- package/dist/src/components/JRCFileViewer/JRCFileViewer.styles.d.ts +15 -15
- package/dist/src/components/JRCFlex/JRCFlexBox.d.ts +1 -1
- package/dist/src/components/JRCFolders/styles.d.ts +15 -15
- package/dist/src/components/JRCGifSelector/JRCGifSelector.d.ts +1 -1
- package/dist/src/components/JRCList/JRCList.styles.d.ts +7 -7
- package/dist/src/components/JRCModal/JRCModal.styles.d.ts +10 -10
- package/dist/src/components/JRCModalImg/JRCModalImg.styles.d.ts +7 -7
- package/dist/src/components/JRCModalUserList/CSSAvatarWrapper.d.ts +1 -1
- package/dist/src/components/JRCSidePanelModal/JRCSidePanelModal.styles.d.ts +5 -5
- package/dist/src/components/JRCSkeleton/JRCSkeletonSquare.d.ts +1 -1
- package/dist/src/components/JRCTabs/JRCTabs.d.ts +1 -1
- package/dist/src/components/JRCTypo/JRCTypo.d.ts +6 -6
- package/dist/src/components/JRCTypography/JRCTypography.styles.d.ts +1 -1
- package/dist/src/components/Stepper/JRCStepper.style.d.ts +2 -2
- package/dist/src/components/Templates/AppColumn.d.ts +1 -1
- package/dist/src/components/Templates/MainColumn.d.ts +1 -1
- package/dist/src/components/Templates/template.styles.d.ts +20 -20
- package/dist/src/components/Widgets/JRCWidgetAttachment/JRCWidgetAttachment.d.ts +1 -1
- package/dist/src/components/Widgets/JRCWidgetCalendarCalDav/styles.d.ts +5 -5
- package/dist/src/components/Widgets/JRCWidgetContactCardDav/styles.d.ts +4 -4
- package/dist/src/components/Widgets/JRCWidgetCover/JRCWidgetCover.d.ts +26 -0
- package/dist/src/components/Widgets/JRCWidgetCover/JRCWidgetCoverEditor.d.ts +11 -0
- package/dist/src/components/Widgets/JRCWidgetEmailsImap/styles.d.ts +6 -6
- package/dist/src/components/Widgets/JRCWidgetImage/styles.d.ts +1 -1
- package/dist/src/components/Widgets/JRCWidgetPresence/JRCWidgetPresence.styles.d.ts +5 -5
- package/dist/src/components/Widgets/JRCWidgetQuickSurvey/JRCWidgetQuickSurveyEditor.styles.d.ts +5 -5
- package/dist/src/components/Widgets/JRCWidgetTable/JRCWidgetDatasourceTableEditor.styles.d.ts +9 -9
- package/dist/src/components/Widgets/JRCWidgetTable/JRCWidgetTable.styles.d.ts +13 -13
- package/dist/src/components/Widgets/WidgetPanelTplWarning.d.ts +1 -1
- package/dist/src/components/Widgets/const.d.ts +20 -9
- package/dist/src/components/Widgets/styles.d.ts +9 -9
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/translation/lang.json.d.ts +23 -12
- package/jamespot-react-components@1.3.14 +0 -0
- package/package.json +3 -4
- package/vite +0 -0
- package/eslint.config.js +0 -102
- package/scripts/generate.ts +0 -121
package/eslint.config.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import prettierConfig from 'eslint-config-prettier';
|
|
3
|
-
import importPlugin from 'eslint-plugin-import';
|
|
4
|
-
import reactPlugin from 'eslint-plugin-react';
|
|
5
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
6
|
-
import storybookPlugin from 'eslint-plugin-storybook';
|
|
7
|
-
import globals from 'globals';
|
|
8
|
-
import ts from 'typescript-eslint';
|
|
9
|
-
import * as customPlugin from './eslint-plugin-custom/index.js';
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
{
|
|
13
|
-
ignores: ['coverage/**', 'dist/**', 'eslint-plugin-custom/**', 'eslint.config.js', 'node_modules/**'],
|
|
14
|
-
},
|
|
15
|
-
js.configs.recommended,
|
|
16
|
-
...ts.configs.recommended,
|
|
17
|
-
{
|
|
18
|
-
files: ['**/*.{ts,tsx}'],
|
|
19
|
-
languageOptions: {
|
|
20
|
-
parser: ts.parser,
|
|
21
|
-
globals: {
|
|
22
|
-
...globals.browser,
|
|
23
|
-
...globals.node,
|
|
24
|
-
...globals.jest,
|
|
25
|
-
},
|
|
26
|
-
parserOptions: {
|
|
27
|
-
project: ['./tsconfig.json', './.storybook/tsconfig.json'],
|
|
28
|
-
ecmaVersion: 2024,
|
|
29
|
-
sourceType: 'module',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
plugins: {
|
|
33
|
-
'@typescript-eslint': ts.plugin,
|
|
34
|
-
react: reactPlugin,
|
|
35
|
-
'react-hooks': reactHooksPlugin,
|
|
36
|
-
storybook: storybookPlugin,
|
|
37
|
-
import: importPlugin,
|
|
38
|
-
custom: customPlugin,
|
|
39
|
-
},
|
|
40
|
-
rules: {
|
|
41
|
-
...ts.configs.recommended.rules,
|
|
42
|
-
...reactPlugin.configs.recommended.rules,
|
|
43
|
-
...reactHooksPlugin.configs.recommended.rules,
|
|
44
|
-
...storybookPlugin.configs.recommended.rules,
|
|
45
|
-
'custom/no-barrel-imports': 'error',
|
|
46
|
-
'import/no-duplicates': 'error',
|
|
47
|
-
'import/no-cycle': 'error',
|
|
48
|
-
'import/no-unresolved': 'error',
|
|
49
|
-
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
50
|
-
'no-restricted-imports': [
|
|
51
|
-
'error',
|
|
52
|
-
{
|
|
53
|
-
patterns: [
|
|
54
|
-
{
|
|
55
|
-
group: ['src/*'],
|
|
56
|
-
message: 'Use relative import (./ ou ../)',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
'react/react-in-jsx-scope': 'off',
|
|
62
|
-
'react-hooks/refs': 'warn',
|
|
63
|
-
'react-hooks/set-state-in-effect': 'warn',
|
|
64
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
65
|
-
'error',
|
|
66
|
-
{
|
|
67
|
-
'ts-ignore': 'allow-with-description',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
'@typescript-eslint/ban-types': 'off',
|
|
71
|
-
'@typescript-eslint/no-empty-interface': 'off',
|
|
72
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
73
|
-
'@typescript-eslint/no-empty-object-type': 'warn',
|
|
74
|
-
'@typescript-eslint/no-namespace': 'off',
|
|
75
|
-
'@typescript-eslint/no-unused-expressions': 'error',
|
|
76
|
-
'@typescript-eslint/no-unused-vars': [
|
|
77
|
-
'error',
|
|
78
|
-
{
|
|
79
|
-
argsIgnorePattern: '^_',
|
|
80
|
-
varsIgnorePattern: '^_',
|
|
81
|
-
caughtErrorsIgnorePattern: '^_',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
85
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
86
|
-
'@typescript-eslint/prefer-as-const': 'error',
|
|
87
|
-
},
|
|
88
|
-
settings: {
|
|
89
|
-
react: {
|
|
90
|
-
version: 'detect',
|
|
91
|
-
jsxRuntime: 'automatic',
|
|
92
|
-
},
|
|
93
|
-
'import/resolver': {
|
|
94
|
-
typescript: {
|
|
95
|
-
alwaysTryTypes: true,
|
|
96
|
-
project: './tsconfig.json',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
prettierConfig,
|
|
102
|
-
];
|
package/scripts/generate.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
// Lightweight arg parsing
|
|
6
|
-
const args = process.argv.slice(2);
|
|
7
|
-
if (args.length < 2) {
|
|
8
|
-
console.error('Usage: npx tsx generate.ts <stories> <path-to-component>');
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const mode = args[0];
|
|
13
|
-
const targetPath = args[1];
|
|
14
|
-
|
|
15
|
-
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
|
|
16
|
-
if (!OPENAI_API_KEY) {
|
|
17
|
-
console.error('Please set OPENAI_API_KEY in environment.');
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const MODEL = process.env.OPENAI_MODEL ?? 'gpt-4o-mini';
|
|
22
|
-
|
|
23
|
-
function readFileOrThrow(p: string) {
|
|
24
|
-
try {
|
|
25
|
-
return fs.readFileSync(p, 'utf8');
|
|
26
|
-
} catch (err) {
|
|
27
|
-
console.error(`Cannot read file ${p}`, err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function callOpenAI(prompt: string) {
|
|
33
|
-
const body = {
|
|
34
|
-
model: MODEL,
|
|
35
|
-
messages: [{ role: 'user', content: prompt }],
|
|
36
|
-
temperature: 0.0,
|
|
37
|
-
max_tokens: 2000,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const res = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
41
|
-
method: 'POST',
|
|
42
|
-
headers: {
|
|
43
|
-
'Content-Type': 'application/json',
|
|
44
|
-
Authorization: `Bearer ${OPENAI_API_KEY}`,
|
|
45
|
-
},
|
|
46
|
-
body: JSON.stringify(body),
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (!res.ok) {
|
|
50
|
-
const text = await res.text();
|
|
51
|
-
throw new Error(`OpenAI API error: ${res.status} ${text}`);
|
|
52
|
-
}
|
|
53
|
-
const json = await res.json();
|
|
54
|
-
return json.choices[0].message.content as string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function generateStoriesForComponent(componentFilePath: string, storiesFilePath?: string) {
|
|
58
|
-
const compText = readFileOrThrow(componentFilePath);
|
|
59
|
-
let prompt;
|
|
60
|
-
if (storiesFilePath && fs.existsSync(storiesFilePath)) {
|
|
61
|
-
const storiesText = readFileOrThrow(storiesFilePath);
|
|
62
|
-
prompt = `Tu es un assistant qui transforme des fichiers Storybook (.stories.tsx) et qui y ajoute des tests (play) pour un composant React.\n\n
|
|
63
|
-
Composant:\n\n
|
|
64
|
-
${compText}\n\n
|
|
65
|
-
Storybook Stories:\n\n
|
|
66
|
-
${storiesText}\n\n
|
|
67
|
-
Part du fichier de stories :\n
|
|
68
|
-
- Change les meta (pour rajouter le tags: ['testing'] et aussi changer le title basé sur le chemin avec comme prefix generate/),\n
|
|
69
|
-
- complete les stories s'il manque de la couverture de props clés,\n
|
|
70
|
-
- pour chaque story une fonction 'play' qui teste le comportement (getByRole/getByText, userEvent, expect),\n
|
|
71
|
-
- imports nécessaires (storybook/test, action, etc.),\n
|
|
72
|
-
- parameters: { mode: 'test' } pour les stories de test.\n\n
|
|
73
|
-
- le code/commentaire doivent être en anglais.\n\n
|
|
74
|
-
Fournis uniquement le contenu du fichier .stories.tsx sans explications sans zone de code "\`\`\`tsx" ton résultat doit pouvoir être sauvegarder dans le fichier directement sans transformation.`;
|
|
75
|
-
} else {
|
|
76
|
-
prompt = `Tu es un assistant qui génère des fichiers Storybook (.stories.tsx) avec tests (play) pour un composant React.\n\n
|
|
77
|
-
Composant:\n\n
|
|
78
|
-
${compText}\n\n
|
|
79
|
-
Génère un fichier .stories.tsx complet qui expose :\n
|
|
80
|
-
- un export default meta (title basé sur le chemin),\n
|
|
81
|
-
- au moins 2-4 stories pertinentes couvrant props clés (args),\n
|
|
82
|
-
- pour chaque story une fonction 'play' qui teste le comportement (getByRole/getByText, userEvent, expect),\n
|
|
83
|
-
- imports nécessaires (storybook/test, action, etc.),\n
|
|
84
|
-
- parameters: { mode: 'test' } pour les stories de test.\n\n
|
|
85
|
-
- le code/commentaire doivent être en anglais.\n\n
|
|
86
|
-
Fournis uniquement le contenu du fichier .stories.tsx sans explications sans zone de code "\`\`\`tsx" ton résultat doit pouvoir être sauvegarder dans le fichier directement sans transformation.`;
|
|
87
|
-
}
|
|
88
|
-
const storiesSampleText = readFileOrThrow('../src/components/JRCButton/JRCButton.stories.tsx');
|
|
89
|
-
prompt += `\n\n
|
|
90
|
-
Le fichier de stories doit être compatible avec Storybook 7.0 et React 18\n\n
|
|
91
|
-
Voici un exemple de fichier de stories qu'on souhaite:\n\n
|
|
92
|
-
${storiesSampleText}
|
|
93
|
-
`;
|
|
94
|
-
return await callOpenAI(prompt);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function modeStories(componentFilePath: string) {
|
|
98
|
-
const abs = path.resolve(componentFilePath);
|
|
99
|
-
const dir = path.dirname(abs);
|
|
100
|
-
const base = path.basename(abs).replace(/\.tsx?$/, '');
|
|
101
|
-
const storiesFilePath = path.join(dir, `${base}.stories.tsx`);
|
|
102
|
-
|
|
103
|
-
console.log('Generating .stories.tsx for', abs);
|
|
104
|
-
const storiesText = await generateStoriesForComponent(componentFilePath, storiesFilePath);
|
|
105
|
-
|
|
106
|
-
fs.writeFileSync(storiesFilePath, storiesText, 'utf8');
|
|
107
|
-
console.log(`Wrote story file to ${storiesFilePath}`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
(async () => {
|
|
111
|
-
try {
|
|
112
|
-
if (mode === 'stories') await modeStories(targetPath);
|
|
113
|
-
else {
|
|
114
|
-
console.error('Unknown mode. Use `stories`');
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
} catch (err: any) {
|
|
118
|
-
console.error('Error:', err.message ?? err);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
})();
|