diff --git a/src/components/Visually-hidden/Visually-hidden.tsx b/src/components/Visually-hidden/Visually-hidden.tsx deleted file mode 100644 index 6f9d578da..000000000 --- a/src/components/Visually-hidden/Visually-hidden.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { Component } from 'react'; -import { default as styled } from 'styled-components'; -import classnames from 'classnames'; -import { HtmlSpan, HtmlSpanProps } from '../../reset/HtmlSpan/HtmlSpan'; - -export interface VisuallyHiddenProps extends HtmlSpanProps { - className?: string; -} - -const baseClassName = 'fi-visually-hidden'; - -const StyledVisuallyHidden = styled((props: VisuallyHiddenProps) => ( - -))` - position: absolute; - clip: rect(0 0 0 0); - height: 1px; - width: 1px; - margin: -1px; - padding: 0; - border: 0; - overflow: hidden; -`; - -export class VisuallyHidden extends Component { - render() { - const { className, ...passProps } = this.props; - return ( - - ); - } -} diff --git a/src/components/index.ts b/src/components/index.ts index dacc259a2..36c39dd7d 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -13,4 +13,3 @@ export { } from './LanguageMenu/LanguageMenu'; export { Paragraph, ParagraphProps } from './Paragraph/Paragraph'; export { Text, TextProps } from './Text/Text'; -export { VisuallyHidden } from './Visually-hidden/Visually-hidden'; diff --git a/src/core/Chip/Chip/Chip.tsx b/src/core/Chip/Chip/Chip.tsx index 0edfc6b8e..26ef4d16e 100644 --- a/src/core/Chip/Chip/Chip.tsx +++ b/src/core/Chip/Chip/Chip.tsx @@ -3,7 +3,7 @@ import classnames from 'classnames'; import { default as styled } from 'styled-components'; import { logger } from '../../../utils/logger'; import { HtmlButton, HtmlButtonProps, HtmlSpan } from '../../../reset'; -import { VisuallyHidden } from '../../../components/Visually-hidden/Visually-hidden'; +import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import { Icon } from '../../Icon/Icon'; import { BaseChipProps, diff --git a/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx b/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx index 82e3f7361..656bfef0f 100644 --- a/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx +++ b/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx @@ -2,7 +2,7 @@ import React, { Component, ReactNode } from 'react'; import { default as styled } from 'styled-components'; import classnames from 'classnames'; import { HtmlDiv, HtmlButton, HtmlButtonProps, HtmlSpan } from '../../../reset'; -import { VisuallyHidden } from '../../../components'; +import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import { baseStyles } from './ExpanderGroup.baseStyles'; const baseClassName = 'fi-expander-group'; diff --git a/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx b/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx index 114a6d4f7..292097f29 100644 --- a/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx +++ b/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx @@ -9,7 +9,7 @@ import { HtmlSpan, } from '../../../reset'; import { Icon } from '../../Icon/Icon'; -import { VisuallyHidden } from '../../../components'; +import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import { ExpanderConsumer, ExpanderTitleBaseProps } from '../Expander/Expander'; import { expanderTitleBaseStyles } from './ExpanderTitle.baseStyles'; diff --git a/src/core/Form/LabelText/LabelText.tsx b/src/core/Form/LabelText/LabelText.tsx index 73222f9be..c966f6c36 100644 --- a/src/core/Form/LabelText/LabelText.tsx +++ b/src/core/Form/LabelText/LabelText.tsx @@ -3,7 +3,7 @@ import classnames from 'classnames'; import { default as styled } from 'styled-components'; import { baseStyles } from './LabelText.baseStyles'; import { asPropType } from '../../../utils/typescript'; -import { VisuallyHidden } from '../../../components/Visually-hidden/Visually-hidden'; +import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import { HtmlSpan, HtmlSpanProps, HtmlDiv, HtmlDivProps } from '../../../reset'; export type LabelMode = 'hidden' | 'visible'; diff --git a/src/core/Form/RadioButton/RadioButtonGroup.tsx b/src/core/Form/RadioButton/RadioButtonGroup.tsx index f45377a33..00fb6b860 100644 --- a/src/core/Form/RadioButton/RadioButtonGroup.tsx +++ b/src/core/Form/RadioButton/RadioButtonGroup.tsx @@ -1,7 +1,7 @@ import React, { Component, ReactNode } from 'react'; import { default as styled } from 'styled-components'; import { HtmlDiv, HtmlSpan, HtmlFieldSet, HtmlLegend } from '../../../reset'; -import { VisuallyHidden } from '../../../components/Visually-hidden/Visually-hidden'; +import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import { RadioButtonProps } from './RadioButton'; import { baseStyles } from './RadioButtonGroup.baseStyles'; import { AutoId } from '../../../utils/AutoId'; diff --git a/src/core/Form/SearchInput/SearchInput.tsx b/src/core/Form/SearchInput/SearchInput.tsx index 49db569de..1596f4030 100644 --- a/src/core/Form/SearchInput/SearchInput.tsx +++ b/src/core/Form/SearchInput/SearchInput.tsx @@ -13,7 +13,7 @@ import { HtmlButton, HtmlButtonProps, } from '../../../reset'; -import { VisuallyHidden } from '../../../components/Visually-hidden/Visually-hidden'; +import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import { StatusText } from '../StatusText/StatusText'; import { LabelText, LabelMode } from '../LabelText/LabelText'; import { Icon } from '../../Icon/Icon'; diff --git a/src/core/Link/LinkExternal.tsx b/src/core/Link/LinkExternal.tsx index 0584cb633..108204978 100644 --- a/src/core/Link/LinkExternal.tsx +++ b/src/core/Link/LinkExternal.tsx @@ -7,7 +7,7 @@ import { } from '../../components/Link/LinkExternal'; import { Icon } from '../Icon/Icon'; import { Link, LinkProps } from './Link'; -import { VisuallyHidden } from '../../components'; +import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden'; import { externalStyles } from './Link.baseStyles'; const iconClassName = 'fi-link_icon'; diff --git a/src/core/VisuallyHidden/VisuallyHidden.tsx b/src/core/VisuallyHidden/VisuallyHidden.tsx index 13eb7eeed..6f9d578da 100644 --- a/src/core/VisuallyHidden/VisuallyHidden.tsx +++ b/src/core/VisuallyHidden/VisuallyHidden.tsx @@ -1 +1,35 @@ -export { VisuallyHidden } from '../../components/Visually-hidden/Visually-hidden'; +import React, { Component } from 'react'; +import { default as styled } from 'styled-components'; +import classnames from 'classnames'; +import { HtmlSpan, HtmlSpanProps } from '../../reset/HtmlSpan/HtmlSpan'; + +export interface VisuallyHiddenProps extends HtmlSpanProps { + className?: string; +} + +const baseClassName = 'fi-visually-hidden'; + +const StyledVisuallyHidden = styled((props: VisuallyHiddenProps) => ( + +))` + position: absolute; + clip: rect(0 0 0 0); + height: 1px; + width: 1px; + margin: -1px; + padding: 0; + border: 0; + overflow: hidden; +`; + +export class VisuallyHidden extends Component { + render() { + const { className, ...passProps } = this.props; + return ( + + ); + } +} diff --git a/src/index.tsx b/src/index.tsx index 4530d9d00..3f0670401 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -76,5 +76,8 @@ export { export { Paragraph, ParagraphProps } from './core/Paragraph/Paragraph'; export { Text, TextProps } from './core/Text/Text'; export { Textarea, TextareaProps } from './core/Form/Textarea/Textarea'; -export { VisuallyHidden } from './core/VisuallyHidden/VisuallyHidden'; +export { + VisuallyHidden, + VisuallyHiddenProps, +} from './core/VisuallyHidden/VisuallyHidden'; export { suomifiDesignTokens, DesignTokens } from 'suomifi-design-tokens';