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/fieldset/__tests__ | petrpan-code/geist-org/geist-ui/components/fieldset/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Fieldset should render correctly 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "fieldset",
},
"children": Array [
Node {
"attribs": Object {
"class": "content",
},
"children": Array [
... | 2,600 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/geist-provider/geist-provider.tsx | import React, { PropsWithChildren, useMemo, useState } from 'react'
import {
GeistUIContent,
defaultToastLayout,
GeistUIContextParams,
UpdateToastsFunction,
UpdateToastsIDFunction,
UpdateToastsLayoutFunction,
} from '../utils/use-geist-ui-context'
import ThemeProvider from './theme-provider'
import useCurre... | 2,601 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/geist-provider/index.ts | import GeistProvider from './geist-provider'
export type { GeistProviderProps } from './geist-provider'
export default GeistProvider
| 2,602 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/geist-provider/theme-provider.tsx | import React, { PropsWithChildren, useEffect, useMemo, useState } from 'react'
import Themes from '../themes'
import { GeistUIThemes } from '../themes/presets'
import { ThemeContext } from '../use-theme/theme-context'
import { AllThemesConfig, AllThemesContext } from '../use-all-themes/all-themes-context'
export inter... | 2,603 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/grid/basic-item.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import {
GridJustify,
GridDirection,
GridAlignItems,
GridAlignContent,
} from './grid-types'
import useScale from '../use-scale'
import useClasses from '../use-classes'
export type GridBreakpointsValue = number | boolean
export interfac... | 2,604 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/grid/grid-container.tsx | import React, { useMemo } from 'react'
import GridBasicItem, { GridBasicItemProps } from './basic-item'
import { GridWrap } from './grid-types'
import css from 'styled-jsx/css'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
gap?: number
wrap?: GridWrap
... | 2,605 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/grid/grid-types.ts | import { tuple } from '../utils/prop-types'
const justify = tuple(
'flex-start',
'center',
'flex-end',
'space-between',
'space-around',
'space-evenly',
)
export type GridJustify = typeof justify[number]
const alignItems = tuple('flex-start', 'center', 'flex-end', 'stretch', 'baseline')
export type GridA... | 2,606 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/grid/grid.tsx | import React from 'react'
import css from 'styled-jsx/css'
import GridBasicItem, { GridBasicItemProps } from './basic-item'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
export type GridPro... | 2,607 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/grid/index.ts | import Grid from './grid'
import GridContainer from './grid-container'
export type GridComponentType = typeof Grid & {
Container: typeof GridContainer
}
;(Grid as GridComponentType).Container = GridContainer
export type { GridContainerProps } from './grid-container'
export type { GridProps } from './grid'
export ty... | 2,608 |
0 | petrpan-code/geist-org/geist-ui/components/grid | petrpan-code/geist-org/geist-ui/components/grid/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Grid } from 'components'
describe('Grid', () => {
it('should render correctly', () => {
const wrapper = mount(
<Grid.Container>
<Grid>test</Grid>
<Grid>test</Grid>
</Grid.Container>,
)
expect(wrapper.html()).to... | 2,609 |
0 | petrpan-code/geist-org/geist-ui/components/grid/__tests__ | petrpan-code/geist-org/geist-ui/components/grid/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Grid all breakpoint values should be supported 1`] = `
"<div class=\\"item xs sm md lg xl mock\\"><div class=\\"item xs sm md lg xl mock\\">test<style>
.item {
font-size: inherit;
height: auto;
}
.justify {
justif... | 2,610 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/helpers.ts | export const transformDataSource = (src: string) => {
const left = `${src}`.slice(0, 4)
if (encodeURIComponent(left) === '%3Csvg') {
return `data:image/svg+xml;utf8,${src}`
}
return src
}
export const getHostFromUrl = (url: string) => {
try {
return new URL(url).host
} catch (e) {
return url
... | 2,611 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/image-browser-https-icon.tsx | import React from 'react'
const ImageBrowserHttpsIcon = () => {
return (
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M5 10.2H19V21H5V10.2Z" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M12 12C13.933 12 15.5 10.3882 15.5 8.4C15.5 6.41177 13.933 4.8 12 4.8C10.067... | 2,612 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/image-browser.tsx | import React, { useMemo } from 'react'
import Link from '../link'
import { Props as LinkProps } from '../link/link'
import useTheme from '../use-theme'
import ImageBrowserHttpsIcon from './image-browser-https-icon'
import { getBrowserColors, BrowserColors } from './styles'
import { getHostFromUrl } from './helpers'
imp... | 2,613 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/image.skeleton.tsx | import React from 'react'
import useTheme from '../use-theme'
interface Props {
opacity?: number
}
const defaultProps = {
opacity: 0.5,
}
export type ImageSkeletonProps = Props
const ImageSkeleton: React.FC<ImageSkeletonProps> = React.memo(
({ opacity, ...props }: ImageSkeletonProps & typeof defaultProps) => ... | 2,614 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/image.tsx | import React, { useEffect, useMemo, useRef, useState } from 'react'
import useTheme from '../use-theme'
import ImageSkeleton from './image.skeleton'
import { transformDataSource } from './helpers'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
src: string... | 2,615 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/index.ts | import Image from './image'
import ImageBrowser from './image-browser'
export type ImageComponentType = typeof Image & {
Browser: typeof ImageBrowser
}
;(Image as ImageComponentType).Browser = ImageBrowser
export type { ImageProps } from './image'
export type { ImageBrowserProps, ImageAnchorProps } from './image-br... | 2,616 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/image/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
export type BrowserColors = {
color: string
barBgColor: string
inputBgColor: string
borderColor: string
titleColor: string
}
export const getBrowserColors = (
invert: boolean,
palette: GeistUIThemesPalette,
): BrowserColors => {
return invert
... | 2,617 |
0 | petrpan-code/geist-org/geist-ui/components/image | petrpan-code/geist-org/geist-ui/components/image/__tests__/browser.test.tsx | import React from 'react'
import { mount, render } from 'enzyme'
import { Image } from 'components'
const link = 'https://geist-ui.dev/en-us/guide/introduction'
const url =
'data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA' +
'AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO' +
'9TXL0Y4OHwAAAABJRU... | 2,618 |
0 | petrpan-code/geist-org/geist-ui/components/image | petrpan-code/geist-org/geist-ui/components/image/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Image } from 'components'
import { updateWrapper } from 'tests/utils'
const url =
'data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA' +
'AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO' +
'9TXL0Y4OHwAAAABJRU5ErkJggg=='
const svg = ... | 2,619 |
0 | petrpan-code/geist-org/geist-ui/components/image/__tests__ | petrpan-code/geist-org/geist-ui/components/image/__tests__/__snapshots__/browser.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Image Browser should render correctly 1`] = `
LoadedCheerio {
"0": Node {
"attribs": Object {
"class": "browser",
},
"children": Array [
Node {
"attribs": Object {},
"children": Array [
Node {
"attribs":... | 2,620 |
0 | petrpan-code/geist-org/geist-ui/components/image/__tests__ | petrpan-code/geist-org/geist-ui/components/image/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Image should render correctly 1`] = `ReactWrapper {}`;
exports[`Image should render correctly 2`] = `ReactWrapper {}`;
exports[`Image should render correctly 3`] = `ReactWrapper {}`;
exports[`Image should render correctly with svg string 1`] = `ReactWrapper {}`;
... | 2,621 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/index.ts | import Input from './input'
import Textarea from '../textarea'
import InputPassword from './password'
export type InputComponentType = typeof Input & {
Textarea: typeof Textarea
Password: typeof InputPassword
}
;(Input as InputComponentType).Textarea = Textarea
;(Input as InputComponentType).Password = InputPasswo... | 2,622 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/input-block-label.tsx | import React from 'react'
import useTheme from '../use-theme'
export interface InputBlockLabelLabel {}
const InputBlockLabelComponent: React.FC<
React.PropsWithChildren<InputBlockLabelLabel>
> = ({ children }) => {
const theme = useTheme()
return (
<label>
{children}
<style jsx>{`
label... | 2,623 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/input-icon-clear.tsx | import React from 'react'
import useTheme from '../use-theme'
import useClasses from '../use-classes'
interface Props {
visible: boolean
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void
disabled?: boolean
}
const InputIconClear: React.FC<Props> = ({ onClick, disabled, visible }) => {
const theme = ... | 2,624 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/input-icon.tsx | import React from 'react'
export interface InputIconProps {
icon: React.ReactNode
clickable: boolean
onClick: (e: React.MouseEvent<HTMLDivElement>) => void
}
const InputIconComponent: React.FC<InputIconProps> = ({ icon, clickable, onClick }) => {
return (
<span className="input-icon" onClick={onClick}>
... | 2,625 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/input-label.tsx | import React from 'react'
import useTheme from '../use-theme'
export interface InputLabel {
isRight?: boolean
}
const InputLabel: React.FC<React.PropsWithChildren<InputLabel>> = ({
children,
isRight,
}) => {
const theme = useTheme()
return (
<span className={isRight ? 'right' : ''}>
{children}
... | 2,626 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/input-props.ts | import React from 'react'
import { NormalTypes } from '../utils/prop-types'
export type InputTypes = NormalTypes
export interface Props {
value?: string
initialValue?: string
placeholder?: string
type?: InputTypes
htmlType?: string
readOnly?: boolean
disabled?: boolean
label?: string
labelRight?: str... | 2,627 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/input.tsx | import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
import useTheme from '../use-theme'
import InputLabel from './input-label'
import InputBlockLabel from './input-block-label'
import InputIcon from './input-icon'
import InputClearIcon from './input-icon-clear'
import { getColors } ... | 2,628 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/password-icon.tsx | import React from 'react'
interface Props {
visible: boolean
}
const PasswordIcon: React.FC<Props> = ({ visible }) => {
return (
<svg
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="g... | 2,629 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/password.tsx | import React, { useImperativeHandle, useMemo, useRef, useState } from 'react'
import { Props, defaultProps } from './input-props'
import PasswordIcon from './password-icon'
import Input from './input'
import { useScale, withScale } from '../use-scale'
interface PasswordProps extends Props {
hideToggle?: boolean
}
c... | 2,630 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/input/styles.ts | import { NormalTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
export type InputColor = {
color: string
borderColor: string
hoverBorder: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): InputColor => {
const colors: { [... | 2,631 |
0 | petrpan-code/geist-org/geist-ui/components/input | petrpan-code/geist-org/geist-ui/components/input/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Input } from 'components'
import { nativeEvent } from 'tests/utils'
describe('Input', () => {
it('should render correctly', () => {
const wrapper = mount(<Input placeholder="placeholder" />)
expect(() => wrapper.unmount()).not.toThrow()
})
... | 2,632 |
0 | petrpan-code/geist-org/geist-ui/components/input | petrpan-code/geist-org/geist-ui/components/input/__tests__/password.test.tsx | import React from 'react'
import { mount, shallow } from 'enzyme'
import { Input } from 'components'
import { nativeEvent } from 'tests/utils'
describe('InputPassword', () => {
it('should render correctly', () => {
const wrapper = mount(<Input.Password />)
const el = wrapper.find('input').getDOMNode() as HTM... | 2,633 |
0 | petrpan-code/geist-org/geist-ui/components/input/__tests__ | petrpan-code/geist-org/geist-ui/components/input/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Input should be work with icon 1`] = `
"<div><div class=\\"with-label\\"><div class=\\"input-container\\"><div class=\\"input-wrapper\\"><span class=\\"input-icon\\"><span>test-icon</span><style>
.input-icon {
box-sizing: border-box;
displ... | 2,634 |
0 | petrpan-code/geist-org/geist-ui/components/input/__tests__ | petrpan-code/geist-org/geist-ui/components/input/__tests__/__snapshots__/password.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`InputPassword should render correctly 1`] = `
"<div class=\\"with-label\\"><div class=\\"input-container\\"><div class=\\"input-wrapper\\"><input type=\\"password\\" class=\\"right-icon\\" placeholder=\\"\\" autocomplete=\\"off\\" value=\\"\\"><span class=\\"input-ic... | 2,635 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/keyboard/index.ts | import Keyboard from './keyboard'
export type { KeyboardProps } from './keyboard'
export default Keyboard
| 2,636 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/keyboard/keyboard.tsx | import React from 'react'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
interface Props {
command?: boolean
shift?: boolean
option?: boolean
ctrl?: boolean
className?: string
}
const defaultProps = {
command: false,
shift: false,
option: false,
ctrl: false,
... | 2,637 |
0 | petrpan-code/geist-org/geist-ui/components/keyboard | petrpan-code/geist-org/geist-ui/components/keyboard/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Keyboard } from 'components'
describe('Keyboard', () => {
it('should render correctly', () => {
const wrapper = mount(<Keyboard>F</Keyboard>)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
i... | 2,638 |
0 | petrpan-code/geist-org/geist-ui/components/keyboard/__tests__ | petrpan-code/geist-org/geist-ui/components/keyboard/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Keyboard should render correctly 1`] = `
"<kbd class=\\"\\"><span>F</span><style>
kbd {
line-height: 2em;
text-align: center;
display: inline-block;
color: #666;
background-color: #fafafa;
font-famil... | 2,639 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/link/icon.tsx | import React from 'react'
export const LinkIconComponent: React.FC<unknown> = () => {
return (
<svg
viewBox="0 0 24 24"
width="0.9375em"
height="0.9375em"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRe... | 2,640 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/link/index.ts | import Link from './link'
export type { LinkProps } from './link'
export default Link
| 2,641 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/link/link.tsx | import React from 'react'
import useTheme from '../use-theme'
import LinkIcon from './icon'
import { addColorAlpha } from '../utils/color'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
export interface Props {
href?: string
color?: boolean
icon?: boolean
underline?:... | 2,642 |
0 | petrpan-code/geist-org/geist-ui/components/link | petrpan-code/geist-org/geist-ui/components/link/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Link } from 'components'
describe('Link', () => {
it('should render correctly', () => {
const wrapper = mount(
<div>
<Link href="https://geist-ui.dev">link</Link>
<Link href="https://geist-ui.dev" color>
link
... | 2,643 |
0 | petrpan-code/geist-org/geist-ui/components/link/__tests__ | petrpan-code/geist-org/geist-ui/components/link/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Link should render correctly 1`] = `
"<div><a class=\\"link\\" href=\\"https://geist-ui.dev\\">link<style>
.link {
display: inline-flex;
align-items: baseline;
line-height: inherit;
color: inherit;
... | 2,644 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/loading/index.ts | import Loading from './loading'
export type { LoadingProps, LoadingTypes } from './loading'
export default Loading
| 2,645 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/loading/loading.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { NormalTypes } from '../utils/prop-types'
import { GeistUIThemesPalette } from '../themes/presets'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
export type LoadingTypes = NormalTypes
interfa... | 2,646 |
0 | petrpan-code/geist-org/geist-ui/components/loading | petrpan-code/geist-org/geist-ui/components/loading/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Loading } from 'components'
describe('Loading', () => {
it('should render correctly', () => {
const wrapper = mount(<Loading />)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).toMatchSnapshot()
})
it('should ... | 2,647 |
0 | petrpan-code/geist-org/geist-ui/components/loading/__tests__ | petrpan-code/geist-org/geist-ui/components/loading/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Loading should render correctly 1`] = `
"<div class=\\"loading-container\\"><span class=\\"loading\\"><i></i><i></i><i></i></span><style>
.loading-container {
display: inline-flex;
align-items: center;
position: relative;
... | 2,648 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/index.ts | import Modal from './modal'
import ModalTitle from './modal-title'
import ModalSubtitle from './modal-subtitle'
import ModalContent from './modal-content'
import ModalAction from './modal-action'
export type ModalComponentType = typeof Modal & {
Title: typeof ModalTitle
Subtitle: typeof ModalSubtitle
Content: ty... | 2,649 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-action.tsx | import React, { MouseEvent, useImperativeHandle, useMemo, useRef } from 'react'
import css from 'styled-jsx/css'
import useTheme from '../use-theme'
import { useModalContext } from './modal-context'
import Button, { ButtonProps } from '../button/button'
import useScale, { withScale } from '../use-scale'
import useClass... | 2,650 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-actions.tsx | import React, { useEffect, useRef, useState } from 'react'
import useTheme from '../use-theme'
const ModalActionsComponent: React.FC<React.PropsWithChildren<unknown>> = ({
children,
...props
}) => {
const theme = useTheme()
const ref = useRef<HTMLDivElement>(null)
const [height, setHeight] = useState<number ... | 2,651 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-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<HTMLElement>, keyof Props>
export type ModalContentProps = Props & Nativ... | 2,652 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-context.ts | import React from 'react'
export interface ModalConfig {
close?: () => void
}
const defaultContext = {}
export const ModalContext = React.createContext<ModalConfig>(defaultContext)
export const useModalContext = (): ModalConfig =>
React.useContext<ModalConfig>(ModalContext)
| 2,653 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-subtitle.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<HTMLHeadingElement>, keyof Props>
export type ModalSubtitleProps = Props & N... | 2,654 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-title.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 ModalTitleProps = Props & NativeAttrs
const ... | 2,655 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal-wrapper.tsx | import React, { useEffect, useRef } from 'react'
import useTheme from '../use-theme'
import CssTransition from '../shared/css-transition'
import { isChildElement } from '../utils/collections'
import useScale from '../use-scale'
import useClasses from '../use-classes'
interface Props {
className?: string
visible?: ... | 2,656 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/modal/modal.tsx | import React, { MouseEvent, useEffect, useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import usePortal from '../utils/use-portal'
import ModalWrapper from './modal-wrapper'
import ModalAction from './modal-action'
import ModalActions from './modal-actions'
import Backdrop from '../shared/back... | 2,657 |
0 | petrpan-code/geist-org/geist-ui/components/modal | petrpan-code/geist-org/geist-ui/components/modal/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Modal } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
import {
expectModalIsClosed,
expectModalIsOpened,
} from '../../use-modal/__tests__/use-modal.test'
import userEvent from '@testing-library/user-event'
describe('Mod... | 2,658 |
0 | petrpan-code/geist-org/geist-ui/components/modal/__tests__ | petrpan-code/geist-org/geist-ui/components/modal/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Modal customization should be supported 1`] = `
"<div class=\\"wrapper test-class wrapper-enter\\" role=\\"dialog\\" tabindex=\\"-1\\"><div tabindex=\\"0\\" class=\\"hide-tab\\" aria-hidden=\\"true\\"></div><h2 class=\\"\\">Modal</h2><style>
h2 {
l... | 2,659 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/note/index.ts | import Note from './note'
export type { NoteProps, NoteTypes } from './note'
export default Note
| 2,660 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/note/note.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 NoteTypes = NormalTypes
interface Props {... | 2,661 |
0 | petrpan-code/geist-org/geist-ui/components/note | petrpan-code/geist-org/geist-ui/components/note/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Note } from 'components'
import { updateWrapper } from 'tests/utils'
describe('Note', () => {
it('should render correctly', () => {
const wrapper = mount(<Note>note</Note>)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmo... | 2,662 |
0 | petrpan-code/geist-org/geist-ui/components/note/__tests__ | petrpan-code/geist-org/geist-ui/components/note/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Note should render correctly 1`] = `
"<div class=\\"note\\"><span class=\\"label\\"><b>note:</b></span>note<style>
.note {
line-height: 1.8;
border: 1px solid #eaeaea;
color: #000;
background-color: #fff;
bord... | 2,663 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/page/index.ts | import Page from './page'
import PageHeader from './page-header'
import PageContent from './page-content'
import PageFooter from './page-footer'
export type PageComponentType = typeof Page & {
Header: typeof PageHeader
Content: typeof PageContent
Body: typeof PageContent
Footer: typeof PageFooter
}
;(Page as P... | 2,664 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/page/page-content.tsx | import React from 'react'
import useScale, { withScale } from '../use-scale'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type PageContentProps = Props & NativeAttrs
const PageContentComponent: React.FC<Reac... | 2,665 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/page/page-footer.tsx | import React from 'react'
import useScale, { withScale } from '../use-scale'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type PageFooterProps = Props & NativeAttrs
const PageFooterComponent: React.FC<React.... | 2,666 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/page/page-header.tsx | import React from 'react'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
center?: boolean
className?: string
}
const defaultProps = {
center: false,
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type PageH... | 2,667 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/page/page.tsx | import React, { CSSProperties, useEffect, useMemo, useState } from 'react'
import { tuple } from '../utils/prop-types'
import useTheme from '../use-theme'
import PageContent from './page-content'
import { hasChild } from '../utils/collections'
import useScale, { withScale } from '../use-scale'
const renderMode = tuple... | 2,668 |
0 | petrpan-code/geist-org/geist-ui/components/page | petrpan-code/geist-org/geist-ui/components/page/__tests__/child.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Page } from 'components'
describe('PageChild', () => {
it('the component Page.Content should be injected automatically', () => {
const wrapper = mount(<Page>test-value</Page>)
const content = mount(
<Page>
<Page.Content>test-valu... | 2,669 |
0 | petrpan-code/geist-org/geist-ui/components/page | petrpan-code/geist-org/geist-ui/components/page/__tests__/index.test.tsx | import React from 'react'
import ReactDom from 'react-dom/server'
import { mount } from 'enzyme'
import { Page, GeistProvider } from 'components'
describe('Page', () => {
it('should render correctly', () => {
const wrapper = mount(<Page>test-value</Page>)
expect(wrapper.text()).toContain('test-value')
ex... | 2,670 |
0 | petrpan-code/geist-org/geist-ui/components/page/__tests__ | petrpan-code/geist-org/geist-ui/components/page/__tests__/__snapshots__/child.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PageChild should work with child component 1`] = `
"<section>outside string<header class=\\"\\">header<style>
header {
font-size: calc(1 * 16px);
width: 100%;
height: auto;
padding: 0 0 0 0;
margin: 0 0 0 0;
... | 2,671 |
0 | petrpan-code/geist-org/geist-ui/components/page/__tests__ | petrpan-code/geist-org/geist-ui/components/page/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Page should render correctly 1`] = `
"<section><main class=\\"\\">test-value<style>
main {
font-size: calc(1 * 16px);
width: 100%;
height: 100%;
padding: calc(3.125 * 16px) 0 calc(3.125 * 16px) 0;
margin: 0 0 ... | 2,672 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/index.ts | import Pagination from './pagination'
import PaginationPrevious from './pagination-previous'
import PaginationNext from './pagination-next'
export type PaginationComponentType = typeof Pagination & {
Previous: typeof PaginationPrevious
Next: typeof PaginationNext
}
;(Pagination as PaginationComponentType).Previous... | 2,673 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination-context.ts | import React from 'react'
import { tuple } from '../utils/prop-types'
const paginationUpdateTypes = tuple('prev', 'next', 'click')
export type PaginationUpdateType = typeof paginationUpdateTypes[number]
export interface PaginationConfig {
isFirst?: boolean
isLast?: boolean
update?: (type: PaginationUpdateType) ... | 2,674 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination-ellipsis.tsx | import React, { useState } from 'react'
import PaginationItem from './pagination-item'
interface Props {
isBefore?: boolean
onClick?: (e: React.MouseEvent) => void
}
const PaginationEllipsis: React.FC<Props> = ({ isBefore, onClick }) => {
const [showMore, setShowMore] = useState(false)
return (
<Paginati... | 2,675 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination-item.tsx | import React, { useMemo } from 'react'
import useTheme from '../use-theme'
import { addColorAlpha } from '../utils/color'
import useClasses from '../use-classes'
interface Props {
active?: boolean
disabled?: boolean
onClick?: (e: React.MouseEvent) => void
}
type NativeAttrs = Omit<React.ButtonHTMLAttributes<any... | 2,676 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination-next.tsx | import React from 'react'
import PaginationItem from './pagination-item'
import { usePaginationContext } from './pagination-context'
export type PaginationNextProps = React.ButtonHTMLAttributes<any>
const PaginationNext: React.FC<React.PropsWithChildren<PaginationNextProps>> = ({
children,
...props
}) => {
cons... | 2,677 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination-pages.tsx | import React, { Dispatch, SetStateAction, useCallback, useMemo } from 'react'
import PaginationItem from './pagination-item'
import PaginationEllipsis from './pagination-ellipsis'
interface Props {
limit: number
count: number
current: number
setPage: Dispatch<SetStateAction<number>>
}
const PaginationPages: R... | 2,678 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination-previous.tsx | import React from 'react'
import PaginationItem from './pagination-item'
import { usePaginationContext } from './pagination-context'
export type PaginationPreviousProps = React.ButtonHTMLAttributes<any>
const PaginationPrevious: React.FC<React.PropsWithChildren<PaginationPreviousProps>> = ({
children,
...props
})... | 2,679 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/pagination/pagination.tsx | import React, { useEffect, useMemo } from 'react'
import PaginationPrevious from './pagination-previous'
import PaginationNext from './pagination-next'
import PaginationPages from './pagination-pages'
import {
PaginationContext,
PaginationConfig,
PaginationUpdateType,
} from './pagination-context'
import useCurre... | 2,680 |
0 | petrpan-code/geist-org/geist-ui/components/pagination | petrpan-code/geist-org/geist-ui/components/pagination/__tests__/pagination.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Pagination } from 'components'
import { act } from 'react-dom/test-utils'
import { updateWrapper } from 'tests/utils'
describe('Pagination', () => {
it('should render correctly', () => {
const wrapper = mount(<Pagination />)
expect(wrapper.htm... | 2,681 |
0 | petrpan-code/geist-org/geist-ui/components/pagination/__tests__ | petrpan-code/geist-org/geist-ui/components/pagination/__tests__/__snapshots__/pagination.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Pagination should render correctly 1`] = `
"<nav class=\\"\\"><li><button class=\\"disabled\\">prev</button><style>
li {
margin-right: 0.428em;
display: inline-block;
}
button {
border: none;
display: in... | 2,682 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/popover/index.ts | import Popover from './popover'
import PopoverItem from './popover-item'
export type PopoverComponentType = typeof Popover & {
Item: typeof PopoverItem
Option: typeof PopoverItem
}
;(Popover as PopoverComponentType).Item = PopoverItem
;(Popover as PopoverComponentType).Option = PopoverItem
export type { PopoverPr... | 2,683 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/popover/popover-context.ts | import React, { useContext } from 'react'
export type PopoverConfig = {
disableItemsAutoClose: boolean
onItemClick: (e: React.MouseEvent<HTMLDivElement>) => void
}
const defaultContext = {
disableItemsAutoClose: false,
onItemClick: () => {},
}
export const PopoverContext = React.createContext<PopoverConfig>(... | 2,684 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/popover/popover-item.tsx | import React from 'react'
import useTheme from '../use-theme'
import useScale, { withScale } from '../use-scale'
import { usePopoverContext } from './popover-context'
import useClasses from '../use-classes'
interface Props {
line?: boolean
title?: boolean
disableAutoClose?: boolean
onClick?: (e: React.MouseEve... | 2,685 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/popover/popover.tsx | import React, { useEffect, useMemo, useState } from 'react'
import Tooltip, {
TooltipOnVisibleChange,
TooltipProps,
TooltipTypes,
} from '../tooltip/tooltip'
import { Placement, TriggerTypes } from '../utils/prop-types'
import { getReactNode } from '../utils/collections'
import useScale, { withScale } from '../us... | 2,686 |
0 | petrpan-code/geist-org/geist-ui/components/popover | petrpan-code/geist-org/geist-ui/components/popover/__tests__/index.test.tsx | import React from 'react'
import { mount, ReactWrapper } from 'enzyme'
import { Popover } from 'components'
import { nativeEvent, updateWrapper } from 'tests/utils'
const expectPopoverIsShow = (wrapper: ReactWrapper) => {
expect(wrapper.find('.inner').length).not.toBe(0)
}
const expectPopoverIsHidden = (wrapper: Re... | 2,687 |
0 | petrpan-code/geist-org/geist-ui/components/popover/__tests__ | petrpan-code/geist-org/geist-ui/components/popover/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Popover should render react-node 1`] = `
"<div class=\\"tooltip\\"><div></div><style>
:global(.tooltip-content.popover > .inner) {
padding: calc(0.9 * 16px) 0 calc(0.9 * 16px) 0;
}
</style><style>
.tooltip {
w... | 2,688 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/progress/index.ts | import Progress from './progress'
export type { ProgressProps, ProgressColors, ProgressTypes } from './progress'
export default Progress
| 2,689 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/progress/progress.tsx | import React from 'react'
import useTheme from '../use-theme'
import { useProportions } from '../utils/calculations'
import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
expo... | 2,690 |
0 | petrpan-code/geist-org/geist-ui/components/progress | petrpan-code/geist-org/geist-ui/components/progress/__tests__/index.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Progress } from 'components'
describe('Progress', () => {
it('should render correctly', () => {
const wrapper = mount(<Progress value={59} />)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
i... | 2,691 |
0 | petrpan-code/geist-org/geist-ui/components/progress/__tests__ | petrpan-code/geist-org/geist-ui/components/progress/__tests__/__snapshots__/index.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Progress should be render background-color with color prop 1`] = `
"<div class=\\"progress\\"><div class=\\"inner\\" title=\\"59%\\"></div><progress class=\\"\\" value=\\"59\\" max=\\"100\\"></progress><style>
progress {
position: fixed;
t... | 2,692 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/radio/index.ts | import Radio from './radio'
import RadioGroup from './radio-group'
import RadioDescription from './radio-description'
export type RadioComponentType = typeof Radio & {
Group: typeof RadioGroup
Description: typeof RadioDescription
Desc: typeof RadioDescription
}
;(Radio as RadioComponentType).Group = RadioGroup
;... | 2,693 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/radio/radio-context.ts | import React from 'react'
export interface RadioConfig {
updateState?: (value: string | number) => void
disabledAll: boolean
value?: string | number
inGroup: boolean
}
const defaultContext = {
disabledAll: false,
inGroup: false,
}
export const RadioContext = React.createContext<RadioConfig>(defaultContex... | 2,694 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/radio/radio-description.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 RadioDescriptionProps = Props & NativeAttrs
... | 2,695 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/radio/radio-group.tsx | import React, { useEffect, useMemo, useState } from 'react'
import { RadioContext } from './radio-context'
import useScale, { withScale } from '../use-scale'
import useClasses from '../use-classes'
interface Props {
value?: string | number
initialValue?: string | number
disabled?: boolean
onChange?: (value: st... | 2,696 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/radio/radio.tsx | import React, { useEffect, useMemo, useState } from 'react'
import useTheme from '../use-theme'
import { useRadioContext } from './radio-context'
import RadioDescription from './radio-description'
import { pickChild } from '../utils/collections'
import useWarning from '../utils/use-warning'
import { NormalTypes } from ... | 2,697 |
0 | petrpan-code/geist-org/geist-ui/components | petrpan-code/geist-org/geist-ui/components/radio/styles.ts | import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
export type RadioColor = {
label: string
border: string
bg: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): RadioColor => {
const colors: { [key in NormalT... | 2,698 |
0 | petrpan-code/geist-org/geist-ui/components/radio | petrpan-code/geist-org/geist-ui/components/radio/__tests__/group.test.tsx | import React from 'react'
import { mount } from 'enzyme'
import { Radio } from 'components'
import { nativeEvent } from 'tests/utils'
describe('Radio Group', () => {
it('should render correctly', () => {
const wrapper = mount(
<div>
<Radio.Group value="1">
<Radio value="1">1</Radio>
... | 2,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.