Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Correct components and svg components #181

Merged
merged 8 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
},
"dependencies": {
"@layer5/sistent-components": "workspace:^",
"@layer5/sistent-svg": "workspace:^",
"@mui/material": "^5.14.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@layer5/sistent-svg": "workspace:^"
},
"devDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.14.15",
"@storybook/addon-essentials": "^7.4.3",
"@storybook/addon-interactions": "^7.4.3",
"@storybook/addon-links": "^7.4.3",
Expand All @@ -42,6 +40,8 @@
"eslint-plugin-storybook": "^0.6.13",
"msw": "^1.3.0",
"msw-storybook-addon": "^1.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.4.3",
"typescript": "^5.0.2",
"vite": "^4.4.5"
Expand Down
21 changes: 12 additions & 9 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "@layer5/sistent-components",
"version": "0.6.0",
"description": "Reusable React Components",
"main": "dist/index.umd.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/components/index.d.ts",
"files": [
"dist"
],
Expand All @@ -14,6 +14,8 @@
"lint:fix": "eslint --fix"
},
"devDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@layer5/sistent-svg": "workspace:^",
"@mui/icons-material": "^5.14.12",
"@mui/material": "^5.14.10",
Expand All @@ -26,6 +28,8 @@
"eslint": "^8.45.0",
"eslint-plugin-react": "^7.33.2",
"mui-datatables": "^4.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11",
"typescript": "^5.0.2",
"vite": "^4.4.5",
Expand All @@ -36,9 +40,11 @@
"@emotion/react": "*",
"@emotion/styled": "*",
"@mui/material": "*",
"@types/mui-datatables": "*",
"mui-datatables": "*",
"react": "*",
"react-dom": "*"
"react-dom": "*",
"react-error-boundary": "*"
},
"peerDependenciesMeta": {
"@emotion/react": {
Expand All @@ -55,9 +61,6 @@
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
},
"publishConfig": {
Expand All @@ -70,8 +73,8 @@
"default": "./dist/index.js"
}
},
"main": "dist/index.cjs",
"main": "dist/index.mjs",
"module": "dist/index.js",
"types": "./dist/index.d.ts"
"types": "./dist/components/index.d.ts"
}
}
5 changes: 5 additions & 0 deletions packages/components/src/base/Form/formcontrollabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FormControlLabel as MuiFormControlLabel, type FormControlLabelProps } from '@mui/material';

export function FormControlLabel(props: FormControlLabelProps) {
return <MuiFormControlLabel {...props} />;
}
1 change: 1 addition & 0 deletions packages/components/src/base/Form/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FormControlLabel } from './formcontrollabel';
1 change: 1 addition & 0 deletions packages/components/src/base/Menu/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { Menu } from './menu';
export { MenuItem } from './menuitem';
5 changes: 5 additions & 0 deletions packages/components/src/base/Menu/menuitem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { MenuItem as MuiMenuItem, type MenuItemProps } from '@mui/material';

export function MenuItem(props: MenuItemProps) {
return <MuiMenuItem {...props} />;
}
4 changes: 2 additions & 2 deletions packages/components/src/base/Popper/popper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Popper as MuiPopper, type PopperProps } from '@mui/material';

export const Popper = (props: PopperProps) => {
export function Popper(props: PopperProps) {
return <MuiPopper {...props} />;
};
}
Empty file.
20 changes: 13 additions & 7 deletions packages/components/src/custom/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from '@mui/material';
import React, { type FC } from 'react';
import React, { ErrorInfo, ReactNode, type ComponentType, type FC } from 'react';
import {
ErrorBoundaryProps,
FallbackProps,
Expand Down Expand Up @@ -41,7 +41,7 @@ const Fallback: React.ComponentType<FallbackProps> = ({ error, resetErrorBoundar
}
};

const reportError = (error: Error, info: React.ErrorInfo) => {
const reportError = (error: Error, info: ErrorInfo) => {
// This is where you'd send the error to Sentry,etc
console.log('Error Caught Inside Boundary --reportError', error, 'Info', info);
};
Expand All @@ -54,11 +54,11 @@ export const ErrorBoundary: FC<ErrorBoundaryProps> = ({ children, ...props }) =>
);
};
//
export const withErrorBoundary = (
Component: FC<any>,
export const withErrorBoundary = <P extends object>(
Component: ComponentType<P>,
errorHandlingProps: ErrorBoundaryProps | null
) => {
const WrappedWithErrorBoundary = (props: any) => (
const WrappedWithErrorBoundary = (props: P) => (
<ErrorBoundary {...(errorHandlingProps ? errorHandlingProps : {})}>
<Component {...props} />
</ErrorBoundary>
Expand All @@ -67,8 +67,14 @@ export const withErrorBoundary = (
return WrappedWithErrorBoundary;
};

export const withSuppressedErrorBoundary = (Component: React.ComponentType<any>) => {
const WrappedWithErrorBoundary = (props: any) => (
interface Props {
children: ReactNode;
}

export const withSuppressedErrorBoundary = <P extends object>(
Component: React.ComponentType<P>
) => {
const WrappedWithErrorBoundary: React.FC<P & Props> = (props: P & Props) => (
<ErrorBoundary FallbackComponent={() => null}>
<Component {...props} />
</ErrorBoundary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Tooltip from '../../../base/Tooltip';
import { Tooltip } from '../../../base/Tooltip';

interface ConditionalTooltipProps {
value: string;
Expand Down
37 changes: 20 additions & 17 deletions packages/components/src/custom/Toolbar/custom-column.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import {
Checkbox,
ClickAwayListener,
FormControlLabel,
IconButton,
Paper,
Popper,
Tooltip
} from '@layer5/sistent-components';

import React, { useState } from 'react';
import ColumnIcon from '../../../../svg/src/icons/Column/columnIcon';
import { IconButton } from '../../base/Button';
import { Checkbox } from '../../base/Checkbox';
import { ClickAwayListener } from '../../base/ClickAwayListener';
import { FormControlLabel } from '../../base/Form';
import { Paper } from '../../base/Paper';
import { Popper } from '../../base/Popper';
import { Tooltip } from '../../base/Tooltip';

interface CustomColumnVisibilityControlProps {
columns: Column[];
Expand Down Expand Up @@ -74,15 +71,21 @@ const CustomColumnVisibilityControl: React.FC<CustomColumnVisibilityControlProps
open={Boolean(anchorEl)}
anchorEl={anchorEl}
placement="bottom-end"
modifiers={{
flip: {
enabled: false
modifiers={[
{
name: 'flip',
options: {
enabled: false
}
},
preventOverflow: {
enabled: true,
boundariesElement: 'scrollParent'
{
name: 'preventOverflow',
options: {
enabled: true,
boundariesElement: 'scrollParent'
}
}
}}
]}
transition
>
<ClickAwayListener onClickAway={handleClose}>
Expand Down
44 changes: 24 additions & 20 deletions packages/components/src/custom/Toolbar/custom-filter.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import {
Button,
ClickAwayListener,
IconButton,
MenuItem,
Paper,
Popper,
Select,
Tooltip
} from '@layer5/sistent-components';
import { FilterIcon } from '@layer5/sistent-svg';
import InputLabel from '@mui/material/InputLabel';
import { SelectChangeEvent } from '@mui/material/Select';
import React, { useState } from 'react';
import FilterIcon from '../../../../svg/src/icons/Filter/FilterIcon';
import { Button, IconButton } from '../../base/Button';
import { ClickAwayListener } from '../../base/ClickAwayListener';
import { MenuItem } from '../../base/Menu';
import { Paper } from '../../base/Paper';
import { Popper } from '../../base/Popper';
import { Select } from '../../base/Select';
import { Tooltip } from '../../base/Tooltip';

interface FilterColumn {
name: string;
Expand Down Expand Up @@ -84,15 +82,21 @@ const UniversalFilter: React.FC<UniversalFilterProps> = ({
open={open}
anchorEl={anchorEl}
placement="bottom-end"
modifiers={{
flip: {
enabled: false
modifiers={[
{
name: 'flip',
options: {
enabled: false
}
},
preventOverflow: {
enabled: true,
boundariesElement: 'scrollParent'
{
name: 'preventOverflow',
options: {
enabled: true,
boundariesElement: 'scrollParent'
}
}
}}
]}
transition
>
<ClickAwayListener
Expand All @@ -119,8 +123,8 @@ const UniversalFilter: React.FC<UniversalFilterProps> = ({
defaultValue="All"
key={filterColumn}
value={selectedFilters[filterColumn]}
onChange={(e: React.ChangeEvent<{ value: string }>) =>
handleFilterChange(e, filterColumn)
onChange={(e: SelectChangeEvent<unknown>) =>
handleFilterChange(e as React.ChangeEvent<{ value: string }>, filterColumn)
}
style={{
width: '15rem',
Expand Down
7 changes: 4 additions & 3 deletions packages/components/src/custom/Toolbar/custom-search.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IconButton, TextField, Tooltip } from '@layer5/sistent-components';
import { CloseIcon, SearchIcon } from '@layer5/sistent-svg';
import React, { useRef, useState } from 'react';
import CloseIcon from '../../../../svg/src/icons/Close/closeIcon';
import SearchIcon from '../../../../svg/src/icons/Search/searchIcon';
import { IconButton } from '../../base/Button';
import { TextField } from '../../base/Input';
import { Tooltip } from '../../base/Tooltip';

interface SearchBarProps {
onSearch: (searchText: string) => void;
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from './base/DataTable';
export * from './base/Dialog';
export * from './base/Divider';
export * from './base/Drawer';
export * from './base/Form';
export * from './base/Input';
export * from './base/List';
export * from './base/Menu';
Expand Down
1 change: 1 addition & 0 deletions packages/svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"react": "^18.2.0",
"typescript": "^5.0.2",
"vite": "^4.4.5",
"vite-plugin-dts": "^3.5.3"
Expand Down
1 change: 1 addition & 0 deletions packages/svg/src/icons/Search/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as SearchIcon } from './searchicon';
1 change: 0 additions & 1 deletion packages/svg/src/icons/Search/intex.ts

This file was deleted.

2 changes: 2 additions & 0 deletions packages/svg/src/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export * from './Bus';
export * from './Chevron';
export * from './Circle';
export * from './Clone';
export * from './Close';
export * from './Cloud';
export * from './Component';
export * from './Configuration';
Expand Down Expand Up @@ -38,6 +39,7 @@ export * from './Reset';
export * from './Ring';
export * from './Save';
export * from './Screenshot';
export * from './Search';
export * from './Settings';
export * from './Star';
export * from './Toolkit';
Expand Down
4 changes: 1 addition & 3 deletions system/foundations/responsive.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ Providing support at these smaller sizes enable people with low vision to use La

To understand how to break down a page to work on smaller viewports, check out [Responsive foundations](/foundations/layout) and [Responsive behavior](/foundations/layout) sections in the [Layout](/foundations/layout) page.


TODO: Capture SVG requirements and practices from Meshery.


- **Minimum viewport width**: 375px
- **Minimum viewport height**: 300px
- **Minimum viewport height**: 300px
Loading
Loading