@spaced-out/ui-design-system 0.0.3-beta.1 → 0.0.4
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/.all-contributorsrc +36 -0
- package/.cspell/custom-words.txt +5 -0
- package/.eslintignore +2 -1
- package/.github/pull_request_template.md +17 -0
- package/.prettierrc +27 -11
- package/.storybook/preview.js +3 -1
- package/.storybook/public/images/contributions.png +0 -0
- package/.storybook/public/images/intro-cover.png +0 -0
- package/.storybook/public/images/usage.png +0 -0
- package/.vscode/settings.json +7 -0
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +161 -0
- package/README.md +87 -129
- package/cspell.json +4 -1
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/Tooltip.js.flow +23 -8
- package/package.json +7 -5
- package/pull_request_template.md +0 -48
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectName": "ui-design-system",
|
|
3
|
+
"projectOwner": "Spaced-Out",
|
|
4
|
+
"repoType": "github",
|
|
5
|
+
"repoHost": "https://github.com",
|
|
6
|
+
"files": [
|
|
7
|
+
"README.md",
|
|
8
|
+
"src/stories/INTRODUCTION.stories.mdx"
|
|
9
|
+
],
|
|
10
|
+
"imageSize": 100,
|
|
11
|
+
"commit": false,
|
|
12
|
+
"commitConvention": "react",
|
|
13
|
+
"contributors": [
|
|
14
|
+
{
|
|
15
|
+
"login": "superrover",
|
|
16
|
+
"name": "Nishant Gaurav",
|
|
17
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/86281150?v=4",
|
|
18
|
+
"profile": "https://github.com/superrover",
|
|
19
|
+
"contributions": [
|
|
20
|
+
"code",
|
|
21
|
+
"doc"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"login": "Anant-Raj",
|
|
26
|
+
"name": "Anant Raj",
|
|
27
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/8904071?v=4",
|
|
28
|
+
"profile": "https://github.com/Anant-Raj",
|
|
29
|
+
"contributions": [
|
|
30
|
+
"code",
|
|
31
|
+
"doc"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"contributorsPerLine": 7
|
|
36
|
+
}
|
package/.cspell/custom-words.txt
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
atleast
|
|
2
2
|
circlehollow
|
|
3
3
|
commitlint
|
|
4
|
+
contributorsrc
|
|
5
|
+
Crespo
|
|
4
6
|
DEFAULTTEXT
|
|
5
7
|
dismissable
|
|
6
8
|
Fennimore
|
|
@@ -10,12 +12,15 @@ Gaurav
|
|
|
10
12
|
Lipsey
|
|
11
13
|
Neue
|
|
12
14
|
Nishant
|
|
15
|
+
OPACITYS
|
|
13
16
|
partialformat
|
|
14
17
|
premajor
|
|
15
18
|
preminor
|
|
16
19
|
prepatch
|
|
17
20
|
rgba
|
|
18
21
|
sbdocs
|
|
22
|
+
Stapleton
|
|
23
|
+
superrover
|
|
19
24
|
testid
|
|
20
25
|
tnum
|
|
21
26
|
transclude
|
package/.eslintignore
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
/src/assets/fontawesome/
|
|
1
|
+
/src/assets/fontawesome/
|
|
2
|
+
node_modules/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
### Description of changes
|
|
2
|
+
<!--- Describe your changes in detail -->
|
|
3
|
+
|
|
4
|
+
### Design Specs(Add a link to Spec sheet)
|
|
5
|
+
<!--- Add a link to design specs -->
|
|
6
|
+
|
|
7
|
+
### Screenshots(if appropriate)
|
|
8
|
+
|
|
9
|
+
### Does this close any currently open issues?
|
|
10
|
+
|
|
11
|
+
### Breaking changes(Describe if any)
|
|
12
|
+
|
|
13
|
+
### Checklist:
|
|
14
|
+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
|
15
|
+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
|
16
|
+
- [ ] Merged with latest `master` branch
|
|
17
|
+
- [ ] I have updated the documentation accordingly.
|
package/.prettierrc
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"trailingComma": "all",
|
|
4
|
+
"printWidth": 80,
|
|
5
|
+
"tabWidth": 2,
|
|
6
|
+
"bracketSpacing": false,
|
|
7
|
+
"endOfLine": "lf",
|
|
8
|
+
"overrides": [
|
|
9
|
+
{
|
|
10
|
+
"files": [
|
|
11
|
+
"*.js",
|
|
12
|
+
"*.jsx"
|
|
13
|
+
],
|
|
14
|
+
"options": {
|
|
15
|
+
"parser": "babel-flow"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"files": [
|
|
20
|
+
"*.css"
|
|
21
|
+
],
|
|
22
|
+
"options": {
|
|
23
|
+
"parser": "css"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
package/.storybook/preview.js
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### 0.0.4 (2022-11-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* pr template ([#35](https://github.com/Spaced-Out/ui-design-system/issues/35)) ([c18e112](https://github.com/Spaced-Out/ui-design-system/commit/c18e1123730acaad77e1334a949573ac0cfd3708))
|
|
11
|
+
|
|
12
|
+
### 0.0.3 (2022-11-22)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* added new storybook pages ([2844a5e](https://github.com/Spaced-Out/ui-design-system/commit/2844a5e90cfa479268374bc8bfd4f46bc8458149))
|
|
18
|
+
|
|
5
19
|
### 0.0.3-beta.1 (2022-11-21)
|
|
6
20
|
|
|
7
21
|
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Contribution Guidelines
|
|
4
|
+
|
|
5
|
+
Genesis Design System is created using:
|
|
6
|
+
|
|
7
|
+
- [Gulp](https://gulpjs.com/)
|
|
8
|
+
- [CSS Modules](https://github.com/css-modules/css-modules)
|
|
9
|
+
- [React](https://reactjs.org/)
|
|
10
|
+
|
|
11
|
+
It also features:
|
|
12
|
+
|
|
13
|
+
- [Style-Dictionary](https://www.style-dictionary-play.dev/) to help you create and style variables
|
|
14
|
+
- [Storybook](https://storybook.js.org/) to help you create and show off your components
|
|
15
|
+
- [Standard Version](https://github.com/conventional-changelog/standard-version) to manage changelog across releases
|
|
16
|
+
|
|
17
|
+
## Development
|
|
18
|
+
|
|
19
|
+
<br/>
|
|
20
|
+
|
|
21
|
+
### Environment Setup
|
|
22
|
+
|
|
23
|
+
- Clone the repository on Github.
|
|
24
|
+
|
|
25
|
+
- Run the environment locally:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
#clone repository
|
|
29
|
+
git clone git@github.com:Spaced-Out/ui-design-system.git
|
|
30
|
+
|
|
31
|
+
#change directory to the cloned repository
|
|
32
|
+
cd ui-design-system
|
|
33
|
+
|
|
34
|
+
#create new branch
|
|
35
|
+
git checkout -b [BRANCH_NAME]
|
|
36
|
+
|
|
37
|
+
#install dependencies
|
|
38
|
+
yarn install
|
|
39
|
+
|
|
40
|
+
#start development server
|
|
41
|
+
yarn storybook
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> The `storybook` server runs on port **6006** and url is opened automatically on successful dev build.
|
|
45
|
+
|
|
46
|
+
### Generating New Components
|
|
47
|
+
|
|
48
|
+
We've included a handy NodeJS util file under `scripts` called `create-component.js`. Instead of copy pasting components to create a new component,
|
|
49
|
+
you can instead run this command to generate all the files you need to start building out a new component. To use it:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
yarn generate YourComponentName
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> This will generate:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
/src
|
|
59
|
+
/components
|
|
60
|
+
/YourComponentName
|
|
61
|
+
YourComponentName.jsx
|
|
62
|
+
YourComponentName.stories.jsx
|
|
63
|
+
YourComponentName.module.css
|
|
64
|
+
YourComponentName.stories.module.css
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
> The default templates for each file can be modified under `scripts/templates`.
|
|
68
|
+
|
|
69
|
+
### Exports
|
|
70
|
+
|
|
71
|
+
Export Component as named export and Component Props/Types e.g. export Modal from `./src/components/Modal/index.js`.
|
|
72
|
+
|
|
73
|
+
### Imports
|
|
74
|
+
|
|
75
|
+
We use a third party plugin to sort out imports. We use
|
|
76
|
+
[eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort#sort-order)
|
|
77
|
+
|
|
78
|
+
### Adding Stories
|
|
79
|
+
|
|
80
|
+
A [story](https://storybook.js.org/docs/react/get-started/whats-a-story) captures the rendered state of a UI component. You can write multiple stories
|
|
81
|
+
per component. A component story must have `.stories.jsx` extension.
|
|
82
|
+
|
|
83
|
+
### Using Design Tokens
|
|
84
|
+
|
|
85
|
+
Check out our [**Design Tokens Page**](https://spaced-out.github.io/ui-design-system/?path=/docs/design-tokens--page) to use tokens.
|
|
86
|
+
|
|
87
|
+
### Testing Genesis Design System Locally
|
|
88
|
+
|
|
89
|
+
> In the `ui_design_system` directory's run:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
yarn build
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> In the `consumer's` directory's run:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
yarn add @spaced-out/ui-design-system@file:../../ui-design-system
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> This would copy the genesis design system package to node modules locally and create an entry in the `consumer's` package.json
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
...
|
|
105
|
+
"dependencies": {
|
|
106
|
+
...
|
|
107
|
+
"@spaced-out/ui-design-system": "file:../../ui_design_system",
|
|
108
|
+
...
|
|
109
|
+
},
|
|
110
|
+
...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
which will install the local genesis design system library as a dependency in `consumer`.
|
|
114
|
+
|
|
115
|
+
For every change in `ui_design_system` that you want to propagate to `consumer` run:
|
|
116
|
+
|
|
117
|
+
> in `ui_design_system`
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
yarn build
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
> in `consumer`
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
yarn upgrade @spaced-out/ui-design-system@file:../../ui-design-system
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Commits
|
|
130
|
+
|
|
131
|
+
Each commit should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines
|
|
132
|
+
|
|
133
|
+
Most commonly used commit prefixes:
|
|
134
|
+
|
|
135
|
+
> `fix:` a commit of the type fix patches a bug in your codebase (this correlates with [PATCH](https://semver.org/#summary) in Semantic Versioning)
|
|
136
|
+
|
|
137
|
+
> `feat:` a commit of the type feat introduces a new feature to the codebase (this correlates with [MINOR](https://semver.org/#summary) in Semantic Versioning)
|
|
138
|
+
|
|
139
|
+
> `refactor:` Commits, that rewrite/restructure your code, however does not change any behavior
|
|
140
|
+
|
|
141
|
+
> `style:` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc)
|
|
142
|
+
|
|
143
|
+
> `docs:` Commits, that affect documentation only
|
|
144
|
+
|
|
145
|
+
> `build:` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, etc.
|
|
146
|
+
|
|
147
|
+
## Add yourself to the maintainer list
|
|
148
|
+
|
|
149
|
+
To add yourself to the `maintainers` table in the README and INTRODUCTION stories:
|
|
150
|
+
|
|
151
|
+
> Run the following commands from the root of the repo:
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
./node_modules/.bin/all-contributors add <username> <contribution>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> Then, you'll need to generate the updated `all-contributors` table by running
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
./node_modules/.bin/all-contributors generate
|
|
161
|
+
```
|
package/README.md
CHANGED
|
@@ -1,167 +1,125 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Genesis Design System
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Genesis design system consists of a set of tools and protocols that unify design and development across surfaces (platforms) to deliver consistent
|
|
6
|
+
user experiences. The system utilizes workflow automation to streamline the design and development process. It's comprised of a number of React
|
|
7
|
+
web components that each play a unique role within the product development cycle.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The integration of these components are intended to grow and scale overtime to increasingly decrease workflow friction and optimize the product
|
|
10
|
+
development lifecycle.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
- [Storybook](https://storybook.js.org/) to help you create and show off your components
|
|
13
|
-
- [Standard Version](https://github.com/conventional-changelog/standard-version) to manage changelog across releases
|
|
14
|
-
|
|
15
|
-
### Commits
|
|
16
|
-
|
|
17
|
-
Each commit should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines
|
|
18
|
-
|
|
19
|
-
Most commonly used commit prefixes:
|
|
20
|
-
|
|
21
|
-
`fix:` a commit of the type fix patches a bug in your codebase (this correlates with [PATCH](https://semver.org/#summary) in Semantic Versioning)
|
|
22
|
-
|
|
23
|
-
`feat:` a commit of the type feat introduces a new feature to the codebase (this correlates with [MINOR](https://semver.org/#summary) in Semantic Versioning)
|
|
24
|
-
|
|
25
|
-
`refactor:` Commits, that rewrite/restructure your code, however does not change any behavior
|
|
26
|
-
|
|
27
|
-
`style:` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc)
|
|
28
|
-
|
|
29
|
-
`docs:` Commits, that affect documentation only
|
|
30
|
-
|
|
31
|
-
`build:` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, etc.
|
|
32
|
-
|
|
33
|
-
### Building
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
yarn build
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
To Build the style variables using style-dictionary run
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
yarn build:style-variables
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
It would put all the style variables created inside the styles folder. Our yarn build hook would essentially copy these variables to the build output target.
|
|
46
|
-
|
|
47
|
-
### Storybook
|
|
48
|
-
|
|
49
|
-
To run a live-reload Storybook server on your local machine:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
yarn storybook
|
|
53
|
-
```
|
|
12
|
+
## Usage
|
|
54
13
|
|
|
55
|
-
To
|
|
14
|
+
To install `@spaced-out/ui-design-system` in your project, you will need to run the
|
|
15
|
+
following command using [yarn](https://yarnpkg.com/):
|
|
56
16
|
|
|
57
|
-
```
|
|
58
|
-
yarn
|
|
17
|
+
```bash
|
|
18
|
+
yarn add @spaced-out/ui-design-system
|
|
59
19
|
```
|
|
60
20
|
|
|
61
|
-
|
|
21
|
+
Usage of the component (after the library installed as a dependency in project) will be:
|
|
62
22
|
|
|
63
|
-
|
|
23
|
+
```js
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import {Button} from '@spaced-out/ui-design-system/lib/components/Button';
|
|
64
26
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
This will generate:
|
|
27
|
+
const App = () => (
|
|
28
|
+
<div className="app-container">
|
|
29
|
+
<Button>Hello world</Button>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
72
32
|
|
|
73
|
-
|
|
74
|
-
/src
|
|
75
|
-
/components
|
|
76
|
-
/YourComponentName
|
|
77
|
-
YourComponentName.jsx
|
|
78
|
-
YourComponentName.stories.jsx
|
|
79
|
-
YourComponentName.module.css
|
|
80
|
-
YourComponentName.stories.module.css
|
|
33
|
+
export default App;
|
|
81
34
|
```
|
|
82
35
|
|
|
83
|
-
|
|
36
|
+
For more information about each component, check out
|
|
37
|
+
[Storybook](https://spaced-out.github.io/ui-design-system).
|
|
84
38
|
|
|
85
|
-
|
|
39
|
+
**→ Fonts**
|
|
86
40
|
|
|
87
|
-
|
|
41
|
+
By default Genesis uses `'Centra No 2'` font. To add this font in your project you need to load this font. The recommended way to do it is by adding the following in your global css.
|
|
88
42
|
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
43
|
+
```css
|
|
44
|
+
@font-face {
|
|
45
|
+
font-family: 'Centra No 2';
|
|
46
|
+
src: url('https://s3.us-west-2.amazonaws.com/assets.sensehq.com/type/CentraNo2-Book.woff2')
|
|
47
|
+
format('woff2'), url('https://s3.us-west-2.amazonaws.com/assets.sensehq.com/type/CentraNo2-Book.woff')
|
|
48
|
+
format('woff');
|
|
49
|
+
font-weight: 300 400;
|
|
50
|
+
font-style: normal;
|
|
51
|
+
font-display: auto;
|
|
52
|
+
}
|
|
92
53
|
|
|
93
|
-
|
|
54
|
+
@font-face {
|
|
55
|
+
font-family: 'Centra No 2';
|
|
56
|
+
src: url('https://s3.us-west-2.amazonaws.com/assets.sensehq.com/type/CentraNo2-BookItalic.woff2')
|
|
57
|
+
format('woff2'), url('https://s3.us-west-2.amazonaws.com/assets.sensehq.com/type/CentraNo2-BookItalic.woff')
|
|
58
|
+
format('woff');
|
|
59
|
+
font-weight: 300 400;
|
|
60
|
+
font-style: italic;
|
|
61
|
+
font-display: auto;
|
|
62
|
+
}
|
|
94
63
|
|
|
95
|
-
|
|
96
|
-
|
|
64
|
+
@font-face {
|
|
65
|
+
font-family: 'Centra No 2';
|
|
66
|
+
src: url('https://s3.us-west-2.amazonaws.com/assets.sensehq.com/type/CentraNo2-Medium.woff2')
|
|
67
|
+
format('woff2'), url('https://s3.us-west-2.amazonaws.com/assets.sensehq.com/type/CentraNo2-Medium.woff')
|
|
68
|
+
format('woff');
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
font-style: normal;
|
|
71
|
+
font-display: auto;
|
|
72
|
+
}
|
|
97
73
|
```
|
|
98
74
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
...
|
|
103
|
-
"dependencies": {
|
|
104
|
-
...
|
|
105
|
-
"@spaced-out/ui-design-system": "file:../../ui_design_system",
|
|
106
|
-
...
|
|
107
|
-
},
|
|
108
|
-
...
|
|
109
|
-
```
|
|
75
|
+
**→ Using Genesis Design Tokens**
|
|
110
76
|
|
|
111
|
-
|
|
77
|
+
Design tokens are exported as `.css` and `.js`. You can consume them easily by
|
|
112
78
|
|
|
113
|
-
|
|
79
|
+
CSS use:
|
|
114
80
|
|
|
115
|
-
|
|
81
|
+
```js
|
|
82
|
+
@value (size2) from '@spaced-out/ui-design-system/lib/styles/variables/_size.css';
|
|
116
83
|
|
|
117
|
-
|
|
118
|
-
|
|
84
|
+
.example-container {
|
|
85
|
+
height: size2
|
|
86
|
+
}
|
|
119
87
|
```
|
|
120
88
|
|
|
121
|
-
|
|
89
|
+
JS use:
|
|
122
90
|
|
|
91
|
+
```js
|
|
92
|
+
import size2 from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
93
|
+
import * as SIZES from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
123
94
|
```
|
|
124
|
-
yarn upgrade @spaced-out/ui-design-system@file:../../ui-design-system
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Usage
|
|
128
|
-
|
|
129
|
-
Let's say you created a public NPM package called `@spaced-out/ui-design-system` with the `Button` component created in this repository.
|
|
130
95
|
|
|
131
|
-
|
|
96
|
+
## Documentation
|
|
132
97
|
|
|
133
|
-
|
|
134
|
-
import React from "react";
|
|
135
|
-
import { Button } from "@spaced-out/ui-design-system/lib/components/Button";
|
|
98
|
+
- [Storybook](https://spaced-out.github.io/ui-design-system)
|
|
136
99
|
|
|
137
|
-
|
|
138
|
-
<div className="app-container">
|
|
139
|
-
<h1>Hello I'm consuming the component library</h1>
|
|
140
|
-
<Button>Hello world</Button>
|
|
141
|
-
</div>
|
|
142
|
-
);
|
|
100
|
+
## Contributions
|
|
143
101
|
|
|
144
|
-
|
|
145
|
-
```
|
|
102
|
+
Check out our [**Contribution Guide**](https://spaced-out.github.io/ui-design-system/?path=/docs/contribution--page) to setup and contribute to Genesis.
|
|
146
103
|
|
|
147
|
-
|
|
104
|
+
## Changelog
|
|
148
105
|
|
|
149
|
-
|
|
106
|
+
Check out our [**Changelog here**](https://spaced-out.github.io/ui-design-system/?path=/docs/changelog--page)
|
|
150
107
|
|
|
151
|
-
|
|
108
|
+
## Maintainers ✨
|
|
152
109
|
|
|
153
|
-
|
|
154
|
-
|
|
110
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
111
|
+
<!-- prettier-ignore-start -->
|
|
112
|
+
<!-- markdownlint-disable -->
|
|
113
|
+
<table>
|
|
114
|
+
<tbody>
|
|
115
|
+
<tr>
|
|
116
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/superrover"><img src="https://avatars.githubusercontent.com/u/86281150?v=4?s=100" width="100px;" alt="Nishant Gaurav"/><br /><sub><b>Nishant Gaurav</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=superrover" title="Code">💻</a> <a href="https://github.com/Spaced-Out/ui-design-system/commits?author=superrover" title="Documentation">📖</a></td>
|
|
117
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Anant-Raj"><img src="https://avatars.githubusercontent.com/u/8904071?v=4?s=100" width="100px;" alt="Anant Raj"/><br /><sub><b>Anant Raj</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=Anant-Raj" title="Code">💻</a> <a href="https://github.com/Spaced-Out/ui-design-system/commits?author=Anant-Raj" title="Documentation">📖</a></td>
|
|
118
|
+
</tr>
|
|
119
|
+
</tbody>
|
|
120
|
+
</table>
|
|
155
121
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
JS use:
|
|
122
|
+
<!-- markdownlint-restore -->
|
|
123
|
+
<!-- prettier-ignore-end -->
|
|
162
124
|
|
|
163
|
-
|
|
164
|
-
import size2 from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
165
|
-
import * as SIZES from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
166
|
-
|
|
167
|
-
```
|
|
125
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
package/cspell.json
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
"storybook-static",
|
|
8
8
|
".vscode",
|
|
9
9
|
"CHANGELOG.md",
|
|
10
|
-
".storybook/public"
|
|
10
|
+
".storybook/public",
|
|
11
|
+
".all-contributorsrc",
|
|
12
|
+
"README.md",
|
|
13
|
+
"src/stories/INTRODUCTION.stories.mdx"
|
|
11
14
|
],
|
|
12
15
|
// Enable your dictionary by adding it to the list of `dictionaries`
|
|
13
16
|
"dictionaries": ["custom-words"],
|
|
@@ -22,7 +22,9 @@ const Tooltip = _ref => {
|
|
|
22
22
|
children,
|
|
23
23
|
title,
|
|
24
24
|
body,
|
|
25
|
-
placement = 'top'
|
|
25
|
+
placement = 'top',
|
|
26
|
+
bodyMaxLines = 2,
|
|
27
|
+
titleMaxLines = 1
|
|
26
28
|
} = _ref;
|
|
27
29
|
const [open, setOpen] = React.useState(false);
|
|
28
30
|
const {
|
|
@@ -53,7 +55,7 @@ const Tooltip = _ref => {
|
|
|
53
55
|
...children.props
|
|
54
56
|
})), open && /*#__PURE__*/React.createElement("div", _extends({
|
|
55
57
|
ref: floating,
|
|
56
|
-
className: (0, _classify.classify)(_TooltipModule.default.tooltip, classNames?.
|
|
58
|
+
className: (0, _classify.classify)(_TooltipModule.default.tooltip, classNames?.tooltip),
|
|
57
59
|
style: {
|
|
58
60
|
position: strategy,
|
|
59
61
|
top: y ?? _space.spaceNone,
|
|
@@ -62,11 +64,11 @@ const Tooltip = _ref => {
|
|
|
62
64
|
}, getFloatingProps()), !!title && /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
|
|
63
65
|
color: "inversePrimary"
|
|
64
66
|
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
65
|
-
line:
|
|
67
|
+
line: titleMaxLines
|
|
66
68
|
}, title)), !!body && /*#__PURE__*/React.createElement(_Text.BodyMedium, {
|
|
67
69
|
color: !title ? 'inversePrimary' : 'inverseSecondary'
|
|
68
70
|
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
69
|
-
line:
|
|
71
|
+
line: bodyMaxLines
|
|
70
72
|
}, body))));
|
|
71
73
|
};
|
|
72
74
|
exports.Tooltip = Tooltip;
|
|
@@ -33,13 +33,23 @@ import {Truncate} from '../Truncate';
|
|
|
33
33
|
import css from './Tooltip.module.css';
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
type ClassNames = $ReadOnly<{
|
|
36
|
+
type ClassNames = $ReadOnly<{tooltip?: string}>;
|
|
37
37
|
|
|
38
38
|
export type TooltipProps = {
|
|
39
39
|
classNames?: ClassNames,
|
|
40
|
-
title?: string,
|
|
41
|
-
body?: string,
|
|
42
|
-
placement?:
|
|
40
|
+
title?: string | React.Node,
|
|
41
|
+
body?: string | React.Node,
|
|
42
|
+
placement?:
|
|
43
|
+
| 'top'
|
|
44
|
+
| 'top-start'
|
|
45
|
+
| 'top-end'
|
|
46
|
+
| 'bottom'
|
|
47
|
+
| 'bottom-start'
|
|
48
|
+
| 'bottom-end'
|
|
49
|
+
| 'left'
|
|
50
|
+
| 'right',
|
|
51
|
+
bodyMaxLines?: number,
|
|
52
|
+
titleMaxLines?: number,
|
|
43
53
|
// TODO(Nishant): Decide on a type to use
|
|
44
54
|
// $FlowFixMe
|
|
45
55
|
children: any,
|
|
@@ -51,6 +61,8 @@ export const Tooltip = ({
|
|
|
51
61
|
title,
|
|
52
62
|
body,
|
|
53
63
|
placement = 'top',
|
|
64
|
+
bodyMaxLines = 2,
|
|
65
|
+
titleMaxLines = 1,
|
|
54
66
|
}: TooltipProps): React.Node => {
|
|
55
67
|
const [open, setOpen] = React.useState(false);
|
|
56
68
|
|
|
@@ -79,12 +91,15 @@ export const Tooltip = ({
|
|
|
79
91
|
<>
|
|
80
92
|
{React.cloneElement(
|
|
81
93
|
children,
|
|
82
|
-
getReferenceProps({
|
|
94
|
+
getReferenceProps({
|
|
95
|
+
ref,
|
|
96
|
+
...children.props,
|
|
97
|
+
}),
|
|
83
98
|
)}
|
|
84
99
|
{open && (
|
|
85
100
|
<div
|
|
86
101
|
ref={floating}
|
|
87
|
-
className={classify(css.tooltip, classNames?.
|
|
102
|
+
className={classify(css.tooltip, classNames?.tooltip)}
|
|
88
103
|
style={{
|
|
89
104
|
position: strategy,
|
|
90
105
|
top: y ?? spaceNone,
|
|
@@ -94,13 +109,13 @@ export const Tooltip = ({
|
|
|
94
109
|
>
|
|
95
110
|
{!!title && (
|
|
96
111
|
<SubTitleExtraSmall color="inversePrimary">
|
|
97
|
-
<Truncate line={
|
|
112
|
+
<Truncate line={titleMaxLines}>{title}</Truncate>
|
|
98
113
|
</SubTitleExtraSmall>
|
|
99
114
|
)}
|
|
100
115
|
|
|
101
116
|
{!!body && (
|
|
102
117
|
<BodyMedium color={!title ? 'inversePrimary' : 'inverseSecondary'}>
|
|
103
|
-
<Truncate line={
|
|
118
|
+
<Truncate line={bodyMaxLines}>{body}</Truncate>
|
|
104
119
|
</BodyMedium>
|
|
105
120
|
)}
|
|
106
121
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spaced-out/ui-design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Sense UI components library",
|
|
6
6
|
"author": {
|
|
@@ -32,9 +32,10 @@
|
|
|
32
32
|
"React",
|
|
33
33
|
"Component",
|
|
34
34
|
"Library",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
35
|
+
"Design System",
|
|
36
|
+
"Genesis",
|
|
37
|
+
"Spaced Out",
|
|
38
|
+
"Sense"
|
|
38
39
|
],
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"react": ">=16.8.0",
|
|
@@ -100,7 +101,8 @@
|
|
|
100
101
|
"standard-version": "^9.5.0",
|
|
101
102
|
"storybook-css-modules": "^1.0.8",
|
|
102
103
|
"storybook-vscode-component": "^1.0.8",
|
|
103
|
-
"style-dictionary": "^3.7.1"
|
|
104
|
+
"style-dictionary": "^3.7.1",
|
|
105
|
+
"all-contributors-cli": "^6.20.0"
|
|
104
106
|
},
|
|
105
107
|
"husky": {
|
|
106
108
|
"hooks": {
|
package/pull_request_template.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
* **Please check if the PR fulfills these requirements**
|
|
2
|
-
- [ ] The commit message follows our guidelines
|
|
3
|
-
- [ ] Tests for the changes have been added (for bug fixes / features)
|
|
4
|
-
- [ ] Docs have been added / updated (for bug fixes / features)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* **Other information**:
|
|
8
|
-
|
|
9
|
-
### All Submissions:
|
|
10
|
-
|
|
11
|
-
* [ ] Have you followed the guidelines in our Contributing document?
|
|
12
|
-
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?
|
|
13
|
-
|
|
14
|
-
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Types of changes
|
|
18
|
-
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
|
19
|
-
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
20
|
-
- [ ] New feature (non-breaking change which adds functionality)
|
|
21
|
-
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
22
|
-
|
|
23
|
-
<!--- Provide a general summary of your changes in the Title above -->
|
|
24
|
-
|
|
25
|
-
## Description
|
|
26
|
-
<!--- Describe your changes in detail -->
|
|
27
|
-
|
|
28
|
-
## Design Specs
|
|
29
|
-
<!--- Add a link to design specs -->
|
|
30
|
-
|
|
31
|
-
## Motivation and Context
|
|
32
|
-
<!--- Why is this change required? What problem does it solve? -->
|
|
33
|
-
<!--- If it fixes an open issue, please link to the issue here. -->
|
|
34
|
-
|
|
35
|
-
## How has this been tested?
|
|
36
|
-
<!--- Please describe in detail how you tested your changes. -->
|
|
37
|
-
<!--- Include details of your testing environment, tests ran to see how -->
|
|
38
|
-
<!--- your change affects other areas of the code, etc. -->
|
|
39
|
-
|
|
40
|
-
## Screenshots (if appropriate):
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Checklist:
|
|
44
|
-
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
|
45
|
-
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
|
46
|
-
- [ ] My code follows the code style of this project.
|
|
47
|
-
- [ ] My change requires a change to the documentation.
|
|
48
|
-
- [ ] I have updated the documentation accordingly.
|