@patternfly/react-styles 6.0.0-alpha.24 → 6.0.0-alpha.26
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/css/assets/images/pf-background.svg +21 -21
- package/css/components/ActionList/action-list.css +4 -4
- package/css/components/Alert/alert-group.css +2 -1
- package/css/components/Banner/banner.css +10 -10
- package/css/components/Banner/banner.d.ts +2 -2
- package/css/components/Banner/banner.js +2 -2
- package/css/components/Banner/banner.mjs +2 -2
- package/css/components/Brand/brand.css +4 -1
- package/css/components/CalendarMonth/calendar-month.css +1 -1
- package/css/components/Card/card.css +11 -1
- package/css/components/Label/label.css +34 -34
- package/css/components/Label/label.d.ts +2 -2
- package/css/components/Label/label.js +2 -2
- package/css/components/Label/label.mjs +2 -2
- package/css/components/List/list.css +4 -1
- package/css/components/LogViewer/log-viewer.css +4 -1
- package/css/components/Menu/menu.css +11 -0
- package/css/components/MenuToggle/menu-toggle.css +7 -0
- package/css/components/Pagination/pagination.css +6 -3
- package/css/components/Popover/popover.css +4 -1
- package/css/components/Table/table-grid.css +1 -1
- package/css/components/Table/table.css +10 -3
- package/css/components/TextInputGroup/text-input-group.css +20 -18
- package/css/components/Truncate/truncate.css +1 -1
- package/css/components/_index.css +134 -81
- package/css/components/_index.d.ts +2 -2
- package/css/components/_index.js +2 -2
- package/css/components/_index.mjs +2 -2
- package/css/docs/components/TextInputGroup/examples/TextInputGroup.css +4 -0
- package/css/docs/components/Truncate/examples/Truncate.css +0 -1
- package/package.json +6 -9
- package/scripts/copyStyles.mjs +8 -0
- package/scripts/{generateClassMaps.js → generateClassMaps.mjs} +8 -11
- package/scripts/{writeClassMaps.js → writeClassMaps.mjs} +15 -13
- package/css/docs/components/Pagination/examples/Pagination.css +0 -3
- package/css/docs/components/Pagination/examples/Pagination.d.ts +0 -3
- package/css/docs/components/Pagination/examples/Pagination.js +0 -4
- package/css/docs/components/Pagination/examples/Pagination.mjs +0 -2
- package/scripts/copyStyles.js +0 -7
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import { camelCase } from 'change-case';
|
2
|
+
import { glob } from 'glob';
|
3
|
+
import fs from 'node:fs';
|
4
|
+
import path from 'node:path';
|
5
|
+
import url from 'node:url';
|
5
6
|
|
6
7
|
/**
|
7
8
|
* @param {string} cssString - CSS string
|
@@ -14,7 +15,7 @@ function getCSSClasses(cssString) {
|
|
14
15
|
* @param {string} className - Class name
|
15
16
|
*/
|
16
17
|
function formatClassName(className) {
|
17
|
-
return
|
18
|
+
return camelCase(className.replace(/pf-(v6-)?((c|l|m|u|is|has)-)?/g, ''));
|
18
19
|
}
|
19
20
|
|
20
21
|
/**
|
@@ -53,8 +54,8 @@ function getClassMaps(cssString) {
|
|
53
54
|
/**
|
54
55
|
* @returns {any} Map of file names to classMaps
|
55
56
|
*/
|
56
|
-
function generateClassMaps() {
|
57
|
-
const pfStylesDir = path.dirname(
|
57
|
+
export function generateClassMaps() {
|
58
|
+
const pfStylesDir = path.dirname(url.fileURLToPath(import.meta.resolve('@patternfly/patternfly/patternfly.css')));
|
58
59
|
|
59
60
|
const patternflyCSSFiles = glob.sync('**/*.css', {
|
60
61
|
cwd: pfStylesDir,
|
@@ -73,7 +74,3 @@ function generateClassMaps() {
|
|
73
74
|
|
74
75
|
return res;
|
75
76
|
}
|
76
|
-
|
77
|
-
module.exports = {
|
78
|
-
generateClassMaps
|
79
|
-
};
|
@@ -1,34 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { outputFileSync } from 'fs-extra/esm';
|
2
|
+
import fs from 'node:fs';
|
3
|
+
import path from 'node:path';
|
4
|
+
import url from 'node:url';
|
5
|
+
import { generateClassMaps } from './generateClassMaps.mjs';
|
4
6
|
|
5
|
-
const outDir = resolve(
|
7
|
+
const outDir = path.resolve(import.meta.dirname, '../css');
|
6
8
|
|
7
9
|
const writeCJSExport = (file, classMap) =>
|
8
10
|
outputFileSync(
|
9
|
-
join(outDir, file.replace(/.css$/, '.js')),
|
11
|
+
path.join(outDir, file.replace(/.css$/, '.js')),
|
10
12
|
`
|
11
13
|
"use strict";
|
12
14
|
exports.__esModule = true;
|
13
|
-
require('./${basename(file, '.css.js')}');
|
15
|
+
require('./${path.basename(file, '.css.js')}');
|
14
16
|
exports.default = ${JSON.stringify(classMap, null, 2)};
|
15
17
|
`.trim()
|
16
18
|
);
|
17
19
|
|
18
20
|
const writeESMExport = (file, classMap) =>
|
19
21
|
outputFileSync(
|
20
|
-
join(outDir, file.replace(/.css$/, '.mjs')),
|
22
|
+
path.join(outDir, file.replace(/.css$/, '.mjs')),
|
21
23
|
`
|
22
|
-
import './${basename(file, '.css.js')}';
|
24
|
+
import './${path.basename(file, '.css.js')}';
|
23
25
|
export default ${JSON.stringify(classMap, null, 2)};
|
24
26
|
`.trim()
|
25
27
|
);
|
26
28
|
|
27
29
|
const writeDTSExport = (file, classMap) =>
|
28
30
|
outputFileSync(
|
29
|
-
join(outDir, file.replace(/.css$/, '.d.ts')),
|
31
|
+
path.join(outDir, file.replace(/.css$/, '.d.ts')),
|
30
32
|
`
|
31
|
-
import './${basename(file, '.css.js')}';
|
33
|
+
import './${path.basename(file, '.css.js')}';
|
32
34
|
declare const _default: ${JSON.stringify(classMap, null, 2)};
|
33
35
|
export default _default;
|
34
36
|
`.trim()
|
@@ -38,15 +40,15 @@ export default _default;
|
|
38
40
|
* @param {any} classMaps Map of file names to classMaps
|
39
41
|
*/
|
40
42
|
function writeClassMaps(classMaps) {
|
41
|
-
const pfStylesDir = dirname(
|
43
|
+
const pfStylesDir = path.dirname(url.fileURLToPath(import.meta.resolve('@patternfly/patternfly/patternfly.css')));
|
42
44
|
|
43
45
|
Object.entries(classMaps).forEach(([file, classMap]) => {
|
44
|
-
const outPath = file.includes(pfStylesDir) ? relative(pfStylesDir, file) : relative('src/css', file);
|
46
|
+
const outPath = file.includes(pfStylesDir) ? path.relative(pfStylesDir, file) : path.relative('src/css', file);
|
45
47
|
|
46
48
|
writeCJSExport(outPath, classMap);
|
47
49
|
writeDTSExport(outPath, classMap);
|
48
50
|
writeESMExport(outPath, classMap);
|
49
|
-
copyFileSync(file, join(outDir, outPath));
|
51
|
+
fs.copyFileSync(file, path.join(outDir, outPath));
|
50
52
|
});
|
51
53
|
|
52
54
|
// eslint-disable-next-line no-console
|
package/scripts/copyStyles.js
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
const { copySync } = require('fs-extra');
|
2
|
-
const { resolve, dirname, join } = require('path');
|
3
|
-
|
4
|
-
const toDir = resolve(__dirname, '../css');
|
5
|
-
const fromDir = dirname(require.resolve('@patternfly/patternfly/package.json'));
|
6
|
-
|
7
|
-
copySync(join(fromDir, 'assets/images'), join(toDir, 'assets/images'));
|