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/geist-org/geist-ui/components/radio | petrpan-code/geist-org/geist-ui/components/radio/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Radio } from 'components'
import { nativeEvent } from 'tests/utils'
describe('Radio', () => {
it('should render correctly', () => {
const wrapper = mount(<Radio checked={false}>Option</Radio>)
expect(wrapper.html()).toMatchSnapshot()
expec... | 2,700 |
0 | petrpan-code/geist-org/geist-ui/components/radio/__tests__ | petrpan-code/geist-org/geist-ui/components/radio/__tests__/__snapshots__/group.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Radio Group should render correctly 1`] = `
"<div><div class=\\"radio-group\\"><div class=\\"radio\\"><label><input type=\\"radio\\" value=\\"1\\"><span class=\\"name\\"><span class=\\"point active\\"></span>1</span></label><style>
input {
opacity: ... | 2,701 |
0 | petrpan-code/geist-org/geist-ui/components/radio/__tests__ | petrpan-code/geist-org/geist-ui/components/radio/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Radio should render correctly 1`] = `
"<div class=\\"radio\\"><label><input type=\\"radio\\" value=\\"\\"><span class=\\"name\\"><span class=\\"point\\"></span>Option</span></label><style>
input {
opacity: 0;
visibility: hidden;
... | 2,702 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/rating/index.ts | import Rating from './rating'
export type { RatingProps, RatingTypes, RatingCount, RatingValue } from './rating'
export default Rating
| 2,703 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/rating/rating-icon.tsx | import React from 'react'
const RatingIcon: React.FC<unknown> = () => {
return (
<svg
viewBox="0 0 24 24"
width="24"
height="24"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="geometricPrecisio... | 2,704 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/rating/rating.tsx | import React, { useEffect, useMemo, useState } from 'react'
import { GeistUIThemesPalette } from '../themes'
import { NormalTypes, tupleNumber } from '../utils/prop-types'
import RatingIcon from './rating-icon'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
import useClasses from... | 2,705 |
0 | petrpan-code/geist-org/geist-ui/components/rating | petrpan-code/geist-org/geist-ui/components/rating/__tests__/index.test.tsx | import React, { useState } from 'react'
import { Rating } from 'components'
import { mount } from 'enzyme'
import { nativeEvent } from 'tests/utils'
describe('Rating', () => {
it('should render correctly', () => {
const wrapper = mount(<Rating />)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wra... | 2,706 |
0 | petrpan-code/geist-org/geist-ui/components/rating/__tests__ | petrpan-code/geist-org/geist-ui/components/rating/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Rating should render correctly 1`] = `
"<div class=\\"rating\\"><div class=\\"icon-box hovered\\"><svg viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" stroke=\\"currentColor\\" stroke-width=\\"1.5\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" fill=... | 2,707 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/row/index.ts | import Row from './row'
export type { RowProps } from './row'
export default Row
| 2,708 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/row/row.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
type Justify = 'start' | 'end' | 'center' | 'space-around' | 'space-between'
type Align = 'top' | 'middle' | 'bottom'
interface Props {
gap?: number
justify?: Justify
align?: Align
component?: keyof JSX.IntrinsicElements
className?: ... | 2,709 |
0 | petrpan-code/geist-org/geist-ui/components/row | petrpan-code/geist-org/geist-ui/components/row/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import Row from '../index'
import Col from '../../col'
describe('Row', () => {
it('should render correctly', () => {
const wrapper = mount(<Row>row</Row>)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
... | 2,710 |
0 | petrpan-code/geist-org/geist-ui/components/row/__tests__ | petrpan-code/geist-org/geist-ui/components/row/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Row should render correctly 1`] = `
"<div class=\\"row \\">row<style>
.row {
display: flex;
position: relative;
box-sizing: border-box;
margin-left: calc(0 * 16pt / 2);
margin-right: calc(0 * 16pt / 2);
... | 2,711 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/index.ts | import Select from './select'
import SelectOption from './select-option'
export type SelectComponentType = typeof Select & {
Option: typeof SelectOption
}
;(Select as SelectComponentType).Option = SelectOption
export type { SelectProps, SelectTypes, SelectRef } from './select'
export type { SelectOptionProps } from... | 2,712 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-context.ts | import React, { MutableRefObject } from 'react'
export interface SelectConfig {
value?: string | string[]
updateValue?: (next: string | undefined) => unknown
visible?: boolean
updateVisible?: (next: boolean) => unknown
disableAll?: boolean
ref?: MutableRefObject<HTMLElement | null>
}
const defaultContext ... | 2,713 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-dropdown.tsx | import React, { CSSProperties, useImperativeHandle, useRef } from 'react'
import useTheme from '../use-theme'
import { useSelectContext } from './select-context'
import Dropdown from '../shared/dropdown'
import useClasses from '../use-classes'
interface Props {
visible: boolean
className?: string
dropdownStyle?:... | 2,714 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-icon-clear.tsx | import React from 'react'
import useTheme from '../use-theme'
interface Props {
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void
}
const SelectIconClear: React.FC<Props> = ({ onClick }) => {
const theme = useTheme()
const clickHandler = (event: React.MouseEvent<HTMLDivElement>) => {
event.prevent... | 2,715 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-icon.tsx | import React from 'react'
const SelectIconComponent: React.FC<unknown> = () => {
return (
<svg
viewBox="0 0 24 24"
strokeWidth="1"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="geometricPrecision">
<path d="M6 9l6 6 6-6" />
<style jsx>{`
... | 2,716 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-input.tsx | import React, { useEffect, useImperativeHandle, useRef } from 'react'
export type SelectInputProps = {
visible: boolean
onBlur: () => void
onFocus: () => void
}
const SelectInput = React.forwardRef<HTMLInputElement | null, SelectInputProps>(
({ visible, onBlur, onFocus }, inputRef) => {
const ref = useRef... | 2,717 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-multiple-value.tsx | import React from 'react'
import useTheme from '../use-theme'
import Grid from '../grid'
import SelectClearIcon from './select-icon-clear'
interface Props {
disabled: boolean
onClear: (() => void) | null
}
const SelectMultipleValue: React.FC<React.PropsWithChildren<Props>> = ({
disabled,
onClear,
children,
... | 2,718 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select-option.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { useSelectContext } from './select-context'
import useWarning from '../utils/use-warning'
import Ellipsis from '../shared/ellipsis'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Pro... | 2,719 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/select.tsx | import React, {
CSSProperties,
useEffect,
useImperativeHandle,
useMemo,
useRef,
useState,
} from 'react'
import { NormalTypes } from '../utils/prop-types'
import useTheme from '../use-theme'
import useCurrentState from '../utils/use-current-state'
import { pickChildByProps } from '../utils/collections'
impo... | 2,720 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/select/styles.ts | import { NormalTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
export type SelectColor = {
border: string
borderActive: string
iconBorder: string
placeholderColor: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): Select... | 2,721 |
0 | petrpan-code/geist-org/geist-ui/components/select | petrpan-code/geist-org/geist-ui/components/select/__tests__/events.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Select } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
describe('Select Events', () => {
let container: HTMLDivElement
beforeEach(() => {
container = document.createElement('div')
document.body.append(container)... | 2,722 |
0 | petrpan-code/geist-org/geist-ui/components/select | petrpan-code/geist-org/geist-ui/components/select/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Select } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
describe('Select', () => {
it('should render correctly', () => {
const wrapper = mount(
<div>
<Select />
<Select scale={2} />
<... | 2,723 |
0 | petrpan-code/geist-org/geist-ui/components/select | petrpan-code/geist-org/geist-ui/components/select/__tests__/multiple.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Select } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
describe('Select Multiple', () => {
it('should render correctly', () => {
const wrapper = mount(
<Select multiple>
<Select.Option value="1">1</Select... | 2,724 |
0 | petrpan-code/geist-org/geist-ui/components/select/__tests__ | petrpan-code/geist-org/geist-ui/components/select/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Select should render correctly 1`] = `
"<div><div class=\\"select\\"><input type=\\"search\\" role=\\"combobox\\" aria-haspopup=\\"listbox\\" readonly=\\"\\" unselectable=\\"on\\" aria-expanded=\\"false\\"><style>
input {
position: fixed;
... | 2,725 |
0 | petrpan-code/geist-org/geist-ui/components/select/__tests__ | petrpan-code/geist-org/geist-ui/components/select/__tests__/__snapshots__/multiple.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Select Multiple should render correctly 1`] = `
"<div class=\\"select multiple\\"><input type=\\"search\\" role=\\"combobox\\" aria-haspopup=\\"listbox\\" readonly=\\"\\" unselectable=\\"on\\" aria-expanded=\\"false\\"><style>
input {
position: ... | 2,726 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/shared/backdrop.tsx | import React, { MouseEvent } from 'react'
import useTheme from '../use-theme'
import CssTransition from './css-transition'
import useCurrentState from '../utils/use-current-state'
import useClasses from '../use-classes'
interface Props {
onClick?: (event: MouseEvent<HTMLElement>) => void
visible?: boolean
width?... | 2,727 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/shared/css-transition.tsx | import React, { useEffect, useState } from 'react'
interface Props {
visible?: boolean
enterTime?: number
leaveTime?: number
clearTime?: number
className?: string
name?: string
}
const defaultProps = {
visible: false,
enterTime: 60,
leaveTime: 60,
clearTime: 60,
className: '',
name: 'transitio... | 2,728 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/shared/dropdown.tsx | import React, { MutableRefObject, useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import usePortal from '../utils/use-portal'
import useResize from '../utils/use-resize'
import CssTransition from './css-transition'
import useClickAnyWhere from '../utils/use-click-anywhere'
import useDOMObser... | 2,729 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/shared/ellipsis.tsx | import React from 'react'
export type EllipsisProps = {
height: string
}
const Ellipsis: React.FC<React.PropsWithChildren<EllipsisProps>> = ({
children,
height,
}) => {
return (
<span>
{children}
<style jsx>{`
span {
overflow: hidden;
text-overflow: ellipsis;
... | 2,730 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/shared/expand.tsx | import React, { useEffect, useRef, useState } from 'react'
import useRealShape from '../utils/use-real-shape'
import useClasses from '../use-classes'
export type ExpandProps = {
isExpanded?: boolean
delay?: number
}
const defaultProps = {
isExpanded: false,
delay: 200,
}
const Expand: React.FC<React.PropsWit... | 2,731 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/shared/highlight.tsx | import React, { useMemo, useRef } from 'react'
import { isUnplacedRect, ReactiveDomReact } from '../utils/layouts'
import usePrevious from '../utils/use-previous'
import useTheme from '../use-theme'
import useClasses from '../use-classes'
type Props = {
rect: ReactiveDomReact
visible?: boolean
hoverHeightRatio?:... | 2,732 |
0 | petrpan-code/geist-org/geist-ui/components/shared | petrpan-code/geist-org/geist-ui/components/shared/__tests__/backdrop.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import Backdrop from '../backdrop'
import { nativeEvent, updateWrapper } from 'tests/utils'
describe('Backdrop', () => {
it('should render correctly', () => {
const wrapper = mount(
<Backdrop visible>
<span>test-value</span>
</Backdrop>... | 2,733 |
0 | petrpan-code/geist-org/geist-ui/components/shared | petrpan-code/geist-org/geist-ui/components/shared/__tests__/dropdown.test.tsx | import React, { useRef } from 'react'
import { mount } from 'enzyme'
import Dropdown from '../dropdown'
import { nativeEvent, updateWrapper } from 'tests/utils'
import { act } from 'react-dom/test-utils'
const simulateGlobalClick = () => {
document.body.dispatchEvent(
new MouseEvent('click', {
view: window... | 2,734 |
0 | petrpan-code/geist-org/geist-ui/components/shared | petrpan-code/geist-org/geist-ui/components/shared/__tests__/ellipsis.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import Ellipsis from '../ellipsis'
describe('Ellipsis', () => {
it('should render correctly', () => {
const wrapper = mount(
<div style={{ width: '1px' }}>
<Ellipsis height="10px">text</Ellipsis>
</div>,
)
expect(wrapper.html())... | 2,735 |
0 | petrpan-code/geist-org/geist-ui/components/shared | petrpan-code/geist-org/geist-ui/components/shared/__tests__/transition.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import CssTransition from '../css-transition'
import { updateWrapper } from 'tests/utils'
describe('CssTransition', () => {
it('should render correctly', () => {
const wrapper = mount(
<CssTransition visible>
<span>test</span>
</CssTran... | 2,736 |
0 | petrpan-code/geist-org/geist-ui/components/shared/__tests__ | petrpan-code/geist-org/geist-ui/components/shared/__tests__/__snapshots__/backdrop.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Backdrop should render correctly 1`] = `
"<div class=\\"backdrop backdrop-wrapper-enter\\"><div class=\\"layer\\"></div><div class=\\"position\\"><span>test-value</span></div><style>
.backdrop {
position: fixed;
top: 0;
... | 2,737 |
0 | petrpan-code/geist-org/geist-ui/components/shared/__tests__ | petrpan-code/geist-org/geist-ui/components/shared/__tests__/__snapshots__/dropdown.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Dropdown should render correctly 1`] = `"<div></div>"`;
| 2,738 |
0 | petrpan-code/geist-org/geist-ui/components/shared/__tests__ | petrpan-code/geist-org/geist-ui/components/shared/__tests__/__snapshots__/ellipsis.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Ellipsis should render correctly 1`] = `
"<div style=\\"width: 1px;\\"><span>text<style>
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 10px;
min-width: 0;
}
... | 2,739 |
0 | petrpan-code/geist-org/geist-ui/components/shared/__tests__ | petrpan-code/geist-org/geist-ui/components/shared/__tests__/__snapshots__/transition.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`CssTransition should render correctly 1`] = `"<span class=\\"undefined transition-enter\\">test</span>"`;
| 2,740 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/slider/index.ts | import Slider from './slider'
export type { SliderProps, SliderTypes } from './slider'
export default Slider
| 2,741 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/slider/slider-dot.tsx | import React from 'react'
import useTheme from '../use-theme'
import useClasses from '../use-classes'
interface Props {
left: number
disabled?: boolean
isClick?: boolean
}
const defaultProps = {
left: 0,
disabled: false,
isClick: false,
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
ex... | 2,742 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/slider/slider-mark.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
interface Props {
max: number
min: number
step: number
}
export type MarkLeftValue = number
export type Marks = Array<MarkLeftValue>
const getMarks = (min: number, max: number, step: number): Marks => {
const value = max - min
cons... | 2,743 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/slider/slider.tsx | import React, {
RefObject,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react'
import useTheme from '../use-theme'
import useDrag, { DraggingEvent } from '../utils/use-drag'
import useCurrentState from '../utils/use-current-state'
import SliderDot from './slider-dot'
import SliderMark from './... | 2,744 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/slider/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
export type SelectColor = {
bg: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): SelectColor => {
const colors: { [key in NormalTypes]: SelectColor } = {
de... | 2,745 |
0 | petrpan-code/geist-org/geist-ui/components/slider | petrpan-code/geist-org/geist-ui/components/slider/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Slider } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
import { act } from 'react-dom/test-utils'
const triggerDrag = (el: HTMLElement, x = 0) => {
window.Element.prototype.getBoundingClientRect = () =>
({
width:... | 2,746 |
0 | petrpan-code/geist-org/geist-ui/components/slider/__tests__ | petrpan-code/geist-org/geist-ui/components/slider/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Slider should render correctly 1`] = `
"<div class=\\"slider\\"><div class=\\"dot\\">20<style>
.dot {
position: absolute;
left: 20%;
top: 50%;
transform: translate(-50%, -50%);
height: calc(var(--s... | 2,747 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/snippet/index.ts | import Snippet from './snippet'
export type { SnippetProps, ToastTypes } from './snippet'
export type { CopyTypes, SnippetTypes } from '../utils/prop-types'
export default Snippet
| 2,748 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/snippet/snippet-icon.tsx | import React from 'react'
const SnippetIconComponent: React.FC<unknown> = () => {
return (
<svg
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="geometricPrecision"
style={{ color: ... | 2,749 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/snippet/snippet.tsx | import React, { useMemo, useRef } from 'react'
import useTheme from '../use-theme'
import { SnippetTypes, CopyTypes, NormalTypes } from '../utils/prop-types'
import { getStyles } from './styles'
import SnippetIcon from './snippet-icon'
import useClipboard from '../utils/use-clipboard'
import useToasts from '../use-toas... | 2,750 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/snippet/styles.ts | import { SnippetTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
export type SnippetStyles = {
color: string
border: string
bgColor: string
}
export const getStyles = (
type: SnippetTypes,
palette: GeistUIThemesPalette,
fill?: boolean,
) => {
const styles: { [k... | 2,751 |
0 | petrpan-code/geist-org/geist-ui/components/snippet | petrpan-code/geist-org/geist-ui/components/snippet/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Snippet } from 'components'
const command = 'yarn add @geist-ui/core'
const multiLine = ['cd project', 'now']
describe('Snippet', () => {
beforeAll(() => {
window.getSelection = jest.fn().mockImplementation(() => ({
removeAllRanges: jest.fn... | 2,752 |
0 | petrpan-code/geist-org/geist-ui/components/snippet/__tests__ | petrpan-code/geist-org/geist-ui/components/snippet/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Snippet should render correctly 1`] = `
"<div class=\\"snippet\\"><pre>yarn add @geist-ui/core</pre><div class=\\"copy\\"><svg viewBox=\\"0 0 24 24\\" stroke=\\"currentColor\\" stroke-width=\\"1.5\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" fill=\\"none... | 2,753 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/spacer/index.ts | import Spacer from './spacer'
export type { SpacerProps } from './spacer'
export default Spacer
| 2,754 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/spacer/spacer.tsx | import React from 'react'
import useScale, { withScale } from '../use-scale'
interface Props {
inline?: boolean
className?: string
}
const defaultProps = {
inline: false,
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type SpacerProps = Props & NativeAttrs
const Spac... | 2,755 |
0 | petrpan-code/geist-org/geist-ui/components/spacer | petrpan-code/geist-org/geist-ui/components/spacer/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Spacer } from 'components'
describe('Spacer', () => {
it('should render correctly', () => {
const wrapper = mount(<Spacer />)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should support... | 2,756 |
0 | petrpan-code/geist-org/geist-ui/components/spacer/__tests__ | petrpan-code/geist-org/geist-ui/components/spacer/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Spacer should render correctly 1`] = `
"<span class=\\"\\"><style>
span {
display: block;
width: calc(1 * 16px);
height: calc(1 * 16px);
padding: 0 0 0 0;
margin: 0 0 0 0;
}
</style></span>"
`;
... | 2,757 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/spinner/index.ts | import Spinner from './spinner'
export type { SpinnerProps } from './spinner'
export default Spinner
| 2,758 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/spinner/spinner.tsx | import React from 'react'
import useTheme from '../use-theme'
import { GeistUIThemes } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.H... | 2,759 |
0 | petrpan-code/geist-org/geist-ui/components/spinner | petrpan-code/geist-org/geist-ui/components/spinner/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Spinner } from 'components'
describe('Spacer', () => {
it('should render correctly', () => {
const wrapper = mount(<Spinner />)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work ... | 2,760 |
0 | petrpan-code/geist-org/geist-ui/components/spinner/__tests__ | petrpan-code/geist-org/geist-ui/components/spinner/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Spacer should render correctly 1`] = `
"<div class=\\"spinner\\"><div class=\\"container\\"><span><style>
span {
background-color: #000;
position: absolute;
top: -3.9%;
width: 24%;
height: 8%;
left: ... | 2,761 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/index.ts | import Table from './table'
export type { TableProps } from './table'
export type { TableColumnProps } from './table-column'
export type {
TableOnCellClick,
TableAbstractColumn,
TableOnChange,
TableOnRowClick,
TableRowClassNameHandler,
TableDataItemBase,
TableColumnRender,
} from './table-types'
export d... | 2,762 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table-body.tsx | import React from 'react'
import useTheme from '../use-theme'
import TableCell from './table-cell'
import { useTableContext } from './table-context'
import {
TableDataItemBase,
TableOnCellClick,
TableOnRowClick,
TableRowClassNameHandler,
} from './table-types'
import useClasses from '../use-classes'
interface ... | 2,763 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table-cell.tsx | import React from 'react'
import { TableDataItemBase, TableAbstractColumn, TableOnCellClick } from './table-types'
interface Props<TableDataItem extends TableDataItemBase> {
columns: Array<TableAbstractColumn<TableDataItem>>
row: TableDataItem
rowIndex: number
emptyText: string
onCellClick?: TableOnCellClick... | 2,764 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table-column.tsx | import React, { useEffect } from 'react'
import { useTableContext } from './table-context'
import useWarning from '../utils/use-warning'
import { TableColumnRender, TableDataItemBase } from './table-types'
const defaultProps = {
className: '',
render: () => {},
}
export type TableColumnProps<TableDataItem> = {
... | 2,765 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table-context.ts | import React from 'react'
import { TableAbstractColumn } from './table-types'
export interface TableConfig<T> {
columns: Array<TableAbstractColumn<T>>
updateColumn: (column: TableAbstractColumn<T>) => void
}
const defaultContext = {
columns: [],
updateColumn: () => {},
}
export const TableContext = React.cre... | 2,766 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table-head.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { TableAbstractColumn, TableDataItemBase } from './table-types'
interface Props<TableDataItem extends TableDataItemBase> {
width: number
columns: Array<TableAbstractColumn<TableDataItem>>
className?: string
}
const defaultProps = ... | 2,767 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table-types.ts | import React from 'react'
export type TableDataItemBase = Record<string, any>
export type TableColumnRender<Item extends TableDataItemBase> = (
value: Item[keyof Item],
rowData: Item,
rowIndex: number,
) => JSX.Element | void
export type TableAbstractColumn<TableDataItem> = {
prop: keyof TableDataItem
labe... | 2,768 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/table/table.tsx | import React, { useEffect, useMemo, useRef, useState } from 'react'
import TableHead from './table-head'
import TableBody from './table-body'
import useRealShape from '../utils/use-real-shape'
import useResize from '../utils/use-resize'
import { TableContext, TableConfig } from './table-context'
import {
TableAbstrac... | 2,769 |
0 | petrpan-code/geist-org/geist-ui/components/table | petrpan-code/geist-org/geist-ui/components/table/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Table, Code } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
import { act } from 'react-dom/test-utils'
import { TableColumnRender } from '../table-types'
const data = [
{ property: 'type', description: 'Content type', defa... | 2,770 |
0 | petrpan-code/geist-org/geist-ui/components/table/__tests__ | petrpan-code/geist-org/geist-ui/components/table/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Table should be no erros when width is too large 1`] = `
"<table class=\\"\\"><colgroup></colgroup><thead><tr><th class=\\"\\"><div class=\\"thead-box\\">property</div></th><th class=\\"\\"><div class=\\"thead-box\\">description</div></th><th class=\\"\\"><div class=... | 2,771 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/tabs/index.ts | import Tabs from './tabs'
import TabsItem from './tabs-item'
export type TabsComponentType = typeof Tabs & {
Item: typeof TabsItem
Tab: typeof TabsItem
}
;(Tabs as TabsComponentType).Item = TabsItem
;(Tabs as TabsComponentType).Tab = TabsItem
export type { TabsProps } from './tabs'
export default Tabs as TabsComp... | 2,772 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/tabs/tabs-context.ts | import React, { CSSProperties, MouseEvent } from 'react'
export type TabsInternalCellProps = {
onClick: (value: string) => void
onMouseOver: (e: MouseEvent<HTMLDivElement>) => void
activeClassName?: string
activeStyle?: CSSProperties
hideBorder?: boolean
}
export type TabsInternalCell = React.FC<TabsInterna... | 2,773 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/tabs/tabs-item.tsx | import React, { useEffect, useMemo, useRef } from 'react'
import { TabsInternalCellProps, useTabsContext } from './tabs-context'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
label: string | React.ReactNode
value: st... | 2,774 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/tabs/tabs.tsx | import React, {
CSSProperties,
MouseEvent,
useEffect,
useMemo,
useRef,
useState,
} from 'react'
import useTheme from '../use-theme'
import { TabsHeaderItem, TabsConfig, TabsContext } from './tabs-context'
import useScale, { withScale } from '../use-scale'
import Highlight from '../shared/highlight'
import {... | 2,775 |
0 | petrpan-code/geist-org/geist-ui/components/tabs | petrpan-code/geist-org/geist-ui/components/tabs/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Tabs } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
describe('Tabs', () => {
it('should render correctly', () => {
const wrapper = mount(
<Tabs>
<Tabs.Item label="label1" value="1">
1
<... | 2,776 |
0 | petrpan-code/geist-org/geist-ui/components/tabs/__tests__ | petrpan-code/geist-org/geist-ui/components/tabs/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Tabs should hide border on active 1`] = `
"<div class=\\"tabs\\"><header><div class=\\"highlight\\"><style>
.highlight {
background: #eaeaea;
position: absolute;
border-radius: 5px;
width: 0px;
left: -1000px;
... | 2,777 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/tag/index.ts | import Tag from './tag'
export type { TagProps, TagColors, TagTypes } from './tag'
export default Tag
| 2,778 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/tag/tag.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { SnippetTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
export type TagTypes = SnippetTypes
interface Props {
type?: TagTypes
invert?: bo... | 2,779 |
0 | petrpan-code/geist-org/geist-ui/components/tag | petrpan-code/geist-org/geist-ui/components/tag/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Tag } from 'components'
describe('Tag', () => {
it('should render correctly', () => {
const wrapper = mount(<Tag>tag</Tag>)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work with types', () => {
const wrapper = ... | 2,780 |
0 | petrpan-code/geist-org/geist-ui/components/tag/__tests__ | petrpan-code/geist-org/geist-ui/components/tag/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Tag should work with invert 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "",
},
"children": Array [
Node {
"data": "success",
"next": Node {
"attribs": Object {},
"children": Array [
... | 2,781 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/text/child.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { NormalTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale from '../use-scale'
export interface Props {
tag: keyof JSX.IntrinsicElements
type?: NormalTypes
className?: string... | 2,782 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/text/index.ts | import Text from './text'
export type { TextProps, TextTypes } from './text'
export default Text
| 2,783 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/text/text.tsx | import React, { ReactNode, useMemo } from 'react'
import { NormalTypes } from '../utils/prop-types'
import TextChild from './child'
import { withScale } from '../use-scale'
export type TextTypes = NormalTypes
interface Props {
h1?: boolean
h2?: boolean
h3?: boolean
h4?: boolean
h5?: boolean
h6?: boolean
... | 2,784 |
0 | petrpan-code/geist-org/geist-ui/components/text | petrpan-code/geist-org/geist-ui/components/text/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Text } from 'components'
describe('Text', () => {
it('should render P element in the default', () => {
const wrapper = mount(<Text>test-value</Text>)
expect(wrapper.find('p')).not.toBe(0)
expect(wrapper.html()).toMatchSnapshot()
expect... | 2,785 |
0 | petrpan-code/geist-org/geist-ui/components/text/__tests__ | petrpan-code/geist-org/geist-ui/components/text/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Text should be able to specify the size of text 1`] = `
"<p class=\\"font\\">test-value<style>
p {
color: inherit;
width: auto;
height: auto;
}
.font {
font-size: calc(14 * 16px);
}
.mx {... | 2,786 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/textarea/index.ts | import Textarea from './textarea'
export type { TextareaProps, TextareaResizes, TextareaTypes } from './textarea'
export default Textarea
| 2,787 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/textarea/textarea.tsx | import React, { useRef, useImperativeHandle, useEffect, useMemo, useState } from 'react'
import useTheme from '../use-theme'
import { NormalTypes, tuple } from '../utils/prop-types'
import { getColors } from '../input/styles'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
co... | 2,788 |
0 | petrpan-code/geist-org/geist-ui/components/textarea | petrpan-code/geist-org/geist-ui/components/textarea/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Textarea } from 'components'
import { nativeEvent } from 'tests/utils'
describe('Textarea', () => {
it('should render correctly', () => {
const wrapper = mount(<Textarea placeholder="placeholder" />)
expect(wrapper.html()).toMatchSnapshot()
... | 2,789 |
0 | petrpan-code/geist-org/geist-ui/components/textarea/__tests__ | petrpan-code/geist-org/geist-ui/components/textarea/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Textarea should render correctly 1`] = `
"<div class=\\"wrapper\\"><textarea placeholder=\\"placeholder\\"></textarea><style>
.wrapper {
display: inline-flex;
box-sizing: border-box;
user-select: none;
border-... | 2,790 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/themes/index.ts | import Themes from './themes'
export type { GeistUserTheme } from './themes'
export type {
GeistUIThemes,
GeistUIThemesBreakpoints,
BreakpointsItem,
GeistUIThemesExpressiveness,
GeistUIThemesFont,
GeistUIThemesLayout,
GeistUIThemesPalette,
} from './presets'
export default Themes
| 2,791 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/themes/themes.ts | import { GeistUIThemes } from './presets/index'
import type { DeepPartial } from '../utils/types'
import lightTheme from './presets/default'
import darkTheme from './presets/dark'
export type GeistUserTheme = DeepPartial<GeistUIThemes> & { type: string }
export const isObject = (target: unknown) => target && typeof t... | 2,792 |
0 | petrpan-code/geist-org/geist-ui/components/themes | petrpan-code/geist-org/geist-ui/components/themes/presets/dark.ts | import { GeistUIThemes, GeistUIThemesPalette, GeistUIThemesExpressiveness } from './index'
import { defaultFont, defaultBreakpoints, defaultLayout } from './shared'
export const palette: GeistUIThemesPalette = {
accents_1: '#111',
accents_2: '#333',
accents_3: '#444',
accents_4: '#666',
accents_5: '#888',
... | 2,793 |
0 | petrpan-code/geist-org/geist-ui/components/themes | petrpan-code/geist-org/geist-ui/components/themes/presets/default.ts | import { GeistUIThemes, GeistUIThemesPalette, GeistUIThemesExpressiveness } from './index'
import { defaultFont, defaultBreakpoints, defaultLayout } from './shared'
export const palette: GeistUIThemesPalette = {
accents_1: '#fafafa',
accents_2: '#eaeaea',
accents_3: '#999',
accents_4: '#888',
accents_5: '#66... | 2,794 |
0 | petrpan-code/geist-org/geist-ui/components/themes | petrpan-code/geist-org/geist-ui/components/themes/presets/index.ts | export interface GeistUIThemesPalette {
accents_1: string
accents_2: string
accents_3: string
accents_4: string
accents_5: string
accents_6: string
accents_7: string
accents_8: string
background: string
foreground: string
selection: string
secondary: string
code: string
border: string
succ... | 2,795 |
0 | petrpan-code/geist-org/geist-ui/components/themes | petrpan-code/geist-org/geist-ui/components/themes/presets/shared.ts | import { GeistUIThemesBreakpoints, GeistUIThemesFont, GeistUIThemesLayout } from './index'
export const defaultFont: GeistUIThemesFont = {
sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
mono: 'Menlo... | 2,796 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/toggle/index.ts | import Toggle from './toggle'
export type {
ToggleProps,
ToggleSize,
ToggleEvent,
ToggleEventTarget,
ToggleTypes,
} from './toggle'
export default Toggle
| 2,797 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/toggle/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
export type SelectColor = {
bg: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): SelectColor => {
const colors: { [key in NormalTypes]: SelectColor } = {
de... | 2,798 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/toggle/toggle.tsx | import React, { useCallback, useEffect, useMemo, useState } from 'react'
import useTheme from '../use-theme'
import { NormalTypes } from '../utils/prop-types'
import { getColors } from './styles'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
export type ToggleTypes = Normal... | 2,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.