@pega/custom-dx-components 0.0.1

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.
Files changed (71) hide show
  1. package/.eslintrc.json +18 -0
  2. package/.prettierignore +2 -0
  3. package/.prettierrc.json +1 -0
  4. package/.vscode/extensions.json +9 -0
  5. package/.vscode/settings.json +48 -0
  6. package/LICENSE +185 -0
  7. package/README.md +204 -0
  8. package/bin/index.js +5 -0
  9. package/cspell.json +26 -0
  10. package/package.json +67 -0
  11. package/src/cli.js +92 -0
  12. package/src/constants.js +92 -0
  13. package/src/tasks/authenticate/helper.js +60 -0
  14. package/src/tasks/authenticate/index.js +75 -0
  15. package/src/tasks/create/index.js +304 -0
  16. package/src/tasks/create/template/config.json.mustache +67 -0
  17. package/src/tasks/create/template/demo.stories.jsx.mustache +44 -0
  18. package/src/tasks/create/template/index.jsx.mustache +55 -0
  19. package/src/tasks/create/template/styles.js.mustache +7 -0
  20. package/src/tasks/delete/helper.js +105 -0
  21. package/src/tasks/delete/index.js +45 -0
  22. package/src/tasks/index.js +9 -0
  23. package/src/tasks/init/helper.js +63 -0
  24. package/src/tasks/init/index.js +165 -0
  25. package/src/tasks/init/template/.eslintrc.json +10 -0
  26. package/src/tasks/init/template/.prettierrc.json +1 -0
  27. package/src/tasks/init/template/.storybook/main.js +6 -0
  28. package/src/tasks/init/template/.storybook/pega-logo.svg +16 -0
  29. package/src/tasks/init/template/.storybook/preview.tsx +44 -0
  30. package/src/tasks/init/template/.storybook/theme.js +44 -0
  31. package/src/tasks/init/template/.stylelintrc.json +4 -0
  32. package/src/tasks/init/template/.vscode/extensions.json +9 -0
  33. package/src/tasks/init/template/.vscode/settings.json +48 -0
  34. package/src/tasks/init/template/README.md +204 -0
  35. package/src/tasks/init/template/build.config.json +1 -0
  36. package/src/tasks/init/template/cspell.json +14 -0
  37. package/src/tasks/init/template/package.json.mustache +69 -0
  38. package/src/tasks/init/template/src/components/MBTAList/MBTAList.stories.tsx +10 -0
  39. package/src/tasks/init/template/src/components/MBTAList/MBTAList.tsx +122 -0
  40. package/src/tasks/init/template/src/components/MBTAList/icons/accessible.icon.tsx +14 -0
  41. package/src/tasks/init/template/src/components/MBTAList/icons/bus.icon.tsx +13 -0
  42. package/src/tasks/init/template/src/components/MBTAList/icons/mbta.icon.tsx +10 -0
  43. package/src/tasks/init/template/src/components/MBTAList/icons/subway.icon.tsx +14 -0
  44. package/src/tasks/init/template/src/components/MBTAList/index.ts +2 -0
  45. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.stories.tsx +19 -0
  46. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.styles.ts +5 -0
  47. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.types.ts +10 -0
  48. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURLDisplay.tsx +25 -0
  49. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURLInput.tsx +24 -0
  50. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/config.json +13 -0
  51. package/src/tasks/init/template/src/components/Organization_Library_MediaURL/index.ts +2 -0
  52. package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/config.json +44 -0
  53. package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/demo.stories.jsx +40 -0
  54. package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/index.jsx +42 -0
  55. package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/styles.js +5 -0
  56. package/src/tasks/init/template/tasks.config.json +21 -0
  57. package/src/tasks/init/template/tsconfig.build.json +16 -0
  58. package/src/tasks/init/template/tsconfig.json +8 -0
  59. package/src/tasks/list/helper.js +118 -0
  60. package/src/tasks/list/index.js +51 -0
  61. package/src/tasks/publish/bundle/builder/index.js +174 -0
  62. package/src/tasks/publish/bundle/builder/modules.js +139 -0
  63. package/src/tasks/publish/bundle/builder/paths.js +50 -0
  64. package/src/tasks/publish/bundle/builder/webpack.config.js +334 -0
  65. package/src/tasks/publish/bundle/index.js +65 -0
  66. package/src/tasks/publish/helper.js +145 -0
  67. package/src/tasks/publish/index.js +55 -0
  68. package/src/tasks/update/index.js +5 -0
  69. package/src/tasks/upgrade/index.js +31 -0
  70. package/src/tasks/validator/index.js +102 -0
  71. package/src/util.js +277 -0
@@ -0,0 +1,105 @@
1
+ import chalk from 'chalk';
2
+ import inquirer from 'inquirer';
3
+ import ora from 'ora';
4
+
5
+ import { LIST_COMPONENT_SERVICE_REST_ENDPOINT } from '../../constants.js';
6
+ import {
7
+ constructCompleteUrl,
8
+ deleteLocalComponent,
9
+ deleteServerComponent,
10
+ getComponents,
11
+ getPegaServerConfig,
12
+ nodeFetch
13
+ } from '../../util.js';
14
+ import { getComponentsFromServer } from '../list/helper.js';
15
+
16
+ export const SOURCE_OF_COMPONENT_TYPES = {
17
+ SERVER: 'Server',
18
+ LOCAL: 'Local'
19
+ };
20
+
21
+ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
22
+ const defaultPegaServerConfig = await getPegaServerConfig();
23
+
24
+ return [
25
+ {
26
+ name: 'sourceOfComponents',
27
+ type: 'rawlist',
28
+ message: 'Delete components from Server or Local ?',
29
+ choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
30
+ default: defaultPegaServerConfig.sourceOfComponents,
31
+ when() {
32
+ return !options.params[3];
33
+ }
34
+ }
35
+ ];
36
+ };
37
+
38
+ export const deleteLocalComponents = async sourceOfComponents => {
39
+ const localComponents = await getComponents();
40
+
41
+ if (localComponents.length > 0) {
42
+ const answers = await inquirer.prompt([
43
+ {
44
+ name: 'componentKey',
45
+ type: 'rawlist',
46
+ message: 'Select component to delete',
47
+ choices: localComponents
48
+ },
49
+ {
50
+ name: 'confirmDeletion',
51
+ type: 'confirm',
52
+ message: 'Are you sure ?',
53
+ default: false
54
+ }
55
+ ]);
56
+ if (answers.confirmDeletion) {
57
+ await deleteLocalComponent(answers.componentKey);
58
+ }
59
+ } else {
60
+ console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
61
+ }
62
+ };
63
+
64
+ export const deleteServerComponents = async (sourceOfComponents, answers) => {
65
+ const spinner = ora('Fetching components from server').start();
66
+ const data = await getComponentsFromServer(answers);
67
+
68
+ const serverComponents = JSON.parse(data);
69
+ spinner.stop();
70
+ if (serverComponents && serverComponents.pxResults?.length > 0) {
71
+ const choicesArr = serverComponents.pxResults.map(({ label, pyRuleSet, pyRuleSetVersion }) => {
72
+ const name = `${standardizeStr(label, 45)} ${standardizeStr(pyRuleSet, 30)} ${standardizeStr(
73
+ pyRuleSetVersion,
74
+ 20
75
+ )}`;
76
+
77
+ const value = `${label}~|~${pyRuleSet}~|~${pyRuleSetVersion}`;
78
+ const short = `Selected component : ${chalk.redBright(
79
+ `${label} ${pyRuleSet} : ${pyRuleSetVersion}`
80
+ )}`;
81
+
82
+ return { name, value, short };
83
+ });
84
+ const answers = await inquirer.prompt({
85
+ name: 'componentToDelete',
86
+ type: 'rawlist',
87
+ pageSize: 10,
88
+ message: `Select component to delete \n ${standardizeStr('Rule name', 48)} ${standardizeStr(
89
+ 'Ruleset name',
90
+ 30
91
+ )} ${standardizeStr('Ruleset version', 22)}`,
92
+ choices: choicesArr
93
+ });
94
+ await deleteServerComponent(answers.componentToDelete);
95
+ } else {
96
+ console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
97
+ }
98
+ };
99
+
100
+ export const standardizeStr = (str, leng) => {
101
+ for (let i = str.length; i <= leng; i++) {
102
+ str += ' ';
103
+ }
104
+ return str;
105
+ };
@@ -0,0 +1,45 @@
1
+ import inquirer from 'inquirer';
2
+ import ora from 'ora';
3
+ import chalk from 'chalk';
4
+
5
+ import {
6
+ deleteLocalComponents,
7
+ SOURCE_OF_COMPONENT_TYPES,
8
+ deleteServerComponents,
9
+ getDeleteComponentsQuestions
10
+ } from './helper.js';
11
+
12
+ const deleteComponentsFn = async (sourceOfComponents, answers) => {
13
+ switch (sourceOfComponents) {
14
+ case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
15
+ await deleteLocalComponents(sourceOfComponents);
16
+ break;
17
+ }
18
+ case SOURCE_OF_COMPONENT_TYPES.SERVER: {
19
+ await deleteServerComponents(sourceOfComponents, answers);
20
+ break;
21
+ }
22
+ default: {
23
+ console.log('Source of components needs to be either Local or Server');
24
+ break;
25
+ }
26
+ }
27
+ };
28
+
29
+ export default async options => {
30
+ let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
31
+ if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
32
+ sourceOfComponentsOption = options.params[3];
33
+ await deleteComponentsFn(sourceOfComponentsOption);
34
+ } else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
35
+ sourceOfComponentsOption = options.params[3];
36
+ const questions = await getDeleteComponentsQuestions(options, sourceOfComponentsOption);
37
+ const answers = await inquirer.prompt(questions);
38
+ await deleteComponentsFn(sourceOfComponentsOption, answers);
39
+ } else {
40
+ const questions = await getDeleteComponentsQuestions(options);
41
+ const answers = await inquirer.prompt(questions);
42
+ const { sourceOfComponents } = answers;
43
+ await deleteComponentsFn(sourceOfComponents, answers);
44
+ }
45
+ };
@@ -0,0 +1,9 @@
1
+ export { default as createComponent } from './create/index.js';
2
+ export { default as deleteComponent } from './delete/index.js';
3
+ export { default as initProject } from './init/index.js';
4
+ export { default as publishComponent } from './publish/index.js';
5
+ export { default as listComponents } from './list/index.js';
6
+ export { default as updateComponent } from './update/index.js';
7
+ export { default as validate } from './validator/index.js';
8
+ export { default as authenticate } from './authenticate/index.js';
9
+ export { default as upgrade } from './upgrade/index.js';
@@ -0,0 +1,63 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import { sanitize, validateSemver } from '../../util.js';
3
+
4
+ export const getInitProjectQuestions = () => {
5
+ return [
6
+ {
7
+ name: 'projectName',
8
+ message: 'Enter Project name (required)',
9
+ validate: value => {
10
+ /* value should not be empty
11
+ It should not have spaces
12
+ It should not start with a number
13
+ Only case-insensitive alphanumeric values are allowed
14
+ */
15
+ if (value && !/^\d/.test(value) && value === sanitize(value)) {
16
+ return true;
17
+ }
18
+ return 'Only alphanumeric values are allowed, starting with alphabets';
19
+ }
20
+ },
21
+ {
22
+ name: 'organization',
23
+ message: 'Enter Organization name (required)',
24
+ validate: value => {
25
+ /* value should not be empty
26
+ It should not have spaces
27
+ It should not start with a number
28
+ Only case-insensitive alphanumeric values are allowed
29
+ */
30
+ if (value && !/^\d/.test(value) && value === sanitize(value)) {
31
+ return true;
32
+ }
33
+ return 'Only alphanumeric values are allowed, starting with alphabets';
34
+ }
35
+ },
36
+ {
37
+ name: 'version',
38
+ message: 'Version',
39
+ default: '1.0.0',
40
+ validate: value => {
41
+ if (validateSemver(value)) {
42
+ return true;
43
+ }
44
+ return 'Please provide semver compatible version e.g 0.0.1';
45
+ }
46
+ },
47
+ {
48
+ name: 'description',
49
+ message: 'Description',
50
+ default: ''
51
+ },
52
+ {
53
+ name: 'gitRepositoryUrl',
54
+ message: 'Git repository url (optional)',
55
+ default: ''
56
+ },
57
+ {
58
+ name: 'author',
59
+ message: 'Author',
60
+ default: ''
61
+ }
62
+ ];
63
+ };
@@ -0,0 +1,165 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { fileURLToPath } from 'url';
4
+ import { promisify } from 'util';
5
+ import { exec } from 'child_process';
6
+
7
+ import chalk from 'chalk';
8
+ import { execa } from 'execa';
9
+ import ncp from 'ncp';
10
+ import Listr from 'listr';
11
+ import gitignore from 'gitignore';
12
+ import inquirer from 'inquirer';
13
+
14
+ import {
15
+ compileMustacheTemplate,
16
+ isPascalCase,
17
+ convertIntoPascalCase,
18
+ sanitize
19
+ } from '../../util.js';
20
+
21
+ import { getInitProjectQuestions } from './helper.js';
22
+
23
+ const execPromise = promisify(exec);
24
+
25
+ const copy = promisify(ncp);
26
+ const writeGitignore = promisify(gitignore.writeFile);
27
+ const writeFile = promisify(fs.writeFile);
28
+
29
+ const createGitignore = async options => {
30
+ const file = fs.createWriteStream(path.join(options.targetDirectory, '.gitignore'), {
31
+ flags: 'a'
32
+ });
33
+ return writeGitignore({
34
+ type: 'Node',
35
+ file
36
+ });
37
+ };
38
+
39
+ const createLicense = async options => {
40
+ const targetPath = path.join(options.targetDirectory, 'LICENSE');
41
+ const licenseContent = 'Enter license text here';
42
+ return writeFile(targetPath, licenseContent, 'utf8');
43
+ };
44
+
45
+ const copyProjectTemplate = async options => {
46
+ await copy(options.templateDirectory, options.targetDirectory, {
47
+ clobber: false
48
+ });
49
+ const packageJsonPath = path.join(options.targetDirectory, 'package.json.mustache');
50
+
51
+ let { organization, projectName } = options;
52
+
53
+ projectName = sanitize(projectName).toLowerCase();
54
+
55
+ organization = sanitize(organization);
56
+ if (!isPascalCase(organization)) {
57
+ organization = convertIntoPascalCase(organization);
58
+ }
59
+
60
+ options = {
61
+ ...options,
62
+ organization,
63
+ projectName
64
+ };
65
+ const output = compileMustacheTemplate(packageJsonPath, options);
66
+ fs.writeFileSync(packageJsonPath, output);
67
+ fs.renameSync(packageJsonPath, packageJsonPath.replace('.mustache', ''));
68
+ await createLicense(options);
69
+ };
70
+
71
+ const initGit = async options => {
72
+ const result = await execa('git', ['init'], {
73
+ cwd: options.targetDirectory
74
+ });
75
+ if (result.failed) {
76
+ return Promise.reject(new Error('Failed to initialize git'));
77
+ }
78
+ };
79
+
80
+ export default async options => {
81
+ options.templateDirectory = path.resolve(
82
+ path.dirname(fileURLToPath(import.meta.url)),
83
+ 'template'
84
+ );
85
+ let projectName = 'test';
86
+
87
+ const questions = getInitProjectQuestions();
88
+
89
+ await inquirer.prompt(questions).then(async answers => {
90
+ projectName = answers.projectName;
91
+ projectName = sanitize(projectName).toLowerCase();
92
+ options = { ...options, ...answers };
93
+
94
+ const projectDirectory = `./${projectName}`;
95
+
96
+ if (!fs.existsSync(projectDirectory)) {
97
+ fs.mkdirSync(projectDirectory);
98
+ } else {
99
+ console.log(chalk.bold.red(`A project with name ${projectName} already exists. Exiting...`));
100
+ process.exit(1);
101
+ }
102
+
103
+ const targetDirectory = options.targetDirectory || process.cwd();
104
+ options.targetDirectory = path.join(targetDirectory, projectName);
105
+ });
106
+
107
+ const installDependenciesText = `Installing dependencies. This will take a couple of minutes.`;
108
+
109
+ const tasks = new Listr(
110
+ [
111
+ {
112
+ title: `Creating a new custom component project in ${chalk.blue(options.targetDirectory)}`,
113
+ task: () => copyProjectTemplate(options)
114
+ },
115
+ {
116
+ title: 'Create gitignore',
117
+ task: () => createGitignore(options)
118
+ },
119
+ {
120
+ title: 'Initialize git',
121
+ task: () => initGit(options),
122
+ enabled: () => options.git
123
+ },
124
+ {
125
+ title: installDependenciesText,
126
+ task: () => execPromise('npm i --production=false', { cwd: options.targetDirectory })
127
+ }
128
+ ],
129
+ {
130
+ exitOnError: false
131
+ }
132
+ );
133
+
134
+ await tasks.run();
135
+ console.log('\n');
136
+ console.log(
137
+ `${chalk.green('Success!!')} Project created at ${chalk.blueBright(options.targetDirectory)}`
138
+ );
139
+ console.log(
140
+ '\n',
141
+ `Inside that directory, you can run several commands:`,
142
+ '\n\n',
143
+ `${chalk.blueBright('npm start')}`,
144
+ `\n Start Storybook in development mode`,
145
+ '\n\n',
146
+ `${chalk.blueBright('npm run create')}`,
147
+ '\n',
148
+ `${chalk.blueBright('npm run list')}`,
149
+ `\n Try out custom-component actions like create, list, publish, etc`,
150
+ '\n\n',
151
+ `${chalk.blueBright('npm run lint')}`,
152
+ `\n Run eslint for component source files`,
153
+ '\n'
154
+ );
155
+
156
+ console.log(
157
+ `We suggest that you begin by typing:`,
158
+ '\n\n',
159
+ `${chalk.blueBright('cd')} ${chalk.bold(projectName)}`,
160
+ '\n',
161
+ `${chalk.blueBright('npm start')}`,
162
+ '\n'
163
+ );
164
+ return true;
165
+ };
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": ["@pega"],
3
+ "parserOptions": { "project": "tsconfig.json" },
4
+ "root": true,
5
+ "ignorePatterns": ["node_modules", "lib", "!.storybook", ".storybook/public"],
6
+ "rules": {
7
+ "prettier/prettier": "off",
8
+ "react/react-in-jsx-scope": "off"
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ "@pega/prettier-config"
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
3
+ core: {
4
+ builder: 'webpack5'
5
+ }
6
+ };
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg viewBox="0 0 311 68" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <!-- Generator: Sketch 46.1 (44463) - http://www.bohemiancoding.com/sketch -->
4
+ <title>Logo</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs></defs>
7
+ <g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+ <g id="Logo">
9
+ <g id="pega_logo_horizontal_positive_rgb">
10
+ <path d="M136.36,17.098 L136.173,17.009 C136.154,16.998 133.96,16.01 132.245,17.815 L132.026,18.046 L135.539,19.768 L136.36,17.098 Z M152.441,36.389 C152.441,36.389 150.91,39.13 150.224,40.143 C149.535,41.164 147.38,41.798 145.517,40.908 C144.665,40.503 136.694,35.854 133.644,36.12 C118.205,37.466 113.999,31.105 113.503,30.527 C113.005,29.949 112.077,30.218 112.74,31.355 C116.127,37.163 126.15,39.856 126.15,39.856 C128.771,46.172 129.085,50.597 129.085,50.597 C126.489,48.574 123.687,46.869 120.714,45.453 C112.768,40.121 100.329,33.518 83.207,29.379 C84.191,15.797 91.044,-3.837 123.092,0.806 C123.092,0.806 129.522,1.86 133.809,4.824 C133.809,4.824 132.779,5.904 131.425,7.256 C130.071,8.605 131.569,9.471 131.569,9.471 L138.338,14.792 C138.417,17.607 138.533,18.396 140.651,20.944 C142.769,23.487 151.004,32.112 152.081,33.266 C153.329,34.6 152.441,36.389 152.441,36.389 Z M78.633,9.915 C76.938,16.897 77.068,23.049 77.939,28.221 C76.33,27.901 74.697,27.594 73.014,27.32 C37.94,21.612 27.361,38.899 31.455,52.916 C19.86,57.274 8.963,62.263 0.214,67.162 C13.98,34.146 43.896,5.087 69.145,1.268 C77.389,0.181 79.708,5.529 78.633,9.915 L78.633,9.915 Z" id="Fill-1" fill="#1F2555"></path>
11
+ <path d="M83.492,40.09 C97.157,39.01 110.054,40.381 120.713,45.453 C112.768,40.121 100.329,33.518 83.206,29.379 C82.864,34.111 83.23,38.107 83.492,40.09 Z M81.52,40.262 C66.209,41.723 48.105,46.663 31.455,52.916 C27.361,38.899 37.941,21.612 73.014,27.32 C74.697,27.594 76.33,27.901 77.938,28.221 C78.77,33.166 80.276,37.228 81.52,40.262 L81.52,40.262 Z" id="Fill-2" fill="#00A6A7"></path>
12
+ <path d="M286.63,35.039 L291.379,23.446 L296.129,35.039 L286.63,35.039 Z M287.854,14 L272.536,50 L280.553,50 L283.819,41.985 L298.938,41.985 L302.204,50 L310.427,50 L295.108,14 L287.854,14 Z M188.647,26.704 C188.647,29.787 186.335,32.153 182.375,32.153 L176.1,32.153 L176.1,21.149 L182.219,21.149 C186.181,21.149 188.647,23.052 188.647,26.601 L188.647,26.704 Z M182.889,14 L168.18,14 L168.18,50 L176.1,50 L176.1,39.2 L182.115,39.2 C190.19,39.2 196.673,34.878 196.673,26.547 L196.673,26.444 C196.673,19.09 191.48,14 182.889,14 Z M239.764,18.02 C235.989,21.708 234.075,26.376 234.075,31.896 C234.075,37.421 235.953,42.054 239.663,45.675 C243.366,49.292 248.022,51.123 253.503,51.123 C259.992,51.123 265.064,49.159 268.587,45.284 L268.769,45.08 L268.769,28.556 L253.112,28.556 L253.112,35.244 L261.279,35.244 L261.279,41.993 C259.164,43.252 256.525,43.891 253.429,43.891 C250.221,43.891 247.454,42.792 245.203,40.62 C242.958,38.458 241.819,35.527 241.819,31.926 C241.819,28.322 242.992,25.379 245.304,23.18 C247.624,20.972 250.538,19.852 253.966,19.852 C255.769,19.852 257.366,20.074 258.711,20.512 C259.973,20.922 261.251,21.667 262.517,22.712 L266.897,17.183 C264.586,15.147 260.427,12.467 253.503,12.467 C248.162,12.467 243.539,14.336 239.764,18.02 Z M210.336,35.604 L225.842,35.604 L225.842,28.556 L210.336,28.556 L210.336,21.042 L229.623,21.042 L229.623,14 L202.466,14 L202.466,50 L229.879,50 L229.879,42.955 L210.336,42.955 L210.336,35.604 L210.336,35.604 Z" id="Fill-3" fill="#1F2555"></path>
13
+ </g>
14
+ </g>
15
+ </g>
16
+ </svg>
@@ -0,0 +1,44 @@
1
+ import type { DecoratorFn } from '@storybook/react';
2
+ import {
3
+ Configuration,
4
+ PopoverManager,
5
+ Toaster,
6
+ ModalManager,
7
+ WorkTheme
8
+ } from '@pega/cosmos-react-core';
9
+
10
+ export const decorators: DecoratorFn[] = [
11
+ (Story, context) => {
12
+ return (
13
+ <Configuration>
14
+ <PopoverManager>
15
+ <Toaster dismissAfter={5000}>
16
+ <ModalManager>
17
+ <Story {...context} />
18
+ </ModalManager>
19
+ </Toaster>
20
+ </PopoverManager>
21
+ </Configuration>
22
+ );
23
+ }
24
+ ];
25
+
26
+ export const parameters = {
27
+ backgrounds: {
28
+ default: 'App',
29
+ values: [
30
+ {
31
+ name: 'App',
32
+ value: WorkTheme.base.palette['app-background']
33
+ },
34
+ {
35
+ name: 'Primary',
36
+ value: WorkTheme.base.palette['primary-background']
37
+ },
38
+ {
39
+ name: 'Secondary',
40
+ value: WorkTheme.base.palette['secondary-background']
41
+ }
42
+ ]
43
+ }
44
+ };
@@ -0,0 +1,44 @@
1
+ import { create } from '@storybook/theming/create';
2
+
3
+ import logo from './pega-logo.svg';
4
+
5
+ const primaryColor = '#005EA7';
6
+ const secondaryColor = '#0076D1';
7
+ const purple = '#433254';
8
+ const black = '#262626';
9
+ const white = '#F0F0F0';
10
+
11
+ export default create({
12
+ base: 'light',
13
+
14
+ colorPrimary: secondaryColor,
15
+ colorSecondary: purple,
16
+
17
+ // UI
18
+ appBg: 'white',
19
+ appContentBg: 'white',
20
+ appBorderColor: '#D6DBE1',
21
+ appBorderRadius: 4,
22
+
23
+ // Typography
24
+ fontBase: '"Open Sans", sans-serif',
25
+ fontCode: 'monospace',
26
+
27
+ // Text colors
28
+ textColor: black,
29
+ textInverseColor: white,
30
+
31
+ // Toolbar default and active colors
32
+ barTextColor: black,
33
+ barSelectedColor: secondaryColor,
34
+ barBg: white,
35
+
36
+ // Form colors
37
+ inputBg: 'white',
38
+ inputBorder: primaryColor,
39
+ inputTextColor: black,
40
+ inputBorderRadius: 4,
41
+
42
+ brandTitle: 'Pega Component System',
43
+ brandImage: logo
44
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["@pega/stylelint-config"],
3
+ "ignoreFiles": ["node_modules/**", "lib/**", "!.storybook", ".storybook/public"]
4
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "recommendations": [
3
+ "dbaeumer.vscode-eslint",
4
+ "esbenp.prettier-vscode",
5
+ "stylelint.vscode-stylelint",
6
+ "streetsidesoftware.code-spell-checker",
7
+ "jpoissonnier.vscode-styled-components"
8
+ ]
9
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "typescript.enablePromptUseWorkspaceTsdk": true,
4
+
5
+ "files.insertFinalNewline": true,
6
+ "files.trimFinalNewlines": true,
7
+ "files.trimTrailingWhitespace": true,
8
+ "files.eol": "\n",
9
+ "files.encoding": "utf8",
10
+
11
+ "editor.insertSpaces": true,
12
+ "editor.tabSize": 2,
13
+ "editor.formatOnSave": true,
14
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
15
+ "editor.codeActionsOnSave": ["source.fixAll.eslint"],
16
+
17
+ "[javascript]": {
18
+ "editor.formatOnSave": true
19
+ },
20
+ "[javascriptreact]": {
21
+ "editor.formatOnSave": true
22
+ },
23
+ "[typescript]": {
24
+ "editor.formatOnSave": true
25
+ },
26
+ "[typescriptreact]": {
27
+ "editor.formatOnSave": true
28
+ },
29
+ "[json]": {
30
+ "editor.formatOnSave": true
31
+ },
32
+ "[jsonc]": {
33
+ "editor.formatOnSave": true
34
+ },
35
+ "[html]": {
36
+ "editor.formatOnSave": true
37
+ },
38
+ "[markdown]": {
39
+ "editor.formatOnSave": true
40
+ },
41
+
42
+ "javascript.preferences.quoteStyle": "single",
43
+ "javascript.format.semicolons": "insert",
44
+ "typescript.preferences.quoteStyle": "single",
45
+ "typescript.format.semicolons": "insert",
46
+
47
+ "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"]
48
+ }