Loading src/@sparqhub/edge.ts +3 −0 Original line number Diff line number Diff line export { default as Box } from 'components/Box'; export { default as Button } from 'components/Button'; export { default as Card } from 'components/Card'; export { default as Dropdown } from 'components/Dropdown'; export { default as Icon } from 'components/Icon'; export { default as Option } from 'components/Option'; export { default as Select } from 'components/Select'; export { default as TextField } from 'components/TextField'; export { default as ThemeProvider } from 'components/ThemeProvider'; Loading src/components/Select/ClearButton.helper.tsx +0 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ import Icon from 'components/Icon'; import { useDownshiftOptions } from './utils'; import styled, { css } from 'styled-components'; import { Size } from 'types/helpers'; const hiddenStyles = css` opacity: 0; Loading src/components/Select/Dropdown.helper.tsx +12 −11 Original line number Diff line number Diff line import React, { useMemo, ReactNodeArray, FunctionComponent } from 'react'; import React, { ReactNodeArray, FunctionComponent } from 'react'; import Dropdown from 'components/Dropdown'; import Option from 'components/Option'; Loading @@ -12,16 +12,6 @@ const SelectDropdown: FunctionComponent<Props> = ({ content, filter, children, . const { getMenuProps, isOpen } = useDownshiftOptions(); const filtered = useFilteredItems(content, filter); const isValidChildren = useMemo(() => { return React.Children.toArray(content).every(child => { return React.isValidElement(child) && child.type === Option; }); }, [content]); if (!isValidChildren) { throw Error('Content` prop is an array of `Option` instances'); } return ( <Dropdown isOpen={isOpen} content={filtered} {...getMenuProps()} {...props}> {children} Loading @@ -29,4 +19,15 @@ const SelectDropdown: FunctionComponent<Props> = ({ content, filter, children, . ); }; SelectDropdown.propTypes = { content(props, propName, componentName) { const isValidChildren = React.Children.toArray(props[propName]).every( child => React.isValidElement(child) && child.type === Option ); if (!isValidChildren) { return new Error(`${componentName} only accepts "<Option />" elements`); } } }; export default SelectDropdown; src/components/Select/Select.tsx +1 −1 Original line number Diff line number Diff line import React, { FunctionComponent, ReactText } from 'react'; import Downshift from 'downshift'; import { useDownshift, DownshiftContext, OptionElement } from './utils'; import { useDownshift, DownshiftContext } from './utils'; import Dropdown from './Dropdown.helper'; import Input from 'components/TextField'; import SelectInput from './SelectInput.helper'; Loading src/components/Select/utils.ts +0 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ import React, { createContext, useContext, ReactText, ReactElement, ReactNode, useRef, useEffect, useLayoutEffect, Loading Loading
src/@sparqhub/edge.ts +3 −0 Original line number Diff line number Diff line export { default as Box } from 'components/Box'; export { default as Button } from 'components/Button'; export { default as Card } from 'components/Card'; export { default as Dropdown } from 'components/Dropdown'; export { default as Icon } from 'components/Icon'; export { default as Option } from 'components/Option'; export { default as Select } from 'components/Select'; export { default as TextField } from 'components/TextField'; export { default as ThemeProvider } from 'components/ThemeProvider'; Loading
src/components/Select/ClearButton.helper.tsx +0 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ import Icon from 'components/Icon'; import { useDownshiftOptions } from './utils'; import styled, { css } from 'styled-components'; import { Size } from 'types/helpers'; const hiddenStyles = css` opacity: 0; Loading
src/components/Select/Dropdown.helper.tsx +12 −11 Original line number Diff line number Diff line import React, { useMemo, ReactNodeArray, FunctionComponent } from 'react'; import React, { ReactNodeArray, FunctionComponent } from 'react'; import Dropdown from 'components/Dropdown'; import Option from 'components/Option'; Loading @@ -12,16 +12,6 @@ const SelectDropdown: FunctionComponent<Props> = ({ content, filter, children, . const { getMenuProps, isOpen } = useDownshiftOptions(); const filtered = useFilteredItems(content, filter); const isValidChildren = useMemo(() => { return React.Children.toArray(content).every(child => { return React.isValidElement(child) && child.type === Option; }); }, [content]); if (!isValidChildren) { throw Error('Content` prop is an array of `Option` instances'); } return ( <Dropdown isOpen={isOpen} content={filtered} {...getMenuProps()} {...props}> {children} Loading @@ -29,4 +19,15 @@ const SelectDropdown: FunctionComponent<Props> = ({ content, filter, children, . ); }; SelectDropdown.propTypes = { content(props, propName, componentName) { const isValidChildren = React.Children.toArray(props[propName]).every( child => React.isValidElement(child) && child.type === Option ); if (!isValidChildren) { return new Error(`${componentName} only accepts "<Option />" elements`); } } }; export default SelectDropdown;
src/components/Select/Select.tsx +1 −1 Original line number Diff line number Diff line import React, { FunctionComponent, ReactText } from 'react'; import Downshift from 'downshift'; import { useDownshift, DownshiftContext, OptionElement } from './utils'; import { useDownshift, DownshiftContext } from './utils'; import Dropdown from './Dropdown.helper'; import Input from 'components/TextField'; import SelectInput from './SelectInput.helper'; Loading
src/components/Select/utils.ts +0 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ import React, { createContext, useContext, ReactText, ReactElement, ReactNode, useRef, useEffect, useLayoutEffect, Loading