@atlaskit/forge-react-types 0.42.7 → 0.42.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/types/components/__generated__/BadgeProps.codegen.d.ts +23 -3
- package/dist/types/components/__generated__/CodeBlockProps.codegen.d.ts +8 -8
- package/dist/types/components/__generated__/CodeProps.codegen.d.ts +4 -4
- package/dist/types-ts4.5/components/__generated__/BadgeProps.codegen.d.ts +23 -3
- package/dist/types-ts4.5/components/__generated__/CodeBlockProps.codegen.d.ts +8 -8
- package/dist/types-ts4.5/components/__generated__/CodeProps.codegen.d.ts +4 -4
- package/package.json +4 -3
- package/scripts/codegen/codeGenerator.ts +28 -14
- package/scripts/codegen/componentPropTypes.ts +11 -4
- package/scripts/codegen/typeSerializer.ts +40 -29
- package/scripts/codegen-runner.ts +17 -0
- package/scripts/typechecker.ts +20 -0
- package/src/components/__generated__/BadgeProps.codegen.tsx +25 -3
- package/src/components/__generated__/CodeBlockProps.codegen.tsx +9 -9
- package/src/components/__generated__/CodeProps.codegen.tsx +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/forge-react-types
|
|
2
2
|
|
|
3
|
+
## 0.42.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#183733](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183733)
|
|
8
|
+
[`a0bd63639d169`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a0bd63639d169) -
|
|
9
|
+
Fix types for code and codeblock components
|
|
10
|
+
|
|
3
11
|
## 0.42.7
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - BadgeProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::70958e2a60c7a0e1b3443db2d24003cc>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/badge/__generated__/index.partial.tsx <<SignedSource::89ad3341c1b8ef4b6fc93df162ac91d3>>
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import PlatformBadge from '@atlaskit/badge';
|
|
12
|
-
type _PlatformBadgeProps = React.ComponentProps<typeof PlatformBadge>;
|
|
13
11
|
export type PlatformBadgeProps = Omit<_PlatformBadgeProps, 'children'> & {
|
|
14
12
|
/**
|
|
15
13
|
* The value displayed within the badge. A badge should only be used in cases where you want to represent a number. Use a lozenge for non-numeric information.
|
|
@@ -18,6 +16,28 @@ export type PlatformBadgeProps = Omit<_PlatformBadgeProps, 'children'> & {
|
|
|
18
16
|
*/
|
|
19
17
|
children?: _PlatformBadgeProps['children'];
|
|
20
18
|
};
|
|
19
|
+
type _PlatformBadgeProps = {
|
|
20
|
+
/**
|
|
21
|
+
* Affects the visual style of the badge.
|
|
22
|
+
*/
|
|
23
|
+
appearance?: 'added' | 'default' | 'important' | 'primary' | 'primaryInverted' | 'removed';
|
|
24
|
+
/**
|
|
25
|
+
* The value displayed within the badge. A badge should only be used in cases where you want to represent a number. Use a lozenge for non-numeric information.
|
|
26
|
+
*
|
|
27
|
+
* @type string | number
|
|
28
|
+
*/
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The maximum value to display. Defaults to `99`. If the value is 100, and max is 50, "50+" will be displayed.
|
|
32
|
+
* This value should be greater than 0. If set to `false` the original value will be displayed regardless of
|
|
33
|
+
* whether it is larger than the default maximum value.
|
|
34
|
+
*/
|
|
35
|
+
max?: number | false;
|
|
36
|
+
/**
|
|
37
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
38
|
+
*/
|
|
39
|
+
testId?: string;
|
|
40
|
+
};
|
|
21
41
|
export type BadgeProps = Pick<PlatformBadgeProps, 'appearance' | 'children' | 'max' | 'testId'>;
|
|
22
42
|
/**
|
|
23
43
|
* A badge is a visual indicator for numeric values such as tallies and scores.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - CodeBlockProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::65085e024d4b564b666c598596566f73>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/code/__generated__/codeblock.partial.tsx <<SignedSource::88ed38fdfc47db0938e7801195a00403>>
|
|
9
9
|
*/
|
|
@@ -16,12 +16,12 @@ type PlatformCodeBlockProps = {
|
|
|
16
16
|
* A unique string that appears as a data attribute `data-testid` in the
|
|
17
17
|
* rendered code. Serves as a hook for automated tests.
|
|
18
18
|
*/
|
|
19
|
-
testId
|
|
19
|
+
testId?: string;
|
|
20
20
|
/**
|
|
21
21
|
* Sets whether to display code line numbers or not.
|
|
22
22
|
* @default true
|
|
23
23
|
*/
|
|
24
|
-
showLineNumbers
|
|
24
|
+
showLineNumbers?: boolean;
|
|
25
25
|
/**
|
|
26
26
|
* Language reference designed to be populated from `SUPPORTED_LANGUAGES` in
|
|
27
27
|
* `design-system/code`. Run against language grammars from PrismJS (full list
|
|
@@ -32,7 +32,7 @@ type PlatformCodeBlockProps = {
|
|
|
32
32
|
*
|
|
33
33
|
* @default 'text'
|
|
34
34
|
*/
|
|
35
|
-
language
|
|
35
|
+
language?: 'text' | 'PHP' | 'php' | 'php3' | 'php4' | 'php5' | 'Java' | 'java' | 'CSharp' | 'csharp' | 'c#' | 'Python' | 'python' | 'py' | 'JavaScript' | 'javascript' | 'js' | 'Html' | 'html' | 'xml' | 'C++' | 'c++' | 'cpp' | 'clike' | 'Ruby' | 'ruby' | 'rb' | 'duby' | 'Objective-C' | 'objective-c' | 'objectivec' | 'obj-c' | 'objc' | 'C' | 'c' | 'Swift' | 'swift' | 'TeX' | 'tex' | 'latex' | 'Shell' | 'shell' | 'bash' | 'sh' | 'ksh' | 'zsh' | 'Scala' | 'scala' | 'Go' | 'go' | 'ActionScript' | 'actionscript' | 'actionscript3' | 'as' | 'ColdFusion' | 'coldfusion' | 'JavaFX' | 'javafx' | 'jfx' | 'VbNet' | 'vbnet' | 'vb.net' | 'vfp' | 'clipper' | 'xbase' | 'JSON' | 'json' | 'MATLAB' | 'matlab' | 'Groovy' | 'groovy' | 'SQL' | 'sql' | 'postgresql' | 'postgres' | 'plpgsql' | 'psql' | 'postgresql-console' | 'postgres-console' | 'tsql' | 't-sql' | 'mysql' | 'sqlite' | 'R' | 'r' | 'Perl' | 'perl' | 'pl' | 'Lua' | 'lua' | 'Pascal' | 'pas' | 'pascal' | 'objectpascal' | 'delphi' | 'XML' | 'TypeScript' | 'typescript' | 'ts' | 'CoffeeScript' | 'coffeescript' | 'coffee-script' | 'coffee' | 'Haskell' | 'haskell' | 'hs' | 'Puppet' | 'puppet' | 'Arduino' | 'arduino' | 'Fortran' | 'fortran' | 'Erlang' | 'erlang' | 'erl' | 'PowerShell' | 'powershell' | 'posh' | 'ps1' | 'psm1' | 'Haxe' | 'haxe' | 'hx' | 'hxsl' | 'Elixir' | 'elixir' | 'ex' | 'exs' | 'Verilog' | 'verilog' | 'v' | 'Rust' | 'rust' | 'VHDL' | 'vhdl' | 'Sass' | 'sass' | 'OCaml' | 'ocaml' | 'Dart' | 'dart' | 'CSS' | 'css' | 'reStructuredText' | 'restructuredtext' | 'rst' | 'rest' | 'Kotlin' | 'kotlin' | 'D' | 'd' | 'Octave' | 'octave' | 'QML' | 'qbs' | 'qml' | 'Prolog' | 'prolog' | 'FoxPro' | 'foxpro' | 'purebasic' | 'Scheme' | 'scheme' | 'scm' | 'CUDA' | 'cuda' | 'cu' | 'Julia' | 'julia' | 'jl' | 'Racket' | 'racket' | 'rkt' | 'Ada' | 'ada' | 'ada95' | 'ada2005' | 'Tcl' | 'tcl' | 'Mathematica' | 'mathematica' | 'mma' | 'nb' | 'Autoit' | 'autoit' | 'StandardML' | 'standardmL' | 'sml' | 'standardml' | 'Objective-J' | 'objective-j' | 'objectivej' | 'obj-j' | 'objj' | 'Smalltalk' | 'smalltalk' | 'squeak' | 'st' | 'Vala' | 'vala' | 'vapi' | 'LiveScript' | 'livescript' | 'live-script' | 'XQuery' | 'xquery' | 'xqy' | 'xq' | 'xql' | 'xqm' | 'PlainText' | 'plaintext' | 'Yaml' | 'yaml' | 'yml' | 'GraphQL' | 'graphql' | 'AppleScript' | 'applescript' | 'Clojure' | 'clojure' | 'Diff' | 'diff' | 'VisualBasic' | 'visualbasic' | 'JSX' | 'jsx' | 'TSX' | 'tsx' | 'SplunkSPL' | 'splunk-spl' | 'Dockerfile' | 'docker' | 'dockerfile' | 'HCL' | 'hcl' | 'terraform' | 'NGINX' | 'nginx' | 'Protocol Buffers' | 'protobuf' | 'proto' | 'Handlebars' | 'handlebars' | 'mustache' | 'Gherkin' | 'gherkin' | 'cucumber' | 'ABAP' | 'abap';
|
|
36
36
|
/**
|
|
37
37
|
* Comma delimited lines to highlight.
|
|
38
38
|
*
|
|
@@ -41,21 +41,21 @@ type PlatformCodeBlockProps = {
|
|
|
41
41
|
* - To highlight a group of lines `highlight="1-5"`
|
|
42
42
|
* - To highlight multiple groups `highlight="1-5,7,10,15-20"`
|
|
43
43
|
*/
|
|
44
|
-
highlight
|
|
44
|
+
highlight?: string;
|
|
45
45
|
/**
|
|
46
46
|
* Screen reader text for the start of a highlighted line.
|
|
47
47
|
*/
|
|
48
|
-
highlightedStartText
|
|
48
|
+
highlightedStartText?: string;
|
|
49
49
|
/**
|
|
50
50
|
* Screen reader text for the end of a highlighted line.
|
|
51
51
|
*/
|
|
52
|
-
highlightedEndText
|
|
52
|
+
highlightedEndText?: string;
|
|
53
53
|
/**
|
|
54
54
|
* Sets whether long lines will create a horizontally scrolling container.
|
|
55
55
|
* When set to `true`, these lines will visually wrap instead.
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
|
-
shouldWrapLongLines
|
|
58
|
+
shouldWrapLongLines?: boolean;
|
|
59
59
|
};
|
|
60
60
|
export type CodeBlockProps = Pick<PlatformCodeBlockProps, 'text' | 'testId' | 'showLineNumbers' | 'language' | 'highlight' | 'highlightedStartText' | 'highlightedEndText' | 'shouldWrapLongLines'>;
|
|
61
61
|
/**
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - CodeProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::e915d32433441373892842df5cce597e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/code/__generated__/code.partial.tsx <<SignedSource::6f210b052488fe7ece12d865706a551e>>
|
|
9
9
|
*/
|
|
10
|
-
import
|
|
10
|
+
import React from 'react';
|
|
11
11
|
type PlatformCodeProps = {
|
|
12
12
|
/**
|
|
13
13
|
* A unique string that appears as a data attribute `data-testid`
|
|
14
14
|
* in the rendered code. Serves as a hook for automated tests.
|
|
15
15
|
*/
|
|
16
|
-
testId
|
|
16
|
+
testId?: string;
|
|
17
17
|
/**
|
|
18
18
|
* Content to be rendered in the inline code block.
|
|
19
19
|
*/
|
|
20
|
-
children
|
|
20
|
+
children?: React.ReactNode;
|
|
21
21
|
};
|
|
22
22
|
export type CodeProps = Pick<PlatformCodeProps, 'children' | 'testId'>;
|
|
23
23
|
/**
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - BadgeProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::70958e2a60c7a0e1b3443db2d24003cc>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/badge/__generated__/index.partial.tsx <<SignedSource::89ad3341c1b8ef4b6fc93df162ac91d3>>
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import PlatformBadge from '@atlaskit/badge';
|
|
12
|
-
type _PlatformBadgeProps = React.ComponentProps<typeof PlatformBadge>;
|
|
13
11
|
export type PlatformBadgeProps = Omit<_PlatformBadgeProps, 'children'> & {
|
|
14
12
|
/**
|
|
15
13
|
* The value displayed within the badge. A badge should only be used in cases where you want to represent a number. Use a lozenge for non-numeric information.
|
|
@@ -18,6 +16,28 @@ export type PlatformBadgeProps = Omit<_PlatformBadgeProps, 'children'> & {
|
|
|
18
16
|
*/
|
|
19
17
|
children?: _PlatformBadgeProps['children'];
|
|
20
18
|
};
|
|
19
|
+
type _PlatformBadgeProps = {
|
|
20
|
+
/**
|
|
21
|
+
* Affects the visual style of the badge.
|
|
22
|
+
*/
|
|
23
|
+
appearance?: 'added' | 'default' | 'important' | 'primary' | 'primaryInverted' | 'removed';
|
|
24
|
+
/**
|
|
25
|
+
* The value displayed within the badge. A badge should only be used in cases where you want to represent a number. Use a lozenge for non-numeric information.
|
|
26
|
+
*
|
|
27
|
+
* @type string | number
|
|
28
|
+
*/
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The maximum value to display. Defaults to `99`. If the value is 100, and max is 50, "50+" will be displayed.
|
|
32
|
+
* This value should be greater than 0. If set to `false` the original value will be displayed regardless of
|
|
33
|
+
* whether it is larger than the default maximum value.
|
|
34
|
+
*/
|
|
35
|
+
max?: number | false;
|
|
36
|
+
/**
|
|
37
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
38
|
+
*/
|
|
39
|
+
testId?: string;
|
|
40
|
+
};
|
|
21
41
|
export type BadgeProps = Pick<PlatformBadgeProps, 'appearance' | 'children' | 'max' | 'testId'>;
|
|
22
42
|
/**
|
|
23
43
|
* A badge is a visual indicator for numeric values such as tallies and scores.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - CodeBlockProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::65085e024d4b564b666c598596566f73>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/code/__generated__/codeblock.partial.tsx <<SignedSource::88ed38fdfc47db0938e7801195a00403>>
|
|
9
9
|
*/
|
|
@@ -16,12 +16,12 @@ type PlatformCodeBlockProps = {
|
|
|
16
16
|
* A unique string that appears as a data attribute `data-testid` in the
|
|
17
17
|
* rendered code. Serves as a hook for automated tests.
|
|
18
18
|
*/
|
|
19
|
-
testId
|
|
19
|
+
testId?: string;
|
|
20
20
|
/**
|
|
21
21
|
* Sets whether to display code line numbers or not.
|
|
22
22
|
* @default true
|
|
23
23
|
*/
|
|
24
|
-
showLineNumbers
|
|
24
|
+
showLineNumbers?: boolean;
|
|
25
25
|
/**
|
|
26
26
|
* Language reference designed to be populated from `SUPPORTED_LANGUAGES` in
|
|
27
27
|
* `design-system/code`. Run against language grammars from PrismJS (full list
|
|
@@ -32,7 +32,7 @@ type PlatformCodeBlockProps = {
|
|
|
32
32
|
*
|
|
33
33
|
* @default 'text'
|
|
34
34
|
*/
|
|
35
|
-
language
|
|
35
|
+
language?: 'text' | 'PHP' | 'php' | 'php3' | 'php4' | 'php5' | 'Java' | 'java' | 'CSharp' | 'csharp' | 'c#' | 'Python' | 'python' | 'py' | 'JavaScript' | 'javascript' | 'js' | 'Html' | 'html' | 'xml' | 'C++' | 'c++' | 'cpp' | 'clike' | 'Ruby' | 'ruby' | 'rb' | 'duby' | 'Objective-C' | 'objective-c' | 'objectivec' | 'obj-c' | 'objc' | 'C' | 'c' | 'Swift' | 'swift' | 'TeX' | 'tex' | 'latex' | 'Shell' | 'shell' | 'bash' | 'sh' | 'ksh' | 'zsh' | 'Scala' | 'scala' | 'Go' | 'go' | 'ActionScript' | 'actionscript' | 'actionscript3' | 'as' | 'ColdFusion' | 'coldfusion' | 'JavaFX' | 'javafx' | 'jfx' | 'VbNet' | 'vbnet' | 'vb.net' | 'vfp' | 'clipper' | 'xbase' | 'JSON' | 'json' | 'MATLAB' | 'matlab' | 'Groovy' | 'groovy' | 'SQL' | 'sql' | 'postgresql' | 'postgres' | 'plpgsql' | 'psql' | 'postgresql-console' | 'postgres-console' | 'tsql' | 't-sql' | 'mysql' | 'sqlite' | 'R' | 'r' | 'Perl' | 'perl' | 'pl' | 'Lua' | 'lua' | 'Pascal' | 'pas' | 'pascal' | 'objectpascal' | 'delphi' | 'XML' | 'TypeScript' | 'typescript' | 'ts' | 'CoffeeScript' | 'coffeescript' | 'coffee-script' | 'coffee' | 'Haskell' | 'haskell' | 'hs' | 'Puppet' | 'puppet' | 'Arduino' | 'arduino' | 'Fortran' | 'fortran' | 'Erlang' | 'erlang' | 'erl' | 'PowerShell' | 'powershell' | 'posh' | 'ps1' | 'psm1' | 'Haxe' | 'haxe' | 'hx' | 'hxsl' | 'Elixir' | 'elixir' | 'ex' | 'exs' | 'Verilog' | 'verilog' | 'v' | 'Rust' | 'rust' | 'VHDL' | 'vhdl' | 'Sass' | 'sass' | 'OCaml' | 'ocaml' | 'Dart' | 'dart' | 'CSS' | 'css' | 'reStructuredText' | 'restructuredtext' | 'rst' | 'rest' | 'Kotlin' | 'kotlin' | 'D' | 'd' | 'Octave' | 'octave' | 'QML' | 'qbs' | 'qml' | 'Prolog' | 'prolog' | 'FoxPro' | 'foxpro' | 'purebasic' | 'Scheme' | 'scheme' | 'scm' | 'CUDA' | 'cuda' | 'cu' | 'Julia' | 'julia' | 'jl' | 'Racket' | 'racket' | 'rkt' | 'Ada' | 'ada' | 'ada95' | 'ada2005' | 'Tcl' | 'tcl' | 'Mathematica' | 'mathematica' | 'mma' | 'nb' | 'Autoit' | 'autoit' | 'StandardML' | 'standardmL' | 'sml' | 'standardml' | 'Objective-J' | 'objective-j' | 'objectivej' | 'obj-j' | 'objj' | 'Smalltalk' | 'smalltalk' | 'squeak' | 'st' | 'Vala' | 'vala' | 'vapi' | 'LiveScript' | 'livescript' | 'live-script' | 'XQuery' | 'xquery' | 'xqy' | 'xq' | 'xql' | 'xqm' | 'PlainText' | 'plaintext' | 'Yaml' | 'yaml' | 'yml' | 'GraphQL' | 'graphql' | 'AppleScript' | 'applescript' | 'Clojure' | 'clojure' | 'Diff' | 'diff' | 'VisualBasic' | 'visualbasic' | 'JSX' | 'jsx' | 'TSX' | 'tsx' | 'SplunkSPL' | 'splunk-spl' | 'Dockerfile' | 'docker' | 'dockerfile' | 'HCL' | 'hcl' | 'terraform' | 'NGINX' | 'nginx' | 'Protocol Buffers' | 'protobuf' | 'proto' | 'Handlebars' | 'handlebars' | 'mustache' | 'Gherkin' | 'gherkin' | 'cucumber' | 'ABAP' | 'abap';
|
|
36
36
|
/**
|
|
37
37
|
* Comma delimited lines to highlight.
|
|
38
38
|
*
|
|
@@ -41,21 +41,21 @@ type PlatformCodeBlockProps = {
|
|
|
41
41
|
* - To highlight a group of lines `highlight="1-5"`
|
|
42
42
|
* - To highlight multiple groups `highlight="1-5,7,10,15-20"`
|
|
43
43
|
*/
|
|
44
|
-
highlight
|
|
44
|
+
highlight?: string;
|
|
45
45
|
/**
|
|
46
46
|
* Screen reader text for the start of a highlighted line.
|
|
47
47
|
*/
|
|
48
|
-
highlightedStartText
|
|
48
|
+
highlightedStartText?: string;
|
|
49
49
|
/**
|
|
50
50
|
* Screen reader text for the end of a highlighted line.
|
|
51
51
|
*/
|
|
52
|
-
highlightedEndText
|
|
52
|
+
highlightedEndText?: string;
|
|
53
53
|
/**
|
|
54
54
|
* Sets whether long lines will create a horizontally scrolling container.
|
|
55
55
|
* When set to `true`, these lines will visually wrap instead.
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
|
-
shouldWrapLongLines
|
|
58
|
+
shouldWrapLongLines?: boolean;
|
|
59
59
|
};
|
|
60
60
|
export type CodeBlockProps = Pick<PlatformCodeBlockProps, 'text' | 'testId' | 'showLineNumbers' | 'language' | 'highlight' | 'highlightedStartText' | 'highlightedEndText' | 'shouldWrapLongLines'>;
|
|
61
61
|
/**
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - CodeProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::e915d32433441373892842df5cce597e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/code/__generated__/code.partial.tsx <<SignedSource::6f210b052488fe7ece12d865706a551e>>
|
|
9
9
|
*/
|
|
10
|
-
import
|
|
10
|
+
import React from 'react';
|
|
11
11
|
type PlatformCodeProps = {
|
|
12
12
|
/**
|
|
13
13
|
* A unique string that appears as a data attribute `data-testid`
|
|
14
14
|
* in the rendered code. Serves as a hook for automated tests.
|
|
15
15
|
*/
|
|
16
|
-
testId
|
|
16
|
+
testId?: string;
|
|
17
17
|
/**
|
|
18
18
|
* Content to be rendered in the inline code block.
|
|
19
19
|
*/
|
|
20
|
-
children
|
|
20
|
+
children?: React.ReactNode;
|
|
21
21
|
};
|
|
22
22
|
export type CodeProps = Pick<PlatformCodeProps, 'children' | 'testId'>;
|
|
23
23
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/forge-react-types",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.8",
|
|
4
4
|
"description": "Component types for Forge UI Kit React components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"team": "Forge UI"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/badge": "^18.1.0",
|
|
28
27
|
"@atlaskit/button": "^23.2.0",
|
|
29
28
|
"@atlaskit/calendar": "^17.1.0",
|
|
30
29
|
"@atlaskit/checkbox": "^17.1.0",
|
|
@@ -61,6 +60,7 @@
|
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@atlassian/codegen": "^0.1.0",
|
|
63
|
+
"@atlassian/forge-ui": "^32.24.0",
|
|
64
64
|
"@types/node": "~20.16.5",
|
|
65
65
|
"lodash": "^4.17.21",
|
|
66
66
|
"react": "^18.2.0",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"typescript": "~5.4.2"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
|
-
"codegen": "ts-node ./scripts/codegen-runner.ts"
|
|
72
|
+
"codegen": "ts-node ./scripts/codegen-runner.ts",
|
|
73
|
+
"check-types": "ts-node --type-check ./scripts/typechecker.ts"
|
|
73
74
|
},
|
|
74
75
|
"sideEffects": [
|
|
75
76
|
"*.compiled.css"
|
|
@@ -200,8 +200,11 @@ class SimpleImportDeclaration implements IImportDeclaration {
|
|
|
200
200
|
|
|
201
201
|
private namedImports = new Set<string>();
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
private defaultImport?: string;
|
|
204
|
+
|
|
205
|
+
constructor(packageName: string, defaultImport?: string) {
|
|
204
206
|
this.packageName = packageName;
|
|
207
|
+
this.defaultImport = defaultImport;
|
|
205
208
|
}
|
|
206
209
|
|
|
207
210
|
public addNamedImport(namedImport: string) {
|
|
@@ -213,14 +216,16 @@ class SimpleImportDeclaration implements IImportDeclaration {
|
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
public getText() {
|
|
216
|
-
if (this.namedImports.size === 0) {
|
|
219
|
+
if (this.namedImports.size === 0 && !this.defaultImport) {
|
|
217
220
|
return `import '${this.packageName}';`;
|
|
218
221
|
}
|
|
219
|
-
const
|
|
222
|
+
const importedNamesList = Array.from(this.namedImports)
|
|
220
223
|
.sort()
|
|
221
|
-
.map((name) => `type ${name}`)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
.map((name) => `type ${name}`);
|
|
225
|
+
const importedNames =
|
|
226
|
+
importedNamesList.length > 0 ? `{ ${importedNamesList.join(', ')} }` : null;
|
|
227
|
+
const defaultImport = this.defaultImport ? `${this.defaultImport}` : null;
|
|
228
|
+
return `import ${[defaultImport, importedNames].filter(Boolean).join(', ')} from '${this.packageName}';`;
|
|
224
229
|
}
|
|
225
230
|
}
|
|
226
231
|
|
|
@@ -559,12 +564,12 @@ const registeredExternalTypes: Record<
|
|
|
559
564
|
string,
|
|
560
565
|
{
|
|
561
566
|
package: string;
|
|
562
|
-
|
|
567
|
+
defaultImport: string;
|
|
563
568
|
}
|
|
564
569
|
> = {
|
|
565
570
|
'React.ReactNode': {
|
|
566
571
|
package: 'react',
|
|
567
|
-
|
|
572
|
+
defaultImport: 'React',
|
|
568
573
|
},
|
|
569
574
|
};
|
|
570
575
|
|
|
@@ -583,8 +588,13 @@ const consolidateImportDeclarations = (
|
|
|
583
588
|
if (existingImport) {
|
|
584
589
|
existingImport.addNamedImport(typeName);
|
|
585
590
|
} else {
|
|
586
|
-
const newImport = new SimpleImportDeclaration(
|
|
587
|
-
|
|
591
|
+
const newImport = new SimpleImportDeclaration(
|
|
592
|
+
typePackage.package,
|
|
593
|
+
typePackage.defaultImport,
|
|
594
|
+
);
|
|
595
|
+
if (!typeName.startsWith(`${typePackage.defaultImport}.`)) {
|
|
596
|
+
newImport.addNamedImport(typeName);
|
|
597
|
+
}
|
|
588
598
|
declarations.push(newImport);
|
|
589
599
|
}
|
|
590
600
|
}
|
|
@@ -614,8 +624,12 @@ const generateComponentPropTypeSourceCodeWithSerializedType = (
|
|
|
614
624
|
sourceFile,
|
|
615
625
|
).reduce(
|
|
616
626
|
(agg, declarations) => {
|
|
617
|
-
if (declarations.getName().startsWith('
|
|
618
|
-
// this is the platform props type declaration, we will use it to generate the type code
|
|
627
|
+
if (declarations.getName().startsWith('_Platform')) {
|
|
628
|
+
// this is the platform props type declaration, we will use it to generate the type code.
|
|
629
|
+
// this pattern is used when we need to add custom overrides to the platform props type.
|
|
630
|
+
agg[1] = declarations;
|
|
631
|
+
} else if (declarations.getName().startsWith('Platform') && !agg[1]) {
|
|
632
|
+
// we only use this pattern if _Platform is not used. (this is for cases like Code and CodeBlock)
|
|
619
633
|
agg[1] = declarations;
|
|
620
634
|
} else {
|
|
621
635
|
agg[0].push(declarations);
|
|
@@ -654,7 +668,7 @@ const generateComponentPropTypeSourceCodeWithSerializedType = (
|
|
|
654
668
|
const dependentTypeCode = [
|
|
655
669
|
...dependentTypeDeclarations.map((typeAlias) => typeAlias.getText()),
|
|
656
670
|
platformPropsTypeDeclarationName &&
|
|
657
|
-
`\n// Serialized type\ntype ${platformPropsTypeDeclarationName} = ${typeDefCode}
|
|
671
|
+
`\n// Serialized type\ntype ${platformPropsTypeDeclarationName} = ${typeDefCode};`,
|
|
658
672
|
]
|
|
659
673
|
.filter(Boolean)
|
|
660
674
|
.join('\n');
|
|
@@ -725,7 +739,7 @@ const codeConsolidators: Record<string, CodeConsolidator> = {
|
|
|
725
739
|
PressableProps: handleXCSSProp,
|
|
726
740
|
};
|
|
727
741
|
|
|
728
|
-
const typeSerializableComponentPropSymbols = ['CodeProps', 'CodeBlockProps'];
|
|
742
|
+
const typeSerializableComponentPropSymbols = ['CodeProps', 'CodeBlockProps', 'BadgeProps'];
|
|
729
743
|
|
|
730
744
|
const generateComponentPropTypeSourceCode = (
|
|
731
745
|
componentPropSymbol: Symbol,
|
|
@@ -189,17 +189,24 @@ const generateSharedTypesFile = (componentOutputDir: string) => {
|
|
|
189
189
|
fs.writeFileSync(typesFilePath, signedSourceCode);
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
const generateComponentPropTypes = (
|
|
192
|
+
const generateComponentPropTypes = (componentNames?: string) => {
|
|
193
193
|
const componentOutputDir = resolve(__dirname, '..', '..', 'src', 'components', '__generated__');
|
|
194
194
|
const componentIndexSourceFile = forgeUIProject.addSourceFileAtPath(
|
|
195
195
|
require.resolve('@atlassian/forge-ui/UIKit'),
|
|
196
196
|
);
|
|
197
197
|
try {
|
|
198
|
+
const componentNamesFilter = componentNames ? componentNames.split(',') : [];
|
|
198
199
|
const componentPropTypeSymbols = componentIndexSourceFile
|
|
199
200
|
.getExportSymbols()
|
|
200
|
-
.filter((symbol) =>
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
.filter((symbol) => {
|
|
202
|
+
if (componentNamesFilter.length === 0) {
|
|
203
|
+
return symbol.getName().endsWith('Props');
|
|
204
|
+
}
|
|
205
|
+
const symbolName = symbol.getName();
|
|
206
|
+
return componentNamesFilter.some((componentName) => {
|
|
207
|
+
return symbolName === `${componentName}Props`;
|
|
208
|
+
});
|
|
209
|
+
})
|
|
203
210
|
.sort((a, b) => a.getName().localeCompare(b.getName()));
|
|
204
211
|
|
|
205
212
|
// generate share types file first
|
|
@@ -55,41 +55,45 @@ const isCommonComponentPropType = (node: Node) => {
|
|
|
55
55
|
|
|
56
56
|
// resolve single level type references (e.g. SupportedLanguages))
|
|
57
57
|
// type SupportedLanguages = 'text' | 'PHP' | 'Java' | 'CSharp' | ...;
|
|
58
|
-
const isSimpleTypeReferenceNode = (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return unionTypes.every((t) => {
|
|
63
|
-
return t.isString() || t.isStringLiteral() || t.isNumber() || t.isBoolean();
|
|
64
|
-
});
|
|
58
|
+
const isSimpleTypeReferenceNode = (tsType: TSType): boolean => {
|
|
59
|
+
if (tsType.isUnion()) {
|
|
60
|
+
const unionTypes = tsType.getUnionTypes();
|
|
61
|
+
return unionTypes.every((t) => isBasicType(t));
|
|
65
62
|
}
|
|
66
63
|
return false;
|
|
67
64
|
};
|
|
68
65
|
|
|
69
|
-
const serializeSimpleTypeNode = (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
case SyntaxKind.TypeReference:
|
|
79
|
-
// resolve single level type references (e.g. SupportedLanguages))
|
|
80
|
-
if (isSimpleTypeReferenceNode(node)) {
|
|
81
|
-
return node
|
|
82
|
-
.getType()
|
|
83
|
-
.getUnionTypes()
|
|
84
|
-
.map((t) => t.getText())
|
|
85
|
-
.join(' | ');
|
|
86
|
-
}
|
|
66
|
+
const serializeSimpleTypeNode = (tsType: TSType): string => {
|
|
67
|
+
if (tsType.isStringLiteral()) {
|
|
68
|
+
return `'${tsType.getLiteralValue()}'`;
|
|
69
|
+
} else if (isBasicType(tsType)) {
|
|
70
|
+
return tsType.getText();
|
|
71
|
+
} else if (isSimpleTypeReferenceNode(tsType)) {
|
|
72
|
+
const unionTypes = tsType.getUnionTypes();
|
|
73
|
+
const serializedTypes = unionTypes.map((t) => serializeSimpleTypeNode(t));
|
|
74
|
+
return serializedTypes.join(' | ');
|
|
87
75
|
}
|
|
88
|
-
return
|
|
76
|
+
return tsType.getText();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const resolveNonNullableType = (propertySignature: PropertySignature): TSType => {
|
|
80
|
+
const hasOptionalHint = propertySignature.hasQuestionToken();
|
|
81
|
+
const type = propertySignature.getType();
|
|
82
|
+
if (!hasOptionalHint) {
|
|
83
|
+
return type;
|
|
84
|
+
}
|
|
85
|
+
// there is a case where `children?: ReactNode` using getNonNullableType() don't return the original ReactNode type
|
|
86
|
+
if (type.getText().split(' | ').includes('undefined')) {
|
|
87
|
+
return type.getNonNullableType();
|
|
88
|
+
}
|
|
89
|
+
return type;
|
|
89
90
|
};
|
|
90
91
|
|
|
91
92
|
const serializePropertySignatureCode = (propertySignature: PropertySignature) => {
|
|
92
|
-
|
|
93
|
+
const propertyName = propertySignature.getName();
|
|
94
|
+
const isOptional = propertySignature.hasQuestionToken();
|
|
95
|
+
const typeCode = serializeSimpleTypeNode(resolveNonNullableType(propertySignature));
|
|
96
|
+
return `${propertyName}${isOptional ? '?' : ''}: ${typeCode};`;
|
|
93
97
|
};
|
|
94
98
|
|
|
95
99
|
const flattenPickType = (
|
|
@@ -161,8 +165,11 @@ const getUnresolvableTypesBase = (tsType: TSType, unresolvableTypes: Set<string>
|
|
|
161
165
|
const isBasicType = (tsType: TSType): boolean => {
|
|
162
166
|
return (
|
|
163
167
|
tsType.isString() ||
|
|
168
|
+
tsType.isStringLiteral() ||
|
|
164
169
|
tsType.isNumber() ||
|
|
170
|
+
tsType.isNumberLiteral() ||
|
|
165
171
|
tsType.isBoolean() ||
|
|
172
|
+
tsType.isBooleanLiteral() ||
|
|
166
173
|
tsType.isNull() ||
|
|
167
174
|
tsType.isUndefined() ||
|
|
168
175
|
tsType.isAny() ||
|
|
@@ -173,10 +180,14 @@ const isBasicType = (tsType: TSType): boolean => {
|
|
|
173
180
|
|
|
174
181
|
const isExternalType = (tsType: TSType): boolean => {
|
|
175
182
|
const symbol = tsType.getSymbol() ?? tsType.getAliasSymbol();
|
|
176
|
-
if (!symbol) {
|
|
183
|
+
if (!symbol) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
177
186
|
|
|
178
187
|
const declaration = symbol.getDeclarations()?.[0];
|
|
179
|
-
if (!declaration) {
|
|
188
|
+
if (!declaration) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
180
191
|
|
|
181
192
|
const sourceFile = declaration.getSourceFile();
|
|
182
193
|
const filePath = sourceFile.getFilePath();
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { generateComponentPropTypes } from './codegen';
|
|
2
2
|
|
|
3
|
+
const runTypeCheck = () => {
|
|
4
|
+
// execute yarn run check-types
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
try {
|
|
7
|
+
execSync('yarn run check-types', { stdio: 'inherit' });
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log('✅ 🚀 Type checks passed successfully for generated UIKit component types!');
|
|
10
|
+
} catch (error) {
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
console.error('❌ Type checks failed:', error);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
3
17
|
if (process.argv.length < 3) {
|
|
4
18
|
generateComponentPropTypes();
|
|
5
19
|
} else {
|
|
6
20
|
// e.g yarn workspace @atlaskit/forge-react-types codegen Button
|
|
21
|
+
// or yarn workspace @atlaskit/forge-react-types codegen Button,Code
|
|
7
22
|
const componentPropTypeFilter = process.argv[2];
|
|
8
23
|
generateComponentPropTypes(componentPropTypeFilter);
|
|
9
24
|
}
|
|
25
|
+
|
|
26
|
+
runTypeCheck();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import {
|
|
3
|
+
type BadgeProps,
|
|
4
|
+
type CodeProps,
|
|
5
|
+
type CodeBlockProps,
|
|
6
|
+
} from '@atlassian/forge-ui/src/components/UIKit';
|
|
7
|
+
import { type BadgeProps as GeneratedBadgeProps } from '../src/components/__generated__/BadgeProps.codegen';
|
|
8
|
+
import { type CodeProps as GeneratedCodeProps } from '../src/components/__generated__/CodeProps.codegen';
|
|
9
|
+
import { type CodeBlockProps as GeneratedCodeBlockProps } from '../src/components/__generated__/CodeBlockProps.codegen';
|
|
10
|
+
|
|
11
|
+
const assertAssignable = <A, B extends A>() => {};
|
|
12
|
+
|
|
13
|
+
assertAssignable<GeneratedBadgeProps, BadgeProps>();
|
|
14
|
+
assertAssignable<BadgeProps, GeneratedBadgeProps>();
|
|
15
|
+
|
|
16
|
+
assertAssignable<GeneratedCodeProps, CodeProps>();
|
|
17
|
+
assertAssignable<CodeProps, GeneratedCodeProps>();
|
|
18
|
+
|
|
19
|
+
assertAssignable<GeneratedCodeBlockProps, CodeBlockProps>();
|
|
20
|
+
assertAssignable<CodeBlockProps, GeneratedCodeBlockProps>();
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - BadgeProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::70958e2a60c7a0e1b3443db2d24003cc>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/badge/__generated__/index.partial.tsx <<SignedSource::89ad3341c1b8ef4b6fc93df162ac91d3>>
|
|
9
9
|
*/
|
|
10
10
|
/* eslint @repo/internal/codegen/signed-source-integrity: "warn" */
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import PlatformBadge from '@atlaskit/badge';
|
|
14
13
|
|
|
15
|
-
type _PlatformBadgeProps = React.ComponentProps<typeof PlatformBadge>;
|
|
16
14
|
export type PlatformBadgeProps = Omit<_PlatformBadgeProps, 'children'> & {
|
|
17
15
|
/**
|
|
18
16
|
* The value displayed within the badge. A badge should only be used in cases where you want to represent a number. Use a lozenge for non-numeric information.
|
|
@@ -22,6 +20,30 @@ export type PlatformBadgeProps = Omit<_PlatformBadgeProps, 'children'> & {
|
|
|
22
20
|
children?: _PlatformBadgeProps['children'];
|
|
23
21
|
}
|
|
24
22
|
|
|
23
|
+
// Serialized type
|
|
24
|
+
type _PlatformBadgeProps = {
|
|
25
|
+
/**
|
|
26
|
+
* Affects the visual style of the badge.
|
|
27
|
+
*/
|
|
28
|
+
appearance?: 'added' | 'default' | 'important' | 'primary' | 'primaryInverted' | 'removed';
|
|
29
|
+
/**
|
|
30
|
+
* The value displayed within the badge. A badge should only be used in cases where you want to represent a number. Use a lozenge for non-numeric information.
|
|
31
|
+
*
|
|
32
|
+
* @type string | number
|
|
33
|
+
*/
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* The maximum value to display. Defaults to `99`. If the value is 100, and max is 50, "50+" will be displayed.
|
|
37
|
+
* This value should be greater than 0. If set to `false` the original value will be displayed regardless of
|
|
38
|
+
* whether it is larger than the default maximum value.
|
|
39
|
+
*/
|
|
40
|
+
max?: number | false;
|
|
41
|
+
/**
|
|
42
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
43
|
+
*/
|
|
44
|
+
testId?: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
25
47
|
export type BadgeProps = Pick<
|
|
26
48
|
PlatformBadgeProps,
|
|
27
49
|
'appearance' | 'children' | 'max' | 'testId'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - CodeBlockProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::65085e024d4b564b666c598596566f73>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/code/__generated__/codeblock.partial.tsx <<SignedSource::88ed38fdfc47db0938e7801195a00403>>
|
|
9
9
|
*/
|
|
@@ -20,12 +20,12 @@ type PlatformCodeBlockProps = {
|
|
|
20
20
|
* A unique string that appears as a data attribute `data-testid` in the
|
|
21
21
|
* rendered code. Serves as a hook for automated tests.
|
|
22
22
|
*/
|
|
23
|
-
testId
|
|
23
|
+
testId?: string;
|
|
24
24
|
/**
|
|
25
25
|
* Sets whether to display code line numbers or not.
|
|
26
26
|
* @default true
|
|
27
27
|
*/
|
|
28
|
-
showLineNumbers
|
|
28
|
+
showLineNumbers?: boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Language reference designed to be populated from `SUPPORTED_LANGUAGES` in
|
|
31
31
|
* `design-system/code`. Run against language grammars from PrismJS (full list
|
|
@@ -36,7 +36,7 @@ type PlatformCodeBlockProps = {
|
|
|
36
36
|
*
|
|
37
37
|
* @default 'text'
|
|
38
38
|
*/
|
|
39
|
-
language
|
|
39
|
+
language?: 'text' | 'PHP' | 'php' | 'php3' | 'php4' | 'php5' | 'Java' | 'java' | 'CSharp' | 'csharp' | 'c#' | 'Python' | 'python' | 'py' | 'JavaScript' | 'javascript' | 'js' | 'Html' | 'html' | 'xml' | 'C++' | 'c++' | 'cpp' | 'clike' | 'Ruby' | 'ruby' | 'rb' | 'duby' | 'Objective-C' | 'objective-c' | 'objectivec' | 'obj-c' | 'objc' | 'C' | 'c' | 'Swift' | 'swift' | 'TeX' | 'tex' | 'latex' | 'Shell' | 'shell' | 'bash' | 'sh' | 'ksh' | 'zsh' | 'Scala' | 'scala' | 'Go' | 'go' | 'ActionScript' | 'actionscript' | 'actionscript3' | 'as' | 'ColdFusion' | 'coldfusion' | 'JavaFX' | 'javafx' | 'jfx' | 'VbNet' | 'vbnet' | 'vb.net' | 'vfp' | 'clipper' | 'xbase' | 'JSON' | 'json' | 'MATLAB' | 'matlab' | 'Groovy' | 'groovy' | 'SQL' | 'sql' | 'postgresql' | 'postgres' | 'plpgsql' | 'psql' | 'postgresql-console' | 'postgres-console' | 'tsql' | 't-sql' | 'mysql' | 'sqlite' | 'R' | 'r' | 'Perl' | 'perl' | 'pl' | 'Lua' | 'lua' | 'Pascal' | 'pas' | 'pascal' | 'objectpascal' | 'delphi' | 'XML' | 'TypeScript' | 'typescript' | 'ts' | 'CoffeeScript' | 'coffeescript' | 'coffee-script' | 'coffee' | 'Haskell' | 'haskell' | 'hs' | 'Puppet' | 'puppet' | 'Arduino' | 'arduino' | 'Fortran' | 'fortran' | 'Erlang' | 'erlang' | 'erl' | 'PowerShell' | 'powershell' | 'posh' | 'ps1' | 'psm1' | 'Haxe' | 'haxe' | 'hx' | 'hxsl' | 'Elixir' | 'elixir' | 'ex' | 'exs' | 'Verilog' | 'verilog' | 'v' | 'Rust' | 'rust' | 'VHDL' | 'vhdl' | 'Sass' | 'sass' | 'OCaml' | 'ocaml' | 'Dart' | 'dart' | 'CSS' | 'css' | 'reStructuredText' | 'restructuredtext' | 'rst' | 'rest' | 'Kotlin' | 'kotlin' | 'D' | 'd' | 'Octave' | 'octave' | 'QML' | 'qbs' | 'qml' | 'Prolog' | 'prolog' | 'FoxPro' | 'foxpro' | 'purebasic' | 'Scheme' | 'scheme' | 'scm' | 'CUDA' | 'cuda' | 'cu' | 'Julia' | 'julia' | 'jl' | 'Racket' | 'racket' | 'rkt' | 'Ada' | 'ada' | 'ada95' | 'ada2005' | 'Tcl' | 'tcl' | 'Mathematica' | 'mathematica' | 'mma' | 'nb' | 'Autoit' | 'autoit' | 'StandardML' | 'standardmL' | 'sml' | 'standardml' | 'Objective-J' | 'objective-j' | 'objectivej' | 'obj-j' | 'objj' | 'Smalltalk' | 'smalltalk' | 'squeak' | 'st' | 'Vala' | 'vala' | 'vapi' | 'LiveScript' | 'livescript' | 'live-script' | 'XQuery' | 'xquery' | 'xqy' | 'xq' | 'xql' | 'xqm' | 'PlainText' | 'plaintext' | 'Yaml' | 'yaml' | 'yml' | 'GraphQL' | 'graphql' | 'AppleScript' | 'applescript' | 'Clojure' | 'clojure' | 'Diff' | 'diff' | 'VisualBasic' | 'visualbasic' | 'JSX' | 'jsx' | 'TSX' | 'tsx' | 'SplunkSPL' | 'splunk-spl' | 'Dockerfile' | 'docker' | 'dockerfile' | 'HCL' | 'hcl' | 'terraform' | 'NGINX' | 'nginx' | 'Protocol Buffers' | 'protobuf' | 'proto' | 'Handlebars' | 'handlebars' | 'mustache' | 'Gherkin' | 'gherkin' | 'cucumber' | 'ABAP' | 'abap';
|
|
40
40
|
/**
|
|
41
41
|
* Comma delimited lines to highlight.
|
|
42
42
|
*
|
|
@@ -45,22 +45,22 @@ type PlatformCodeBlockProps = {
|
|
|
45
45
|
* - To highlight a group of lines `highlight="1-5"`
|
|
46
46
|
* - To highlight multiple groups `highlight="1-5,7,10,15-20"`
|
|
47
47
|
*/
|
|
48
|
-
highlight
|
|
48
|
+
highlight?: string;
|
|
49
49
|
/**
|
|
50
50
|
* Screen reader text for the start of a highlighted line.
|
|
51
51
|
*/
|
|
52
|
-
highlightedStartText
|
|
52
|
+
highlightedStartText?: string;
|
|
53
53
|
/**
|
|
54
54
|
* Screen reader text for the end of a highlighted line.
|
|
55
55
|
*/
|
|
56
|
-
highlightedEndText
|
|
56
|
+
highlightedEndText?: string;
|
|
57
57
|
/**
|
|
58
58
|
* Sets whether long lines will create a horizontally scrolling container.
|
|
59
59
|
* When set to `true`, these lines will visually wrap instead.
|
|
60
60
|
* @default false
|
|
61
61
|
*/
|
|
62
|
-
shouldWrapLongLines
|
|
63
|
-
}
|
|
62
|
+
shouldWrapLongLines?: boolean;
|
|
63
|
+
};
|
|
64
64
|
|
|
65
65
|
export type CodeBlockProps = Pick<
|
|
66
66
|
PlatformCodeBlockProps,
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - CodeProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::e915d32433441373892842df5cce597e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
8
|
* @codegenDependency ../../../../forge-ui/src/components/UIKit/code/__generated__/code.partial.tsx <<SignedSource::6f210b052488fe7ece12d865706a551e>>
|
|
9
9
|
*/
|
|
10
10
|
/* eslint @repo/internal/codegen/signed-source-integrity: "warn" */
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import React from 'react';
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
// Serialized type
|
|
@@ -18,12 +18,12 @@ type PlatformCodeProps = {
|
|
|
18
18
|
* A unique string that appears as a data attribute `data-testid`
|
|
19
19
|
* in the rendered code. Serves as a hook for automated tests.
|
|
20
20
|
*/
|
|
21
|
-
testId
|
|
21
|
+
testId?: string;
|
|
22
22
|
/**
|
|
23
23
|
* Content to be rendered in the inline code block.
|
|
24
24
|
*/
|
|
25
|
-
children
|
|
26
|
-
}
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
};
|
|
27
27
|
|
|
28
28
|
export type CodeProps = Pick<
|
|
29
29
|
PlatformCodeProps,
|