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 | petrpan-code/geist-org/geist-ui/components/button-dropdown/button-dropdown-item.tsx | import React, { MouseEvent, useMemo } from 'react'
import useTheme from '../use-theme'
import { getColor } from './styles'
import { useButtonDropdown } from './button-dropdown-context'
import Loading from '../loading'
import { NormalTypes } from '../utils/prop-types'
export type ButtonDropdownItemTypes = NormalTypes
... | 2,500 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-dropdown/button-dropdown.tsx | import React, { MouseEvent, useCallback, useMemo, useRef, useState } from 'react'
import useTheme from '../use-theme'
import useClickAway from '../utils/use-click-away'
import { getColor } from './styles'
import ButtonDropdownIcon from './icon'
import ButtonDropdownItem from './button-dropdown-item'
import { ButtonDrop... | 2,501 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-dropdown/icon.tsx | import React from 'react'
interface Props {
color?: string
height?: string
}
const ButtonDropdownIcon: React.FC<Props> = ({ color, height }) => {
return (
<svg
stroke={color}
style={{ color }}
viewBox="0 0 24 24"
width={height}
height={height}
strokeWidth="1"
stroke... | 2,502 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-dropdown/index.ts | import ButtonDropdown from './button-dropdown'
import ButtonDropdownItem from './button-dropdown-item'
type ButtonDropdownType = typeof ButtonDropdown & {
Item: typeof ButtonDropdownItem
}
;(ButtonDropdown as ButtonDropdownType).Item = ButtonDropdownItem
export type { ButtonDropdownProps, ButtonDropdownTypes } from... | 2,503 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-dropdown/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
type ButtonDropdownColors = {
color: string
bgColor: string
hoverBgColor: string
hoverBorder: string
borderLeftColor: string
}
export const getColor = (
palette: GeistUIThemesPalette,
type: NormalT... | 2,504 |
0 | petrpan-code/geist-org/geist-ui/components/button-dropdown | petrpan-code/geist-org/geist-ui/components/button-dropdown/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { ButtonDropdown } from 'components'
import { mockNativeEvent, nativeEvent } from 'tests/utils'
const Icon: React.FC<any> = () => <svg />
describe('Button Dropdown', () => {
it('should render correctly', () => {
const wrapper = mount(
... | 2,505 |
0 | petrpan-code/geist-org/geist-ui/components/button-dropdown/__tests__ | petrpan-code/geist-org/geist-ui/components/button-dropdown/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Button Dropdown should render multiple types 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "btn-dropdown",
},
"children": Array [
Node {
"attribs": Object {
"class": "",
},
"children": Arr... | 2,506 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-group/button-group-context.ts | import React from 'react'
import { ButtonTypes } from '../utils/prop-types'
export interface ButtonGroupConfig {
type?: ButtonTypes
ghost?: boolean
disabled?: boolean
isButtonGroup: boolean
}
const defaultContext = {
isButtonGroup: false,
disabled: false,
}
export const ButtonGroupContext = React.createC... | 2,507 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-group/button-group.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { ButtonTypes } from '../utils/prop-types'
import { ButtonGroupContext, ButtonGroupConfig } from './button-group-context'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
import u... | 2,508 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button-group/index.ts | import ButtonGroup from './button-group'
export type { ButtonGroupProps } from './button-group'
export type { ButtonTypes } from '../utils/prop-types'
export default ButtonGroup
| 2,509 |
0 | petrpan-code/geist-org/geist-ui/components/button-group | petrpan-code/geist-org/geist-ui/components/button-group/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { ButtonGroup, Button } from 'components'
import { nativeEvent } from 'tests/utils'
describe('ButtonGroup', () => {
it('should render correctly', () => {
const wrapper = mount(
<ButtonGroup>
<Button>action</Button>
</ButtonGroup>... | 2,510 |
0 | petrpan-code/geist-org/geist-ui/components/button-group/__tests__ | petrpan-code/geist-org/geist-ui/components/button-group/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ButtonGroup buttons should be displayed vertically 1`] = `
"<div class=\\"btn-group vertical\\"><button type=\\"button\\" class=\\"btn\\"><div class=\\"text\\">action1</div><style>
.btn {
box-sizing: border-box;
display: inline-block... | 2,511 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/button-icon.tsx | import React from 'react'
import useClasses from '../use-classes'
interface Props {
isRight?: boolean
isSingle?: boolean
className?: string
}
const defaultProps = {
isRight: false,
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type ButtonIconProps = Props & NativeA... | 2,512 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/button-loading.tsx | import React from 'react'
import Loading from '../loading'
interface Props {
color: string
}
const ButtonLoading: React.FC<React.PropsWithChildren<Props>> = ({ color }) => {
return (
<div className="btn-loading">
<Loading color={color} />
<style jsx>{`
.btn-loading {
position: ab... | 2,513 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/button.drip.tsx | import React, { useEffect, useRef } from 'react'
interface Props {
x: number
y: number
onCompleted: () => void
color: string
}
const defaultProps = {
x: 0,
y: 0,
}
export type ButtonDrip = Props
const ButtonDrip: React.FC<ButtonDrip> = ({
x,
y,
color,
onCompleted,
}: ButtonDrip & typeof defaultP... | 2,514 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/button.tsx | import React, { useRef, useState, MouseEvent, useMemo, useImperativeHandle } from 'react'
import useScale, { withScale } from '../use-scale'
import useTheme from '../use-theme'
import ButtonDrip from './button.drip'
import ButtonLoading from './button-loading'
import { ButtonTypes } from '../utils/prop-types'
import { ... | 2,515 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/index.ts | import Button from './button'
export type { ButtonProps } from './button'
export type { ButtonTypes } from '../utils/prop-types'
export default Button
| 2,516 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
import { ButtonTypes } from '../utils/prop-types'
import { ButtonProps } from './button'
import { addColorAlpha } from '../utils/color'
export interface ButtonColorGroup {
bg: string
border: string
color: string
}
export const getButtonGhostColors = (
p... | 2,517 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/button/utils.tsx | import React, { ReactNode } from 'react'
import ButtonIcon from './button-icon'
import { ButtonProps } from './button'
import { ButtonGroupConfig } from '../button-group/button-group-context'
import useClasses from '../use-classes'
export const getButtonChildrenWithIcon = (
auto: boolean,
children: ReactNode,
ic... | 2,518 |
0 | petrpan-code/geist-org/geist-ui/components/button | petrpan-code/geist-org/geist-ui/components/button/__tests__/icon.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Button } from 'components'
const Icon: React.FC<any> = () => <svg />
describe('ButtonIcon', () => {
it('should render correctly', () => {
const wrapper = mount(<Button icon={<Icon />}>action</Button>)
expect(wrapper.html()).toMatchSnapshot()
... | 2,519 |
0 | petrpan-code/geist-org/geist-ui/components/button | petrpan-code/geist-org/geist-ui/components/button/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Button } from 'components'
import { sleep } from 'tests/utils'
describe('Button', () => {
it('should render correctly', () => {
const wrapper = mount(<Button>Button</Button>)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should sup... | 2,520 |
0 | petrpan-code/geist-org/geist-ui/components/button/__tests__ | petrpan-code/geist-org/geist-ui/components/button/__tests__/__snapshots__/icon.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ButtonIcon should render correctly 1`] = `
"<button type=\\"button\\" class=\\"btn\\"><span class=\\"icon\\"><svg></svg><style>
.icon {
position: absolute;
left: var(--geist-ui-button-icon-padding);
right: auto;
top: 50... | 2,521 |
0 | petrpan-code/geist-org/geist-ui/components/button/__tests__ | petrpan-code/geist-org/geist-ui/components/button/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Button should render empty button correctly 1`] = `<ScaleGeistButton />`;
exports[`Button should render special styles 1`] = `ReactWrapper {}`;
exports[`Button should render special styles 2`] = `
<ScaleGeistButton
loading={true}
>
button
</ScaleGeistButton>
`;... | 2,522 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/capacity/capacity.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { useProportions } from '../utils/calculations'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
value?: number
limi... | 2,523 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/capacity/index.ts | import Capacity from './capacity'
export type { CapacityProps } from './capacity'
export default Capacity
| 2,524 |
0 | petrpan-code/geist-org/geist-ui/components/capacity | petrpan-code/geist-org/geist-ui/components/capacity/__tests__/index.test.tsx | import React from 'react'
import { render, mount } from 'enzyme'
import { Capacity } from 'components'
describe('Capacity', () => {
it('should render value correctly', () => {
const wrapper = mount(<Capacity value={50} />)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should render title correctl... | 2,525 |
0 | petrpan-code/geist-org/geist-ui/components/capacity/__tests__ | petrpan-code/geist-org/geist-ui/components/capacity/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Capacity should override background color 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "capacity",
"title": "50%",
},
"children": Array [
Node {
"attribs": Object {},
"children": Array [],
"n... | 2,526 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/card/card-content.tsx | import React from 'react'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type CardContentProps = Props & NativeAttrs
c... | 2,527 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/card/card-footer.tsx | import React from 'react'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
disableAutoMargin?: boolean
className?: string
}
const defaultProps = {
disableAutoMargin: false,
className: '',
}
type NativeAttrs = Omit... | 2,528 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/card/card.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { CardTypes } from '../utils/prop-types'
import { getStyles } from './styles'
import CardFooter from './card-footer'
import CardContent from './card-content'
import Image from '../image'
import { hasChild, pickChild } from '../utils/colle... | 2,529 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/card/index.ts | import Card from './card'
import CardFooter from './card-footer'
import CardContent from './card-content'
export type CardComponentType = typeof Card & {
Footer: typeof CardFooter
Actions: typeof CardFooter
Content: typeof CardContent
Body: typeof CardContent
}
;(Card as CardComponentType).Footer = CardFooter
... | 2,530 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/card/styles.ts | import { CardTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
export type CardStyles = {
color: string
bgColor: string
borderColor: string
}
export const getStyles = (
type: CardTypes,
palette: GeistUIThemesPalette,
isShadow?: boolean,
): CardStyles => {
const ... | 2,531 |
0 | petrpan-code/geist-org/geist-ui/components/card | petrpan-code/geist-org/geist-ui/components/card/__tests__/footer.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Card } from 'components'
describe('Card Footer', () => {
it('should render correctly', () => {
const wrapper = mount(
<Card>
<p>card</p>
<Card.Footer>footer</Card.Footer>
</Card>,
)
expect(wrapper.html()).toMatc... | 2,532 |
0 | petrpan-code/geist-org/geist-ui/components/card | petrpan-code/geist-org/geist-ui/components/card/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Card } from 'components'
describe('Card', () => {
it('should render correctly', () => {
const wrapper = mount(<Card>card</Card>)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should support shadow and hoverable', () => {
... | 2,533 |
0 | petrpan-code/geist-org/geist-ui/components/card/__tests__ | petrpan-code/geist-org/geist-ui/components/card/__tests__/__snapshots__/footer.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Card Footer should render correctly 1`] = `
"<div class=\\"card\\"><div class=\\"content\\"><p>card</p><style>
.content {
width: 100%;
height: auto;
padding: calc(1 * 16px) calc(1 * 16px) calc(1 * 16px) calc(1 * 16px);
... | 2,534 |
0 | petrpan-code/geist-org/geist-ui/components/card/__tests__ | petrpan-code/geist-org/geist-ui/components/card/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Card should render correctly when nested 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "card",
},
"children": Array [
Node {
"attribs": Object {
"class": "content",
},
"children": Array [
... | 2,535 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/checkbox/checkbox-context.ts | import React from 'react'
export interface CheckboxConfig {
updateState?: (value: string, checked: boolean) => void
disabledAll: boolean
values: string[]
inGroup: boolean
}
const defaultContext = {
disabledAll: false,
inGroup: false,
values: [],
}
export const CheckboxContext = React.createContext<Chec... | 2,536 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/checkbox/checkbox-group.tsx | import React, { useEffect, useMemo, useState } from 'react'
import { CheckboxContext } from './checkbox-context'
import useWarning from '../utils/use-warning'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
value: string[]
disabled?: boolean
onChange?:... | 2,537 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/checkbox/checkbox.icon.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
interface Props {
disabled?: boolean
checked?: boolean
fill?: string
bg?: string
}
const CheckboxIconComponent: React.FC<Props> = ({ fill, bg, disabled, checked }) => {
const theme = useTheme()
const { propsFill, propsBg } = useMe... | 2,538 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/checkbox/checkbox.tsx | import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { useCheckbox } from './checkbox-context'
import CheckboxIcon from './checkbox.icon'
import useWarning from '../utils/use-warning'
import { NormalTypes } from '../utils/prop-types'
import { getColors } from './styles'
import useTheme from '... | 2,539 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/checkbox/index.ts | import Checkbox from './checkbox'
import CheckboxGroup from './checkbox-group'
export type CheckboxComponentType = typeof Checkbox & {
Group: typeof CheckboxGroup
}
;(Checkbox as CheckboxComponentType).Group = CheckboxGroup
export type {
CheckboxProps,
CheckboxEvent,
CheckboxEventTarget,
CheckboxTypes,
} fr... | 2,540 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/checkbox/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
export type CheckboxColor = {
fill: string
bg: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): CheckboxColor => {
const colors: { [key in NormalTypes]: Check... | 2,541 |
0 | petrpan-code/geist-org/geist-ui/components/checkbox | petrpan-code/geist-org/geist-ui/components/checkbox/__tests__/group.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Checkbox } from 'components'
describe('Checkbox Group', () => {
it('should render correctly', () => {
const wrapper = mount(
<Checkbox.Group value={[]}>
<Checkbox value="sydney">Sydney</Checkbox>
</Checkbox.Group>,
... | 2,542 |
0 | petrpan-code/geist-org/geist-ui/components/checkbox | petrpan-code/geist-org/geist-ui/components/checkbox/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Checkbox } from 'components'
describe('Checkbox', () => {
it('should render correctly', () => {
const wrapper = mount(<Checkbox checked={true}>Sydney</Checkbox>)
expect(() => wrapper.unmount()).not.toThrow()
const rendered = render... | 2,543 |
0 | petrpan-code/geist-org/geist-ui/components/checkbox/__tests__ | petrpan-code/geist-org/geist-ui/components/checkbox/__tests__/__snapshots__/group.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Checkbox Group should render correctly 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "group",
},
"children": Array [
Node {
"attribs": Object {
"class": "checkbox",
},
"children": Array [
... | 2,544 |
0 | petrpan-code/geist-org/geist-ui/components/checkbox/__tests__ | petrpan-code/geist-org/geist-ui/components/checkbox/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Checkbox should render correctly 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "checkbox",
},
"children": Array [
Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
},
... | 2,545 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/code/code.tsx | import React, { useMemo } from 'react'
import useScale, { withScale } from '../use-scale'
import useTheme from '../use-theme'
import { addColorAlpha } from '../utils/color'
interface Props {
block?: boolean
className?: string
name?: string
classic?: boolean
}
const defaultProps = {
block: false,
className... | 2,546 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/code/index.ts | import Code from './code'
export type { CodeProps } from './code'
export default Code
| 2,547 |
0 | petrpan-code/geist-org/geist-ui/components/code | petrpan-code/geist-org/geist-ui/components/code/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Code } from 'components'
describe('Code', () => {
it('should render correctly', () => {
const wrapper = mount(<Code>code</Code>)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should support block mode', () => {
const wr... | 2,548 |
0 | petrpan-code/geist-org/geist-ui/components/code/__tests__ | petrpan-code/geist-org/geist-ui/components/code/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Code should repspond to changed by width 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "pre",
},
"children": Array [
Node {
"attribs": Object {
"class": "",
},
"children": Array [
... | 2,549 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/col/col.tsx | import React from 'react'
interface Props {
span?: number
offset?: number
component?: keyof JSX.IntrinsicElements
className?: string
}
const defaultProps = {
span: 24,
offset: 0,
component: 'div' as keyof JSX.IntrinsicElements,
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof... | 2,550 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/col/index.ts | import Col from './col'
export type { ColProps } from './col'
export default Col
| 2,551 |
0 | petrpan-code/geist-org/geist-ui/components/col | petrpan-code/geist-org/geist-ui/components/col/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import Col from '../index'
describe('Col', () => {
it('should render correctly', () => {
const wrapper = mount(<Col>col</Col>)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work with span... | 2,552 |
0 | petrpan-code/geist-org/geist-ui/components/col/__tests__ | petrpan-code/geist-org/geist-ui/components/col/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Col should render correctly 1`] = `ReactWrapper {}`;
exports[`Col should work with span and offset 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {},
"children": Array [
Node {
"attribs": Object {
"class": "col ",
},
... | 2,553 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/collapse/collapse-context.ts | import React from 'react'
export interface CollapseConfig {
values: Array<number>
updateValues?: (currentIndex: number | undefined, nextState: boolean) => unknown
}
const defaultContext = {
values: [],
}
export const CollapseContext = React.createContext<CollapseConfig>(defaultContext)
export const useCollaps... | 2,554 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/collapse/collapse-group.tsx | import React, { useMemo } from 'react'
import Collapse from './collapse'
import useCurrentState from '../utils/use-current-state'
import { setChildrenIndex } from '../utils/collections'
import { CollapseContext, CollapseConfig } from './collapse-context'
import useScale, { withScale } from '../use-scale'
import useClas... | 2,555 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/collapse/collapse-icon.tsx | import React from 'react'
interface Props {
active?: boolean
}
const CollapseIcon: React.FC<Props> = ({ active }) => {
return (
<svg
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="ge... | 2,556 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/collapse/collapse.tsx | import React, { useEffect } from 'react'
import CollapseIcon from './collapse-icon'
import useTheme from '../use-theme'
import Expand from '../shared/expand'
import { useCollapseContext } from './collapse-context'
import useCurrentState from '../utils/use-current-state'
import useWarning from '../utils/use-warning'
imp... | 2,557 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/collapse/index.ts | import Collapse from './collapse'
import CollapseGroup from './collapse-group'
export type CollapseComponentType = typeof Collapse & {
Group: typeof CollapseGroup
}
;(Collapse as CollapseComponentType).Group = CollapseGroup
export type { CollapseProps } from './collapse'
export type { CollapseGroupProps } from './c... | 2,558 |
0 | petrpan-code/geist-org/geist-ui/components/collapse | petrpan-code/geist-org/geist-ui/components/collapse/__tests__/group.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Collapse } from 'components'
import { updateWrapper } from 'tests/utils'
describe('Collapse Group', () => {
it('should render correctly', () => {
const wrapper = mount(
<Collapse.Group>
<Collapse title="title1">content1</Coll... | 2,559 |
0 | petrpan-code/geist-org/geist-ui/components/collapse | petrpan-code/geist-org/geist-ui/components/collapse/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Collapse } from 'components'
import { updateWrapper } from 'tests/utils'
describe('Collapse', () => {
it('should render correctly', () => {
const wrapper = mount(<Collapse title="title">content</Collapse>)
expect(wrapper).toMatchSnapsh... | 2,560 |
0 | petrpan-code/geist-org/geist-ui/components/collapse/__tests__ | petrpan-code/geist-org/geist-ui/components/collapse/__tests__/__snapshots__/group.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Collapse Group should be no errors when children are missing 1`] = `ReactWrapper {}`;
exports[`Collapse Group should render correctly 1`] = `ReactWrapper {}`;
exports[`Collapse Group should work without accordion 1`] = `
LoadedCheerio {
"0": Node {
"attribs":... | 2,561 |
0 | petrpan-code/geist-org/geist-ui/components/collapse/__tests__ | petrpan-code/geist-org/geist-ui/components/collapse/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Collapse should render correctly 1`] = `ReactWrapper {}`;
exports[`Collapse should work with initial visible 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {},
"children": Array [
Node {
"attribs": Object {
"class": "collapse... | 2,562 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/css-baseline/css-baseline.tsx | import React, { ReactElement } from 'react'
import useTheme from '../use-theme'
import flush, { flushToHTML } from 'styled-jsx/server'
export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
export type FlushToHTML = (opts?: { nonce?: string }) => string
const CssBaseline: React.FC<React.P... | 2,563 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/css-baseline/index.ts | export { default } from './css-baseline'
| 2,564 |
0 | petrpan-code/geist-org/geist-ui/components/css-baseline | petrpan-code/geist-org/geist-ui/components/css-baseline/__tests__/baseline.test.tsx | import React from 'react'
import { render } from 'enzyme'
import { CssBaseline, GeistProvider } from 'components'
describe('CSSBaseline', () => {
it('should render correctly', () => {
const wrapper = render(
<GeistProvider>
<CssBaseline />
</GeistProvider>,
)
expect(wrapper).toMatchSn... | 2,565 |
0 | petrpan-code/geist-org/geist-ui/components/css-baseline/__tests__ | petrpan-code/geist-org/geist-ui/components/css-baseline/__tests__/__snapshots__/baseline.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`CSSBaseline should render correctly 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {},
"children": Array [
Node {
"data": "
html,
body {
background-color: #fff;
color: #000;
}
html {
... | 2,566 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/description/description.tsx | import React, { ReactNode } from 'react'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
title?: ReactNode | string
content?: ReactNode | string
className?: string
}
const defaultProps = {
title: 'Title' as ReactN... | 2,567 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/description/index.ts | import Description from './description'
export type { DescriptionProps } from './description'
export default Description
| 2,568 |
0 | petrpan-code/geist-org/geist-ui/components/description | petrpan-code/geist-org/geist-ui/components/description/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Description } from 'components'
describe('Description', () => {
it('should render correctly', () => {
const wrapper = mount(<Description title="title" />)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})... | 2,569 |
0 | petrpan-code/geist-org/geist-ui/components/description/__tests__ | petrpan-code/geist-org/geist-ui/components/description/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Description should render correctly 1`] = `ReactWrapper {}`;
| 2,570 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/display/display.tsx | import React, { ReactNode, useMemo } from 'react'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
caption?: ReactNode | string
shadow?: boolean
className?: string
}
const defaultProps = {
caption: '' as ReactNode ... | 2,571 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/display/index.ts | import Display from './display'
export type { DisplayProps } from './display'
export default Display
| 2,572 |
0 | petrpan-code/geist-org/geist-ui/components/display | petrpan-code/geist-org/geist-ui/components/display/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Display } from 'components'
describe('Display', () => {
it('should render correctly', () => {
const wrapper = mount(<Display caption="caption">display</Display>)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not... | 2,573 |
0 | petrpan-code/geist-org/geist-ui/components/display/__tests__ | petrpan-code/geist-org/geist-ui/components/display/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Display should render correctly 1`] = `ReactWrapper {}`;
exports[`Display should support react-node 1`] = `ReactWrapper {}`;
exports[`Display should work with shadow and width 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {},
"children": Array [
... | 2,574 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/divider/divider.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { DividerAlign, SnippetTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
export type DividerTypes = Snip... | 2,575 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/divider/index.ts | import Divider from './divider'
export type { DividerProps, DividerTypes } from './divider'
export type { DividerAlign } from '../utils/prop-types'
export default Divider
| 2,576 |
0 | petrpan-code/geist-org/geist-ui/components/divider | petrpan-code/geist-org/geist-ui/components/divider/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Divider } from 'components'
describe('Divider', () => {
it('should render correctly', () => {
const wrapper = mount(<Divider />)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should wor... | 2,577 |
0 | petrpan-code/geist-org/geist-ui/components/divider/__tests__ | petrpan-code/geist-org/geist-ui/components/divider/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Divider should render correctly 1`] = `ReactWrapper {}`;
exports[`Divider should support float 1`] = `ReactWrapper {}`;
exports[`Divider should work with align and volume 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {},
"children": Array [
... | 2,578 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/dot/dot.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { NormalTypes } from '../utils/prop-types'
import { GeistUIThemes } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
export type DotTypes = NormalTypes
interface Props {
... | 2,579 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/dot/index.ts | import Dot from './dot'
export type { DotProps, DotTypes } from './dot'
export default Dot
| 2,580 |
0 | petrpan-code/geist-org/geist-ui/components/dot | petrpan-code/geist-org/geist-ui/components/dot/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Dot } from 'components'
describe('Dot', () => {
it('should render correctly', () => {
const wrapper = mount(<Dot />)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should supports types'... | 2,581 |
0 | petrpan-code/geist-org/geist-ui/components/dot/__tests__ | petrpan-code/geist-org/geist-ui/components/dot/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Dot should render correctly 1`] = `ReactWrapper {}`;
exports[`Dot should supports types 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {},
"children": Array [
Node {
"attribs": Object {
"class": "dot",
},
"chi... | 2,582 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/drawer/drawer-wrapper.tsx | import React, { useEffect, useMemo, useRef } from 'react'
import useScale from '../use-scale'
import useTheme from '../use-theme'
import CssTransition from '../shared/css-transition'
import { isChildElement } from '../utils/collections'
import { DrawerPlacement, getDrawerTransform } from './helper'
import useClasses fr... | 2,583 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/drawer/drawer.tsx | import React, { MouseEvent, useEffect, useState } from 'react'
import { withScale } from '../use-scale'
import usePortal from '../utils/use-portal'
import useBodyScroll from '../utils/use-body-scroll'
import useKeyboard, { KeyCode } from '../use-keyboard'
import { createPortal } from 'react-dom'
import Backdrop from '.... | 2,584 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/drawer/helper.ts | import { tuple } from '../utils/prop-types'
const drawerPlacement = tuple('top', 'right', 'bottom', 'left')
export type DrawerPlacement = typeof drawerPlacement[number]
export type DrawerTranslateItem = {
initial: string
hidden: string
visible: string
}
export const getDrawerTransform = (placement: DrawerPlace... | 2,585 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/drawer/index.ts | import Drawer from './drawer'
import ModalTitle from '../modal/modal-title'
import ModalSubtitle from '../modal/modal-subtitle'
import ModalContent from '../modal/modal-content'
export type DrawerComponentType = typeof Drawer & {
Title: typeof ModalTitle
Subtitle: typeof ModalSubtitle
Content: typeof ModalConten... | 2,586 |
0 | petrpan-code/geist-org/geist-ui/components/drawer | petrpan-code/geist-org/geist-ui/components/drawer/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Drawer } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
import { expectDrawerIsClosed, expectDrawerIsOpened } from './use-modal.test'
import userEvent from '@testing-library/user-event'
describe('Drawer', () => {
it('should... | 2,587 |
0 | petrpan-code/geist-org/geist-ui/components/drawer | petrpan-code/geist-org/geist-ui/components/drawer/__tests__/use-modal.test.tsx | import React, { useEffect } from 'react'
import { mount, ReactWrapper } from 'enzyme'
import { Drawer, useModal } from 'components'
import { updateWrapper } from 'tests/utils'
export const expectDrawerIsOpened = (wrapper: ReactWrapper) => {
expect(wrapper.find('.position').length).not.toBe(0)
}
export const expectD... | 2,588 |
0 | petrpan-code/geist-org/geist-ui/components/drawer/__tests__ | petrpan-code/geist-org/geist-ui/components/drawer/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Drawer customization should be supported 1`] = `
"<div class=\\"wrapper right test-class wrapper-enter\\" role=\\"dialog\\" tabindex=\\"-1\\"><div tabindex=\\"0\\" class=\\"hide-tab start\\" aria-hidden=\\"true\\"></div><h2 class=\\"\\">Modal</h2><style>
h2 ... | 2,589 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset-content.tsx | import React from 'react'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type FieldsetContentProps = Props & NativeAttr... | 2,590 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset-context.ts | import React from 'react'
export interface FieldItem {
value: string
label: string
}
export interface FieldsetConfig {
register?: (item: FieldItem) => void
currentValue: string
inGroup: boolean
}
const defaultContext = {
inGroup: false,
currentValue: '',
}
export const FieldsetContext = React.createCo... | 2,591 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset-footer.tsx | import React from 'react'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type FieldsetFooterProps = Props & NativeAttrs
co... | 2,592 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset-group.tsx | import React, { useCallback, useMemo, useState } from 'react'
import useTheme from '../use-theme'
import useCurrentState from '../utils/use-current-state'
import { FieldsetContext, FieldItem } from './fieldset-context'
import useWarning from '../utils/use-warning'
import useScale, { withScale } from '../use-scale'
impo... | 2,593 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset-subtitle.tsx | import React from 'react'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props>
export type FieldsetSubtitleProps = Props & NativeAttrs
const FieldsetSubtitle: React.FC<React.PropsWithChildren<FieldsetSubtitlePro... | 2,594 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset-title.tsx | import React from 'react'
import useClasses from '../use-classes'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props>
export type FieldsetTitleProps = Props & NativeAttrs
const FieldsetTitle: React.FC<React.Pro... | 2,595 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/fieldset.tsx | import React, { ReactNode, useEffect, useMemo, useState } from 'react'
import useTheme from '../use-theme'
import FieldsetTitle from './fieldset-title'
import FieldsetSubtitle from './fieldset-subtitle'
import FieldsetFooter from './fieldset-footer'
import FieldsetContent from './fieldset-content'
import { hasChild, pi... | 2,596 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/fieldset/index.ts | import Fieldset from './fieldset'
import FieldsetTitle from './fieldset-title'
import FieldsetSubtitle from './fieldset-subtitle'
import FieldsetFooter from './fieldset-footer'
import FieldsetGroup from './fieldset-group'
import FieldsetContent from './fieldset-content'
export type FieldsetComponentType = typeof Field... | 2,597 |
0 | petrpan-code/geist-org/geist-ui/components/fieldset | petrpan-code/geist-org/geist-ui/components/fieldset/__tests__/group.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Fieldset } from 'components'
describe('Fieldset Group', () => {
it('should trigger callback when tab clicked', () => {
const callbcak = jest.fn()
const wrapper = mount(
<Fieldset.Group value="two" onChange={callbcak}>
<Fieldset l... | 2,598 |
0 | petrpan-code/geist-org/geist-ui/components/fieldset | petrpan-code/geist-org/geist-ui/components/fieldset/__tests__/index.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Fieldset } from 'components'
describe('Fieldset', () => {
it('should mount correctly', () => {
const wrapper = mount(
<Fieldset>
<Fieldset.Title>title</Fieldset.Title>
<Fieldset.Subtitle>subtitle</Fieldset.Subtitle>
... | 2,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.