├── src ├── elements │ ├── image │ │ ├── index.ts │ │ ├── image.module.scss │ │ ├── image.spec.tsx │ │ └── image.tsx │ ├── label │ │ ├── index.tsx │ │ ├── label.module.scss │ │ ├── label.spec.tsx │ │ └── label.tsx │ ├── link │ │ ├── index.ts │ │ └── link.tsx │ ├── dots-loader │ │ ├── index.ts │ │ ├── dots-loader.tsx │ │ └── dots-loader.module.scss │ ├── icon │ │ ├── index.ts │ │ └── base-icon.tsx │ └── separator │ │ ├── index.tsx │ │ ├── separator.module.scss │ │ ├── separator.tsx │ │ └── separator.spec.tsx ├── input │ ├── error │ │ ├── index.ts │ │ ├── error.module.scss │ │ └── error.tsx │ └── button │ │ ├── index.ts │ │ ├── button.module.scss │ │ ├── button.tsx │ │ └── button.spec.tsx ├── surfaces │ ├── card │ │ ├── index.tsx │ │ ├── card.module.scss │ │ ├── card.spec.tsx │ │ └── card.tsx │ ├── drawer │ │ ├── index.ts │ │ ├── drawer.module.scss │ │ ├── default-placeholder.tsx │ │ └── drawer.tsx │ ├── bedrock │ │ ├── index.ts │ │ └── bedrock.tsx │ ├── click-outside │ │ ├── index.ts │ │ └── click-outside.tsx │ ├── abs-container │ │ ├── containee │ │ │ ├── index.ts │ │ │ ├── positions.module.scss │ │ │ ├── displacement.module.scss │ │ │ └── containee.tsx │ │ ├── container │ │ │ ├── index.ts │ │ │ └── container.tsx │ │ ├── abs-container.module.scss │ │ └── index.ts │ └── background │ │ ├── index.ts │ │ └── background.module.scss ├── geometry │ └── curve-peek │ │ ├── indext.ts │ │ ├── filling.module.scss │ │ └── curve-peek.tsx ├── layout │ ├── grid-component │ │ ├── index.ts │ │ ├── grid.module.scss │ │ ├── grid-template │ │ │ ├── grid-template.module.scss │ │ │ └── index.ts │ │ ├── README.md │ │ └── grid.tsx │ ├── page-frame │ │ ├── index.ts │ │ ├── page-frame.module.scss │ │ └── README.md │ ├── col-span │ │ ├── index.ts │ │ ├── make-spans.ts │ │ ├── col-span.module.scss │ │ └── README.md │ ├── grid-presets │ │ ├── z-grid │ │ │ ├── index.ts │ │ │ └── z-grid.module.scss │ │ └── four-way-grid │ │ │ ├── index.ts │ │ │ └── four-way-grid.module.scss │ ├── _breakpoints.scss │ └── align │ │ ├── README.md │ │ ├── align.module.scss │ │ └── index.ts ├── text │ ├── heading │ │ ├── index.ts │ │ ├── heading.tsx │ │ └── heading.spec.tsx │ ├── muted-text │ │ ├── index.ts │ │ ├── muted-text.module.scss │ │ └── muted-text.tsx │ ├── paragraph │ │ ├── index.tsx │ │ ├── paragraph.module.scss │ │ ├── paragraph.spec.tsx │ │ └── paragraph.tsx │ ├── themed-text │ │ ├── index.ts │ │ ├── themed-text.module.scss │ │ └── themed-text.tsx │ └── text-separator │ │ ├── index.ts │ │ ├── text-separator.module.scss │ │ └── text-separator.tsx ├── effects │ └── ref-tooltip │ │ ├── index.ts │ │ ├── ref-tooltip.module.scss │ │ └── ref-tooltip.tsx ├── react-app-env.d.ts ├── themes │ ├── theme-provider │ │ ├── index.tsx │ │ ├── texts.module.scss │ │ └── theme-provider.tsx │ ├── brand-colors.module.scss │ ├── brand-definition.module.scss │ ├── heading-margin-definition.module.scss │ ├── color-palette │ │ ├── index.ts │ │ └── color-palette.module.scss │ ├── size-definition.module.scss │ ├── shadow-definition.module.scss │ ├── book-font.module.scss │ ├── colors.module.scss │ └── color-definition.module.scss ├── utils │ └── popper-js │ │ ├── ignore-popper-size │ │ ├── index.ts │ │ └── ignore-popper-size.tsx │ │ └── resize-to-match-reference │ │ ├── index.ts │ │ └── resize-to-match-reference.tsx ├── css-components │ ├── pill │ │ ├── pill.module.scss │ │ └── index.ts │ ├── elevation │ │ ├── elevation-height.ts │ │ ├── elevations.module.scss │ │ └── index.ts │ └── roundness │ │ ├── roundness-values.ts │ │ ├── roundness.module.scss │ │ └── index.ts ├── constants │ ├── storage │ │ ├── _storage.module.scss │ │ └── index.ts │ └── sizes.ts ├── setupTests.ts ├── App.test.tsx ├── index.css ├── index.tsx ├── App.tsx ├── App.css ├── logo.svg └── serviceWorker.ts ├── public ├── favicon.ico ├── logo192.png ├── logo512.png ├── robots.txt ├── manifest.json └── index.html ├── docs └── scope-screenshot.png ├── .prettierrc ├── .gitignore ├── tsconfig.json ├── LICENSE ├── package.json ├── README.md └── .bitmap /src/elements/image/index.ts: -------------------------------------------------------------------------------- 1 | export * from './image'; -------------------------------------------------------------------------------- /src/input/error/index.ts: -------------------------------------------------------------------------------- 1 | export * from './error'; 2 | -------------------------------------------------------------------------------- /src/elements/label/index.tsx: -------------------------------------------------------------------------------- 1 | export * from "./label"; 2 | -------------------------------------------------------------------------------- /src/elements/link/index.ts: -------------------------------------------------------------------------------- 1 | export * from './link'; 2 | -------------------------------------------------------------------------------- /src/surfaces/card/index.tsx: -------------------------------------------------------------------------------- 1 | export * from "./card"; 2 | -------------------------------------------------------------------------------- /src/surfaces/drawer/index.ts: -------------------------------------------------------------------------------- 1 | export * from './drawer'; 2 | -------------------------------------------------------------------------------- /src/elements/dots-loader/index.ts: -------------------------------------------------------------------------------- 1 | export * from './dots-loader'; -------------------------------------------------------------------------------- /src/elements/icon/index.ts: -------------------------------------------------------------------------------- 1 | export * from './base-icon'; 2 | -------------------------------------------------------------------------------- /src/geometry/curve-peek/indext.ts: -------------------------------------------------------------------------------- 1 | export * from './curve-peek'; -------------------------------------------------------------------------------- /src/layout/grid-component/index.ts: -------------------------------------------------------------------------------- 1 | export * from './grid'; 2 | -------------------------------------------------------------------------------- /src/surfaces/bedrock/index.ts: -------------------------------------------------------------------------------- 1 | export * from './bedrock'; 2 | -------------------------------------------------------------------------------- /src/text/heading/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./heading"; 2 | 3 | -------------------------------------------------------------------------------- /src/text/muted-text/index.ts: -------------------------------------------------------------------------------- 1 | export * from './muted-text'; 2 | -------------------------------------------------------------------------------- /src/text/paragraph/index.tsx: -------------------------------------------------------------------------------- 1 | export * from './paragraph'; 2 | -------------------------------------------------------------------------------- /src/text/themed-text/index.ts: -------------------------------------------------------------------------------- 1 | export * from './themed-text'; -------------------------------------------------------------------------------- /src/effects/ref-tooltip/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ref-tooltip'; 2 | -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /src/surfaces/click-outside/index.ts: -------------------------------------------------------------------------------- 1 | export * from './click-outside'; -------------------------------------------------------------------------------- /src/text/text-separator/index.ts: -------------------------------------------------------------------------------- 1 | export * from './text-separator'; 2 | -------------------------------------------------------------------------------- /src/elements/separator/index.tsx: -------------------------------------------------------------------------------- 1 | export { Separator } from "./separator"; 2 | -------------------------------------------------------------------------------- /src/surfaces/abs-container/containee/index.ts: -------------------------------------------------------------------------------- 1 | export * from './containee'; 2 | -------------------------------------------------------------------------------- /src/surfaces/abs-container/container/index.ts: -------------------------------------------------------------------------------- 1 | export * from './container'; 2 | -------------------------------------------------------------------------------- /src/themes/theme-provider/index.tsx: -------------------------------------------------------------------------------- 1 | export {Theme} from './theme-provider'; -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teambit/base-ui/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teambit/base-ui/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teambit/base-ui/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/themes/theme-provider/texts.module.scss: -------------------------------------------------------------------------------- 1 | .defaults { 2 | line-height: 1.23; 3 | } -------------------------------------------------------------------------------- /src/input/error/error.module.scss: -------------------------------------------------------------------------------- 1 | .error { 2 | color: var(--error-color, #e62e5c); 3 | } 4 | -------------------------------------------------------------------------------- /src/utils/popper-js/ignore-popper-size/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ignore-popper-size'; 2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/input/button/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './button'; 2 | export * from './button'; 3 | -------------------------------------------------------------------------------- /docs/scope-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teambit/base-ui/HEAD/docs/scope-screenshot.png -------------------------------------------------------------------------------- /src/text/themed-text/themed-text.module.scss: -------------------------------------------------------------------------------- 1 | .themedText { 2 | color: var(--base-color, #6c5ce7); 3 | } -------------------------------------------------------------------------------- /src/utils/popper-js/resize-to-match-reference/index.ts: -------------------------------------------------------------------------------- 1 | export * from './resize-to-match-reference'; 2 | -------------------------------------------------------------------------------- /src/css-components/pill/pill.module.scss: -------------------------------------------------------------------------------- 1 | .pill { 2 | border-radius: 11px / 50%; 3 | overflow: hidden; 4 | } -------------------------------------------------------------------------------- /src/elements/image/image.module.scss: -------------------------------------------------------------------------------- 1 | .image { 2 | 3 | } 4 | 5 | .fullWidth { 6 | width: 100%; 7 | } -------------------------------------------------------------------------------- /src/surfaces/card/card.module.scss: -------------------------------------------------------------------------------- 1 | .card { 2 | padding: 20px; 3 | box-sizing: border-box; 4 | } 5 | -------------------------------------------------------------------------------- /src/text/muted-text/muted-text.module.scss: -------------------------------------------------------------------------------- 1 | .mutedText { 2 | color: var(--text-muted, #6c707c); 3 | } 4 | -------------------------------------------------------------------------------- /src/surfaces/drawer/drawer.module.scss: -------------------------------------------------------------------------------- 1 | .placeholder { 2 | cursor: pointer; 3 | user-select: none; 4 | } 5 | -------------------------------------------------------------------------------- /src/css-components/elevation/elevation-height.ts: -------------------------------------------------------------------------------- 1 | export type ElevationHeight = 'low' | 'medium' | 'high' | 'none'; 2 | -------------------------------------------------------------------------------- /src/css-components/roundness/roundness-values.ts: -------------------------------------------------------------------------------- 1 | export type Roundness = 'sharp' | 'default' | 'medium' | 'circle'; 2 | -------------------------------------------------------------------------------- /src/layout/grid-component/grid.module.scss: -------------------------------------------------------------------------------- 1 | .gridContainer { 2 | display: grid; 3 | grid-gap: 16px 16px; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /src/input/button/button.module.scss: -------------------------------------------------------------------------------- 1 | .vanillaButton { 2 | transition: all 180ms ease-in-out; 3 | 4 | user-select: none; 5 | cursor: pointer; 6 | } 7 | -------------------------------------------------------------------------------- /src/geometry/curve-peek/filling.module.scss: -------------------------------------------------------------------------------- 1 | @import '~@bit/bit.base-ui.theme.colors'; 2 | 3 | .white { 4 | fill: white; 5 | } 6 | 7 | .cloud { 8 | fill: $w20; 9 | } 10 | -------------------------------------------------------------------------------- /src/effects/ref-tooltip/ref-tooltip.module.scss: -------------------------------------------------------------------------------- 1 | .tooltipWrapper { 2 | //provides an 'interactive border' 3 | //where the user can mouse over without losing tooltip 4 | padding: 4px 9px 9px 9px; 5 | } -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "typescript", 3 | "semi": true, 4 | "printWidth": 96, 5 | "useTabs": true, 6 | "tabWidth": 4, 7 | "singleQuote": true, 8 | "trailingComma": "es5", 9 | "jsxBracketSameLine": false 10 | } -------------------------------------------------------------------------------- /src/css-components/elevation/elevations.module.scss: -------------------------------------------------------------------------------- 1 | .low { 2 | box-shadow: var(--shadow-hover-low); 3 | } 4 | .medium { 5 | box-shadow: var(--shadow-hover-medium); 6 | } 7 | .high { 8 | box-shadow: var(--shadow-hover-high); 9 | } -------------------------------------------------------------------------------- /src/layout/page-frame/index.ts: -------------------------------------------------------------------------------- 1 | import styles from './page-frame.module.scss'; 2 | 3 | export const centerColumn = styles.centerColumn; 4 | export const wideColumn = styles.wideColumn; 5 | export const textColumn = styles.textColumn; 6 | -------------------------------------------------------------------------------- /src/css-components/roundness/roundness.module.scss: -------------------------------------------------------------------------------- 1 | .sharp { 2 | border-radius: 2px; 3 | } 4 | 5 | .default { 6 | border-radius: 5px; 7 | } 8 | 9 | .medium { 10 | border-radius: 10px; 11 | } 12 | 13 | .circle { 14 | border-radius: 50%; 15 | } -------------------------------------------------------------------------------- /src/surfaces/abs-container/abs-container.module.scss: -------------------------------------------------------------------------------- 1 | .container { 2 | position: relative; 3 | } 4 | 5 | .containee { 6 | position: absolute; 7 | 8 | visibility: hidden; 9 | [data-open='true'] & { 10 | visibility: visible; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/constants/storage/_storage.module.scss: -------------------------------------------------------------------------------- 1 | $staticStorageUrl: 'https://static.bit.dev'; 2 | // or... uncached for dev: 3 | // $staticStorageUrl: 'https://storage.cloud.google.com/static.bit.dev'; 4 | 5 | :export { 6 | staticStorageUrl: $staticStorageUrl 7 | } -------------------------------------------------------------------------------- /src/surfaces/abs-container/index.ts: -------------------------------------------------------------------------------- 1 | import styles from './abs-container.module.scss'; 2 | 3 | export * from './containee'; 4 | export * from './container'; 5 | 6 | export const containerClass = styles.container; 7 | export const containeeClass = styles.containee; -------------------------------------------------------------------------------- /src/themes/brand-colors.module.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Sass variables for brands we use in the page. 3 | * ```scss 4 | * $twitter: #1da1f2; 5 | * $slack: #4a154b; 6 | * $github: #2b2b2b; 7 | * ``` 8 | */ 9 | 10 | $twitter: #1da1f2; 11 | $slack: #4a154b; 12 | $github: #2b2b2b; -------------------------------------------------------------------------------- /src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /src/elements/separator/separator.module.scss: -------------------------------------------------------------------------------- 1 | .separator { 2 | border-bottom: 1px solid var(--separator-color, #ededed); 3 | width: 100%; 4 | } 5 | 6 | .vertical { 7 | width: 1px; 8 | height: 100%; 9 | border-bottom-width: 0px; 10 | border-right: 1px solid var(--separator-color, #ededed); 11 | } -------------------------------------------------------------------------------- /src/themes/brand-definition.module.scss: -------------------------------------------------------------------------------- 1 | @import "./colors.module.scss"; 2 | 3 | /** 4 | * css variables definition, for brand colors. 5 | * @example 6 | *
{children}
7 | */ 8 | 9 | .brands { 10 | --github-bg: #2b2b2b; 11 | --brand-text: #{$w10}; 12 | --slack-bg: #4a154b; 13 | --twitter-bg: #1da1f2; 14 | } -------------------------------------------------------------------------------- /src/text/text-separator/text-separator.module.scss: -------------------------------------------------------------------------------- 1 | .textSeparator { 2 | display: flex; 3 | align-items: center; 4 | } 5 | 6 | .line { 7 | flex: 1 1 100%; 8 | border-bottom: 2px dashed var(--separator-color, #ededed); 9 | 10 | &:first-child { 11 | margin-right: 11px; 12 | } 13 | 14 | &:last-child { 15 | margin-left: 11px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/layout/page-frame/page-frame.module.scss: -------------------------------------------------------------------------------- 1 | .centerColumn { 2 | width: calc(100% - 40px); 3 | max-width: 1000px; 4 | margin-right: auto; 5 | margin-left: auto; 6 | } 7 | 8 | .wideColumn { 9 | width: calc(100% - 40px); 10 | max-width: 1440px; 11 | margin-right: auto; 12 | margin-left: auto; 13 | } 14 | 15 | .textColumn { 16 | max-width: 700px; 17 | } -------------------------------------------------------------------------------- /src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import { expect } from 'chai'; 4 | 5 | import App from './App'; 6 | 7 | test('renders learn react link', () => { 8 | const { getByText } = render(); 9 | const linkElement = getByText(/learn react/i); 10 | expect(linkElement).that.exist; 11 | }); 12 | -------------------------------------------------------------------------------- /src/constants/sizes.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Preset sizes enum, used across the application 4 | * @name PossibleSizes 5 | * @example 6 | * 7 | */ 8 | 9 | export enum PossibleSizes { 10 | xxs = "xxs", 11 | xs = "xs", 12 | sm = "sm", 13 | md = "md", 14 | lg = "lg", 15 | xl = "xl", 16 | xxl = "xxl" 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/css-components/roundness/index.ts: -------------------------------------------------------------------------------- 1 | import styles from './roundness.module.scss'; 2 | import { Roundness } from './roundness-values'; 3 | export * from './roundness-values'; 4 | 5 | export const roundnessClass: { [key in Roundness]: string } = { 6 | circle: styles.circle, 7 | default: styles.default, 8 | medium: styles.medium, 9 | sharp: styles.sharp, 10 | }; 11 | -------------------------------------------------------------------------------- /src/surfaces/bedrock/bedrock.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import classNames from 'classnames'; 3 | import { backgrounds } from '../background'; 4 | 5 | type BedrockProps = React.HTMLAttributes; 6 | 7 | export function Bedrock(props: BedrockProps) { 8 | return
; 9 | } 10 | -------------------------------------------------------------------------------- /src/css-components/elevation/index.ts: -------------------------------------------------------------------------------- 1 | import { ElevationHeight } from './elevation-height'; 2 | import styles from './elevations.module.scss'; 3 | export * from './elevation-height'; 4 | 5 | export const elevationClass: { [key in ElevationHeight]: string | undefined } = { 6 | low: styles.low, 7 | medium: styles.medium, 8 | high: styles.high, 9 | none: undefined, 10 | }; 11 | -------------------------------------------------------------------------------- /src/layout/col-span/index.ts: -------------------------------------------------------------------------------- 1 | import { makeSpans } from './make-spans'; 2 | 3 | export const colSpan = makeSpans(); 4 | export const colSpanXs = makeSpans('xs'); 5 | export const colSpanSm = makeSpans('sm'); 6 | export const colSpanMd = makeSpans('md'); 7 | export const colSpanL = makeSpans('l'); 8 | export const colSpanLg = makeSpans('lg'); 9 | export const colSpanXl = makeSpans('xl'); 10 | -------------------------------------------------------------------------------- /src/surfaces/background/index.ts: -------------------------------------------------------------------------------- 1 | import styles from './background.module.scss'; 2 | 3 | type BackgroundLayer = 'bedrock' | 'base' | 'layer' | 'crust' | 'topping' | 'dent'; 4 | 5 | export const backgrounds: { [key in BackgroundLayer]: string } = { 6 | bedrock: styles.bedrock, 7 | base: styles.base, 8 | layer: styles.layer, 9 | crust: styles.crust, 10 | topping: styles.topping, 11 | dent: styles.dent, 12 | }; 13 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/surfaces/drawer/default-placeholder.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import classNames from 'classnames'; 3 | import styles from './drawer.module.scss'; 4 | 5 | export type DrawerPlaceholderProps = React.HTMLAttributes; 6 | 7 | export function DefaultPlaceholder(props: DrawerPlaceholderProps) { 8 | return ( 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/constants/storage/index.ts: -------------------------------------------------------------------------------- 1 | import definitions from './_storage.module.scss'; 2 | 3 | /** 4 | * Provides constant url for images CDN. 5 | * @example 6 | * //in ts/js file: 7 | * 8 | * @example 9 | * //in scss file: 10 | * background-image: url($staticStorageUrl + '/some/image.svg'); 11 | */ 12 | 13 | export const staticStorageUrl = definitions.staticStorageUrl.replace(/["']/g, ''); 14 | -------------------------------------------------------------------------------- /src/css-components/pill/index.ts: -------------------------------------------------------------------------------- 1 | import styles from './pill.module.scss'; 2 | 3 | /** 4 | * Tried and tested pure css pill component. 5 | * Add border-radius to dom elements in a safe and predicable way. 6 | * The component also inclues `overflow: hidden` to prevent artifacts and border issues when zoomed out. 7 | * 8 | * @example 9 | *
this is a pill
10 | */ 11 | export const pillClass = styles.pill; 12 | -------------------------------------------------------------------------------- /src/elements/label/label.module.scss: -------------------------------------------------------------------------------- 1 | .label { 2 | display: flex; 3 | 4 | justify-content: center; 5 | align-items: center; 6 | 7 | border-radius: 6px; 8 | max-width: var(--primary-label-width, 50px); 9 | width: 100%; 10 | height: var(--primary-label-height, 30px); 11 | padding: 0 15px; 12 | 13 | font-size: 12px; 14 | font-weight: bold; 15 | 16 | background-color: var(--base-color, #6c5ce7); 17 | color: var(--primary-label-text, white); 18 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # bit 9 | dist 10 | 11 | # testing 12 | /coverage 13 | 14 | # production 15 | /build 16 | 17 | # misc 18 | .DS_Store 19 | .env.local 20 | .env.development.local 21 | .env.test.local 22 | .env.production.local 23 | 24 | yarn.lock 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | -------------------------------------------------------------------------------- /src/text/paragraph/paragraph.module.scss: -------------------------------------------------------------------------------- 1 | // font sizes only! 2 | 3 | .xxs { 4 | font-size: var(--p-xxs, 12px); 5 | } 6 | 7 | .xs { 8 | font-size: var(--p-xs, 14px); 9 | } 10 | 11 | .sm { 12 | font-size: var(--p-sm, 15px); 13 | } 14 | 15 | .md { 16 | font-size: var(--p-md, 16px); 17 | } 18 | 19 | .lg { 20 | font-size: var(--p-lg, 18px); 21 | } 22 | 23 | .xl { 24 | font-size: var(--p-xl, 20px); 25 | } 26 | 27 | .xxl { 28 | font-size: var(--p-xxl, 24px); 29 | } -------------------------------------------------------------------------------- /src/surfaces/abs-container/container/container.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import cn from 'classnames'; 3 | import styles from '../abs-container.module.scss'; 4 | 5 | export type ContainerProps = { open?: boolean } & React.HTMLAttributes; 6 | 7 | export function Container(props: ContainerProps) { 8 | const { className, open, ...rest } = props; 9 | 10 | return
; 11 | } 12 | -------------------------------------------------------------------------------- /src/surfaces/background/background.module.scss: -------------------------------------------------------------------------------- 1 | .bedrock { 2 | background: var(--bg-bedrock); 3 | } 4 | 5 | .base { 6 | background: var(--bg-base); 7 | } 8 | 9 | .layer { 10 | background: var(--bg-layer); 11 | } 12 | 13 | .crust { 14 | background: var(--bg-crust); 15 | } 16 | 17 | .topping { 18 | background: var(--bg-topping); 19 | &:hover { 20 | background: var(--bg-topping-highlight); 21 | } 22 | } 23 | 24 | .dent { 25 | background: var(--bg-dent); 26 | } 27 | -------------------------------------------------------------------------------- /src/elements/dots-loader/dots-loader.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import classNames from 'classnames'; 3 | 4 | import styles from './dots-loader.module.scss'; 5 | 6 | type LoaderProps = React.HTMLAttributes; 7 | 8 | export function DotsLoader({ className, ...rest }: LoaderProps) { 9 | return ( 10 | 11 | 12 | 13 | 14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/layout/col-span/make-spans.ts: -------------------------------------------------------------------------------- 1 | import styles from './col-span.module.scss'; 2 | 3 | type ColSpans = { 4 | 1: string; 5 | 2: string; 6 | 3: string; 7 | 4: string; 8 | 5: string; 9 | 6: string; 10 | 7: string; 11 | 8: string; 12 | 9: string; 13 | 10: string; 14 | 11: string; 15 | 12: string; 16 | }; 17 | 18 | export function makeSpans(breakPoints: string = ''): ColSpans { 19 | const obj: any = {}; 20 | 21 | for (var i = 1; i <= 12; i++) { 22 | obj[i] = styles[`colSpan--${breakPoints}-${i}`]; 23 | } 24 | 25 | return obj; 26 | } 27 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want your app to work offline and load faster, you can change 15 | // unregister() to register() below. Note this comes with some pitfalls. 16 | // Learn more about service workers: https://bit.ly/CRA-PWA 17 | serviceWorker.unregister(); 18 | -------------------------------------------------------------------------------- /src/input/error/error.tsx: -------------------------------------------------------------------------------- 1 | import React, { HTMLAttributes } from 'react'; 2 | import classNames from 'classnames'; 3 | import styles from './error.module.scss'; 4 | 5 | /** 6 | * Shows an error message. Avoids rendering when prop `children` is empty.
7 | * 8 | * Uses error color from css variable `--error-color` 9 | * @name Error 10 | */ 11 | export function Error(props: HTMLAttributes) { 12 | const { className, children, ...rest } = props; 13 | if (!children) return null; 14 | 15 | return
{children}
; 16 | } 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/themes/heading-margin-definition.module.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Margin css-variables definitions for headlines. 3 | * - `--h1Margin: 20px;` 4 | * - `--h2Margin: 20px;` 5 | * - `--h3Margin: 20px;` 6 | * - `--h4Margin: 8px;` 7 | * - `--h5Margin: 8px;` 8 | * - `--h6Margin: 8px;` 9 | * - `--h7Margin: 8px;` 10 | * 11 | * To use, add class `headingMargins` to your root component. 12 | */ 13 | 14 | .headingMargins { 15 | --h1Margin: 20px; 16 | --h2Margin: 20px; 17 | --h3Margin: 20px; 18 | --h4Margin: 8px; 19 | --h5Margin: 8px; 20 | --h6Margin: 8px; 21 | --h7Margin: 8px; 22 | } -------------------------------------------------------------------------------- /src/elements/dots-loader/dots-loader.module.scss: -------------------------------------------------------------------------------- 1 | $blinkMs: 185ms; 2 | $exaggeratedMs: 1270ms; 3 | 4 | .dotsLoader { 5 | letter-spacing: 0.6em; 6 | text-indent: 0.6em; 7 | 8 | > * { 9 | animation: $exaggeratedMs infinite ease-in-out both; 10 | animation-name: scale-down; 11 | display: inline-block; 12 | 13 | &:nth-child(1) { 14 | animation-delay: -$blinkMs * 2; 15 | } 16 | &:nth-child(2) { 17 | animation-delay: -$blinkMs; 18 | } 19 | } 20 | } 21 | 22 | @keyframes scale-down { 23 | 0%, 24 | 20%, 25 | 100% { 26 | transform: scale(0); 27 | } 28 | 29 | 60% { 30 | transform: scale(1); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/layout/col-span/col-span.module.scss: -------------------------------------------------------------------------------- 1 | @import '../_breakpoints.scss'; 2 | 3 | $breakpoints: //name val 4 | xs $br-xs, 5 | sm $br-sm, 6 | md $br-md, 7 | l $br-l, 8 | lg $br-lg, 9 | // lg $br-lg, 10 | xl $br-xl; 11 | 12 | 13 | @for $i from 1 through 12 { 14 | @each $breakpoint in $breakpoints { 15 | $brName: nth($breakpoint, 1); 16 | $brVal: nth($breakpoint, 2); 17 | 18 | @media only screen and (min-width: $brVal) { 19 | .colSpan { 20 | &--#{$brName}-#{$i} { 21 | grid-column-end: span $i; 22 | } 23 | } 24 | } 25 | } 26 | 27 | .colSpan { 28 | &---#{$i} { 29 | grid-column-end: span $i; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | 5 | function App() { 6 | return ( 7 |
8 |
9 | logo 10 |

11 | Edit src/App.tsx and save to reload. 12 |

13 | 19 | Learn React 20 | 21 |
22 |
23 | ); 24 | } 25 | 26 | export default App; 27 | -------------------------------------------------------------------------------- /src/elements/label/label.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import { expect } from 'chai'; 4 | 5 | import { Label } from './label'; 6 | 7 | it('should render correct text in Label', () => { 8 | const { getByText } = render(); 9 | const rendered = getByText('label'); 10 | expect(rendered).to.exist; 11 | }); 12 | 13 | it('should apply background color', () => { 14 | const { getByText } = render(); 15 | const rendered = getByText('label'); 16 | 17 | const styles = window.getComputedStyle(rendered); 18 | 19 | expect(styles.background).to.equal('blue'); 20 | }); 21 | -------------------------------------------------------------------------------- /src/surfaces/card/card.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { render } from "@testing-library/react"; 3 | import { expect } from "chai"; 4 | 5 | import { Card } from "./card"; 6 | 7 | it("should render default card", () => { 8 | const { getByText } = render(base Card); 9 | const rendered = getByText("base Card"); 10 | expect(rendered).to.exist; 11 | }); 12 | 13 | // it("should render card with high elevation", () => { 14 | // const { getByText } = render(base Card); 15 | // const rendered = getByText("base Card"); 16 | // expect(rendered.classList.contains('elevation-high')).to.equal(true); 17 | // }); 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Bit - Distributed code component manager. 2 | 3 | Copyright (C) 2017 Cocycles LTD. 4 | 5 | Can be contacted at: team@bit.dev 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. -------------------------------------------------------------------------------- /src/layout/grid-component/grid-template/grid-template.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../_breakpoints.scss'; 2 | 3 | $breakpoints: //name val 4 | xs $br-xs, 5 | sm $br-sm, 6 | md $br-md, 7 | l $br-l, 8 | lg $br-lg, 9 | // lg $br-lg, 10 | xl $br-xl; 11 | 12 | 13 | @for $i from 1 through 12 { 14 | @each $breakpoint in $breakpoints { 15 | $brName: nth($breakpoint, 1); 16 | $brVal: nth($breakpoint, 2); 17 | 18 | @media only screen and (min-width: $brVal) { 19 | .colTemplate { 20 | &--#{$brName}-#{$i} { 21 | grid-template-columns: repeat($i, 1fr); 22 | } 23 | } 24 | } 25 | } 26 | 27 | .colTemplate { 28 | &--all-#{$i} { 29 | grid-template-columns: repeat($i, 1fr); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/themes/color-palette/index.ts: -------------------------------------------------------------------------------- 1 | import colorStyles from './color-palette.module.scss'; 2 | 3 | /** 4 | * Sets the `--base-color` and `--base-highlight` for the specific use case.
5 | * Effects the color of many elements, such as `` and ` 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/effects/ref-tooltip/ref-tooltip.tsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import classNames from 'classnames'; 3 | import { createPopper, Instance, Options } from '@popperjs/core'; 4 | //@ts-ignore 5 | import createRef from 'react-create-ref'; 6 | 7 | import styles from './ref-tooltip.module.scss'; 8 | 9 | export type RefTooltipProps = { 10 | /** dom element to attach to */ 11 | targetElement?: HTMLElement, 12 | /** options for the underlying Popper.js position engine */ 13 | popperOptions?: Partial, 14 | /** Actively recalculate position, to support moving elements */ 15 | motionTracking?: boolean, 16 | } & React.HTMLAttributes; 17 | 18 | /** 19 | * A [Popper.js](https://popper.js.org/) react wrapper that repositions children to be adjacent to a target element. 20 | * This component is a container only, with no visual styling. 21 | * 22 | * @example 23 | * 24 | * I will show up next to the element! 25 | * 26 | */ 27 | export class RefTooltip extends Component { 28 | ref: any = createRef(); 29 | popperInstance: Instance | undefined; 30 | 31 | componentWillUnmount() { 32 | this.destroy(); 33 | } 34 | 35 | componentDidUpdate(prevProps: RefTooltipProps) { 36 | const nextProps = this.props; 37 | 38 | if (prevProps.targetElement !== nextProps.targetElement) { 39 | this.reposition(nextProps.targetElement); 40 | } 41 | } 42 | 43 | reposition = (targetElement?: HTMLElement) => { 44 | const { popperOptions = popperDefaultOptions } = this.props; 45 | const popperElement = this.ref.current; 46 | 47 | if (!targetElement) { 48 | this.destroy(); 49 | } 50 | 51 | if (!targetElement || !popperElement) return; 52 | 53 | this.popperInstance = createPopper(targetElement, popperElement, popperOptions); 54 | 55 | window.requestAnimationFrame(this.step); 56 | }; 57 | 58 | private step = () => { 59 | if (!this.popperInstance || !this.props.motionTracking) return; 60 | 61 | this.popperInstance.update(); 62 | window.requestAnimationFrame(this.step); 63 | }; 64 | 65 | destroy = () => { 66 | if (!this.popperInstance) return; 67 | 68 | this.popperInstance.destroy(); 69 | this.popperInstance = undefined; 70 | }; 71 | 72 | render() { 73 | const { className, targetElement, popperOptions, motionTracking, ...rest } = this.props; 74 | return ( 75 |
81 | ); 82 | } 83 | } 84 | 85 | const popperDefaultOptions: Partial = { 86 | placement: 'top', 87 | modifiers: [ 88 | { 89 | name: 'flip', 90 | enabled: false, 91 | }, 92 | ], 93 | }; 94 | -------------------------------------------------------------------------------- /src/input/button/button.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, fireEvent, waitForElementToBeRemoved } from '@testing-library/react'; 3 | import { expect } from 'chai'; 4 | import { fake } from 'sinon'; 5 | 6 | import Button from './button'; 7 | 8 | const testLoader = loading...; 9 | 10 | it('should render with children', () => { 11 | const { getByText } = render(); 12 | const rendered = getByText('actual button'); 13 | expect(rendered).to.exist; 14 | }); 15 | 16 | it('should trigger onClick', () => { 17 | const onClick = fake(); 18 | const { getByText } = render(); 19 | const rendered = getByText('actual button'); 20 | 21 | //could use userEvents.click(), in @testing-library/user-event 22 | fireEvent.click(rendered); 23 | 24 | expect(onClick.called).to.be.true; 25 | }); 26 | 27 | it('should remove loader after onClick has been resolved', async () => { 28 | let resolveClick = () => {}; 29 | const onClick = () => new Promise(res => (resolveClick = res)); 30 | const { getByTestId, queryByTestId } = render( 31 | ); 67 | 68 | expect(queryByText('actual children')).not.to.exist; 69 | }); 70 | 71 | it('should remove loader when changing loading back to ={false}', () => { 72 | const { queryByTestId, rerender } = render(