pdap-design-system 2.7.0-beta.3 → 2.7.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/README.md +19 -18
  2. package/dist/components/Breadcrumbs/PdapBreadcrumbs.vue.d.ts +9 -0
  3. package/dist/components/Breadcrumbs/index.d.ts +1 -2
  4. package/dist/components/Button/PdapButton.vue.d.ts +9 -0
  5. package/dist/components/Button/index.d.ts +1 -2
  6. package/dist/components/Dropdown/PdapDropdown.vue.d.ts +10 -0
  7. package/dist/components/ErrorBoundary/PdapErrorBoundary.vue.d.ts +82 -16
  8. package/dist/components/ErrorBoundary/index.d.ts +1 -0
  9. package/dist/components/ErrorBoundary/types.d.ts +11 -0
  10. package/dist/components/Footer/PdapFooter.vue.d.ts +8 -0
  11. package/dist/components/Form/PdapForm.vue.d.ts +105 -2
  12. package/dist/components/Header/PdapHeader.vue.d.ts +11 -0
  13. package/dist/components/Nav/PdapNav.vue.d.ts +37 -0
  14. package/dist/components/QuickSearchForm/QuickSearchForm.vue.d.ts +14 -0
  15. package/dist/components/TileIcon/TileIcon.vue.d.ts +3 -0
  16. package/dist/components/index.d.ts +1 -3
  17. package/dist/index.cjs +2 -2
  18. package/dist/index.d.ts +1 -3
  19. package/dist/index.js +623 -653
  20. package/dist/styles.css +1 -1
  21. package/docs/components.md +13 -533
  22. package/package.json +3 -2
  23. package/dist/components/FlexContainer/FlexContainer.vue.d.ts +0 -37
  24. package/dist/components/FlexContainer/index.d.ts +0 -2
  25. package/dist/components/FlexContainer/types.d.ts +0 -4
  26. package/dist/components/GridContainer/GridContainer.vue.d.ts +0 -40
  27. package/dist/components/GridContainer/index.d.ts +0 -2
  28. package/dist/components/GridContainer/types.d.ts +0 -7
  29. package/dist/components/GridItem/GridItem.vue.d.ts +0 -40
  30. package/dist/components/GridItem/index.d.ts +0 -2
  31. package/dist/components/GridItem/types.d.ts +0 -5
@@ -1,533 +1,13 @@
1
- # PDAP Component Documentation
2
-
3
- Documentation for PDAP component usage
4
-
5
- ## Table of Contents
6
-
7
- - [Breadcrumbs](#breadcrumbs)
8
-
9
- - [Props](#props)
10
- - [Example](#example)
11
-
12
- - [Button](#button)
13
-
14
- - [Props](#props-1)
15
-
16
- - [Example](#example-1)
17
-
18
- - [FlexContainer](#flexcontainer)
19
-
20
- - [Props](#props-2)
21
-
22
- - [Example](#example-2)
23
-
24
- - [Footer](#footer)
25
-
26
- - [Props](#props-3)
27
-
28
- - [Example](#example-3)
29
-
30
- - [Form](#form)
31
-
32
- - [Props](#props-4)
33
-
34
- - [Example](#example-4)
35
-
36
- - [GridContainer](#gridcontainer)
37
-
38
- - [Props](#props-5)
39
-
40
- - [Example](#example-5)
41
-
42
- - [GridItem](#griditem)
43
-
44
- - [Props](#props-6)
45
-
46
- - [Example](#example-6)
47
-
48
- - [Header](#header)
49
-
50
- - [Props](#props-7)
51
- - [Example](#example-7)
52
-
53
- - [Input](#input)
54
-
55
- - [Nav](#nav)
56
-
57
- - [Example](#example-8)
58
-
59
- - [QuickSearchForm](#quicksearchform)
60
-
61
- - [Props](#props-8)
62
-
63
- - [TileIcon](#tileicon)
64
-
65
- - [Props](#props-9)
66
-
67
- - [Example](#example-9)
68
-
69
- - [Dropdown](#dropdown)
70
-
71
- - [Props](#props-9)
72
-
73
- - [Example](#example-9)
74
-
75
- ## Button
76
-
77
- ### _Props_
78
-
79
- None
80
-
81
- ### _Example_
82
-
83
- See the Demo application [page](../src/demo/pages/ComponentDemo.vue) and [router](../src/demo/router.js)
84
-
85
- ...
86
-
87
- ## Footer
88
-
89
- ### _Props_
90
-
91
- name | required? | types | description | default
92
- --------------------- | --------- | -------- | ---------------------- | -----------------------------------------------------------
93
- `logoImageSrc` | no | `string` | Source of logo image | `'node_modules/pdap-design-system/dist/images/acronym.svg'`
94
- `logoImageAnchorPath` | no | `string` | Flex alignment presets | `/`
95
-
96
- ### _Notes_
97
-
98
- The `Footer` component provides support for overriding the default social links. The `links` variable is `inject`ed by the component, using the following defaults:
99
-
100
- ```
101
- export default {
102
- ...
103
- inject: {
104
- footerLinks: {
105
- default: [
106
- {
107
- to: 'https://github.com/orgs/Police-Data-Accessibility-Project',
108
- text: 'Github',
109
- },
110
- {
111
- to: 'ttps://discord.gg/wMqex8nKZJ',
112
- text: 'Discord',
113
- },
114
- {
115
- to: 'https://www.linkedin.com/company/pdap',
116
- text: 'LinkedIn',
117
- },
118
- ]
119
- }
120
- },
121
- data() {
122
- return {
123
- links: this.footerLinks;
124
- }
125
- }
126
- }
127
- ```
128
-
129
- If we desire different links somewhere that `Footer` is rendered, simply `provide` an overriding array from a parent component, like so:
130
-
131
- ### _Example_
132
-
133
- ```
134
- <template>
135
- <Header />
136
- <router-view />
137
- <Footer />
138
- </template>
139
-
140
- ...
141
-
142
- <script>
143
- import { Header, Footer } from 'pdap-design-system';
144
- import { RouterView } from 'vue-router'
145
-
146
- ...
147
-
148
- export default {
149
- name: 'Layout',
150
- components: ['Header', 'Footer'],
151
- ...
152
- provide: {
153
- navLinks: [...]
154
- }
155
- }
156
- </script>
157
- ```
158
-
159
- ## Form
160
-
161
- 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.
162
-
163
- ### _Props_
164
-
165
- name | required? | types | description | default
166
- -------- | --------- | ---------------- | ---------------------------------- | -------
167
- `error` | no | `string` \ | `undefined` \ | `null` | Error state | `undefined`
168
- `id` | yes | `string` | Form id | none
169
- `name` | yes | `string` | Form name | none
170
- `schema` | yes | `PdapFormSchema` | Array of schema entries for inputs | none
171
-
172
- ### _Notes_
173
-
174
- - Form schema entries can look different depending on the type of input. We currently only use text inputs, so the example only displays these.
175
- - To properly submit the form, you must render a button with `type="submit"` _inside_ of the `Form` component.
176
- - `Form` emits a `submit` event and passes all values to the handler you pass to `on-submit`
177
- - Currently available form validations are defined by the `PdapFormValidators` interface:
178
-
179
- ```
180
- PdapFormValidators {
181
- maxLength: {
182
- message?: string;
183
- value: number;
184
- };
185
- minLength: {
186
- message?: string;
187
- value: number;
188
- };
189
- required: {
190
- message?: string;
191
- value: boolean;
192
- };
193
- }
194
- ```
195
-
196
- - 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:
197
-
198
- ```
199
- // For a custom message
200
- {
201
- ...,
202
- validators: {
203
- maxLength: {
204
- message: 'No more than twelve characters, please!',
205
- value: 12
206
- },
207
- required: {
208
- message: 'Pretty please enter this field.',
209
- value: true
210
- }
211
- }
212
- }
213
-
214
- // For the default Vuelidate message
215
- {
216
- ...,
217
- validators: {
218
- maxLength: {
219
- value: 12
220
- },
221
- required: {
222
- value: true
223
- }
224
- }
225
- }
226
- ```
227
-
228
- )
229
-
230
- ### _Example_
231
-
232
- ```
233
- <template>
234
- <Form :schema="formSchema" :on-submit="handleSubmit" id="test-form" name="data-request-form">
235
- <Button intent="primary" type="submit">Click me</Button>
236
- </Form>
237
- </template>
238
-
239
- ...
240
-
241
- <script>
242
- import { Button, Form, PdapInputTypes } from 'pdap-design-system';
243
-
244
- ...
245
-
246
- export default {
247
- components: ['Button', 'Form'],
248
- data() {
249
- return {
250
- formSchema: [
251
- {
252
- id: 'testfirstname',
253
- name: 'firstName',
254
- label: 'First Name',
255
- type: 'text',
256
- placeholder: 'John',
257
- value: '',
258
- validators: {
259
- minLength: {
260
- value: 3
261
- },
262
- required: {
263
- message: 'Please provide this information',
264
- value: true
265
- }
266
- },
267
- },
268
- {
269
- id: 'testlastname',
270
- name: 'lastName',
271
- label: 'Last Name',
272
- type: 'text',
273
- placeholder: 'Doe',
274
- value: '',
275
- validators: {
276
- minLength: {
277
- value: 3
278
- },
279
- maxLength: {
280
- message: 'A thousand characters for your surname? Are you a bot?',
281
- value: 999
282
- },
283
- },
284
- {
285
- id: 'ice-cream',
286
- name: 'iceCream',
287
- label: 'Do you like ice cream?',
288
- type: 'checkbox',
289
- defaultChecked: true,
290
- }
291
- ]
292
- }
293
- },
294
- methods: {
295
- handleSubmit: async function(data) {
296
- await doRequestStuff(data);
297
- this.$router.push('/')
298
- }
299
- }
300
- ...
301
- }
302
- </script>
303
- ```
304
-
305
- ## GridContainer
306
-
307
- _DEPRECATED_ 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.
308
-
309
- ### _Props_
310
-
311
- name | required? | types | description | default
312
- ----------------- | --------- | ---------- | ----------------------------------- | ---------------------------------------------------
313
- `columns` | no | `1` \ | `2` \ | `3` \ | `'auto'` | Number of grid columns | `'auto'`
314
- `component` | no | `string` | HTML Element to render as container | `'div'`
315
- `rows` | no | `number` \ | `'auto'` | Number of grid rows | `'auto'`
316
- `templateColumns` | no | `string` \ | `undefined` | Custom `grid-template-columns` value, passed inline | `undefined` (no-op)
317
- `templateRows` | no | `string` \ | `undefined` | Custom `grid-template-rows` value, passed inline | `undefined` (no-op)
318
-
319
- ### _Notes_
320
-
321
- - Grid layouts max out at 3 columns, and responsiveness is baked in.
322
-
323
- - i.e. When you render a 3-column grid layout, it automatically resizes to 2 columns, then 1 column, as screen widths decrease.
324
- - 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
325
-
326
- ### _Example_
327
-
328
- ```
329
- <template>
330
- <GridContainer :columns="3" component="section">
331
- <GridItem component="FlexContainer">
332
- <h2>Some content goes here</h2>
333
- <p>More content goes here.</p>
334
- <Button class="custom-button-class-name" :isLoading="isLoading" @click="() => console.log('hello world')">
335
- Say hello with this button
336
- </Button>
337
- </GridItem>
338
- </GridContainer>
339
- </template>
340
-
341
- ...
342
-
343
- <script>
344
- import { Button, FlexContainer } from 'pdap-design-system';
345
-
346
- ...
347
-
348
- export default {
349
- components: ['Button', 'FlexContainer', 'GridContainer', 'GridItem'],
350
- props: ['requestPending', ...],
351
- data() {
352
- return {
353
- isLoading: this.requestPending
354
- }
355
- },
356
- ...
357
- }
358
- </script>
359
- ```
360
-
361
- ## GridItem
362
-
363
- _DEPRECATED_
364
-
365
- ### _Props_
366
-
367
- name | required? | types | description | default
368
- ------------ | --------- | -------- | ----------------------------------- | -------
369
- `component` | no | `string` | HTML Element to render as grid item | `'div'`
370
- `spanColumn` | no | `1` \ | `2` \ | `3` | Columns grid item should span | `1`
371
- `spanRow` | no | `number` | Rows grid item should span | `1`
372
-
373
- ### _Notes_
374
-
375
- - Grid layouts max out at 3 columns, and responsiveness is baked in.
376
-
377
- - i.e. When you render a 3-column grid layout, it automatically resizes to 2 columns, then 1 column, as screen widths decrease.
378
- - 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
379
-
380
- ### _Example_
381
-
382
- See `GridContainer` above.
383
-
384
- ## Header
385
-
386
- ### _Props_
387
-
388
- name | required? | types | description | default
389
- --------------------- | --------- | -------- | ---------------------- | ----------------------------------------------------------
390
- `logoImageSrc` | no | `string` | Source of logo image | `'node_modules/pdap-design-system/dist/images/lockup.svg'`
391
- `logoImageAnchorPath` | no | `string` | Flex alignment presets | `/`
392
-
393
- ### _Notes_
394
-
395
- 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
396
-
397
- ### _Example_
398
-
399
- ```
400
- <template>
401
- <Header />
402
- <router-view />
403
- <Footer />
404
- </template>
405
-
406
- ...
407
-
408
- <script>
409
- import { Header, Footer } from 'pdap-design-system';
410
- import { RouterView } from 'vue-router'
411
-
412
- ...
413
-
414
- export default {
415
- name: 'Layout',
416
- components: ['Header', 'Footer'],
417
- ...
418
- provide: {
419
- navLinks: [...]
420
- }
421
- }
422
- </script>
423
- ```
424
-
425
- ## Input
426
-
427
- Inputs are rendered by the `Form` component via a schema. Please see `Form` for more details
428
-
429
- ## Nav
430
-
431
- 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.
432
-
433
- ### _Example_
434
-
435
- ```
436
- <template>
437
- <Header />
438
- <router-view />
439
- <Footer />
440
- </template>
441
-
442
- ...
443
-
444
- <script>
445
- import { Footer, Header } from 'pdap-design-system';
446
- import { RouterView } from 'vue-router';
447
-
448
- ...
449
-
450
- export default {
451
- name: 'Layout',
452
- components: ['Footer', 'Header'],
453
- provide: {
454
- navLinks: [
455
- { path: '/', text: 'Home', method: 'path' },
456
- { path: '/a', text: 'a', method: 'path' },
457
- { path: '/b', text: 'b', method: 'path' },
458
- { path: '/c', text: 'c', method: 'path' },
459
- { href: 'https://www.google.com', text: 'Go to Google', method: 'href' },
460
- ]
461
- }
462
- ...
463
- ```
464
-
465
- ## QuickSearchForm
466
-
467
- ### _Props_
468
-
469
- name | required? | types | description | default
470
- ------ | --------- | -------- | ----------- | --------------------------------------------------------------------------
471
- `mode` | no | `'dev' \ | 'prod'` | env. controls which url users are sent to when form is rendered on pdap.io | `'prod'`
472
-
473
- ### _Notes_
474
-
475
- The different `mode` prop values result the following base url values in the eventual navigation | value | base url | |--|--| | `'dev'` | `'https://data-sources.pdap.dev'` | | `'prod'` | `'https://data-sources.pdap.io'` |
476
-
477
- ## TileIcon
478
-
479
- ### _Props_
480
-
481
- name | required? | types | description | default
482
- ------------ | --------- | -------- | ----------------------------- | -------
483
- `imgAltText` | yes | `string` | Descriptive alt text for icon | none
484
- `imgSrc` | yes | `string` | Source of icon to render | none
485
-
486
- ### _Example_
487
-
488
- ```
489
- <template>
490
- <GridContainer :columns="3" component="section">
491
- <GridItem>
492
- <TileIcon :imgAltText="altText" :imgSrc="imagePath" >
493
- </GridItem>
494
- </GridContainer>
495
- </template>
496
-
497
- ...
498
-
499
- <script>
500
- import { Header, Footer } from 'pdap-design-system';
501
- import { RouterView } from 'vue-router'
502
-
503
- ...
504
-
505
- export default {
506
- name: 'Layout',
507
- components: ['GridContainer', 'GridItem', 'TileIcon'],
508
- props: ['alt', 'src'],
509
- data() {
510
- return {
511
- altText: this.alt,
512
- imgSrc: this.src
513
- }
514
- }
515
- }
516
- </script>
517
- ```
518
-
519
- ## Dropdown
520
-
521
- The Dropdown component is an accessible dropdown menu that can be triggered by click or hover and positioned in various placements. It provides keyboard accessibility features such as toggling the dropdown on enter/space and closing on escape.
522
-
523
- ### _Props_
524
-
525
- name | required? | types | description | default
526
- ------------- | --------- | ------------------------- | -------------------------------------------------- | -------------------------------
527
- `defaultOpen` | no | `boolean` | Whether the dropdown is initially open | `false`
528
- `disabled` | no | `boolean` | Whether the dropdown should be disabled | `false`
529
- `triggerType` | no | `PdapDropdownTriggerType` | The type of event that should trigger the dropdown | `PdapDropdownTriggerType.PRESS`
530
-
531
- ### _Example_
532
-
533
- See [Component demo](../src/demo/pages/ComponentDemo.vue)
1
+ # Component Documentation
2
+ <!-- This file is auto-generated from README.md files contained in the components directory, no need to edit this file directly. -->
3
+
4
+ - [Breadcrumbs](../src/components/Breadcrumbs//README.md)
5
+ - [Button](../src/components/Button//README.md)
6
+ - [Dropdown](../src/components/Dropdown//README.md)
7
+ - [ErrorBoundary](../src/components/ErrorBoundary//README.md)
8
+ - [Footer](../src/components/Footer//README.md)
9
+ - [Form](../src/components/Form//README.md)
10
+ - [Header](../src/components/Header//README.md)
11
+ - [Input](../src/components/Input//README.md)
12
+ - [Nav](../src/components/Nav//README.md)
13
+ - [QuickSearchForm](../src/components/QuickSearchForm//README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdap-design-system",
3
- "version": "2.7.0-beta.3",
3
+ "version": "2.7.0-beta.4",
4
4
  "description": "Global styles for PDAP apps",
5
5
  "author": "Police Data Accessibility Project, Inc.",
6
6
  "license": "ISC",
@@ -113,7 +113,8 @@
113
113
  "test:badge": "vitest run --coverage.enabled --coverage.reporter='text-summary'",
114
114
  "test:ci": "npm run test -- --silent",
115
115
  "typecheck": "vue-tsc",
116
- "dev": "vite"
116
+ "dev": "vite",
117
+ "docs": "bash ./scripts/update-docs.sh"
117
118
  },
118
119
  "workspaces": [
119
120
  "eslint-config"
@@ -1,37 +0,0 @@
1
- import { PdapFlexContainerProps } from './types';
2
- /** @deprecated Please use TailwindCSS class instead */
3
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapFlexContainerProps>, {
4
- alignment: string;
5
- component: string;
6
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapFlexContainerProps>, {
7
- alignment: string;
8
- component: string;
9
- }>>>, {
10
- component: string;
11
- alignment: "center" | "start";
12
- }, {}>, {
13
- default?(_: {}): any;
14
- }>;
15
- export default _default;
16
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
17
- type __VLS_TypePropsToRuntimeProps<T> = {
18
- [K in keyof T]-?: {} extends Pick<T, K> ? {
19
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
20
- } : {
21
- type: import('vue').PropType<T[K]>;
22
- required: true;
23
- };
24
- };
25
- type __VLS_WithDefaults<P, D> = {
26
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
27
- default: D[K];
28
- }> : P[K];
29
- };
30
- type __VLS_Prettify<T> = {
31
- [K in keyof T]: T[K];
32
- } & {};
33
- type __VLS_WithTemplateSlots<T, S> = T & {
34
- new (): {
35
- $slots: S;
36
- };
37
- };
@@ -1,2 +0,0 @@
1
- import FlexContainer from './FlexContainer.vue';
2
- export { FlexContainer };
@@ -1,4 +0,0 @@
1
- export interface PdapFlexContainerProps {
2
- alignment?: 'center' | 'start';
3
- component?: string;
4
- }
@@ -1,40 +0,0 @@
1
- import { PdapGridContainerProps } from './types';
2
- /** @deprecated use TailwindCSS class instead */
3
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapGridContainerProps>, {
4
- columns: string;
5
- component: string;
6
- rows: string;
7
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapGridContainerProps>, {
8
- columns: string;
9
- component: string;
10
- rows: string;
11
- }>>>, {
12
- component: string;
13
- columns: 1 | 2 | 3 | "auto";
14
- rows: number | "auto";
15
- }, {}>, {
16
- default?(_: {}): any;
17
- }>;
18
- export default _default;
19
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
20
- type __VLS_TypePropsToRuntimeProps<T> = {
21
- [K in keyof T]-?: {} extends Pick<T, K> ? {
22
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
23
- } : {
24
- type: import('vue').PropType<T[K]>;
25
- required: true;
26
- };
27
- };
28
- type __VLS_WithDefaults<P, D> = {
29
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
30
- default: D[K];
31
- }> : P[K];
32
- };
33
- type __VLS_Prettify<T> = {
34
- [K in keyof T]: T[K];
35
- } & {};
36
- type __VLS_WithTemplateSlots<T, S> = T & {
37
- new (): {
38
- $slots: S;
39
- };
40
- };
@@ -1,2 +0,0 @@
1
- import GridContainer from './GridContainer.vue';
2
- export { GridContainer };
@@ -1,7 +0,0 @@
1
- export interface PdapGridContainerProps {
2
- columns?: 1 | 2 | 3 | 'auto';
3
- component?: string;
4
- rows?: number | 'auto';
5
- templateColumns?: string;
6
- templateRows?: string;
7
- }