pentatrion-design 0.0.1 → 0.0.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/README.md +146 -15
- package/dist/index.d.ts +353 -294
- package/dist/index.js +2962 -2210
- package/index.ts +38 -0
- package/package.json +40 -37
- package/.storybook/main.ts +0 -33
- package/.storybook/manager.ts +0 -8
- package/.storybook/preview-head.html +0 -2
- package/.storybook/preview.ts +0 -26
- package/.storybook/public/bg-map.jpg +0 -0
- package/.storybook/public/favicon-32x32.png +0 -0
- package/.storybook/public/favicon.svg +0 -28
- package/.storybook/public/movies.json +0 -2153
- package/.storybook/public/population.json +0 -1178
- package/.storybook/public/town-74.geojson +0 -8995
- package/.storybook/public/town-74.json +0 -4062
- package/.storybook/theme.ts +0 -14
- package/Makefile +0 -14
- package/TODO.md +0 -5
- package/dist/redux/index.d.ts +0 -43
- package/dist/redux/index.js +0 -583
- package/dist/types.d-DlHa_IaW.d.ts +0 -14
- package/images/logo-shadow.svg +0 -173
- package/images/logo.svg +0 -76
- package/postcss.config.js +0 -7
- package/src/components/autocomplete/Autocomplete.stories.tsx +0 -89
- package/src/components/autocomplete/Autocomplete.tsx +0 -316
- package/src/components/autocomplete/AutocompleteOption.tsx +0 -35
- package/src/components/autocomplete/LazyAutocomplete.tsx +0 -130
- package/src/components/autocomplete/SimpleAutocomplete.tsx +0 -74
- package/src/components/autocomplete/index.ts +0 -6
- package/src/components/autocomplete/useAutocompleteContext.ts +0 -20
- package/src/components/autocomplete/util.ts +0 -19
- package/src/components/badge/Badge.stories.tsx +0 -72
- package/src/components/badge/Badge.tsx +0 -70
- package/src/components/button/Button.stories.tsx +0 -189
- package/src/components/button/Button.test.tsx +0 -20
- package/src/components/button/Button.tsx +0 -200
- package/src/components/button/ButtonGroup.stories.tsx +0 -46
- package/src/components/button/ButtonGroup.tsx +0 -29
- package/src/components/button/index.ts +0 -2
- package/src/components/card/Card.stories.tsx +0 -21
- package/src/components/card/config.ts +0 -4
- package/src/components/card/index.ts +0 -1
- package/src/components/code/Code.tsx +0 -15
- package/src/components/context-menu/ContextMenu.stories.tsx +0 -22
- package/src/components/context-menu/ContextMenu.tsx +0 -175
- package/src/components/context-menu/ContextMenuItem.tsx +0 -34
- package/src/components/context-menu/index.ts +0 -2
- package/src/components/dialog/Dialog.stories.tsx +0 -270
- package/src/components/dialog/Dialog.tsx +0 -46
- package/src/components/dialog/index.ts +0 -1
- package/src/components/dialog/util.ts +0 -29
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +0 -19
- package/src/components/dropdown-menu/DropdownMenu.tsx +0 -12
- package/src/components/dropdown-menu/DropdownMenuContent.tsx +0 -46
- package/src/components/dropdown-menu/DropdownMenuItem.tsx +0 -33
- package/src/components/dropdown-menu/DropdownMenuTrigger.tsx +0 -42
- package/src/components/dropdown-menu/index.ts +0 -7
- package/src/components/dropdown-menu/interface.d.ts +0 -13
- package/src/components/dropdown-menu/useDropdownMenu.tsx +0 -115
- package/src/components/dropdown-menu/useDropdownMenuContext.ts +0 -16
- package/src/components/dropdown-menu-nested/DropdownMenuNested.stories.tsx +0 -33
- package/src/components/dropdown-menu-nested/DropdownMenuNested.tsx +0 -19
- package/src/components/dropdown-menu-nested/MenuContext.ts +0 -15
- package/src/components/dropdown-menu-nested/MenuItem.tsx +0 -43
- package/src/components/dropdown-menu-nested/MenuItemWithChildren.tsx +0 -204
- package/src/components/dropdown-menu-nested/index.ts +0 -3
- package/src/components/flash/Flash.stories.tsx +0 -34
- package/src/components/flash/Flash.tsx +0 -24
- package/src/components/highlight/Highlight.stories.tsx +0 -128
- package/src/components/highlight/Highlight.tsx +0 -29
- package/src/components/href/Href.stories.tsx +0 -55
- package/src/components/href/Href.tsx +0 -18
- package/src/components/input/Checkbox.stories.tsx +0 -52
- package/src/components/input/Checkbox.tsx +0 -41
- package/src/components/input/Input.stories.tsx +0 -103
- package/src/components/input/Input.test.tsx +0 -10
- package/src/components/input/Input.tsx +0 -60
- package/src/components/input/RadioGroup.stories.tsx +0 -76
- package/src/components/input/RadioGroup.tsx +0 -84
- package/src/components/input/Toggle.stories.tsx +0 -29
- package/src/components/input/Toggle.tsx +0 -35
- package/src/components/input/index.ts +0 -4
- package/src/components/input-field/InputField.stories.tsx +0 -227
- package/src/components/input-field/InputField.tsx +0 -62
- package/src/components/loader/Loader.stories.tsx +0 -37
- package/src/components/loader/Loader.tsx +0 -54
- package/src/components/modal/Components.tsx +0 -58
- package/src/components/modal/Modal.stories.tsx +0 -113
- package/src/components/modal/Modal.tsx +0 -13
- package/src/components/modal/ModalContent.tsx +0 -46
- package/src/components/modal/ModalTrigger.tsx +0 -41
- package/src/components/modal/index.ts +0 -7
- package/src/components/modal/interface.d.ts +0 -10
- package/src/components/modal/useModal.ts +0 -48
- package/src/components/modal/useModalContext.ts +0 -16
- package/src/components/notification/Notification.stories.tsx +0 -51
- package/src/components/notification/NotificationsContext.ts +0 -79
- package/src/components/notification/NotificationsProvider.tsx +0 -58
- package/src/components/notification/index.ts +0 -2
- package/src/components/popover/Components.tsx +0 -45
- package/src/components/popover/Popover.stories.tsx +0 -46
- package/src/components/popover/Popover.test.tsx +0 -21
- package/src/components/popover/Popover.tsx +0 -12
- package/src/components/popover/PopoverContent.tsx +0 -46
- package/src/components/popover/PopoverTrigger.tsx +0 -42
- package/src/components/popover/index.ts +0 -7
- package/src/components/popover/interface.d.ts +0 -13
- package/src/components/popover/usePopover.tsx +0 -80
- package/src/components/popover/usePopoverContext.ts +0 -16
- package/src/components/portal/Portal.tsx +0 -12
- package/src/components/quick-settings/QuickSettings.stories.tsx +0 -182
- package/src/components/resize-area/ResizeArea.stories.css +0 -40
- package/src/components/resize-area/ResizeArea.stories.tsx +0 -30
- package/src/components/resize-area/ResizeArea.tsx +0 -79
- package/src/components/scroll/Scroll.stories.tsx +0 -81
- package/src/components/scroll/Scroll.tsx +0 -111
- package/src/components/select/Select.stories.tsx +0 -248
- package/src/components/select/Select.tsx +0 -362
- package/src/components/select/SelectOption.tsx +0 -29
- package/src/components/select/SelectSelection.tsx +0 -13
- package/src/components/select/index.ts +0 -5
- package/src/components/select/interface.d.ts +0 -36
- package/src/components/select/useSelectContext.ts +0 -19
- package/src/components/select/util.ts +0 -12
- package/src/components/snack/Snack.stories.tsx +0 -33
- package/src/components/snack/Snack.tsx +0 -47
- package/src/components/sortable/Sortable.stories.tsx +0 -98
- package/src/components/sortable/Sortable.tsx +0 -37
- package/src/components/sortable/index.ts +0 -2
- package/src/components/sortable/types.d.ts +0 -12
- package/src/components/steps/Step.tsx +0 -41
- package/src/components/steps/Steps.stories.tsx +0 -141
- package/src/components/steps/Steps.tsx +0 -49
- package/src/components/steps/index.ts +0 -3
- package/src/components/steps/util.ts +0 -3
- package/src/components/table/Table.stories.tsx +0 -36
- package/src/components/table/Table.tsx +0 -13
- package/src/components/table/TableBody.tsx +0 -9
- package/src/components/table/TableCell.tsx +0 -16
- package/src/components/table/TableFooter.tsx +0 -9
- package/src/components/table/TableHeader.tsx +0 -14
- package/src/components/table/TableHeaderCell.tsx +0 -14
- package/src/components/table/TableRow.tsx +0 -14
- package/src/components/table/index.ts +0 -7
- package/src/components/tabs/Tabs.stories.tsx +0 -66
- package/src/components/tabs/Tabs.tsx +0 -80
- package/src/components/tooltip/SimpleTooltip.tsx +0 -17
- package/src/components/tooltip/Tooltip.stories.tsx +0 -129
- package/src/components/tooltip/Tooltip.test.tsx +0 -18
- package/src/components/tooltip/Tooltip.tsx +0 -13
- package/src/components/tooltip/TooltipContent.tsx +0 -41
- package/src/components/tooltip/TooltipTrigger.tsx +0 -36
- package/src/components/tooltip/index.ts +0 -6
- package/src/components/tooltip/interface.d.ts +0 -15
- package/src/components/tooltip/useTooltip.ts +0 -87
- package/src/components/tooltip/useTooltipContext.ts +0 -16
- package/src/env.d.ts +0 -27
- package/src/hooks/index.ts +0 -13
- package/src/hooks/useCombinedRefs.test.tsx +0 -42
- package/src/hooks/useCombinedRefs.ts +0 -21
- package/src/hooks/useCopyToClipboard.ts +0 -28
- package/src/hooks/useDebounce.ts +0 -59
- package/src/hooks/useEventCallback.ts +0 -13
- package/src/hooks/useEventListener.ts +0 -86
- package/src/hooks/useFetch.tsx +0 -21
- package/src/hooks/useIsClosing.ts +0 -25
- package/src/hooks/useIsMounted.tsx +0 -16
- package/src/hooks/useIsomorphicLayoutEffect.ts +0 -4
- package/src/hooks/useNotifications.tsx +0 -13
- package/src/hooks/useOnClickOutside.ts +0 -35
- package/src/hooks/usePrevious.ts +0 -9
- package/src/hooks/useRipple.test.tsx +0 -52
- package/src/hooks/useRipple.tsx +0 -79
- package/src/index.css +0 -14
- package/src/index.ts +0 -39
- package/src/lib/arrUtil.ts +0 -8
- package/src/lib/error.ts +0 -18
- package/src/lib/fetch.test.ts +0 -107
- package/src/lib/fetch.ts +0 -115
- package/src/lib/index.ts +0 -3
- package/src/lib/tailwindVariants.ts +0 -35
- package/src/redux/index.ts +0 -1
- package/src/redux/notification/components/NotificationConsumer.tsx +0 -52
- package/src/redux/notification/errorCatcherMiddleware.ts +0 -17
- package/src/redux/notification/hooks/useNotification.ts +0 -26
- package/src/redux/notification/index.ts +0 -5
- package/src/redux/notification/notificationSlice.ts +0 -68
- package/src/styles/Animation.stories.tsx +0 -43
- package/src/styles/Shadow.stories.tsx +0 -43
- package/src/styles/Themes.stories.tsx +0 -31
- package/src/styles/Typography.stories.tsx +0 -101
- package/src/tailwind/base.css +0 -188
- package/src/tailwind/components-input-outline.css +0 -62
- package/src/tailwind/components-resize-area.css +0 -112
- package/src/tailwind/components-step.css +0 -161
- package/src/tailwind/components.css +0 -51
- package/src/tailwind/keyframes.ts +0 -69
- package/src/tailwind/pentatrionTw.ts +0 -147
- package/src/tailwind/utilities-dialog.css +0 -103
- package/src/tailwind/utilities.css +0 -3
- package/src/types.d.ts +0 -12
- package/tailwind.config.js +0 -18
- package/tests/README.md +0 -32
- package/tests/setup.ts +0 -1
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -23
- package/vite.config.ts +0 -24
package/README.md
CHANGED
|
@@ -1,40 +1,171 @@
|
|
|
1
|
-
# Pentatrion Design System
|
|
1
|
+
# [Pentatrion Design System](https://storybook.lonlat.pentatrion.com)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<a href="https://storybook.lonlat.pentatrion.com">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/lhapaipai/lonlat/main/extra/assets/public/graphics/screenshots/storybook.jpg" alt="Pentatrion design system" />
|
|
5
|
+
</a>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Prérequis
|
|
8
|
+
|
|
9
|
+
Créez un nouveau projet Vite + React + TailwindCSS. [Official doc](https://tailwindcss.com/docs/guides/vite)
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
pnpm
|
|
12
|
+
pnpm create vite my-app
|
|
13
|
+
|
|
14
|
+
# 1. React
|
|
15
|
+
# 2. TypeScript + SWC
|
|
16
|
+
|
|
17
|
+
cd my-app
|
|
18
|
+
|
|
19
|
+
pnpm add -D tailwindcss postcss autoprefixer postcss-load-config prettier-plugin-tailwindcss
|
|
20
|
+
|
|
21
|
+
# si vous utilisez le composant <input type="range" />
|
|
22
|
+
pnpm add -D postcss-input-range
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Supprimer les fichiers inutiles
|
|
26
|
+
|
|
9
27
|
```
|
|
28
|
+
.
|
|
29
|
+
├── src
|
|
30
|
+
│ ├── App.tsx
|
|
31
|
+
│ ├── index.css
|
|
32
|
+
│ ├── main.tsx
|
|
33
|
+
│ └── vite-env.d.ts
|
|
34
|
+
├── tailwind.config.js
|
|
35
|
+
└── postcss.config.js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Créer un fichier `tailwind.config.js` et `postcss.config.js`.
|
|
10
39
|
|
|
11
40
|
```js
|
|
12
41
|
// tailwind.config.js
|
|
13
|
-
import pentatrionTw from "pentatrion-design";
|
|
14
42
|
|
|
15
43
|
/** @type {import('tailwindcss').Config} */
|
|
16
44
|
export default {
|
|
17
45
|
content: [
|
|
18
|
-
"./
|
|
46
|
+
"./index.html",
|
|
47
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
19
48
|
],
|
|
20
49
|
darkMode: ["class"],
|
|
21
|
-
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// postcss.config.js
|
|
54
|
+
/** @type {import("postcss-load-config").Config} */
|
|
55
|
+
export default {
|
|
56
|
+
plugins: {
|
|
57
|
+
"tailwindcss/nesting": {},
|
|
58
|
+
tailwindcss: {},
|
|
59
|
+
|
|
60
|
+
// si vous utilisez le composant <input type="range" />
|
|
61
|
+
// bien le mettre en dernier car tailwind génère du contenu à transformer
|
|
62
|
+
"postcss-input-range": {}
|
|
63
|
+
},
|
|
22
64
|
};
|
|
23
65
|
```
|
|
66
|
+
|
|
67
|
+
Mettre à jour le fichier `src/index.css`
|
|
24
68
|
```css
|
|
69
|
+
/* on utilisera des imports pour faciliter l'intégration du design système */
|
|
70
|
+
@import "tailwindcss/base";
|
|
71
|
+
@import "tailwindcss/components";
|
|
72
|
+
@import "tailwindcss/utilities";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pnpm add pentatrion-design
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Mettre à jour la configuration de tailwind.
|
|
83
|
+
|
|
84
|
+
```diff
|
|
85
|
+
// tailwind.config.js
|
|
86
|
+
+ import { pentatrionTw } from "pentatrion-design/tailwind";
|
|
87
|
+
|
|
88
|
+
/** @type {import('tailwindcss').Config} */
|
|
89
|
+
export default {
|
|
90
|
+
content: [
|
|
91
|
+
"./index.html",
|
|
92
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
93
|
+
+ "./node_modules/pentatrion-design/components/**/*.{ts,tsx}",
|
|
94
|
+
+ "./node_modules/pentatrion-design/hooks/**/*.{ts,tsx}",
|
|
95
|
+
+ "./node_modules/pentatrion-design/redux/**/*.{ts,tsx}",
|
|
96
|
+
],
|
|
97
|
+
darkMode: ["class"],
|
|
98
|
+
+ plugins: [pentatrionTw],
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
La dépendance `pentatrion-fonts` est optionnelle.
|
|
103
|
+
|
|
104
|
+
Mettre à jour `src/App.tsx`
|
|
105
|
+
```tsx
|
|
106
|
+
// import global
|
|
107
|
+
import { Button } from "pentatrion-design";
|
|
108
|
+
|
|
109
|
+
// import minimal
|
|
110
|
+
import { Button } from "pentatrion-design/components/button";
|
|
111
|
+
|
|
112
|
+
import { useState } from "react"
|
|
113
|
+
|
|
114
|
+
function App() {
|
|
115
|
+
const [counter, setCounter] = useState(0);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div className="flex flex-col gap-2 items-center">
|
|
119
|
+
<h1 className="text-gray-6">Vite + React</h1>
|
|
120
|
+
<Button onClick={() => setCounter(c => c + 1)}>Click me !</Button>
|
|
121
|
+
<p>{counter}</p>
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export default App
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
L'import minimal `import { Button } from "pentatrion-design/components/button";` est plus contraignant et n'est pas nécessaire si votre projet utilise toutes les dépendances de `pentatrion-design`. si par contre votre projet n'utilise que certains composants et n'utilise pas certains dépendances comme `react-sortablejs` il vaut mieux utiliser l'import `pentatrion-design/components/button`. Cela allégera le build (que notre compilateur fasse du tree shaking ou non).
|
|
130
|
+
|
|
131
|
+
Mettre à jour `src/index.css`
|
|
132
|
+
```diff
|
|
25
133
|
/* index.css */
|
|
26
134
|
@import "tailwindcss/base";
|
|
27
|
-
@import "pentatrion-design/
|
|
135
|
+
+ @import "pentatrion-design/tailwind/base.css" layer(base);
|
|
28
136
|
|
|
29
137
|
@import "tailwindcss/components";
|
|
30
|
-
@import "pentatrion-design/
|
|
31
|
-
@import "pentatrion-design/
|
|
32
|
-
@import "pentatrion-design/
|
|
33
|
-
@import "pentatrion-design/
|
|
138
|
+
+ @import "pentatrion-design/tailwind/components.css" layer(components);
|
|
139
|
+
+ @import "pentatrion-design/tailwind/components-input-outline.css" layer(components);
|
|
140
|
+
+ @import "pentatrion-design/tailwind/components-resize-area.css" layer(components);
|
|
141
|
+
+ @import "pentatrion-design/tailwind/components-step.css" layer(components);
|
|
34
142
|
|
|
35
143
|
@import "tailwindcss/utilities";
|
|
36
|
-
@import "pentatrion-design/
|
|
37
|
-
@import "pentatrion-design/
|
|
144
|
+
+ @import "pentatrion-design/tailwind/utilities.css" layer(utilities);
|
|
145
|
+
+ @import "pentatrion-design/tailwind/utilities-dialog.css" layer(utilities);
|
|
146
|
+
|
|
147
|
+
/* Optionel */
|
|
148
|
+
+ @import "pentatrion-fonts/fontello-lonlat";
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
## projet sans TypeScript
|
|
153
|
+
|
|
154
|
+
pour faciliter l'expérience de développement, `pentatrion-design` fait référence par défaut aux fichiers TypeScript non compilés. Si votre projet n'utilise pas TypeScript il faudra faire référence au dossier `dist`
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
import { Button } from "pentatrion-design/dist";
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## VsCode
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
Create a `.vscode/settings.json` file
|
|
38
164
|
|
|
39
|
-
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"files.associations": {
|
|
168
|
+
"*.css": "tailwindcss"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
40
171
|
```
|