diff --git a/development/generate-icon-names.js b/development/generate-icon-names.js index 60637ae86deb..a89887de73cf 100644 --- a/development/generate-icon-names.js +++ b/development/generate-icon-names.js @@ -4,7 +4,7 @@ * Reads all the icon svg files in app/images/icons * and returns an object of icon name key value pairs * stored in the environment variable ICON_NAMES - * Used with the Icon component in ./ui/component-library/icon + * Used with the Icon component in ./ui/components/component-library/icon/icon.js */ const fs = require('fs'); const path = require('path'); diff --git a/ui/components/component-library/button-base/README.mdx b/ui/components/component-library/button-base/README.mdx index e1e69d19c2fd..76d630f88493 100644 --- a/ui/components/component-library/button-base/README.mdx +++ b/ui/components/component-library/button-base/README.mdx @@ -37,7 +37,7 @@ Possible sizes include: ```jsx import { SIZES } from '../../../helpers/constants/design-system'; -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; @@ -55,7 +55,7 @@ Use boolean `block` prop to quickly enable a full width block button ```jsx import { DISPLAY } from '../../../helpers/constants/design-system'; -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; Default Button Block Button @@ -77,7 +77,7 @@ Button `as` options: ```jsx -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; Button Element @@ -95,7 +95,7 @@ When an `href` prop is passed it will change the element to an anchor(`a`) tag. ```jsx -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; Anchor Element; ``` @@ -109,7 +109,7 @@ Use the boolean `disabled` prop to disable button ```jsx -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; Disabled Button; ``` @@ -123,21 +123,21 @@ Use the boolean `loading` prop to set loading spinner ```jsx -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; Loading Button; ``` ### Icon -Use the `icon` prop and the `ICON_NAMES` object from `./ui/components/component-library/icon` to select icon. +Use the `icon` prop and the `ICON_NAMES` object from `./ui/components/component-library` to select icon. ```jsx -import { ButtonBase } from '../ui/component-library'; +import { ButtonBase } from '../../ui/components/component-library'; import { ICON_NAMES } from '../icon'; Button; diff --git a/ui/components/component-library/button-base/button-base.js b/ui/components/component-library/button-base/button-base.js index 85801bb839ce..426b65a311e7 100644 --- a/ui/components/component-library/button-base/button-base.js +++ b/ui/components/component-library/button-base/button-base.js @@ -133,10 +133,6 @@ ButtonBase.propTypes = { * Possible values could be 'SIZES.AUTO', 'SIZES.SM'(32px), 'SIZES.MD'(40px), 'SIZES.LG'(48px), */ size: PropTypes.oneOf(Object.values(BUTTON_BASE_SIZES)), - /** - * Addition style properties to apply to the button. - */ - style: PropTypes.object, /** * ButtonBase accepts all the props from Box */ diff --git a/ui/components/component-library/button-link/README.mdx b/ui/components/component-library/button-link/README.mdx index 2c33d5dad09a..0d51dc036bb4 100644 --- a/ui/components/component-library/button-link/README.mdx +++ b/ui/components/component-library/button-link/README.mdx @@ -35,7 +35,7 @@ Possible sizes include: ```jsx import { SIZES } from '../../../helpers/constants/design-system'; -import { ButtonLink } from '../ui/component-library/button/button-link/button-link'; +import { ButtonLink } from '../../ui/components/component-library'; @@ -52,7 +52,7 @@ Use the `danger` boolean prop to change the `ButtonPrimary` to danger color. ```jsx -import { ButtonLink } from '../ui/component-library/button/button-link/button-link'; +import { ButtonLink } from '../../ui/components/component-library'; Normal Danger @@ -67,7 +67,7 @@ When an `href` is passed the tag element will switch to an `anchor`(`a`) tag. ```jsx -import { ButtonLink } from '../ui/component-library/button/button-link/button-link'; +import { ButtonLink } from '../../ui/components/component-library'; Href Example; ``` diff --git a/ui/components/component-library/button-primary/README.mdx b/ui/components/component-library/button-primary/README.mdx index 372339ea98c9..48f883d8fbc8 100644 --- a/ui/components/component-library/button-primary/README.mdx +++ b/ui/components/component-library/button-primary/README.mdx @@ -34,7 +34,7 @@ Possible sizes include: ```jsx import { SIZES } from '../../../helpers/constants/design-system'; -import { ButtonPrimary } from '../ui/component-library/button/button-primary/button-primary'; +import { ButtonPrimary } from '../../ui/components/component-library'; @@ -50,7 +50,7 @@ Use the `danger` boolean prop to change the `ButtonPrimary` to danger color. ```jsx -import { ButtonPrimary } from '../ui/component-library/button/button-primary/button-primary'; +import { ButtonPrimary } from '../../ui/components/component-library'; Normal Danger diff --git a/ui/components/component-library/button-secondary/README.mdx b/ui/components/component-library/button-secondary/README.mdx index fba6ebb6145c..dc793ced0d5c 100644 --- a/ui/components/component-library/button-secondary/README.mdx +++ b/ui/components/component-library/button-secondary/README.mdx @@ -34,7 +34,7 @@ Possible sizes include: ```jsx import { SIZES } from '../../../helpers/constants/design-system'; -import { ButtonSecondary } from '../ui/component-library/button/button-secondary/button-secondary'; +import { ButtonSecondary } from '../../ui/components/component-library'; @@ -50,7 +50,7 @@ Use the `danger` boolean prop to change the `ButtonPrimary` to danger color. ```jsx -import { ButtonSecondary } from '../ui/component-library/button/button-secondary/button-secondary'; +import { ButtonSecondary } from '../../ui/components/component-library'; Normal Danger diff --git a/ui/components/component-library/component-library-components.scss b/ui/components/component-library/component-library-components.scss index cbc90849f1d9..173f6958ffec 100644 --- a/ui/components/component-library/component-library-components.scss +++ b/ui/components/component-library/component-library-components.scss @@ -1,20 +1,27 @@ -/** Please import your files in alphabetical order **/ +/** +* Please import your styles in order of atomicity. +* The most atomic styles should be imported first. +* This will help improve specificity and reduce the chance of +* unintended overrides. +**/ +// Atoms +@import 'text/text'; +@import 'icon/icon'; +@import 'label/label'; +@import 'tag/tag'; +@import 'base-avatar/base-avatar'; @import 'avatar-account/avatar-account'; @import 'avatar-favicon/avatar-favicon'; @import 'avatar-network/avatar-network'; @import 'avatar-token/avatar-token'; @import 'avatar-with-badge/avatar-with-badge'; -@import 'base-avatar/base-avatar'; @import 'button-base/button-base'; @import 'button-icon/button-icon'; @import 'button-link/button-link'; @import 'button-primary/button-primary'; @import 'button-secondary/button-secondary'; -@import 'icon/icon'; -@import 'label/label'; +// Molecules @import 'picker-network/picker-network'; -@import 'tag/tag'; @import 'tag-url/tag-url'; -@import 'text/text'; @import 'text-field/text-field'; @import 'text-field-base/text-field-base'; diff --git a/ui/components/component-library/help-text/README.mdx b/ui/components/component-library/help-text/README.mdx index b7dcf5b10f35..03c2cf50aade 100644 --- a/ui/components/component-library/help-text/README.mdx +++ b/ui/components/component-library/help-text/README.mdx @@ -26,8 +26,8 @@ The `children` of the `HelpText` can be plain text or react nodes. ```jsx import { SIZES, COLORS } from '../../../helpers/constants/design-system'; -import { Icon, ICON_NAMES } from '../../ui/component-library/icon'; -import { HelpText } from '../../ui/component-library/help-text'; +import { Icon, ICON_NAMES } from '../../ui/components/component-library'; +import { HelpText } from '../../ui/components/component-library'; Plain text @@ -50,7 +50,7 @@ Use the `error` prop to show the `HelpText` in error state. ```jsx -import { HelpText } from '../../ui/component-library/help-text'; +import { HelpText } from '../../ui/components/component-library'; This HelpText in error state; ``` @@ -65,7 +65,7 @@ It may be useful to change the color of the `HelpText`. Use the `color` prop and ```jsx import { COLORS } from '../../../helpers/constants/design-system'; -import { HelpText } from '../../ui/component-library/help-text'; +import { HelpText } from '../../ui/components/component-library'; diff --git a/ui/components/component-library/icon/README.mdx b/ui/components/component-library/icon/README.mdx index 950e2d07b8fa..d18913802c4e 100644 --- a/ui/components/component-library/icon/README.mdx +++ b/ui/components/component-library/icon/README.mdx @@ -23,7 +23,7 @@ Use the `name` prop and the `ICON_NAMES` object to change the icon. Use the [IconSearch](/ui-components-component-library-icon-icon-stories-js--name) story to find the icon you want to use. ```jsx -import { Icon, ICON_NAMES } from '../ui/component-library'; +import { Icon, ICON_NAMES } from '../../ui/components/component-library'; @@ -55,7 +55,7 @@ Possible sizes include: ```jsx import { SIZES } from '../../../helpers/constants/design-system'; -import { Icon, ICON_NAMES } from '../ui/component-library'; +import { Icon, ICON_NAMES } from '../../ui/components/component-library'; @@ -79,7 +79,7 @@ Use the `color` prop and the `COLORS` object from `./ui/helpers/constants/design ```jsx import { COLORS } from '../../../helpers/constants/design-system'; -import { Icon, ICON_NAMES } from '../ui/component-library'; +import { Icon, ICON_NAMES } from '../../ui/components/component-library'; diff --git a/ui/components/component-library/index.js b/ui/components/component-library/index.js new file mode 100644 index 000000000000..6927e233496d --- /dev/null +++ b/ui/components/component-library/index.js @@ -0,0 +1,25 @@ +export { AvatarAccount } from './avatar-account'; +export { AvatarFavicon } from './avatar-favicon'; +export { AvatarNetwork } from './avatar-network'; +export { AvatarToken } from './avatar-token'; +export { AvatarWithBadge } from './avatar-with-badge'; +export { BaseAvatar } from './base-avatar'; +export { Button } from './button'; +export { ButtonBase } from './button-base'; +export { ButtonIcon } from './button-icon'; +export { ButtonLink } from './button-link'; +export { ButtonPrimary } from './button-primary'; +export { ButtonSecondary } from './button-secondary'; +export { HelpText } from './help-text'; +export { Icon, ICON_NAMES } from './icon'; +export { Label } from './label'; +export { PickerNetwork } from './picker-network'; +export { Tag } from './tag'; +export { TagUrl } from './tag-url'; +export { Text } from './text'; +export { TextField } from './text-field'; +export { + TextFieldBase, + TEXT_FIELD_BASE_SIZES, + TEXT_FIELD_BASE_TYPES, +} from './text-field-base'; diff --git a/ui/components/component-library/label/README.mdx b/ui/components/component-library/label/README.mdx index 66868610f3a9..5f83c96d5cc0 100644 --- a/ui/components/component-library/label/README.mdx +++ b/ui/components/component-library/label/README.mdx @@ -26,9 +26,9 @@ The `children` of the label can be text or a react node. ```jsx import { DISPLAY, ALIGN_ITEMS, FLEX_DIRECTION, SIZES, COLORS } from '../../../helpers/constants/design-system'; -import { Icon, ICON_NAMES } from '../../ui/component-library/icon'; -import { Label } from '../../ui/component-library/label'; -import { TextFieldBase } from '../../ui/component-library/text-field-base' +import { Icon, ICON_NAMES } from '../../ui/components/component-library'; +import { Label } from '../../ui/components/component-library'; +import { TextFieldBase } from '../../ui/components/component-library';