@agility/plenum-ui 2.0.0-rc6 → 2.0.0-rc61
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 +104 -31
- package/build.js +30 -25
- package/dist/index.d.ts +446 -320
- package/dist/index.js +1 -6108
- package/dist/index.js.map +4 -4
- package/dist/{lib/tailwind.css → tailwind.css} +3735 -8122
- package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +3 -7
- package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +1 -1
- package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +2 -2
- package/dist/types/stories/atoms/icons/TablerIcon.d.ts +1 -1
- package/dist/types/stories/index.d.ts +4 -4
- package/dist/types/stories/molecules/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +8 -8
- package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +1 -1
- package/dist/types/stories/molecules/inputs/index.d.ts +4 -4
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +4 -2
- package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +34 -21
- package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +4 -4
- package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +10 -7
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +5 -5
- package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +1 -1
- package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
- package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
- package/dist/types/stories/organisms/ButtonDropdown/ButtonDropdown.d.ts +1 -0
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +24 -13
- package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
- package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +1 -1
- package/dist/types/stories/organisms/TextInputSelect/InputSelect.d.ts +16 -0
- package/dist/types/stories/organisms/TextInputSelect/TextInputSelect.d.ts +48 -0
- package/dist/types/stories/organisms/TextInputSelect/index.d.ts +3 -0
- package/dist/types/stories/organisms/index.d.ts +5 -3
- package/local.sh +100 -0
- package/package.json +35 -18
- package/rollup.config.mjs +42 -0
- package/stories/atoms/badges/Badge.tsx +1 -1
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +10 -0
- package/stories/atoms/buttons/Button/Button.tsx +111 -25
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +14 -2
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +14 -2
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +13 -1
- package/stories/atoms/buttons/Button/defaultArgs.ts +1 -1
- package/stories/atoms/buttons/Capsule/Capsule.tsx +2 -1
- package/stories/atoms/icons/DynamicIcon.stories.ts +1 -1
- package/stories/atoms/icons/DynamicIcon.tsx +7 -7
- package/stories/atoms/icons/IconWithShadow.stories.ts +3 -3
- package/stories/atoms/icons/TablerIcon.tsx +1 -1
- package/stories/atoms/loaders/Loader.tsx +12 -6
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +0 -2
- package/stories/index.ts +18 -10
- package/stories/molecules/index.ts +6 -4
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +2 -2
- package/stories/molecules/inputs/InputField/InputField.tsx +32 -29
- package/stories/molecules/inputs/TextInput/TextInput.tsx +7 -4
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +1 -1
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -2
- package/stories/molecules/inputs/combobox/ComboBox.tsx +126 -135
- package/stories/molecules/inputs/index.ts +5 -4
- package/stories/molecules/inputs/radio/Radio.stories.ts +2 -2
- package/stories/molecules/inputs/select/Select.tsx +10 -2
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +7 -5
- package/stories/molecules/inputs/textArea/TextArea.tsx +139 -48
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +15 -16
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +63 -57
- package/stories/molecules/tabs/index.tsx +2 -3
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +53 -37
- package/stories/organisms/AnimatedLabelInput/index.tsx +1 -1
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +65 -58
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +42 -30
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +26 -2
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +225 -179
- package/stories/organisms/DropdownComponent/dropdownItems.ts +30 -9
- package/stories/organisms/DropdownComponent/index.ts +2 -2
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +3 -3
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +2 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +1 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +7 -2
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -0
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -0
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -0
- package/stories/organisms/TextInputSelect/index.tsx +3 -0
- package/stories/organisms/index.ts +15 -4
- package/tailwind.config.js +81 -37
- package/tsconfig.lib.json +13 -6
- package/watch.js +49 -0
- package/.yarnrc.yml +0 -1
- package/dist/types/stories/layouts/index.d.ts +0 -0
- package/stories/layouts/CardLayout/CardLayout.stories.tsx +0 -18
- package/stories/layouts/CardLayout/CardLayout.tsx +0 -22
- package/stories/layouts/CardLayout/index.tsx +0 -3
- package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +0 -18
- package/stories/layouts/ModalLayout/ModalLayout.tsx +0 -22
- package/stories/layouts/ModalLayout/index.tsx +0 -3
- package/stories/layouts/index.ts +0 -0
- package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
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,15 @@ 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
|
-
Run your development server with Storybook:
|
|
59
|
+
#### Run your development server with Storybook:
|
|
62
60
|
|
|
63
61
|
```bash
|
|
64
62
|
npm run dev
|
|
@@ -66,7 +64,7 @@ npm run dev
|
|
|
66
64
|
yarn dev
|
|
67
65
|
```
|
|
68
66
|
|
|
69
|
-
Build your project:
|
|
67
|
+
#### Build your project:
|
|
70
68
|
|
|
71
69
|
```bash
|
|
72
70
|
npm run build
|
|
@@ -74,7 +72,44 @@ npm run build
|
|
|
74
72
|
yarn build
|
|
75
73
|
```
|
|
76
74
|
|
|
77
|
-
|
|
75
|
+
### Build your project locally and watch for changes
|
|
76
|
+
|
|
77
|
+
This will create symlinks for the current project and its necessary dependencies, so that it can be connected to other projects.
|
|
78
|
+
It will also start the watch server, so it will automatically rebuild on any local changes.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
yarn start:local
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Use yarn link to locally test the library in another project:
|
|
85
|
+
|
|
86
|
+
In the Plenum project directory after having run a build, run:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
yarn link.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
You should see the following in your terminal:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
yarn link v1.22.10
|
|
96
|
+
success Registered "@agility/plenum-ui".
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You can now run
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
yarn link "@agility/plenum-ui"
|
|
103
|
+
```
|
|
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
|
+
|
|
107
|
+
```bash
|
|
108
|
+
yarn link v1.22.10
|
|
109
|
+
success Using linked package for "@agility/plenum-ui".
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Clean the \`dist\` directory:
|
|
78
113
|
|
|
79
114
|
```bash
|
|
80
115
|
npm run clean
|
|
@@ -82,7 +117,7 @@ npm run clean
|
|
|
82
117
|
yarn clean
|
|
83
118
|
```
|
|
84
119
|
|
|
85
|
-
Lint your project:
|
|
120
|
+
#### Lint your project:
|
|
86
121
|
|
|
87
122
|
```bash
|
|
88
123
|
npm run lint
|
|
@@ -90,7 +125,7 @@ npm run lint
|
|
|
90
125
|
yarn lint
|
|
91
126
|
```
|
|
92
127
|
|
|
93
|
-
Build Tailwind CSS:
|
|
128
|
+
#### Build Tailwind CSS:
|
|
94
129
|
|
|
95
130
|
```bash
|
|
96
131
|
npm run build:tw
|
|
@@ -100,7 +135,7 @@ yarn build:tw
|
|
|
100
135
|
|
|
101
136
|
### Storybook Scripts
|
|
102
137
|
|
|
103
|
-
Build your Storybook:
|
|
138
|
+
#### Build your Storybook:
|
|
104
139
|
|
|
105
140
|
```bash
|
|
106
141
|
npm run build-storybook
|
|
@@ -108,7 +143,7 @@ npm run build-storybook
|
|
|
108
143
|
yarn build-storybook
|
|
109
144
|
```
|
|
110
145
|
|
|
111
|
-
Run your Storybook in development mode:
|
|
146
|
+
#### Run your Storybook in development mode:
|
|
112
147
|
|
|
113
148
|
```bash
|
|
114
149
|
npm run storybook:dev
|
|
@@ -116,7 +151,7 @@ npm run storybook:dev
|
|
|
116
151
|
yarn storybook:dev
|
|
117
152
|
```
|
|
118
153
|
|
|
119
|
-
Generate Tailwind CSS for Storybook and watch for changes:
|
|
154
|
+
#### Generate Tailwind CSS for Storybook and watch for changes:
|
|
120
155
|
|
|
121
156
|
```bash
|
|
122
157
|
npm run storybook:tw
|
|
@@ -124,7 +159,7 @@ npm run storybook:tw
|
|
|
124
159
|
yarn storybook:tw
|
|
125
160
|
```
|
|
126
161
|
|
|
127
|
-
Build specific parts of Storybook:
|
|
162
|
+
#### Build specific parts of Storybook:
|
|
128
163
|
|
|
129
164
|
```bash
|
|
130
165
|
# Build Storybook
|
|
@@ -138,7 +173,7 @@ npm run sb-build:tw
|
|
|
138
173
|
yarn sb-build:tw
|
|
139
174
|
```
|
|
140
175
|
|
|
141
|
-
Compile TypeScript files using custom build script:
|
|
176
|
+
#### Compile TypeScript files using custom build script:
|
|
142
177
|
|
|
143
178
|
```bash
|
|
144
179
|
npm run build:tsc
|
|
@@ -148,7 +183,6 @@ yarn build:tsc
|
|
|
148
183
|
|
|
149
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.
|
|
150
185
|
|
|
151
|
-
|
|
152
186
|
### Component Generation Script
|
|
153
187
|
|
|
154
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\`.
|
|
@@ -163,14 +197,14 @@ node create-component.js ComponentName DestinationDirectory
|
|
|
163
197
|
|
|
164
198
|
This command takes two arguments:
|
|
165
199
|
|
|
166
|
-
-
|
|
167
|
-
-
|
|
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").
|
|
168
202
|
|
|
169
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:
|
|
170
204
|
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
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.
|
|
174
208
|
|
|
175
209
|
#### Example
|
|
176
210
|
|
|
@@ -196,3 +230,42 @@ Each of the generated files will contain basic boilerplate code that you can sta
|
|
|
196
230
|
##### Notes
|
|
197
231
|
|
|
198
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/build.js
CHANGED
|
@@ -12,30 +12,35 @@ new Generator({
|
|
|
12
12
|
// Run TypeScript to generate type declarations using the new tsconfig.lib.json
|
|
13
13
|
execSync("tsc --emitDeclarationOnly --project tsconfig.lib.json", { stdio: "inherit" })
|
|
14
14
|
|
|
15
|
+
const context = {
|
|
16
|
+
logLevel: "info",
|
|
17
|
+
entryPoints: [path.resolve(__dirname, "stories/index.ts")],
|
|
18
|
+
|
|
19
|
+
bundle: true,
|
|
20
|
+
platform: "browser",
|
|
21
|
+
target: ["esnext"],
|
|
22
|
+
minify: true,
|
|
23
|
+
pure: ["React.createElement"],
|
|
24
|
+
jsx: 'transform',
|
|
25
|
+
loader: { '.js': 'jsx' },
|
|
26
|
+
outdir: path.resolve(__dirname, "dist"),
|
|
27
|
+
sourcemap: true,
|
|
28
|
+
external: [
|
|
29
|
+
"react",
|
|
30
|
+
"react-dom",
|
|
31
|
+
"@floating-ui/react",
|
|
32
|
+
"@headlessui/react",
|
|
33
|
+
"@headlessui/tailwindcss",
|
|
34
|
+
"@heroicons/react",
|
|
35
|
+
"@tabler/icons",
|
|
36
|
+
"@tabler/icons-react",
|
|
37
|
+
"classnames",
|
|
38
|
+
"react-icons"
|
|
39
|
+
],
|
|
40
|
+
format: "esm"
|
|
41
|
+
}
|
|
42
|
+
|
|
15
43
|
// Build script using esbuild
|
|
16
44
|
esbuild
|
|
17
|
-
.build(
|
|
18
|
-
|
|
19
|
-
bundle: true,
|
|
20
|
-
platform: "browser",
|
|
21
|
-
target: ["es6"],
|
|
22
|
-
//HACK outfile: "dist/index.js,"
|
|
23
|
-
outdir: path.resolve(__dirname, "dist"),
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
external: [
|
|
26
|
-
"react",
|
|
27
|
-
"react-dom",
|
|
28
|
-
"@floating-ui/react",
|
|
29
|
-
"@headlessui/react",
|
|
30
|
-
"@headlessui/tailwindcss",
|
|
31
|
-
"@heroicons/react",
|
|
32
|
-
"@tabler/icons",
|
|
33
|
-
"@tabler/icons-react",
|
|
34
|
-
"classnames",
|
|
35
|
-
"react",
|
|
36
|
-
"react-dom",
|
|
37
|
-
"react-icons"
|
|
38
|
-
],
|
|
39
|
-
format: "esm"
|
|
40
|
-
})
|
|
41
|
-
.catch(() => process.exit(1))
|
|
45
|
+
.build(context)
|
|
46
|
+
.catch(() => process.exit(1))
|