@agility/plenum-ui 2.0.0-rc47 → 2.0.0-rc49
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/.eslintrc.json +6 -6
- package/.prettierrc +13 -13
- package/.storybook/Layout.jsx +12 -12
- package/.storybook/head.tsx +4 -4
- package/.storybook/main.ts +18 -18
- package/.storybook/manager-head.html +1 -1
- package/.storybook/manager.ts +25 -25
- package/.storybook/plenumTheme.ts +8 -8
- package/.storybook/preview-head.html +3 -3
- package/.storybook/preview.tsx +28 -28
- package/.vscode/settings.json +3 -3
- package/README.md +271 -271
- package/app/globals.css +99 -99
- package/app/head.tsx +59 -59
- package/app/layout.tsx +28 -28
- package/app/page.tsx +7 -7
- package/build.js +45 -45
- package/dist/index.d.ts +232 -230
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -0
- package/local.sh +100 -100
- package/next.config.js +8 -8
- package/package.json +82 -82
- package/pages/api/hello.ts +13 -13
- package/postcss.config.js +6 -6
- package/rollup.config.mjs +41 -41
- package/scripts/create-component.js +97 -97
- package/stories/Introduction.mdx +314 -314
- package/stories/assets/stackalt.svg +1 -1
- package/stories/atoms/Avatar/Avatar.stories.tsx +96 -96
- package/stories/atoms/Avatar/Avatar.tsx +123 -123
- package/stories/atoms/Avatar/index.ts +3 -3
- package/stories/atoms/badges/Badge.tsx +127 -127
- package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -75
- package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -75
- package/stories/atoms/badges/index.ts +3 -3
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +86 -86
- package/stories/atoms/buttons/Button/Button.tsx +232 -232
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +90 -90
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +97 -97
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +93 -93
- package/stories/atoms/buttons/Button/defaultArgs.ts +9 -9
- package/stories/atoms/buttons/Button/index.ts +3 -3
- package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Capsule.tsx +88 -88
- package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/index.ts +3 -3
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -15
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -22
- package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -3
- package/stories/atoms/buttons/index.ts +4 -4
- package/stories/atoms/crumb/Crumb.stories.tsx +18 -18
- package/stories/atoms/crumb/Crumb.tsx +22 -22
- package/stories/atoms/crumb/index.tsx +3 -3
- package/stories/atoms/icons/DynamicIcon.stories.ts +43 -43
- package/stories/atoms/icons/DynamicIcon.tsx +90 -90
- package/stories/atoms/icons/IconWithShadow.stories.ts +43 -43
- package/stories/atoms/icons/IconWithShadow.tsx +16 -16
- package/stories/atoms/icons/TablerIcon.tsx +22 -22
- package/stories/atoms/icons/index.tsx +14 -14
- package/stories/atoms/icons/tablerIconNames.ts +4336 -4336
- package/stories/atoms/index.ts +46 -46
- package/stories/atoms/loaders/Loader.stories.ts +15 -15
- package/stories/atoms/loaders/Loader.tsx +21 -21
- package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -19
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +74 -74
- package/stories/atoms/loaders/NProgress/index.ts +3 -3
- package/stories/atoms/loaders/index.ts +4 -4
- package/stories/index.ts +136 -136
- package/stories/molecules/index.ts +51 -51
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -18
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -24
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -3
- package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -29
- package/stories/molecules/inputs/InputField/InputField.tsx +96 -96
- package/stories/molecules/inputs/InputField/index.tsx +3 -3
- package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -19
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -45
- package/stories/molecules/inputs/InputLabel/index.tsx +3 -3
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -52
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -64
- package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -3
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -32
- package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -165
- package/stories/molecules/inputs/TextInput/index.tsx +5 -5
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -23
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +98 -98
- package/stories/molecules/inputs/checkbox/index.ts +3 -3
- package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -41
- package/stories/molecules/inputs/combobox/ComboBox.tsx +185 -185
- package/stories/molecules/inputs/combobox/index.ts +3 -3
- package/stories/molecules/inputs/index.ts +38 -38
- package/stories/molecules/inputs/radio/Radio.stories.ts +27 -27
- package/stories/molecules/inputs/radio/Radio.tsx +92 -92
- package/stories/molecules/inputs/radio/index.ts +3 -3
- package/stories/molecules/inputs/select/Select.stories.ts +23 -23
- package/stories/molecules/inputs/select/Select.tsx +108 -100
- package/stories/molecules/inputs/select/index.ts +3 -3
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +22 -22
- package/stories/molecules/inputs/textArea/TextArea.tsx +158 -158
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +118 -118
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +81 -81
- package/stories/molecules/inputs/toggleSwitch/index.ts +3 -3
- package/stories/molecules/tabs/Tabs.stories.tsx +18 -18
- package/stories/molecules/tabs/Tabs.tsx +22 -22
- package/stories/molecules/tabs/index.tsx +2 -2
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +30 -30
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +66 -66
- package/stories/organisms/AnimatedLabelInput/index.tsx +3 -3
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -26
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -61
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -3
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +125 -125
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +86 -86
- package/stories/organisms/ButtonDropdown/index.tsx +3 -3
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +73 -73
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +346 -346
- package/stories/organisms/DropdownComponent/dropdownItems.ts +122 -122
- package/stories/organisms/DropdownComponent/index.ts +4 -4
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -76
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -52
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +4 -4
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -29
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +145 -145
- package/stories/organisms/FormInputWithAddons/index.tsx +3 -3
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -59
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -33
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -186
- package/stories/organisms/TextInputSelect/index.tsx +3 -3
- package/stories/organisms/index.ts +27 -27
- package/tailwind.config.js +192 -192
- package/tsconfig.json +29 -29
- package/tsconfig.lib.json +25 -25
- package/utils/types.d.ts +2 -2
- package/utils/types.ts +3 -3
- package/utils/useId.d.ts +1 -1
- package/utils/useId.tsx +16 -16
package/stories/Introduction.mdx
CHANGED
|
@@ -1,314 +1,314 @@
|
|
|
1
|
-
import { Meta } from "@storybook/blocks"
|
|
2
|
-
import Code from "./assets/code-brackets.svg"
|
|
3
|
-
import Colors from "./assets/colors.svg"
|
|
4
|
-
import Comments from "./assets/comments.svg"
|
|
5
|
-
import Direction from "./assets/direction.svg"
|
|
6
|
-
import Flow from "./assets/flow.svg"
|
|
7
|
-
import Plugin from "./assets/plugin.svg"
|
|
8
|
-
import Repo from "./assets/repo.svg"
|
|
9
|
-
import StackAlt from "./assets/stackalt.svg"
|
|
10
|
-
|
|
11
|
-
<Meta title="Plenum Introduction" />
|
|
12
|
-
|
|
13
|
-
<style>
|
|
14
|
-
{`
|
|
15
|
-
.subheading {
|
|
16
|
-
--mediumdark: '#999999';
|
|
17
|
-
font-weight: 900;
|
|
18
|
-
font-size: 13px;
|
|
19
|
-
color: #999;
|
|
20
|
-
letter-spacing: 6px;
|
|
21
|
-
line-height: 24px;
|
|
22
|
-
text-transform: uppercase;
|
|
23
|
-
margin-bottom: 12px;
|
|
24
|
-
margin-top: 40px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.link-list {
|
|
28
|
-
display: grid;
|
|
29
|
-
grid-template-columns: 1fr;
|
|
30
|
-
grid-template-rows: 1fr 1fr;
|
|
31
|
-
row-gap: 10px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@media (min-width: 620px) {
|
|
35
|
-
.link-list {
|
|
36
|
-
row-gap: 20px;
|
|
37
|
-
column-gap: 20px;
|
|
38
|
-
grid-template-columns: 1fr 1fr;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@media all and (-ms-high-contrast:none) {
|
|
43
|
-
.link-list {
|
|
44
|
-
display: -ms-grid;
|
|
45
|
-
-ms-grid-columns: 1fr 1fr;
|
|
46
|
-
-ms-grid-rows: 1fr 1fr;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.link-item {
|
|
51
|
-
display: block;
|
|
52
|
-
padding: 20px 30px 20px 15px;
|
|
53
|
-
border: 1px solid #00000010;
|
|
54
|
-
border-radius: 5px;
|
|
55
|
-
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
|
|
56
|
-
color: #333333;
|
|
57
|
-
display: flex;
|
|
58
|
-
align-items: flex-start;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.link-item:hover {
|
|
62
|
-
border-color: #1EA7FD50;
|
|
63
|
-
transform: translate3d(0, -3px, 0);
|
|
64
|
-
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.link-item:active {
|
|
68
|
-
border-color: #1EA7FD;
|
|
69
|
-
transform: translate3d(0, 0, 0);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.link-item strong {
|
|
73
|
-
font-weight: 700;
|
|
74
|
-
display: block;
|
|
75
|
-
margin-bottom: 2px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.link-item img {
|
|
79
|
-
height: 40px;
|
|
80
|
-
width: 40px;
|
|
81
|
-
margin-right: 15px;
|
|
82
|
-
flex: none;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.link-item span {
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
line-height: 20px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.tip {
|
|
91
|
-
display: inline-block;
|
|
92
|
-
border-radius: 1em;
|
|
93
|
-
font-size: 11px;
|
|
94
|
-
line-height: 12px;
|
|
95
|
-
font-weight: 700;
|
|
96
|
-
background: #E7FDD8;
|
|
97
|
-
color: #66BF3C;
|
|
98
|
-
padding: 4px 12px;
|
|
99
|
-
margin-right: 10px;
|
|
100
|
-
vertical-align: top;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.tip-wrapper {
|
|
104
|
-
font-size: 13px;
|
|
105
|
-
line-height: 20px;
|
|
106
|
-
margin-top: 40px;
|
|
107
|
-
margin-bottom: 40px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tip-wrapper code {
|
|
111
|
-
font-size: 12px;
|
|
112
|
-
display: inline-block;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
`}
|
|
116
|
-
</style>
|
|
117
|
-
|
|
118
|
-
[](https://agilitycms.com/)
|
|
119
|
-
# Agility Plenum UI Library
|
|
120
|
-
|
|
121
|
-
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.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## Building for the Agility Marketplace
|
|
125
|
-
|
|
126
|
-
The Plenum library is designed to encourage and facilitate building applications for the Agility CMS Marketplace. Use the rich selection of components and patterns to build consistent, robust, and user-friendly applications for the Agility ecosystem.
|
|
127
|
-
|
|
128
|
-
Contributions to extend and improve this library are welcome! Feel free to fork the repository and submit pull requests.
|
|
129
|
-
|
|
130
|
-
## Features
|
|
131
|
-
|
|
132
|
-
- Comprehensive UI components library, designed for versatility and consistency.
|
|
133
|
-
- Built with modern technologies like Next.js 13 and Storybook 7.1.
|
|
134
|
-
- Includes automation scripts for efficient component creation.
|
|
135
|
-
- Adopts Tailwind CSS for utility-first styling.
|
|
136
|
-
- Easy to use, install, and integrate into your project.
|
|
137
|
-
|
|
138
|
-
## Prerequisites
|
|
139
|
-
|
|
140
|
-
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)
|
|
141
|
-
|
|
142
|
-
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:
|
|
143
|
-
|
|
144
|
-
```jsx
|
|
145
|
-
import "<RELATIVE_PATH>/globals.css";
|
|
146
|
-
import "@agility/plenum-ui/dist/lib/tailwind.css";
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Make sure to add any additional styles before these two import statements to prevent overwriting the Plenum styling.
|
|
150
|
-
|
|
151
|
-
## Installation
|
|
152
|
-
|
|
153
|
-
You can install the Plenum library using npm or yarn:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
# Using npm:
|
|
157
|
-
npm install @agility/plenum-ui
|
|
158
|
-
|
|
159
|
-
# Using yarn:
|
|
160
|
-
yarn add @agility/plenum-ui
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Usage
|
|
164
|
-
|
|
165
|
-
Import and use the Plenum components in your React components:
|
|
166
|
-
|
|
167
|
-
```jsx
|
|
168
|
-
import { Component } from '@agility/plenum-ui';
|
|
169
|
-
|
|
170
|
-
<Component {...{ComponentProps}} />
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Scripts
|
|
174
|
-
|
|
175
|
-
### Development and Build Scripts
|
|
176
|
-
|
|
177
|
-
Run your development server with Storybook:
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
npm run dev
|
|
181
|
-
# or
|
|
182
|
-
yarn dev
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
Build your project:
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
npm run build
|
|
189
|
-
# or
|
|
190
|
-
yarn build
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Clean the \`dist\` directory:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
npm run clean
|
|
197
|
-
# or
|
|
198
|
-
yarn clean
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Lint your project:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
npm run lint
|
|
205
|
-
# or
|
|
206
|
-
yarn lint
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Build Tailwind CSS:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
npm run build:tw
|
|
213
|
-
# or
|
|
214
|
-
yarn build:tw
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Storybook Scripts
|
|
218
|
-
|
|
219
|
-
Build your Storybook:
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
npm run build-storybook
|
|
223
|
-
# or
|
|
224
|
-
yarn build-storybook
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Run your Storybook in development mode:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
npm run storybook:dev
|
|
231
|
-
# or
|
|
232
|
-
yarn storybook:dev
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
Generate Tailwind CSS for Storybook and watch for changes:
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
npm run storybook:tw
|
|
239
|
-
# or
|
|
240
|
-
yarn storybook:tw
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Build specific parts of Storybook:
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
# Build Storybook
|
|
247
|
-
npm run sb-build:storybook
|
|
248
|
-
# or
|
|
249
|
-
yarn sb-build:storybook
|
|
250
|
-
|
|
251
|
-
# Build Tailwind CSS for Storybook
|
|
252
|
-
npm run sb-build:tw
|
|
253
|
-
# or
|
|
254
|
-
yarn sb-build:tw
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
Compile TypeScript files using custom build script:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
npm run build:tsc
|
|
261
|
-
# or
|
|
262
|
-
yarn build:tsc
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
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.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
### Component Generation Script
|
|
269
|
-
|
|
270
|
-
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\`.
|
|
271
|
-
|
|
272
|
-
#### How to use the script
|
|
273
|
-
|
|
274
|
-
To use the script, you should have Node.js installed. From the terminal, you can create a new component by running the following command:
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
node create-component.js ComponentName DestinationDirectory
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
This command takes two arguments:
|
|
281
|
-
|
|
282
|
-
- \`ComponentName\` - The name of the new component you want to create. This should be in PascalCase (for example, "MyComponent").
|
|
283
|
-
- \`DestinationDirectory\` - The directory where the new component will be created. This should be relative to the 'stories' directory. (for example, "atoms" or "Molecules").
|
|
284
|
-
|
|
285
|
-
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:
|
|
286
|
-
|
|
287
|
-
- \`ComponentName.tsx\` - This is the component file. It contains a basic React functional component structure.
|
|
288
|
-
- \`ComponentName.stories.tsx\` - This is the Storybook story file. It sets up a basic story for the new component.
|
|
289
|
-
- \`index.tsx\` - This file simply exports the new component. It's used for cleaner imports.
|
|
290
|
-
|
|
291
|
-
#### Example
|
|
292
|
-
|
|
293
|
-
To create a new component named "Button" in the "atoms" directory, you would run:
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
node create-component.js Button atoms
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
This would create a directory structure like:
|
|
300
|
-
|
|
301
|
-
```
|
|
302
|
-
- stories
|
|
303
|
-
- atoms
|
|
304
|
-
- Button
|
|
305
|
-
- Button.tsx
|
|
306
|
-
- Button.stories.tsx
|
|
307
|
-
- index.tsx
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Each of the generated files will contain basic boilerplate code that you can start with.
|
|
311
|
-
|
|
312
|
-
##### Notes
|
|
313
|
-
|
|
314
|
-
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
|
|
1
|
+
import { Meta } from "@storybook/blocks"
|
|
2
|
+
import Code from "./assets/code-brackets.svg"
|
|
3
|
+
import Colors from "./assets/colors.svg"
|
|
4
|
+
import Comments from "./assets/comments.svg"
|
|
5
|
+
import Direction from "./assets/direction.svg"
|
|
6
|
+
import Flow from "./assets/flow.svg"
|
|
7
|
+
import Plugin from "./assets/plugin.svg"
|
|
8
|
+
import Repo from "./assets/repo.svg"
|
|
9
|
+
import StackAlt from "./assets/stackalt.svg"
|
|
10
|
+
|
|
11
|
+
<Meta title="Plenum Introduction" />
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
{`
|
|
15
|
+
.subheading {
|
|
16
|
+
--mediumdark: '#999999';
|
|
17
|
+
font-weight: 900;
|
|
18
|
+
font-size: 13px;
|
|
19
|
+
color: #999;
|
|
20
|
+
letter-spacing: 6px;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
text-transform: uppercase;
|
|
23
|
+
margin-bottom: 12px;
|
|
24
|
+
margin-top: 40px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.link-list {
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: 1fr;
|
|
30
|
+
grid-template-rows: 1fr 1fr;
|
|
31
|
+
row-gap: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (min-width: 620px) {
|
|
35
|
+
.link-list {
|
|
36
|
+
row-gap: 20px;
|
|
37
|
+
column-gap: 20px;
|
|
38
|
+
grid-template-columns: 1fr 1fr;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media all and (-ms-high-contrast:none) {
|
|
43
|
+
.link-list {
|
|
44
|
+
display: -ms-grid;
|
|
45
|
+
-ms-grid-columns: 1fr 1fr;
|
|
46
|
+
-ms-grid-rows: 1fr 1fr;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.link-item {
|
|
51
|
+
display: block;
|
|
52
|
+
padding: 20px 30px 20px 15px;
|
|
53
|
+
border: 1px solid #00000010;
|
|
54
|
+
border-radius: 5px;
|
|
55
|
+
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
|
|
56
|
+
color: #333333;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.link-item:hover {
|
|
62
|
+
border-color: #1EA7FD50;
|
|
63
|
+
transform: translate3d(0, -3px, 0);
|
|
64
|
+
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.link-item:active {
|
|
68
|
+
border-color: #1EA7FD;
|
|
69
|
+
transform: translate3d(0, 0, 0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.link-item strong {
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
display: block;
|
|
75
|
+
margin-bottom: 2px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.link-item img {
|
|
79
|
+
height: 40px;
|
|
80
|
+
width: 40px;
|
|
81
|
+
margin-right: 15px;
|
|
82
|
+
flex: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.link-item span {
|
|
86
|
+
font-size: 14px;
|
|
87
|
+
line-height: 20px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.tip {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
border-radius: 1em;
|
|
93
|
+
font-size: 11px;
|
|
94
|
+
line-height: 12px;
|
|
95
|
+
font-weight: 700;
|
|
96
|
+
background: #E7FDD8;
|
|
97
|
+
color: #66BF3C;
|
|
98
|
+
padding: 4px 12px;
|
|
99
|
+
margin-right: 10px;
|
|
100
|
+
vertical-align: top;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.tip-wrapper {
|
|
104
|
+
font-size: 13px;
|
|
105
|
+
line-height: 20px;
|
|
106
|
+
margin-top: 40px;
|
|
107
|
+
margin-bottom: 40px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.tip-wrapper code {
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
display: inline-block;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
`}
|
|
116
|
+
</style>
|
|
117
|
+
|
|
118
|
+
[](https://agilitycms.com/)
|
|
119
|
+
# Agility Plenum UI Library
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Building for the Agility Marketplace
|
|
125
|
+
|
|
126
|
+
The Plenum library is designed to encourage and facilitate building applications for the Agility CMS Marketplace. Use the rich selection of components and patterns to build consistent, robust, and user-friendly applications for the Agility ecosystem.
|
|
127
|
+
|
|
128
|
+
Contributions to extend and improve this library are welcome! Feel free to fork the repository and submit pull requests.
|
|
129
|
+
|
|
130
|
+
## Features
|
|
131
|
+
|
|
132
|
+
- Comprehensive UI components library, designed for versatility and consistency.
|
|
133
|
+
- Built with modern technologies like Next.js 13 and Storybook 7.1.
|
|
134
|
+
- Includes automation scripts for efficient component creation.
|
|
135
|
+
- Adopts Tailwind CSS for utility-first styling.
|
|
136
|
+
- Easy to use, install, and integrate into your project.
|
|
137
|
+
|
|
138
|
+
## Prerequisites
|
|
139
|
+
|
|
140
|
+
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)
|
|
141
|
+
|
|
142
|
+
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:
|
|
143
|
+
|
|
144
|
+
```jsx
|
|
145
|
+
import "<RELATIVE_PATH>/globals.css";
|
|
146
|
+
import "@agility/plenum-ui/dist/lib/tailwind.css";
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Make sure to add any additional styles before these two import statements to prevent overwriting the Plenum styling.
|
|
150
|
+
|
|
151
|
+
## Installation
|
|
152
|
+
|
|
153
|
+
You can install the Plenum library using npm or yarn:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Using npm:
|
|
157
|
+
npm install @agility/plenum-ui
|
|
158
|
+
|
|
159
|
+
# Using yarn:
|
|
160
|
+
yarn add @agility/plenum-ui
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Usage
|
|
164
|
+
|
|
165
|
+
Import and use the Plenum components in your React components:
|
|
166
|
+
|
|
167
|
+
```jsx
|
|
168
|
+
import { Component } from '@agility/plenum-ui';
|
|
169
|
+
|
|
170
|
+
<Component {...{ComponentProps}} />
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Scripts
|
|
174
|
+
|
|
175
|
+
### Development and Build Scripts
|
|
176
|
+
|
|
177
|
+
Run your development server with Storybook:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm run dev
|
|
181
|
+
# or
|
|
182
|
+
yarn dev
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Build your project:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm run build
|
|
189
|
+
# or
|
|
190
|
+
yarn build
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Clean the \`dist\` directory:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npm run clean
|
|
197
|
+
# or
|
|
198
|
+
yarn clean
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Lint your project:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm run lint
|
|
205
|
+
# or
|
|
206
|
+
yarn lint
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Build Tailwind CSS:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
npm run build:tw
|
|
213
|
+
# or
|
|
214
|
+
yarn build:tw
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Storybook Scripts
|
|
218
|
+
|
|
219
|
+
Build your Storybook:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
npm run build-storybook
|
|
223
|
+
# or
|
|
224
|
+
yarn build-storybook
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Run your Storybook in development mode:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
npm run storybook:dev
|
|
231
|
+
# or
|
|
232
|
+
yarn storybook:dev
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Generate Tailwind CSS for Storybook and watch for changes:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
npm run storybook:tw
|
|
239
|
+
# or
|
|
240
|
+
yarn storybook:tw
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Build specific parts of Storybook:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Build Storybook
|
|
247
|
+
npm run sb-build:storybook
|
|
248
|
+
# or
|
|
249
|
+
yarn sb-build:storybook
|
|
250
|
+
|
|
251
|
+
# Build Tailwind CSS for Storybook
|
|
252
|
+
npm run sb-build:tw
|
|
253
|
+
# or
|
|
254
|
+
yarn sb-build:tw
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Compile TypeScript files using custom build script:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
npm run build:tsc
|
|
261
|
+
# or
|
|
262
|
+
yarn build:tsc
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
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.
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
### Component Generation Script
|
|
269
|
+
|
|
270
|
+
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\`.
|
|
271
|
+
|
|
272
|
+
#### How to use the script
|
|
273
|
+
|
|
274
|
+
To use the script, you should have Node.js installed. From the terminal, you can create a new component by running the following command:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
node create-component.js ComponentName DestinationDirectory
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
This command takes two arguments:
|
|
281
|
+
|
|
282
|
+
- \`ComponentName\` - The name of the new component you want to create. This should be in PascalCase (for example, "MyComponent").
|
|
283
|
+
- \`DestinationDirectory\` - The directory where the new component will be created. This should be relative to the 'stories' directory. (for example, "atoms" or "Molecules").
|
|
284
|
+
|
|
285
|
+
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:
|
|
286
|
+
|
|
287
|
+
- \`ComponentName.tsx\` - This is the component file. It contains a basic React functional component structure.
|
|
288
|
+
- \`ComponentName.stories.tsx\` - This is the Storybook story file. It sets up a basic story for the new component.
|
|
289
|
+
- \`index.tsx\` - This file simply exports the new component. It's used for cleaner imports.
|
|
290
|
+
|
|
291
|
+
#### Example
|
|
292
|
+
|
|
293
|
+
To create a new component named "Button" in the "atoms" directory, you would run:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
node create-component.js Button atoms
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
This would create a directory structure like:
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
- stories
|
|
303
|
+
- atoms
|
|
304
|
+
- Button
|
|
305
|
+
- Button.tsx
|
|
306
|
+
- Button.stories.tsx
|
|
307
|
+
- index.tsx
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Each of the generated files will contain basic boilerplate code that you can start with.
|
|
311
|
+
|
|
312
|
+
##### Notes
|
|
313
|
+
|
|
314
|
+
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/stackalt</title><g id="illustration/stackalt" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#FFAE00" d="M23.8628277,0 L23.8628277,48 L3.32291648,36.2491883 L3.32155653,11.9499781 L23.8628277,0 Z M23.8670509,0 L44.408322,11.9499781 L44.4069621,36.2491883 L23.8670509,48 L23.8670509,0 Z" opacity=".196"/><path id="Rectangle-46-Copy-3" fill="#66BF3C" d="M15.8232279,19.1155258 L24.7368455,21.4714881 C29.6053842,22.7582937 33.4077423,26.5606518 34.694548,31.4291905 L37.0505103,40.3428082 C37.6150232,42.4786032 36.3412474,44.6676353 34.2054524,45.2321482 C33.5569474,45.4035549 32.87575,45.4091235 32.2245294,45.2483418 L23.3459013,43.0562718 C18.2976962,41.809906 14.3561301,37.8683399 13.1097642,32.8201348 L10.9176943,23.9415066 C10.3881737,21.7967682 11.6975664,19.6288529 13.8423049,19.0993322 C14.4935255,18.9385505 15.1747229,18.9441191 15.8232279,19.1155258 Z" opacity=".5" transform="translate(23.999997, 32.166058) rotate(-45.000000) translate(-23.999997, -32.166058)"/><path id="Rectangle-46-Copy-2" fill="#FFAE00" d="M15.8232279,11.2216893 L24.7368455,13.5776516 C29.6053842,14.8644572 33.4077423,18.6668153 34.694548,23.5353541 L37.0505103,32.4489717 C37.6150232,34.5847667 36.3412474,36.7737988 34.2054524,37.3383117 C33.5569474,37.5097184 32.87575,37.515287 32.2245294,37.3545053 L23.3459013,35.1624353 C18.2976962,33.9160695 14.3561301,29.9745034 13.1097642,24.9262983 L10.9176943,16.0476701 C10.3881737,13.9029317 11.6975664,11.7350164 13.8423049,11.2054957 C14.4935255,11.044714 15.1747229,11.0502826 15.8232279,11.2216893 Z" opacity=".5" transform="translate(23.999997, 24.272222) rotate(-45.000000) translate(-23.999997, -24.272222)"/><path id="Rectangle-46-Copy" fill="#FC521F" d="M15.8232279,3.32785281 L24.7368455,5.68381509 C29.6053842,6.97062075 33.4077423,10.7729788 34.694548,15.6415176 L37.0505103,24.5551352 C37.6150232,26.6909302 36.3412474,28.8799623 34.2054524,29.4444752 C33.5569474,29.6158819 32.87575,29.6214505 32.2245294,29.4606688 L23.3459013,27.2685988 C18.2976962,26.022233 14.3561301,22.0806669 13.1097642,17.0324618 L10.9176943,8.15383364 C10.3881737,6.00909519 11.6975664,3.84117987 13.8423049,3.31165925 C14.4935255,3.15087753 15.1747229,3.15644615 15.8232279,3.32785281 Z" opacity=".5" transform="translate(23.999997, 16.378385) rotate(-45.000000) translate(-23.999997, -16.378385)"/></g></svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/stackalt</title><g id="illustration/stackalt" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#FFAE00" d="M23.8628277,0 L23.8628277,48 L3.32291648,36.2491883 L3.32155653,11.9499781 L23.8628277,0 Z M23.8670509,0 L44.408322,11.9499781 L44.4069621,36.2491883 L23.8670509,48 L23.8670509,0 Z" opacity=".196"/><path id="Rectangle-46-Copy-3" fill="#66BF3C" d="M15.8232279,19.1155258 L24.7368455,21.4714881 C29.6053842,22.7582937 33.4077423,26.5606518 34.694548,31.4291905 L37.0505103,40.3428082 C37.6150232,42.4786032 36.3412474,44.6676353 34.2054524,45.2321482 C33.5569474,45.4035549 32.87575,45.4091235 32.2245294,45.2483418 L23.3459013,43.0562718 C18.2976962,41.809906 14.3561301,37.8683399 13.1097642,32.8201348 L10.9176943,23.9415066 C10.3881737,21.7967682 11.6975664,19.6288529 13.8423049,19.0993322 C14.4935255,18.9385505 15.1747229,18.9441191 15.8232279,19.1155258 Z" opacity=".5" transform="translate(23.999997, 32.166058) rotate(-45.000000) translate(-23.999997, -32.166058)"/><path id="Rectangle-46-Copy-2" fill="#FFAE00" d="M15.8232279,11.2216893 L24.7368455,13.5776516 C29.6053842,14.8644572 33.4077423,18.6668153 34.694548,23.5353541 L37.0505103,32.4489717 C37.6150232,34.5847667 36.3412474,36.7737988 34.2054524,37.3383117 C33.5569474,37.5097184 32.87575,37.515287 32.2245294,37.3545053 L23.3459013,35.1624353 C18.2976962,33.9160695 14.3561301,29.9745034 13.1097642,24.9262983 L10.9176943,16.0476701 C10.3881737,13.9029317 11.6975664,11.7350164 13.8423049,11.2054957 C14.4935255,11.044714 15.1747229,11.0502826 15.8232279,11.2216893 Z" opacity=".5" transform="translate(23.999997, 24.272222) rotate(-45.000000) translate(-23.999997, -24.272222)"/><path id="Rectangle-46-Copy" fill="#FC521F" d="M15.8232279,3.32785281 L24.7368455,5.68381509 C29.6053842,6.97062075 33.4077423,10.7729788 34.694548,15.6415176 L37.0505103,24.5551352 C37.6150232,26.6909302 36.3412474,28.8799623 34.2054524,29.4444752 C33.5569474,29.6158819 32.87575,29.6214505 32.2245294,29.4606688 L23.3459013,27.2685988 C18.2976962,26.022233 14.3561301,22.0806669 13.1097642,17.0324618 L10.9176943,8.15383364 C10.3881737,6.00909519 11.6975664,3.84117987 13.8423049,3.31165925 C14.4935255,3.15087753 15.1747229,3.15644615 15.8232279,3.32785281 Z" opacity=".5" transform="translate(23.999997, 16.378385) rotate(-45.000000) translate(-23.999997, -16.378385)"/></g></svg>
|