repo
stringlengths
7
64
file_url
stringlengths
81
338
file_path
stringlengths
5
257
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:25:31
2026-01-05 01:50:38
truncated
bool
2 classes
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/utils.ts
code/renderers/react/src/componentManifest/utils.ts
// Object.groupBy polyfill import { readFileSync } from 'node:fs'; import { resolveImport } from 'storybook/internal/common'; import { logger } from 'storybook/internal/node-logger'; import * as find from 'empathic/find'; export const groupBy = <K extends PropertyKey, T>( items: T[], keySelector: (item: T, index...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/generator.ts
code/renderers/react/src/componentManifest/generator.ts
import { recast } from 'storybook/internal/babel'; import { extractDescription, loadCsf } from 'storybook/internal/csf-tools'; import { logger } from 'storybook/internal/node-logger'; import type { IndexEntry } from 'storybook/internal/types'; import { type ComponentManifest, type PresetPropertyFn, type Storybook...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/getComponentImports.test.ts
code/renderers/react/src/componentManifest/getComponentImports.test.ts
import { beforeEach, expect, test, vi } from 'vitest'; import { loadCsf } from 'storybook/internal/csf-tools'; import { vol } from 'memfs'; import { dedent } from 'ts-dedent'; import { fsMocks } from './fixtures'; import { getImports as buildImports, getComponentData } from './getComponentImports'; beforeEach(() =>...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/generateCodeSnippet.ts
code/renderers/react/src/componentManifest/generateCodeSnippet.ts
import { type NodePath, types as t } from 'storybook/internal/babel'; import { type CsfFile } from 'storybook/internal/csf-tools'; import { invariant } from './utils'; export function getCodeSnippet( csf: CsfFile, storyName: string, componentName?: string ): t.VariableDeclaration | t.FunctionDeclaration { con...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/utils.test.ts
code/renderers/react/src/componentManifest/utils.test.ts
import { expect, test, vi } from 'vitest'; import { cached, groupBy, invalidateCache, invariant } from './utils'; // Helpers const calls = () => { let n = 0; return { inc: () => ++n, count: () => n, }; }; test('groupBy groups items by key function', () => { const items = [ { k: 'a', v: 1 }, {...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/fixtures.ts
code/renderers/react/src/componentManifest/fixtures.ts
import { dedent } from 'ts-dedent'; export const fsMocks = { ['./package.json']: JSON.stringify({ name: 'some-package' }), ['./src/stories/Button.stories.ts']: dedent` import type { Meta, StoryObj } from '@storybook/react'; import { fn } from 'storybook/test'; import { Button } from './Butt...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/jsdocTags.test.ts
code/renderers/react/src/componentManifest/jsdocTags.test.ts
import { expect, it } from 'vitest'; import { dedent } from 'ts-dedent'; import { extractJSDocInfo } from './jsdocTags'; it('should extract @summary tag', () => { const code = dedent`description\n@summary\n my summary`; const tags = extractJSDocInfo(code); expect(tags).toMatchInlineSnapshot(` { "desc...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/generator.test.ts
code/renderers/react/src/componentManifest/generator.test.ts
import { beforeEach, expect, test, vi } from 'vitest'; import { vol } from 'memfs'; import { dedent } from 'ts-dedent'; import { fsMocks, indexJson } from './fixtures'; import { manifests } from './generator'; beforeEach(() => { vi.spyOn(process, 'cwd').mockReturnValue('/app'); vol.fromJSON(fsMocks, '/app'); });...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/reactDocgen.ts
code/renderers/react/src/componentManifest/reactDocgen.ts
import { existsSync } from 'node:fs'; import { dirname, sep } from 'node:path'; import { babelParse, types as t } from 'storybook/internal/babel'; import { getProjectRoot, supportedExtensions } from 'storybook/internal/common'; import { logger } from 'storybook/internal/node-logger'; import * as find from 'empathic/f...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/reactDocgen/docgenResolver.ts
code/renderers/react/src/componentManifest/reactDocgen/docgenResolver.ts
import { extname } from 'node:path'; import { supportedExtensions } from 'storybook/internal/common'; import resolve from 'resolve'; export class ReactDocgenResolveError extends Error { // the magic string that react-docgen uses to check if a module is ignored readonly code = 'MODULE_NOT_FOUND'; constructor(f...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/reactDocgen/exportNameHandler.ts
code/renderers/react/src/componentManifest/reactDocgen/exportNameHandler.ts
/** * ExportNameHandler * * Sets `exportName` on the documentation: * * - 'default' for default exports * - The exported identifier for named exports (incl. aliases) * - Undefined when not exported / undetermined */ import type { Handler, NodePath, babelTypes as t } from 'react-docgen'; import { utils } from 'r...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/componentManifest/reactDocgen/actualNameHandler.ts
code/renderers/react/src/componentManifest/reactDocgen/actualNameHandler.ts
/** * This is heavily based on the react-docgen `displayNameHandler` * (https://github.com/reactjs/react-docgen/blob/26c90c0dd105bf83499a83826f2a6ff7a724620d/src/handlers/displayNameHandler.ts) * but instead defines an `actualName` property on the generated docs that is taken first from the * component's actual nam...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/jsxDecorator.tsx
code/renderers/react/src/docs/jsxDecorator.tsx
import type { ReactElement, ReactNode } from 'react'; import React, { createElement, isValidElement } from 'react'; import { logger } from 'storybook/internal/client-logger'; import { SourceType, getDocgenSection } from 'storybook/internal/docs-tools'; import type { PartialStoryFn, StoryContext } from 'storybook/inter...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/jsxDecorator.test.tsx
code/renderers/react/src/docs/jsxDecorator.test.tsx
/** @vitest-environment happy-dom */ import type { Mock } from 'vitest'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import type { FC, PropsWithChildren } from 'react'; import React, { Profiler, StrictMode, createElement } from 'react'; import PropTypes from 'prop-types'; import { addons, emitTrans...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/applyDecorators.ts
code/renderers/react/src/docs/applyDecorators.ts
import type { DecoratorFunction, LegacyStoryFn } from 'storybook/internal/types'; import { applyDecorators as defaultDecorateStory } from '../applyDecorators'; import type { ReactRenderer } from '../types'; import { jsxDecorator } from './jsxDecorator'; export const applyDecorators = ( storyFn: LegacyStoryFn<ReactR...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/typeScript/handleProp.ts
code/renderers/react/src/docs/typeScript/handleProp.ts
import type { ExtractedProp, PropDef } from 'storybook/internal/docs-tools'; import { createDefaultValue, createDefaultValueFromRawDefaultProp } from '../lib/defaultValues'; export function enhanceTypeScriptProp(extractedProp: ExtractedProp, rawDefaultProp?: any): PropDef { const { propDef } = extractedProp; con...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/typeScript/handleProp.test.tsx
code/renderers/react/src/docs/typeScript/handleProp.test.tsx
import { describe, expect, it } from 'vitest'; import React from 'react'; import { type DocgenInfo, type DocgenPropDefaultValue, type PropDef, extractComponentProps, } from 'storybook/internal/docs-tools'; import { enhanceTypeScriptProp } from './handleProp'; type Component = any; const DOCGEN_SECTION = 'p...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/rawDefaultPropResolvers.ts
code/renderers/react/src/docs/propTypes/rawDefaultPropResolvers.ts
import { createSummaryValue } from 'storybook/internal/docs-tools'; import { ELEMENT_CAPTION, FUNCTION_CAPTION } from '../lib/captions'; import type { TypeResolver } from '../lib/defaultValues'; import { createTypeResolvers, extractFunctionName } from '../lib/defaultValues'; import { getPrettyElementIdentifier, ge...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/generateFuncSignature.test.ts
code/renderers/react/src/docs/propTypes/generateFuncSignature.test.ts
import { describe, expect, it } from 'vitest'; import { parseJsDoc } from 'storybook/internal/docs-tools'; import { generateFuncSignature, generateShortFuncSignature } from './generateFuncSignature'; describe('generateFuncSignature', () => { it('should return an empty string when there is no @params and @returns t...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/createType.ts
code/renderers/react/src/docs/propTypes/createType.ts
import type { DocgenPropType, ExtractedProp, PropType } from 'storybook/internal/docs-tools'; import { createSummaryValue, isTooLongForTypeSummary } from 'storybook/internal/docs-tools'; import { ARRAY_CAPTION, CLASS_CAPTION, CUSTOM_CAPTION, ELEMENT_CAPTION, FUNCTION_CAPTION, OBJECT_CAPTION, } from '../lib...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/handleProp.ts
code/renderers/react/src/docs/propTypes/handleProp.ts
import type { ExtractedProp, PropDef } from 'storybook/internal/docs-tools'; import { createDefaultValue, createDefaultValueFromRawDefaultProp } from '../lib/defaultValues'; import { createType } from './createType'; import { rawDefaultPropTypeResolvers } from './rawDefaultPropResolvers'; import { keepOriginalDefiniti...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/generateFuncSignature.ts
code/renderers/react/src/docs/propTypes/generateFuncSignature.ts
import type { ExtractedJsDocParam, ExtractedJsDocReturns } from 'storybook/internal/docs-tools'; export function generateFuncSignature( params: ExtractedJsDocParam[], returns: ExtractedJsDocReturns ): string { const hasParams = params != null; const hasReturns = returns != null; if (!hasParams && !hasReturn...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/handleProp.test.tsx
code/renderers/react/src/docs/propTypes/handleProp.test.tsx
import { describe, expect, it } from 'vitest'; import React from 'react'; import { type DocgenInfo, type DocgenPropDefaultValue, type PropDef, extractComponentProps, } from 'storybook/internal/docs-tools'; import PropTypes from 'prop-types'; import { enhancePropTypesProp, enhancePropTypesProps } from './han...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
true
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/propTypes/sortProps.ts
code/renderers/react/src/docs/propTypes/sortProps.ts
import type { PropDef } from 'storybook/internal/docs-tools'; type Component = any; // react-docgen doesn't returned the props in the order they were defined in the "propTypes" object of the component. // This function re-order them by their original definition order. export function keepOriginalDefinitionOrder( ex...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/isHtmlTag.ts
code/renderers/react/src/docs/lib/isHtmlTag.ts
import htmlTags from 'html-tags'; export function isHtmlTag(tagName: string): boolean { return htmlTags.includes(tagName.toLowerCase() as Parameters<typeof htmlTags.includes>[0]); }
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/captions.ts
code/renderers/react/src/docs/lib/captions.ts
export const CUSTOM_CAPTION = 'custom'; export const OBJECT_CAPTION = 'object'; export const ARRAY_CAPTION = 'array'; export const CLASS_CAPTION = 'class'; export const FUNCTION_CAPTION = 'func'; export const ELEMENT_CAPTION = 'element';
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/generateCode.ts
code/renderers/react/src/docs/lib/generateCode.ts
import { generate } from 'escodegen'; import { dedent } from 'ts-dedent'; const BASIC_OPTIONS = { format: { indent: { style: ' ', }, semicolons: false, }, }; const COMPACT_OPTIONS = { ...BASIC_OPTIONS, format: { newline: '', }, }; const PRETTY_OPTIONS = { ...BASIC_OPTIONS, }; expo...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/componentTypes.ts
code/renderers/react/src/docs/lib/componentTypes.ts
export const isMemo = (component: any) => component.$$typeof === Symbol.for('react.memo'); export const isForwardRef = (component: any) => component.$$typeof === Symbol.for('react.forward_ref');
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/defaultValues/prettyIdentifier.ts
code/renderers/react/src/docs/lib/defaultValues/prettyIdentifier.ts
import type { InspectionFunction, InspectionIdentifiableInferedType } from '../inspection'; import { InspectionType } from '../inspection'; export function getPrettyFuncIdentifier(identifier: string, hasArguments: boolean): string { return hasArguments ? `${identifier}( ... )` : `${identifier}()`; } export function...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/defaultValues/generateArray.ts
code/renderers/react/src/docs/lib/defaultValues/generateArray.ts
import { type PropDefaultValue, createSummaryValue, isTooLongForDefaultValueSummary, } from 'storybook/internal/docs-tools'; import { ARRAY_CAPTION } from '../captions'; import { generateArrayCode } from '../generateCode'; import type { InspectionArray, InspectionResult } from '../inspection'; export function g...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/defaultValues/createFromRawDefaultProp.ts
code/renderers/react/src/docs/lib/defaultValues/createFromRawDefaultProp.ts
import { type PropDef, type PropDefaultValue, createSummaryValue, isTooLongForDefaultValueSummary, } from 'storybook/internal/docs-tools'; import { isFunction, isPlainObject, isString } from 'es-toolkit/predicate'; import type reactElementToJSXStringType from 'react-element-to-jsx-string'; // @ts-expect-error ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/defaultValues/generateObject.ts
code/renderers/react/src/docs/lib/defaultValues/generateObject.ts
import { type PropDefaultValue, createSummaryValue, isTooLongForDefaultValueSummary, } from 'storybook/internal/docs-tools'; import { OBJECT_CAPTION } from '../captions'; import { generateObjectCode } from '../generateCode'; import type { InspectionArray, InspectionResult } from '../inspection'; export function...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/defaultValues/createDefaultValue.ts
code/renderers/react/src/docs/lib/defaultValues/createDefaultValue.ts
import { type PropDefaultValue, createSummaryValue, isTooLongForDefaultValueSummary, } from 'storybook/internal/docs-tools'; import { ELEMENT_CAPTION, FUNCTION_CAPTION } from '../captions'; import { generateCode } from '../generateCode'; import type { InspectionElement, InspectionFunction, InspectionIdenti...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/defaultValues/index.ts
code/renderers/react/src/docs/lib/defaultValues/index.ts
export * from './createDefaultValue'; export * from './createFromRawDefaultProp';
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/inspection/acornParser.ts
code/renderers/react/src/docs/lib/inspection/acornParser.ts
import { Parser } from 'acorn'; import jsx from 'acorn-jsx'; import * as acornWalk from 'acorn-walk'; import type estree from 'estree'; import type { InspectionArray, InspectionClass, InspectionElement, InspectionFunction, InspectionIdentifier, InspectionInferedType, InspectionLiteral, InspectionObject...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/inspection/acornParser.test.ts
code/renderers/react/src/docs/lib/inspection/acornParser.test.ts
import { describe, expect, it } from 'vitest'; import { parse } from './acornParser'; import type { InspectionArray, InspectionElement, InspectionFunction, InspectionIdentifier, InspectionLiteral, InspectionObject, InspectionUnknown, } from './types'; import { InspectionType } from './types'; describe('...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/inspection/inspectValue.ts
code/renderers/react/src/docs/lib/inspection/inspectValue.ts
import { parse } from './acornParser'; import type { InspectionResult } from './types'; import { InspectionType } from './types'; export function inspectValue(value: string): InspectionResult { try { const parsingResult = parse(value); return { ...parsingResult }; } catch (e) { // do nothing. } r...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/inspection/types.ts
code/renderers/react/src/docs/lib/inspection/types.ts
export enum InspectionType { IDENTIFIER = 'Identifier', LITERAL = 'Literal', OBJECT = 'Object', ARRAY = 'Array', FUNCTION = 'Function', CLASS = 'Class', ELEMENT = 'Element', UNKNOWN = 'Unknown', } export interface InspectionInferedType { type: InspectionType; } export interface InspectionIdentifier ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/src/docs/lib/inspection/index.ts
code/renderers/react/src/docs/lib/inspection/index.ts
export * from './types'; export * from './inspectValue';
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/csf1.stories.tsx
code/renderers/react/template/stories/csf1.stories.tsx
import React from 'react'; export default { component: {}, parameters: { chromatic: { disableSnapshot: true }, }, }; export const Hello1 = () => <div>Hello1</div>; export const Hello2 = () => <div>Hello2</div>;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/ts-argtypes.stories.tsx
code/renderers/react/template/stories/ts-argtypes.stories.tsx
import React, { useState } from 'react'; import type { Args, Parameters, StoryContext } from 'storybook/internal/types'; import type { StoryObj } from '@storybook/react'; import { PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks'; import { mapValues } from 'es-toolkit/object'; import { inferControls ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/preview.ts
code/renderers/react/template/stories/preview.ts
import { __definePreview } from '@storybook/react'; // This file is used for CSF4 stories export default __definePreview({ addons: [] });
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/teardown.stories.tsx
code/renderers/react/template/stories/teardown.stories.tsx
import { useEffect } from 'react'; const LoggingComponent = () => { useEffect(() => { console.log('mounted'); return () => { console.log('unmounted'); }; }, []); return 'Component'; }; export default { component: LoggingComponent, tags: ['autodocs'], parameters: { chromatic: { disab...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/hooks.stories.tsx
code/renderers/react/template/stories/hooks.stories.tsx
import type { FC } from 'react'; import React, { useState } from 'react'; const ButtonWithState: FC = () => { const [count, setCount] = useState(0); return ( <button type="button" onClick={() => setCount(count + 1)}> {`count: ${count}`} </button> ); }; export default { component: ButtonWithState...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/csf4.stories.tsx
code/renderers/react/template/stories/csf4.stories.tsx
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- we can't expect error as it is an error in development but it isn't sandbox // @ts-ignore only present in sandbox import preview from '#.storybook/preview'; const meta = preview.meta({ // @ts-expect-error fix globalThis.__TEMPLATE_COMPONENTS__ type not...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/jsx-docgen.stories.tsx
code/renderers/react/template/stories/jsx-docgen.stories.tsx
import React, { type FC } from 'react'; const Component: FC<{ children: React.ReactNode }> = ({ children }) => { return <div>{children}</div>; }; export default { component: Component, tags: ['autodocs'], }; // This story is used to test whether JSX elements render correctly in autodocs and controls panel expo...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/test-fn.stories.tsx
code/renderers/react/template/stories/test-fn.stories.tsx
import React from 'react'; import type { StoryContext } from '@storybook/react'; import { expect, fn } from 'storybook/test'; import preview from './preview'; const Button = (args: React.ComponentProps<'button'>) => <button {...args} />; const meta = preview.meta({ component: Button, args: { children: 'Def...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/csf2.stories.tsx
code/renderers/react/template/stories/csf2.stories.tsx
import React from 'react'; export default { component: {}, parameters: { chromatic: { disableSnapshot: true }, }, }; const Template = ({ label }: { label: string }) => <div>{label}</div>; Template.args = { label: 'Hello' }; export const Hello1 = Template.bind({}); export const Hello2 = Template.bind({}); ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/decorators.stories.tsx
code/renderers/react/template/stories/decorators.stories.tsx
import type { FC } from 'react'; import React, { createContext, useContext, useState } from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { useParameter } from 'storybook/preview-api'; const Component: FC = () => <p>Story</p>; export default { component: Component, tags: ['autodocs'], ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/mount-in-play.stories.tsx
code/renderers/react/template/stories/mount-in-play.stories.tsx
import type { FC } from 'react'; import React from 'react'; import type { StoryObj } from '@storybook/react'; const Button: FC<{ label?: string; disabled?: boolean }> = (props) => { return <button disabled={props.disabled}>{props.label}</button>; }; export default { component: Button, }; export const Basic: Sto...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/errors.stories.tsx
code/renderers/react/template/stories/errors.stories.tsx
import React from 'react'; const badOutput = { renderable: 'no, react can not render objects' }; const BadComponent = () => badOutput; export default { component: BadComponent, parameters: { chromatic: { disableSnapshot: true }, }, tags: ['!test', '!vitest'], }; export const RenderThrows = { render() {...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/10278-ts-multiple-components/input.tsx
code/renderers/react/template/stories/docgen-components/10278-ts-multiple-components/input.tsx
/* eslint-disable react/destructuring-assignment */ import React from 'react'; interface IAProps { aProperty: any; } interface IBProps { bProperty: any; } /** A component */ const A = (props: IAProps): React.JSX.Element => { return <>Hi {props.aProperty}</>; }; /** B component */ const B = (props: IBProps): R...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/10017-ts-union/input.tsx
code/renderers/react/template/stories/docgen-components/10017-ts-union/input.tsx
import React from 'react'; interface AvatarProps { /** Specify icon="search" or icon={IconComponent} */ icon: React.ReactNode | string; } const Avatar = ({ icon }: AvatarProps) => { return <div className="hello">Hello Component {icon}</div>; }; export const component = Avatar;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/ts-html/input.tsx
code/renderers/react/template/stories/docgen-components/ts-html/input.tsx
import type { FC } from 'react'; import React from 'react'; interface TypeScriptHtmlComponentProps { text: string; } export const TypeScriptHtmlComponent: FC< React.HTMLAttributes<HTMLDivElement> & TypeScriptHtmlComponentProps > = () => <div>My HTML component</div>; export const component = TypeScriptHtmlCompone...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9721-ts-deprecated-jsdoc/input.tsx
code/renderers/react/template/stories/docgen-components/9721-ts-deprecated-jsdoc/input.tsx
import React from 'react'; interface FooProps { /** The size (replaces width) */ size: { width: number; height: number }; } const Foo: React.FC<FooProps> = (props: FooProps) => <>{JSON.stringify(props)}</>; export const component = Foo;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9764-ts-extend-props/input.tsx
code/renderers/react/template/stories/docgen-components/9764-ts-extend-props/input.tsx
import React from 'react'; interface InputProps { /** The input content value */ value?: string | number; } interface RadioProps extends InputProps { defaultChecked?: boolean; checked?: boolean; } const Radio: React.FC<RadioProps> = (props: RadioProps) => <>{JSON.stringify(props)}</>; export const component...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9575-ts-camel-case/input.tsx
code/renderers/react/template/stories/docgen-components/9575-ts-camel-case/input.tsx
import type { FC } from 'react'; import React from 'react'; import PropTypes from 'prop-types'; export interface IProps { /** Button color */ color?: string; } const iconButton: FC<IProps> = function IconButton() { return <div className="icon-button">icon-button</div>; }; iconButton.propTypes = { // deepsca...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/ts-function-component/input.tsx
code/renderers/react/template/stories/docgen-components/ts-function-component/input.tsx
import React from 'react'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore (js import not supported in TS) import { imported } from '../imported'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore no types for this import * as styles from '../imported.module.css'; ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9591-ts-import-types/Bar.tsx
code/renderers/react/template/stories/docgen-components/9591-ts-import-types/Bar.tsx
export interface BarProps { foo?: string; }
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9591-ts-import-types/input.tsx
code/renderers/react/template/stories/docgen-components/9591-ts-import-types/input.tsx
import React from 'react'; import type { BarProps } from './Bar'; type OtherProps = BarProps & { other?: number; }; const Other = (props: OtherProps) => <span {...props}>Other</span>; export const component = Other;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/ts-types/input.tsx
code/renderers/react/template/stories/docgen-components/ts-types/input.tsx
import type { FC } from 'react'; import React from 'react'; function concat(a: string, b: string): string { return a + b; } interface ItemInterface { text: string; value: string; } interface PersonInterface { name: string; } type InterfaceIntersection = ItemInterface & PersonInterface; interface GenericInt...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9827-ts-default-values/input.tsx
code/renderers/react/template/stories/docgen-components/9827-ts-default-values/input.tsx
import React from 'react'; export interface HelloProps { title: string; foo: boolean; bar?: string[]; } const Hello = ({ title }: HelloProps) => { return <div className="hello">Hello Component {title}</div>; }; Hello.defaultProps = { title: 'this is the default :)', }; export const component = Hello;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/8143-ts-imported-types/types.ts
code/renderers/react/template/stories/docgen-components/8143-ts-imported-types/types.ts
export interface Foo { bar: number; }
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/8143-ts-imported-types/input.tsx
code/renderers/react/template/stories/docgen-components/8143-ts-imported-types/input.tsx
import React from 'react'; import type { Foo } from './types'; interface FooProps { bar: Foo['bar']; } export const FooComponent = (foo: FooProps) => <>{JSON.stringify(foo)}</>; export const component = FooComponent;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/ts-jsdoc/input.tsx
code/renderers/react/template/stories/docgen-components/ts-jsdoc/input.tsx
import type { FC, SyntheticEvent } from 'react'; import React from 'react'; interface TSProps { /** * This is case 1. * * @param {SyntheticEvent} event - React's original event. * @returns {void} */ case1: (event: SyntheticEvent) => void; /** * Should not be visible since it's ignored. * ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9493-ts-display-name/input.tsx
code/renderers/react/template/stories/docgen-components/9493-ts-display-name/input.tsx
import React from 'react'; type AlertCode = 'Code Red' | 'Code Yellow' | 'Code Green'; export interface EmpireAlertProps { /** A title that brings attention to the alert. */ title: AlertCode; /** A message alerting about Empire activities. */ message: string; } /** This message should show up in the Docs pan...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9556-ts-react-default-exports/input.tsx
code/renderers/react/template/stories/docgen-components/9556-ts-react-default-exports/input.tsx
import React from 'react'; export interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> { isDisabled?: boolean; } export const Button: React.FC<Props> = ({ isDisabled = false, ...props }: Props) => ( <button disabled={isDisabled} {...props} /> ); export const component = Button;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx
code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx
import React from 'react'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore-error (importing a js file) import { imported } from '../imported'; const local = 'local-value'; enum GlobalNames { top = 'top', left = 'left', } interface PropsWriterProps { /** Description */ numberRequi...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9922-ts-component-props/input.tsx
code/renderers/react/template/stories/docgen-components/9922-ts-component-props/input.tsx
import type { ComponentProps, FC, HTMLAttributes } from 'react'; import React from 'react'; type Props = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'> & { children: React.ReactNode; }; const Button: FC<Props> = ({ children, onClick }) => ( <button onClick={onClick} type="button"> {children} </button> )...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/8894-9511-ts-forward-ref/input.tsx
code/renderers/react/template/stories/docgen-components/8894-9511-ts-forward-ref/input.tsx
import React, { forwardRef } from 'react'; interface ButtonProps { /** Sets the button size. */ variant?: 'small' | 'large'; /** Disables the button. */ disabled?: boolean; /** Content of the button. */ children: React.ReactNode; } const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/8143-ts-react-fc-generics/input.tsx
code/renderers/react/template/stories/docgen-components/8143-ts-react-fc-generics/input.tsx
import React from 'react'; interface Props { padding: string; margin: number; } export const Text: React.FC<Props> = ({ padding = '0', margin }) => <>Text</>; export const component = Text;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9465-ts-type-props/input.tsx
code/renderers/react/template/stories/docgen-components/9465-ts-type-props/input.tsx
import React from 'react'; type Props = React.ButtonHTMLAttributes<HTMLButtonElement> & { disabled?: boolean; }; const Component = ({ disabled = false, children }: Props) => ( <button disabled={disabled}>{children}</button> ); export const component = Component;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/8740-ts-multi-props/input.tsx
code/renderers/react/template/stories/docgen-components/8740-ts-multi-props/input.tsx
import React from 'react'; export interface ElemAProps { size?: 'a' | 'b' | 'c' | 'd'; children: React.ReactNode; } export const Header: React.FC<ElemAProps> = ({ size = 'a', children }) => ( <div className={size}>{children}</div> ); export interface ElemBProps { size?: 'sm' | 'md' | 'lg'; children: React....
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/9832-ts-enum-export/input.tsx
code/renderers/react/template/stories/docgen-components/9832-ts-enum-export/input.tsx
import React from 'react'; export enum EnumWithExtraProps { key1 = 'key1', key2 = 'key2', } export const component = () => <div>hello</div>;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/stories/docgen-components/ts-react-fc/input.tsx
code/renderers/react/template/stories/docgen-components/ts-react-fc/input.tsx
import type { FC } from 'react'; import React from 'react'; interface ItemInterface { text: string; value: string; } interface PersonInterface { name: string; } type InterfaceIntersection = ItemInterface & PersonInterface; interface GenericInterface<T> { value: T; } enum DefaultEnum { TopLeft, TopRight...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/cli/ts/Button.stories.ts
code/renderers/react/template/cli/ts/Button.stories.ts
import type { Meta, StoryObj } from '@storybook/react'; import { fn } from 'storybook/test'; import { Button } from './Button'; // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export const meta = { title: 'Example/Button', component: Button, parameters: { // Optio...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/cli/ts/Page.stories.ts
code/renderers/react/template/cli/ts/Page.stories.ts
import type { Meta, StoryObj } from '@storybook/react'; import { expect, userEvent, within } from 'storybook/test'; import { Page } from './Page'; const meta = { title: 'Example/Page', component: Page, parameters: { // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/cli/ts/Button.tsx
code/renderers/react/template/cli/ts/Button.tsx
import React from 'react'; import './button.css'; export interface ButtonProps { /** Is this the principal call to action on the page? */ primary?: boolean; /** What background color to use */ backgroundColor?: string; /** How large should the button be? */ size?: 'small' | 'medium' | 'large'; /** Butto...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/cli/ts/Header.stories.ts
code/renderers/react/template/cli/ts/Header.stories.ts
import type { Meta, StoryObj } from '@storybook/react'; import { fn } from 'storybook/test'; import { Header } from './Header'; const meta = { title: 'Example/Header', component: Header, // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/cli/ts/Page.tsx
code/renderers/react/template/cli/ts/Page.tsx
import React from 'react'; import { Header } from './Header'; import './page.css'; type User = { name: string; }; export const Page: React.FC = () => { const [user, setUser] = React.useState<User>(); return ( <article> <Header user={user} onLogin={() => setUser({ name: 'Jane Doe' })}...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/renderers/react/template/cli/ts/Header.tsx
code/renderers/react/template/cli/ts/Header.tsx
import React from 'react'; import { Button } from './Button'; import './header.css'; type User = { name: string; }; export interface HeaderProps { user?: User; onLogin?: () => void; onLogout?: () => void; onCreateAccount?: () => void; } export const Header = ({ user, onLogin, onLogout, onCreateAccount }: ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/vitest.config.ts
code/addons/a11y/vitest.config.ts
import { defineConfig, mergeConfig } from 'vitest/config'; import { vitestCommonConfig } from '../../vitest.shared'; export default mergeConfig( vitestCommonConfig, defineConfig({ // Add custom config here }) );
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/build-config.ts
code/addons/a11y/build-config.ts
import type { BuildEntries } from '../../../scripts/build/utils/entry-utils'; const config: BuildEntries = { entries: { browser: [ { exportEntries: ['.'], entryPoint: './src/index.ts', }, { exportEntries: ['./preview'], entryPoint: './src/preview.tsx', }, ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/a11yRunner.ts
code/addons/a11y/src/a11yRunner.ts
import { ElementA11yParameterError } from 'storybook/internal/preview-errors'; import { global } from '@storybook/global'; import type { AxeResults, ContextProp, ContextSpec } from 'axe-core'; import { addons, waitForAnimations } from 'storybook/preview-api'; import { withLinkPaths } from './a11yRunnerUtils'; import...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/axeRuleMappingHelper.ts
code/addons/a11y/src/axeRuleMappingHelper.ts
import { combinedRulesMap } from './AccessibilityRuleMaps'; import type { EnhancedResult } from './types'; export const getTitleForAxeResult = (axeResult: EnhancedResult): string => combinedRulesMap[axeResult.id]?.title || axeResult.id; export const getFriendlySummaryForAxeResult = (axeResult: EnhancedResult): stri...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/preview.tsx
code/addons/a11y/src/preview.tsx
import type { AfterEach } from 'storybook/internal/types'; import { expect } from 'storybook/test'; import { run } from './a11yRunner'; import type { A11yParameters } from './params'; import { getIsVitestStandaloneRun } from './utils'; let vitestMatchersExtended = false; export const afterEach: AfterEach<any> = asy...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/a11yRunnerUtils.ts
code/addons/a11y/src/a11yRunnerUtils.ts
import { global } from '@storybook/global'; import type { AxeResults, Result } from 'axe-core'; import { PANEL_ID } from './constants'; import type { EnhancedResults } from './types'; const { document } = global; // Augment axe results with debuggable links export const withLinkPaths = (results: AxeResults, storyId...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/a11yRunnerUtils.test.ts
code/addons/a11y/src/a11yRunnerUtils.test.ts
// @vitest-environment happy-dom import { describe, expect, it } from 'vitest'; import type { AxeResults } from 'axe-core'; import { withLinkPaths } from './a11yRunnerUtils'; describe('a11yRunnerUtils', () => { describe('withLinkPaths', () => { it('should add link paths to the axe results', () => { const...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/typings.d.ts
code/addons/a11y/src/typings.d.ts
declare var __STORYBOOK_STORY_STORE__: any;
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/manager.tsx
code/addons/a11y/src/manager.tsx
import React from 'react'; import { Badge } from 'storybook/internal/components'; import { addons, types, useAddonState, useStorybookApi } from 'storybook/manager-api'; import { A11YPanel } from './components/A11YPanel'; import { A11yContextProvider } from './components/A11yContext'; import { VisionSimulator } from ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/utils.ts
code/addons/a11y/src/utils.ts
export function getIsVitestStandaloneRun() { try { // @ts-expect-error Suppress TypeScript warning about wrong setting. Doesn't matter, because we don't use tsc for bundling. return import.meta.env.VITEST_STORYBOOK === 'false'; } catch (e) { return false; } } export function getIsVitestRunning() { ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/params.ts
code/addons/a11y/src/params.ts
import type { RunOptions, Selector, SelectorList, Spec } from 'axe-core'; export type SelectorWithoutNode = Omit<Selector, 'Node'> | Omit<SelectorList, 'NodeList'>; // copy of ContextObject from axe-core export type ContextObjectWithoutNode = | { include: SelectorWithoutNode; exclude?: SelectorWithoutNo...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/AccessibilityRuleMaps.ts
code/addons/a11y/src/AccessibilityRuleMaps.ts
export type AxeRuleMap = { // The rule id from axe-core [axeId: string]: { // The simple name of the rule title: string; // The summary of the rule from axe-core axeSummary: string; // The UX-friendly summary of the rule friendlySummary: string; }; }; // Rules that align with WCAG 2.0 A/A...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/results.mock.ts
code/addons/a11y/src/results.mock.ts
export const results = { testEngine: { name: 'axe-core', version: '4.10.2', }, testRunner: { name: 'axe', }, testEnvironment: { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36', windowWidth: 833, wi...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
true
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/preview.test.tsx
code/addons/a11y/src/preview.test.tsx
// @vitest-environment happy-dom import { beforeEach, describe, expect, it, vi } from 'vitest'; import type { StoryContext } from 'storybook/internal/csf'; import { run } from './a11yRunner'; import { afterEach } from './preview'; import { getIsVitestRunning, getIsVitestStandaloneRun } from './utils'; const mocks = ...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/manager.test.tsx
code/addons/a11y/src/manager.test.tsx
// @vitest-environment happy-dom import { describe, expect, it, vi } from 'vitest'; import type { Addon_BaseType } from 'storybook/internal/types'; import * as api from 'storybook/manager-api'; import { PANEL_ID } from './constants'; import './manager'; vi.mock('storybook/manager-api'); const mockedApi = vi.mocked<...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/a11yRunner.test.ts
code/addons/a11y/src/a11yRunner.test.ts
import type { Mock } from 'vitest'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { addons } from 'storybook/preview-api'; import { EVENTS } from './constants'; vi.mock('storybook/preview-api'); const mockedAddons = vi.mocked(addons); describe('a11yRunner', () => { let mockChannel: { on: M...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/constants.ts
code/addons/a11y/src/constants.ts
export const ADDON_ID = 'storybook/a11y'; export const PANEL_ID = `${ADDON_ID}/panel`; export const PARAM_KEY = `a11y`; export const UI_STATE_ID = `${ADDON_ID}/ui`; const RESULT = `${ADDON_ID}/result`; const REQUEST = `${ADDON_ID}/request`; const RUNNING = `${ADDON_ID}/running`; const ERROR = `${ADDON_ID}/error`; const...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/postinstall.ts
code/addons/a11y/src/postinstall.ts
import { JsPackageManagerFactory } from 'storybook/internal/common'; import type { PostinstallOptions } from '../../../lib/cli-storybook/src/add'; export default async function postinstall(options: PostinstallOptions) { const args = ['storybook', 'automigrate', 'addon-a11y-addon-test']; args.push('--loglevel', '...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false
storybookjs/storybook
https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/addons/a11y/src/types.ts
code/addons/a11y/src/types.ts
import type { AxeResults, NodeResult, Result } from 'axe-core'; import type { A11yParameters as A11yParams } from './params'; export type A11YReport = EnhancedResults | { error: Error }; export interface A11yParameters { /** * Accessibility configuration * * @see https://storybook.js.org/docs/writing-test...
typescript
MIT
7f193d38eec36246a211339c1f352cca246de779
2026-01-04T15:25:31.846427Z
false