Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DevoInc/genesys-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
soslayando committed Sep 26, 2024
2 parents 7e16941 + 729d1fc commit 3d22c4f
Show file tree
Hide file tree
Showing 144 changed files with 2,069 additions and 1,208 deletions.
433 changes: 283 additions & 150 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"stryker": "npm run stryker -ws --if-present",
"analyzer": "npm run analyzer -ws --if-present",
"test": "vitest",
"test:ci": "vitest --coverage",
"test:ci": "npm run test -ws --if-present -- --coverage --watch=false",
"dpdm": "npm run dpdm -ws --if-present",
"release": "release-it --dry-run",
"release:ci": "release-it --ci",
Expand Down Expand Up @@ -51,35 +51,36 @@
"@stryker-mutator/vitest-runner": "^8.5.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.5.5",
"@types/node": "^22.7.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.1.1",
"babel-plugin-styled-components": "^2.1.4",
"dependency-cruiser": "^16.4.1",
"dependency-cruiser": "^16.4.2",
"dpdm": "^3.14.0",
"framer-motion": "^11.5.4",
"framer-motion": "^11.7.0",
"happy-dom": "^15.7.4",
"identity-obj-proxy": "^3.0.0",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
"mermaid": "^11.2.1",
"oxlint": "^0.9.6",
"oxlint": "^0.9.8",
"polished": "^4.3.1",
"prettier": "^3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-syntax-highlighter": "^15.5.0",
"release-it": "^17.6.0",
"remark-gfm": "^4.0.0",
"sass": "^1.79.1",
"sass": "^1.79.3",
"storybook": "^8.3.1",
"tocbot": "^4.29.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.4.6",
"vite-bundle-analyzer": "^0.11.0",
"vite-plugin-dts": "^4.2.1",
"vite": "^5.4.8",
"vite-bundle-visualizer": "^1.2.1",
"vite-plugin-dts": "^4.2.2",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.1",
"viz.js": "^2.1.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"build": "vite build",
"build:watch": "vite build --watch",
"depcruise": "sh ../../depcruise.sh \"$npm_package_name\"",
"analyzer": "npx vite-bundle-visualizer -o 'dist/stats.html'",
"analyzer": "vite-bundle-visualizer -o 'dist/stats.html'",
"stryker": "npx stryker run",
"dpdm": "dpdm --exit-code circular:1 ./src/index.ts"
},
Expand Down
175 changes: 88 additions & 87 deletions packages/code/src/components/Editor/Editor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ import { Editor, useEditorTheme } from '@devoinc/genesys-ui-code';
export const CustomThemed = () => {
const editorTheme = useEditorTheme();
return (
<Editor.Container bordered={true}>
<Editor.Editor
height="300px"
bordered={true}
theme={editorTheme}
value="I'm being built from my inner parts"
/>
<Editor.ActionsContainer>
<IconButton icon="gi-heart_full" />
</Editor.ActionsContainer>
</Editor.Container>
);
return (
<Editor.Container bordered={true}>
<Editor.Editor
height="300px"
bordered={true}
theme={editorTheme}
value="I'm being built from my inner parts"
/>
<Editor.ActionsContainer>
<IconButton icon="gi-heart_full" />
</Editor.ActionsContainer>
</Editor.Container>
);
};
`} />

Expand Down Expand Up @@ -87,41 +87,41 @@ import { Editor, registerLanguage } from '@devoinc/genesys-ui-code';
const languageId = 'myLang';
const language = {
keywords: ['"keyword"'],
tokenizer: {
root: [
[
/"[A-Za-z0-9_]_"/,
{
cases: {
'@keywords': 'keyword',
'@default': 'default',
},
},
],
[/:\\s"((.|-|\\n|\\r)_)"/, 'value'],
],
},
keywords: ['"keyword"'],
tokenizer: {
root: [
[
/"[A-Za-z0-9_]_"/,
{
cases: {
'@keywords': 'keyword',
'@default': 'default',
},
},
],
[/:\\s"((.|-|\\n|\\r)_)"/, 'value'],
],
},
};
const completionProvider = {
provideCompletionItems: (model, position) => {
const word = model.getWordUntilPosition(position);
const suggestions = [
{
label: 'keyword',
kind: monaco.languages.CompletionItemKind.Field,
insertText: '"keyword"',
range: {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: word.startColumn,
endColumn: word.endColumn,
},
},
];
return { suggestions: suggestions };
},
provideCompletionItems: (model, position) => {
const word = model.getWordUntilPosition(position);
const suggestions = [
{
label: 'keyword',
kind: monaco.languages.CompletionItemKind.Field,
insertText: '"keyword"',
range: {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: word.startColumn,
endColumn: word.endColumn,
},
},
];
return { suggestions: suggestions };
},
};
export const CustomLang = () => {
Expand All @@ -133,15 +133,15 @@ export const CustomLang = () => {
.registerCompletionProvider(completionProvider);
};
return (
<Editor
height="300px"
language={languageId}
bordered={true}
value={'{ "keyword": true, "not_keyword": 123 }'}
beforeMount={registerLanguageProviders}
/>
);
return (
<Editor
height="300px"
language={languageId}
bordered={true}
value={'{ "keyword": true, "not_keyword": 123 }'}
beforeMount={registerLanguageProviders}
/>
);
};
`} />

Expand All @@ -164,26 +164,27 @@ import {
export const CustomThemed = () => {
const editorTheme = useEditorTheme();
const { containerRef } = useEditor({
originalValue: 'Hey there!',
modifiedValue: 'Hey hey!',
theme: editorTheme,
language: '',
beforeMount: () => console.log('beforeMount'),
onMount: () => console.log('onMount'),
onChange: () => console.log('onChange'),
onValidate: () => console.log('onValidate'),
options: {},
});
return (
<Editor.Container>
<Box ref={containerRef} height="100%" />
<Editor.ActionsContainer>
<IconButton icon="gi-heart_full" />
</Editor.ActionsContainer>
</Editor.Container>
);
const { containerRef } = useEditor({
originalValue: 'Hey there!',
modifiedValue: 'Hey hey!',
theme: editorTheme,
language: '',
beforeMount: () => console.log('beforeMount'),
onMount: () => console.log('onMount'),
onChange: () => console.log('onChange'),
onValidate: () => console.log('onValidate'),
options: {},
});
return (
<Editor.Container>
<Box ref={containerRef} height="100%" />
<Editor.ActionsContainer>
<IconButton icon="gi-heart_full" />
</Editor.ActionsContainer>
</Box>
</Editor.Container>
);
};
`} />

Expand Down Expand Up @@ -215,19 +216,19 @@ export const CustomThemed = () => {
},
};
return (
<Editor.Container bordered={true}>
<Editor.Editor
height="300px"
bordered={true}
theme={customEditorTheme}
value="I'm being built from my inner parts"
/>
<Editor.ActionsContainer>
<IconButton icon="gi-heart_full" />
</Editor.ActionsContainer>
</Editor.Container>
);
return (
<Editor.Container bordered={true}>
<Editor.Editor
height="300px"
bordered={true}
theme={customEditorTheme}
value="I'm being built from my inner parts"
/>
<Editor.ActionsContainer>
<IconButton icon="gi-heart_full" />
</Editor.ActionsContainer>
</Editor.Container>
);
};
`} />

Expand Down
9 changes: 9 additions & 0 deletions packages/code/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,14 @@ export default defineConfig({
test: {
environment: 'happy-dom',
include: ['{src,stories}/**/*.test.ts?(x)'],
coverage: {
provider: 'v8',
include: ['{src,stories}/**/*'],
},
server: {
deps: {
inline: [/\/@devoinc\/genesys-ui\//],
},
},
},
});
2 changes: 1 addition & 1 deletion packages/color/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build",
"build:watch": "vite build --watch",
"depcruise": "sh ../../depcruise.sh \"$npm_package_name\"",
"analyzer": "npx vite-bundle-visualizer -o 'dist/stats.html'",
"analyzer": "vite-bundle-visualizer -o 'dist/stats.html'",
"stryker": "npx stryker run",
"dpdm": "dpdm --exit-code circular:1 ./src/index.ts"
},
Expand Down
9 changes: 9 additions & 0 deletions packages/color/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,14 @@ export default defineConfig({
test: {
environment: 'happy-dom',
include: ['{src,stories}/**/*.test.ts?(x)'],
coverage: {
provider: 'v8',
include: ['{src,stories}/**/*'],
},
server: {
deps: {
inline: [/\/@devoinc\/genesys-ui\//],
},
},
},
});
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
"scripts": {
"compile": "tsc --project tsconfig.json",
"compile:watch": "npm run compile -- --watch",
"test": "vitest",
"build": "vite build",
"build:watch": "vite build --watch",
"depcruise": "sh ../../depcruise.sh \"$npm_package_name\"",
"analyzer": "npx vite-bundle-visualizer -o 'dist/stats.html'",
"analyzer": "vite-bundle-visualizer -o 'dist/stats.html'",
"stryker": "npx stryker run",
"dpdm": "dpdm --exit-code circular:1 ./src/index.ts"
},
Expand Down
13 changes: 10 additions & 3 deletions packages/core/src/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { useTheme } from 'styled-components';

import { useDetectScroll } from '../../hooks';
import { useIsOverflow } from '../../hooks';
import type { TPanelSize } from './declarations';
import type {
IStyledOverloadCss,
Expand Down Expand Up @@ -47,12 +47,14 @@ const InternalPanel = React.forwardRef<HTMLElement, PanelProps>(
style,
size = 'md',
children,
removeContentSpace,
...restBoxProps
},
ref,
) => {
const theme = useTheme();
const { hasScroll, targetElRef } = useDetectScroll();
const targetElRef = React.useRef<HTMLDivElement>(null);
const { hasScroll } = useIsOverflow(targetElRef);
return (
<Box
{...restBoxProps}
Expand All @@ -69,7 +71,12 @@ const InternalPanel = React.forwardRef<HTMLElement, PanelProps>(
)}
>
<PanelContext.Provider
value={{ scrolledBodyContent: hasScroll, size, bodyRef: targetElRef }}
value={{
scrolledBodyContent: hasScroll,
size,
bodyRef: targetElRef,
removeContentSpace,
}}
>
{children}
</PanelContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const PanelBody = React.forwardRef<HTMLElement, PanelBodyProps>(
const theme = useTheme();
const context = React.useContext(PanelContext);
const evalSize = size || context.size || 'md';
const removeContentSpace =
removeSpace ?? context?.removeContentSpace ?? false;

return (
<Box
Expand All @@ -29,7 +31,7 @@ export const PanelBody = React.forwardRef<HTMLElement, PanelBodyProps>(
style={mergeStyles(
panelBodyMixin({
hasScrollSpacing: hasScrollSpacing ?? context.scrolledBodyContent,
removeSpace,
removeSpace: removeContentSpace,
size: evalSize,
theme,
}),
Expand Down
Loading

0 comments on commit 3d22c4f

Please sign in to comment.