index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/system-ui/theme-ui/examples/typography | petrpan-code/system-ui/theme-ui/examples/typography/src/theme.tsx | // @ts-ignore no types
import { toTheme } from 'theme-ui-typography'
import merge from 'lodash.merge'
// @ts-ignore no types
import fairyGates from 'typography-theme-fairy-gates'
const typography = toTheme(fairyGates)
const theme = merge(typography, {
colors: {
text: '#000',
background: '#fff',
primary:... | 7,600 |
0 | petrpan-code/system-ui/theme-ui/examples/typography/src | petrpan-code/system-ui/theme-ui/examples/typography/src/pages/index.mdx | import Layout from '../layout'
export default Layout
# Hello
This is an example of using [Typography.js][] with [Theme UI][].
[typography.js]: https://github.com/KyleAMathews/typography.js
[theme ui]: https://theme-ui.now.sh
[mdx]: https://mdxjs.com
| 7,601 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/color-modes/CHANGELOG.md | # v0.13.0 (Mon Dec 27 2021)
### Release Notes
#### Move Emotion and MDX packages to peerDeps ([#1867](https://github.com/system-ui/theme-ui/pull/1867))
**BREAKING CHANGE:** `@emotion/react` and `@mdx-js/react` were moved to peerDependencies of `theme-ui`, `@theme-ui/mdx` and `@theme-ui/sidenav` and must be installe... | 7,602 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/color-modes/README.md | # @theme-ui/color-modes
Adds support for user-controlled color modes
https://theme-ui.com
**Note:** _This package is included in the main `theme-ui` package, and
generally should not be used on its own._
```sh
npm i @theme-ui/color-modes
```
```jsx
import { ThemeProvider } from '@theme-ui/core'
import { ColorModeP... | 7,603 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/color-modes/package.json | {
"name": "@theme-ui/color-modes",
"version": "0.16.2-develop.0",
"main": "dist/theme-ui-color-modes.cjs.js",
"module": "dist/theme-ui-color-modes.esm.js",
"types": "dist/theme-ui-color-modes.cjs.d.ts",
"source": "src/index.tsx",
"sideEffects": false,
"scripts": {},
"repository": "system-ui/theme-ui",... | 7,604 |
0 | petrpan-code/system-ui/theme-ui/packages/color-modes | petrpan-code/system-ui/theme-ui/packages/color-modes/src/custom-properties.ts | import { ColorMode, ColorModesScale, css, Theme } from '@theme-ui/css'
const toVarName = (key: string) => `--theme-ui-${key.replace('-__default', '')}`
const toVarValue = (key: string) => `var(${toVarName(key)})`
const join = (...args: (string | undefined)[]) => args.filter(Boolean).join('-')
const reservedKeys = ne... | 7,605 |
0 | petrpan-code/system-ui/theme-ui/packages/color-modes | petrpan-code/system-ui/theme-ui/packages/color-modes/src/index.tsx | import React, {
Dispatch,
useEffect,
useLayoutEffect,
useState,
useMemo,
SetStateAction,
useCallback,
} from 'react'
import {
jsx,
ThemeUIContextValue,
useThemeUI,
__ThemeUIInternalBaseThemeProvider as ThemeUIInternalBaseThemeProvider,
} from '@theme-ui/core'
import {
get,
Theme,
ColorModesS... | 7,606 |
0 | petrpan-code/system-ui/theme-ui/packages/color-modes | petrpan-code/system-ui/theme-ui/packages/color-modes/test/custom-properties.tsx | import {
toCustomProperties,
__createColorStyles,
} from '../src/custom-properties'
describe('toCustomProperties', () => {
test('converts theme object to custom properties', () => {
const result = toCustomProperties({
config: {
initialColorModeName: 'light',
},
colors: {
tex... | 7,607 |
0 | petrpan-code/system-ui/theme-ui/packages/color-modes | petrpan-code/system-ui/theme-ui/packages/color-modes/test/index.tsx | /**
* @jest-environment jsdom
*/
import renderer from 'react-test-renderer'
import { render, fireEvent, cleanup, act } from '@testing-library/react'
import { useTheme } from '@emotion/react'
import { matchers } from '@emotion/jest'
import mockConsole from 'jest-mock-console'
import { ThemeProvider, ThemeUIContextValu... | 7,608 |
0 | petrpan-code/system-ui/theme-ui/packages/color-modes/test | petrpan-code/system-ui/theme-ui/packages/color-modes/test/__snapshots__/index.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`InitializeColorMode renders 1`] = `
<script
dangerouslySetInnerHTML={
{
"__html": "(function() { try {
var mode = localStorage.getItem('theme-ui-color-mode');
if (!mode) return
document.documentElement.classList.add('theme-ui-' + mode);
} catch (e) ... | 7,609 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/color/CHANGELOG.md | # v0.13.1 (Wed Jan 05 2022)
#### 🐛 Bug Fix
#### Authors: 4
- [@dependabot[bot]](https://github.com/dependabot[bot])
- Akash ([@appsparkler](https://github.com/appsparkler))
- Lachlan Campbell ([@lachlanjc](https://github.com/lachlanjc))
- Piotr Monwid-Olechnowicz ([@hasparus](https://github.com/hasparus))
---
# ... | 7,610 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/color/README.md | # @theme-ui/color
Color manipulation utilities for Theme UI
```sh
npm i @theme-ui/color
```
Import utilities from the `@theme-ui/color` package and use them with colors in
the `sx` prop.
```js
/** @jsxImportSource theme-ui */
import { darken, lighten } from '@theme-ui/color'
export default (props) => (
<div
... | 7,611 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/color/package.json | {
"name": "@theme-ui/color",
"version": "0.16.2-develop.0",
"source": "src/index.ts",
"main": "dist/theme-ui-color.cjs.js",
"module": "dist/theme-ui-color.esm.js",
"types": "dist/theme-ui-color.cjs.d.ts",
"scripts": {},
"dependencies": {
"@theme-ui/css": "workspace:^",
"polished": "^4.0.5"
},
... | 7,612 |
0 | petrpan-code/system-ui/theme-ui/packages/color | petrpan-code/system-ui/theme-ui/packages/color/src/index.ts | import * as P from 'polished'
import { ColorModesScale, get, Theme } from '@theme-ui/css'
type Color = ColorModesScale[string]
/**
* Get color from theme.colors
*/
export const getColor = (theme: Theme, color: Color) => {
if (typeof color === 'object') {
color = Array.isArray(color)
? color[0]
: (... | 7,613 |
0 | petrpan-code/system-ui/theme-ui/packages/color | petrpan-code/system-ui/theme-ui/packages/color/test/index.tsx | /**
* @jest-environment jsdom
*/
import { Theme, ThemeUICSSObject } from '@theme-ui/css'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import { render } from '@theme-ui/test-utils'
import { matchers } from '@emotion/jest'
import {
darken,
lighten,
rotate,
hue,
saturation,
lightness,
desat... | 7,614 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/components/CHANGELOG.md | # v0.14.4 (Sat Apr 23 2022)
:tada: This release contains work from a new contributor! :tada:
Thank you, kamatte ([@kamatte-me](https://github.com/kamatte-me)), for all your work!
#### 🐛 Bug Fix
- fix: Donut component's `viewBox` svg property [#2209](https://github.com/system-ui/theme-ui/pull/2209) ([@kamatte-me](h... | 7,615 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/components/README.md | # @theme-ui/components
Primitive layout, typographic, and other components for use with Theme UI.
**Note:** _This package is included in the main `theme-ui` package and a
separate installation is not required._
```sh
npm i @theme-ui/components @emotion/react
```
https://theme-ui.com/components
| 7,616 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/components/package.json | {
"name": "@theme-ui/components",
"version": "0.16.2-develop.0",
"main": "dist/theme-ui-components.cjs.js",
"module": "dist/theme-ui-components.esm.js",
"types": "dist/theme-ui-components.cjs.d.ts",
"sideEffects": false,
"scripts": {},
"dependencies": {
"@styled-system/color": "^5.1.2",
"@styled... | 7,617 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Alert.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type AlertProps = BoxProps
/**
* Component for displaying messages, notifications, or other application state.
*
* Alert variants can be defined in `theme.alert... | 7,618 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/AspectImage.tsx | import React from 'react'
import { AspectRatio } from './AspectRatio'
import { Image, ImageProps } from './Image'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export interface AspectImageProps extends ImageProps {
ratio?: number
}
/**
* Image component constrained by as aspect... | 7,619 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/AspectRatio.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export interface AspectRatioProps extends BoxProps {
ratio?: number
}
/**
* Component for maintaining a fluid-width aspect ratio
* @see https://theme-ui.com/component... | 7,620 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Avatar.tsx | import React from 'react'
import { Image, ImageProps } from './Image'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export interface AvatarProps extends ImageProps {
size?: number | string
}
export const Avatar: ForwardRef<HTMLImageElement, AvatarProps> =
React.forwardRef(fun... | 7,621 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Badge.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type BadgeProps = BoxProps
export const Badge: ForwardRef<HTMLDivElement, BadgeProps> = React.forwardRef(
function Badge(props, ref) {
return (
<Box
... | 7,622 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Box.tsx | import {
ArrayInterpolation,
CSSObject,
Interpolation,
jsx,
useTheme,
} from '@emotion/react'
import React, { forwardRef } from 'react'
import {
css,
get,
ThemeUICSSProperties,
ThemeUIStyleObject,
} from '@theme-ui/css'
import type { Assign, ForwardRef } from './types'
import type { __ThemeUIComponent... | 7,623 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Button.tsx | import React from 'react'
import { Box as _Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
const Box = _Box as React.ForwardRefExoticComponent<
BoxProps & React.RefAttributes<HTMLButtonElement>
>
export interface ButtonProps
ext... | 7,624 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Card.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type CardProps = BoxProps
/**
* Card style variants can be defined in the `theme.cards` object.
* By default the Card component uses the `theme.cards.primary` var... | 7,625 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Checkbox.tsx | import React from 'react'
import { Box, BoxOwnProps } from './Box'
import { SVG, SVGProps } from './SVG'
import { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
const CheckboxChecked = (props: SVGProps) => (
<SVG {...props}>
<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.... | 7,626 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Close.tsx | import React from 'react'
import { IconButton, IconButtonProps } from './IconButton'
import type { ForwardRef } from './types'
export const CloseIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="currentColor"
viewBox="0 0 24 24"
>
<path d="M19 6.41L17.59 5 12 10... | 7,627 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Container.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type ContainerProps = BoxProps
/**
* Centered, max-width layout component
*
* Container variants can be defined in the `theme.layout` object.
* The Container c... | 7,628 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Divider.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type DividerProps = BoxProps
/**
* The Divider component reuses styles from `theme.styles.hr` as its default variant.
*/
export const Divider: ForwardRef<HTMLDiv... | 7,629 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Donut.tsx | import React from 'react'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface DonutProps
extends Assign<
Omit<
React.ComponentPropsWithRef<'svg'>,
'opacity' | 'color' | 'css' | 'sx' | 'max' | '... | 7,630 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Embed.tsx | import React, { ComponentPropsWithoutRef } from 'react'
import { Box, BoxOwnProps, __isBoxStyledSystemProp } from './Box'
import { Assign, ForwardRef } from './types'
import { getProps, __internalProps } from './util'
const getContainerProps = getProps(__isBoxStyledSystemProp)
const getIframeProps = getProps((str) =>... | 7,631 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Field.tsx | import React from 'react'
import { Box } from './Box'
import { Label } from './Label'
import { Input, InputProps } from './Input'
import { getMargin, MarginProps, omitMargin } from './util'
export interface FieldOwnProps extends MarginProps {
/**
* Text for Label component
*/
label?: string
/**
* Used ... | 7,632 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Flex.tsx | import React from 'react'
import { Box, BoxOwnProps, BoxProps } from './Box'
import { ForwardRef } from './types'
export type FlexOwnProps = BoxOwnProps
export type FlexProps = BoxProps
/**
* Use the Flex component to create flexbox layouts.
* @see https://theme-ui.com/components/flex
*/
export const Flex: Forward... | 7,633 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Grid.tsx | import type {
ResponsiveStyleValue,
ThemeUICSSObject,
ThemeUIEmpty,
} from '@theme-ui/css'
import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
const px = (n: number | string) => (typeof n === 'number' ? n + 'px' : n)
... | 7,634 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Heading.tsx | import React from 'react'
import { Box, BoxOwnProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface HeadingProps
extends Assign<React.ComponentPropsWithRef<'h2'>, BoxOwnProps> {}
/**
* Primitive heading component, defaults to <h2>.
*
* T... | 7,635 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/IconButton.tsx | import React from 'react'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps, __ThemeUIComponentsInternalProps } from './util'
export interface IconButtonProps
extends Assign<React.ComponentPropsWithRef<'button'>, BoxOwnProps> {
size?: num... | 7,636 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Image.tsx | import React from 'react'
import { Box, BoxOwnProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps, __ThemeUIComponentsInternalProps } from './util'
export interface ImageProps
extends Assign<React.ComponentPropsWithRef<'img'>, BoxOwnProps> {}
/**
* Image style variants ... | 7,637 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Input.tsx | import React from 'react'
import { Box, BoxOwnProps } from './Box'
import { get, ThemeUIStyleObject } from '@theme-ui/css'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
const autofillStyles: ThemeUIStyleObject = {
boxShadow: 'inset 0 0 0 1000px var(--theme-ui-input-autof... | 7,638 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Label.tsx | import React from 'react'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface LabelProps
extends Assign<React.ComponentPropsWithRef<'label'>, BoxOwnProps> {}
/**
* Label variants can be defined in `theme.for... | 7,639 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Link.tsx | import React from 'react'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface LinkProps
extends Assign<React.ComponentPropsWithRef<'a'>, BoxOwnProps> {}
/**
* Link variants can be defined in the `theme.links... | 7,640 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/MenuButton.tsx | import React from 'react'
import { IconButton, IconButtonProps } from './IconButton'
import type { ForwardRef } from './types'
export const MenuIcon = ({ size = 24 }) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={size}
height={size}
fill="currentC... | 7,641 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Message.tsx | import React from 'react'
import { ThemeUICSSObject } from '@theme-ui/css'
import { Box, BoxProps } from './Box'
import { ForwardRef } from './types'
import { __internalProps } from './util'
export type MessageProps = BoxProps
/**
* Styled Box component for callouts and inline messages
*
* Message variants can be... | 7,642 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/NavLink.tsx | import React from 'react'
import type { ThemeUICSSObject } from '@theme-ui/css'
import { Link, LinkProps } from './Link'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type NavLinkProps = LinkProps
/**
* Link component for use in navigation
*
* NavLink variants can be def... | 7,643 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Paragraph.tsx | import React from 'react'
import { Box, BoxOwnProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface ParagraphProps
extends Assign<React.ComponentPropsWithRef<'p'>, BoxOwnProps> {}
/**
* Primitive typographic component.
*
* Text style var... | 7,644 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Progress.tsx | import React from 'react'
import { ThemeUICSSObject } from '@theme-ui/css'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface ProgressProps
extends Assign<React.ComponentPropsWithRef<'progress'>, BoxOwnProps... | 7,645 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Radio.tsx | import React from 'react'
import { Box, BoxOwnProps } from './Box'
import { SVG, SVGProps } from './SVG'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
const RadioChecked = (props: SVGProps) => (
<SVG {...props}>
<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5... | 7,646 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/SVG.tsx | import React, { SVGAttributes } from 'react'
import { Box, BoxOwnProps } from './Box'
import type { Assign, ForwardRef } from './types'
export interface SVGProps
extends Assign<SVGAttributes<SVGElement>, BoxOwnProps> {
size?: number | string
}
export const SVG: ForwardRef<SVGSVGElement, SVGProps> = React.forward... | 7,647 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Select.tsx | import React from 'react'
import { get, ThemeUICSSObject } from '@theme-ui/css'
import { Box, BoxOwnProps, BoxProps } from './Box'
import { SVG, SVGProps } from './SVG'
import { getMargin, omitMargin, __internalProps } from './util'
import { Assign, ForwardRef } from './types'
const DownArrow = (props: SVGProps) => ... | 7,648 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Slider.tsx | import React from 'react'
import { ThemeUICSSObject } from '@theme-ui/css'
import { Box, BoxOwnProps } from './Box'
import { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
const thumbStyle: ThemeUICSSObject = {
appearance: 'none',
width: 16,
height: 16,
bg: 'currentcolor',
bor... | 7,649 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Spinner.tsx | import React from 'react'
import type { ThemeUICSSObject } from '@theme-ui/css'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export interface SpinnerProps
extends Omit<
React.ComponentPropsWithRef<'svg'>,
'opacity' ... | 7,650 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Switch.tsx | import React from 'react'
import type { ThemeUICSSObject } from '@theme-ui/css'
import { Box, BoxOwnProps } from './Box'
import { Label } from './Label'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
const GUTTER = 2
const SIZE = 18
export interface SwitchProps
extends ... | 7,651 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Text.tsx | import React from 'react'
import { Box, BoxProps } from './Box'
import { ForwardRef } from './types'
import { __internalProps } from './util'
export type TextProps = BoxProps
/**
* Primitive typographic component.
*
* Text style variants can be defined in the theme.text object.
* @see https://theme-ui.com/compon... | 7,652 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/Textarea.tsx | import React from 'react'
import { Box, BoxOwnProps, BoxProps } from './Box'
import type { Assign, ForwardRef } from './types'
import { __internalProps } from './util'
export interface TextareaProps
extends Assign<React.ComponentPropsWithRef<'textarea'>, BoxOwnProps> {}
/**
* Form textarea component
*
* Textare... | 7,653 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/index.ts | export * from './Box'
export * from './Flex'
export * from './Grid'
export * from './Button'
export * from './Link'
export * from './Paragraph'
export * from './Text'
export * from './Heading'
export * from './Image'
export * from './Card'
export * from './Label'
export * from './Input'
export * from './Select'
export ... | 7,654 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/types.ts | export type Assign<T, U> = {
[P in keyof (T & U)]: P extends keyof T
? T[P]
: P extends keyof U
? U[P]
: never
}
export interface ForwardRef<T, P>
extends React.ForwardRefExoticComponent<
React.PropsWithoutRef<P> & React.RefAttributes<T>
> {}
| 7,655 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/src/util.ts | import type { ThemeUICSSObject, ThemeUICSSProperties } from '@theme-ui/css'
export const getProps =
(test: (k: string) => boolean) =>
<T extends object>(props: T): T => {
const next: Partial<T> = {}
for (const key in props) {
if (test(key || '')) next[key] = props[key]
}
return next as T
}
... | 7,656 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/Box.spec.tsx | /**
* @jest-environment jsdom
*/
import { renderJSON, render, waitFor } from '@theme-ui/test-utils'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import { Box } from '..'
import { theme } from './__test-utils__'
import { __internalProps } from '../src/util'
describe('Box', () => {
test('renders', ... | 7,657 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/Button.spec.tsx | /**
* @jest-environment jsdom
*/
import { renderJSON } from '@theme-ui/test-utils'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import { Button } from '..'
import { theme } from './__test-utils__'
describe('Button', () => {
test('renders', () => {
const json = renderJSON(
<ThemeUIProvide... | 7,658 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/Flex.spec.tsx | /**
* @jest-environment jsdom
*/
import { render } from '@theme-ui/test-utils'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import { Flex } from '../src/Flex'
test('accepts ref', async () => {
let ref: HTMLElement | null = null
render(
<ThemeUIProvider theme={{}}>
<Flex ref={(r) => (ref... | 7,659 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/Grid.spec.tsx | /**
* @jest-environment jsdom
*/
import { renderJSON } from '@theme-ui/test-utils'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import { Grid } from '..'
import { theme } from './__test-utils__'
describe('Grid', () => {
test('renders', () => {
const json = renderJSON(
<ThemeUIProvider th... | 7,660 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/SVG.spec.tsx | /**
* @jest-environment jsdom
*/
import React from 'react'
import { render } from '@theme-ui/test-utils'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import { SVG } from '../src/SVG'
test('accepts ref', async () => {
let ref: SVGSVGElement | null = null
render(
<ThemeUIProvider theme={{}}>
... | 7,661 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/Switch.spec.tsx | /**
* @jest-environment jsdom
*/
import { ThemeProvider } from '@theme-ui/core'
import { AssertTrue, IsExact, render } from '@theme-ui/test-utils'
import { forwardRef } from 'react'
import { Switch, SwitchProps } from '../src'
describe(Switch.name, () => {
test('accepts forwarded ref', () => {
const CustomSw... | 7,662 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/index.tsx | /**
* @jest-environment jsdom
*/
import React from 'react'
import { renderJSON } from '@theme-ui/test-utils'
import { ThemeUIProvider } from '@theme-ui/theme-provider'
import {
Card,
Flex,
Heading,
Image,
Link,
Paragraph,
Text,
Label,
Input,
Select,
Textarea,
Radio,
Checkbox,
Slider,
Fi... | 7,663 |
0 | petrpan-code/system-ui/theme-ui/packages/components | petrpan-code/system-ui/theme-ui/packages/components/test/types.tsx | /** @jsxRuntime automatic */
/** @jsxImportSource @theme-ui/core */
import { AssertTrue, IsExact } from '@theme-ui/test-utils'
import {
Alert,
AlertProps,
AspectImage,
AspectImageProps,
AspectRatio,
AspectRatioProps,
Avatar,
AvatarProps,
Badge,
BadgeProps,
Box,
BoxProps,
Button,
ButtonProps... | 7,664 |
0 | petrpan-code/system-ui/theme-ui/packages/components/test | petrpan-code/system-ui/theme-ui/packages/components/test/__snapshots__/Box.spec.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Box renders 1`] = `
.emotion-0 {
box-sizing: border-box;
margin: 0;
min-width: 0;
padding: 8px;
}
<div
className="emotion-0"
>
Hello
</div>
`;
| 7,665 |
0 | petrpan-code/system-ui/theme-ui/packages/components/test | petrpan-code/system-ui/theme-ui/packages/components/test/__snapshots__/Button.spec.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Button hidden 1`] = `
.emotion-0 {
box-sizing: border-box;
margin: 0;
min-width: 0;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
text-align: center;
line-height: inherit;
-webkit-text-decoration: none;
... | 7,666 |
0 | petrpan-code/system-ui/theme-ui/packages/components/test | petrpan-code/system-ui/theme-ui/packages/components/test/__snapshots__/Grid.spec.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Grid renders 1`] = `
.emotion-0 {
box-sizing: border-box;
margin: 0;
min-width: 0;
display: grid;
grid-gap: 16px;
}
<div
className="emotion-0"
/>
`;
exports[`Grid renders with columns prop 1`] = `
.emotion-0 {
box-sizing: border-box;
margin: 0;
mi... | 7,667 |
0 | petrpan-code/system-ui/theme-ui/packages/components/test | petrpan-code/system-ui/theme-ui/packages/components/test/__snapshots__/index.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Alert renders 1`] = `
.emotion-0 {
box-sizing: border-box;
margin: 0;
min-width: 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
... | 7,668 |
0 | petrpan-code/system-ui/theme-ui/packages/components/test | petrpan-code/system-ui/theme-ui/packages/components/test/__test-utils__/index.tsx | import { makeTheme } from '@theme-ui/css/utils'
import { matchers } from '@emotion/jest'
expect.extend(matchers)
export const theme = makeTheme({
boxes: {
beep: {
p: 4,
bg: 'highlight',
},
},
cards: {
primary: {
p: 3,
bg: 'muted',
borderRadius: 4,
},
},
buttons... | 7,669 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/core/CHANGELOG.md | # v0.13.0 (Mon Dec 27 2021)
### Release Notes
#### Move Emotion and MDX packages to peerDeps ([#1867](https://github.com/system-ui/theme-ui/pull/1867))
**BREAKING CHANGE:** `@emotion/react` and `@mdx-js/react` were moved to peerDependencies of `theme-ui`, `@theme-ui/mdx` and `@theme-ui/sidenav` and must be installe... | 7,670 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/core/README.md | # @theme-ui/core
[](https://bundlephobia.com/package/@theme-ui/core)
`@theme-ui/core` provides minimal React support for lightweight usage.
```sh
npm i @theme-ui/core @emotion/react
```
## Usage
```js
/** @jsxImportSource @theme... | 7,671 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/core/package.json | {
"name": "@theme-ui/core",
"version": "0.16.2-develop.0",
"source": "src/index.ts",
"main": "dist/theme-ui-core.cjs.js",
"module": "dist/theme-ui-core.esm.js",
"types": "dist/theme-ui-core.cjs.d.ts",
"browser": {
"./dist/theme-ui-core.esm.js": "./dist/theme-ui-core.browser.esm.js"
},
"exports": {... | 7,672 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/jsx-dev-runtime/package.json | {
"name": "@theme-ui/core-jsx-dev-runtime",
"source": "../src/jsx-dev-runtime.ts",
"main": "dist/theme-ui-core-jsx-dev-runtime.cjs.js",
"module": "dist/theme-ui-core-jsx-dev-runtime.esm.js",
"types": "dist/theme-ui-core-jsx-dev-runtime.cjs.d.ts",
"browser": {
"./dist/theme-ui-core-jsx-dev-runtime.esm.js... | 7,673 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/jsx-runtime/package.json | {
"name": "@theme-ui/core-jsx-runtime",
"source": "../src/jsx-runtime.ts",
"main": "dist/theme-ui-core-jsx-runtime.cjs.js",
"module": "dist/theme-ui-core-jsx-runtime.esm.js",
"types": "dist/theme-ui-core-jsx-runtime.cjs.d.ts",
"browser": {
"./dist/theme-ui-core-jsx-runtime.esm.js": "./dist/theme-ui-core... | 7,674 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/src/index.ts | import {
jsx as emotionJsx,
ThemeContext as EmotionContext,
} from '@emotion/react'
import { Theme } from '@theme-ui/css'
import * as React from 'react'
import deepmerge from 'deepmerge'
import packageInfo from '@emotion/react/package.json'
import { parseProps } from './parseProps'
import { ThemeUIJSX } from './js... | 7,675 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/src/jsx-dev-runtime.ts | // @ts-ignore
import { jsxDEV as emotionJsxDEV } from '@emotion/react/jsx-dev-runtime'
import { ThemeUIJSX } from './jsx-namespace'
import { parseProps } from './parseProps'
import type { ElementType } from 'react'
export { Fragment } from 'react'
export type { ThemeUIJSX as JSX } from './jsx-namespace'
export const ... | 7,676 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/src/jsx-namespace.ts | import type { SxProp } from './types'
import type { JSX as ReactJSX } from 'react'
type WithConditionalSxProp<P> = 'className' extends keyof P
? string extends P['className']
? P & SxProp
: P
: P
export declare namespace ThemeUIJSX {
export type Element = ReactJSX.Element
export type ElementType = Rea... | 7,677 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/src/jsx-runtime.ts | import {
// @ts-ignore
jsx as emotionJsx,
// @ts-ignore
jsxs as emotionJsxs,
} from '@emotion/react/jsx-runtime'
import { ThemeUIJSX } from './jsx-namespace'
import { parseProps } from './parseProps'
import type { ElementType } from 'react'
export { Fragment } from 'react'
export type { ThemeUIJSX as JSX } fro... | 7,678 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/src/parseProps.tsx | import { css } from '@theme-ui/css'
const getCSS = (props: any) => (theme: any) => {
const styles = css(props.sx)(theme)
const raw = typeof props.css === 'function' ? props.css(theme) : props.css
return [styles, raw]
}
export function parseProps(props: any) {
if (!props || (!props.sx && !props.css)) return pr... | 7,679 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/src/types.ts | import { Interpolation } from '@emotion/react'
import { ThemeUIStyleObject, Theme as ThemeUITheme } from '@theme-ui/css'
export interface SxProp {
/**
* The sx prop lets you style elements inline, using values from your
* theme.
*
* @see https://theme-ui.com/sx-prop/
*/
sx?: ThemeUIStyleObject
/**... | 7,680 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/test/index.tsx | /**
* @jest-environment jsdom
* @jsxImportSource react
*/
import React from 'react'
import { cleanup } from '@testing-library/react'
import { renderJSON } from '@theme-ui/test-utils'
import { matchers } from '@emotion/jest'
import mockConsole from 'jest-mock-console'
import {
jsx,
__ThemeUIContext,
useThemeUI... | 7,681 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/test/jsx-dev-runtime.ts | /**
* @jest-environment jsdom
*/
import { screen, render } from '@testing-library/react'
import { matchers } from '@emotion/jest'
import { jsxDEV } from '../src/jsx-dev-runtime'
expect.extend(matchers)
describe('automatic JSX dev runtime in @theme-ui/core package', () => {
test('jsxDEV', () => {
const self ... | 7,682 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/test/jsx-runtime.ts | /**
* @jest-environment jsdom
*/
import { screen, render } from '@testing-library/react'
import { matchers } from '@emotion/jest'
import { jsx, jsxs } from '../src/jsx-runtime'
expect.extend(matchers)
describe('automatic JSX runtime in @theme-ui/core package', () => {
test('jsx and jsxs', () => {
render(
... | 7,683 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/test/parseProps.tsx | import { parseProps } from '../src/parseProps'
describe('parseProps', () => {
test('does not touch props if not relevant', () => {
expect(parseProps(null)).toBeNull()
const props1 = {}
expect(parseProps(props1)).toBe(props1)
const props2 = { foo: 'bar', baz: 'qux' }
expect(parseProps(props2)).t... | 7,684 |
0 | petrpan-code/system-ui/theme-ui/packages/core | petrpan-code/system-ui/theme-ui/packages/core/test/react-jsx.tsx | /**
* @jest-environment jsdom
* @jsxImportSource ../src
*/
/* eslint-disable no-lone-blocks */
import { renderJSON, NotHas, Assert, expecter } from '@theme-ui/test-utils'
import { SxProp, ThemeUIJSX } from '../src'
describe('JSX', () => {
test('accepts sx prop', () => {
expect(
renderJSON(
<div... | 7,685 |
0 | petrpan-code/system-ui/theme-ui/packages/core/test | petrpan-code/system-ui/theme-ui/packages/core/test/__snapshots__/index.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ThemeProvider renders 1`] = `
<h1>
Hello
</h1>
`;
exports[`jsx custom pragma handles null props 1`] = `
<h1>
hello
</h1>
`;
| 7,686 |
0 | petrpan-code/system-ui/theme-ui/packages/core/test | petrpan-code/system-ui/theme-ui/packages/core/test/__snapshots__/react-jsx.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`JSX accepts sx prop 1`] = `
.emotion-0 {
margin-top: 10px;
padding-left: 8px;
padding-right: 8px;
scroll-padding-top: 8px;
scroll-padding-bottom: 8px;
}
.emotion-1 {
background-color: primary;
}
<div
className="emotion-0"
>
<input
className="emo... | 7,687 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/css/CHANGELOG.md | # v0.13.1 (Wed Jan 05 2022)
#### 🐛 Bug Fix
- css: Make background a theme-aware property [#2056](https://github.com/system-ui/theme-ui/pull/2056) ([@lachlanjc](https://github.com/lachlanjc))
#### 🏠 Internal
- css: Make background a theme-aware property ([@lachlanjc](https://github.com/lachlanjc))
#### Authors: 4... | 7,688 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/css/README.md | # @theme-ui/css
[](https://bundlephobia.com/package/@theme-ui/css)
`@theme-ui/css` contains the framework-agnostic core logic of Theme UI. It lets
you write style objects with responsive, theme-aware ergonomic shortcuts.
```sh
npm ... | 7,689 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/css/package.json | {
"name": "@theme-ui/css",
"version": "0.16.2-develop.0",
"source": "src/index.ts",
"main": "dist/theme-ui-css.cjs.js",
"module": "dist/theme-ui-css.esm.js",
"browser": {
"./dist/theme-ui-css.esm.js": "./dist/theme-ui-css.browser.esm.js"
},
"exports": {
".": {
"module": {
"browser"... | 7,690 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/src/index.ts | import type {
CSSObject,
ThemeUIStyleObject,
ThemeDerivedStyles,
Theme,
ThemeUICSSObject,
} from './types'
export * from './types'
/**
* Allows for nested scales with shorthand values
* @example
* {
* colors: {
* primary: { __default: '#00f', light: '#33f' }
* }
* }
* css({ color: 'primary' ... | 7,691 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/src/options.ts | export interface ThemeUIConfig {
/**
* Enable/disable custom CSS properties/variables if lower browser
* support is required (for eg. IE 11).
*
* References: https://theme-ui.com/color-modes/#turn-off-custom-properties
*/
useCustomProperties?: boolean
/**
* Provide a value here to enable color ... | 7,692 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/src/types.ts | import * as CSS from 'csstype'
import type { ThemeUIConfig } from './options'
export type { CSSObject } from '@emotion/react'
type StandardCSSProperties = CSS.Properties<number | string>
/**
* Style properties with value of undefined, null or false are ignored.
*/
export type ThemeUIEmpty = undefined | null | fal... | 7,693 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/src/utils.ts | import type { ColorModesScale, Theme, ThemeStyles } from './types'
/**
* Constrained identity function used to constrain user's theme type to Theme
* while preserving its exact type.
*/
export const makeTheme = <T extends Theme>(theme: T): T => theme
/**
* Constrained identity function used to create a styles dic... | 7,694 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/test/errors-and-inference.ts | import { expecter } from '@theme-ui/test-utils'
import { css, get, Theme } from '../src'
const expectSnippet = expecter(`
import { css } from './packages/css/src'
`)
describe('Theme', () => {
test('shows friendly error only on bad property', () => {
expectSnippet(`
css({
bg: 'salmon',
w... | 7,695 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/test/index.ts | import { css, NestedScaleDict, Theme } from '../src'
const theme: Theme = {
colors: {
primary: 'tomato',
secondary: 'cyan',
background: 'white',
text: 'black',
purple: {
__default: 'darkviolet',
100: 'rebeccapurple',
500: 'darkviolet',
900: 'violet',
},
pink: {
... | 7,696 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/test/past-bugs.ts | import { css, Theme, THEME_UI_DEFAULT_KEY } from '..'
// https://github.com/system-ui/theme-ui/issues/1439
describe('theme scales, get and default object property (#1439)', () => {
test('scale with default key works', () => {
const theme: Theme = {
zIndices: {
// the value of THEME_UI_DEFAULT_KEY u... | 7,697 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/test/utils.ts | import { Theme } from '../src'
import { makeColorsScale, makeStyles, makeTheme } from '../src/utils'
import { AssertTrue, expecter, IsExact } from '@theme-ui/test-utils'
const symbolPretendingToBeTheme = Symbol() as Theme
describe(makeTheme, () => {
it('returns input unchanged', () => {
const actual = makeTheme... | 7,698 |
0 | petrpan-code/system-ui/theme-ui/packages/css | petrpan-code/system-ui/theme-ui/packages/css/utils/package.json | {
"main": "dist/theme-ui-css-utils.cjs.js",
"module": "dist/theme-ui-css-utils.esm.js",
"browser": {
"./dist/theme-ui-css-utils.esm.js": "./dist/theme-ui-css-utils.browser.esm.js"
}
}
| 7,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.