@scality/core-ui 0.206.0 → 0.208.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/github-pages.yml +2 -0
- package/.github/workflows/post-release.yml +3 -11
- package/dist/components/icon/Icon.component.d.ts +3 -3
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +6 -3
- package/jest.config.js +5 -0
- package/package.json +2 -3
- package/src/lib/components/icon/Icon.component.tsx +11 -8
- package/src/lib/valalint/index.mjs +49 -0
- package/src/lib/valalint/rules/modal-button-forbidden-label.test.js +1 -1
- package/src/lib/valalint/rules/no-raw-number-in-jsx.test.js +1 -1
- package/src/lib/valalint/rules/technical-sentence-case.test.js +1 -1
- package/src/lib/valalint/index.js +0 -49
- /package/src/lib/valalint/rules/{modal-button-forbidden-label.js → modal-button-forbidden-label.mjs} +0 -0
- /package/src/lib/valalint/rules/{no-raw-number-in-jsx.js → no-raw-number-in-jsx.mjs} +0 -0
- /package/src/lib/valalint/rules/{technical-sentence-case.js → technical-sentence-case.mjs} +0 -0
|
@@ -14,6 +14,8 @@ jobs:
|
|
|
14
14
|
with:
|
|
15
15
|
node-version: 20
|
|
16
16
|
- run: npm ci
|
|
17
|
+
- name: Configure git credentials
|
|
18
|
+
run: git config --global url."https://x-access-token:${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
17
19
|
- run: npm run storybook:deploy
|
|
18
20
|
env:
|
|
19
21
|
STORYBOOK_DISABLE_TELEMETRY: 1
|
|
@@ -39,19 +39,11 @@ jobs:
|
|
|
39
39
|
body: ''
|
|
40
40
|
});
|
|
41
41
|
core.setOutput('pull-request-number', String(pr.data.number));
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
with:
|
|
45
|
-
script: |
|
|
46
|
-
github.rest.issues.createComment({
|
|
47
|
-
issue_number: '${{ steps.cpr.outputs.pull-request-number }}',
|
|
48
|
-
owner: context.repo.owner,
|
|
49
|
-
repo: context.repo.repo,
|
|
50
|
-
body: '/approve'
|
|
51
|
-
})
|
|
52
|
-
- uses: actions/github-script@v5
|
|
42
|
+
- name: Merge Pull Request
|
|
43
|
+
uses: actions/github-script@v5
|
|
53
44
|
if: ${{ steps.cpr.outputs.pull-request-number }}
|
|
54
45
|
with:
|
|
46
|
+
github-token: ${{ secrets.GIT_ACCESS_TOKEN }}
|
|
55
47
|
script: |
|
|
56
48
|
await github.rest.pulls.merge({
|
|
57
49
|
owner: context.repo.owner,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
-
import { CSSProperties } from 'react';
|
|
3
|
-
import { CoreUITheme } from '../../style/theme';
|
|
1
|
+
import type { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { type CSSProperties } from 'react';
|
|
3
|
+
import type { CoreUITheme } from '../../style/theme';
|
|
4
4
|
import { iconTable } from './iconTable';
|
|
5
5
|
type IconProps = {
|
|
6
6
|
'aria-label'?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,KAAK,SAAS,GAAG;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAC9B,MAAM,EACN,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAc/D,CAAC;AAkBF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,WAAW,CAAC;AACzE,MAAM,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC;AAC1C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAiBF,eAAO,MAAM,WAAW;UAAsB,QAAQ;SAiCrD,CAAC;AAsEF,iBAAS,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,2CAU7C;AAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -60,8 +60,8 @@ export const IconWrapper = styled.div `
|
|
|
60
60
|
height: 1.5rem;
|
|
61
61
|
`
|
|
62
62
|
: `
|
|
63
|
-
width: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
64
|
-
height: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
63
|
+
width: ${parseInt(props.size.replace('x', ''), 10) * 2}rem;
|
|
64
|
+
height: ${parseInt(props.size.replace('x', ''), 10) * 2}rem;
|
|
65
65
|
`}
|
|
66
66
|
`;
|
|
67
67
|
}}
|
|
@@ -92,9 +92,12 @@ function NonWrappedIcon({ name, size = '1x', color, ariaLabel, title, ...rest })
|
|
|
92
92
|
// Handle FontAwesome icons with dynamic import
|
|
93
93
|
import(
|
|
94
94
|
/* webpackExclude: /import\.macro\.js$/ */
|
|
95
|
-
|
|
95
|
+
/* webpackInclude: /\.js$/ */
|
|
96
|
+
`@fortawesome/${fontAwesomeType}/${iconClass}`).then((module) => {
|
|
96
97
|
setIcon(module[iconClass]);
|
|
97
98
|
iconCache[cacheKey] = module[iconClass];
|
|
99
|
+
}).catch((err) => {
|
|
100
|
+
console.warn(`Icon ${iconClass} could not be loaded:`, err.message);
|
|
98
101
|
});
|
|
99
102
|
return () => setIcon(undefined);
|
|
100
103
|
}, [name, iconInfo]);
|
package/jest.config.js
CHANGED
|
@@ -10,5 +10,10 @@ export default {
|
|
|
10
10
|
'^@fortawesome/free-regular-svg-icons/(.+)\\.js$':
|
|
11
11
|
'@fortawesome/free-regular-svg-icons/$1',
|
|
12
12
|
},
|
|
13
|
+
// Transform both .js and .mjs files with Babel
|
|
14
|
+
transform: {
|
|
15
|
+
'^.+\\.(js|jsx|mjs)$': 'babel-jest',
|
|
16
|
+
'^.+\\.(ts|tsx)$': 'babel-jest',
|
|
17
|
+
},
|
|
13
18
|
testEnvironment: 'jsdom',
|
|
14
19
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scality/core-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.208.0",
|
|
4
4
|
"description": "Scality common React component library",
|
|
5
5
|
"author": "Scality Engineering",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
-
"type": "module",
|
|
9
8
|
"types": "dist/index.d.ts",
|
|
10
9
|
"mainSrc": "src/lib/index.js",
|
|
11
10
|
"exports": {
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
"require": "./dist/index.js",
|
|
15
14
|
"types": "./dist/index.d.ts"
|
|
16
15
|
},
|
|
17
|
-
"./eslint-plugin": "./src/lib/valalint/index.
|
|
16
|
+
"./eslint-plugin": "./src/lib/valalint/index.mjs",
|
|
18
17
|
"./dist/*.css": "./dist/*.css",
|
|
19
18
|
"./dist/*": "./dist/*"
|
|
20
19
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
1
|
+
import type { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
3
|
import {
|
|
4
|
-
CSSProperties,
|
|
5
|
-
HTMLProps,
|
|
6
|
-
PropsWithChildren,
|
|
4
|
+
type CSSProperties,
|
|
5
|
+
type HTMLProps,
|
|
6
|
+
type PropsWithChildren,
|
|
7
7
|
useEffect,
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react';
|
|
10
10
|
import styled, { css } from 'styled-components';
|
|
11
|
-
import { CoreUITheme } from '../../style/theme';
|
|
11
|
+
import type { CoreUITheme } from '../../style/theme';
|
|
12
12
|
import { Loader } from '../loader/Loader.component';
|
|
13
13
|
import { Bucket, Buckets, RemoteGroup, RemoteUser } from './CustomsIcons';
|
|
14
14
|
import { iconTable } from './iconTable';
|
|
@@ -114,8 +114,8 @@ export const IconWrapper = styled.div<{ size: SizeProp }>`
|
|
|
114
114
|
height: 1.5rem;
|
|
115
115
|
`
|
|
116
116
|
: `
|
|
117
|
-
width: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
118
|
-
height: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
117
|
+
width: ${parseInt(props.size.replace('x', ''), 10) * 2}rem;
|
|
118
|
+
height: ${parseInt(props.size.replace('x', ''), 10) * 2}rem;
|
|
119
119
|
`}
|
|
120
120
|
`;
|
|
121
121
|
}}
|
|
@@ -157,9 +157,12 @@ function NonWrappedIcon({
|
|
|
157
157
|
// Handle FontAwesome icons with dynamic import
|
|
158
158
|
import(
|
|
159
159
|
/* webpackExclude: /import\.macro\.js$/ */
|
|
160
|
-
|
|
160
|
+
/* webpackInclude: /\.js$/ */
|
|
161
|
+
`@fortawesome/${fontAwesomeType}/${iconClass}`).then((module) => {
|
|
161
162
|
setIcon(module[iconClass]);
|
|
162
163
|
iconCache[cacheKey] = module[iconClass];
|
|
164
|
+
}).catch((err) => {
|
|
165
|
+
console.warn(`Icon ${iconClass} could not be loaded:`, err.message);
|
|
163
166
|
});
|
|
164
167
|
return () => setIcon(undefined);
|
|
165
168
|
}, [name, iconInfo]);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import tsParser from "@typescript-eslint/parser";
|
|
2
|
+
import modalButtonForbiddenLabel from "./rules/modal-button-forbidden-label.mjs";
|
|
3
|
+
import noRawNumberInJsx from "./rules/no-raw-number-in-jsx.mjs";
|
|
4
|
+
import technicalSentenceCase from "./rules/technical-sentence-case.mjs";
|
|
5
|
+
|
|
6
|
+
const rules = {
|
|
7
|
+
"technical-sentence-case": technicalSentenceCase,
|
|
8
|
+
"modal-button-forbidden-label": modalButtonForbiddenLabel,
|
|
9
|
+
"no-raw-number-in-jsx": noRawNumberInJsx,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** Default rule severity for the recommended config. */
|
|
13
|
+
const recommendedRules = {
|
|
14
|
+
"valalint/technical-sentence-case": "warn",
|
|
15
|
+
"valalint/modal-button-forbidden-label": "warn",
|
|
16
|
+
"valalint/no-raw-number-in-jsx": "warn",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const plugin = {
|
|
20
|
+
meta: {
|
|
21
|
+
name: "valalint",
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
rules,
|
|
26
|
+
configs: {
|
|
27
|
+
/** Legacy eslintrc-style recommended config. */
|
|
28
|
+
recommended: {
|
|
29
|
+
plugins: ["valalint"],
|
|
30
|
+
rules: recommendedRules,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
plugin.configs["flat/recommended"] = {
|
|
36
|
+
plugins: { valalint: plugin },
|
|
37
|
+
rules: recommendedRules,
|
|
38
|
+
languageOptions: {
|
|
39
|
+
parser: tsParser,
|
|
40
|
+
parserOptions: {
|
|
41
|
+
ecmaFeatures: {
|
|
42
|
+
jsx: true,
|
|
43
|
+
},
|
|
44
|
+
project: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default plugin;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jest-environment node
|
|
3
3
|
*/
|
|
4
4
|
import { RuleTester } from '@typescript-eslint/rule-tester';
|
|
5
|
-
import rule from './no-raw-number-in-jsx.
|
|
5
|
+
import rule from './no-raw-number-in-jsx.mjs';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
|
|
8
8
|
// Jest runs from the project root, so process.cwd() is the workspace root
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import technicalSentenceCase from './rules/technical-sentence-case.js';
|
|
3
|
-
import modalButtonForbiddenLabel from './rules/modal-button-forbidden-label.js';
|
|
4
|
-
import noRawNumberInJsx from './rules/no-raw-number-in-jsx.js';
|
|
5
|
-
|
|
6
|
-
const rules = {
|
|
7
|
-
'technical-sentence-case': technicalSentenceCase,
|
|
8
|
-
'modal-button-forbidden-label': modalButtonForbiddenLabel,
|
|
9
|
-
'no-raw-number-in-jsx': noRawNumberInJsx,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/** Default rule severity for the recommended config. */
|
|
13
|
-
const recommendedRules = {
|
|
14
|
-
'valalint/technical-sentence-case': 'warn',
|
|
15
|
-
'valalint/modal-button-forbidden-label': 'warn',
|
|
16
|
-
'valalint/no-raw-number-in-jsx': 'warn',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const plugin = {
|
|
20
|
-
meta: {
|
|
21
|
-
name: 'valalint',
|
|
22
|
-
version: '1.0.0',
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
rules,
|
|
26
|
-
configs: {
|
|
27
|
-
/** Legacy eslintrc-style recommended config. */
|
|
28
|
-
recommended: {
|
|
29
|
-
plugins: ['valalint'],
|
|
30
|
-
rules: recommendedRules,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
plugin.configs['flat/recommended'] = {
|
|
36
|
-
plugins: { valalint: plugin },
|
|
37
|
-
rules: recommendedRules,
|
|
38
|
-
languageOptions: {
|
|
39
|
-
parser: tsParser,
|
|
40
|
-
parserOptions: {
|
|
41
|
-
ecmaFeatures: {
|
|
42
|
-
jsx: true,
|
|
43
|
-
},
|
|
44
|
-
project: true,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default plugin;
|
/package/src/lib/valalint/rules/{modal-button-forbidden-label.js → modal-button-forbidden-label.mjs}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|