@agility/plenum-ui 2.0.0-rc21 → 2.0.0-rc23
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
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
1
|
[](https://agilitycms.com/)
|
|
3
|
-
# Agility Plenum UI Library
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
# Agility Plenum UI Library
|
|
6
4
|
|
|
5
|
+
Welcome to Plenum, the definitive UI library for working within the [Agility CMS](https://www.agilitycms.com/) ecosystem. Built with [Next.js 13](https://nextjs.org/) and [Storybook 7.1](https://storybook.js.org/), Plenum is a comprehensive collection of components and patterns designed for building user interfaces in Agility CMS, as well as your own applications within the Agility CMS ecosystem.
|
|
7
6
|
|
|
8
7
|
## Building for the Agility Marketplace
|
|
9
8
|
|
|
@@ -13,21 +12,21 @@ Contributions to extend and improve this library are welcome! Feel free to fork
|
|
|
13
12
|
|
|
14
13
|
## Features
|
|
15
14
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
15
|
+
- Comprehensive UI components library, designed for versatility and consistency.
|
|
16
|
+
- Built with modern technologies like Next.js 13 and Storybook 7.1.
|
|
17
|
+
- Includes automation scripts for efficient component creation.
|
|
18
|
+
- Adopts Tailwind CSS for utility-first styling.
|
|
19
|
+
- Easy to use, install, and integrate into your project.
|
|
20
|
+
|
|
22
21
|
## Prerequisites
|
|
23
22
|
|
|
24
23
|
Before you begin, ensure that Tailwind CSS is installed in your project. Follow the instructions here: [Install Tailwind CSS with Next.js](https://tailwindcss.com/docs/guides/nextjs)
|
|
25
24
|
|
|
26
|
-
In your app entry point (i.e.
|
|
25
|
+
In your app entry point (i.e. \`\_app.tsx\`), import the \`globals.css\` file from the previous step, and the \`tailwind.css\` file from Plenum:
|
|
27
26
|
|
|
28
27
|
```jsx
|
|
29
|
-
import "<RELATIVE_PATH>/globals.css"
|
|
30
|
-
import "@agility/plenum-ui/dist/lib/tailwind.css"
|
|
28
|
+
import "<RELATIVE_PATH>/globals.css"
|
|
29
|
+
import "@agility/plenum-ui/dist/lib/tailwind.css"
|
|
31
30
|
```
|
|
32
31
|
|
|
33
32
|
Make sure to add any additional styles before these two import statements to prevent overwriting the Plenum styling.
|
|
@@ -49,16 +48,14 @@ yarn add @agility/plenum-ui
|
|
|
49
48
|
Import and use the Plenum components in your React components:
|
|
50
49
|
|
|
51
50
|
```jsx
|
|
52
|
-
import { Component } from
|
|
53
|
-
|
|
54
|
-
<Component {...{ComponentProps}} />
|
|
51
|
+
import { Component } from "@agility/plenum-ui"
|
|
52
|
+
;<Component {...{ ComponentProps }} />
|
|
55
53
|
```
|
|
56
54
|
|
|
57
55
|
## Scripts
|
|
58
56
|
|
|
59
57
|
### Development and Build Scripts
|
|
60
58
|
|
|
61
|
-
|
|
62
59
|
#### Run your development server with Storybook:
|
|
63
60
|
|
|
64
61
|
```bash
|
|
@@ -76,6 +73,7 @@ yarn build
|
|
|
76
73
|
```
|
|
77
74
|
|
|
78
75
|
### Build your project locally and watch for changes
|
|
76
|
+
|
|
79
77
|
This will create symlinks for the current project and its necessary dependencies, so that it can be connected to other projects.
|
|
80
78
|
It will also start the watch server, so it will automatically rebuild on any local changes.
|
|
81
79
|
|
|
@@ -86,19 +84,26 @@ yarn start:local
|
|
|
86
84
|
#### Use yarn link to locally test the library in another project:
|
|
87
85
|
|
|
88
86
|
In the Plenum project directory after having run a build, run:
|
|
89
|
-
|
|
87
|
+
|
|
88
|
+
```bash
|
|
90
89
|
yarn link.
|
|
91
90
|
```
|
|
92
|
-
|
|
91
|
+
|
|
92
|
+
You should see the following in your terminal:
|
|
93
|
+
|
|
93
94
|
```bash
|
|
94
|
-
yarn link v1.22.10
|
|
95
|
+
yarn link v1.22.10
|
|
95
96
|
success Registered "@agility/plenum-ui".
|
|
96
97
|
```
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
|
|
99
|
+
You can now run
|
|
100
|
+
|
|
101
|
+
```bash
|
|
99
102
|
yarn link "@agility/plenum-ui"
|
|
100
103
|
```
|
|
101
|
-
|
|
104
|
+
|
|
105
|
+
in the projects where you want to consume this package and it will be used instead. It should output a message like
|
|
106
|
+
|
|
102
107
|
```bash
|
|
103
108
|
yarn link v1.22.10
|
|
104
109
|
success Using linked package for "@agility/plenum-ui".
|
|
@@ -178,7 +183,6 @@ yarn build:tsc
|
|
|
178
183
|
|
|
179
184
|
These scripts cover various tasks related to development, build processes, linting, and handling specific aspects like Storybook and Tailwind CSS. Make sure to run the appropriate script for the task you want to perform.
|
|
180
185
|
|
|
181
|
-
|
|
182
186
|
### Component Generation Script
|
|
183
187
|
|
|
184
188
|
We have a Node.js script that automates the creation of new components for our Storybook library. This script generates a component directory, along with the necessary files like \`Component.tsx\`, \`Component.stories.tsx\`, and \`index.tsx\`.
|
|
@@ -193,14 +197,14 @@ node create-component.js ComponentName DestinationDirectory
|
|
|
193
197
|
|
|
194
198
|
This command takes two arguments:
|
|
195
199
|
|
|
196
|
-
-
|
|
197
|
-
-
|
|
200
|
+
- \`ComponentName\` - The name of the new component you want to create. This should be in PascalCase (for example, "MyComponent").
|
|
201
|
+
- \`DestinationDirectory\` - The directory where the new component will be created. This should be relative to the 'stories' directory. (for example, "atoms" or "Molecules").
|
|
198
202
|
|
|
199
203
|
The script will create a new directory with the given component name inside the specified destination directory (under the 'stories' directory). Then, it will generate three files in the new directory:
|
|
200
204
|
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
205
|
+
- \`ComponentName.tsx\` - This is the component file. It contains a basic React functional component structure.
|
|
206
|
+
- \`ComponentName.stories.tsx\` - This is the Storybook story file. It sets up a basic story for the new component.
|
|
207
|
+
- \`index.tsx\` - This file simply exports the new component. It's used for cleaner imports.
|
|
204
208
|
|
|
205
209
|
#### Example
|
|
206
210
|
|
|
@@ -226,3 +230,42 @@ Each of the generated files will contain basic boilerplate code that you can sta
|
|
|
226
230
|
##### Notes
|
|
227
231
|
|
|
228
232
|
This script does prompt the user before overwriting existing directories, so you can run it with confidence. Always use PascalCase for component names, and ensure the destination directory exists or can be created. If you encounter any issues, you can create the component and its files manually
|
|
233
|
+
|
|
234
|
+
## Advanced
|
|
235
|
+
|
|
236
|
+
Old School Yarn Link Instructions :)
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
cd THIS_PACKAGE
|
|
240
|
+
yarn link
|
|
241
|
+
yarn install
|
|
242
|
+
cd node_modules/react
|
|
243
|
+
yarn link
|
|
244
|
+
cd ../../node_modules/react-dom
|
|
245
|
+
yarn link
|
|
246
|
+
cd YOUR_PROJECT
|
|
247
|
+
yarn link PACKAGE_YOU_DEBUG_LOCALLY
|
|
248
|
+
yarn link react
|
|
249
|
+
yarn link react-dom
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Then, when you are done
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
cd YOUR_PROJECT
|
|
256
|
+
yarn unlink "@agility/plenum-ui"
|
|
257
|
+
yarn unlink react
|
|
258
|
+
yarn link react-dom
|
|
259
|
+
|
|
260
|
+
cd THIS_PACKAGE
|
|
261
|
+
yarn unlink
|
|
262
|
+
cd node_modules/react
|
|
263
|
+
yarn unlink
|
|
264
|
+
cd ../../node_modules/react-dom
|
|
265
|
+
yarn unlink
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -930,7 +930,7 @@ declare module '@agility/plenum-ui/stories/organisms/DropdownComponent/DropdownC
|
|
|
930
930
|
import { Placement } from "@floating-ui/react";
|
|
931
931
|
import { ClassNameWithAutocomplete } from "utils/types";
|
|
932
932
|
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
933
|
-
export interface IItemProp
|
|
933
|
+
export interface IItemProp {
|
|
934
934
|
icon?: IDynamicIconProps;
|
|
935
935
|
iconPosition?: "trailing" | "leading";
|
|
936
936
|
label: string;
|