aristid-ds 0.7.4 → 0.8.0
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/README.md +258 -140
- package/dist/Kit/DataDisplay/Avatar/types.d.ts +5 -4
- package/dist/Kit/DataDisplay/Badge/types.d.ts +5 -4
- package/dist/Kit/DataDisplay/Card/types.d.ts +0 -2
- package/dist/Kit/DataDisplay/ItemCard/types.d.ts +1 -1
- package/dist/Kit/DataDisplay/ItemList/types.d.ts +1 -0
- package/dist/Kit/{DataEntry → DataDisplay}/Tag/types.d.ts +6 -5
- package/dist/Kit/DataDisplay/Tour/index.d.ts +3 -0
- package/dist/Kit/DataDisplay/Tour/style.d.ts +3 -0
- package/dist/Kit/DataDisplay/Tour/types.d.ts +12 -0
- package/dist/Kit/DataDisplay/index.d.ts +2 -0
- package/dist/Kit/DataEntry/AutoComplete/index.d.ts +8 -4
- package/dist/Kit/DataEntry/AutoComplete/types.d.ts +2 -1
- package/dist/Kit/DataEntry/Checkbox/Checkbox.d.ts +2 -1
- package/dist/Kit/DataEntry/ColorPicker/index.d.ts +3 -0
- package/dist/Kit/DataEntry/ColorPicker/style.d.ts +41 -0
- package/dist/Kit/DataEntry/ColorPicker/types.d.ts +19 -0
- package/dist/Kit/DataEntry/DatePicker/DatePicker.d.ts +2 -3
- package/dist/Kit/DataEntry/DatePicker/RangePicker.d.ts +2 -2
- package/dist/Kit/DataEntry/DatePicker/types.d.ts +9 -1
- package/dist/Kit/DataEntry/Input/Input.d.ts +2 -1
- package/dist/Kit/DataEntry/Input/Password.d.ts +3 -2
- package/dist/Kit/DataEntry/Input/TextArea.d.ts +3 -2
- package/dist/Kit/DataEntry/Input/types.d.ts +4 -0
- package/dist/Kit/DataEntry/InputNumber/index.d.ts +2 -2
- package/dist/Kit/DataEntry/InputNumber/types.d.ts +1 -0
- package/dist/Kit/DataEntry/Radio/Radio.d.ts +2 -1
- package/dist/Kit/DataEntry/Rate/index.d.ts +3 -2
- package/dist/Kit/DataEntry/Rate/types.d.ts +8 -7
- package/dist/Kit/DataEntry/Select/index.d.ts +3 -2
- package/dist/Kit/DataEntry/Select/style.d.ts +1 -1
- package/dist/Kit/DataEntry/Select/types.d.ts +1 -0
- package/dist/Kit/DataEntry/Slider/index.d.ts +3 -2
- package/dist/Kit/DataEntry/Switch/index.d.ts +2 -2
- package/dist/Kit/DataEntry/Upload/Upload.d.ts +3 -2
- package/dist/Kit/DataEntry/index.d.ts +1 -1
- package/dist/Kit/General/Button/types.d.ts +4 -0
- package/dist/Kit/General/Icon/types.d.ts +5 -4
- package/dist/Kit/Navigation/Menu/types.d.ts +1 -0
- package/dist/hooks/useSecureClick/index.d.ts +2 -0
- package/dist/index.es.js +1026 -871
- package/dist/index.js +473 -356
- package/dist/theme/aristid/components/{DataEntry → DataDisplay}/Tag/index.d.ts +1 -1
- package/dist/theme/aristid/components/DataEntry/ColorPicker/index.d.ts +3 -0
- package/dist/theme/types/components/DataDisplay/Avatar/index.d.ts +0 -15
- package/dist/theme/types/components/DataDisplay/Badge/index.d.ts +0 -40
- package/dist/theme/types/components/DataDisplay/ItemList/index.d.ts +7 -0
- package/dist/theme/types/components/{DataEntry → DataDisplay}/Tag/index.d.ts +0 -31
- package/dist/theme/types/components/DataEntry/ColorPicker/index.d.ts +156 -0
- package/dist/theme/types/components/DataEntry/Rate/index.d.ts +0 -22
- package/dist/theme/types/components/DataEntry/Upload/index.d.ts +5 -0
- package/dist/theme/types/components/General/Button/index.d.ts +5 -1
- package/dist/theme/types/components/Navigation/Breadcrumb/index.d.ts +0 -9
- package/dist/theme/types/general/colors/index.d.ts +8 -9
- package/dist/theme/types/index.d.ts +3 -1
- package/dist/theme/utils/tokens-mapper/DataEntry/ColorPicker/index.d.ts +12 -0
- package/dist/theme/utils/tokens-mapper/DataEntry/Tag/index.d.ts +1 -1
- package/dist/theme/utils/tokens-mapper/DataEntry/index.d.ts +1 -0
- package/dist/translation/en-US/components/DataDisplay/Image/index.d.ts +2 -0
- package/dist/translation/fr-FR/components/DataDisplay/Image/index.d.ts +2 -0
- package/dist/translation/types/components/DataDisplay/Image/index.d.ts +3 -0
- package/dist/translation/types/index.d.ts +2 -0
- package/dist/utils/functions/index.d.ts +6 -0
- package/dist/utils/functions/types.d.ts +3 -0
- package/package.json +1 -1
- package/dist/icons/KitCalendarOutlined.d.ts +0 -4
- package/dist/icons/KitDeleteOutlined.d.ts +0 -4
- package/dist/icons/KitDownloadOutlined.d.ts +0 -4
- package/dist/icons/KitDropdownOutlined.d.ts +0 -4
- package/dist/icons/KitDropupOutlined.d.ts +0 -4
- package/dist/icons/KitEditOutlined.d.ts +0 -4
- package/dist/icons/KitHideOutlined.d.ts +0 -4
- package/dist/icons/KitInfoOutlined.d.ts +0 -4
- package/dist/icons/KitLessOutlined.d.ts +0 -4
- package/dist/icons/KitListOutlined.d.ts +0 -4
- package/dist/icons/KitLockOutlined.d.ts +0 -4
- package/dist/icons/KitLogoutOutlined.d.ts +0 -4
- package/dist/icons/KitPdfOutlined.d.ts +0 -4
- package/dist/icons/KitPlusOutlined.d.ts +0 -4
- package/dist/icons/KitRailroadOutlined.d.ts +0 -4
- package/dist/icons/KitShowOutlined.d.ts +0 -4
- package/dist/icons/KitWarningOutlined.d.ts +0 -4
- package/dist/icons/asn/KitCalendarOutlined.d.ts +0 -3
- package/dist/icons/asn/KitDeleteOutlined.d.ts +0 -3
- package/dist/icons/asn/KitDownloadOutlined.d.ts +0 -3
- package/dist/icons/asn/KitDropdownOutlined.d.ts +0 -3
- package/dist/icons/asn/KitDropupOutlined.d.ts +0 -3
- package/dist/icons/asn/KitEditOutlined.d.ts +0 -3
- package/dist/icons/asn/KitHideOutlined.d.ts +0 -3
- package/dist/icons/asn/KitInfoOutlined.d.ts +0 -3
- package/dist/icons/asn/KitLessOutlined.d.ts +0 -3
- package/dist/icons/asn/KitListOutlined.d.ts +0 -3
- package/dist/icons/asn/KitLockOutlined.d.ts +0 -3
- package/dist/icons/asn/KitLogoutOutlined.d.ts +0 -3
- package/dist/icons/asn/KitPdfOutlined.d.ts +0 -3
- package/dist/icons/asn/KitPlusOutlined.d.ts +0 -3
- package/dist/icons/asn/KitRailroadOutlined.d.ts +0 -3
- package/dist/icons/asn/KitShowOutlined.d.ts +0 -3
- package/dist/icons/asn/KitWarningOutlined.d.ts +0 -3
- package/dist/icons/index.d.ts +0 -17
- /package/dist/Kit/{DataEntry → DataDisplay}/Tag/Tag.d.ts +0 -0
- /package/dist/Kit/{DataEntry → DataDisplay}/Tag/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
<div align="center" className="header-block">
|
|
2
|
+
<img src="https://www.aristid.com/wp-content/uploads/2021/09/logo-aristid-bleu-2.png" height="100px" alt="Aristid logo" />
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
ARiSTiD Design System Readme.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[View Demo](https://storybook.aristid.com/?path=/docs/introduction-wip--docs)
|
|
8
|
-
·
|
|
9
|
-
[Report Bug](https://gitlab.aristid.com/dev/design-system/-/issuess)
|
|
10
|
-
·
|
|
11
|
-
[Request Feature](https://gitlab.aristid.com/dev/design-system/-/issues)
|
|
6
|
+
[Our Storybook](https://storybook.aristid.com/?path=/docs/design-icons--docs)
|
|
12
7
|
</div>
|
|
13
8
|
|
|
14
9
|
<hr>
|
|
@@ -16,21 +11,23 @@ ARiSTiD design system documentation.
|
|
|
16
11
|
<details open className="toc-block">
|
|
17
12
|
<summary>Table of Contents</summary>
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
- [Getting Started](#getting-started)
|
|
15
|
+
- [Prerequisites](#prerequisites)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Usage in a project](#usage-in-a-project)
|
|
18
|
+
- [Development](#development)
|
|
19
|
+
- [Code structure](#code-structure)
|
|
20
|
+
- [Creating a component](#creating-a-component)
|
|
21
|
+
- [Component code](#component-code)
|
|
22
|
+
- [Component theming](#component-theming)
|
|
23
|
+
- [Component documentation](#component-documentation)
|
|
24
|
+
- [Important](#important)
|
|
25
|
+
- [Contributing](#contributing)
|
|
26
|
+
- [Commit](#commit)
|
|
27
|
+
- [Gitflow](#gitflow)
|
|
28
|
+
- [Feature](#feature)
|
|
29
|
+
- [Release](#release)
|
|
30
|
+
- [Hotfix](#hotfix)
|
|
34
31
|
</details>
|
|
35
32
|
<hr>
|
|
36
33
|
|
|
@@ -83,20 +80,19 @@ yarn storybook
|
|
|
83
80
|
### Usage in a project
|
|
84
81
|
|
|
85
82
|
1. How To Import
|
|
86
|
-
|
|
87
83
|
```sh dark
|
|
88
84
|
yarn add aristid-ds
|
|
85
|
+
```
|
|
89
86
|
|
|
90
|
-
|
|
87
|
+
```sh dark
|
|
88
|
+
npm install aristid-ds
|
|
91
89
|
```
|
|
92
90
|
|
|
93
91
|
2. How to use KitApp
|
|
94
92
|
|
|
95
|
-
The **KitApp** is an essential context for the proper functioning of the **design system** components.
|
|
96
|
-
|
|
97
|
-
The kitApp is mainly used to supply the various components with **style** overloads. For the moment, the KitApp provide a default **Aristid Theme**. In the futur, it will be possible to customize every component with theme tokens.
|
|
93
|
+
The **KitApp** is an essential context for the proper functioning of the **design system** components. This context is mainly used to supply the various components with **style** and **translation** overloads.
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
By default KitApp provides **Aristid Theme** but you can override to customize every component with theme tokens.
|
|
100
96
|
|
|
101
97
|
```jsx dark
|
|
102
98
|
import {KitApp} from "aristid-ds";
|
|
@@ -106,7 +102,9 @@ import {KitApp} from "aristid-ds";
|
|
|
106
102
|
</KitApp>
|
|
107
103
|
```
|
|
108
104
|
|
|
109
|
-
|
|
105
|
+
> If you don't use KitApp, you'll get **missing styles / translation** and **errors** when using components.
|
|
106
|
+
|
|
107
|
+
1. Usage
|
|
110
108
|
|
|
111
109
|
All components are exported directly from 'aristid-ds' package.
|
|
112
110
|
|
|
@@ -114,10 +112,11 @@ All components are exported directly from 'aristid-ds' package.
|
|
|
114
112
|
import {KitButton, Kitcheckbox} from "aristid-ds";
|
|
115
113
|
```
|
|
116
114
|
|
|
115
|
+
4. Theme
|
|
116
|
+
You can override default theme by passing a theme configuration to the props `theme` of `KitApp`. All tokens are available in the documentation of each components in the section `Design Tokens`. Your theme configuration can be ease by using the **Theme Editor** available in the storybook. You can `edit` and `export` a **ready to use** configuration.
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
> Work in progress
|
|
118
|
+
5. Internationalization
|
|
119
|
+
You can override default translation by passing translation configuration to the props `locale`of the `KitApp`. Major part of tokens are override by antd [cf Antd translation documentation](https://ant.design/docs/react/i18n) and the other part is design system tokens. You can fin them in the section `Translation Tokens` of each components.
|
|
121
120
|
|
|
122
121
|
<br/>
|
|
123
122
|
|
|
@@ -125,24 +124,41 @@ import {KitButton, Kitcheckbox} from "aristid-ds";
|
|
|
125
124
|
|
|
126
125
|
### Code structure
|
|
127
126
|
|
|
127
|
+
<span style="float: right;"></span>
|
|
128
128
|
|
|
129
|
-
1. 📁 .storybook (💡 Configuration files of Storybook)
|
|
130
|
-
2. 📁 src (💡 Design system code)
|
|
131
|
-
- 📁 fonts
|
|
132
|
-
- 📁
|
|
133
|
-
-
|
|
129
|
+
1. 📁 .storybook <span style="float: right;">(💡 Configuration files of Storybook)</span>
|
|
130
|
+
2. 📁 src <span style="float: right;">(💡 Design system code folder)</span>
|
|
131
|
+
- 📁 fonts <span style="float: right;">(💡 Provided font)</span>
|
|
132
|
+
- 📁 hooks <span style="float: right;">(💡 Custom Hooks)</span>
|
|
133
|
+
- 📁 Kit <span style="float: right;">(💡 Components code)</span>
|
|
134
134
|
- 📁 App
|
|
135
135
|
- 📁 DataDisplay
|
|
136
136
|
- 📁 DataEntry
|
|
137
137
|
- 📁 Feedback
|
|
138
138
|
- 📁 General
|
|
139
139
|
- 📁 Layout
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
- index.tsx
|
|
141
|
+
- 📁 theme <span style="float: right;">(💡 Theming code)</span>
|
|
142
|
+
- 📁 aristid <span style="float: right;">(💡 Default theme use by `KitApp`)</span>
|
|
143
|
+
- 📁 types <span style="float: right;">(💡 Themes types declaration)</span>
|
|
144
|
+
- 📁 utils <span style="float: right;">(💡 All themes utils)</span>
|
|
145
|
+
- 📁 theme-builder <span style="float: right;">(💡 Use to build active theme)</span>
|
|
146
|
+
- 📁 tokens-mapper <span style="float: right;">(💡 Use to map our custom tokens with Antd tokens)</span>
|
|
147
|
+
- theme-context.tsx
|
|
148
|
+
- 📁 translation <span style="float: right;">(💡 Translation code)</span>
|
|
149
|
+
- 📁 en-US <span style="float: right;">(💡 `en-US` custom tokens)</span>
|
|
150
|
+
- 📁 fr-FR <span style="float: right;">(💡 `fr-FR` custom tokens)</span>
|
|
151
|
+
- 📁 types <span style="float: right;">(💡 Translation types declaration)</span>
|
|
152
|
+
- 📁 utils <span style="float: right;">(💡 All translation utils)</span>
|
|
153
|
+
- locale-context.tsx
|
|
154
|
+
- 📁 utils <span style="float: right;">(💡 All components utils)</span>
|
|
155
|
+
- 📁 functions <span style="float: right;">(💡 Function use in several components)</span>
|
|
156
|
+
- index.tsx
|
|
157
|
+
- vite-env.d.ts
|
|
158
|
+
3. 📁 stories <span style="float: right;">(💡 Storybook documentation)</span>
|
|
144
159
|
- 📁 01-Design
|
|
145
|
-
|
|
160
|
+
- themeEditor.mdx <span style="float: right;">(💡 Live theme editor page)</span>
|
|
161
|
+
- 📁 02-Design System <span style="float: right;">(💡 Components folder)</span>
|
|
146
162
|
- 📁 01-General
|
|
147
163
|
- 📁 02-Layout
|
|
148
164
|
- 📁 03-Navigation
|
|
@@ -151,6 +167,10 @@ import {KitButton, Kitcheckbox} from "aristid-ds";
|
|
|
151
167
|
- 📁 06-Feedback
|
|
152
168
|
- 📁 assets
|
|
153
169
|
- 📁 Root
|
|
170
|
+
- 📁 template
|
|
171
|
+
- index.tsx <span style="float: right;">(💡 Export all EditorTemplate for themeEditor.mdx)</span>
|
|
172
|
+
- tokens.tsx <span style="float: right;">(💡 Theme tokens generate by tokens-generator.js)</span>
|
|
173
|
+
- types.d.ts
|
|
154
174
|
<br/>
|
|
155
175
|
|
|
156
176
|
### Creating a component
|
|
@@ -170,7 +190,7 @@ touch index.tsx
|
|
|
170
190
|
touch types.d.ts
|
|
171
191
|
```
|
|
172
192
|
|
|
173
|
-
3.
|
|
193
|
+
3. Example of `Tooltip/index.tsx`
|
|
174
194
|
|
|
175
195
|
```tsx dark
|
|
176
196
|
import React from 'react';
|
|
@@ -184,7 +204,7 @@ export const KitTooltip: React.FunctionComponent<IKitTooltip> = tooltipProps =>
|
|
|
184
204
|
KitTooltip.displayName = 'KitTooltip';
|
|
185
205
|
```
|
|
186
206
|
|
|
187
|
-
4.
|
|
207
|
+
4. Example of `Tooltip/types.d.ts`
|
|
188
208
|
|
|
189
209
|
```tsx dark
|
|
190
210
|
import {TooltipProps} from 'antd';
|
|
@@ -205,124 +225,222 @@ export {KitTooltip};
|
|
|
205
225
|
|
|
206
226
|
<br/>
|
|
207
227
|
|
|
208
|
-
|
|
228
|
+
### Component theming
|
|
229
|
+
Every components **style** of the design system can be **override** by tokens.
|
|
209
230
|
|
|
210
|
-
1. Create a
|
|
231
|
+
1. **Create a token file type**
|
|
232
|
+
The `theme`folder is structure as same as the Kit folder.
|
|
233
|
+
<br/>
|
|
211
234
|
|
|
212
|
-
```sh dark
|
|
213
|
-
mkdir DESIGN-SYSTEM/
|
|
214
|
-
```
|
|
235
|
+
```sh dark
|
|
236
|
+
mkdir DESIGN-SYSTEM/src/theme/type/components/DataDisplay/tooltip
|
|
237
|
+
```
|
|
215
238
|
|
|
216
|
-
|
|
239
|
+
<br/>
|
|
240
|
+
In this file, you have all the tokens type definition. The tokens follow some rules you can find here [TODO]
|
|
217
241
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
touch Tooltip.stories.mdx
|
|
221
|
-
touch data.tsx
|
|
222
|
-
```
|
|
223
|
-
- Tooltip.stories.mdx : Contain all your documentation and exemples
|
|
224
|
-
- data.tsx : Used mainly for the API section (Args, Template, ...)
|
|
242
|
+
2. **Create a token file**
|
|
243
|
+
The token file is the definition of all tokens with their value. It exports a function that create the theme for the cmponent. You define this file in the `aristid` that is the default theme of the design system.
|
|
225
244
|
|
|
226
|
-
|
|
245
|
+
```sh dark
|
|
246
|
+
mkdir DESIGN-SYSTEM/src/theme/aristid/components/DataDisplay/tooltip
|
|
247
|
+
```
|
|
227
248
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
cd exemples
|
|
231
|
-
touch basic.tsx
|
|
232
|
-
touch index.tsx
|
|
233
|
-
```
|
|
234
|
-
- basic.tsx : Contain your exemple
|
|
235
|
-
- index.tsx : Used for export exemples and sources
|
|
249
|
+
3. **Global theme type**
|
|
250
|
+
After that, go to file `src/theme/type/index.tsx`to add your component type. This files contains all components that can be override.
|
|
236
251
|
|
|
237
|
-
4.
|
|
252
|
+
4. **Global theme**
|
|
253
|
+
You can now add your component in the `src/theme/aristid/index.tsx` and you add your component and the function that creates tokens defined in point 2.
|
|
238
254
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
import {KitTooltip} from '@aristid/design-system';
|
|
242
|
-
|
|
243
|
-
const App = () => {
|
|
244
|
-
return (
|
|
245
|
-
<KitTooltip title="Hey i'm a tooltip">
|
|
246
|
-
Tooltip will show on mouse enter.
|
|
247
|
-
</KitTooltip>
|
|
248
|
-
);
|
|
249
|
-
};
|
|
255
|
+
5. **Component Antd mapper**
|
|
256
|
+
As we use both `antd` and `design system` tokens, we normalize all token to follow a same model. If your component uses antd tokens, you have to add a mapper in the `src/theme/utils/tokens-mapper` folder. This folder as the same folder structure as the rest of the application.
|
|
250
257
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
<br/>
|
|
258
|
+
<br/>
|
|
259
|
+
Example of component mapper :
|
|
254
260
|
|
|
255
|
-
|
|
261
|
+
```tsx
|
|
262
|
+
// utils/tokens-mapper/DataDisplay/Tag
|
|
256
263
|
|
|
257
|
-
|
|
258
|
-
import Basic from './basic';
|
|
259
|
-
import BasicSource from './basic?raw';
|
|
264
|
+
import {IKitTagTheme} from '@theme/types/components/DataDisplay/Tag';
|
|
260
265
|
|
|
261
|
-
export const
|
|
262
|
-
|
|
263
|
-
};
|
|
266
|
+
export const mapTagKitTokenToAntdToken = (kitTagTheme: IKitTagTheme) => {
|
|
267
|
+
const {colors, border} = kitTagTheme;
|
|
264
268
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
return {
|
|
270
|
+
defaultBg: colors.default.background.default,
|
|
271
|
+
defaultColor: colors.default.typography.default,
|
|
272
|
+
borderRadiusSM: border.radius
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
```
|
|
269
276
|
|
|
270
|
-
|
|
277
|
+
6. **Global theme mapper**
|
|
278
|
+
After that, you have to add your component mapper to the global mapper in the file `src/theme/utils/tokens-mapper/index.tsx`.
|
|
271
279
|
|
|
272
|
-
|
|
280
|
+
7. **Theme consumption**
|
|
281
|
+
You can use the theme in your styled component by calling the hook `useKitTheme`. You can get the component theme by calling `theme.components.Tooltip`.
|
|
273
282
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
table: {
|
|
284
|
-
type: {
|
|
285
|
-
summary: 'ReactNode | () => ReactNode'
|
|
286
|
-
},
|
|
287
|
-
category: 'Tooltip'
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
...
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export const Template = ({component, ...args}) => {
|
|
294
|
-
return (
|
|
295
|
-
<KitTooltip {...args}>
|
|
296
|
-
Tooltip will show on mouse enter.
|
|
297
|
-
</KitTooltip>
|
|
298
|
-
);
|
|
299
|
-
};
|
|
300
|
-
```
|
|
283
|
+
</br>
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
const {theme} = useKitTheme();
|
|
287
|
+
|
|
288
|
+
const tooltipTheme = theme.components.Tooltip;
|
|
289
|
+
|
|
290
|
+
return <KitTooltip $theme={tooltipTheme} />;
|
|
291
|
+
```
|
|
301
292
|
|
|
302
293
|
<br/>
|
|
303
294
|
|
|
304
|
-
|
|
295
|
+
#### Component documentation
|
|
305
296
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
297
|
+
1. **Copy - Paste the template folder (stories/template)**
|
|
298
|
+
This folder contains all required files to create component documentation.
|
|
299
|
+
- `examples` : contains all the code of examples, index.tsx export all examples in the convenient format.
|
|
300
|
+
- `data.tsx`: contains the API data (Args, Template, ...)
|
|
301
|
+
- `Component.mdx` : file that contains the component documentation (usage / examples / api / tokens)
|
|
302
|
+
- `Component.stories.tsx` : file use by storybook as a story to test and display.
|
|
310
303
|
|
|
311
|
-
|
|
312
|
-
title="Design System/DataDisplay/Tooltip"
|
|
313
|
-
argTypes={TooltipArgTypes}
|
|
314
|
-
/>
|
|
304
|
+
</br>
|
|
315
305
|
|
|
316
|
-
|
|
306
|
+
2. **Implement examples**
|
|
307
|
+
Create all examples needed in the documentation.
|
|
317
308
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
309
|
+
```tsx
|
|
310
|
+
// basic.tsx
|
|
311
|
+
import React from 'react';
|
|
321
312
|
|
|
322
|
-
|
|
323
|
-
|
|
313
|
+
const App = () => {
|
|
314
|
+
return (
|
|
315
|
+
<KitTooltip title"this is an example">
|
|
316
|
+
<div>Template Example</div>
|
|
317
|
+
</KitTooltip>
|
|
318
|
+
);
|
|
319
|
+
};
|
|
324
320
|
|
|
325
|
-
|
|
321
|
+
export default App;
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
</br>
|
|
325
|
+
|
|
326
|
+
3. **Export examples**
|
|
327
|
+
You have to export all of your examples in the index.tsx of the examples folder. It permits to export all files in the convenient format to be read by the custom canvas component.
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
import Basic from './basic';
|
|
331
|
+
|
|
332
|
+
import BasicSource from './basic?raw';
|
|
333
|
+
|
|
334
|
+
export const Sources = {
|
|
335
|
+
Basic: BasicSource
|
|
336
|
+
};
|
|
337
|
+
export default {
|
|
338
|
+
Basic
|
|
339
|
+
};
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
</br>
|
|
343
|
+
|
|
344
|
+
4. **Modify Component.mdx**
|
|
345
|
+
- Rename Component in the file name by your component name (ex : Tooltip.mdx).
|
|
346
|
+
- Rename Component in the file by your component name.
|
|
347
|
+
- Complete all examples you want to display in documentation.
|
|
348
|
+
|
|
349
|
+
```tsx
|
|
350
|
+
// Tooltip.mdx
|
|
351
|
+
import { Meta, Story, Canvas } from "@storybook/addon-docs";
|
|
352
|
+
import { Controls } from "@storybook/addon-docs";
|
|
353
|
+
import { argTypes, Template } from "./data";
|
|
354
|
+
import Examples, { Sources } from './examples';
|
|
355
|
+
import CustomCanvas from '../../../../.storybook/components/CustomCanvas.jsx';
|
|
356
|
+
import DesignTokens from '../../.storybook/components/DesignTokens';
|
|
357
|
+
import fields from '../tokens';
|
|
358
|
+
import * as Tooltip from './Tooltip.stories';
|
|
359
|
+
|
|
360
|
+
<Meta of={Tooltip} />
|
|
361
|
+
|
|
362
|
+
# Tooltip
|
|
363
|
+
|
|
364
|
+
Brief component description.
|
|
365
|
+
|
|
366
|
+
## Examples
|
|
367
|
+
|
|
368
|
+
##### Basic
|
|
369
|
+
Example description
|
|
370
|
+
|
|
371
|
+
<CustomCanvas content={Examples.Basic} source={Sources.Basic} id="tooltip-basic"/>
|
|
372
|
+
|
|
373
|
+
## Api
|
|
374
|
+
|
|
375
|
+
<Canvas of={Tooltip.Api} />
|
|
376
|
+
|
|
377
|
+
<Controls of={Tooltip.Api} />
|
|
378
|
+
|
|
379
|
+
## Design Tokens
|
|
380
|
+
|
|
381
|
+
<DesignTokens path="components.Tooltip" tokens={fields?.components?.Tooltip} />
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
</br>
|
|
385
|
+
|
|
386
|
+
5. **Modify Component.stories.tsx**
|
|
387
|
+
- Rename Component in the file name by your component name (ex : Tooltip.stories.tsx).
|
|
388
|
+
- Rename the meta object title attribute by the pass of the component (ex : title: 'Design System/DataDisplay/Tooltip'). The path specify where the component will be placed in the storybook.
|
|
389
|
+
- Replace KitComponent by your component (ex KitTooltip).
|
|
390
|
+
|
|
391
|
+
</br>
|
|
392
|
+
|
|
393
|
+
```tsx
|
|
394
|
+
// Tooltip.stories.tsx
|
|
395
|
+
import type {Meta, StoryObj} from '@storybook/react';
|
|
396
|
+
import {KitTooltip} from '@components/DataDisplay';
|
|
397
|
+
import {argTypes, Template} from './data';
|
|
398
|
+
|
|
399
|
+
const meta: Meta<typeof KitTooltip> = {
|
|
400
|
+
component: KitTooltip,
|
|
401
|
+
title: 'Design System/DataDisplay/Tooltip',
|
|
402
|
+
argTypes: argTypes
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export default meta;
|
|
406
|
+
type Story = StoryObj<typeof KitTooltip>;
|
|
407
|
+
|
|
408
|
+
export const Api: Story = {
|
|
409
|
+
render: Template
|
|
410
|
+
};
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
6. **Import Component Theme Editor Template**
|
|
414
|
+
In the `data.tsx` file, you defined a `EditorTemplate`. It permits to modify in live all tokens and get a preview of the component. You have to import this Editor in the `stories/index.tsx`and add it inside the object that contains all theme editor that already exist.
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
import {EditorTemplate as Tooltip} from './02-Design System/05-DataDisplay/Tooltip/data';
|
|
418
|
+
|
|
419
|
+
export default {
|
|
420
|
+
...
|
|
421
|
+
DataDisplay: {
|
|
422
|
+
...
|
|
423
|
+
Tooltip
|
|
424
|
+
...
|
|
425
|
+
}
|
|
426
|
+
...
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
7. **Design tokens generation**
|
|
432
|
+
When everything is setup, you have to run the tokens-generator script to generate all design tokens in the documentation.
|
|
433
|
+
|
|
434
|
+
```sh
|
|
435
|
+
node tokens-generator.js
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
After the script run, section `Design Tokens` documentation is up to date with all design tokens.
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
## Important
|
|
443
|
+
Every import of antd library should pass by `antd` or `/lib/antd`. `es` import will lead to issues in the build process.
|
|
326
444
|
|
|
327
445
|
## Contributing
|
|
328
446
|
|
|
@@ -338,7 +456,7 @@ git commit -m "type[(component)] : message"
|
|
|
338
456
|
|
|
339
457
|
The type is telling us what change or iteration is being made. We have the following types:
|
|
340
458
|
|
|
341
|
-
| Type | Description |
|
|
459
|
+
| Type | Description | Example |
|
|
342
460
|
|---|---|---|
|
|
343
461
|
| test | indicates any type of creation or alteration of test codes | Creation of unit tests |
|
|
344
462
|
| feat | indicates the development of a new feature for the project. | Adding a service, functionality, endpoint, etc |
|
|
@@ -353,7 +471,7 @@ The type is telling us what change or iteration is being made. We have the follo
|
|
|
353
471
|
| revert | indicates the reversal of a previous commit |
|
|
354
472
|
|
|
355
473
|
|
|
356
|
-
|
|
474
|
+
Example :
|
|
357
475
|
|
|
358
476
|
```sh
|
|
359
477
|
git commit -m "style(Tooltip) : Change color on hover"
|
|
@@ -3,19 +3,20 @@ import {GroupProps} from 'antd/lib/avatar';
|
|
|
3
3
|
import {KitHTMLAttributes} from '../../../types';
|
|
4
4
|
import {IKitAvatarTheme} from '@theme/types/components/DataDisplay/Avatar';
|
|
5
5
|
import {FunctionComponent} from 'react';
|
|
6
|
+
import {KitColorProp} from '@utils/functions/types';
|
|
6
7
|
|
|
7
8
|
type AntdAvatarTypesToOmit = '';
|
|
8
9
|
type AntdAvatarGroupTypesToOmit = 'maxStyle';
|
|
9
10
|
|
|
10
|
-
export type KitAvatarColorType = 'default' | 'blueInvert' | string;
|
|
11
|
-
|
|
12
11
|
export interface IKitAvatar extends Omit<AvatarProps, AntdAvatarTypesToOmit>, KitHTMLAttributes<HTMLSpanElement> {
|
|
13
|
-
color?:
|
|
12
|
+
color?: KitColorProp;
|
|
13
|
+
secondaryColorInvert?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface IStyledKitAvatar {
|
|
17
17
|
$theme: IKitAvatarTheme;
|
|
18
|
-
$
|
|
18
|
+
$iconColor: string;
|
|
19
|
+
$backgroundColor: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export interface IKitAvatarGroup
|
|
@@ -2,17 +2,18 @@ import {BadgeProps} from 'antd';
|
|
|
2
2
|
import {KitHTMLAttributes} from '../../../types';
|
|
3
3
|
import {IKitBadgeTheme} from '@theme/types/components/DataDisplay/Badge';
|
|
4
4
|
import {IKitTypography} from '@theme/types/general/typography';
|
|
5
|
+
import {KitColorProp} from '@utils/functions/types';
|
|
5
6
|
|
|
6
7
|
type AntdBadgeTypesToOmit = 'color' | 'size' | 'offset' | 'text';
|
|
7
8
|
|
|
8
|
-
export type KitBadgeCountColor = 'default' | 'green' | 'blue' | 'blueInvert' | 'gray';
|
|
9
|
-
|
|
10
9
|
export interface IKitBadge extends Omit<BadgeProps, AntdBadgeTypesToOmit>, KitHTMLAttributes<HTMLDivElement> {
|
|
11
|
-
|
|
10
|
+
color?: KitColorProp;
|
|
11
|
+
secondaryColorInvert?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface IStyledKitBadge {
|
|
15
15
|
$theme: IKitBadgeTheme;
|
|
16
16
|
$typographyTheme: IKitTypography;
|
|
17
|
-
$
|
|
17
|
+
$backgroundColor: string;
|
|
18
|
+
$fontColor: string;
|
|
18
19
|
}
|
|
@@ -17,7 +17,6 @@ export default interface IKitCard extends Omit<CardProps, AntdCardTypesToOmit> {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
contentTitle?: string;
|
|
19
19
|
contentDescription?: string;
|
|
20
|
-
sideSpacing?: boolean;
|
|
21
20
|
separator?: boolean;
|
|
22
21
|
onContentTitleClick?: () => void;
|
|
23
22
|
}
|
|
@@ -25,7 +24,6 @@ export default interface IKitCard extends Omit<CardProps, AntdCardTypesToOmit> {
|
|
|
25
24
|
export interface IStyledKitCard {
|
|
26
25
|
$theme: IKitCardTheme;
|
|
27
26
|
$disabled: boolean;
|
|
28
|
-
$sideSpacing: boolean;
|
|
29
27
|
$separator: boolean;
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {KitHTMLAttributes} from '../../../types';
|
|
2
|
-
import {IKitTag} from '
|
|
2
|
+
import {IKitTag} from '../Tag/types';
|
|
3
3
|
import {ReactNode, MouseEvent} from 'react';
|
|
4
4
|
import {CheckboxChangeEvent} from 'antd/lib/checkbox';
|
|
5
5
|
import {IKitItemCardTheme} from '@theme/types/components/DataDisplay/ItemCard';
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {TagProps} from 'antd';
|
|
2
2
|
import {KitHTMLAttributes} from '../../../types';
|
|
3
3
|
import {ReactNode} from 'react';
|
|
4
|
-
import {IKitTagTheme} from '@theme/types/components/
|
|
4
|
+
import {IKitTagTheme} from '@theme/types/components/DataDisplay/Tag';
|
|
5
|
+
import {KitColorProp} from '@utils/functions/types';
|
|
5
6
|
|
|
6
7
|
export type AntdTagPropsToOmit = 'color' | 'checkableTag' | 'icon' | 'closable';
|
|
7
8
|
|
|
8
|
-
export type KitTagColor = 'red' | 'green' | 'blue' | 'blueInvert' | 'default';
|
|
9
|
-
|
|
10
9
|
export interface IKitTag extends Omit<TagProps, AntdTagPropsToOmit>, KitHTMLAttributes<HTMLSpanElement> {
|
|
11
|
-
color?:
|
|
10
|
+
color?: KitColorProp;
|
|
11
|
+
secondaryColorInvert?: boolean;
|
|
12
12
|
children?: ReactNode[] | ReactNode;
|
|
13
13
|
onClose?: TagProps['onClose'];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface IStyledAntdTag {
|
|
17
17
|
$theme: IKitTagTheme;
|
|
18
|
-
$color
|
|
18
|
+
$color?: string;
|
|
19
|
+
$backgroundColor?: string;
|
|
19
20
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {IKitThemeGeneral} from '@theme/types';
|
|
2
|
+
import {IKitButtonTheme} from '@theme/types/components/General/Button';
|
|
3
|
+
import {TourProps} from 'antd';
|
|
4
|
+
|
|
5
|
+
type AntdTourTypesToOmit = '';
|
|
6
|
+
|
|
7
|
+
export interface IKitTour extends Omit<TourProps, AntdTourTypesToOmit> {}
|
|
8
|
+
|
|
9
|
+
export interface IStyledAntdTour {
|
|
10
|
+
$buttonTheme: IKitButtonTheme;
|
|
11
|
+
$generalTheme: IKitThemeGeneral;
|
|
12
|
+
}
|