Skip to content

Commit 0dac4e2

Browse files
authored
Merge pull request #190 from pegasystems/bugfix/libs
Bugfix/libs
2 parents 806cbec + 3ebd238 commit 0dac4e2

File tree

144 files changed

+5171
-5641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+5171
-5641
lines changed

.github/workflows/validatepr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ jobs:
2525
run: npm ci
2626
- name: Install Playwright
2727
run: npx playwright install --with-deps
28+
timeout-minutes: 10
2829
- name: Build Storybook
2930
run: npm run build-storybook
3031
- name: Run unit test
3132
run: npm run test
33+
timeout-minutes: 10
3234
- uses: Eun/http-server-action@v1
3335
with:
3436
directory: ${{ github.workspace }}/storybook-static

.storybook/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import type { StorybookConfig } from '@storybook/react-webpack5';
22

33
const config: StorybookConfig = {
44
core: {
5-
disableTelemetry: true
5+
disableTelemetry: true,
66
},
77
framework: '@storybook/react-webpack5',
88
staticDirs: ['./static'],
99
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
1010
addons: ['@storybook/addon-a11y', '@storybook/addon-essentials'],
1111
docs: {
12-
autodocs: true
12+
autodocs: true,
1313
},
1414
typescript: {
15-
check: false
16-
}
15+
check: false,
16+
},
1717
};
1818

1919
export default config;

.storybook/manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ addons.setConfig({
66
enableShortcuts: false,
77
showToolbar: true,
88
sidebar: {
9-
showRoots: false
10-
}
9+
showRoots: false,
10+
},
1111
});

.storybook/preview.tsx

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { useEffect as useReactEffect } from 'react';
22
import { configureActions } from '@storybook/addon-actions';
33
import { css } from '@storybook/theming';
4-
import {
5-
useEffect as useStorybookEffect,
6-
useMemo as useStorybookMemo
7-
} from '@storybook/preview-api';
4+
import { useEffect as useStorybookEffect, useMemo as useStorybookMemo } from '@storybook/preview-api';
85
import type { Preview } from '@storybook/react';
96
import {
107
Configuration,
@@ -14,7 +11,7 @@ import {
1411
Aries2023Theme,
1512
Aries2023DarkTheme,
1613
ThemeMachine,
17-
BaseThemeMachine
14+
BaseThemeMachine,
1815
} from '@pega/cosmos-react-core';
1916
import type { DefaultSettableTheme, DefaultThemeDefinition } from '@pega/cosmos-react-core';
2017
import * as MantisTheme from './MantisTheme.json';
@@ -23,41 +20,41 @@ import * as HoneyFlowerTheme from './HoneyFlowerTheme.json';
2320

2421
configureActions({
2522
depth: 5,
26-
limit: 20
23+
limit: 20,
2724
});
2825

2926
const themes: Record<string, DefaultSettableTheme | undefined> = {
3027
Default: Aries2023Theme,
3128
Dark: Aries2023DarkTheme,
3229
Mantis: MantisTheme,
3330
Flame: FlameTheme,
34-
HoneyFlower: HoneyFlowerTheme
31+
HoneyFlower: HoneyFlowerTheme,
3532
};
3633

3734
const themeMachines = Object.fromEntries(
3835
Object.entries(themes).map(([name, theme]) => [
3936
name,
40-
new ThemeMachine<DefaultThemeDefinition>({ theme, parent: BaseThemeMachine })
41-
])
37+
new ThemeMachine<DefaultThemeDefinition>({ theme, parent: BaseThemeMachine }),
38+
]),
4239
);
4340

4441
const preview: Preview = {
4542
parameters: {
4643
options: {
4744
storySort: {
48-
order: ['Getting Started', 'Libraries', 'Support and Contributing']
49-
}
45+
order: ['Getting Started', 'Libraries', 'Support and Contributing'],
46+
},
5047
},
5148
backgrounds: {
5249
disable: true,
5350
grid: {
54-
disable: true
55-
}
51+
disable: true,
52+
},
5653
},
5754
outline: {
58-
disable: true
55+
disable: true,
5956
},
60-
controls: { hideNoControlsWarning: true }
57+
controls: { hideNoControlsWarning: true },
6158
},
6259

6360
decorators: [
@@ -90,8 +87,7 @@ const preview: Preview = {
9087
// Sets up shadow DOM rendering
9188
(Story, context) => {
9289
const backgroundStyles = useStorybookMemo(() => {
93-
const selector =
94-
context.viewMode === 'docs' ? `#anchor--${context.id} .docs-story` : '.sb-show-main';
90+
const selector = context.viewMode === 'docs' ? `#anchor--${context.id} .docs-story` : '.sb-show-main';
9591

9692
const maxWidth = context.globals.fullscreen !== 'On' ? '1000px' : 'none';
9793

@@ -129,12 +125,8 @@ const preview: Preview = {
129125
}
130126
131127
:root {
132-
--addon-backgrounds-gradient-primary: ${themeMachine.theme.base.palette[
133-
'app-background'
134-
]};
135-
--addon-backgrounds-gradient-secondary: ${themeMachine.theme.base.palette[
136-
'primary-background'
137-
]};
128+
--addon-backgrounds-gradient-primary: ${themeMachine.theme.base.palette['app-background']};
129+
--addon-backgrounds-gradient-secondary: ${themeMachine.theme.base.palette['primary-background']};
138130
background: repeating-conic-gradient(
139131
var(--addon-backgrounds-gradient-primary) 0% 25%,
140132
var(--addon-backgrounds-gradient-secondary) 0% 50%
@@ -155,18 +147,10 @@ const preview: Preview = {
155147
max-width: ${maxWidth}!important;
156148
}
157149
`.styles;
158-
}, [
159-
context.viewMode,
160-
context.globals.theme,
161-
context.globals.backgrounds,
162-
context.globals.fullscreen
163-
]);
150+
}, [context.viewMode, context.globals.theme, context.globals.backgrounds, context.globals.fullscreen]);
164151

165152
useStorybookEffect(() => {
166-
const id =
167-
context.viewMode === 'docs'
168-
? `addon-backgrounds-docs-${context.id}`
169-
: 'addon-backgrounds-color';
153+
const id = context.viewMode === 'docs' ? `addon-backgrounds-docs-${context.id}` : 'addon-backgrounds-color';
170154

171155
const existingStyleEl = document.getElementById(id);
172156
if (existingStyleEl) {
@@ -184,7 +168,7 @@ const preview: Preview = {
184168
}, [backgroundStyles, context.viewMode, context.id]);
185169

186170
return <Story {...context} />;
187-
}
171+
},
188172
],
189173

190174
globalTypes: {
@@ -194,26 +178,26 @@ const preview: Preview = {
194178
defaultValue: 'Default',
195179
toolbar: {
196180
icon: 'paintbrush',
197-
items: Object.keys(themes)
198-
}
181+
items: Object.keys(themes),
182+
},
199183
},
200184
backgrounds: {
201185
name: 'Backgrounds',
202186
description: 'Change the background of the preview',
203187
defaultValue: 'Clear',
204188
toolbar: {
205189
icon: 'photo',
206-
items: ['Clear', 'App Background', 'Primary Background', 'Secondary Background']
207-
}
190+
items: ['Clear', 'App Background', 'Primary Background', 'Secondary Background'],
191+
},
208192
},
209193
fullscreen: {
210194
name: 'Fullscreen',
211195
description: 'Use all space',
212196
defaultValue: 'Off',
213197
toolbar: {
214198
icon: 'grow',
215-
items: ['Off', 'On']
216-
}
199+
items: ['Off', 'On'],
200+
},
217201
},
218202
locale: {
219203
name: 'Locale',
@@ -225,9 +209,9 @@ const preview: Preview = {
225209
{ value: 'en-US', right: '🇺🇸', title: 'English (US)' },
226210
{ value: 'pl', right: '🇵🇱', title: 'Polish' },
227211
{ value: 'fr', right: '🇫🇷', title: 'Français' },
228-
{ value: 'ar', right: '🇦🇪', title: 'عربي' }
229-
]
230-
}
212+
{ value: 'ar', right: '🇦🇪', title: 'عربي' },
213+
],
214+
},
231215
},
232216
direction: {
233217
name: 'Directionality',
@@ -236,11 +220,11 @@ const preview: Preview = {
236220
toolbar: {
237221
items: [
238222
{ value: 'ltr', icon: 'arrowrightalt', title: 'Left to Right' },
239-
{ value: 'rtl', icon: 'arrowleftalt', title: 'Right to Left' }
240-
]
241-
}
242-
}
243-
}
223+
{ value: 'rtl', icon: 'arrowleftalt', title: 'Right to Left' },
224+
],
225+
},
226+
},
227+
},
244228
};
245229

246230
export default preview;

.storybook/test-runner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ const config: TestRunnerConfig = {
1717

1818
// Apply story-level a11y rules
1919
await configureAxe(page, {
20-
rules: storyContext.parameters?.a11y?.config?.rules
20+
rules: storyContext.parameters?.a11y?.config?.rules,
2121
});
2222

2323
await checkA11y(page, '#storybook-root', {
2424
detailedReport: true,
2525
detailedReportOptions: {
26-
html: true
27-
}
26+
html: true,
27+
},
2828
});
29-
}
29+
},
3030
};
3131

3232
export default config;

.storybook/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ export default create({
3939

4040
brandTitle: 'Constellation UI Gallery',
4141
brandUrl: 'https://github.com/pegasystems/constellation-ui-gallery',
42-
brandImage: './pega-logo.svg'
42+
brandImage: './pega-logo.svg',
4343
});

.stylelintrc.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,5 @@
66
"selector-max-combinators": null,
77
"selector-max-compound-selectors": null
88
},
9-
"ignoreFiles": [
10-
"node_modules/**",
11-
"lib/**",
12-
"!.storybook",
13-
".storybook/public",
14-
"storybook-static/**"
15-
]
9+
"ignoreFiles": ["node_modules/**", "lib/**", "!.storybook", ".storybook/public", "storybook-static/**"]
1610
}

babel.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ module.exports = function (api) {
66
{
77
targets: {
88
esmodules: true,
9-
node: true
10-
}
11-
}
9+
node: true,
10+
},
11+
},
1212
],
1313
'@babel/preset-typescript',
14-
['@babel/preset-react', { runtime: 'automatic' }]
14+
['@babel/preset-react', { runtime: 'automatic' }],
1515
];
1616
const plugins = [];
1717

1818
return {
1919
presets,
20-
plugins
20+
plugins,
2121
};
2222
};

jest.config.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@ const packagesToTranspile = [
44
'@pega/cosmos-react-rte',
55
'@pega/cosmos-react-work',
66
'shortcuts',
7-
'preact'
7+
'preact',
88
];
9-
const packagesToTranspileStr = packagesToTranspile.map(p => `${p}`).join('|');
9+
const packagesToTranspileStr = packagesToTranspile.map((p) => `${p}`).join('|');
1010

1111
module.exports = {
1212
preset: 'ts-jest',
1313
verbose: true,
1414
moduleNameMapper: {
15-
shortcuts: '<rootDir>/node_modules/shortcuts/dist/index.js'
15+
shortcuts: '<rootDir>/node_modules/shortcuts/dist/index.js',
1616
},
17-
collectCoverageFrom: [
18-
'src/components/**/*.{ts,tsx,js,jsx}',
19-
'!**/*.(test|stories).{ts,tsx,js,jsx}'
20-
],
17+
collectCoverageFrom: ['src/components/**/*.{ts,tsx,js,jsx}', '!**/*.(test|stories).{ts,tsx,js,jsx}'],
2118
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
2219
moduleDirectories: ['node_modules', 'src'],
2320
setupFiles: ['./setupFiles.ts'],
@@ -26,6 +23,6 @@ module.exports = {
2623
testEnvironment: 'jsdom',
2724
transform: {
2825
'\\.[jt]sx?$': 'babel-jest',
29-
'^.+\\.(ts|tsx)?$': 'ts-jest'
30-
}
26+
'^.+\\.(ts|tsx)?$': 'ts-jest',
27+
},
3128
};

0 commit comments

Comments
 (0)