├── hooks ├── index.ts └── usePrefetchOnHover.ts ├── .yalc └── @stoplight │ └── mosaic │ ├── yalc.sig │ ├── components │ ├── Avatar │ │ ├── index.d.ts │ │ └── Avatar.d.ts │ ├── Card │ │ ├── index.d.ts │ │ └── Card.d.ts │ ├── Code │ │ ├── index.d.ts │ │ └── Code.d.ts │ ├── Flex │ │ ├── index.d.ts │ │ └── Flex.d.ts │ ├── Grid │ │ ├── index.d.ts │ │ └── Grid.d.ts │ ├── Icon │ │ ├── index.d.ts │ │ └── Icon.d.ts │ ├── Image │ │ ├── index.d.ts │ │ └── Image.d.ts │ ├── Input │ │ ├── index.d.ts │ │ ├── variants.d.ts │ │ └── Input.d.ts │ ├── Link │ │ ├── index.d.ts │ │ └── Link.d.ts │ ├── Modal │ │ ├── index.d.ts │ │ └── Modal.d.ts │ ├── NoSsr │ │ ├── index.d.ts │ │ └── NoSsr.d.ts │ ├── Panel │ │ ├── index.d.ts │ │ ├── PanelContent.d.ts │ │ ├── PanelTitlebar.d.ts │ │ └── Panel.d.ts │ ├── Prose │ │ ├── index.d.ts │ │ └── Prose.d.ts │ ├── Stack │ │ ├── index.d.ts │ │ └── Stack.d.ts │ ├── Text │ │ ├── index.d.ts │ │ └── Text.d.ts │ ├── Article │ │ ├── index.d.ts │ │ └── Article.d.ts │ ├── Divider │ │ ├── index.d.ts │ │ └── Divider.d.ts │ ├── Heading │ │ ├── index.d.ts │ │ └── Heading.d.ts │ ├── Overlay │ │ ├── index.d.ts │ │ └── Overlay.d.ts │ ├── Popover │ │ ├── index.d.ts │ │ └── Popover.d.ts │ ├── Provider │ │ ├── index.d.ts │ │ └── Provider.d.ts │ ├── Tooltip │ │ ├── index.d.ts │ │ └── Tooltip.d.ts │ ├── TreeItem │ │ ├── index.d.ts │ │ └── TreeItem.d.ts │ ├── Container │ │ ├── index.d.ts │ │ └── Container.d.ts │ ├── EntityName │ │ ├── index.d.ts │ │ └── EntityName.d.ts │ ├── InvertTheme │ │ ├── index.d.ts │ │ └── InvertTheme.d.ts │ ├── LinkHeading │ │ ├── index.d.ts │ │ └── LinkHeading.d.ts │ ├── Paragraph │ │ ├── index.d.ts │ │ └── Paragraph.d.ts │ ├── Box │ │ ├── index.d.ts │ │ ├── Box.d.ts │ │ └── types.d.ts │ ├── Pressable │ │ └── index.d.ts │ ├── Button │ │ ├── index.d.ts │ │ ├── variants.d.ts │ │ ├── Button.d.ts │ │ └── FieldButton.d.ts │ ├── Tabs │ │ ├── index.d.ts │ │ ├── TabList.d.ts │ │ ├── Tab.d.ts │ │ ├── TabPanel.d.ts │ │ ├── Tabs.d.ts │ │ └── TabsContext.d.ts │ ├── Menu │ │ ├── MenuDivider.d.ts │ │ ├── index.d.ts │ │ ├── MenuOption.d.ts │ │ ├── MenuRadioGroup.d.ts │ │ ├── Menu.d.ts │ │ └── MenuItem.d.ts │ └── Select │ │ ├── index.d.ts │ │ ├── SelectSection.d.ts │ │ ├── SelectAction.d.ts │ │ ├── SelectOption.d.ts │ │ ├── Select.d.ts │ │ └── types.d.ts │ ├── hooks │ ├── use-is-ssr.d.ts │ ├── use-theme-is-dark.d.ts │ ├── use-theme-mode.d.ts │ ├── use-clipboard.d.ts │ ├── index.d.ts │ ├── use-theme.d.ts │ ├── use-theme-store.d.ts │ └── use-controllable-state.d.ts │ ├── utils │ ├── css.d.ts │ ├── index.d.ts │ ├── function.d.ts │ ├── color-manipulation.d.ts │ ├── use-dom-ref.d.ts │ ├── types.d.ts │ ├── assertion.d.ts │ ├── theme.d.ts │ └── split-box-props.d.ts │ ├── enhancers │ ├── types.d.ts │ ├── index.d.ts │ ├── shadow.d.ts │ ├── pseudo.d.ts │ ├── layout.d.ts │ ├── position.d.ts │ ├── interactivity.d.ts │ ├── size.d.ts │ ├── spacing.d.ts │ ├── color.d.ts │ ├── border.d.ts │ ├── flex.d.ts │ └── typography.d.ts │ ├── styles.d.ts │ ├── index.d.ts │ ├── package.json │ └── themes │ └── default.css ├── vercel.json ├── next-env.d.ts ├── .prettierrc.js ├── README.md ├── .eslintignore ├── styles.css ├── components ├── SEO.tsx ├── ListDetail.tsx ├── ListItem.tsx ├── List.tsx ├── PageTransition.tsx ├── GlobalProgressBar.tsx ├── ErrorBoundary.tsx ├── ThemeSwitcher.tsx ├── StoplightProjectSidebar.tsx ├── NextNProgress.tsx └── SiteHeader.tsx ├── yalc.lock ├── utils └── sample-data.ts ├── interfaces └── index.ts ├── pages ├── index.tsx ├── 404.tsx ├── _app.tsx ├── _document.tsx └── docs │ └── [projectSlug] │ └── [[...docsPath]].tsx ├── next-seo.config.js ├── handlers └── node.ts ├── next.config.js ├── .gitignore ├── .eslintrc.json ├── tsconfig.json ├── layouts ├── SiteLayout.tsx └── StoplightProjectLayout.tsx └── package.json /hooks/index.ts: -------------------------------------------------------------------------------- 1 | export * from './usePrefetchOnHover'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/yalc.sig: -------------------------------------------------------------------------------- 1 | 23684a307ac0cd403399d568aec83f73 -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "github": { 3 | "silent": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Avatar/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Avatar'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Card/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Card'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Code/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Code'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Flex/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Flex'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Grid/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Grid'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Icon/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Icon'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Image/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Image'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Input/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Input'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Link/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Link'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Modal/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Modal'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/NoSsr/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './NoSsr'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Panel/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Panel'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Prose/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Prose'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Stack/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Stack'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Text/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Text'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Article/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Article'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Divider/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Divider'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Heading/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Heading'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Overlay/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Overlay'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Popover/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Popover'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Provider/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Provider'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tooltip/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Tooltip'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/TreeItem/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './TreeItem'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Container/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Container'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/EntityName/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './EntityName'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/InvertTheme/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './InvertTheme'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/LinkHeading/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './LinkHeading'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Paragraph/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Paragraph'; 2 | -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@stoplight/eslint-config/prettier.config'), 3 | }; 4 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Box/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Box'; 2 | export * from './types'; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-is-ssr.d.ts: -------------------------------------------------------------------------------- 1 | export { useIsSSR, useSSRSafeId } from '@react-aria/ssr'; 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stoplight Dev Portal 2 | 3 | ## Development 4 | 5 | ```bash 6 | yarn 7 | yarn dev 8 | ``` 9 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | build 4 | coverage 5 | .eslintrc.js 6 | .yalc 7 | .yarn 8 | .cache 9 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-theme-is-dark.d.ts: -------------------------------------------------------------------------------- 1 | export declare const useThemeIsDark: () => boolean; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Pressable/index.d.ts: -------------------------------------------------------------------------------- 1 | export { PressResponder, Pressable } from '@react-aria/interactions'; 2 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Card/Card.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare const Card: (props: any) => JSX.Element; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Grid/Grid.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare const Grid: (props: any) => JSX.Element; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Image/Image.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare const Image: (props: any) => JSX.Element; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Button/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Button'; 2 | export * from './CopyButton'; 3 | export * from './FieldButton'; 4 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Divider/Divider.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare const Divider: (props: any) => JSX.Element; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/TreeItem/TreeItem.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare const TreeItem: (props: any) => JSX.Element; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tabs/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Tab'; 2 | export * from './TabList'; 3 | export * from './TabPanel'; 4 | export * from './Tabs'; 5 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | @import '@stoplight/elements/styles/elements.min.css'; 2 | 3 | #__next { 4 | min-height: 100vh; 5 | display: flex; 6 | flex-direction: column; 7 | } 8 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Menu/MenuDivider.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | export declare const MenuDivider: React.ForwardRefExoticComponent>; 3 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Panel/PanelContent.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { BoxOwnProps } from '../Box'; 3 | export declare const PanelContent: React.FC; 4 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-theme-mode.d.ts: -------------------------------------------------------------------------------- 1 | export declare const useThemeMode: () => { 2 | mode: import("..").ThemeMode; 3 | setMode: (mode: import("..").ThemeMode) => void; 4 | }; 5 | -------------------------------------------------------------------------------- /components/SEO.tsx: -------------------------------------------------------------------------------- 1 | import { NextSeo } from 'next-seo'; 2 | import * as React from 'react'; 3 | 4 | export const SEO = ({ title, description }) => ; 5 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-clipboard.d.ts: -------------------------------------------------------------------------------- 1 | export declare function useClipboard(text: string, timeout?: number): { 2 | value: string; 3 | onCopy: () => void; 4 | hasCopied: boolean; 5 | }; 6 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Menu/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Menu'; 2 | export * from './MenuItem'; 3 | export * from './MenuOption'; 4 | export * from './MenuDivider'; 5 | export * from './MenuRadioGroup'; 6 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Select/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Select'; 2 | export * from './SelectAction'; 3 | export * from './SelectOption'; 4 | export * from './SelectSection'; 5 | export * from './types'; 6 | -------------------------------------------------------------------------------- /yalc.lock: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v1", 3 | "packages": { 4 | "@stoplight/mosaic": { 5 | "signature": "23684a307ac0cd403399d568aec83f73", 6 | "file": true, 7 | "replaced": "~1.0.0-beta.30" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/css.d.ts: -------------------------------------------------------------------------------- 1 | export declare const findCss: (id: string) => HTMLStyleElement; 2 | export declare const appendCss: (id: string, css: string) => void; 3 | export declare const replaceCss: (id: string, css: string) => void; 4 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tabs/TabList.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | export declare type TabListOwnProps = { 3 | children: React.ReactNode; 4 | }; 5 | export declare const TabList: (props: TabListOwnProps) => JSX.Element; 6 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Article/Article.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { BoxProps } from '../Box'; 3 | export declare type ArticleProps = BoxProps; 4 | export declare const Article: React.NamedExoticComponent>; 5 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Prose/Prose.d.ts: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import React from 'react'; 3 | import { BoxProps } from '../Box'; 4 | export declare type ProseProps = BoxProps<'div'>; 5 | export declare const Prose: React.NamedExoticComponent>; 6 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Select/SelectSection.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { SelectSectionProps } from './types'; 3 | declare let _SelectSection: (props: SelectSectionProps) => JSX.Element; 4 | export { _SelectSection as SelectSection }; 5 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/types.d.ts: -------------------------------------------------------------------------------- 1 | declare type Without = Pick>; 2 | export declare type EnhancerFn = (props: T) => { 3 | props: Without; 4 | className: string; 5 | }; 6 | export {}; 7 | -------------------------------------------------------------------------------- /utils/sample-data.ts: -------------------------------------------------------------------------------- 1 | import { User } from '../interfaces'; 2 | 3 | /** Dummy user data. */ 4 | export const sampleUserData: User[] = [ 5 | { id: 101, name: 'Alice' }, 6 | { id: 102, name: 'Bob' }, 7 | { id: 103, name: 'Caroline' }, 8 | { id: 104, name: 'Dave' }, 9 | ]; 10 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Box/Box.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { BoxProps } from './types'; 3 | declare const defaultElement = "div"; 4 | export declare const Box: (props: BoxProps) => JSX.Element; 5 | export {}; 6 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './use-clipboard'; 2 | export * from './use-controllable-state'; 3 | export * from './use-is-ssr'; 4 | export * from './use-theme-is-dark'; 5 | export * from './use-theme-mode'; 6 | export * from './use-theme-store'; 7 | export * from './use-theme'; 8 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './assertion'; 2 | export * from './color-manipulation'; 3 | export * from './css'; 4 | export * from './function'; 5 | export * from './split-box-props'; 6 | export * from './theme'; 7 | export * from './types'; 8 | export * from './use-dom-ref'; 9 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Input/variants.d.ts: -------------------------------------------------------------------------------- 1 | import { IntentVals } from '../../enhancers'; 2 | import { BoxOwnProps } from '../Box/types'; 3 | export declare type AppearanceVals = 'default' | 'minimal'; 4 | export declare const variants: Record>>; 5 | -------------------------------------------------------------------------------- /interfaces/index.ts: -------------------------------------------------------------------------------- 1 | // You can include shared interfaces/types in a separate file 2 | // and then use them in any component by importing them. For 3 | // example, to import the interface below do: 4 | // 5 | // import { User } from 'path/to/interfaces'; 6 | 7 | export type User = { 8 | id: number; 9 | name: string; 10 | }; 11 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/InvertTheme/InvertTheme.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | export declare const InvertThemeContext: React.Context<{ 3 | inverted?: boolean; 4 | }>; 5 | export declare const InvertTheme: ({ children, inverted }: { 6 | children: JSX.Element; 7 | inverted?: boolean; 8 | }) => JSX.Element; 9 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Provider/Provider.d.ts: -------------------------------------------------------------------------------- 1 | import React, { CSSProperties } from 'react'; 2 | export declare type ProviderProps = { 3 | children: React.ReactNode; 4 | className?: string; 5 | style?: CSSProperties; 6 | }; 7 | export declare const Provider: ({ children, className, style }: ProviderProps) => JSX.Element; 8 | -------------------------------------------------------------------------------- /pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { Container, Heading } from '@stoplight/mosaic'; 2 | 3 | import { getLayout } from '../layouts/SiteLayout'; 4 | 5 | const IndexPage = () => ( 6 | 7 | Landing Page 8 | 9 | ); 10 | 11 | IndexPage.getLayout = getLayout; 12 | 13 | export default IndexPage; 14 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Code/Code.d.ts: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import React from 'react'; 3 | import { IBoxHTMLAttributes } from '../Box/types'; 4 | export interface ICodeProps extends IBoxHTMLAttributes { 5 | } 6 | export declare const Code: React.MemoExoticComponent>>; 7 | -------------------------------------------------------------------------------- /components/ListDetail.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { User } from '../interfaces'; 4 | 5 | type ListDetailProps = { 6 | item: User; 7 | }; 8 | 9 | const ListDetail = ({ item: user }: ListDetailProps) => ( 10 |
11 |

Detail for {user.name}

12 |

ID: {user.id}

13 |
14 | ); 15 | 16 | export default ListDetail; 17 | -------------------------------------------------------------------------------- /next-seo.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | titleTemplate: '%s | Stoplight Docs', 3 | openGraph: { 4 | type: 'website', 5 | locale: 'en_IE', 6 | url: 'https://docs.stoplight.io', 7 | site_name: 'Stoplight Docs', 8 | }, 9 | twitter: { 10 | handle: '@stoplightio', 11 | site: 'https://stoplight.io', 12 | cardType: 'summary_large_image', 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Select/SelectAction.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { PartialSpectrumCollectionNode } from '../../utils'; 3 | import { SelectActionProps } from './types'; 4 | export declare const SelectAction: { 5 | (_props: SelectActionProps): React.ReactElement; 6 | getCollectionNode(props: any): Generator>; 7 | }; 8 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Select/SelectOption.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { PartialSpectrumCollectionNode } from '../../utils'; 3 | import { SelectOptionProps } from './types'; 4 | export declare const SelectOption: { 5 | (_props: SelectOptionProps): React.ReactElement; 6 | getCollectionNode(props: any): Generator>; 7 | }; 8 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './border'; 2 | export * from './color'; 3 | export * from './flex'; 4 | export * from './interactivity'; 5 | export * from './layout'; 6 | export * from './position'; 7 | export * from './shadow'; 8 | export * from './size'; 9 | export * from './spacing'; 10 | export * from './types'; 11 | export * from './typography'; 12 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/function.d.ts: -------------------------------------------------------------------------------- 1 | export declare function runIfFn(valueOrFn: T | ((...fnArgs: U[]) => T), ...args: U[]): T; 2 | export declare function once(fn?: Function | null): (this: any, ...args: any[]) => any; 3 | export declare const noop: () => void; 4 | export declare const warn: (this: any, ...args: any[]) => any; 5 | export declare const error: (this: any, ...args: any[]) => any; 6 | -------------------------------------------------------------------------------- /handlers/node.ts: -------------------------------------------------------------------------------- 1 | import * as _path from 'path'; 2 | 3 | export const fetchNode = async ({ nodeUri, projectSlug }: { nodeUri: string; projectSlug: string }) => { 4 | // TODO: probably shouldn't hardcode this 5 | const data = await ( 6 | await fetch(`https://stoplight.io/api/v1/projects/` + _path.join('meta', projectSlug, 'bundled-nodes', nodeUri)) 7 | ).json(); 8 | 9 | return data; 10 | }; 11 | -------------------------------------------------------------------------------- /components/ListItem.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link'; 2 | import * as React from 'react'; 3 | 4 | import { User } from '../interfaces'; 5 | 6 | type Props = { 7 | data: User; 8 | }; 9 | 10 | const ListItem = ({ data }: Props) => ( 11 | 12 | 13 | {data.id}: {data.name} 14 | 15 | 16 | ); 17 | 18 | export default ListItem; 19 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Overlay/Overlay.d.ts: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | export declare type OverlayProps = { 3 | children: ReactNode; 4 | isOpen?: boolean; 5 | container?: Element; 6 | }; 7 | declare let _Overlay: React.ForwardRefExoticComponent>>; 8 | export { _Overlay as Overlay }; 9 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tabs/Tab.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | export declare type TabOwnProps = { 3 | children: React.ReactNode; 4 | /** 5 | * A unique identifier for the tab. 6 | */ 7 | id: string; 8 | disabled?: boolean; 9 | }; 10 | export declare const Tab: React.MemoExoticComponent<({ children, id, disabled, ...restProps }: TabOwnProps) => JSX.Element>; 11 | -------------------------------------------------------------------------------- /hooks/usePrefetchOnHover.ts: -------------------------------------------------------------------------------- 1 | import { useRouter } from 'next/router'; 2 | import { useCallback } from 'react'; 3 | 4 | export const usePrefetchOnHover = (url: string) => { 5 | const { prefetch } = useRouter(); 6 | 7 | const doPrefetch = useCallback(() => { 8 | prefetch(url); 9 | }, [prefetch, url]); 10 | 11 | return { 12 | onMouseEnter: doPrefetch, 13 | onFocus: doPrefetch, 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /components/List.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { User } from '../interfaces'; 4 | import ListItem from './ListItem'; 5 | 6 | type Props = { 7 | items: User[]; 8 | }; 9 | 10 | const List = ({ items }: Props) => ( 11 |
    12 | {items.map(item => ( 13 |
  • 14 | 15 |
  • 16 | ))} 17 |
18 | ); 19 | 20 | export default List; 21 | -------------------------------------------------------------------------------- /components/PageTransition.tsx: -------------------------------------------------------------------------------- 1 | import { HTMLMotionProps, motion } from 'framer-motion'; 2 | import * as React from 'react'; 3 | 4 | /** 5 | * Re-mounts and runs initial animation when id changes. 6 | */ 7 | export const PageTransition = ({ id, ...restProps }: HTMLMotionProps<'div'> & { id: string }) => { 8 | return ; 9 | }; 10 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Select/Select.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { SelectProps } from './types'; 3 | export declare function Select({ flexGrow, w, size, label, renderTrigger, triggerTextPrefix, items, selectedValue, defaultSelectedValue, onSelectionChange, allowEmptySelection, placeholder, onOpen, onClose, isReadOnly, isDisabled, children, disabledValues, ...props }: SelectProps): JSX.Element; 4 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | const withPlugins = require('next-compose-plugins'); 2 | const withBundleAnalyzer = require('@next/bundle-analyzer')({ 3 | enabled: process.env.ANALYZE === 'true', 4 | }); 5 | 6 | const defaultConfig = { 7 | target: process.env.VERCEL ? 'experimental-serverless-trace' : 'server', 8 | 9 | reactStrictMode: process.env.NODE_ENV !== 'production', 10 | }; 11 | 12 | module.exports = withPlugins([withBundleAnalyzer], defaultConfig); 13 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/shadow.d.ts: -------------------------------------------------------------------------------- 1 | import { Pseudo } from './pseudo'; 2 | import { EnhancerFn } from './types'; 3 | export declare type BoxShadowVals = true | false | 'sm' | 'md' | 'lg' | 'xl' | 'xl' | '2xl'; 4 | export interface IShadowProps { 5 | boxShadow?: BoxShadowVals | Pseudo; 6 | } 7 | export declare const shadowPropNames: Array; 8 | export declare const shadowProps: EnhancerFn; 9 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/pseudo.d.ts: -------------------------------------------------------------------------------- 1 | declare type DefaultPseudoProps = 'sm' | 'md' | 'first' | 'last' | 'odd' | 'even' | 'hover' | 'focus' | 'active' | 'visited' | 'groupHover' | 'groupFocus' | 'disabled'; 2 | export declare type Pseudo = { 3 | [key in P | 'default']?: T; 4 | }; 5 | export declare const computePseudoClasses: (prop: string, val: boolean | string | number | Pseudo) => string; 6 | export {}; 7 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/color-manipulation.d.ts: -------------------------------------------------------------------------------- 1 | export declare type HslColor2 = { 2 | h: number; 3 | s: number; 4 | l: number; 5 | a?: number; 6 | }; 7 | export declare const getContrastColor: (bgLuminance: number, fgLuminance: number, targetContrast: number, hue: number, saturation?: number, lightness?: number) => string; 8 | export declare const parseHsl: (hsl: string) => HslColor2; 9 | export declare const stringifyHsl: (hsl: HslColor2) => string; 10 | -------------------------------------------------------------------------------- /components/GlobalProgressBar.tsx: -------------------------------------------------------------------------------- 1 | import { getCssVariable, useThemeStore } from '@stoplight/mosaic'; 2 | import * as React from 'react'; 3 | 4 | import { NextNProgress } from './NextNProgress'; 5 | 6 | export const GlobalProgressBar = () => { 7 | const { mode } = useThemeStore(); 8 | 9 | const color = mode === 'dark' ? getCssVariable('--color-primary-tint') : getCssVariable('--color-primary'); 10 | 11 | return ; 12 | }; 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Link/Link.d.ts: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import React from 'react'; 3 | import { PolymorphicComponentProps } from '../Box'; 4 | export declare type LinkOwnProps = { 5 | href?: string; 6 | }; 7 | export declare type LinkProps = PolymorphicComponentProps; 8 | declare const defaultElement = "a"; 9 | export declare const Link: (props: LinkProps) => JSX.Element; 10 | export {}; 11 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/layout.d.ts: -------------------------------------------------------------------------------- 1 | import { EnhancerFn } from './types'; 2 | declare type DisplayVals = 'block' | 'inline-block' | 'inline' | 'flex' | 'inline-flex' | 'hidden'; 3 | declare type OverflowVals = 'auto' | 'scroll' | 'hidden' | 'visible'; 4 | export interface ILayoutProps { 5 | display?: DisplayVals; 6 | overflowY?: OverflowVals; 7 | overflowX?: OverflowVals; 8 | } 9 | export declare const layoutPropNames: Array; 10 | export declare const layoutProps: EnhancerFn; 11 | export {}; 12 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Menu/MenuOption.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { MenuItemProps } from './MenuItem'; 3 | export declare type MenuOptionProps = { 4 | /** 5 | * The option value to send when this item is selected. 6 | */ 7 | value: string; 8 | } & MenuItemProps; 9 | export declare const MenuOption: React.ForwardRefExoticComponent<{ 10 | /** 11 | * The option value to send when this item is selected. 12 | */ 13 | value: string; 14 | } & MenuItemProps & React.RefAttributes>; 15 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-theme.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Pass a lodash style property path to pluck a specific theme property out. This helps with performance 3 | * if theme is being updated, since calling component will only re-render when the particular theme value 4 | * that is subscribed to changes. 5 | */ 6 | export declare const useTheme: (property?: string) => { 7 | themeValue: any; 8 | setColor: (name: "background" | "text" | "primary" | "success" | "warning" | "danger", val: string | import("..").HslColor2) => void; 9 | reset: () => void; 10 | }; 11 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@stoplight"], 3 | "rules": { 4 | "react/react-in-jsx-scope": "off", 5 | "@typescript-eslint/explicit-member-accessibility": "off", 6 | "@typescript-eslint/explicit-module-boundary-types": "off", 7 | "@typescript-eslint/explicit-function-return-type": "off", 8 | "@typescript-eslint/no-parameter-properties": "off", 9 | "jest/no-truthy-falsy": "off", 10 | "no-console": "off" 11 | }, 12 | "overrides": [ 13 | { 14 | "files": ["*.tsx"], 15 | "rules": { 16 | "@typescript-eslint/no-unused-vars": "off" 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/use-dom-ref.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMRef, DOMRefValue } from '@react-types/shared'; 2 | import React, { RefObject } from 'react'; 3 | export declare function useDOMRef(ref: DOMRef, skip?: boolean): RefObject; 4 | declare type WithDomRefProps = { 5 | children: React.FunctionComponentElement; 6 | }; 7 | export declare const WithDomRef: React.ForwardRefExoticComponent>>; 8 | export declare function useUnwrapDOMRef(ref: RefObject>): RefObject; 9 | export {}; 10 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Paragraph/Paragraph.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { PolymorphicComponentProps } from '../Box'; 3 | export declare type ParagraphSizeVals = 'leading' | 'default' | 'small' | 'tiny'; 4 | export declare type ParagraphOwnProps = { 5 | size?: ParagraphSizeVals; 6 | }; 7 | export declare type ParagraphProps = PolymorphicComponentProps; 8 | declare const defaultElement = "p"; 9 | export declare const Paragraph: (props: ParagraphProps) => JSX.Element; 10 | export {}; 11 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Text/Text.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { FontSizeVals, ParagraphSizes } from '../../enhancers'; 3 | import { PolymorphicComponentProps } from '../Box'; 4 | export declare type TextSizeVals = FontSizeVals | ParagraphSizes; 5 | export declare type TextOwnProps = { 6 | size?: TextSizeVals; 7 | }; 8 | export declare type TextProps = PolymorphicComponentProps; 9 | declare const defaultElement = "span"; 10 | export declare const Text: (props: TextProps) => JSX.Element; 11 | export {}; 12 | -------------------------------------------------------------------------------- /pages/404.tsx: -------------------------------------------------------------------------------- 1 | import { Box, Flex, Heading, VStack } from '@stoplight/mosaic'; 2 | import React from 'react'; 3 | 4 | import { SEO } from '../components/SEO'; 5 | import { SiteLayout } from '../layouts/SiteLayout'; 6 | 7 | const NotFoundPage = () => ( 8 | 9 | 10 | 11 | Not Found 12 | Could not find what you are looking for 13 | 14 | 15 | ); 16 | 17 | NotFoundPage.getLayout = page => {page}; 18 | 19 | export default NotFoundPage; 20 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Flex/Flex.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { IFlexShorthandProps } from '../../enhancers/flex'; 3 | import { PolymorphicComponentProps } from '../Box'; 4 | export declare type FlexOwnProps = IFlexShorthandProps & { 5 | /** 6 | * If `true`, will render as `inline-flex` rather than `flex` 7 | */ 8 | inline?: boolean; 9 | }; 10 | export declare type FlexProps = PolymorphicComponentProps; 11 | declare const defaultElement = "div"; 12 | export declare const Flex: (props: FlexProps) => JSX.Element; 13 | export {}; 14 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tabs/TabPanel.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { IMarginProps, IPaddingProps } from '../../enhancers'; 3 | export declare type TabPanelOwnProps = { 4 | children: React.ReactNode; 5 | /** 6 | * A unique ID for this tab panel. If not provided, one will be generated. 7 | */ 8 | id?: string; 9 | /** 10 | * ID of the tab that corresponds with this panel. If not provided, it will be inferred from tab index. 11 | */ 12 | tabId?: string; 13 | }; 14 | export declare type TabPanelProps = TabPanelOwnProps & IMarginProps & IPaddingProps; 15 | export declare const TabPanel: React.NamedExoticComponent; 16 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Container/Container.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { IMarginProps, IPaddingProps, SpaceVals } from '../../enhancers'; 3 | import { IBoxHTMLAttributes } from '../Box/types'; 4 | export declare type ContainerSizeVals = 'full' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'; 5 | export interface IContainerProps extends IMarginProps, IPaddingProps, IBoxHTMLAttributes { 6 | as?: React.ElementType; 7 | size?: ContainerSizeVals; 8 | } 9 | export declare const containerSizes: Record; 13 | export declare const Container: React.MemoExoticComponent>>; 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "alwaysStrict": true, 5 | "esModuleInterop": true, 6 | "forceConsistentCasingInFileNames": true, 7 | "isolatedModules": true, 8 | "jsx": "preserve", 9 | "lib": [ 10 | "dom", 11 | "es2017" 12 | ], 13 | "module": "esnext", 14 | "moduleResolution": "node", 15 | "noEmit": true, 16 | "noFallthroughCasesInSwitch": true, 17 | "noUnusedLocals": true, 18 | "noUnusedParameters": true, 19 | "resolveJsonModule": true, 20 | "skipLibCheck": true, 21 | "target": "esnext", 22 | "strict": false 23 | }, 24 | "exclude": [ 25 | "node_modules" 26 | ], 27 | "include": [ 28 | "**/*.ts", 29 | "**/*.tsx" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/styles.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { ThemeMode } from './utils/theme'; 3 | export declare const GLOBAL_CSS_ID = "mosaic-global"; 4 | export declare const GLOBAL_CSS_THEME_ID = "mosaic-theme"; 5 | export declare const injectStyles: ({ mode }?: { 6 | mode?: ThemeMode; 7 | }) => () => void; 8 | export declare const subscribeTheme: ({ mode: initialMode }?: { 9 | mode?: ThemeMode; 10 | }) => () => void; 11 | export declare const InlineStyles: () => JSX.Element; 12 | /** 13 | * Small snippet to set the basics re theme as early as possible during rendering, to avoid major flashes of white etc. 14 | */ 15 | export declare const INIT_THEME_JS: string; 16 | export declare const InitTheme: () => JSX.Element; 17 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Button/variants.d.ts: -------------------------------------------------------------------------------- 1 | import { FontSizeVals, HeightVals, IntentVals, NegativeSpaceVals, RoundedVals, SpaceVals } from '../../enhancers'; 2 | import { BoxOwnProps } from '../Box/types'; 3 | export declare type AppearanceVals = 'default' | 'primary' | 'minimal' | 'select'; 4 | export declare const sizes: Partial>; 13 | export declare const variants: Record>>; 14 | -------------------------------------------------------------------------------- /components/ErrorBoundary.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export class ErrorBoundary extends React.Component<{}, { hasError: boolean }> { 4 | constructor(props) { 5 | super(props); 6 | this.state = { hasError: false }; 7 | } 8 | 9 | static getDerivedStateFromError() { 10 | // Update state so the next render will show the fallback UI. 11 | return { hasError: true }; 12 | } 13 | 14 | componentDidCatch(error, errorInfo) { 15 | // eslint-disable-next-line no-console 16 | console.error('React error boundary', { error, errorInfo }); 17 | } 18 | 19 | render() { 20 | if (this.state.hasError) { 21 | return

Something went wrong, check the console.

; 22 | } 23 | 24 | return this.props.children; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Icon/Icon.d.ts: -------------------------------------------------------------------------------- 1 | import { IconDefinition, IconProp } from '@fortawesome/fontawesome-svg-core'; 2 | import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome'; 3 | import React from 'react'; 4 | export interface IIconProps extends FontAwesomeIconProps { 5 | } 6 | declare type State = { 7 | defaultStyle: 'fas' | 'far' | 'fal' | 'fad'; 8 | setDefaultStyle: (style: State['defaultStyle']) => void; 9 | }; 10 | export declare const useIconStore: import("zustand").UseStore; 11 | export declare const Icon: React.NamedExoticComponent; 12 | export declare function isIconDefinition(prop?: unknown): prop is IconDefinition; 13 | export declare function isIconProp(prop?: unknown): prop is IconProp; 14 | export {}; 15 | -------------------------------------------------------------------------------- /components/ThemeSwitcher.tsx: -------------------------------------------------------------------------------- 1 | import { Button, Tooltip, useThemeMode } from '@stoplight/mosaic'; 2 | import * as React from 'react'; 3 | 4 | export const ThemeSwitcher = () => { 5 | const { mode, setMode } = useThemeMode(); 6 | 7 | return ( 8 | { 15 | const nextTheme = mode === 'light' ? 'dark' : 'light'; 16 | document.body.setAttribute('data-theme', nextTheme); 17 | setMode(nextTheme); 18 | }} 19 | /> 20 | } 21 | > 22 | {mode === 'light' ? 'Switch to dark theme' : 'Switch to light theme'} 23 | 24 | ); 25 | }; 26 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Menu/MenuRadioGroup.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { MenuStateReturn } from 'reakit/Menu'; 3 | export declare type MenuRadioGroupProps = { 4 | /** 5 | * The value of the active radio option. 6 | */ 7 | value: string; 8 | /** 9 | * This function is called when the user selects a radio group option. 10 | */ 11 | onChange: (value: string) => void; 12 | /** 13 | * Must contain one or more `MenuOption` elements. 14 | */ 15 | children: React.ReactNode; 16 | /** 17 | * Not for external use. 18 | * 19 | * @private 20 | */ 21 | __menu?: MenuStateReturn; 22 | }; 23 | export declare const MenuRadioGroup: React.ForwardRefExoticComponent>; 24 | -------------------------------------------------------------------------------- /layouts/SiteLayout.tsx: -------------------------------------------------------------------------------- 1 | import { Flex } from '@stoplight/mosaic'; 2 | import * as React from 'react'; 3 | 4 | import { SEO } from '../components/SEO'; 5 | import SiteHeader from '../components/SiteHeader'; 6 | 7 | interface SiteLayoutProps { 8 | title?: string; 9 | description?: string; 10 | children: React.ReactNode; 11 | } 12 | 13 | export function SiteLayout(props: SiteLayoutProps) { 14 | const { title, description, children } = props; 15 | 16 | React.useEffect(() => console.info('SiteLayout.mount'), []); 17 | 18 | return ( 19 | <> 20 | 21 | 22 | {children} 23 | 24 | 25 | 26 | 27 | ); 28 | } 29 | 30 | export const getLayout = page => {page}; 31 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/NoSsr/NoSsr.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Adapted from Material UI - https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/NoSsr/NoSsr.js 3 | */ 4 | import React from 'react'; 5 | export declare type NoSsrProps = { 6 | defer?: boolean; 7 | fallback?: React.ReactNode; 8 | }; 9 | /** 10 | * NoSsr purposely removes components from the subject of Server Side Rendering (SSR). 11 | * 12 | * This component can be useful in a variety of situations: 13 | * - Escape hatch for broken dependencies not supporting SSR. 14 | * - Improve the time-to-first paint on the client by only rendering above the fold. 15 | * - Reduce the rendering time on the server. 16 | * - Under too heavy server load, you can turn on service degradation. 17 | */ 18 | export declare const NoSsr: React.FC; 19 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-theme-store.d.ts: -------------------------------------------------------------------------------- 1 | import { ColorValues, ICustomTheme, ITheme, ThemeMode } from '../utils'; 2 | import { HslColor2 } from '../utils/color-manipulation'; 3 | export declare const THEME_STORAGE_KEY = "mosaic-theme"; 4 | export declare const DEFAULT_THEME_MODE = "light"; 5 | export declare type ThemeState = { 6 | mode: ThemeMode; 7 | setMode: (mode: ThemeMode) => void; 8 | theme: ICustomTheme; 9 | setColor: (name: keyof ITheme['colors'], val: string | HslColor2) => void; 10 | reset: () => void; 11 | colorValues: Partial; 12 | setColorValues: (cv: ColorValues) => void; 13 | invertedColorValues: Partial; 14 | setInvertedColorValues: (cv: ColorValues) => void; 15 | }; 16 | export declare const useThemeStore: import("zustand").UseStore; 17 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Menu/Menu.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { MenuOptions as BaseMenuOptions } from 'reakit/Menu'; 3 | export declare type MenuProps = { 4 | /** 5 | * The react element that when clicked / triggered will open the menu. The menu will be positioned around this trigger element. 6 | */ 7 | trigger: React.ReactElement; 8 | /** 9 | * Must contain `MenuItem`, `MenuDivider`, or `MenuRadioGroup` components. 10 | */ 11 | children: React.ReactNode; 12 | /** 13 | * Optional unique identifier. 14 | */ 15 | baseId?: BaseMenuOptions['baseId']; 16 | /** 17 | * Optional label that describes the purpose of the menu. Helpful for accessibility. 18 | */ 19 | label?: string; 20 | }; 21 | export declare const Menu: (props: MenuProps) => JSX.Element; 22 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/position.d.ts: -------------------------------------------------------------------------------- 1 | import { Pseudo } from './pseudo'; 2 | import { NegativeSpaceVals, SpaceVals } from './spacing'; 3 | import { EnhancerFn } from './types'; 4 | declare type PositionVals = 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky'; 5 | declare type PositionLocVals = 'auto' | SpaceVals | NegativeSpaceVals; 6 | declare type PinVals = true | PositionLocVals; 7 | declare type ZIndexVals = 0 | 10 | 20 | 40 | 50 | 'auto'; 8 | export interface IPositionProps { 9 | pos?: PositionVals; 10 | pin?: PinVals; 11 | pinY?: PinVals; 12 | pinX?: PinVals; 13 | top?: PositionLocVals; 14 | left?: PositionLocVals; 15 | right?: PositionLocVals; 16 | bottom?: PositionLocVals; 17 | zIndex?: ZIndexVals | Pseudo; 18 | } 19 | export declare const positionPropNames: Array; 20 | export declare const positionProps: EnhancerFn; 21 | export {}; 22 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/EntityName/EntityName.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { AvatarProps } from '../Avatar'; 3 | import { IIconProps } from '../Icon'; 4 | declare type BaseEntityNameProps = { 5 | name: string; 6 | className?: string; 7 | isHeading?: boolean; 8 | size?: 'md' | 'lg'; 9 | avatar?: AvatarProps; 10 | }; 11 | declare type IconEntityNameProps = BaseEntityNameProps & { 12 | icon: IIconProps['icon']; 13 | }; 14 | declare type AvatarEntityNameProps = BaseEntityNameProps & { 15 | avatar: AvatarProps; 16 | }; 17 | export declare type EntityNameProps = BaseEntityNameProps | IconEntityNameProps | AvatarEntityNameProps; 18 | export declare const EntityName: React.MemoExoticComponent) | (BaseEntityNameProps & { 19 | icon: IIconProps['icon']; 20 | } & React.RefAttributes) | (BaseEntityNameProps & { 21 | avatar: AvatarProps; 22 | } & React.RefAttributes)>>; 23 | export {}; 24 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/interactivity.d.ts: -------------------------------------------------------------------------------- 1 | import { Pseudo } from './pseudo'; 2 | import { EnhancerFn } from './types'; 3 | export declare type Cursor = 'auto' | 'default' | 'pointer' | 'wait' | 'text' | 'move' | 'not-allowed'; 4 | export declare type UserSelect = 'none' | 'text' | 'all' | 'auto'; 5 | export declare type Resize = true | 'none' | 'y' | 'x'; 6 | export declare type PointerEvents = 'none' | 'auto'; 7 | export declare type OpacityVals = 0 | 5 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100; 8 | export declare type VisibilityVals = 'visible' | 'invisible'; 9 | export interface IInteractivityProps { 10 | cursor?: Cursor; 11 | opacity?: OpacityVals | Pseudo; 12 | pointerEvents?: PointerEvents; 13 | resize?: Resize; 14 | userSelect?: UserSelect; 15 | visibility?: VisibilityVals | Pseudo; 16 | } 17 | export declare const interactivityPropNames: Array; 18 | export declare const interactivityProps: EnhancerFn; 19 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Panel/PanelTitlebar.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { BoxOwnProps, IBoxHTMLAttributes } from '../Box/types'; 3 | declare type AppearanceVals = 'default' | 'minimal'; 4 | export interface IPanelTitlebar extends BoxOwnProps, Omit { 5 | /** 6 | * The contents to render on the right side of the titlebar. 7 | * 8 | * This component will not toggle the collapsed state if clicked. 9 | */ 10 | rightComponent?: React.ReactNode; 11 | /** 12 | * Titlebar background color. 13 | */ 14 | bg?: 'canvas-100' | 'canvas-200' | 'canvas-300' | 'transparent'; 15 | /** 16 | * The icon to render to the left of the titlebar children. 17 | * 18 | * If collapse is enabled, this prop will be overridden with a caret icon. 19 | */ 20 | icon?: React.ReactNode; 21 | /** 22 | * Controls how the titlebar will appear. 23 | */ 24 | appearance?: AppearanceVals; 25 | } 26 | export declare const PanelTitlebar: React.NamedExoticComponent; 27 | export {}; 28 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/types.d.ts: -------------------------------------------------------------------------------- 1 | import { ItemRenderer } from '@react-types/shared'; 2 | import React from 'react'; 3 | export declare type MaybeRenderProp = R | ((props: P) => R); 4 | export declare type MaybeRenderPropWithState = R | ((props: P, state: S) => R); 5 | export declare type Placement = 'bottom' | 'bottom left' | 'bottom right' | 'top' | 'top left' | 'top right' | 'left' | 'left top' | 'left bottom' | 'right' | 'right top' | 'right bottom'; 6 | export interface PartialSpectrumCollectionNode { 7 | type?: 'item' | 'section' | string; 8 | key?: React.Key; 9 | value?: T; 10 | element?: React.ReactElement; 11 | wrapper?: (element: React.ReactElement) => React.ReactElement; 12 | rendered?: React.ReactNode; 13 | textValue?: string; 14 | 'aria-label'?: string; 15 | index?: number; 16 | renderer?: ItemRenderer; 17 | hasChildNodes?: boolean; 18 | childNodes?: () => IterableIterator>; 19 | props?: any; 20 | shouldInvalidate?: (context: unknown) => boolean; 21 | } 22 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Modal/Modal.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | export declare type ModalProps = { 3 | title: React.ReactElement | string; 4 | /** 5 | * The content to render in the Modal. 6 | */ 7 | children: React.ReactNode; 8 | /** 9 | * The content to render in the footer slot. 10 | */ 11 | footer?: React.ReactElement | string; 12 | /** 13 | * Whether the Modal is open. 14 | */ 15 | isOpen: boolean; 16 | /** 17 | * Called when the Modal closes. 18 | */ 19 | onClose: () => void; 20 | /** 21 | * When true the user will be able to interact with content behind the modal, and move the modal around. 22 | */ 23 | isDraggable?: boolean; 24 | /** 25 | * Whether to prevent closing the overlay when the user interacts outside of it. 26 | */ 27 | isNotDismissable?: boolean; 28 | }; 29 | export declare const useModalState: () => { 30 | isOpen: boolean; 31 | open: () => void; 32 | close: () => void; 33 | }; 34 | export declare const Modal: (props: ModalProps) => JSX.Element; 35 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/assertion.d.ts: -------------------------------------------------------------------------------- 1 | import { ChangeEvent } from 'react'; 2 | export declare type Dict = Record; 3 | export declare function isNumber(value: any): value is number; 4 | export declare const isNotNumber: (value: any) => boolean; 5 | export declare function isNumeric(value: any): boolean; 6 | export declare function isArray(value: any): value is Array; 7 | export declare const isEmptyArray: (value: any) => boolean; 8 | export declare function isFunction(value: any): value is Function; 9 | export declare const isDefined: (value: any) => boolean; 10 | export declare const isUndefined: (value: any) => value is undefined; 11 | export declare const isObject: (value: any) => value is Record; 12 | export declare const isEmptyObject: (value: any) => boolean; 13 | export declare function isNotEmptyObject(value: any): value is object; 14 | export declare const isNull: (value: any) => value is null; 15 | export declare function isString(value: any): value is string; 16 | export declare function isInputEvent(value: any): value is ChangeEvent; 17 | export declare const isEmpty: (value: any) => boolean; 18 | export declare const __DEV__: boolean; 19 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/size.d.ts: -------------------------------------------------------------------------------- 1 | import { SpaceVals } from './spacing'; 2 | import { EnhancerFn } from './types'; 3 | export declare type HeightVals = SpaceVals | 'auto' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' | 'screen'; 4 | export declare type MaxHeightVals = 'full' | 'screen'; 5 | export declare type MinHeightVals = 'full' | 'screen'; 6 | export declare type WidthVals = SpaceVals | 'auto' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '1/2' | '1/3' | '2/3' | '1/4' | '2/4' | '3/4' | '1/5' | '2/5' | '3/5' | '4/5' | '1/6' | '2/6' | '3/6' | '4/6' | '5/6' | 'full' | 'screen' | 'min' | 'max'; 7 | export declare type MaxWidthVals = 'none' | 'full' | 'min' | 'max' | 'prose'; 8 | export declare type MinWidthVals = 'full' | 'min' | 'max'; 9 | export interface IHeightProps { 10 | h?: HeightVals; 11 | maxH?: MaxHeightVals; 12 | minH?: MinHeightVals; 13 | } 14 | export interface IWidthProps { 15 | w?: WidthVals; 16 | maxW?: MaxWidthVals; 17 | minW?: MinWidthVals; 18 | } 19 | export interface ISizeProps extends IHeightProps, IWidthProps { 20 | } 21 | export declare const sizePropNames: Array; 22 | export declare const sizeProps: EnhancerFn; 23 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Button/Button.d.ts: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import { FocusableProps, PressEvents } from '@react-types/shared'; 3 | import React, { RefObject } from 'react'; 4 | import { IntentVals } from '../../enhancers'; 5 | import { PolymorphicComponentProps } from '../Box/types'; 6 | import { IIconProps } from '../Icon'; 7 | import { AppearanceVals } from './variants'; 8 | export declare type ButtonOwnProps = PressEvents & FocusableProps & { 9 | children?: React.ReactNode; 10 | appearance?: AppearanceVals; 11 | intent?: IntentVals; 12 | size?: 'sm' | 'md'; 13 | active?: boolean; 14 | disabled?: boolean; 15 | loading?: boolean; 16 | icon?: IIconProps['icon'] | React.ReactElement; 17 | iconRight?: IIconProps['icon'] | React.ReactElement; 18 | autoFocus?: boolean; 19 | label?: string; 20 | }; 21 | export declare type ButtonProps = PolymorphicComponentProps; 22 | declare const defaultElement = "button"; 23 | export declare const Button: (props: ButtonProps & { 24 | ref?: RefObject; 25 | }) => JSX.Element; 26 | export {}; 27 | -------------------------------------------------------------------------------- /pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import '../styles.css'; 2 | 3 | import { Provider, subscribeTheme } from '@stoplight/mosaic'; 4 | import { AppProps } from 'next/app'; 5 | import dynamic from 'next/dynamic'; 6 | import Head from 'next/head'; 7 | import { DefaultSeo } from 'next-seo'; 8 | import * as React from 'react'; 9 | 10 | import SEO from '../next-seo.config'; 11 | 12 | if (process.browser) { 13 | subscribeTheme(); 14 | } 15 | 16 | const GlobalProgressBar = dynamic(() => import('../components/GlobalProgressBar').then(mod => mod.GlobalProgressBar), { 17 | ssr: false, 18 | }); 19 | 20 | function App({ Component, pageProps }: AppProps) { 21 | /** Keep an eye out for full remounts, we want to minimize those */ 22 | React.useEffect(() => console.info('App.mount'), []); 23 | 24 | // @ts-expect-error 25 | const getLayout = Component.getLayout || (page => page); 26 | 27 | return ( 28 | <> 29 | 30 | 31 | 32 | 33 | 34 | 35 | {getLayout()} 36 | 37 | 38 | 39 | ); 40 | } 41 | 42 | export default App; 43 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tabs/Tabs.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | export declare type TabsOwnProps = { 3 | /** 4 | * Must contain `TabList` and `TabPanel` components. 5 | */ 6 | children: React.ReactNode; 7 | /** 8 | * ID that will serve as a base for all the generated tab IDs. 9 | */ 10 | id?: string; 11 | /** 12 | * The current selected tab's `id`. 13 | */ 14 | selectedId?: string; 15 | /** 16 | * Callback for when the selected tab state changes. 17 | */ 18 | onChange?: (selectedId: string) => void; 19 | /** 20 | * Defines the direction the tabs are displayed. Defaults to horizontal. 21 | */ 22 | direction?: 'horizontal' | 'vertical'; 23 | /** 24 | * Defines how large the tabs should be. 25 | */ 26 | size?: 'sm' | 'lg'; 27 | /** 28 | * The alignment of the tabs. 29 | */ 30 | align?: 'center' | 'end' | 'start'; 31 | /** 32 | * Performance: If `true`, the TabPanel rendering will be deferred until it is open. 33 | */ 34 | isEager?: boolean; 35 | }; 36 | export declare const Tabs: ({ children, id, selectedId, onChange, direction, size, align, isEager, }: TabsOwnProps) => JSX.Element; 37 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/hooks/use-controllable-state.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | export declare function useControllableProp(prop: T | undefined, state: T): readonly [boolean, T]; 3 | export interface IUseControllableStateProps { 4 | /** 5 | * The value to used in controlled mode 6 | */ 7 | value?: T; 8 | /** 9 | * The initial value to be used, in uncontrolled mode 10 | */ 11 | defaultValue?: T | (() => T); 12 | /** 13 | * The callback fired when the value changes 14 | */ 15 | onChange?: (value: T) => void; 16 | /** 17 | * The component name (for warnings) 18 | */ 19 | name?: string; 20 | /** 21 | * A mapping for the props to give more contextual warning messages. 22 | * 23 | * In some components `value` might be called `index`, and defaultValue 24 | * might be called `defaultIndex`, so this map helps us generate 25 | * contextual warning messages 26 | */ 27 | propsMap?: { 28 | value: string; 29 | defaultValue: string; 30 | onChange: string; 31 | }; 32 | } 33 | /** 34 | * React hook for using controlling component state. 35 | * @param props 36 | */ 37 | export declare function useControllableState(props: IUseControllableStateProps): [T, React.Dispatch>]; 38 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/theme.d.ts: -------------------------------------------------------------------------------- 1 | import { HslColor2 } from './color-manipulation'; 2 | export declare type ThemeMode = 'light' | 'dark' | 'system'; 3 | declare type Color = string; 4 | export interface ITheme { 5 | colors: { 6 | background: Color; 7 | text?: Color; 8 | primary: Color; 9 | success: Color; 10 | warning: Color; 11 | danger: Color; 12 | }; 13 | } 14 | export interface ICustomTheme { 15 | colors: Partial; 16 | } 17 | export declare type ColorValues = { 18 | light?: boolean; 19 | } & Record, HslColor2>; 20 | export declare const defaultTheme: ITheme; 21 | export declare const getCssVariable: (name: string, element?: HTMLElement) => string; 22 | export declare const prefersDarkMode: () => MediaQueryList; 23 | /** 24 | * Handles figuring out what 'system' mode resolves to if user has that picked. Always returns light | dark. 25 | */ 26 | export declare const getResolvedThemeMode: (userMode: ThemeMode) => "light" | "dark"; 27 | export declare const computeTheme: (customTheme: ICustomTheme, $mode?: ThemeMode) => { 28 | mult: { 29 | s: number; 30 | l: number; 31 | }; 32 | colorValues: ColorValues; 33 | invertedColorValues: ColorValues; 34 | css: string; 35 | }; 36 | export {}; 37 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Stack/Stack.d.ts: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import React from 'react'; 3 | import { IFlexShorthandProps } from '../../enhancers'; 4 | import { PolymorphicComponentProps } from '../Box'; 5 | export declare type StackOwnProps = Pick & { 6 | /** 7 | * The direction to render the stack 8 | */ 9 | direction?: 'vertical' | 'horizontal'; 10 | /** 11 | * The space between each stack item 12 | */ 13 | spacing?: 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 20 | 24 | 32; 14 | /** 15 | * If `true`, each stack item will show a divider 16 | */ 17 | divider?: true | React.ReactElement; 18 | /** 19 | * If `true`, will render as `inline-flex` rather than `flex` 20 | */ 21 | inline?: boolean; 22 | }; 23 | export declare type StackProps = PolymorphicComponentProps; 24 | declare const defaultElement = "div"; 25 | export declare const Stack: (props: StackProps) => JSX.Element; 26 | export declare const HStack: (props: StackProps) => JSX.Element; 27 | export declare const VStack: (props: StackProps) => JSX.Element; 28 | export {}; 29 | -------------------------------------------------------------------------------- /pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import { Box, InitTheme, InlineStyles } from '@stoplight/mosaic'; 2 | import Document, { DocumentContext, Head, Html, Main, NextScript } from 'next/document'; 3 | import * as React from 'react'; 4 | 5 | class CustomDocument extends Document { 6 | static getInitialProps(ctx: DocumentContext) { 7 | return Document.getInitialProps(ctx); 8 | } 9 | 10 | render() { 11 | return ( 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 35 | 36 |
37 | 38 | 39 | 40 | ); 41 | } 42 | } 43 | 44 | export default CustomDocument; 45 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/spacing.d.ts: -------------------------------------------------------------------------------- 1 | import { EnhancerFn } from './types'; 2 | export declare type SpaceVals = 'auto' | 'px' | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 16 | 20 | 24 | 32 | 40 | 60 | 80; 3 | export declare type NegativeSpaceVals = '-px' | -0 | -0.5 | -1 | -1.5 | -2 | -2.5 | -3 | -3.5 | -4 | -5 | -6 | -7 | -8 | -9 | -10 | -11 | -12 | -14 | -16 | -20 | -24 | -32 | -40 | -60 | -80; 4 | export interface IMarginProps { 5 | m?: SpaceVals | NegativeSpaceVals; 6 | mx?: SpaceVals | NegativeSpaceVals; 7 | my?: SpaceVals | NegativeSpaceVals; 8 | mt?: SpaceVals | NegativeSpaceVals; 9 | mr?: SpaceVals | NegativeSpaceVals; 10 | mb?: SpaceVals | NegativeSpaceVals; 11 | ml?: SpaceVals | NegativeSpaceVals; 12 | } 13 | export interface IPaddingProps { 14 | p?: SpaceVals; 15 | px?: SpaceVals; 16 | py?: SpaceVals; 17 | pt?: SpaceVals; 18 | pr?: SpaceVals; 19 | pb?: SpaceVals; 20 | pl?: SpaceVals; 21 | } 22 | export interface ISpacingProps extends IMarginProps, IPaddingProps { 23 | } 24 | export declare const isNegative: (v: number | string) => boolean; 25 | export declare const buildClassname: (p: string, v: number | string) => string; 26 | export declare const spacingPropNames: Array; 27 | export declare const marginProps: EnhancerFn; 28 | export declare const paddingProps: EnhancerFn; 29 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/utils/split-box-props.d.ts: -------------------------------------------------------------------------------- 1 | import { IBorderProps, IColorProps, IFlexProps, IInteractivityProps, ILayoutProps, IPositionProps, IShadowProps, ISizeProps, ISpacingProps, ITypographyProps } from '../enhancers'; 2 | interface IEnhancerProps extends IBorderProps, IColorProps, IFlexProps, IInteractivityProps, ILayoutProps, IPositionProps, IShadowProps, ISizeProps, ISpacingProps, ITypographyProps { 3 | } 4 | interface SplitBoxProps

{ 5 | matchedProps: Pick; 6 | remainingProps: Pick>; 7 | } 8 | /** 9 | * Convenience method to split the Box props. 10 | * 11 | * Useful for when you want to pass all of the Box props to the root Box and 12 | * pass the remaining props to a child element (e.g: disabled, readOnly, required, etc). 13 | */ 14 | export declare function splitBoxProps

(props: P): SplitBoxProps

; 15 | declare type Omit, K extends keyof T> = Pick>; 16 | interface Dictionary { 17 | [key: string]: T; 18 | } 19 | export interface SplitProps { 20 | matchedProps: Pick; 21 | remainingProps: Omit; 22 | } 23 | /** 24 | * Utility to split props based on an array of keys 25 | */ 26 | export declare function splitProps

, K extends keyof P>(props: P, keys: K[]): SplitProps; 27 | export {}; 28 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './enhancers'; 2 | export * from './hooks'; 3 | export * from './utils'; 4 | export * from './styles'; 5 | export * from './components/Article'; 6 | export * from './components/Avatar'; 7 | export * from './components/Box'; 8 | export * from './components/Button'; 9 | export * from './components/Card'; 10 | export * from './components/Code'; 11 | export * from './components/Container'; 12 | export * from './components/Modal'; 13 | export * from './components/Divider'; 14 | export * from './components/EntityName'; 15 | export * from './components/Flex'; 16 | export * from './components/Grid'; 17 | export * from './components/Heading'; 18 | export * from './components/Icon'; 19 | export * from './components/Image'; 20 | export * from './components/Input'; 21 | export * from './components/Link'; 22 | export * from './components/LinkHeading'; 23 | export * from './components/Menu'; 24 | export * from './components/NoSsr'; 25 | export * from './components/Overlay'; 26 | export * from './components/Panel'; 27 | export * from './components/Paragraph'; 28 | export * from './components/Popover'; 29 | export * from './components/Pressable'; 30 | export * from './components/Prose'; 31 | export * from './components/Provider'; 32 | export * from './components/InvertTheme'; 33 | export * from './components/Tabs'; 34 | export * from './components/Text'; 35 | export * from './components/Tooltip'; 36 | export * from './components/TreeItem'; 37 | export * from './components/Select'; 38 | export * from './components/Stack'; 39 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Box/types.d.ts: -------------------------------------------------------------------------------- 1 | import { HTMLAttributes } from 'react'; 2 | import { IBorderProps, IColorProps, IFlexProps, IInteractivityProps, ILayoutProps, IMarginProps, IPaddingProps, IPositionProps, IRingProps, IShadowProps, ISizeProps, ITypographyProps } from '../../enhancers'; 3 | declare type EnhancerProps = ITypographyProps & ISizeProps & IMarginProps & IPaddingProps & IShadowProps & IColorProps & IBorderProps & IRingProps & IInteractivityProps & IFlexProps & IPositionProps & ILayoutProps; 4 | /** 5 | * Generic component props with "as" prop 6 | * @template P Additional props 7 | * @template T React component or string element 8 | */ 9 | export declare type BoxOwnProps = EnhancerProps & { 10 | /** 11 | * Replaces the underlying element 12 | */ 13 | as?: E; 14 | className?: string; 15 | role?: string; 16 | noFocusRing?: boolean; 17 | }; 18 | /** 19 | * Box supports standard HTML attributes 20 | * Box re-defines some props like color, so omit here to prevent clash 21 | */ 22 | export interface IBoxHTMLAttributes extends Omit, 'color'> { 23 | } 24 | export declare type BoxProps = BoxOwnProps & Omit, keyof BoxOwnProps>; 25 | export declare type PolymorphicComponentProps = P & BoxProps; 26 | export declare type PolymorphicComponent = (props: PolymorphicComponentProps) => JSX.Element; 27 | export {}; 28 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/color.d.ts: -------------------------------------------------------------------------------- 1 | import { Pseudo } from './pseudo'; 2 | import { EnhancerFn } from './types'; 3 | export declare type IntentVals = 'default' | 'success' | 'warning' | 'danger'; 4 | export declare type SemanticColorVals = 'link' | 'link-dark' | 'code' | 'on-code' | 'primary' | 'primary-tint' | 'primary-light' | 'primary-dark' | 'on-primary' | 'success' | 'success-tint' | 'success-light' | 'success-dark' | 'on-success' | 'warning' | 'warning-tint' | 'warning-light' | 'warning-dark' | 'on-warning' | 'danger' | 'danger-tint' | 'danger-light' | 'danger-dark' | 'on-danger'; 5 | export declare type TextColorVals = 'current' | 'body' | 'muted' | 'light' | 'heading' | 'paragraph' | 'canvas' | 'canvas-pure' | 'canvas-50' | 'canvas-100' | 'canvas-200' | 'canvas-300' | 'canvas-dialog' | SemanticColorVals; 6 | export declare type PlaceholderColorVals = true | 'primary' | 'success' | 'warning' | 'danger'; 7 | export interface ITextColorProps { 8 | color?: TextColorVals | Pseudo; 9 | } 10 | export interface IPlaceholderProps { 11 | placeholderColor?: PlaceholderColorVals; 12 | } 13 | export declare type BackgroundColorVals = 'canvas' | 'canvas-pure' | 'canvas-50' | 'canvas-100' | 'canvas-200' | 'canvas-300' | 'canvas-dialog' | 'transparent' | SemanticColorVals; 14 | export interface IBackgroundColorProps { 15 | bg?: BackgroundColorVals | Pseudo; 16 | } 17 | export interface IColorProps extends ITextColorProps, IPlaceholderProps, IBackgroundColorProps { 18 | } 19 | export declare const colorPropNames: Array; 20 | export declare const colorProps: EnhancerFn; 21 | -------------------------------------------------------------------------------- /layouts/StoplightProjectLayout.tsx: -------------------------------------------------------------------------------- 1 | import { Box, containerSizes, Flex } from '@stoplight/mosaic'; 2 | import { useRouter } from 'next/router'; 3 | import * as React from 'react'; 4 | 5 | import { StoplightProjectSidebar } from '../components/StoplightProjectSidebar'; 6 | import { getLayout as getSiteLayout } from './SiteLayout'; 7 | 8 | interface StoplightProjectLayoutProps { 9 | title?: string; 10 | description?: string; 11 | children: React.ReactNode; 12 | sidebar?: boolean; 13 | } 14 | 15 | const SIDEBAR_WIDTH = 300; 16 | 17 | export function StoplightProjectLayout(props: StoplightProjectLayoutProps) { 18 | const { children } = props; 19 | 20 | const { query } = useRouter(); 21 | const nodeUri = typeof query.docsPath === 'string' ? query.docsPath : query.docsPath?.join('/'); 22 | const projectSlug = typeof query.projectSlug === 'string' ? query.projectSlug : query.projectSlug?.join('/'); 23 | 24 | React.useEffect(() => console.info('StoplightProjectLayout.mount'), []); 25 | 26 | return ( 27 | 28 | 37 | 38 | 39 | 40 | 41 | {children} 42 | 43 | 44 | ); 45 | } 46 | 47 | export const getLayout = page => getSiteLayout({page}); 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stoplight-dev-portal", 3 | "version": "1.0.0", 4 | "private": true, 5 | "license": "MIT", 6 | "scripts": { 7 | "dev": "next", 8 | "build": "next build", 9 | "start": "next start", 10 | "lint": "yarn prettier.check && eslint --ext .js,.jsx,.ts,.tsx .", 11 | "prettier.check": "prettier --ignore-path .eslintignore --check '**/*.{js,jsx,ts,tsx,md}'", 12 | "lint.fix": "prettier --ignore-path .eslintignore --write '**/*.{js,jsx,ts,tsx,md}'; eslint --ext .js,.jsx,.ts,.tsx . --fix", 13 | "type-check": "tsc", 14 | "deduplicate": "yarn-deduplicate --strategy fewer && yarn" 15 | }, 16 | "dependencies": { 17 | "@stoplight/mosaic": "file:.yalc/@stoplight/mosaic", 18 | "@stoplight/elements": "7.0.0-alpha.3", 19 | "framer-motion": "^3.3.0", 20 | "mobx": "^6.1.7", 21 | "next": "^10.0.7", 22 | "next-seo": "^4.19.0", 23 | "nprogress": "^0.2.0", 24 | "react": "^17.0.1", 25 | "react-dom": "^17.0.1" 26 | }, 27 | "devDependencies": { 28 | "@next/bundle-analyzer": "^10.0.7", 29 | "@stoplight/eslint-config": "^2.0.0", 30 | "@types/node": "^14.14.28", 31 | "@types/nprogress": "^0.2.0", 32 | "@types/react": "^17.0.2", 33 | "@types/react-dom": "^17.0.1", 34 | "@typescript-eslint/eslint-plugin": "^4.15.1", 35 | "@typescript-eslint/parser": "^4.15.1", 36 | "eslint": "^7.20.0", 37 | "eslint-plugin-import": "^2.22.1", 38 | "eslint-plugin-jest": "^24.1.5", 39 | "eslint-plugin-prettier": "^3.3.1", 40 | "eslint-plugin-react": "^7.22.0", 41 | "eslint-plugin-react-hooks": "^4.2.0", 42 | "eslint-plugin-simple-import-sort": "^7.0.0", 43 | "next-compose-plugins": "^2.2.1", 44 | "prettier": "^2.2.1", 45 | "typescript": "~4.1.5" 46 | } 47 | } -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@stoplight/mosaic", 3 | "version": "0.0.0-23684a30", 4 | "sideEffects": false, 5 | "peerDependencies": { 6 | "react": ">= 16.8" 7 | }, 8 | "resolutions": { 9 | "@react-stately/collections": "npm:@stoplight/react-stately-collections@^3.3.0", 10 | "@react-stately/list": "npm:@stoplight/react-stately-list@^3.2.2" 11 | }, 12 | "dependencies": { 13 | "@fortawesome/fontawesome-svg-core": "^1.2.34", 14 | "@fortawesome/free-solid-svg-icons": "^5.15.2", 15 | "@fortawesome/react-fontawesome": "^0.1.14", 16 | "@react-aria/button": "^3.3.1", 17 | "@react-aria/dialog": "^3.1.2", 18 | "@react-aria/focus": "^3.2.3", 19 | "@react-aria/interactions": "^3.3.3", 20 | "@react-aria/listbox": "^3.2.4", 21 | "@react-aria/overlays": "^3.6.1", 22 | "@react-aria/select": "^3.3.0", 23 | "@react-aria/separator": "^3.1.1", 24 | "@react-aria/ssr": "^3.0.1", 25 | "@react-aria/tooltip": "^3.1.1", 26 | "@react-aria/utils": "^3.6.0", 27 | "@react-hook/size": "^2.1.1", 28 | "@react-hook/window-size": "^3.0.7", 29 | "@react-spectrum/utils": "^3.5.1", 30 | "@react-stately/collections": "npm:@stoplight/react-stately-collections@^3.3.0", 31 | "@react-stately/list": "npm:@stoplight/react-stately-list@^3.2.2", 32 | "@react-stately/select": "^3.1.1", 33 | "@react-stately/tooltip": "^3.0.2", 34 | "clsx": "^1.1.1", 35 | "copy-to-clipboard": "^3.3.1", 36 | "deepmerge": "^4.2.2", 37 | "lodash.get": "^4.4.2", 38 | "polished": "^4.0.5", 39 | "reakit": "npm:@stoplight/reakit@~1.3.5", 40 | "ts-keycode-enum": "^1.0.6", 41 | "zustand": "^3.3.1" 42 | }, 43 | "main": "./core.umd.js", 44 | "module": "./core.esm.js", 45 | "typings": "./index.d.ts" 46 | } 47 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/border.d.ts: -------------------------------------------------------------------------------- 1 | import { SemanticColorVals } from './color'; 2 | import { OpacityVals } from './interactivity'; 3 | import { Pseudo } from './pseudo'; 4 | import { EnhancerFn } from './types'; 5 | export declare type OutlineVals = 'none'; 6 | export declare type BorderColorVals = 'light' | 'dark' | 'button' | 'input' | 'transparent' | SemanticColorVals; 7 | export declare type BorderWidthVals = true | 0 | 2 | 4 | 8; 8 | export declare type RoundedVals = true | 'none' | 'sm' | 'lg' | 'xl' | 'full' | 'b' | 't' | 'l' | 'r' | 'b-none' | 't-none' | 'l-none' | 'r-none' | 'b-sm' | 't-sm' | 'l-sm' | 'r-sm' | 'b-lg' | 't-lg' | 'l-lg' | 'r-lg' | 'b-xl' | 't-xl' | 'l-xl' | 'r-xl' | 'b-full' | 't-full' | 'l-full' | 'r-full'; 9 | export interface IBorderProps { 10 | outline?: OutlineVals; 11 | borderColor?: BorderColorVals | Pseudo; 12 | border?: BorderWidthVals; 13 | borderT?: BorderWidthVals; 14 | borderR?: BorderWidthVals; 15 | borderL?: BorderWidthVals; 16 | borderB?: BorderWidthVals; 17 | rounded?: RoundedVals; 18 | } 19 | export declare const borderPropNames: Array; 20 | export declare const borderProps: EnhancerFn; 21 | export declare type RingWidthVals = true | false; 22 | export declare type RingColorVals = 'primary' | 'success' | 'warning' | 'danger'; 23 | export declare type RingOpacityVals = OpacityVals; 24 | export interface IRingProps { 25 | ring?: RingWidthVals | Pseudo; 26 | ringColor?: RingColorVals | Pseudo; 27 | ringOpacity?: RingOpacityVals | Pseudo; 28 | } 29 | export declare const ringPropNames: Array; 30 | export declare const ringProps: EnhancerFn; 31 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Avatar/Avatar.d.ts: -------------------------------------------------------------------------------- 1 | import React, { CSSProperties } from 'react'; 2 | import { IMarginProps } from '../../enhancers'; 3 | import { IIconProps } from '../Icon'; 4 | declare type BaseAvatarProps = IMarginProps & { 5 | size?: 'sm' | 'md' | 'lg'; 6 | className?: string; 7 | bg?: CSSProperties['backgroundColor']; 8 | }; 9 | export declare type ImageAvatarProps = BaseAvatarProps & { 10 | imageUrl: string; 11 | }; 12 | export declare type IconAvatarProps = BaseAvatarProps & { 13 | icon: IIconProps['icon']; 14 | }; 15 | export declare type LetterAvatarProps = BaseAvatarProps & { 16 | letter: string; 17 | }; 18 | export declare type BlankAvatarProps = BaseAvatarProps & { 19 | blank: true; 20 | }; 21 | export declare type AvatarProps = ImageAvatarProps | IconAvatarProps | LetterAvatarProps | BlankAvatarProps; 22 | export declare const Avatar: React.MemoExoticComponent) | (IMarginProps & { 29 | size?: 'sm' | 'md' | 'lg'; 30 | className?: string; 31 | bg?: CSSProperties['backgroundColor']; 32 | } & { 33 | icon: IIconProps['icon']; 34 | } & React.RefAttributes) | (IMarginProps & { 35 | size?: 'sm' | 'md' | 'lg'; 36 | className?: string; 37 | bg?: CSSProperties['backgroundColor']; 38 | } & { 39 | letter: string; 40 | } & React.RefAttributes) | (IMarginProps & { 41 | size?: 'sm' | 'md' | 'lg'; 42 | className?: string; 43 | bg?: CSSProperties['backgroundColor']; 44 | } & { 45 | blank: true; 46 | } & React.RefAttributes)>>; 47 | export {}; 48 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/flex.d.ts: -------------------------------------------------------------------------------- 1 | import { EnhancerFn } from './types'; 2 | export declare type FlexVals = 1 | 'auto' | 'initial' | 'none'; 3 | export declare type FlexDirectionVals = 'row' | 'row-reverse' | 'col' | 'col-reverse'; 4 | export declare type FlexWrapVals = true | 'reverse' | 'no-wrap'; 5 | export declare type FlexGrowVals = true | 0; 6 | export declare type FlexShrinkVals = true | 0; 7 | export declare type JustifyContentVals = 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'; 8 | export declare type JustifyItemsVals = 'auto' | 'start' | 'end' | 'center' | 'stretch'; 9 | export declare type JustifySelfVals = 'auto' | 'start' | 'end' | 'center' | 'stretch'; 10 | export declare type AlignContentVals = 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'; 11 | export declare type AlignItemsVals = 'start' | 'end' | 'center' | 'baseline' | 'stretch'; 12 | export declare type AlignSelfVals = 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch'; 13 | export interface IFlexProps { 14 | flex?: FlexVals; 15 | flexDirection?: FlexDirectionVals; 16 | flexWrap?: FlexWrapVals; 17 | flexGrow?: FlexGrowVals; 18 | flexShrink?: FlexShrinkVals; 19 | justifyContent?: JustifyContentVals; 20 | justifyItems?: JustifyItemsVals; 21 | justifySelf?: JustifySelfVals; 22 | alignContent?: AlignContentVals; 23 | alignItems?: AlignItemsVals; 24 | alignSelf?: AlignSelfVals; 25 | } 26 | export interface IFlexShorthandProps { 27 | align?: IFlexProps['alignItems']; 28 | justify?: IFlexProps['justifyContent']; 29 | wrap?: IFlexProps['flexWrap']; 30 | direction?: IFlexProps['flexDirection']; 31 | grow?: IFlexProps['flexGrow']; 32 | shrink?: IFlexProps['flexShrink']; 33 | } 34 | export declare const flexPropNames: Array; 35 | export declare const flexProps: EnhancerFn; 36 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/enhancers/typography.d.ts: -------------------------------------------------------------------------------- 1 | import { EnhancerFn } from './types'; 2 | export declare type FontSizeVals = '2xs' | 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl'; 3 | export declare type LineHeights = 'none' | 'tight' | 'snug' | 'normal' | 'relaxed' | 'loose'; 4 | export declare type LetterSpacing = 'tight' | 'normal' | 'wide'; 5 | export declare type ParagraphSizes = 'paragraph-leading' | 'paragraph' | 'paragraph-small' | 'paragraph-tiny'; 6 | export declare type FontFamilyVals = 'ui' | 'prose' | 'mono'; 7 | export declare type FontWeightVals = 'normal' | 'light' | 'medium' | 'semibold' | 'bold'; 8 | export declare type FontStyleVals = 'italic' | 'non-italic'; 9 | export declare type TextAlign = 'left' | 'center' | 'right' | 'justify'; 10 | export declare type TextDecoration = 'underline' | 'line-through' | 'no-underline'; 11 | export declare type TextTransform = 'uppercase' | 'lowercase' | 'capitalize' | 'normal-case'; 12 | export declare type TextOverflow = 'truncate' | 'overflow-ellipsis' | 'overflow-clip'; 13 | export declare type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom'; 14 | export declare type Whitespace = 'normal' | 'nowrap' | 'pre' | 'pre-line' | 'pre-wrap'; 15 | export declare type WordBreak = 'normal' | 'words' | 'all'; 16 | export interface ITypographyProps { 17 | fontSize?: FontSizeVals | ParagraphSizes; 18 | lineHeight?: LineHeights | ParagraphSizes; 19 | letterSpacing?: LetterSpacing; 20 | fontFamily?: FontFamilyVals; 21 | fontWeight?: FontWeightVals; 22 | fontStyle?: FontStyleVals; 23 | textAlign?: TextAlign; 24 | textDecoration?: TextDecoration; 25 | textTransform?: TextTransform; 26 | textOverflow?: TextOverflow; 27 | verticalAlign?: VerticalAlign; 28 | whitespace?: Whitespace; 29 | wordBreak?: WordBreak; 30 | } 31 | export declare const typographyPropNames: Array; 32 | export declare const typographyProps: EnhancerFn; 33 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Panel/Panel.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { PolymorphicComponentProps } from '../Box'; 3 | export declare type PanelOwnProps = { 4 | /** 5 | * The contents of the panel. 6 | * 7 | * A Panel.Titlebar must be the first child element. 8 | */ 9 | children: React.ReactNode; 10 | /** 11 | * Wether the panel should be rounded. Applies rounded "lg" and overflow hidden. 12 | * 13 | * Usually only use this on root panel components, not nested panel components. 14 | */ 15 | rounded?: boolean; 16 | /** 17 | * Controls how the panel will appear. 18 | * 19 | * @default 'default' 20 | */ 21 | appearance?: 'default' | 'minimal'; 22 | /** 23 | * Enable collapsing 24 | */ 25 | isCollapsible?: boolean; 26 | /** 27 | * Identifier to use for aria controls when collapse is enabled 28 | */ 29 | id?: string; 30 | /** 31 | * Controls whether to show the panel contents or not by default in. 32 | * 33 | * If defaultIsOpen is provided the panel will be uncontrolled. 34 | */ 35 | defaultIsOpen?: boolean; 36 | /** 37 | * Controls whether to show the panel contents or not. 38 | * 39 | * If no onChange is provided, isOpen will be used as the default value (uncontrolled). 40 | */ 41 | isOpen?: boolean; 42 | /** 43 | * Called when the collapsed state changes. 44 | * 45 | * When not provided, the component will control it's own state internally (uncontrolled). 46 | */ 47 | onChange?: (value: boolean) => void; 48 | }; 49 | export declare type PanelProps = PolymorphicComponentProps<'div', PanelOwnProps>; 50 | export declare const Panel: { 51 | ({ appearance, id, className, children, isCollapsible, isOpen: isOpenProp, defaultIsOpen, onChange, rounded, ...extraProps }: PanelProps): JSX.Element; 52 | Titlebar: React.NamedExoticComponent; 53 | Content: React.FC>>; 54 | }; 55 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Menu/MenuItem.d.ts: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | export declare type MenuItemProps = { 3 | /** 4 | * The text to display in the menu item. 5 | */ 6 | text: ReactNode; 7 | /** 8 | * Optional element to render on the right side of the menu item. Use this to display keyboard shortcut, badge counts, etc. 9 | */ 10 | meta?: ReactNode; 11 | /** 12 | * Render menu item with extra space on the left side. Useful to align menus when some items are checkbox items. 13 | */ 14 | indent?: boolean; 15 | /** 16 | * If true or false is provided, menu item will render with indent={true}, and a checkbox icon when true. 17 | */ 18 | checked?: boolean; 19 | /** 20 | * If provided, the menu item will render as a link with target="_blank". href must be an absolute url. 21 | */ 22 | href?: string; 23 | /** 24 | * When disabled is true the MenuItem is rendered as semi-transparent and cannot be interacted with. 25 | */ 26 | disabled?: boolean; 27 | /** 28 | * Optional additional logic to run when MenuItem is clicked (or triggered in any way, such as via keyboard shortcut). 29 | */ 30 | onClick?: (event: React.MouseEvent) => void; 31 | /** 32 | * For use when nesting menus, if you want the submenu to have a particular label. Gets forwarded through to the `Menu.label` prop. 33 | */ 34 | label?: string; 35 | /** 36 | * If children are supplied then this MenuItem will render a submenu when active. Must contain `MenuItem`, `MenuDivider`, or `MenuRadioGroup` components. 37 | */ 38 | children?: React.ReactNode; 39 | /** 40 | * Not for external use, this property is used by the Menu component when rendering submenus. 41 | * 42 | * @private 43 | */ 44 | __hasSubmenu?: boolean; 45 | /** 46 | * Not for external use, this property is used by the menu component when rendering items. 47 | * 48 | * @private 49 | */ 50 | __active?: boolean; 51 | }; 52 | export declare const MenuItem: React.ForwardRefExoticComponent>; 53 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tooltip/Tooltip.d.ts: -------------------------------------------------------------------------------- 1 | import { MutableRefObject, ReactElement } from 'react'; 2 | import { MaybeRenderProp, Placement } from '../../utils'; 3 | /** 4 | * Expose a select set of props to customize the popover wrapper 5 | */ 6 | declare type TooltipBoxProps = {}; 7 | export declare type TooltipProps = { 8 | /** 9 | * The element that will trigger the Tooltip. Should be a button in most cases. Can use a function for more control. 10 | */ 11 | renderTrigger: MaybeRenderProp<{ 12 | isOpen: boolean; 13 | }, ReactElement>; 14 | /** 15 | * The content to render in the Tooltip. Can use a function to access Tooltip state and for more control over close. 16 | */ 17 | children: MaybeRenderProp<{ 18 | close: () => void; 19 | }>; 20 | /** 21 | * The ref of the element the Tooltip should visually attach itself to. 22 | */ 23 | triggerRef?: MutableRefObject; 24 | /** 25 | * The delay time for the tooltip to show up, in milliseconds. Defaults to 500. 26 | */ 27 | delay?: number; 28 | /** 29 | * Whether the tooltip should be disabled, independent from the trigger. 30 | */ 31 | isDisabled?: boolean; 32 | /** 33 | * Whether the Tooltip is open (controlled mode). 34 | */ 35 | isOpen?: boolean; 36 | /** 37 | * Wether to default the Tooltip to open (uncontrolled mode). 38 | */ 39 | defaultOpen?: boolean; 40 | /** 41 | * Called when the Tooltip opens. 42 | */ 43 | onOpen?: () => void; 44 | /** 45 | * Called when the Tooltip closes. 46 | */ 47 | onClose?: () => void; 48 | /** 49 | * The placement of the Tooltip overlay with respect to its trigger element. Defaults to `bottom`. 50 | */ 51 | placement?: Placement; 52 | /** 53 | * Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient 54 | * room for it to render completely. Defaults to true. 55 | */ 56 | shouldFlip?: boolean; 57 | /** 58 | * The additional offset applied along the main axis between the element and its anchor element. 59 | */ 60 | offset?: number; 61 | /** 62 | * The additional offset applied along the cross axis between the element and its anchor element. 63 | */ 64 | crossOffset?: number; 65 | /** 66 | * Pass true to render the tooltip without an arrow. 67 | */ 68 | hideArrow?: boolean; 69 | } & TooltipBoxProps; 70 | export declare const Tooltip: (props: TooltipProps) => JSX.Element; 71 | export {}; 72 | -------------------------------------------------------------------------------- /pages/docs/[projectSlug]/[[...docsPath]].tsx: -------------------------------------------------------------------------------- 1 | import { Box } from '@stoplight/mosaic'; 2 | import { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from 'next'; 3 | import dynamic from 'next/dynamic'; 4 | import { useRouter } from 'next/router'; 5 | import * as React from 'react'; 6 | 7 | import { ErrorBoundary } from '../../../components/ErrorBoundary'; 8 | import { PageTransition } from '../../../components/PageTransition'; 9 | import { fetchNode } from '../../../handlers/node'; 10 | import { getLayout } from '../../../layouts/StoplightProjectLayout'; 11 | 12 | // @ts-expect-error : TODO need to fix the typings or wrap + re-export this component 13 | const DocsContent = dynamic(() => import('@stoplight/elements/components/Docs').then(mod => mod.Docs), { ssr: false }); 14 | 15 | type ThenArg = T extends PromiseLike ? U : T; 16 | 17 | export const getStaticProps: GetStaticProps<{ 18 | node: ThenArg>; 19 | }> = async ctx => { 20 | const { docsPath, projectSlug } = ctx.params; 21 | 22 | let node; 23 | try { 24 | node = await fetchNode({ 25 | projectSlug: typeof projectSlug === 'string' ? projectSlug : projectSlug.join('/'), 26 | nodeUri: typeof docsPath === 'string' ? docsPath : docsPath.join('/'), 27 | }); 28 | } catch (e) { 29 | // TODO: throw error with a code so we can distinguish not found from other errors 30 | console.error('docs.fetchNode.getStaticProps', e); 31 | return { 32 | notFound: true, 33 | }; 34 | } 35 | 36 | return { 37 | // 1 min 38 | revalidate: 60, 39 | props: { 40 | node, 41 | }, 42 | }; 43 | }; 44 | 45 | export const getStaticPaths: GetStaticPaths = async () => { 46 | return { 47 | paths: [], 48 | // this generates static pages on demand, with re-build according to `revalidate` seconds prop above 49 | fallback: 'blocking', 50 | }; 51 | }; 52 | 53 | function DocsPage({ node }: InferGetStaticPropsType) { 54 | React.useEffect(() => console.info('DocsPage.mount'), []); 55 | console.info('DocsPage.render'); 56 | 57 | const router = useRouter(); 58 | if (router.isFallback) { 59 | return

Loading...
; 60 | } 61 | 62 | let elem; 63 | if (!node || router.isFallback) { 64 | elem = Loading...; 65 | } else { 66 | elem = ( 67 | 68 | {/* @ts-expect-error : TODO let's make nodeType have a less strict typing (no enums) */} 69 | 70 | 71 | ); 72 | } 73 | 74 | return ( 75 | 76 | {elem} 77 | 78 | ); 79 | } 80 | 81 | DocsPage.getLayout = getLayout; 82 | 83 | export default DocsPage; 84 | -------------------------------------------------------------------------------- /components/StoplightProjectSidebar.tsx: -------------------------------------------------------------------------------- 1 | import { TableOfContentsSkeleton } from '@stoplight/elements/components/TableOfContents/Skeleton'; 2 | import { usePlatformApi } from '@stoplight/elements/hooks/usePlatformApi'; 3 | import { useTocContents } from '@stoplight/elements/hooks/useTocContents'; 4 | import { ITableOfContentsTree, TableOfContentsLinkWithId } from '@stoplight/elements/types'; 5 | import { Box } from '@stoplight/mosaic'; 6 | import { DefaultRow, RowComponentType, TableOfContents as UIKitTableOfContents } from '@stoplight/ui-kit'; 7 | import Link from 'next/link'; 8 | import * as path from 'path'; 9 | import * as React from 'react'; 10 | 11 | import { usePrefetchOnHover } from '../hooks/usePrefetchOnHover'; 12 | 13 | const tocUri = 'api/v1/projects/{workspaceSlug}/{projectSlug}/table-of-contents'; 14 | 15 | export type StoplightProjectSidebarProps = { 16 | projectSlug: string; 17 | nodeUri?: string; 18 | branchSlug?: string; 19 | }; 20 | 21 | export const StoplightProjectSidebar = React.memo( 22 | ({ projectSlug, branchSlug, nodeUri }) => { 23 | const { data: tocData, error } = usePlatformApi( 24 | tocUri, 25 | { 26 | workspaceSlug: 'meta', 27 | projectSlug, 28 | branchSlug, 29 | }, 30 | { 31 | type: 'custom', 32 | }, 33 | ); 34 | 35 | const tree = tocData ?? { items: [] }; 36 | 37 | const contents: TableOfContentsLinkWithId[] = useTocContents(tree).map(item => { 38 | return { 39 | ...item, 40 | isActive: item.type === 'item' && nodeUri !== void 0 ? item.to === nodeUri : false, 41 | }; 42 | }); 43 | 44 | if (!tocData && !error) { 45 | return ; 46 | } 47 | 48 | return ( 49 | 58 | ); 59 | }, 60 | ); 61 | 62 | const StoplightProjectSidebarRow: RowComponentType< 63 | TableOfContentsLinkWithId, 64 | { projectSlug: string; nodeUri?: string } 65 | > = ({ item, extra, ...rest }) => { 66 | const { projectSlug, nodeUri } = extra; 67 | 68 | const to = path.join('/docs', projectSlug, item.to || ''); 69 | const prefetchProps = usePrefetchOnHover(to); 70 | 71 | if (!item.to) return ; 72 | if (item.isExternalLink) { 73 | return ( 74 | 75 | 76 | 77 | ); 78 | } 79 | 80 | const isSelected = item.to === nodeUri; 81 | 82 | // TODO: no-underline isn't working because Elements overrides with an a:hover style 83 | return ( 84 | 85 | 86 | 94 | 95 | 96 | ); 97 | }; 98 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Select/types.d.ts: -------------------------------------------------------------------------------- 1 | import { AriaButtonProps } from '@react-types/button'; 2 | import { AriaLabelingProps, CollectionChildren, ItemElement, ItemRenderer } from '@react-types/shared'; 3 | import { Key, ReactElement, ReactNode } from 'react'; 4 | import { FlexGrowVals, WidthVals } from '../../enhancers'; 5 | import { FieldButtonProps } from '../Button'; 6 | export declare type SelectProps = AriaLabelingProps & { 7 | /** 8 | * The contents of the Select collection. 9 | */ 10 | children: CollectionChildren; 11 | /** 12 | * Item objects in the collection. Must be provided when rendering dynamic children. 13 | */ 14 | items?: Iterable; 15 | /** 16 | * The name of the Select input, used when submitting an HTML form. 17 | */ 18 | name?: string; 19 | /** 20 | * TODO: The content to display as the label. Use aria-label if a visible label is not desired. 21 | */ 22 | label?: React.ReactNode; 23 | /** 24 | * Temporary text that occupies the text input when it is empty. 25 | */ 26 | placeholder?: string; 27 | /** 28 | * The select button size - defaults to 'md'. 29 | */ 30 | size?: 'sm' | 'md'; 31 | /** 32 | * A function that returns the element that will trigger the Select. Should be a FieldButton in most cases. 33 | */ 34 | renderTrigger?: (props: Pick & AriaButtonProps<'button'>, state: { 35 | selectedItem?: SelectOptionProps; 36 | }) => ReactElement; 37 | /** 38 | * Optional text to render in front of the trigger text. Is only included when a value is selected - placeholder is not affected. 39 | */ 40 | triggerTextPrefix?: string; 41 | /** 42 | * When true the end user can select the currently selected option to de-select it (and thus clear back to empty value). 43 | */ 44 | allowEmptySelection?: boolean; 45 | /** 46 | * Whether the input can be selected but not changed by the user. 47 | */ 48 | isReadOnly?: boolean; 49 | /** 50 | * Whether the Select is disabled. 51 | */ 52 | isDisabled?: boolean; 53 | /** 54 | * The currently selected value in the collection (controlled). 55 | */ 56 | selectedValue?: Key; 57 | /** 58 | * The initial selected value in the collection (uncontrolled). 59 | */ 60 | defaultSelectedValue?: Key; 61 | /** 62 | * Handler that is called when the selection changes. 63 | */ 64 | onSelectionChange?: (value: Key) => void; 65 | /** 66 | * The values that are disabled. These options cannot be selected, focused, or otherwise interacted with. 67 | */ 68 | disabledValues?: Iterable; 69 | /** 70 | * Called when the Select opens. 71 | */ 72 | onOpen?: () => void; 73 | /** 74 | * Called when the Select closes. 75 | */ 76 | onClose?: () => void; 77 | flexGrow?: FlexGrowVals; 78 | w?: WidthVals; 79 | }; 80 | export declare type SelectItem = SelectOptionProps | SelectActionProps; 81 | declare type SelectItemBase = { 82 | /** 83 | * Optional element to render on the right side of the menu item. Use this to display keyboard shortcut, badge counts, etc. 84 | */ 85 | meta?: ReactNode; 86 | }; 87 | export declare type SelectOptionProps = SelectItemBase & { 88 | value: Key; 89 | text?: String; 90 | }; 91 | export declare type SelectActionProps = SelectItemBase & { 92 | text: String; 93 | /** 94 | * Called when SelectOption is clicked (or triggered in any way, such as via keyboard shortcut). 95 | */ 96 | onPress: () => void; 97 | }; 98 | export interface SelectSectionProps { 99 | /** Rendered contents of the section, e.g. a header. */ 100 | title?: ReactNode; 101 | /** An accessibility label for the section. */ 102 | 'aria-label'?: string; 103 | /** Static child items or a function to render children. */ 104 | children: ItemElement | ItemElement[] | ItemRenderer; 105 | /** Item objects in the section. */ 106 | items?: Iterable; 107 | } 108 | export {}; 109 | -------------------------------------------------------------------------------- /components/NextNProgress.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Adapted from https://github.com/apal21/nextjs-progressbar/blob/master/src/index.js 3 | * 4 | * Adds startDelayMs 5 | */ 6 | 7 | import Router from 'next/router'; 8 | import NProgress from 'nprogress'; 9 | import * as React from 'react'; 10 | 11 | export interface INextNProgressProps { 12 | color: string; 13 | height?: number; 14 | startPosition?: number; 15 | startDelayMs?: number; 16 | stopDelayMs?: number; 17 | options?: object; 18 | } 19 | 20 | export class NextNProgress extends React.Component { 21 | static defaultProps = { 22 | color: '#29D', 23 | startPosition: 0.3, 24 | startDelayMs: 0, 25 | stopDelayMs: 200, 26 | height: 3, 27 | }; 28 | 29 | started = false; 30 | startTimer: NodeJS.Timeout | null = null; 31 | endTimer: NodeJS.Timeout | null = null; 32 | 33 | routeChangeStart = () => { 34 | if (this.startTimer) clearTimeout(this.startTimer); 35 | if (this.endTimer) clearTimeout(this.endTimer); 36 | this.startTimer = setTimeout(() => { 37 | this.started = true; 38 | NProgress.set(this.props.startPosition || 0); 39 | NProgress.start(); 40 | }, this.props.startDelayMs); 41 | }; 42 | 43 | routeChangeEnd = () => { 44 | clearTimeout(this.startTimer); 45 | clearTimeout(this.endTimer); 46 | if (!this.started) return; 47 | this.started = false; 48 | this.endTimer = setTimeout(() => { 49 | NProgress.done(true); 50 | }, this.props.stopDelayMs); 51 | }; 52 | 53 | render() { 54 | const { color, height } = this.props; 55 | 56 | return ( 57 | 125 | ); 126 | } 127 | 128 | componentDidMount() { 129 | const { options } = this.props; 130 | 131 | if (options) { 132 | NProgress.configure(options); 133 | } 134 | 135 | Router.events.on('routeChangeStart', this.routeChangeStart); 136 | Router.events.on('routeChangeComplete', this.routeChangeEnd); 137 | Router.events.on('routeChangeError', this.routeChangeEnd); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Popover/Popover.d.ts: -------------------------------------------------------------------------------- 1 | import React, { ReactElement, RefObject } from 'react'; 2 | import { MaybeRenderProp, Placement } from '../../utils'; 3 | import { BoxOwnProps } from '../Box'; 4 | /** 5 | * Expose a select set of props to customize the popover wrapper 6 | */ 7 | declare type PopoverBoxProps = Pick; 8 | export declare type PopoverProps = { 9 | /** 10 | * The element that will trigger the Popover. Should be a button in most cases. Can use a function for more control. 11 | */ 12 | renderTrigger: MaybeRenderProp<{ 13 | isOpen: boolean; 14 | }, ReactElement>; 15 | /** 16 | * The content to render in the Popover. Can use a function to access Popover state and for more control over close. 17 | */ 18 | children: MaybeRenderProp<{ 19 | close: () => void; 20 | }>; 21 | /** 22 | * The ref of the element the Popover should visually attach itself to. 23 | */ 24 | triggerRef?: RefObject; 25 | scrollRef?: RefObject; 26 | /** 27 | * Whether the Popover is open (controlled mode). 28 | */ 29 | isOpen?: boolean; 30 | /** 31 | * Wether to default the Popover to open (uncontrolled mode). 32 | */ 33 | defaultOpen?: boolean; 34 | /** 35 | * Called when the Popover opens. 36 | */ 37 | onOpen?: () => void; 38 | /** 39 | * Called when the Popover closes. 40 | */ 41 | onClose?: () => void; 42 | /** 43 | * The placement of the Popover overlay with respect to its trigger element. 44 | */ 45 | placement?: Placement; 46 | /** 47 | * Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient 48 | * room for it to render completely. Defaults to true. 49 | */ 50 | shouldFlip?: boolean; 51 | /** 52 | * The additional offset applied along the main axis between the element and its anchor element. 53 | */ 54 | offset?: number; 55 | /** 56 | * The additional offset applied along the cross axis between the element and its anchor element. 57 | */ 58 | crossOffset?: number; 59 | } & PopoverBoxProps; 60 | export declare const Popover: React.ForwardRefExoticComponent<{ 61 | /** 62 | * The element that will trigger the Popover. Should be a button in most cases. Can use a function for more control. 63 | */ 64 | renderTrigger: MaybeRenderProp<{ 65 | isOpen: boolean; 66 | }, ReactElement>; 67 | /** 68 | * The content to render in the Popover. Can use a function to access Popover state and for more control over close. 69 | */ 70 | children: MaybeRenderProp<{ 71 | close: () => void; 72 | }>; 73 | /** 74 | * The ref of the element the Popover should visually attach itself to. 75 | */ 76 | triggerRef?: RefObject; 77 | scrollRef?: RefObject; 78 | /** 79 | * Whether the Popover is open (controlled mode). 80 | */ 81 | isOpen?: boolean; 82 | /** 83 | * Wether to default the Popover to open (uncontrolled mode). 84 | */ 85 | defaultOpen?: boolean; 86 | /** 87 | * Called when the Popover opens. 88 | */ 89 | onOpen?: () => void; 90 | /** 91 | * Called when the Popover closes. 92 | */ 93 | onClose?: () => void; 94 | /** 95 | * The placement of the Popover overlay with respect to its trigger element. 96 | */ 97 | placement?: Placement; 98 | /** 99 | * Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient 100 | * room for it to render completely. Defaults to true. 101 | */ 102 | shouldFlip?: boolean; 103 | /** 104 | * The additional offset applied along the main axis between the element and its anchor element. 105 | */ 106 | offset?: number; 107 | /** 108 | * The additional offset applied along the cross axis between the element and its anchor element. 109 | */ 110 | crossOffset?: number; 111 | } & Pick>, "p"> & React.RefAttributes>; 112 | export {}; 113 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Tabs/TabsContext.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { TabsOwnProps } from './Tabs'; 3 | export declare const TabsContext: React.Context void; 22 | unregisterItem: (id: string) => void; 23 | registerGroup: (group: import("reakit/ts/Composite/__utils/types").Group) => void; 24 | unregisterGroup: (id: string) => void; 25 | move: (id: string) => void; 26 | next: (unstable_allTheWay?: boolean) => void; 27 | previous: (unstable_allTheWay?: boolean) => void; 28 | up: (unstable_allTheWay?: boolean) => void; 29 | down: (unstable_allTheWay?: boolean) => void; 30 | first: () => void; 31 | last: () => void; 32 | sort: () => void; 33 | unstable_setVirtual: React.Dispatch>; 34 | setRTL: React.Dispatch>; 35 | setOrientation: React.Dispatch>; 36 | setCurrentId: React.Dispatch>; 37 | setLoop: React.Dispatch>; 38 | setWrap: React.Dispatch>; 39 | setShift: React.Dispatch>; 40 | reset: () => void; 41 | unstable_setIncludesBaseElement: React.Dispatch>; 42 | unstable_setHasActiveWidget: React.Dispatch>; 43 | } & { 44 | select: (id: string) => void; 45 | setSelectedId: React.Dispatch>; 46 | registerPanel: (item: import("reakit/ts/Composite/__utils/types").Item) => void; 47 | unregisterPanel: (id: string) => void; 48 | } & Pick>; 49 | export declare const useTabContext: () => import("reakit/ts").unstable_IdState & { 50 | unstable_virtual: boolean; 51 | rtl: boolean; 52 | orientation?: import("reakit/ts/Composite/__utils/types").Orientation; 53 | items: import("reakit/ts/Composite/__utils/types").Item[]; 54 | groups: import("reakit/ts/Composite/__utils/types").Group[]; 55 | currentId?: string; 56 | loop: boolean | "horizontal" | "vertical"; 57 | wrap: boolean | "horizontal" | "vertical"; 58 | shift: boolean; 59 | unstable_moves: number; 60 | unstable_hasActiveWidget: boolean; 61 | unstable_includesBaseElement: boolean; 62 | } & { 63 | selectedId?: string; 64 | panels: import("reakit/ts/Composite/__utils/types").Item[]; 65 | manual: boolean; 66 | } & import("reakit/ts").unstable_IdActions & { 67 | registerItem: (item: import("reakit/ts/Composite/__utils/types").Item) => void; 68 | unregisterItem: (id: string) => void; 69 | registerGroup: (group: import("reakit/ts/Composite/__utils/types").Group) => void; 70 | unregisterGroup: (id: string) => void; 71 | move: (id: string) => void; 72 | next: (unstable_allTheWay?: boolean) => void; 73 | previous: (unstable_allTheWay?: boolean) => void; 74 | up: (unstable_allTheWay?: boolean) => void; 75 | down: (unstable_allTheWay?: boolean) => void; 76 | first: () => void; 77 | last: () => void; 78 | sort: () => void; 79 | unstable_setVirtual: React.Dispatch>; 80 | setRTL: React.Dispatch>; 81 | setOrientation: React.Dispatch>; 82 | setCurrentId: React.Dispatch>; 83 | setLoop: React.Dispatch>; 84 | setWrap: React.Dispatch>; 85 | setShift: React.Dispatch>; 86 | reset: () => void; 87 | unstable_setIncludesBaseElement: React.Dispatch>; 88 | unstable_setHasActiveWidget: React.Dispatch>; 89 | } & { 90 | select: (id: string) => void; 91 | setSelectedId: React.Dispatch>; 92 | registerPanel: (item: import("reakit/ts/Composite/__utils/types").Item) => void; 93 | unregisterPanel: (id: string) => void; 94 | } & Pick; 95 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/LinkHeading/LinkHeading.d.ts: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import React from 'react'; 3 | import { BoxProps } from '../Box'; 4 | import { HeadingAs, HeadingOwnProps } from '../Heading'; 5 | export declare type LinkHeadingOwnProps = HeadingOwnProps & { 6 | id?: string; 7 | }; 8 | export declare type LinkHeadingProps = LinkHeadingOwnProps & BoxProps; 9 | export declare const LinkHeading: React.MemoExoticComponent & React.RefAttributes>>; 10 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Heading/Heading.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { BoxProps } from '../Box/types'; 3 | export declare type HeadingSizeVals = 1 | 2 | 3 | 4; 4 | export declare type HeadingOwnProps = { 5 | size: HeadingSizeVals; 6 | }; 7 | export declare type HeadingAs = 'h1' | 'h2' | 'h3' | 'h4'; 8 | export declare type HeadingProps = HeadingOwnProps & BoxProps; 9 | export declare const Heading: React.MemoExoticComponent & React.RefAttributes>>; 10 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Button/FieldButton.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { ButtonProps } from './Button'; 3 | export declare type FieldButtonProps = { 4 | placeholder?: string; 5 | onClear?: () => void; 6 | } & ButtonProps; 7 | export declare const FieldButton: React.ForwardRefExoticComponent & React.RefAttributes>; 8 | -------------------------------------------------------------------------------- /components/SiteHeader.tsx: -------------------------------------------------------------------------------- 1 | import { Box, Container, Flex, HStack, Icon, Menu, MenuItem, NoSsr, Pressable } from '@stoplight/mosaic'; 2 | import Link from 'next/link'; 3 | import { useRouter } from 'next/router'; 4 | import * as React from 'react'; 5 | 6 | import { usePrefetchOnHover } from '../hooks'; 7 | import { ThemeSwitcher } from './ThemeSwitcher'; 8 | 9 | const SiteHeaderLink = ({ to, children }: { to: string; children: React.ReactNode }) => { 10 | const router = useRouter(); 11 | 12 | const currentPath = router.asPath; 13 | const isActive = currentPath === to || currentPath.startsWith(to); 14 | 15 | return ( 16 | 17 | 18 | 24 | {children} 25 | 26 | 27 | 28 | ); 29 | }; 30 | 31 | const SiteHeaderMenuLink = ({ to, children }: { to: string; children: React.ReactNode }) => { 32 | const router = useRouter(); 33 | 34 | const currentPath = router.asPath; 35 | const isActive = currentPath === to || currentPath.startsWith(to); 36 | 37 | return ( 38 | 39 | 47 | {children} 48 | 49 | 50 | ); 51 | }; 52 | 53 | const SiteHeader = React.memo(() => { 54 | // mosaic doesn't yet support `fak` (custom kit icons) 55 | // @ts-expect-error 56 | const icon = ; 57 | const router = useRouter(); 58 | 59 | console.info('SiteHeader.render'); 60 | 61 | return ( 62 | 63 | 64 | 65 | 66 | 67 | 68 | {icon} 69 | 70 | 71 | 72 | 73 | 74 | Docs 75 | Guides 76 | 77 | 81 | 82 | Reference 83 | 84 | 85 | } 86 | > 87 | Styleguides with Spectral} 89 | onClick={() => { 90 | // TODO: This is a hack because the text prop doesn't allow filling the entire row. This there's a space to the right that's unclickable by the link 91 | router.push('/docs/spectral/README.md'); 92 | }} 93 | /> 94 | 95 | Mock with Prism} 97 | onClick={() => { 98 | // TODO: This is a hack because the text prop doesn't allow filling the entire row. This there's a space to the right that's unclickable by the link 99 | router.push('/docs/prism/README.md'); 100 | }} 101 | /> 102 | 103 | Docs with Elements 106 | } 107 | onClick={() => { 108 | // TODO: This is a hack because the text prop doesn't allow filling the entire row. This there's a space to the right that's unclickable by the link 109 | router.push('/docs/elements/docs/introduction.md'); 110 | }} 111 | /> 112 | 113 | Stoplight CLI} 115 | onClick={() => { 116 | // TODO: This is a hack because the text prop doesn't allow filling the entire row. This there's a space to the right that's unclickable by the link 117 | router.push('/docs/cli/README.md'); 118 | }} 119 | /> 120 | 121 | Stoplight API} 123 | onClick={() => { 124 | // TODO: This is a hack because the text prop doesn't allow filling the entire row. This there's a space to the right that's unclickable by the link 125 | router.push('/docs/platform-api/openapi.v1.yaml'); 126 | }} 127 | /> 128 | 129 | 130 | 131 | 132 | 133 | Blog 134 | Support 135 | Sign In 136 | 137 | 138 | 139 | 140 | 141 | 142 | ); 143 | }); 144 | 145 | export default SiteHeader; 146 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/components/Input/Input.d.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { IMarginProps, IntentVals } from '../../enhancers'; 3 | import { BoxOwnProps } from '../Box/types'; 4 | import { IIconProps } from '../Icon'; 5 | import { AppearanceVals } from './variants'; 6 | export interface IInputProps extends IMarginProps, BoxOwnProps>, Omit, HTMLInputElement>, 'width' | 'height' | 'color' | 'size'> { 7 | appearance?: AppearanceVals; 8 | intent?: IntentVals; 9 | size?: 'sm' | 'md' | 'lg'; 10 | disabled?: boolean; 11 | readOnly?: boolean; 12 | required?: boolean; 13 | icon?: IIconProps['icon'] | React.ReactElement; 14 | } 15 | export declare const Input: React.MemoExoticComponent & React.RefAttributes>>; 16 | -------------------------------------------------------------------------------- /.yalc/@stoplight/mosaic/themes/default.css: -------------------------------------------------------------------------------- 1 | :root, 2 | [data-theme="light"], 3 | [data-theme="light"] .sl-inverted .sl-inverted, 4 | [data-theme="light"] .sl-inverted .sl-inverted .sl-inverted .sl-inverted { 5 | color: var(--color-text); 6 | 7 | --text-h: 0; 8 | --text-s: 0%; 9 | --text-l: 15%; 10 | --shadow-sm: 0px 0px 1px rgba(67, 90, 111, 0.3); 11 | --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.25), 0px 0px 1px rgba(67, 90, 111, 0.3); 12 | --shadow-lg: 0 5px 14px -3px rgba(67, 90, 111, .3), 0 0 0 0.5px rgba(0,0,0,.2); 13 | --shadow-xl: 0px 0px 1px rgba(67, 90, 111, 0.3), 0px 8px 10px -4px rgba(67, 90, 111, 0.45); 14 | --shadow-2xl: 0px 0px 1px rgba(67, 90, 111, 0.3), 0px 16px 24px -8px rgba(67, 90, 111, 0.45); 15 | --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 10)), 1); 16 | --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1); 17 | --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9); 18 | --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7); 19 | --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55); 20 | --canvas-h: 218; 21 | --canvas-s: 40%; 22 | --canvas-l: 100%; 23 | --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1); 24 | --color-canvas-pure: hsla(218, 40%, 100%, 1); 25 | --color-canvas-50: hsla(218, 40%, 88%, 0.15); 26 | --color-canvas-100: hsla(218, 30%, 96%, 1); 27 | --color-canvas-200: hsla(218, 36%, 92%, 1); 28 | --color-canvas-300: hsla(218, 38%, 89%, 1); 29 | --color-canvas-dialog: hsla(218, 40%, 100%, 1); 30 | --color-border-dark: hsla(var(--canvas-h), 30%, 72%, 0.5); 31 | --color-border: hsla(var(--canvas-h), 32%, 78%, 0.5); 32 | --color-border-light: hsla(var(--canvas-h), 24%, 84%, 0.5); 33 | --color-border-input: hsla(var(--canvas-h), 24%, 72%, 0.8); 34 | --color-border-button: hsla(var(--canvas-h), 24%, 20%, 0.8); 35 | --primary-h: 211; 36 | --primary-s: 100%; 37 | --primary-l: 61%; 38 | --color-text-primary: hsla(211, 100%, 40%, 1); 39 | --color-primary-dark: hsla(211, 80%, 52%, 1); 40 | --color-primary: hsla(211, 100%, 61%, 1); 41 | --color-primary-light: hsla(211, 100%, 73%, 1); 42 | --color-primary-tint: hsla(211, 100%, 65%, 0.25); 43 | --color-on-primary: hsla(211, 100%, 100%, 1); 44 | --success-h: 160; 45 | --success-s: 84%; 46 | --success-l: 34%; 47 | --color-text-success: hsla(160, 84%, 40%, 1); 48 | --color-success-dark: hsla(160, 67%, 29%, 1); 49 | --color-success: hsla(160, 84%, 34%, 1); 50 | --color-success-light: hsla(160, 84%, 41%, 1); 51 | --color-success-tint: hsla(160, 84%, 65%, 0.25); 52 | --color-on-success: hsla(160, 84%, 100%, 1); 53 | --warning-h: 20; 54 | --warning-s: 90%; 55 | --warning-l: 56%; 56 | --color-text-warning: hsla(20, 90%, 40%, 1); 57 | --color-warning-dark: hsla(20, 72%, 48%, 1); 58 | --color-warning: hsla(20, 90%, 56%, 1); 59 | --color-warning-light: hsla(20, 90%, 67%, 1); 60 | --color-warning-tint: hsla(20, 90%, 65%, 0.25); 61 | --color-on-warning: hsla(20, 90%, 100%, 1); 62 | --danger-h: 0; 63 | --danger-s: 84%; 64 | --danger-l: 63%; 65 | --color-text-danger: hsla(0, 84%, 40%, 1); 66 | --color-danger-dark: hsla(0, 67%, 54%, 1); 67 | --color-danger: hsla(0, 84%, 63%, 1); 68 | --color-danger-light: hsla(0, 84%, 76%, 1); 69 | --color-danger-tint: hsla(0, 84%, 65%, 0.25); 70 | --color-on-danger: hsla(0, 84%, 100%, 1); 71 | 72 | } 73 | 74 | [data-theme="light"] .sl-inverted, 75 | [data-theme="light"] .sl-inverted .sl-inverted .sl-inverted { 76 | color: var(--color-text); 77 | 78 | --text-h: 0; 79 | --text-s: 0%; 80 | --text-l: 98%; 81 | --shadow-sm: 0px 0px 1px rgba(11, 13, 19, 0.5); 82 | --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.35), 0px 0px 1px rgba(11, 13, 19, 0.4); 83 | --shadow-lg: 0 2px 14px rgba(0,0,0,.55), 0 0 0 0.5px rgba(255,255,255,.3); 84 | --shadow-xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 8px 10px -4px rgba(11, 13, 19, 0.55); 85 | --shadow-2xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 16px 24px -8px rgba(11, 13, 19, 0.55); 86 | --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 10)), 1); 87 | --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1); 88 | --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9); 89 | --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7); 90 | --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55); 91 | --canvas-h: 218; 92 | --canvas-s: 28%; 93 | --canvas-l: 15%; 94 | --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1); 95 | --color-canvas-pure: hsla(218, 28%, 12%, 1); 96 | --color-canvas-50: hsla(218, 28%, 37%, 0.15); 97 | --color-canvas-100: hsla(218, 21%, 29%, 1); 98 | --color-canvas-200: hsla(218, 25%, 23%, 1); 99 | --color-canvas-300: hsla(218, 26%, 19%, 1); 100 | --color-canvas-dialog: hsla(218, 21%, 29%, 1); 101 | --color-border-dark: hsla(var(--canvas-h), 21%, 28%, 0.5); 102 | --color-border: hsla(var(--canvas-h), 22%, 33%, 0.5); 103 | --color-border-light: hsla(var(--canvas-h), 17%, 39%, 0.5); 104 | --color-border-input: hsla(var(--canvas-h), 17%, 35%, 0.8); 105 | --color-border-button: hsla(var(--canvas-h), 17%, 85%, 0.8); 106 | --primary-h: 211; 107 | --primary-s: 100%; 108 | --primary-l: 54%; 109 | --color-text-primary: hsla(211, 90%, 60%, 1); 110 | --color-primary-dark: hsla(211, 72%, 46%, 1); 111 | --color-primary: hsla(211, 90%, 54%, 1); 112 | --color-primary-light: hsla(211, 90%, 65%, 1); 113 | --color-primary-tint: hsla(211, 90%, 65%, 0.25); 114 | --color-on-primary: hsla(211, 100%, 100%, 1); 115 | --success-h: 160; 116 | --success-s: 84%; 117 | --success-l: 75%; 118 | --color-text-success: hsla(160, 76%, 60%, 1); 119 | --color-success-dark: hsla(160, 60%, 64%, 1); 120 | --color-success: hsla(160, 76%, 75%, 1); 121 | --color-success-light: hsla(160, 76%, 90%, 1); 122 | --color-success-tint: hsla(160, 76%, 65%, 0.25); 123 | --color-on-success: hsla(160, 84%, 100%, 1); 124 | --warning-h: 20; 125 | --warning-s: 90%; 126 | --warning-l: 58%; 127 | --color-text-warning: hsla(20, 81%, 60%, 1); 128 | --color-warning-dark: hsla(20, 65%, 49%, 1); 129 | --color-warning: hsla(20, 81%, 58%, 1); 130 | --color-warning-light: hsla(20, 81%, 70%, 1); 131 | --color-warning-tint: hsla(20, 81%, 65%, 0.25); 132 | --color-on-warning: hsla(20, 90%, 100%, 1); 133 | --danger-h: 0; 134 | --danger-s: 84%; 135 | --danger-l: 53%; 136 | --color-text-danger: hsla(0, 76%, 60%, 1); 137 | --color-danger-dark: hsla(0, 60%, 45%, 1); 138 | --color-danger: hsla(0, 76%, 53%, 1); 139 | --color-danger-light: hsla(0, 76%, 64%, 1); 140 | --color-danger-tint: hsla(0, 76%, 65%, 0.25); 141 | --color-on-danger: hsla(0, 84%, 100%, 1); 142 | 143 | } 144 | [data-theme="dark"], 145 | [data-theme="dark"] .sl-inverted .sl-inverted, 146 | [data-theme="dark"] .sl-inverted .sl-inverted .sl-inverted .sl-inverted { 147 | color: var(--color-text); 148 | 149 | --text-h: 0; 150 | --text-s: 0%; 151 | --text-l: 91%; 152 | --shadow-sm: 0px 0px 1px rgba(11, 13, 19, 0.5); 153 | --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.35), 0px 0px 1px rgba(11, 13, 19, 0.4); 154 | --shadow-lg: 0 2px 14px rgba(0,0,0,.55), 0 0 0 0.5px rgba(255,255,255,.3); 155 | --shadow-xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 8px 10px -4px rgba(11, 13, 19, 0.55); 156 | --shadow-2xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 16px 24px -8px rgba(11, 13, 19, 0.55); 157 | --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 10)), 1); 158 | --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1); 159 | --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9); 160 | --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7); 161 | --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55); 162 | --canvas-h: 218; 163 | --canvas-s: 34%; 164 | --canvas-l: 10%; 165 | --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1); 166 | --color-canvas-pure: hsla(218, 34%, 7%, 1); 167 | --color-canvas-50: hsla(218, 34%, 32%, 0.15); 168 | --color-canvas-100: hsla(218, 26%, 24%, 1); 169 | --color-canvas-200: hsla(218, 31%, 18%, 1); 170 | --color-canvas-300: hsla(218, 32%, 14%, 1); 171 | --color-canvas-dialog: hsla(218, 26%, 24%, 1); 172 | --color-border-dark: hsla(var(--canvas-h), 26%, 23%, 0.5); 173 | --color-border: hsla(var(--canvas-h), 27%, 28%, 0.5); 174 | --color-border-light: hsla(var(--canvas-h), 20%, 34%, 0.5); 175 | --color-border-input: hsla(var(--canvas-h), 20%, 30%, 0.8); 176 | --color-border-button: hsla(var(--canvas-h), 20%, 85%, 0.8); 177 | --primary-h: 211; 178 | --primary-s: 100%; 179 | --primary-l: 61%; 180 | --color-text-primary: hsla(211, 100%, 60%, 1); 181 | --color-primary-dark: hsla(211, 80%, 52%, 1); 182 | --color-primary: hsla(211, 100%, 61%, 1); 183 | --color-primary-light: hsla(211, 100%, 73%, 1); 184 | --color-primary-tint: hsla(211, 100%, 65%, 0.25); 185 | --color-on-primary: hsla(211, 100%, 100%, 1); 186 | --success-h: 160; 187 | --success-s: 84%; 188 | --success-l: 34%; 189 | --color-text-success: hsla(160, 84%, 60%, 1); 190 | --color-success-dark: hsla(160, 67%, 29%, 1); 191 | --color-success: hsla(160, 84%, 34%, 1); 192 | --color-success-light: hsla(160, 84%, 41%, 1); 193 | --color-success-tint: hsla(160, 84%, 65%, 0.25); 194 | --color-on-success: hsla(160, 84%, 100%, 1); 195 | --warning-h: 20; 196 | --warning-s: 90%; 197 | --warning-l: 56%; 198 | --color-text-warning: hsla(20, 90%, 60%, 1); 199 | --color-warning-dark: hsla(20, 72%, 48%, 1); 200 | --color-warning: hsla(20, 90%, 56%, 1); 201 | --color-warning-light: hsla(20, 90%, 67%, 1); 202 | --color-warning-tint: hsla(20, 90%, 65%, 0.25); 203 | --color-on-warning: hsla(20, 90%, 100%, 1); 204 | --danger-h: 0; 205 | --danger-s: 84%; 206 | --danger-l: 63%; 207 | --color-text-danger: hsla(0, 84%, 60%, 1); 208 | --color-danger-dark: hsla(0, 67%, 54%, 1); 209 | --color-danger: hsla(0, 84%, 63%, 1); 210 | --color-danger-light: hsla(0, 84%, 76%, 1); 211 | --color-danger-tint: hsla(0, 84%, 65%, 0.25); 212 | --color-on-danger: hsla(0, 84%, 100%, 1); 213 | 214 | } 215 | 216 | [data-theme="dark"] .sl-inverted, 217 | [data-theme="dark"] .sl-inverted .sl-inverted .sl-inverted { 218 | color: var(--color-text); 219 | 220 | --text-h: 0; 221 | --text-s: 0%; 222 | --text-l: 97%; 223 | --shadow-sm: 0px 0px 1px rgba(11, 13, 19, 0.5); 224 | --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.35), 0px 0px 1px rgba(11, 13, 19, 0.4); 225 | --shadow-lg: 0 2px 14px rgba(0,0,0,.55), 0 0 0 0.5px rgba(255,255,255,.3); 226 | --shadow-xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 8px 10px -4px rgba(11, 13, 19, 0.55); 227 | --shadow-2xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 16px 24px -8px rgba(11, 13, 19, 0.55); 228 | --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 10)), 1); 229 | --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1); 230 | --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9); 231 | --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7); 232 | --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55); 233 | --canvas-h: 218; 234 | --canvas-s: 34%; 235 | --canvas-l: 15%; 236 | --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1); 237 | --color-canvas-pure: hsla(218, 34%, 12%, 1); 238 | --color-canvas-50: hsla(218, 34%, 24%, 0.15); 239 | --color-canvas-100: hsla(218, 26%, 19%, 1); 240 | --color-canvas-200: hsla(218, 31%, 15%, 1); 241 | --color-canvas-300: hsla(218, 32%, 12%, 1); 242 | --color-canvas-dialog: hsla(218, 26%, 19%, 1); 243 | --color-border-dark: hsla(var(--canvas-h), 26%, 28%, 0.5); 244 | --color-border: hsla(var(--canvas-h), 27%, 33%, 0.5); 245 | --color-border-light: hsla(var(--canvas-h), 20%, 39%, 0.5); 246 | --color-border-input: hsla(var(--canvas-h), 20%, 35%, 0.8); 247 | --color-border-button: hsla(var(--canvas-h), 20%, 85%, 0.8); 248 | --primary-h: 211; 249 | --primary-s: 100%; 250 | --primary-l: 54%; 251 | --color-text-primary: hsla(211, 80%, 60%, 1); 252 | --color-primary-dark: hsla(211, 64%, 30%, 1); 253 | --color-primary: hsla(211, 80%, 35%, 1); 254 | --color-primary-light: hsla(211, 80%, 42%, 1); 255 | --color-primary-tint: hsla(211, 80%, 42%, 0.25); 256 | --color-on-primary: hsla(211, 100%, 100%, 1); 257 | --success-h: 160; 258 | --success-s: 84%; 259 | --success-l: 75%; 260 | --color-text-success: hsla(160, 67%, 60%, 1); 261 | --color-success-dark: hsla(160, 54%, 41%, 1); 262 | --color-success: hsla(160, 67%, 49%, 1); 263 | --color-success-light: hsla(160, 67%, 59%, 1); 264 | --color-success-tint: hsla(160, 67%, 42%, 0.25); 265 | --color-on-success: hsla(160, 84%, 100%, 1); 266 | --warning-h: 20; 267 | --warning-s: 90%; 268 | --warning-l: 58%; 269 | --color-text-warning: hsla(20, 72%, 60%, 1); 270 | --color-warning-dark: hsla(20, 58%, 32%, 1); 271 | --color-warning: hsla(20, 72%, 38%, 1); 272 | --color-warning-light: hsla(20, 72%, 45%, 1); 273 | --color-warning-tint: hsla(20, 72%, 42%, 0.25); 274 | --color-on-warning: hsla(20, 90%, 100%, 1); 275 | --danger-h: 0; 276 | --danger-s: 84%; 277 | --danger-l: 53%; 278 | --color-text-danger: hsla(0, 67%, 60%, 1); 279 | --color-danger-dark: hsla(0, 54%, 29%, 1); 280 | --color-danger: hsla(0, 67%, 34%, 1); 281 | --color-danger-light: hsla(0, 67%, 41%, 1); 282 | --color-danger-tint: hsla(0, 67%, 42%, 0.25); 283 | --color-on-danger: hsla(0, 84%, 100%, 1); 284 | 285 | } --------------------------------------------------------------------------------