@bitrise/bitkit 9.5.1 → 9.5.3
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/package.json +5 -1
- package/src/tsconfig.tsbuildinfo +1 -0
- package/src/variables.css +141 -1
- package/.browserslistrc +0 -2
- package/.editorconfig +0 -4
- package/.eslint-tsconfig.json +0 -7
- package/.eslintrc.js +0 -28
- package/.husky/commit-msg +0 -4
- package/.nvmrc +0 -1
- package/.storybook/main.js +0 -35
- package/.storybook/manager.js +0 -6
- package/.storybook/preview.tsx +0 -20
- package/.storybook/theme.js +0 -7
- package/.stylelintignore +0 -2
- package/.stylelintrc +0 -287
- package/.svgrrc.js +0 -52
- package/.tool-versions +0 -1
- package/@types/@bitrise/bitkit.ts +0 -1
- package/@types/react-docgen.ts +0 -119
- package/CHANGELOG.md +0 -989
- package/CONTRIBUTING.md +0 -79
- package/FAQ.md +0 -19
- package/bitrise.yml +0 -66
- package/commitlint.config.js +0 -10
- package/jest.setup.js +0 -36
- package/netlify.toml +0 -42
- package/postcss.config.js +0 -16
- package/release.config.js +0 -32
- package/renovate.json +0 -6
- package/scripts/build-docs-watch.ts +0 -7
- package/scripts/build-docs.ts +0 -59
- package/site/assets/fonts/TT_Norms_Pro_Bold.woff +0 -0
- package/site/assets/fonts/TT_Norms_Pro_Normal.woff +0 -0
- package/site/assets/icons/favicon-32x32.png +0 -0
- package/site/assets/images/app_icon.jpg +0 -0
- package/site/assets/images/status-checks.png +0 -0
- package/site/components/CodeBlock/CodeBlock.css +0 -87
- package/site/components/CodeBlock/CodeBlock.tsx +0 -35
- package/site/components/Documentation/ComponentDocumentationPage.tsx +0 -150
- package/site/components/Documentation/Components/SectionAddonBeam.tsx +0 -47
- package/site/components/Documentation/Components/SectionAddonBeamSandbox.tsx +0 -32
- package/site/components/Documentation/Components/SectionAddonFooter.tsx +0 -22
- package/site/components/Documentation/Components/SectionAppear.tsx +0 -59
- package/site/components/Documentation/Components/SectionAvatar.tsx +0 -50
- package/site/components/Documentation/Components/SectionBadge.tsx +0 -38
- package/site/components/Documentation/Components/SectionBase.tsx +0 -17
- package/site/components/Documentation/Components/SectionButtons.tsx +0 -361
- package/site/components/Documentation/Components/SectionCards.tsx +0 -276
- package/site/components/Documentation/Components/SectionCheckbox.tsx +0 -38
- package/site/components/Documentation/Components/SectionDatePicker.tsx +0 -82
- package/site/components/Documentation/Components/SectionDivider.tsx +0 -31
- package/site/components/Documentation/Components/SectionDot.tsx +0 -27
- package/site/components/Documentation/Components/SectionDropdowns.tsx +0 -388
- package/site/components/Documentation/Components/SectionExpand.tsx +0 -143
- package/site/components/Documentation/Components/SectionFlex.tsx +0 -33
- package/site/components/Documentation/Components/SectionFormElements.tsx +0 -187
- package/site/components/Documentation/Components/SectionGrid.tsx +0 -125
- package/site/components/Documentation/Components/SectionHamburger.tsx +0 -34
- package/site/components/Documentation/Components/SectionIcons.tsx +0 -30
- package/site/components/Documentation/Components/SectionInputs.tsx +0 -89
- package/site/components/Documentation/Components/SectionList.tsx +0 -26
- package/site/components/Documentation/Components/SectionModals.tsx +0 -224
- package/site/components/Documentation/Components/SectionNotification.tsx +0 -38
- package/site/components/Documentation/Components/SectionPlacement.tsx +0 -167
- package/site/components/Documentation/Components/SectionProgress.tsx +0 -149
- package/site/components/Documentation/Components/SectionRadioButton.tsx +0 -38
- package/site/components/Documentation/Components/SectionRibbon.tsx +0 -33
- package/site/components/Documentation/Components/SectionRibbonSandbox.tsx +0 -17
- package/site/components/Documentation/Components/SectionSidebar.tsx +0 -125
- package/site/components/Documentation/Components/SectionSkeleton.tsx +0 -99
- package/site/components/Documentation/Components/SectionStatus.tsx +0 -53
- package/site/components/Documentation/Components/SectionStatusSandbox404.tsx +0 -42
- package/site/components/Documentation/Components/SectionStatusSandbox500.tsx +0 -13
- package/site/components/Documentation/Components/SectionTable.tsx +0 -83
- package/site/components/Documentation/Components/SectionTabs.tsx +0 -25
- package/site/components/Documentation/Components/SectionText.tsx +0 -34
- package/site/components/Documentation/Components/SectionTextarea.tsx +0 -43
- package/site/components/Documentation/Components/SectionToggle.tsx +0 -50
- package/site/components/Documentation/Components/SectionTooltips.tsx +0 -50
- package/site/components/Documentation/Documentation.tsx +0 -302
- package/site/components/Documentation/Materials/SectionColors.css +0 -33
- package/site/components/Documentation/Materials/SectionColors.tsx +0 -197
- package/site/components/Documentation/Materials/SectionIcons.tsx +0 -106
- package/site/components/Documentation/Materials/SectionTypography.tsx +0 -143
- package/site/components/Page/Page.tsx +0 -8
- package/site/components/Page/PageTitle.tsx +0 -8
- package/site/components/PropsTable/PropsTable.tsx +0 -35
- package/site/components/PropsTable/PropsTableCellUnion.tsx +0 -29
- package/site/components/PropsTable/PropsTableRow.tsx +0 -55
- package/site/components/Root/Root.tsx +0 -89
- package/site/components/Root/index.tsx +0 -4
- package/site/components/Sandbox/Sandbox.tsx +0 -19
- package/site/components/Sandbox/SandboxFrame.css +0 -20
- package/site/components/Sandbox/SandboxFrame.tsx +0 -77
- package/site/components/Section/Section.tsx +0 -8
- package/site/components/Section/SectionSubTitle.tsx +0 -8
- package/site/components/Section/SectionTitle.tsx +0 -8
- package/site/components/SideMenu/SideMenu.css +0 -39
- package/site/components/SideMenu/SideMenu.tsx +0 -53
- package/site/components/SideMenu/SideMenuItem.tsx +0 -34
- package/site/components/Window/Window.tsx +0 -62
- package/site/index.css +0 -11
- package/site/index.html +0 -16
- package/site/index.tsx +0 -16
- package/superstatic.json +0 -13
package/CONTRIBUTING.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
## Commit Messages
|
|
2
|
-
|
|
3
|
-
This project is following **continuous deployment** using Bitrise CI 🙌.
|
|
4
|
-
|
|
5
|
-
Bitkit uses a strict commit message structure that follows the [Conventional Commits](https://www.conventionalcommits.org) spec. This is used to automate publishing the package to NPM and generating the [CHANGELOG](../CHANGELOG.md) with [Semantic Release](https://github.com/semantic-release/semantic-release).
|
|
6
|
-
|
|
7
|
-
Any changes to the consumable resources of the library should trigger a release, which can be done with the following commit types.
|
|
8
|
-
|
|
9
|
-
| Commit | Release type |
|
|
10
|
-
|---|---|
|
|
11
|
-
| Commit with breaking change | Major Breaking release |
|
|
12
|
-
| Commit with type `feat` | Minor release |
|
|
13
|
-
| Commit with type `fix` | Patch release |
|
|
14
|
-
| Commit with type `style` | Patch release |
|
|
15
|
-
| Commit with type `perf` | Patch release |
|
|
16
|
-
|
|
17
|
-
Some examples...
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
fix(Button): Removed `pointer-events` rule that prevented it from being clickable.
|
|
21
|
-
feat(DatePicker): Added `range` prop to allow start and end dates to be selected.
|
|
22
|
-
style(Avatar): Updated colors of the avatar backgrounds.
|
|
23
|
-
chore(ESlint): Added rule 'blahblah'.
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Here, the `chore()` type would not trigger a new release.
|
|
27
|
-
|
|
28
|
-
## Design Review
|
|
29
|
-
|
|
30
|
-
Some changes that get submitted to Bitkit may include design changes, which should be approved by someone on the design team.
|
|
31
|
-
|
|
32
|
-
It is down to the developer to assess whether they think they require a design review, when they think this is needed, they should tag the Github handle of one of the designers on the Pull Request that has the changes.
|
|
33
|
-
|
|
34
|
-
The Pull Request should have enough information to indicate to the designer what has been changed, and what they should look at, if not a cheeky slack chat is always a good idea.
|
|
35
|
-
|
|
36
|
-
We use Netlify for branch deployments on Pull Requests. One of the Github statuses on the Pull Request will be "deploy/netlify - Deploy preview ready!". Here you can preview the changes made on that Pull Request.
|
|
37
|
-
|
|
38
|
-

|
|
39
|
-
|
|
40
|
-
## Component Guidance
|
|
41
|
-
|
|
42
|
-
Finding the balance of flexibility, scalability and usefulness is hard with Pattern Libraries. Components should remain useful in multiple contexts while also being ready to extend and scale as the design or usecases evolve.
|
|
43
|
-
|
|
44
|
-
**Style Guide Driven Development** - The Style Guide helps to document the contents of the Pattern Library for users and also acts as an isolated development environment. It should be possible to see all variations of a component to validate it's implementation and how it reacts to any changes made at a later date.
|
|
45
|
-
|
|
46
|
-
**The Open/Closed Principle** - Components should be _"Open for extension but Closed for modification"_. To help the pattern library scale, maintain and for components to remain reusable in as many contexts as possible, components should be built with API like CSS (using BEM) and should not reference a selector or override styles from another CSS module.
|
|
47
|
-
|
|
48
|
-
For example, "The Button inside the DatePicker should be bigger".
|
|
49
|
-
|
|
50
|
-
Instead of this...
|
|
51
|
-
|
|
52
|
-
```css
|
|
53
|
-
/* Button.css */
|
|
54
|
-
.Button { padding: 12px 16px; }
|
|
55
|
-
|
|
56
|
-
/* DatePicker.css */
|
|
57
|
-
.DatePicker .Button { padding: 16px 24px; }
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
... or this...
|
|
61
|
-
|
|
62
|
-
```jsx
|
|
63
|
-
<Button className="DatePickerButton">...</Button>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```css
|
|
67
|
-
.DatePickerButton {
|
|
68
|
-
padding: 16px 24px;
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
A better way would be
|
|
73
|
-
|
|
74
|
-
```css
|
|
75
|
-
/* Button.css */
|
|
76
|
-
.Button { }
|
|
77
|
-
.Button--size-small { padding: 12px 16px; }
|
|
78
|
-
.Button--size-large { padding: 16px 24px; }
|
|
79
|
-
```
|
package/FAQ.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
## FAQ
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#### "Why can't I pass in my own CSS classes to components?"
|
|
5
|
-
|
|
6
|
-
There are two types of components inside Bitkit, 'styled' components and 'utility' components. The utility components **do** support custom CSS classes. The styled components all provide styling from the design system. The components and their variations should remain available for everyone to use and should be predictable to changes that are made inside this library. For this reason, they do not allow custom CSS classes.
|
|
7
|
-
|
|
8
|
-
By allowing custom styling and classes to be added to these components, it would create random overriding variations that are not documented and react in unpredictable ways between releases. This is also why referencing the CSS selectors of Bitkit components is discouraged.
|
|
9
|
-
|
|
10
|
-
Even if this wasn't the case, some components might also have a slightly more complicated template structure and would require an API that allows CSS classes to be added to every node in the outputted template.
|
|
11
|
-
|
|
12
|
-
Some possible reasons for needing to do this -
|
|
13
|
-
|
|
14
|
-
• **Adding some layout styling to position the component** - A better way to achieve this would be to follow _["The Single Responsibility Principle"](https://cssguidelin.es/#the-single-responsibility-principle)_, and use wrapping layout components (like Flex).
|
|
15
|
-
|
|
16
|
-
• **Adding some visual styling to adjust the appearance of the component** - A better way to achieve this is either verify this is a needed style and contribute it as a variation extension to the current component API or adjust the design and use a variation that already exists.
|
|
17
|
-
|
|
18
|
-
• **It's a one off use case that is needed** - It's best to try and avoid these on offs where possible by adjusting the designs or environment that has caused the situation. If not there are the utility components like `Base`, `Flex`, `Grid` and `Text` that are general use components that all provide a lot of styling that might get you what you need and that also **do** support passing custom CSS classes.
|
|
19
|
-
|
package/bitrise.yml
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
format_version: '8'
|
|
3
|
-
default_step_lib_source: 'https://github.com/bitrise-io/bitrise-steplib.git'
|
|
4
|
-
project_type: other
|
|
5
|
-
trigger_map:
|
|
6
|
-
- push_branch: master
|
|
7
|
-
workflow: Master
|
|
8
|
-
- push_branch: 'alpha*'
|
|
9
|
-
workflow: AlphaBranch
|
|
10
|
-
- pull_request_source_branch: '*'
|
|
11
|
-
workflow: PullRequests
|
|
12
|
-
pull_request_target_branch: master
|
|
13
|
-
workflows:
|
|
14
|
-
AlphaBranch:
|
|
15
|
-
before_run:
|
|
16
|
-
- Primary
|
|
17
|
-
steps:
|
|
18
|
-
- yarn@0.1:
|
|
19
|
-
inputs:
|
|
20
|
-
- command: semantic-release
|
|
21
|
-
title: Publish from alpha branch (... if needed)
|
|
22
|
-
Master:
|
|
23
|
-
before_run:
|
|
24
|
-
- Primary
|
|
25
|
-
steps:
|
|
26
|
-
- yarn@0.0.8:
|
|
27
|
-
inputs:
|
|
28
|
-
- command: semantic-release
|
|
29
|
-
title: Publish (... if needed)
|
|
30
|
-
Primary:
|
|
31
|
-
steps:
|
|
32
|
-
- activate-ssh-key@4.1:
|
|
33
|
-
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
|
|
34
|
-
- git-clone@6.1: {}
|
|
35
|
-
- nvm@1.3: {}
|
|
36
|
-
- yarn@0.1:
|
|
37
|
-
title: Install Dependencies
|
|
38
|
-
- yarn@0.1:
|
|
39
|
-
title: Run Linting
|
|
40
|
-
inputs:
|
|
41
|
-
- command: lint
|
|
42
|
-
- yarn@0.1:
|
|
43
|
-
title: Run typechecking
|
|
44
|
-
inputs:
|
|
45
|
-
- command: tsc -p src --noEmit
|
|
46
|
-
- yarn@0.1:
|
|
47
|
-
inputs:
|
|
48
|
-
- command: test
|
|
49
|
-
title: Run Tests
|
|
50
|
-
PullRequests:
|
|
51
|
-
before_run:
|
|
52
|
-
- Primary
|
|
53
|
-
steps:
|
|
54
|
-
- script@1.1.5:
|
|
55
|
-
inputs:
|
|
56
|
-
- content: >
|
|
57
|
-
#!/bin/bash
|
|
58
|
-
|
|
59
|
-
set -ex
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# Check for malformed commit messages
|
|
63
|
-
|
|
64
|
-
git log --pretty=format:'%s' origin/master...$BITRISE_GIT_COMMIT |
|
|
65
|
-
yarn commitlint
|
|
66
|
-
title: Lint Commits
|
package/commitlint.config.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ['@commitlint/config-conventional'],
|
|
3
|
-
// https://commitlint.js.org/#/reference-rules
|
|
4
|
-
rules: {
|
|
5
|
-
'header-max-length': [0],
|
|
6
|
-
'scope-case': [2, 'always', ['lower-case', 'camel-case', 'pascal-case']],
|
|
7
|
-
'subject-case': [0],
|
|
8
|
-
'subject-full-stop': [0],
|
|
9
|
-
},
|
|
10
|
-
};
|
package/jest.setup.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const Enzyme = require('enzyme');
|
|
3
|
-
const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
|
|
4
|
-
const { JSDOM } = require('jsdom');
|
|
5
|
-
|
|
6
|
-
const jsdom = new JSDOM('<!doctype html><html><body></body></html>', {
|
|
7
|
-
url: 'http://localhost/',
|
|
8
|
-
});
|
|
9
|
-
const { window } = jsdom;
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
12
|
-
value: () => ({
|
|
13
|
-
matches: false,
|
|
14
|
-
addListener: () => {},
|
|
15
|
-
removeListener: () => {},
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
global.window = window;
|
|
20
|
-
global.document = window.document;
|
|
21
|
-
global.navigator = {
|
|
22
|
-
userAgent: 'node.js',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
global.requestAnimationFrame = (cb) => setTimeout(cb, 0);
|
|
26
|
-
global.cancelAnimationFrame = (id) => clearTimeout(id);
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
28
|
-
global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
|
|
29
|
-
global.window.cancelAnimationFrame = (id) => clearTimeout(id);
|
|
30
|
-
|
|
31
|
-
Object.defineProperties(global, {
|
|
32
|
-
...Object.getOwnPropertyDescriptors(window),
|
|
33
|
-
...Object.getOwnPropertyDescriptors(global),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
Enzyme.configure({ adapter: new Adapter() });
|
package/netlify.toml
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
[Settings]
|
|
2
|
-
[build]
|
|
3
|
-
[[headers]]
|
|
4
|
-
for = "*"
|
|
5
|
-
[headers.values]
|
|
6
|
-
Cache-Control = "no-cache, no-store, must-revalidate"
|
|
7
|
-
[[headers]]
|
|
8
|
-
for = "*.js"
|
|
9
|
-
[headers.values]
|
|
10
|
-
Cache-Control = "public, max-age=604800"
|
|
11
|
-
[[headers]]
|
|
12
|
-
for = "*.css"
|
|
13
|
-
[headers.values]
|
|
14
|
-
Cache-Control = "public, max-age=604800"
|
|
15
|
-
[[headers]]
|
|
16
|
-
for = "*.eot"
|
|
17
|
-
[headers.values]
|
|
18
|
-
Cache-Control = "public, max-age=604800"
|
|
19
|
-
[[headers]]
|
|
20
|
-
for = "*.png"
|
|
21
|
-
[headers.values]
|
|
22
|
-
Cache-Control = "public, max-age=604800"
|
|
23
|
-
[[headers]]
|
|
24
|
-
for = "*.svg"
|
|
25
|
-
[headers.values]
|
|
26
|
-
Cache-Control = "public, max-age=604800"
|
|
27
|
-
[[headers]]
|
|
28
|
-
for = "*.ttf"
|
|
29
|
-
[headers.values]
|
|
30
|
-
Cache-Control = "public, max-age=604800"
|
|
31
|
-
[[headers]]
|
|
32
|
-
for = "*.woff"
|
|
33
|
-
[headers.values]
|
|
34
|
-
Cache-Control = "public, max-age=604800"
|
|
35
|
-
[[headers]]
|
|
36
|
-
for = "*.woff2"
|
|
37
|
-
[headers.values]
|
|
38
|
-
Cache-Control = "public, max-age=604800"
|
|
39
|
-
[[redirects]]
|
|
40
|
-
from = "/*"
|
|
41
|
-
to = "/index.html"
|
|
42
|
-
status = 200
|
package/postcss.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const autoprefixer = require('autoprefixer');
|
|
3
|
-
const postcssPresetEnv = require('postcss-preset-env');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
plugins: [
|
|
7
|
-
autoprefixer(),
|
|
8
|
-
postcssPresetEnv({
|
|
9
|
-
stage: 3,
|
|
10
|
-
features: {
|
|
11
|
-
'custom-properties': false,
|
|
12
|
-
'nesting-rules': true,
|
|
13
|
-
},
|
|
14
|
-
}),
|
|
15
|
-
],
|
|
16
|
-
};
|
package/release.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
branches: ['master', { name: 'alpha', prerelease: true }, { name: 'alpha-*', prerelease: true }],
|
|
3
|
-
plugins: [
|
|
4
|
-
[
|
|
5
|
-
'@semantic-release/commit-analyzer',
|
|
6
|
-
{
|
|
7
|
-
releaseRules: [
|
|
8
|
-
{ breaking: true, release: 'major' },
|
|
9
|
-
{ type: 'feat', release: 'minor' },
|
|
10
|
-
{ type: 'fix', release: 'patch' },
|
|
11
|
-
{ type: 'perf', release: 'patch' },
|
|
12
|
-
{ type: 'style', release: 'patch' },
|
|
13
|
-
{ type: 'chore', release: 'patch' },
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
'@semantic-release/release-notes-generator',
|
|
18
|
-
'@semantic-release/npm',
|
|
19
|
-
'@semantic-release/github',
|
|
20
|
-
],
|
|
21
|
-
verifyConditions: ['@semantic-release/changelog', '@semantic-release/npm', '@semantic-release/git'],
|
|
22
|
-
prepare: [
|
|
23
|
-
'@semantic-release/changelog',
|
|
24
|
-
'@semantic-release/npm',
|
|
25
|
-
{
|
|
26
|
-
path: '@semantic-release/git',
|
|
27
|
-
assets: ['CHANGELOG.md'],
|
|
28
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
29
|
-
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
package/renovate.json
DELETED
package/scripts/build-docs.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import { parse, DocumentationObject } from 'react-docgen';
|
|
6
|
-
import ts from 'typescript';
|
|
7
|
-
|
|
8
|
-
const documentation: { [key: string]: DocumentationObject } = {};
|
|
9
|
-
const exportedComponents: { [key: string]: string } = {};
|
|
10
|
-
const indexFile = path.resolve(__dirname, '../src/index.ts');
|
|
11
|
-
const indexFileContent = fs.readFileSync(indexFile, 'utf8');
|
|
12
|
-
const indexSourceFile = ts.createSourceFile('index.ts', indexFileContent, ts.ScriptTarget.ES2015, true);
|
|
13
|
-
|
|
14
|
-
const exclude = ['Portal'];
|
|
15
|
-
|
|
16
|
-
const getExportedComponents = (node: ts.Node) => {
|
|
17
|
-
if (node.kind === ts.SyntaxKind.ExportDeclaration) {
|
|
18
|
-
const decl = node as ts.ExportDeclaration;
|
|
19
|
-
|
|
20
|
-
if (decl.exportClause) {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
const defaultExport = decl.exportClause.elements.find(
|
|
24
|
-
({ propertyName }: { propertyName: any }) => !!propertyName && propertyName.getText() === 'default',
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (decl.moduleSpecifier && defaultExport) {
|
|
28
|
-
exportedComponents[defaultExport.name.getText()] = (decl.moduleSpecifier as unknown as { text: string }).text;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
ts.forEachChild(node, (n) => getExportedComponents(n));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const buildDocs = () => {
|
|
37
|
-
getExportedComponents(indexSourceFile);
|
|
38
|
-
|
|
39
|
-
Object.entries(exportedComponents)
|
|
40
|
-
.filter(([exportName]) => !exclude.includes(exportName))
|
|
41
|
-
.forEach(([exportName, exportPath]) => {
|
|
42
|
-
try {
|
|
43
|
-
const filePath = path.resolve(__dirname, '../src', `${exportPath}.tsx`);
|
|
44
|
-
const fileContent = fs.readFileSync(filePath, 'utf8');
|
|
45
|
-
const parsedDocs = parse(fileContent);
|
|
46
|
-
|
|
47
|
-
documentation[exportName] = parsedDocs;
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.error(`${exportName}: ${exportPath}`);
|
|
50
|
-
console.error(e);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
fs.writeFileSync(path.resolve(__dirname, '../documentation.json'), JSON.stringify(documentation, null, 2));
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
buildDocs();
|
|
58
|
-
|
|
59
|
-
export default buildDocs;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
pre[class*='language-'] {
|
|
2
|
-
width: 100%;
|
|
3
|
-
color: var(--color-gray--1);
|
|
4
|
-
overflow: auto;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
pre[class*='language-'],
|
|
8
|
-
code[class*='language-'] {
|
|
9
|
-
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
10
|
-
font-size: var(--fontSizes-2);
|
|
11
|
-
text-align: left;
|
|
12
|
-
line-height: var(--lineHeights-2);
|
|
13
|
-
white-space: pre;
|
|
14
|
-
word-spacing: normal;
|
|
15
|
-
hyphens: none;
|
|
16
|
-
word-break: normal;
|
|
17
|
-
word-wrap: normal;
|
|
18
|
-
tab-size: 2;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* stylelint-disable selector-class-pattern, font-weight-notation */
|
|
22
|
-
.token.comment,
|
|
23
|
-
.token.prolog,
|
|
24
|
-
.token.doctype,
|
|
25
|
-
.token.cdata {
|
|
26
|
-
color: var(--color-gray--5);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.token.tag {
|
|
30
|
-
color: var(--color-red--1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.token.punctuation {
|
|
34
|
-
color: var(--color-gray--3);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.token.function,
|
|
38
|
-
.token.attr-name,
|
|
39
|
-
.token.selector {
|
|
40
|
-
color: var(--color-aqua--3);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.token.string {
|
|
44
|
-
color: var(--color-green--3);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.token.attr-value,
|
|
48
|
-
.token.boolean,
|
|
49
|
-
.token.keyword,
|
|
50
|
-
.token.number,
|
|
51
|
-
.token.property {
|
|
52
|
-
color: var(--color-grape--2);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.token.function {
|
|
56
|
-
color: var(--color-yellow--3);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/*
|
|
60
|
-
.token.regex,
|
|
61
|
-
.token.important,
|
|
62
|
-
.token.variable,
|
|
63
|
-
.token.atrule,
|
|
64
|
-
.token.char,
|
|
65
|
-
.token.builtin,
|
|
66
|
-
.token.inserted,,
|
|
67
|
-
.token.property,
|
|
68
|
-
.token.boolean,
|
|
69
|
-
.token.number,
|
|
70
|
-
.token.constant,
|
|
71
|
-
.token.symbol,
|
|
72
|
-
.token.deleted,
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
.token.important,
|
|
76
|
-
.token.bold {
|
|
77
|
-
font-weight: 700;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.token.italic {
|
|
81
|
-
font-style: italic;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.token.entity {
|
|
85
|
-
cursor: help;
|
|
86
|
-
}
|
|
87
|
-
/* stylelint-enable */
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as Prism from 'prismjs';
|
|
3
|
-
import { Base, FlexProps } from '@bitrise/bitkit';
|
|
4
|
-
import Window from '../Window/Window';
|
|
5
|
-
import 'prismjs/components/prism-jsx';
|
|
6
|
-
import './CodeBlock.css';
|
|
7
|
-
|
|
8
|
-
const { useEffect, useState } = React;
|
|
9
|
-
|
|
10
|
-
interface Props extends FlexProps {
|
|
11
|
-
children: string;
|
|
12
|
-
language?: 'css' | 'jsx';
|
|
13
|
-
title: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const CodeBlock: React.FunctionComponent<Props> = (props: Props) => {
|
|
17
|
-
const { children, language = 'jsx', title, ...rest } = props;
|
|
18
|
-
const [__html, setCode] = useState<string>('');
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
setCode(Prism.highlight(children || '', Prism.languages[language], language));
|
|
22
|
-
}, [children]);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Window {...rest} backgroundColor="grape-5" margin="x12" textColor="grape-1" title={title}>
|
|
26
|
-
<Base paddingHorizontal="x4" paddingVertical="x3">
|
|
27
|
-
<pre className={`language-${language}`}>
|
|
28
|
-
<code dangerouslySetInnerHTML={{ __html }} />
|
|
29
|
-
</pre>
|
|
30
|
-
</Base>
|
|
31
|
-
</Window>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default CodeBlock;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { match, Link as RouterLink, Redirect } from 'react-router-dom';
|
|
3
|
-
import { DocumentationObject, PropDescriptor } from 'react-docgen';
|
|
4
|
-
import { Base, Flex, FlexProps, Link, Notification, Text } from '@bitrise/bitkit';
|
|
5
|
-
import PropsTable from '../PropsTable/PropsTable';
|
|
6
|
-
|
|
7
|
-
interface Props extends FlexProps {
|
|
8
|
-
match: match<{
|
|
9
|
-
sectionName: string;
|
|
10
|
-
}>;
|
|
11
|
-
map: {
|
|
12
|
-
[key: string]: {
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
Showcase?: React.ComponentType<any>;
|
|
15
|
-
components: DocumentationObject[];
|
|
16
|
-
information?: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const filterProps = ([name, value]: [string, PropDescriptor]) =>
|
|
22
|
-
value.description !== '@Ignore' && name !== 'className' && name !== 'ref' && name !== 'style';
|
|
23
|
-
|
|
24
|
-
const ComponentDocumentation = (props: Props): JSX.Element => {
|
|
25
|
-
const {
|
|
26
|
-
match: { params },
|
|
27
|
-
map,
|
|
28
|
-
} = props;
|
|
29
|
-
const { sectionName } = params;
|
|
30
|
-
const key = Object.keys(map).find((k) => !!k.match(new RegExp(sectionName, 'i')));
|
|
31
|
-
|
|
32
|
-
if (!key || !map[key]) {
|
|
33
|
-
return <Redirect to="/components/404" />;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const { Showcase, components, information } = map[key];
|
|
37
|
-
const componentsFilteredProps = components.reduce((properties, component) => {
|
|
38
|
-
if (!component) {
|
|
39
|
-
return {
|
|
40
|
-
...properties,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
...properties,
|
|
45
|
-
[component.displayName]: Object.entries(component.props || {}).filter(filterProps),
|
|
46
|
-
};
|
|
47
|
-
}, {});
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Flex>
|
|
51
|
-
<Text margin="x6" size="8" weight="bold">
|
|
52
|
-
{key}
|
|
53
|
-
</Text>
|
|
54
|
-
|
|
55
|
-
{information && (
|
|
56
|
-
<Notification icon="Info" type="inform">
|
|
57
|
-
{information}
|
|
58
|
-
</Notification>
|
|
59
|
-
)}
|
|
60
|
-
|
|
61
|
-
<Base margin="x16">
|
|
62
|
-
<Text margin="x2" size="4" weight="bold">
|
|
63
|
-
Components summary
|
|
64
|
-
</Text>
|
|
65
|
-
|
|
66
|
-
{components.map((c) => {
|
|
67
|
-
if (!c) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const { description, displayName } = c;
|
|
71
|
-
return (
|
|
72
|
-
<Base key={displayName} margin="x4">
|
|
73
|
-
<Link Component={RouterLink} color="grape-3" to={`#${displayName}`}>
|
|
74
|
-
{displayName}
|
|
75
|
-
</Link>
|
|
76
|
-
{description && <Text size="2">{description}</Text>}
|
|
77
|
-
{!!componentsFilteredProps[displayName].length && (
|
|
78
|
-
<Text margin="x1" size="2">
|
|
79
|
-
Props:{' '}
|
|
80
|
-
{componentsFilteredProps[displayName].map(([propName], index, { length }) => (
|
|
81
|
-
<Link Component={RouterLink} color="gray-5" key={propName} to={`#${displayName}-${propName}`}>
|
|
82
|
-
{propName + (index + 1 === length ? '' : ' / ')}
|
|
83
|
-
</Link>
|
|
84
|
-
))}
|
|
85
|
-
</Text>
|
|
86
|
-
)}
|
|
87
|
-
</Base>
|
|
88
|
-
);
|
|
89
|
-
})}
|
|
90
|
-
</Base>
|
|
91
|
-
|
|
92
|
-
{Showcase && (
|
|
93
|
-
<Base margin="x16">
|
|
94
|
-
<Text margin="x2" size="4" weight="bold">
|
|
95
|
-
Showcase
|
|
96
|
-
</Text>
|
|
97
|
-
<Showcase />
|
|
98
|
-
</Base>
|
|
99
|
-
)}
|
|
100
|
-
|
|
101
|
-
<Base margin="x16">
|
|
102
|
-
<Text margin="x2" size="4" weight="bold">
|
|
103
|
-
Components API
|
|
104
|
-
</Text>
|
|
105
|
-
|
|
106
|
-
{components.map((c) => {
|
|
107
|
-
if (!c) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const { composes, description, displayName } = c;
|
|
111
|
-
return (
|
|
112
|
-
<Base id={displayName} key={displayName} margin="x8">
|
|
113
|
-
<Flex direction="horizontal">
|
|
114
|
-
<Flex grow initial="none">
|
|
115
|
-
<Text>{`<${displayName}>`}</Text>
|
|
116
|
-
{description && <Text size="2">{description}</Text>}
|
|
117
|
-
</Flex>
|
|
118
|
-
|
|
119
|
-
{composes && composes.length && (
|
|
120
|
-
<Flex>
|
|
121
|
-
<Text>
|
|
122
|
-
Extends:{' '}
|
|
123
|
-
{composes
|
|
124
|
-
.map((compose) => compose.replace('Props', ''))
|
|
125
|
-
.map((compose) => (
|
|
126
|
-
<Link key={compose} to={`/documentation/components/${compose}`}>{`<${compose}>`}</Link>
|
|
127
|
-
))}
|
|
128
|
-
</Text>
|
|
129
|
-
</Flex>
|
|
130
|
-
)}
|
|
131
|
-
</Flex>
|
|
132
|
-
|
|
133
|
-
<PropsTable
|
|
134
|
-
composes={composes}
|
|
135
|
-
displayName={displayName}
|
|
136
|
-
margin="x4"
|
|
137
|
-
props={componentsFilteredProps[displayName].reduce(
|
|
138
|
-
(props, [name, value]) => ({ ...props, [name]: value }),
|
|
139
|
-
{},
|
|
140
|
-
)}
|
|
141
|
-
/>
|
|
142
|
-
</Base>
|
|
143
|
-
);
|
|
144
|
-
})}
|
|
145
|
-
</Base>
|
|
146
|
-
</Flex>
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export default ComponentDocumentation;
|