pdap-design-system 2.0.5 → 2.1.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 +41 -15
- package/bin/pdap-design-system-cli.js +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +429 -347
- package/dist/{index.d.ts → src/index.d.ts} +1 -0
- package/dist/tailwind.config.d.ts +2 -0
- package/docs/CONTRIBUTING.md +64 -0
- package/docs/components.md +555 -0
- package/package.json +42 -14
- package/CONTRIBUTING.md +0 -34
- package/dist/tools/testing/serializer.d.ts +0 -7
- package/dist/tools/testing/setup.d.ts +0 -1
- /package/dist/{components → src/components}/Button/PdapButton.vue.d.ts +0 -0
- /package/dist/{components → src/components}/Button/index.d.ts +0 -0
- /package/dist/{components → src/components}/Button/types.d.ts +0 -0
- /package/dist/{components → src/components}/FlexContainer/FlexContainer.vue.d.ts +0 -0
- /package/dist/{components → src/components}/FlexContainer/index.d.ts +0 -0
- /package/dist/{components → src/components}/FlexContainer/types.d.ts +0 -0
- /package/dist/{components → src/components}/Footer/PdapFooter.vue.d.ts +0 -0
- /package/dist/{components → src/components}/Footer/index.d.ts +0 -0
- /package/dist/{components → src/components}/Footer/types.d.ts +0 -0
- /package/dist/{components → src/components}/Form/PdapForm.vue.d.ts +0 -0
- /package/dist/{components → src/components}/Form/index.d.ts +0 -0
- /package/dist/{components → src/components}/Form/types.d.ts +0 -0
- /package/dist/{components → src/components}/GridContainer/GridContainer.vue.d.ts +0 -0
- /package/dist/{components → src/components}/GridContainer/index.d.ts +0 -0
- /package/dist/{components → src/components}/GridContainer/types.d.ts +0 -0
- /package/dist/{components → src/components}/GridItem/GridItem.vue.d.ts +0 -0
- /package/dist/{components → src/components}/GridItem/index.d.ts +0 -0
- /package/dist/{components → src/components}/GridItem/types.d.ts +0 -0
- /package/dist/{components → src/components}/Header/PdapHeader.vue.d.ts +0 -0
- /package/dist/{components → src/components}/Header/index.d.ts +0 -0
- /package/dist/{components → src/components}/Header/types.d.ts +0 -0
- /package/dist/{components → src/components}/Input/PdapInput.vue.d.ts +0 -0
- /package/dist/{components → src/components}/Input/index.d.ts +0 -0
- /package/dist/{components → src/components}/Input/types.d.ts +0 -0
- /package/dist/{components → src/components}/Input/utils.d.ts +0 -0
- /package/dist/{components → src/components}/Nav/PdapNav.vue.d.ts +0 -0
- /package/dist/{components → src/components}/Nav/index.d.ts +0 -0
- /package/dist/{components → src/components}/Nav/types.d.ts +0 -0
- /package/dist/{components → src/components}/QuickSearchForm/QuickSearchForm.vue.d.ts +0 -0
- /package/dist/{components → src/components}/QuickSearchForm/index.d.ts +0 -0
- /package/dist/{components → src/components}/TileIcon/TileIcon.vue.d.ts +0 -0
- /package/dist/{components → src/components}/TileIcon/index.d.ts +0 -0
- /package/dist/{components → src/components}/TileIcon/types.d.ts +0 -0
- /package/dist/{components → src/components}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/vuelidate.d.ts +0 -0
- /package/dist/{utils → src/utils}/vuelidate.test.d.ts +0 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
## Tech Stack
|
4
|
+
|
5
|
+
This is a `Vue` component library. It is built using `Vue3` and the `composition` API with TypeScript. Styles are created using `TailwindCSS`. The library is built using `Vite`. For testing, we use `Vitest`, for linting `eslint`, for formatting `prettier`. Conventional commits are enforced using `commitizen`, and publishing is done automatically via `semantic-release`.
|
6
|
+
Some helpful resources and reading:
|
7
|
+
|
8
|
+
[Commitizen](https://commitizen-tools.github.io/commitizen/)
|
9
|
+
[Semantic Release](https://semantic-release.gitbook.io/semantic-release/)
|
10
|
+
[Tailwind](https://tailwindui.com/documentation)
|
11
|
+
[TypeScript](https://www.typescriptlang.org/docs/)
|
12
|
+
[Vite](https://vitejs.dev/guide/)
|
13
|
+
[Vitest](https://vitest.dev/guide/)
|
14
|
+
[Vue Testing Handbook](https://lmiller1990.github.io/vue-testing-handbook/v3/)
|
15
|
+
[Vue.js](https://vuejs.org/guide/introduction.html)
|
16
|
+
[Vuelidate](https://vuelidate.js.org/)
|
17
|
+
|
18
|
+
### Etiquette
|
19
|
+
|
20
|
+
Head to [\#outreach](https://discord.com/channels/828274060034965575/853442226034442260/) in our [Discord](https://discord.gg/vKhDv7nC8B) if you'd like to collect feedback from the wider group.
|
21
|
+
|
22
|
+
Test your changes **locally first**, if possible. Include **screenshots with your PR** if you're changing something visual.
|
23
|
+
|
24
|
+
### Setup
|
25
|
+
|
26
|
+
1. [Clone the repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
|
27
|
+
2. Install `node@v20.6.1` (Recommended to [use `nvm` to manage `node` versions](https://github.com/nvm-sh/nvm))
|
28
|
+
3. `cd` into the project directory `cd design-system` and install dependencies `npm i`
|
29
|
+
|
30
|
+
### Workflow
|
31
|
+
1. Create a branch prefixed with the appropriate action (e.g. `feature/add-dropdown-component`, `fix/button-border-styles`).
|
32
|
+
2. Make your changes.
|
33
|
+
3. Commit your changes, using `npm run _commit` (this calls `commitizen`, which guides you through creating a conventional commit).*
|
34
|
+
|
35
|
+
|
36
|
+
* [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#specification) are strictly enforced. It is generally best to use `npm run _commit` or `cz`, if you have `commitizen` installed globally. Even if you commit using `git commit`, this repository uses `husky` to lint commit messages. If you must skip the pre-commit hook (useful for `git commit --amend`, etc.) you can pass `no-verify` to `git commit`. But we check commit messages again on pull request, so please make sure they are formatted according to the convention.
|
37
|
+
#### A few examples
|
38
|
+
```
|
39
|
+
# example 1
|
40
|
+
feat: Button
|
41
|
+
|
42
|
+
# example 2
|
43
|
+
fix(Button): update border styles
|
44
|
+
Bug in post-css causing....
|
45
|
+
|
46
|
+
BREAKING CHANGE
|
47
|
+
|
48
|
+
# example 3
|
49
|
+
docs(README): add button documentation
|
50
|
+
Document component API
|
51
|
+
```
|
52
|
+
|
53
|
+
### Why all this humbuggery about conventional commits?
|
54
|
+
Because we use `semantic-release` to auto-generate releases, `CHANGELOG` entries, etc., based on conventional commits, all commits need to follow the convention.
|
55
|
+
|
56
|
+
### Testing and verifying changes
|
57
|
+
To test the package locally:
|
58
|
+
|
59
|
+
1. Run `npm link` from the root of the project directory.
|
60
|
+
2. `cd` into the local directory of the app you want to test importing into, then run `npm link pdap-design-system`
|
61
|
+
3. This will create a symlink between your local directories, allowing you to test changes in real time without actually publish to the `npm` registry.
|
62
|
+
4. To test publishing, squash merge your local feature/fix/whatever branch into `main`. Then from `main` run `npm exec semantic-release --dry-run`. Then revert the squash merge commit.
|
63
|
+
|
64
|
+
The `lint`, `test`, and `build` scripts are all required to pass before pull requests can be merged. The `lint` scripts are run against all staged files, and you can run `test:changed` to verify test suites against all local changes (staged and unstaged) before committing. You can run `build` locally as well, if you want to verify that it will pass before pushing changes.
|
@@ -0,0 +1,555 @@
|
|
1
|
+
# PDAP Component Documentation
|
2
|
+
|
3
|
+
Documentation for PDAP component usage
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
- [Button](#button)
|
8
|
+
- [Props](#props)
|
9
|
+
- [Example](#example)
|
10
|
+
- [FlexContainer](#flexcontainer)
|
11
|
+
- [Props](#props-1)
|
12
|
+
- [Example](#example-1)
|
13
|
+
- [Footer](#footer)
|
14
|
+
- [Props](#props-2)
|
15
|
+
- [Example](#example-2)
|
16
|
+
- [Form](#form)
|
17
|
+
- [Props](#props-3)
|
18
|
+
- [Example](#example-3)
|
19
|
+
- [GridContainer](#gridcontainer)
|
20
|
+
- [Props](#props-4)
|
21
|
+
- [Example](#example-4)
|
22
|
+
- [GridItem](#griditem)
|
23
|
+
- [Props](#props-5)
|
24
|
+
- [Example](#example-5)
|
25
|
+
- [Header](#header)
|
26
|
+
- [Props](#props-6)
|
27
|
+
- [Example](#example-6)
|
28
|
+
- [Input](#input)
|
29
|
+
- [Nav](#nav)
|
30
|
+
- [Example](#example-7)
|
31
|
+
- [QuickSearchForm](#quicksearchform)
|
32
|
+
- [Props](#props-7)
|
33
|
+
- [TileIcon](#tileicon)
|
34
|
+
- [Props](#props-8)
|
35
|
+
- [Example](#example-8)
|
36
|
+
|
37
|
+
## Button
|
38
|
+
|
39
|
+
### _Props_
|
40
|
+
|
41
|
+
| name | required? | types | description | default |
|
42
|
+
| ----------- | --------- | ------------------------ | -------------------------- | --------- |
|
43
|
+
| `isLoading` | no | `boolean` | Request state | `false` |
|
44
|
+
| `intent` | yes | `primary` \| `secondary` | Determines style of button | `primary` |
|
45
|
+
|
46
|
+
### _Example_
|
47
|
+
|
48
|
+
```
|
49
|
+
<template>
|
50
|
+
<Button class="custom-btn-class" intent="primary" @click="() => console.log('hello world')" type="button">Click me</Button>
|
51
|
+
</template>
|
52
|
+
|
53
|
+
...
|
54
|
+
|
55
|
+
<script>
|
56
|
+
import { Button } from 'pdap-design-system';
|
57
|
+
|
58
|
+
...
|
59
|
+
|
60
|
+
export default {
|
61
|
+
components: ['Button'],
|
62
|
+
...
|
63
|
+
}
|
64
|
+
</script>
|
65
|
+
|
66
|
+
...
|
67
|
+
|
68
|
+
<style>
|
69
|
+
.custom-btn-class {
|
70
|
+
padding: 12px;
|
71
|
+
}
|
72
|
+
</style>
|
73
|
+
```
|
74
|
+
|
75
|
+
## FlexContainer
|
76
|
+
|
77
|
+
All container components are designed to be dynamic and take any `HTMLElement` tag as the component to be rendered. `FlexContainer` can itself be passed as the element type for `GridItem`, for example, or vice versa, allowing us to easily compose complex layouts (more on this later with the `GridContainer` and `GridItem` documentation).
|
78
|
+
|
79
|
+
### _Props_
|
80
|
+
|
81
|
+
| name | required? | types | description | default |
|
82
|
+
| ----------- | --------- | ------------------- | ----------------------------------- | ------- |
|
83
|
+
| `component` | no | `string` | HTML Element to render as container | `'div'` |
|
84
|
+
| `alignment` | no | `start` \| `center` | Flex alignment presets | `start` |
|
85
|
+
|
86
|
+
### _Example_
|
87
|
+
|
88
|
+
```
|
89
|
+
<template>
|
90
|
+
<FlexContainer alignment="center" component="card">
|
91
|
+
<h2>Some content goes here</h2>
|
92
|
+
<p>More content goes here.</p>
|
93
|
+
<Button class="custom-button-class-name" :isLoading="isLoading" @click="() => console.log('hello world')">
|
94
|
+
Say hello with this button
|
95
|
+
</Button>
|
96
|
+
</FlexContainer>
|
97
|
+
</template>
|
98
|
+
|
99
|
+
...
|
100
|
+
|
101
|
+
<script>
|
102
|
+
import { Button, FlexContainer } from 'pdap-design-system';
|
103
|
+
|
104
|
+
...
|
105
|
+
|
106
|
+
export default {
|
107
|
+
components: ['Button', 'FlexContainer'],
|
108
|
+
props: ['requestPending', ...],
|
109
|
+
data() {
|
110
|
+
return {
|
111
|
+
isLoading: this.requestPending
|
112
|
+
}
|
113
|
+
}
|
114
|
+
...
|
115
|
+
}
|
116
|
+
</script>
|
117
|
+
```
|
118
|
+
|
119
|
+
## Footer
|
120
|
+
|
121
|
+
### _Props_
|
122
|
+
|
123
|
+
| name | required? | types | description | default |
|
124
|
+
| --------------------- | --------- | -------- | ---------------------- | ----------------------------------------------------------- |
|
125
|
+
| `logoImageSrc` | no | `string` | Source of logo image | `'node_modules/pdap-design-system/dist/images/acronym.svg'` |
|
126
|
+
| `logoImageAnchorPath` | no | `string` | Flex alignment presets | `/` |
|
127
|
+
|
128
|
+
### _Notes_
|
129
|
+
|
130
|
+
The `Footer` component provides support for overriding the default social links. The `links` variable is `inject`ed by the component, using the following defaults:
|
131
|
+
|
132
|
+
```
|
133
|
+
export default {
|
134
|
+
...
|
135
|
+
inject: {
|
136
|
+
footerLinks: {
|
137
|
+
default: [
|
138
|
+
{
|
139
|
+
to: 'https://github.com/orgs/Police-Data-Accessibility-Project',
|
140
|
+
text: 'Github',
|
141
|
+
},
|
142
|
+
{
|
143
|
+
to: 'ttps://discord.gg/wMqex8nKZJ',
|
144
|
+
text: 'Discord',
|
145
|
+
},
|
146
|
+
{
|
147
|
+
to: 'https://www.linkedin.com/company/pdap',
|
148
|
+
text: 'LinkedIn',
|
149
|
+
},
|
150
|
+
]
|
151
|
+
}
|
152
|
+
},
|
153
|
+
data() {
|
154
|
+
return {
|
155
|
+
links: this.footerLinks;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
```
|
160
|
+
|
161
|
+
If we desire different links somewhere that `Footer` is rendered, simply `provide` an overriding array from a parent component, like so:
|
162
|
+
|
163
|
+
### _Example_
|
164
|
+
|
165
|
+
```
|
166
|
+
<template>
|
167
|
+
<Header />
|
168
|
+
<router-view />
|
169
|
+
<Footer />
|
170
|
+
</template>
|
171
|
+
|
172
|
+
...
|
173
|
+
|
174
|
+
<script>
|
175
|
+
import { Header, Footer } from 'pdap-design-system';
|
176
|
+
import { RouterView } from 'vue-router'
|
177
|
+
|
178
|
+
...
|
179
|
+
|
180
|
+
export default {
|
181
|
+
name: 'Layout',
|
182
|
+
components: ['Header', 'Footer'],
|
183
|
+
...
|
184
|
+
provide: {
|
185
|
+
navLinks: [...]
|
186
|
+
}
|
187
|
+
}
|
188
|
+
</script>
|
189
|
+
|
190
|
+
```
|
191
|
+
|
192
|
+
## Form
|
193
|
+
|
194
|
+
The `Form` component is powerful. All you need to do is pass a few props, and the component will generate inputs and render them in the UI, complete with customizable form validation and both form-level and input-level error states.
|
195
|
+
|
196
|
+
### _Props_
|
197
|
+
|
198
|
+
| name | required? | types | description | default |
|
199
|
+
| -------- | --------- | --------------------------------- | ---------------------------------- | ----------- |
|
200
|
+
| `error` | no | `string` \| `undefined` \| `null` | Error state | `undefined` |
|
201
|
+
| `id` | yes | `string` | Form id | none |
|
202
|
+
| `name` | yes | `string` | Form name | none |
|
203
|
+
| `schema` | yes | `PdapFormSchema` | Array of schema entries for inputs | none |
|
204
|
+
|
205
|
+
### _Notes_
|
206
|
+
|
207
|
+
- Form schema entries can look different depending on the type of input. We currently only use text inputs, so the example only displays these.
|
208
|
+
- To properly submit the form, you must render a button with `type="submit"` _inside_ of the `Form` component.
|
209
|
+
- `Form` emits a `submit` event and passes all values to the handler you pass to `on-submit`
|
210
|
+
- Currently available form validations are defined by the `PdapFormValidators` interface:
|
211
|
+
|
212
|
+
```
|
213
|
+
|
214
|
+
PdapFormValidators {
|
215
|
+
maxLength: {
|
216
|
+
message?: string;
|
217
|
+
value: number;
|
218
|
+
};
|
219
|
+
minLength: {
|
220
|
+
message?: string;
|
221
|
+
value: number;
|
222
|
+
};
|
223
|
+
required: {
|
224
|
+
message?: string;
|
225
|
+
value: boolean;
|
226
|
+
};
|
227
|
+
}
|
228
|
+
|
229
|
+
```
|
230
|
+
|
231
|
+
- The `message` property is optional. If it is not passed, Vuelidate will default to a generic error message. The `value` property is the value you want to validate against. (i.e. for a required field with a max length of 12 characters, we might pass:
|
232
|
+
|
233
|
+
```
|
234
|
+
// For a custom message
|
235
|
+
{
|
236
|
+
...,
|
237
|
+
validators: {
|
238
|
+
maxLength: {
|
239
|
+
message: 'No more than twelve characters, please!',
|
240
|
+
value: 12
|
241
|
+
},
|
242
|
+
required: {
|
243
|
+
message: 'Pretty please enter this field.',
|
244
|
+
value: true
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
// For the default Vuelidate message
|
250
|
+
{
|
251
|
+
...,
|
252
|
+
validators: {
|
253
|
+
maxLength: {
|
254
|
+
value: 12
|
255
|
+
},
|
256
|
+
required: {
|
257
|
+
value: true
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
|
263
|
+
```
|
264
|
+
|
265
|
+
)
|
266
|
+
|
267
|
+
### _Example_
|
268
|
+
|
269
|
+
```
|
270
|
+
|
271
|
+
<template>
|
272
|
+
<Form :schema="formSchema" :on-submit="handleSubmit" id="test-form" name="data-request-form">
|
273
|
+
<Button intent="primary" type="submit">Click me</Button>
|
274
|
+
</Form>
|
275
|
+
</template>
|
276
|
+
|
277
|
+
...
|
278
|
+
|
279
|
+
<script>
|
280
|
+
import { Button, Form, PdapInputTypes } from 'pdap-design-system';
|
281
|
+
|
282
|
+
...
|
283
|
+
|
284
|
+
export default {
|
285
|
+
components: ['Button', 'Form'],
|
286
|
+
data() {
|
287
|
+
return {
|
288
|
+
formSchema: [
|
289
|
+
{
|
290
|
+
id: 'testfirstname',
|
291
|
+
name: 'firstName',
|
292
|
+
label: 'First Name',
|
293
|
+
type: 'text',
|
294
|
+
placeholder: 'John',
|
295
|
+
value: '',
|
296
|
+
validators: {
|
297
|
+
minLength: {
|
298
|
+
value: 3
|
299
|
+
},
|
300
|
+
required: {
|
301
|
+
message: 'Please provide this information',
|
302
|
+
value: true
|
303
|
+
}
|
304
|
+
},
|
305
|
+
},
|
306
|
+
{
|
307
|
+
id: 'testlastname',
|
308
|
+
name: 'lastName',
|
309
|
+
label: 'Last Name',
|
310
|
+
type: 'text',
|
311
|
+
placeholder: 'Doe',
|
312
|
+
value: '',
|
313
|
+
validators: {
|
314
|
+
minLength: {
|
315
|
+
value: 3
|
316
|
+
},
|
317
|
+
maxLength: {
|
318
|
+
message: 'A thousand characters for your surname? Are you a bot?',
|
319
|
+
value: 999
|
320
|
+
},
|
321
|
+
},
|
322
|
+
}
|
323
|
+
]
|
324
|
+
}
|
325
|
+
},
|
326
|
+
methods: {
|
327
|
+
handleSubmit: async function(data) {
|
328
|
+
await doRequestStuff(data);
|
329
|
+
this.$router.push('/')
|
330
|
+
}
|
331
|
+
}
|
332
|
+
...
|
333
|
+
}
|
334
|
+
</script>
|
335
|
+
|
336
|
+
```
|
337
|
+
|
338
|
+
## GridContainer
|
339
|
+
|
340
|
+
All container components are designed to be dynamic and take any `HTMLElement` tag as the component to be rendered. It also works with the `GridItem` component (see example below). `GridContainer` and `GridItem` could both be passed as the element type for `FlexContainer`, for example, or vice versa, allowing us to easily compose complex layouts.
|
341
|
+
|
342
|
+
### _Props_
|
343
|
+
|
344
|
+
| name | required? | types | description | default |
|
345
|
+
| ----------------- | --------- | ----------------------------- | --------------------------------------------------- | ------------------- |
|
346
|
+
| `columns` | no | `1` \| `2` \| `3` \| `'auto'` | Number of grid columns | `'auto'` |
|
347
|
+
| `component` | no | `string` | HTML Element to render as container | `'div'` |
|
348
|
+
| `rows` | no | `number` \| `'auto'` | Number of grid rows | `'auto'` |
|
349
|
+
| `templateColumns` | no | `string` \| `undefined` | Custom `grid-template-columns` value, passed inline | `undefined` (no-op) |
|
350
|
+
| `templateRows` | no | `string` \| `undefined` | Custom `grid-template-rows` value, passed inline | `undefined` (no-op) |
|
351
|
+
|
352
|
+
### _Notes_
|
353
|
+
|
354
|
+
- Grid layouts max out at 3 columns, and responsiveness is baked in.
|
355
|
+
- i.e. When you render a 3-column grid layout, it automatically resizes to 2 columns, then 1 column, as screen widths decrease.
|
356
|
+
- In this case, it is a best practice to leave the `rows` prop as its default `'auto'` value, to ensure that the layout fills as many rows as are needed when the number of columns decreases
|
357
|
+
|
358
|
+
### _Example_
|
359
|
+
|
360
|
+
```
|
361
|
+
<template>
|
362
|
+
<GridContainer :columns="3" component="section">
|
363
|
+
<GridItem component="FlexContainer">
|
364
|
+
<h2>Some content goes here</h2>
|
365
|
+
<p>More content goes here.</p>
|
366
|
+
<Button class="custom-button-class-name" :isLoading="isLoading" @click="() => console.log('hello world')">
|
367
|
+
Say hello with this button
|
368
|
+
</Button>
|
369
|
+
</GridItem>
|
370
|
+
</GridContainer>
|
371
|
+
</template>
|
372
|
+
|
373
|
+
...
|
374
|
+
|
375
|
+
<script>
|
376
|
+
import { Button, FlexContainer } from 'pdap-design-system';
|
377
|
+
|
378
|
+
...
|
379
|
+
|
380
|
+
export default {
|
381
|
+
components: ['Button', 'FlexContainer', 'GridContainer', 'GridItem'],
|
382
|
+
props: ['requestPending', ...],
|
383
|
+
data() {
|
384
|
+
return {
|
385
|
+
isLoading: this.requestPending
|
386
|
+
}
|
387
|
+
},
|
388
|
+
...
|
389
|
+
}
|
390
|
+
</script>
|
391
|
+
```
|
392
|
+
|
393
|
+
## GridItem
|
394
|
+
|
395
|
+
### _Props_
|
396
|
+
|
397
|
+
| name | required? | types | description | default |
|
398
|
+
| ------------ | --------- | ----------------- | ----------------------------------- | ------- |
|
399
|
+
| `component` | no | `string` | HTML Element to render as grid item | `'div'` |
|
400
|
+
| `spanColumn` | no | `1` \| `2` \| `3` | Columns grid item should span | `1` |
|
401
|
+
| `spanRow` | no | `number` | Rows grid item should span | `1` |
|
402
|
+
|
403
|
+
### _Notes_
|
404
|
+
|
405
|
+
- Grid layouts max out at 3 columns, and responsiveness is baked in.
|
406
|
+
- i.e. When you render a 3-column grid layout, it automatically resizes to 2 columns, then 1 column, as screen widths decrease.
|
407
|
+
- In this case, it is a best practice to leave the `rows` prop as its default `'auto'` value, to ensure that the layout fills as many rows as are needed when the number of columns decreases
|
408
|
+
|
409
|
+
### _Example_
|
410
|
+
|
411
|
+
See `GridContainer` above.
|
412
|
+
|
413
|
+
## Header
|
414
|
+
|
415
|
+
### _Props_
|
416
|
+
|
417
|
+
| name | required? | types | description | default |
|
418
|
+
| --------------------- | --------- | -------- | ---------------------- | ---------------------------------------------------------- |
|
419
|
+
| `logoImageSrc` | no | `string` | Source of logo image | `'node_modules/pdap-design-system/dist/images/lockup.svg'` |
|
420
|
+
| `logoImageAnchorPath` | no | `string` | Flex alignment presets | `/` |
|
421
|
+
|
422
|
+
### _Notes_
|
423
|
+
|
424
|
+
The `Header` component does not require any props to be passed. But keep in mind that it is responsible for rendering the `Nav` component. Consuming applications will need to `provide` an array of nav links — **there are no defaults for this**, you must `provide` these links either 1. in a layout component (see example below), at the route level, or at the app level. This allows for flexibility in which links are rendered on which routes
|
425
|
+
|
426
|
+
### _Example_
|
427
|
+
|
428
|
+
```
|
429
|
+
<template>
|
430
|
+
<Header />
|
431
|
+
<router-view />
|
432
|
+
<Footer />
|
433
|
+
</template>
|
434
|
+
|
435
|
+
...
|
436
|
+
|
437
|
+
<script>
|
438
|
+
import { Header, Footer } from 'pdap-design-system';
|
439
|
+
import { RouterView } from 'vue-router'
|
440
|
+
|
441
|
+
...
|
442
|
+
|
443
|
+
export default {
|
444
|
+
name: 'Layout',
|
445
|
+
components: ['Header', 'Footer'],
|
446
|
+
...
|
447
|
+
provide: {
|
448
|
+
navLinks: [...]
|
449
|
+
}
|
450
|
+
}
|
451
|
+
</script>
|
452
|
+
|
453
|
+
```
|
454
|
+
|
455
|
+
## Input
|
456
|
+
|
457
|
+
Inputs are rendered by the `Form` component via a schema. Please see `Form` for more details
|
458
|
+
|
459
|
+
## Nav
|
460
|
+
|
461
|
+
You do not need to render `Nav` directly. `Header` takes care of that. But you do need to `provide` nav link data from a parent component. This allows for nav links to be dynamic depending on where `Header` is rendered.
|
462
|
+
|
463
|
+
### _Example_
|
464
|
+
|
465
|
+
```
|
466
|
+
|
467
|
+
<template>
|
468
|
+
<Header />
|
469
|
+
<router-view />
|
470
|
+
<Footer />
|
471
|
+
</template>
|
472
|
+
|
473
|
+
...
|
474
|
+
|
475
|
+
<script>
|
476
|
+
import { Footer, Header } from 'pdap-design-system';
|
477
|
+
import { RouterView } from 'vue-router';
|
478
|
+
|
479
|
+
...
|
480
|
+
|
481
|
+
export default {
|
482
|
+
name: 'Layout',
|
483
|
+
components: ['Footer', 'Header'],
|
484
|
+
provide: {
|
485
|
+
navLinks: [
|
486
|
+
{ path: '/', text: 'Home', method: 'path' },
|
487
|
+
{ path: '/a', text: 'a', method: 'path' },
|
488
|
+
{ path: '/b', text: 'b', method: 'path' },
|
489
|
+
{ path: '/c', text: 'c', method: 'path' },
|
490
|
+
{ href: 'https://www.google.com', text: 'Go to Google', method: 'href' },
|
491
|
+
]
|
492
|
+
}
|
493
|
+
...
|
494
|
+
|
495
|
+
```
|
496
|
+
|
497
|
+
## QuickSearchForm
|
498
|
+
|
499
|
+
### _Props_
|
500
|
+
|
501
|
+
| name | required? | types | description | default |
|
502
|
+
| ------ | --------- | ----------------- | -------------------------------------------------------------------------- | -------- |
|
503
|
+
| `mode` | no | `'dev' \| 'prod'` | env. controls which url users are sent to when form is rendered on pdap.io | `'prod'` |
|
504
|
+
|
505
|
+
### _Notes_
|
506
|
+
|
507
|
+
The different `mode` prop values result the following base url values in the eventual navigation
|
508
|
+
| value | base url |
|
509
|
+
|--|--|
|
510
|
+
| `'dev'` | `'https://data-sources.pdap.dev'` |
|
511
|
+
| `'prod'` | `'https://data-sources.pdap.io'` |
|
512
|
+
|
513
|
+
## TileIcon
|
514
|
+
|
515
|
+
### _Props_
|
516
|
+
|
517
|
+
| name | required? | types | description | default |
|
518
|
+
| ------------ | --------- | -------- | ----------------------------- | ------- |
|
519
|
+
| `imgAltText` | yes | `string` | Descriptive alt text for icon | none |
|
520
|
+
| `imgSrc` | yes | `string` | Source of icon to render | none |
|
521
|
+
|
522
|
+
### _Example_
|
523
|
+
|
524
|
+
```
|
525
|
+
|
526
|
+
<template>
|
527
|
+
<GridContainer :columns="3" component="section">
|
528
|
+
<GridItem>
|
529
|
+
<TileIcon :imgAltText="altText" :imgSrc="imagePath" >
|
530
|
+
</GridItem>
|
531
|
+
</GridContainer>
|
532
|
+
</template>
|
533
|
+
|
534
|
+
...
|
535
|
+
|
536
|
+
<script>
|
537
|
+
import { Header, Footer } from 'pdap-design-system';
|
538
|
+
import { RouterView } from 'vue-router'
|
539
|
+
|
540
|
+
...
|
541
|
+
|
542
|
+
export default {
|
543
|
+
name: 'Layout',
|
544
|
+
components: ['GridContainer', 'GridItem', 'TileIcon'],
|
545
|
+
props: ['alt', 'src'],
|
546
|
+
data() {
|
547
|
+
return {
|
548
|
+
altText: this.alt,
|
549
|
+
imgSrc: this.src
|
550
|
+
}
|
551
|
+
}
|
552
|
+
}
|
553
|
+
</script>
|
554
|
+
|
555
|
+
```
|