diff --git a/src/components/AutoComplete/AutoComplete.stories.tsx b/src/components/AutoComplete/AutoComplete.stories.tsx index bd975bf..535b4b0 100644 --- a/src/components/AutoComplete/AutoComplete.stories.tsx +++ b/src/components/AutoComplete/AutoComplete.stories.tsx @@ -29,6 +29,7 @@ export const Single: Story> = () => { value={value} displayValue={(e) => e as string} onChange={(e: string) => update(e)} + hint="Select an alter ego" /> ); }; diff --git a/src/components/AutoComplete/AutoComplete.tsx b/src/components/AutoComplete/AutoComplete.tsx index 7b0e50b..cc2f480 100644 --- a/src/components/AutoComplete/AutoComplete.tsx +++ b/src/components/AutoComplete/AutoComplete.tsx @@ -12,6 +12,8 @@ import { lightText } from '../../helpers/color'; import { Skeleton } from '../Loading'; export class AutoComplete extends React.Component, State> { + dataActualLength = 0; + constructor(props) { super(props); @@ -20,6 +22,7 @@ export class AutoComplete extends React.Component, State data: [], open: false, loading: false, + selected: -1, }; } @@ -41,6 +44,7 @@ export class AutoComplete extends React.Component, State items = await items; this.setState({ loading: false }); } + this.dataActualLength = items.length; this.setState({ data: items }); }; @@ -48,26 +52,35 @@ export class AutoComplete extends React.Component, State if (this.props.disabled) { return; } + if (!open) { + return this.setState({ open, selected: -1, search: '' }); + } open && this.fetchData(); this.setState({ open }); }; displayList = () => { - const { data, search, loading } = this.state; + const { data, search, loading, selected } = this.state; const { listDisplayProp, uniqueIdentifier, searchValue } = this.props; + const filteredData = data?.filter((v) => searchValue(v).toLowerCase().includes(search.toLowerCase())); + + this.dataActualLength = filteredData.length; + return ( ( - - {data - .filter((v) => searchValue(v).toLowerCase().includes(search)) - .map((v) => ( - this.onChange(v)}> - {listDisplayProp(v)} - - ))} + + {filteredData?.map((v, i) => ( + this.onChange(v)} + > + {listDisplayProp(v)} + + ))} )} /> @@ -166,7 +179,7 @@ export class AutoComplete extends React.Component, State this.setState({ search }, this.fetchData); }; - onChange = (selected: AutoCompleteProps['value']) => { + onChange = (selected: T) => { const { mode, value, onChange, uniqueIdentifier } = this.props; if (mode === 'single') { onChange(selected as never); @@ -185,13 +198,37 @@ export class AutoComplete extends React.Component, State this.setState({ search: '' }); }; - onKeyUp = (e: React.KeyboardEvent) => { - switch (e.which) { - case 27: { - return this.onOpen(false); + onKeyDown = (e: React.KeyboardEvent) => { + const { data, selected, open } = this.state; + switch (e.key) { + case 'ArrowDown': { + if (!open) { + return this.onOpen(true); + } + + if (selected === this.dataActualLength - 1) { + return this.setState({ selected: -1 }); + } + + return this.setState({ selected: selected + 1 }); } - case 9: { - return this.onOpen(true); + case 'ArrowUp': { + if (!open) { + return this.onOpen(true); + } + + if (selected === -1) { + return this.setState({ selected: this.dataActualLength - 1 }); + } + + return this.setState({ selected: selected - 1 }); + } + case 'Enter': { + if (selected === -1) { + return; + } + + return this.onChange(data[selected]); } } }; @@ -209,7 +246,7 @@ export class AutoComplete extends React.Component, State value: this.displayValue(), before: this.renderBefore(), onChange: (e) => this.onSearch(e.target.value), - onKeyUp: this.onKeyUp, + onKeyDown: this.onKeyDown, required, disabled: this.props.disabled, }); @@ -269,4 +306,5 @@ interface State { data: T[]; open: boolean; loading: boolean; + selected: number; } diff --git a/src/components/Breadcrumb/Breadcrumb.stories.tsx b/src/components/Breadcrumb/Breadcrumb.stories.tsx index b01dacd..5a16844 100644 --- a/src/components/Breadcrumb/Breadcrumb.stories.tsx +++ b/src/components/Breadcrumb/Breadcrumb.stories.tsx @@ -3,7 +3,8 @@ import { Story, Meta } from '@storybook/react'; import { MdHome, MdNavigateNext } from 'react-icons/md'; import { Breadcrumb, BreadcrumbProps } from './Breadcrumb'; -import { MenuItemGroup, MenuItem } from '../Menu'; +import { MenuItem, Menu } from '../Menu'; +import { Button } from '../Button'; export default { title: 'Navigation/Breadcrumb', @@ -27,8 +28,8 @@ Icons.args = { paths: [() => Home, () => Breadcrumb], }; -export const Menu = Template.bind({}); -Menu.args = { +export const WithMenu = Template.bind({}); +WithMenu.args = { seperator: '>', paths: [ () => ( @@ -37,9 +38,9 @@ Menu.args = { ), () => ( - - Option 1 - + Options}> + Option 1 + ), ], }; diff --git a/src/components/Button/Button.stories.tsx b/src/components/Button/Button.stories.tsx index 8dfe393..7fed818 100644 --- a/src/components/Button/Button.stories.tsx +++ b/src/components/Button/Button.stories.tsx @@ -17,16 +17,16 @@ export default { const BlockTemplate: Story = (args) => ( <> - - - - @@ -35,16 +35,16 @@ const BlockTemplate: Story = (args) => ( const MixedTemplate: Story = (args) => ( <> - - - - @@ -53,11 +53,11 @@ const MixedTemplate: Story = (args) => ( const CircleTemplate: Story = (args) => ( <> - - - + + + ); diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index b2e7f21..246a7ec 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { stylesheet, classes } from 'typestyle'; -import { removeObjectProperties } from '../../helpers'; import { Theme, ThemeConsumer } from '../Theme/Theme'; import { buttonColor } from '../../helpers/color'; import { Loading } from '../Loading'; @@ -8,7 +7,6 @@ import { Text } from '../Text'; export const Button: React.FunctionComponent = (props) => { const { - type, size: __size, shape: __shape, displayBlock: __displayBlock, @@ -19,6 +17,10 @@ export const Button: React.FunctionComponent = (props) => { component, onClick, outline: __outline, + primary, + secondary, + danger, + link, ...rest } = props; @@ -28,15 +30,14 @@ export const Button: React.FunctionComponent = (props) => { if (component) { return React.cloneElement(props.component, p); } - if (rest.href !== undefined || type === 'link') { + if (rest.href !== undefined || link) { return React.cloneElement()} />); } return React.cloneElement( + } + > + {months.map((v) => ( + this.monthChange(v)} key={v}> + {v} + + ))} + + + + + {date[0]} + + } + > + {arrayBetween(1980, 2030).map((v) => ( + this.yearChange(v)} key={v}> + {v} + + ))} + + + + + {weeks.map((v) => ( + + + {v.slice(0, 3)} + + + ))} + + + {dateObj.map((v) => { + return weeks.map((f, i) => { + const selectedDate = this.toDate(this.props.date || null); + const isSelectedDate = + selectedDate && compareDesc(new Date(date[0], date[1], nestedAccess(v, f)), selectedDate) === 0; + const today = this.today(v?.[f]); + return ( + + {nestedAccess(v, f) ? ( + this.props.cellRender?.([date?.[0], date?.[1], v?.[f]], f) || ( + + ) + ) : ( +
+ )} + {this.props.callendarEvents && ( +
{this.calendarEvent(v?.[f])}
+ )} + + ); + }); + })} + + + ); } @@ -271,37 +261,28 @@ export class Calendar extends React.Component { return stylesheet({ dateContent: { position: 'static', + width: '110%', height: '0', textAlign: 'left', paddingBottom: '25%', boxSizing: 'border-box', }, - weeks: { - textAlign: 'right', - fontWeight: 'bold', - color: '#333', - }, cell: { - borderBottom: '1px solid #eee', - fontWeight: 400, + border: '1px solid rgba(0,0,0,0.1)', color: '#555', - textAlign: 'right', + display: 'flex', + position: 'relative', + alignItems: 'center', + justifyContent: 'center', + flexWrap: 'wrap', padding: '0', - borderLeft: 'none #e0e0e0 1px solid', - borderRight: 'none #e0e0e0 1px solid', cursor: 'pointer', - - $nest: { - '&:hover': { - background: '#eee', - }, - }, }, badge: { - height: '5px', - width: '100%', + height: '10px', + minWidth: '100%', cursor: 'pointer', - marginBottom: '2px', + margin: '2px 0', }, }); }; diff --git a/src/components/DatePicker/DatePicker.stories.tsx b/src/components/DatePicker/DatePicker.stories.tsx index c2094fb..dffe905 100644 --- a/src/components/DatePicker/DatePicker.stories.tsx +++ b/src/components/DatePicker/DatePicker.stories.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Story, Meta } from '@storybook/react'; import { DatePicker, DatePickerProps } from './DatePicker'; @@ -11,9 +11,15 @@ export default { }, } as Meta; -const Template: Story = (args) => ; +const Template: Story = (args) => { + const [date, updateDate] = useState(null); + return updateDate(e)} />; +}; export const Basic = Template.bind({}); +Basic.args = { + label: 'Enter Date', +}; export const DisabledDates = Template.bind({}); DisabledDates.args = { diff --git a/src/components/DatePicker/DatePicker.tsx b/src/components/DatePicker/DatePicker.tsx index 32876a2..54f27df 100644 --- a/src/components/DatePicker/DatePicker.tsx +++ b/src/components/DatePicker/DatePicker.tsx @@ -1,17 +1,12 @@ import * as React from 'react'; import { InputProps, Input } from '../Input/Input'; import { Button } from '../Button'; -import { Text } from '../Text'; -import { MdPermContactCalendar } from 'react-icons/md'; import { Calendar } from '../Calendar'; -import { Modal } from '../Modal'; import { Row, Col } from '../Grid'; import { CalendarProps, DateTupple } from '../Calendar/Calendar'; -import { format } from 'date-fns'; -import { getColor } from '../../helpers'; import { TimePickerProps, TimePicker, TimeTupple } from './TimePicker'; -import { ThemeConsumer } from '../Theme/Theme'; -import { lightText } from '../../helpers/color'; +import { Popover } from '../Popover'; +import { IoMdCalendar } from 'react-icons/io'; export const DatePicker: React.FunctionComponent = (props) => { const { @@ -27,72 +22,58 @@ export const DatePicker: React.FunctionComponent = (props) => { const date = toDate(props.date); - const [calendar, toggleCalendar] = React.useState(false); - const [time, onTimeChange] = React.useState([date.getHours(), date.getMinutes(), date.getSeconds()]); + const [time, onTimeChange] = React.useState([ + date?.getHours() || 0, + date?.getMinutes() || 0, + date?.getSeconds() || 0, + ]); return ( <> - toggleCalendar(true)} - after={ - <> -
+ {!drawer &&
} +
+
+ {bottom.map((v, i) => ( +
onOpen(v, children.length + i, false, toggle)} + > + {v.props?.anchor || v} +
+ ))}
-
-
{props.children}
-
{props.bottom}
- - // + ); }} @@ -43,75 +100,79 @@ export const SidePanel: React.FunctionComponent = (props) => { ); }; -const style = (open: boolean, theme: Theme, width: number) => { +const style = (theme: Theme, width: number) => { + const background = theme.background; + const color = getColor(background); return stylesheet({ + ...elevations(theme), container: { position: 'fixed', - width, - flex: `0 1 ${width}px`, - height: '100vh', + width: width + 'px', + flex: `0 1 60px`, maxHeight: '100%', - background: open ? theme.background : 'none', + color, + background, transition: '.3s all', + overflow: 'auto', zIndex: 1, left: 0, top: 0, + overflowX: 'visible', + overflowY: 'auto', }, - line: { - width: !open && '3px', - height: '100%', - position: 'absolute', - left: open ? '100%' : '23.5px', - background: theme.primary, - transition: '1s all', - zIndex: -1, - }, - arrow: { - zIndex: 1000, - display: 'none', - position: 'absolute', - right: '0', + logo: { cursor: 'pointer', - color: theme.secondary, - fontSize: '30px', - transition: '.2s', - left: '0', - top: '10px', + margin: 'auto', + marginTop: '20px', $nest: { - '&:hover': { - color: theme.warning, + svg: { + width: '100%', }, }, }, - resizer: { - position: 'absolute', - right: '-12px', - top: '0', - bottom: '0', - width: '30px', - // TODO: activate once drag is fixed - // cursor: 'ew-resize', - zIndex: 1, + item: { + margin: '20px 0', + color, $nest: { - '&:hover': { + '*': { + color, $nest: { - '& div': { - display: 'block', + '&:hover': { + color, }, }, }, }, }, + drawer: { + height: '100vh', + overflow: 'auto', + }, + resizer: { + position: 'fixed', + top: '20px', + left: width - 10 + 'px', + }, + line: { + position: 'fixed', + height: '110vh', + left: width / 2 + 'px', + width: '2px', + background: theme.primary, + }, bottom: { - position: 'absolute', - bottom: 0, - width: '100%', + position: 'fixed', + bottom: '0', + left: '0', + width: '60px', + background, + zIndex: 2, }, }); }; export interface SidePanelProps { - children: React.ReactNode; - bottom?: React.ReactNode; - // collapsed?: boolean; + children: React.ReactElement[] | React.ReactElement; + bottom?: React.ReactElement[] | React.ReactElement; + logo?: React.ReactNode; } diff --git a/src/components/List/List.stories.tsx b/src/components/List/List.stories.tsx index b192aa6..507a20b 100644 --- a/src/components/List/List.stories.tsx +++ b/src/components/List/List.stories.tsx @@ -15,7 +15,7 @@ export default { }, } as Meta; -export const Basic: Story> = (args) => ( +export const Basic: Story = (args) => ( }>Basic Item List }>Basic Item List @@ -25,7 +25,7 @@ export const Basic: Story> = (args) => ( ); -export const Subtitle: Story> = (args) => ( +export const Subtitle: Story = (args) => ( } subtitle="Do you Know Lorem Ipsum?"> Basic Item List @@ -40,7 +40,7 @@ export const Subtitle: Story> = (args) => ( ); -export const Collapsible: Story> = (args) => ( +export const Collapsible: Story = (args) => ( } subtitle="Do you Know Lorem Ipsum?"> Basic Item List @@ -57,3 +57,21 @@ export const Collapsible: Story> = (args) => ( Basic Item List ); + +export const Densed: Story = (args) => ( + + } subtitle="Do you Know Lorem Ipsum?"> + Basic Item List + + } subtitle="Do you Know Lorem Ipsum?"> + Basic Item List + + } subtitle="Do you Know Lorem Ipsum?"> + Basic Item List + + + Basic Item List + + Basic Item List + +); diff --git a/src/components/List/List.tsx b/src/components/List/List.tsx index f3f8629..a377633 100644 --- a/src/components/List/List.tsx +++ b/src/components/List/List.tsx @@ -4,10 +4,13 @@ import { ThemeConsumer } from '../Theme/Theme'; import { style } from './style'; export interface ListProps { - children?: React.ReactNode; + children?: React.ReactElement | React.ReactElement[]; style?: React.CSSProperties; elevation?: number; className?: string; + densed?: boolean; + inline?: boolean; + backgroundColor?: string; } export const List: React.FC = (props) => { @@ -16,11 +19,22 @@ export const List: React.FC = (props) => { return ( {(theme) => { - const css = style(theme); + const css = style(theme, props.backgroundColor, props.densed, props.inline); return (
    - {props.children} + {Array.isArray(props.children) + ? (props.children as React.ReactElement[])?.map( + (v, i) => + v && + React.cloneElement(v, { + key: `item-${i}`, + gutter: (props.densed && [0, '6px 8px 6px 9px']) || v.props.gutter, + }), + ) + : React.cloneElement(props.children ||
    , { + gutter: (props.densed && [0, '6px 8px 6px 9px']) || props.children?.props.gutter, + })}
); diff --git a/src/components/List/ListItem.tsx b/src/components/List/ListItem.tsx index d12ed38..7fbb843 100644 --- a/src/components/List/ListItem.tsx +++ b/src/components/List/ListItem.tsx @@ -37,7 +37,7 @@ export const ListItem: React.FC = (props) => { const css = listStyle(theme); const Element: React.FC = (p) => React.cloneElement(props.element ||
  • , { - className: classes(css.listItem, props.className), + className: classes(css.listItem, props.className, 'list-item'), onClick: onClick, style: { background: selected && theme.primary, diff --git a/src/components/List/style.ts b/src/components/List/style.ts index 44c1d87..d6a2381 100644 --- a/src/components/List/style.ts +++ b/src/components/List/style.ts @@ -3,31 +3,42 @@ import { Theme } from '../Theme/Theme'; import { hoverColor } from '../../helpers/color'; import elevations from '../../helpers/elevations'; -export const style = (theme: Theme) => { +export const style = (theme: Theme, background: string = theme.background, densed?: boolean, inline?: boolean) => { return stylesheet({ list: { - padding: '8px 0', + padding: densed ? '4px 0' : '8px 0', margin: 0, listStyle: 'none', width: '100%', boxSizing: 'border-box', - background: theme.background, + background: background, + $nest: { + '.list-item': { + display: inline ? 'inline-block' : 'block', + background: background, + $nest: { + '&:hover': { + filter: hoverColor(background), + background: background, + }, + }, + }, + }, }, listItem: { transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms', cursor: 'pointer', listStyle: 'none', overflow: 'hidden', - display: 'block', - // color: theme.textColor, $nest: { '&:hover': { - background: hoverColor(theme.background), + filter: hoverColor(background), + background: background, }, }, }, nestedItem: { - paddingLeft: '20px', + paddingLeft: densed ? '10px' : '20px', overflowY: 'hidden', transition: 'all .6s cubic-bezier(0.4, 0, 0.2, 1)', }, diff --git a/src/components/Menu/Menu.stories.tsx b/src/components/Menu/Menu.stories.tsx index 251cca6..20af0a6 100644 --- a/src/components/Menu/Menu.stories.tsx +++ b/src/components/Menu/Menu.stories.tsx @@ -1,45 +1,76 @@ import React from 'react'; import { Story, Meta } from '@storybook/react'; -import { MenuItemGroup, MenuItem, Menu } from '.'; +import { MenuItem, Menu } from '.'; import { Button } from '../Button'; -import { IoMdOptions } from 'react-icons/io'; -import { MenuItemGroupProps } from './MenuItemGroup'; +import { MenuProps } from './Menu'; +import { MdAcUnit, MdChevronRight, MdExpandMore } from 'react-icons/md'; export default { title: 'Navigation/Menu', - component: MenuItemGroup, - subcomponents: { MenuItem, MenuItemGroup }, - argTypes: { - // backgroundColor: { control: 'color' }, - }, + component: Menu, + subcomponents: { MenuItem }, } as Meta; -export const Collapsible: Story = (args) => ( - - - } name="1"> - Option 1 - - Option 2 - Option 3 - +export const InlineMenu: Story = (args) => ( + OPEN MENU}> + }>Option 1 + Option 2 + Option 3 + } icon={}> + More + + } + > + }>Option 4 + Option 5 + Option 6 + }>Even More}> + }>Option 7 + Option 8 + Option 9 + + ); -export const PopupMenu = Collapsible.bind({}); -PopupMenu.args = { - inline: false, +export const HorizontalMenu: Story = (args) => ( + OPEN MENU}> + }>Option 1 + Option 2 + Option 3 + } icon={}> + More + + } + > + }>Option 4 + Option 5 + Option 6 + }>Even More}> + }>Option 7 + Option 8 + Option 9 + + + +); + +HorizontalMenu.args = { + mode: 'horizontal', + elevation: 0, }; -export const AnchorAndOffset = Collapsible.bind({}); -AnchorAndOffset.args = { - inline: false, - position: 'bottom', - anchor: ( - -
  • } - trigger={this.props.trigger} - position={this.props.position} - visible={this.state.open} - onVisibleChange={(open) => this.setState({ open })} - hideArrow - style={{ - content: { - padding: '0', - }, - child: { - display: 'inline-block', - }, - }} - align={this.props.offset && { offset: this.props.offset }} - > - {this.props.anchor || ( - - {!this.props.inline && title} - - )} - - ); - }; - - render() { - return ( - - {(context) => { - const isBarOpen = this.props.inline && context.width > 200; - return this.renderPopup(isBarOpen); - }} - - ); - } -} - -export interface MenuItemGroupProps { - title: React.ReactNode; - icon?: React.ReactNode; - name?: string; - defaultActive?: boolean; - inline?: boolean; - position?: PopoverProps['position']; - trigger?: PopoverProps['trigger']; - - /** - * Custom element to be shown as anchor - * Applicable only for popover menu. - */ - anchor?: PopoverProps['children']; - - /** - * Offset for element popup placement - * [X, Y] - */ - offset?: [number, number]; -} - -interface State { - active?: boolean; - open: boolean; -} diff --git a/src/components/Menu/index.ts b/src/components/Menu/index.ts index ab4f36b..4825138 100644 --- a/src/components/Menu/index.ts +++ b/src/components/Menu/index.ts @@ -1,3 +1,2 @@ export { MenuItem } from './MenuItem'; -export { MenuItemGroup } from './MenuItemGroup'; export { Menu } from './Menu'; diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index a9469e7..524e7c6 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -1,21 +1,37 @@ import * as React from 'react'; import { Portal } from '../Popover/Portal'; -import { style as typeStyle, stylesheet, keyframes, classes } from 'typestyle'; +import { style as typeStyle, stylesheet, keyframes, classes, style, media } from 'typestyle'; import { Theme, ThemeConsumer } from '../Theme/Theme'; import { colorShades } from '../../helpers/color'; import elevations from '../../helpers/elevations'; export const Modal: React.FunctionComponent = (props) => { - const { children, onClose, isVisible, style = {}, width, elevation = 0 } = props; + const { children, onClose = () => ({}), isVisible, style = {}, width, elevation = 24 } = props; if (!isVisible) { - document.body.style.overflow = 'auto'; - document.body.style.position = ''; return null; } - document.body.style.overflow = 'hidden'; - document.body.style.position = 'relative'; + const [className, updateClassName] = React.useState(''); + + const beforeClose = () => { + const slideOutRight = keyframes({ + '0%': { + transform: 'translateY(0)', + }, + '100%': { + transform: 'translateY(120vh)', + }, + }); + + setTimeout(onClose, 200); + + updateClassName( + typeStyle({ + animation: `${slideOutRight} .2s ease-in both !important`, + }), + ); + }; return ( @@ -23,10 +39,10 @@ export const Modal: React.FunctionComponent = (props) => { {(theme) => { const css = modalStyle(theme); return ( -
    onClose && onClose()}> +
    onClose && beforeClose()}>
    e.stopPropagation()} > @@ -51,6 +67,41 @@ const slideInBottom = keyframes({ }, }); +const mediaQueries = style( + media( + { + maxWidth: 768, + }, + { + width: '99vw', + }, + ), + media( + { + minWidth: 768, + }, + { + width: '80vw', + }, + ), + media( + { + minWidth: 992, + }, + { + width: '70vw', + }, + ), + media( + { + minWidth: 1200, + }, + { + width: '50vw', + }, + ), +); + const modalStyle = (theme: Theme) => { return stylesheet({ container: { @@ -59,7 +110,6 @@ const modalStyle = (theme: Theme) => { zIndex: 1001, top: '10vh', overflowY: 'auto', - width: '50vw', animation: `${slideInBottom} 0.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both`, borderRadius: '2px', }, diff --git a/src/components/Page/Page.stories.tsx b/src/components/Page/Page.stories.tsx index f14f480..03fcc7c 100644 --- a/src/components/Page/Page.stories.tsx +++ b/src/components/Page/Page.stories.tsx @@ -1,14 +1,15 @@ import React from 'react'; import { Meta } from '@storybook/react'; -import { Page, Row, Col, Tag, TabPanel, Card, Collapse } from '../../'; +import { Page, Row, Col, Tag, TabPanel, Card, Collapse, AutoComplete } from '../../'; import { Textarea, Input } from '../Input'; -import { MdArrowBack, MdSearch } from 'react-icons/md'; +import { MdAdd, MdArrowBack, MdSearch } from 'react-icons/md'; import { Breadcrumb } from '../Breadcrumb'; import { FlexTable } from '../Table'; import MOCK_DATA from '../Table/MOCK_DATA.json'; +import { Button } from '../Button'; type DataType = typeof MOCK_DATA[0]; @@ -39,6 +40,11 @@ export const Basic = () => ( List , ]} + bottom={ + + } tabs={{ defaultActiveKey: 'a', headers: [ @@ -70,7 +76,15 @@ export const Basic = () => ( Yolo , - Yolo + ['Bruce', 'Clark', 'Arthur', 'Diana']} + uniqueIdentifier={(e) => e} + listDisplayProp={(e) => e} + label="Select Alter Ego" + displayValue={(e) => e as string} + hint="Select an alter ego" + /> , Yolo @@ -101,12 +115,51 @@ export const Basic = () => ( HELLO + ['Bruce', 'Clark', 'Arthur', 'Diana']} + uniqueIdentifier={(e) => e} + listDisplayProp={(e) => e} + label="Select Alter Ego" + displayValue={(e) => e as string} + hint="Select an alter ego" + /> + ['Bruce', 'Clark', 'Arthur', 'Diana']} + uniqueIdentifier={(e) => e} + listDisplayProp={(e) => e} + label="Select Alter Ego" + displayValue={(e) => e as string} + hint="Select an alter ego" + /> + ['Bruce', 'Clark', 'Arthur', 'Diana']} + uniqueIdentifier={(e) => e} + listDisplayProp={(e) => e} + label="Select Alter Ego" + displayValue={(e) => e as string} + hint="Select an alter ego" + /> + ['Bruce', 'Clark', 'Arthur', 'Diana']} + uniqueIdentifier={(e) => e} + listDisplayProp={(e) => e} + label="Select Alter Ego" + displayValue={(e) => e as string} + hint="Select an alter ego" + /> + ['Bruce', 'Clark', 'Arthur', 'Diana']} + uniqueIdentifier={(e) => e} + listDisplayProp={(e) => e} + label="Select Alter Ego" + displayValue={(e) => e as string} + hint="Select an alter ego" + /> ); -// stories.add( -// 'Page', -// withInfo()(() => ( -// -// )), -// ); diff --git a/src/components/Page/Page.tsx b/src/components/Page/Page.tsx index 3889f18..5059d75 100644 --- a/src/components/Page/Page.tsx +++ b/src/components/Page/Page.tsx @@ -31,13 +31,13 @@ export const Page: React.FC = (props) => { {(props.bottom || props.tabs) && (
    - + {props.tabs && ( - + )} - {props.bottom} + {props.bottom}
    )} @@ -64,9 +64,7 @@ const style = (theme: Theme) => { const shadowDef = shadow('DEFAULT', theme); return stylesheet({ - container: { - margin: '1%', - }, + container: {}, header: { padding: '0px 1.5%', background: theme.background, diff --git a/src/components/Pagination/Pagination.tsx b/src/components/Pagination/Pagination.tsx index acefb25..b6351aa 100644 --- a/src/components/Pagination/Pagination.tsx +++ b/src/components/Pagination/Pagination.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { IoIosArrowBack, IoIosArrowForward } from 'react-icons/io'; import { MdExpandMore } from 'react-icons/md'; -import { Row, Col, Text, MenuItem, MenuItemGroup } from '../..'; +import { Row, Col, Text, MenuItem, Menu } from '../..'; import { Button } from '../Button'; import { RowProps } from '../Grid/Row'; import { Input } from '../Input'; @@ -12,37 +12,36 @@ export const Pagination: React.FC = (props) => { {itemsPerPage && ( - } label="Items/Page" value={batchSize} + readOnly borderLess /> } - inline={false} position="bottom" - title="Options" > {itemsPerPage.map((v) => ( - onChange(1, v, false, false)} key={`pagination-${v}`} name={`pagination-${v}`}> + onChange?.(1, v, false, false)} key={`pagination-${v}`}> {v} ))} - + )} - {batchSize * (currentPage - 1) + 1} -{' '} + {totalCount === 0 ? 0 : batchSize * (currentPage - 1) + 1} -{' '} {batchSize * currentPage > totalCount ? totalCount : batchSize * currentPage} of {totalCount} ); @@ -23,46 +31,110 @@ export const Position: Story = (args) => ( <> - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > @@ -72,20 +144,52 @@ export const Position: Story = (args) => ( export const Triggers: Story = (args) => ( <> - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > - Hello}> + + Content + + } + > ); export const HideArrow: Story = (args) => ( - Hello} hideArrow> + + Content + + } + hideArrow + > ); diff --git a/src/components/Popover/Popover.tsx b/src/components/Popover/Popover.tsx index 55dc46e..95d4c96 100644 --- a/src/components/Popover/Popover.tsx +++ b/src/components/Popover/Popover.tsx @@ -10,6 +10,7 @@ export class Popover extends React.Component { trigger: 'onClick', position: 'bottom', style: {}, + elevation: 12, }; child = React.createRef(); @@ -19,13 +20,18 @@ export class Popover extends React.Component { this.state = { childWidth: 0, + childHeight: 0, isBrowser: false, visible: false, }; } componentDidMount() { - this.setState({ childWidth: this.child.current.getBoundingClientRect().width }); + const childRect = this.child.current?.getBoundingClientRect(); + this.setState({ + childWidth: childRect?.width || 0, + childHeight: childRect?.height || 0, + }); this.isBrowser(); } @@ -35,7 +41,7 @@ export class Popover extends React.Component { visible: props.visible, }; } - return null; + return {}; } isBrowser = () => { @@ -49,9 +55,9 @@ export class Popover extends React.Component { const { hideArrow } = this.props; return (
    -
    +
    -
    {this.props.content}
    +
    {this.props.content}
    ); @@ -63,7 +69,7 @@ export class Popover extends React.Component { children, preserveOnClose, position, - style: { container: containerStyle, child: childStyle }, + style: { container: containerStyle = {}, child: childStyle = {} } = {}, onVisibleChange, elevation = 12, } = this.props; @@ -79,7 +85,7 @@ export class Popover extends React.Component { return ( {(theme) => { - const css = style(this.props.expand, this.state.childWidth, theme); + const css = style(this.props.expand || false, this.state.childWidth, theme); return ( { overlayClassName={classes(css.container, css[`elevation${elevation}`])} overlayStyle={containerStyle} onVisibleChange={(v) => { - this.setState({ visible: v, childWidth: this.child.current?.getBoundingClientRect().width }); + this.setState({ visible: v, childWidth: this.child.current?.getBoundingClientRect().width || 0 }); onVisibleChange && onVisibleChange(v); }} visible={this.state.visible} - align={this.props.align} + align={this.props.cover ? { points: ['tl', 't'] } : this.props.align} + animation={this.props.animation} >
    {React.cloneElement(children)} @@ -111,14 +118,14 @@ const triggers = (t: PopoverProps['trigger']) => onClick: 'click', onHover: 'hover', onFocus: 'focus', - }[t]); + }[t || 'onClick']); function style(expand: boolean, childWidth: number, theme: Theme) { return stylesheet({ container: { width: expand ? childWidth : 'auto', minWidth: '100px', - borderRadius: '2px', + borderRadius: '4px', padding: '0', background: theme.background, color: `${theme.textColor} !important`, @@ -145,10 +152,13 @@ export interface PopoverProps { onVisibleChange?: (visible?: boolean) => void; align?: Record; elevation: number; + cover?: boolean; + animation?: string; } interface State { childWidth: number; isBrowser: boolean; visible: boolean; + childHeight: number; } diff --git a/src/components/Slider/Slider.stories.tsx b/src/components/Slider/Slider.stories.tsx index 07b8baa..80ee7f9 100644 --- a/src/components/Slider/Slider.stories.tsx +++ b/src/components/Slider/Slider.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Story, Meta } from '@storybook/react'; -import { Slider, SliderProps, Range as SlRange, RangeProps, Handle } from './Slider'; +import { Slider, SliderProps, Range as SlRange, RangeProps, SliderHandle } from './Slider'; import { Text } from '../Text'; import { SliderTooltip } from 'rc-slider'; @@ -39,7 +39,7 @@ Marks.args = { export const WithTooltip: Story = (args) => { const handle = ({ value, dragging, ...rest }: { value: number; dragging?: boolean }) => ( - + ); return ; diff --git a/src/components/Slider/Slider.tsx b/src/components/Slider/Slider.tsx index 81bf869..f24392b 100644 --- a/src/components/Slider/Slider.tsx +++ b/src/components/Slider/Slider.tsx @@ -28,4 +28,4 @@ export const Range: React.FC = (props) => { ); }; -export { RangeProps, SliderProps, HandleProps, Handle, SliderTooltip }; +export { RangeProps, SliderProps, HandleProps, Handle as SliderHandle, SliderTooltip }; diff --git a/src/components/Slider/index.ts b/src/components/Slider/index.ts index ecad1fc..65ee6c0 100644 --- a/src/components/Slider/index.ts +++ b/src/components/Slider/index.ts @@ -1 +1 @@ -export { Slider, SliderTooltip, Range, Handle } from './Slider'; +export { Slider, SliderTooltip, Range, SliderHandle } from './Slider'; diff --git a/src/components/Table/FlexTable.stories.tsx b/src/components/Table/FlexTable.stories.tsx index e7fd6a7..7ce3b1f 100644 --- a/src/components/Table/FlexTable.stories.tsx +++ b/src/components/Table/FlexTable.stories.tsx @@ -12,7 +12,7 @@ import { IoMdFunnel } from 'react-icons/io'; import { MdClear } from 'react-icons/md'; export default { - title: 'Display/FlexTable', + title: 'Display/Flex Table', component: FlexTable, subcomponents: { Column: FlexTable.Column }, argTypes: { diff --git a/src/components/Table/FlexTable.tsx b/src/components/Table/FlexTable.tsx index 4ac3c5d..1353b5d 100644 --- a/src/components/Table/FlexTable.tsx +++ b/src/components/Table/FlexTable.tsx @@ -61,7 +61,6 @@ export function FlexTable(props: FlexTableProps) { className={css.header} style={style.header} gutter={[0, 0]} - selected action={nested && } > @@ -69,7 +68,7 @@ export function FlexTable(props: FlexTableProps) { ( <> {showEmptyState(css.empty)} @@ -80,7 +79,7 @@ export function FlexTable(props: FlexTableProps) { ) : React.cloneElement(props.children, { data: v, key: `col-${index}`, index }); - if (nested && nested.exapandable(v, index)) { + if (nested && nested.exapandable?.(v, index)) { return ( (props: FlexTableProps) { )} /> - {pagination} + {pagination ||
    } ); }} @@ -150,7 +149,7 @@ interface ColumnProps extends ColProps { /** * Index will have -1 for header */ - children: (data: T, index: number) => React.ReactNode; + children: (data?: T, index?: number) => React.ReactNode; header?: React.ReactNode; key: string; } diff --git a/src/components/Table/Table.stories.tsx b/src/components/Table/Table.stories.tsx index c8fda63..eb5ebef 100644 --- a/src/components/Table/Table.stories.tsx +++ b/src/components/Table/Table.stories.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Story, Meta } from '@storybook/react'; import { Table } from '.'; -import { Row, Col, MenuItemGroup, MenuItem, Tooltip, Pagination } from '../..'; +import { Row, Col, MenuItem, Tooltip, Pagination, Menu } from '../..'; import { MdSort, MdSortByAlpha } from 'react-icons/md'; import { TableProps } from './Table'; @@ -41,25 +41,23 @@ export const BasicTableWithHeadersAndFooters: Story Profile Table - } inline={false} position="bottom"> - - {'List'} - - + } position="bottom"> + {'List'} +
    - } inline={false} position="bottom"> - Ascending - Descening - + } position="bottom"> + Ascending + Descening +
    } - footer={} + footer={} /> ); diff --git a/src/components/Table/style.ts b/src/components/Table/style.ts index ae46a17..c7d3ee0 100644 --- a/src/components/Table/style.ts +++ b/src/components/Table/style.ts @@ -1,3 +1,4 @@ +import { borderColor } from 'csx'; import { stylesheet } from 'typestyle'; import { lightText, shadowColor } from '../../helpers/color'; import { Theme } from '../Theme/Theme'; @@ -22,22 +23,21 @@ export const style = (theme: Theme, nested: boolean, clickableRow: boolean) => { header: { fontWeight: 600, fontSize: '12px', + color: lightText(theme), + borderBottom: '2px solid ' + borderColor(theme.bodyBg), + cursor: 'default', $nest: { '&:hover': { - background: `${theme.primary}`, + background: theme.background, }, }, }, tableRow: { padding: '0', - cursor: !nested && !clickableRow && 'auto !important', + cursor: (!nested && !clickableRow && 'auto !important') || undefined, fontFamily: "'Fira Code', monospace !important", - $nest: { - '& .table-cell': { - borderBottom: `1px solid ${shadowColor(theme)[0]}`, - borderCollapse: 'collapse', - }, - }, + borderBottom: `1px solid ${shadowColor(theme)[0]}`, + borderCollapse: 'collapse', }, nestedContent: { marginLeft: '-20px', diff --git a/src/components/Tabs/TabPanelContainer.tsx b/src/components/Tabs/TabPanelContainer.tsx index 5a45af2..c7f4c36 100644 --- a/src/components/Tabs/TabPanelContainer.tsx +++ b/src/components/Tabs/TabPanelContainer.tsx @@ -45,7 +45,7 @@ interface TabPanelContainerProps { titles: TabPanelProps[]; activeKey: string; children: React.ReactNode; - unMountOnChange: boolean; + unMountOnChange?: boolean; } const Container = posed.div({ diff --git a/src/components/Tabs/Tabs.tsx b/src/components/Tabs/Tabs.tsx index 6dd5f6e..5b3b655 100644 --- a/src/components/Tabs/Tabs.tsx +++ b/src/components/Tabs/Tabs.tsx @@ -42,7 +42,7 @@ export class Tabs extends React.Component { return (
    this.setState({ activeKey: key })} /> - + {this.props.children}
    diff --git a/src/components/Tabs/style.ts b/src/components/Tabs/style.ts index 8c43b99..98ca366 100644 --- a/src/components/Tabs/style.ts +++ b/src/components/Tabs/style.ts @@ -41,7 +41,8 @@ export const style = (theme: Theme) => { $nest: { '&:hover': { color: theme.primary, - background: hoverColor(theme.background), + filter: hoverColor(theme.background), + background: theme.background, }, }, }, diff --git a/src/components/Tag/Tag.tsx b/src/components/Tag/Tag.tsx index f76570f..58a2523 100644 --- a/src/components/Tag/Tag.tsx +++ b/src/components/Tag/Tag.tsx @@ -11,7 +11,7 @@ export const Tag: React.StatelessComponent = (props) => { return ( {(theme) => ( - props.onClick()} style={props.style}> + props?.onClick()} style={props.style}> {props.children} {props.chips && ( @@ -72,7 +72,7 @@ const css = (props: TagProps, theme: Theme) => margin: '5px', display: 'inline-flex', boxShadow: shadow('DEFAULT', theme), - cursor: 'pointer', + cursor: props.onClick && 'pointer', textTransform: 'uppercase', minWidth: '64px', textAlign: 'center', @@ -94,7 +94,6 @@ export interface TagProps { } Tag.defaultProps = { - onClick: () => null, style: {}, size: 'DEFAULT', }; diff --git a/src/components/Text/Text.stories.tsx b/src/components/Text/Text.stories.tsx index c90f010..c08fffd 100644 --- a/src/components/Text/Text.stories.tsx +++ b/src/components/Text/Text.stories.tsx @@ -31,7 +31,7 @@ export const Variants = () => ( export const Styling = () => ( <> - + The quick brown fox jumps over the lazy dog diff --git a/src/components/Text/Text.tsx b/src/components/Text/Text.tsx index a570c68..dab4e00 100644 --- a/src/components/Text/Text.tsx +++ b/src/components/Text/Text.tsx @@ -70,6 +70,14 @@ export const Text: React.FunctionComponent = (props) => { ); } + if (props.variant === 'label') { + return ( + + ); + } + return ( {props.children} @@ -84,7 +92,7 @@ export interface TextProps { /** * Defines variant for heading. */ - variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p'; + variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'label'; /** * Sets the font style to italics. */ @@ -127,6 +135,11 @@ export interface TextProps { */ fontWeight?: React.CSSProperties['fontWeight']; + /** + * Add text align + */ + textAlign?: React.CSSProperties['textAlign']; + className?: string; } diff --git a/src/components/Tooltip/Tooltip.stories.tsx b/src/components/Tooltip/Tooltip.stories.tsx new file mode 100644 index 0000000..8aad358 --- /dev/null +++ b/src/components/Tooltip/Tooltip.stories.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { Story, Meta } from '@storybook/react'; +import { Tooltip } from '../..'; + +import { Button } from '../Button'; +import { Text } from '../Text'; +import { TooltipProps } from './Tooltip'; + +export default { + title: 'Feedback/Tooltip', + component: Tooltip, + argTypes: { + // backgroundColor: { control: 'color' }, + }, +} as Meta; + +export const Basic: Story = (args) => ( + Content}> + + +); diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx new file mode 100644 index 0000000..7350d86 --- /dev/null +++ b/src/components/Tooltip/Tooltip.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import RCTooltip from 'rc-tooltip'; +import { TooltipProps } from 'rc-tooltip/lib/Tooltip'; +import { Theme, ThemeConsumer } from '../Theme/Theme'; +import { stylesheet } from 'typestyle'; +import { color } from 'csx'; +import { colorShades } from '../../helpers/color'; + +const style = (theme: Theme) => + stylesheet({ + overlay: { + background: colorShades(color(theme.background).invert().toString())[4], + color: theme.background, + borderRadius: '4px', + padding: '5px 10px', + }, + }); + +export const Tooltip: React.FC = (props) => { + return ( + + {(theme) => { + const css = style(theme); + + return ; + }} + + ); +}; + +export { TooltipProps }; diff --git a/src/components/Tooltip/index.ts b/src/components/Tooltip/index.ts new file mode 100644 index 0000000..b44d466 --- /dev/null +++ b/src/components/Tooltip/index.ts @@ -0,0 +1 @@ +export { Tooltip } from './Tooltip'; diff --git a/src/helpers/color.ts b/src/helpers/color.ts index 3f3b111..6b4c5eb 100644 --- a/src/helpers/color.ts +++ b/src/helpers/color.ts @@ -19,7 +19,7 @@ export const shadowColor = (theme: Theme) => { export const hoverColor = (bgColor: string) => { const color = csxColor(bgColor); - return (color.lightness() > 0.7 ? color.darken(0.1) : color.lighten(0.1)).toString(); + return color.lightness() > 0.7 ? 'brightness(90%)' : 'brightness(130%)'; }; export const borderColor = (bodyBg: string) => { @@ -31,20 +31,41 @@ export const disabledColor = (theme: Theme) => { return getColor(theme.background, 'rgba(0, 0, 0, 0.20)', 'rgba(255,255,255,0.20)'); }; +export const disabledText = (theme: Theme) => { + return getColor(theme.background, 'rgba(0, 0, 0, 0.38)', 'rgba(255, 255, 255, 0.5)'); +}; + /** * @param props: ButtonProps, * @param theme: Theme * @returns [backgroundColor, textColor, hoverBgColor, border], */ -export const buttonColor = (props: ButtonProps, theme: Theme): [string, string, string, string] => { +export const buttonColor = ( + props: ButtonProps, + theme: Theme, + primary, + secondary: boolean, + danger: boolean, + link: boolean, +): [string, string, string, string] => { let backgroundColor = 'transparent'; let textColor = ''; let hoverBgColor = 'none'; let border = 'none'; - const defaultColor = () => (props.type === 'default' ? getColor(theme.background) : theme[props.type]); + const type = primary + ? 'primary' + : secondary + ? 'secondary' + : danger + ? 'danger' + : link + ? 'link' + : props.type || 'default'; + + const defaultColor = () => (type === 'default' ? getColor(theme.background) : theme[type]); - if (props.type === 'link') { + if (type === 'link') { textColor = getColor(theme.background, theme.primary, csxColor(theme.primary).lighten(0.7).toString()); } else if (props.flat) { textColor = defaultColor(); @@ -52,11 +73,11 @@ export const buttonColor = (props: ButtonProps, theme: Theme): [string, string, } else if (props.outline) { border = `1px solid ${defaultColor()}`; textColor = defaultColor(); - hoverBgColor = csxColor(theme[props.type]).fade(0.2).toString(); + hoverBgColor = csxColor(theme[type]).fade(0.2).toString(); } - if (!(props.flat || props.outline || props.type === 'link')) { - backgroundColor = props.type === 'default' ? colorShades(theme.background)[1] : theme[props.type]; + if (!(props.flat || props.outline || type === 'link' || link)) { + backgroundColor = type === 'default' ? colorShades(theme.background)[1] : theme[type]; textColor = getColor(backgroundColor); hoverBgColor = csxColor(backgroundColor).lighten(0.1).toHexString(); } @@ -64,7 +85,7 @@ export const buttonColor = (props: ButtonProps, theme: Theme): [string, string, if (props.disabled && props.outline) { border = `1px solid ${disabledColor(theme)}`; textColor = disabledColor(theme); - } else if (props.disabled && !(props.type === 'link' || props.flat) && !props.outline) { + } else if (props.disabled && !(type === 'link' || link || props.flat) && !props.outline) { backgroundColor = disabledColor(theme); textColor = getColor(disabledColor(theme)); } else if (props.disabled && !props.outline) { @@ -74,7 +95,7 @@ export const buttonColor = (props: ButtonProps, theme: Theme): [string, string, if (props.loading) { backgroundColor = - backgroundColor === 'transparent' || props.type === 'default' + backgroundColor === 'transparent' || type === 'default' ? 'transparent' : color(backgroundColor).lighten(0.1).toHexString(); } diff --git a/src/helpers/index.ts b/src/helpers/index.ts index 9b76e26..b66acfe 100644 --- a/src/helpers/index.ts +++ b/src/helpers/index.ts @@ -5,7 +5,10 @@ import { initializeNotification } from './../components/Notification/Notificatio import popverCss from './popover.css'; import topography from './topography.css'; -export function removeObjectProperties(obj: T, ...props: (keyof T)[]): Omit { +export function removeObjectProperties>( + obj: T, + ...props: (keyof T)[] +): Omit { obj = { ...obj }; for (let i = 0; i < props.length; i++) { if (obj.hasOwnProperty(props[i])) { @@ -78,7 +81,7 @@ export function initialize() { } export function arrayBetween(num1: number, num2: number) { - const arr = []; + const arr: number[] = []; for (let i = num1; i < num2; i++) { arr.push(i); } diff --git a/src/helpers/popover.css.ts b/src/helpers/popover.css.ts index bea58ca..3c8c279 100644 --- a/src/helpers/popover.css.ts +++ b/src/helpers/popover.css.ts @@ -185,14 +185,15 @@ export default ` *::-webkit-scrollbar { height: 5px; + width: 5px; background-color: rgba(0,0,0,0); } *::-webkit-scrollbar-thumb { - height: 2px, - width: 10px; - background-color: var(--primary); + height: 2px; + width: 2px; + background-color: #ccc; background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, diff --git a/src/helpers/text.ts b/src/helpers/text.ts index 5c72b1b..75d0946 100644 --- a/src/helpers/text.ts +++ b/src/helpers/text.ts @@ -39,5 +39,6 @@ export function format(props: TextProps, theme: Theme) { margin, textDecoration, padding, + textAlign: props.textAlign, }); } diff --git a/src/index.ts b/src/index.ts index a69328f..eb6b61e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,3 @@ -import RCTooltip from 'rc-tooltip'; - import { initialize } from './helpers'; initialize(); @@ -12,7 +10,7 @@ export { Card, CardHeader, CardBody, CardMedia } from './components/Card'; export { Row, Col } from './components/Grid'; export { SidePanel, Container, Content } from './components/Layout'; export { Loading, Skeleton } from './components/Loading'; -export { MenuItem, MenuItemGroup, Menu } from './components/Menu'; +export { MenuItem, Menu } from './components/Menu'; export { Modal } from './components/Modal'; export { Pagination } from './components/Pagination'; export { Popover } from './components/Popover'; @@ -36,7 +34,7 @@ export { Drawer } from './components/Drawer'; export { DatePicker, TimePicker } from './components/DatePicker'; export { Transfer } from './components/Transfer'; export { List, ListItem, CollapsibleList } from './components/List'; -export { RCTooltip as Tooltip }; +export { Tooltip } from './components/Tooltip'; export { Text } from './components/Text'; export { Upload } from './components/Upload'; -export { Slider, Range, Handle } from './components/Slider'; +export { Slider, Range, SliderHandle } from './components/Slider'; diff --git a/tsconfig.json b/tsconfig.json index a62a43c..3664e2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "declaration": true, "noImplicitAny": false, "removeComments": true, + // "strictNullChecks": true, "noLib": false, "allowSyntheticDefaultImports": true, "emitDecoratorMetadata": true,