pdap-design-system 2.7.0-beta.2 → 2.7.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +39 -47
- package/dist/components/Breadcrumbs/PdapBreadcrumbs.vue.d.ts +9 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -2
- package/dist/components/Button/PdapButton.vue.d.ts +9 -0
- package/dist/components/Button/index.d.ts +1 -2
- package/dist/components/Dropdown/PdapDropdown.vue.d.ts +56 -0
- package/dist/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Dropdown/types.d.ts +9 -0
- package/dist/components/ErrorBoundary/PdapErrorBoundary.vue.d.ts +82 -16
- package/dist/components/ErrorBoundary/index.d.ts +1 -0
- package/dist/components/ErrorBoundary/types.d.ts +11 -0
- package/dist/components/Footer/PdapFooter.vue.d.ts +8 -0
- package/dist/components/Form/PdapForm.vue.d.ts +105 -2
- package/dist/components/Header/PdapHeader.vue.d.ts +11 -0
- package/dist/components/Nav/PdapNav.vue.d.ts +37 -0
- package/dist/components/QuickSearchForm/QuickSearchForm.vue.d.ts +14 -0
- package/dist/components/TileIcon/TileIcon.vue.d.ts +3 -0
- package/dist/components/index.d.ts +2 -3
- package/dist/directives/click-outside.d.ts +16 -0
- package/dist/directives/index.d.ts +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +961 -879
- package/dist/styles.css +1 -1
- package/docs/components.md +13 -584
- package/package.json +3 -2
- package/dist/components/FlexContainer/FlexContainer.vue.d.ts +0 -37
- package/dist/components/FlexContainer/index.d.ts +0 -2
- package/dist/components/FlexContainer/types.d.ts +0 -4
- package/dist/components/GridContainer/GridContainer.vue.d.ts +0 -40
- package/dist/components/GridContainer/index.d.ts +0 -2
- package/dist/components/GridContainer/types.d.ts +0 -7
- package/dist/components/GridItem/GridItem.vue.d.ts +0 -40
- package/dist/components/GridItem/index.d.ts +0 -2
- package/dist/components/GridItem/types.d.ts +0 -5
package/README.md
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
# PDAP Design System
|
2
|
-
_A `Vue` component library, styling system, and image asset repository for PDAP-branded client apps._
|
3
2
|
|
4
|
-
|
5
|
-
![Build status](https://img.shields.io/github/actions/workflow/status/Police-Data-Accessibility-Project/design-system/build.yaml?branch=main&style=for-the-badge)
|
6
|
-
![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/joshuagraber/f3a173e87a763056b73438f503680993/raw/ff7d81845d17020e8a2bc01481d3cda512a15698/pdap-design-system__heads_main.json)
|
7
|
-
![License](https://img.shields.io/github/license/Police-Data-Accessibility-Project/design-system.svg?style=for-the-badge&color=green)
|
3
|
+
_A `Vue` component library, styling system, and image asset repository for PDAP-branded client apps._
|
8
4
|
|
5
|
+
[![Current npm release](https://img.shields.io/npm/v/pdap-design-system?style=for-the-badge)](https://www.npmjs.com/package/pdap-design-system) ![Build status](https://img.shields.io/github/actions/workflow/status/Police-Data-Accessibility-Project/design-system/build.yaml?branch=main&style=for-the-badge) ![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/joshuagraber/f3a173e87a763056b73438f503680993/raw/pdap-design-system__heads_main.json) ![License](https://img.shields.io/github/license/Police-Data-Accessibility-Project/design-system.svg?style=for-the-badge&color=green)
|
9
6
|
|
10
7
|
[![Discord](https://img.shields.io/discord/828274060034965575?logo=discord&style=for-the-badge&color=blue)](https://discord.gg/vKhDv7nC8B)
|
11
8
|
|
12
|
-
|
13
9
|
## Usage
|
14
10
|
|
15
11
|
1. Install the package
|
@@ -18,7 +14,7 @@ _A `Vue` component library, styling system, and image asset repository for PDAP-
|
|
18
14
|
npm install pdap-design-system
|
19
15
|
```
|
20
16
|
|
21
|
-
|
17
|
+
1. Import the stylesheet in the app's entrypoint (usually `index.js` or `main.js`, at the root of your project)
|
22
18
|
|
23
19
|
```
|
24
20
|
// index.js | main.js
|
@@ -26,27 +22,25 @@ npm install pdap-design-system
|
|
26
22
|
import 'pdap-design-system/styles';
|
27
23
|
```
|
28
24
|
|
29
|
-
|
25
|
+
1. Import and use the components
|
30
26
|
|
31
27
|
```
|
32
28
|
import { Button, Form } from 'pdap-design-system';
|
33
29
|
```
|
34
30
|
|
35
|
-
1. Extend the `es-lint` config, for consistency in linting between client apps:
|
36
|
-
First `npm install --save-dev @pdap-design-system/eslint-config`, then, in `eslintrc`:
|
31
|
+
1. Extend the `es-lint` config, for consistency in linting between client apps: First `npm install --save-dev @pdap-design-system/eslint-config`, then, in `eslintrc`:
|
37
32
|
|
38
33
|
```
|
39
34
|
{
|
40
35
|
...,
|
41
|
-
|
42
|
-
|
36
|
+
extends: [
|
37
|
+
"@pdap-design-system/eslint-config",
|
43
38
|
...
|
44
|
-
|
39
|
+
],
|
45
40
|
}
|
46
41
|
```
|
47
42
|
|
48
|
-
|
49
|
-
5. (Optional) Import the tailwind config if you need to use additional tailwind styles.
|
43
|
+
1. (Optional) Import the tailwind config if you need to use additional tailwind styles.
|
50
44
|
|
51
45
|
```
|
52
46
|
// tailwind.config.js
|
@@ -62,17 +56,16 @@ module.exports = {
|
|
62
56
|
"./src/**/*.{vue,js,css}",
|
63
57
|
],
|
64
58
|
}
|
65
|
-
|
66
59
|
```
|
67
60
|
|
68
|
-
|
69
|
-
|
61
|
+
1. If the project is using `TypeScript`, the component props definitions and other types are exposed for import as well.<br>
|
62
|
+
_n.b. This can be particularly useful for composing `Form` schemas, where `Input` schema objects are defined differently depending on the `type` of input desired._
|
70
63
|
|
71
64
|
```
|
72
65
|
import { PdapInputTypes } from 'pdap-design-system';
|
73
66
|
```
|
74
67
|
|
75
|
-
|
68
|
+
1. See [the component documentation](./docs/components.md) for details on each component's API.
|
76
69
|
|
77
70
|
### About images
|
78
71
|
|
@@ -96,16 +89,16 @@ import `pdap-design-system/images`;
|
|
96
89
|
gh repo clone Police-Data-Accessibility-Project/design-system
|
97
90
|
```
|
98
91
|
|
99
|
-
|
92
|
+
1. CD into the project directory and install dependencies
|
100
93
|
|
101
94
|
```
|
102
95
|
cd design-system
|
103
96
|
npm i
|
104
97
|
```
|
105
98
|
|
106
|
-
|
99
|
+
1. Step 2 should result in the `build` script being run after packages are installed. Check the `dist` directory for changes. You then may want to take one or both of the following steps:
|
107
100
|
|
108
|
-
|
101
|
+
2. If `build` wasn't called when you installed deps, build styles and images to the `dist` directory:
|
109
102
|
|
110
103
|
```
|
111
104
|
npm run build
|
@@ -117,39 +110,38 @@ npm run build
|
|
117
110
|
npm run build:watch
|
118
111
|
```
|
119
112
|
|
120
|
-
|
113
|
+
1. If you use VS Code as your editor, you may want to install the [tailwind VS Code extension](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss), which helps with intellisense and the custom at-rules used by TailwindCSS.
|
121
114
|
|
122
|
-
|
115
|
+
2. Read the [contributing guide](./CONTRIBUTING.md) for development requirements and tips.
|
123
116
|
|
124
117
|
## Assets
|
125
118
|
|
126
|
-
Use these [brand assets](https://docs.pdap.io/meta/about/staff/brand-assets).
|
127
|
-
Use this [terminology](https://docs.pdap.io/activities/terms-and-definitions).
|
119
|
+
Use these [brand assets](https://docs.pdap.io/meta/about/staff/brand-assets). Use this [terminology](https://docs.pdap.io/activities/terms-and-definitions).
|
128
120
|
|
129
121
|
## Scripts reference
|
130
122
|
|
131
|
-
| Script | What it does
|
132
|
-
| -------------- |
|
133
|
-
| `_commit` | Create conventional commits
|
134
|
-
| `build` | Builds the library
|
135
|
-
| `build:watch` | Builds the library and watches for file changes
|
136
|
-
| `ci` | Remove all generated files and re-installs deps
|
137
|
-
| `clean` | Remove all generated files (except `package-lock.json`)
|
138
|
-
| `clean:deps` | Remove node_modules directory
|
139
|
-
| `clean:build` | Remove dist directory
|
140
|
-
| `clean:test` | Remove testing coverage reports
|
141
|
-
| `lint` | Lint everything
|
142
|
-
| `lint:es` | Lint `ts`
|
143
|
-
| `lint:css` | Lint `css` and `vue` with `stylelint`
|
144
|
-
| `lint:ts` | Lint `ts` with `tsc`
|
145
|
-
| `test` | Run all test suites
|
146
|
-
| `test:changed` | Run only test suites affected by changed files
|
147
|
-
| `typecheck` | Run type check on all `ts` and `vue` files
|
148
|
-
| `dev` | Run demo app to check visual changes to components
|
149
|
-
|
123
|
+
| Script | What it does |
|
124
|
+
| -------------- | ----------------------------------------------------------------------- |
|
125
|
+
| `_commit` | Create conventional commits |
|
126
|
+
| `build` | Builds the library |
|
127
|
+
| `build:watch` | Builds the library and watches for file changes |
|
128
|
+
| `ci` | Remove all generated files and re-installs deps |
|
129
|
+
| `clean` | Remove all generated files (except `package-lock.json`) |
|
130
|
+
| `clean:deps` | Remove node_modules directory |
|
131
|
+
| `clean:build` | Remove dist directory |
|
132
|
+
| `clean:test` | Remove testing coverage reports |
|
133
|
+
| `lint` | Lint everything |
|
134
|
+
| `lint:es` | Lint `ts` and `vue` with `eslint` |
|
135
|
+
| `lint:css` | Lint `css` and `vue` with `stylelint` |
|
136
|
+
| `lint:ts` | Lint `ts` with `tsc` |
|
137
|
+
| `test` | Run all test suites |
|
138
|
+
| `test:changed` | Run only test suites affected by changed files |
|
139
|
+
| `typecheck` | Run type check on all `ts` and `vue` files |
|
140
|
+
| `dev` | Run demo app to check visual changes to components |
|
141
|
+
| `docs` | Run script to automatically aggregate links to component `README` files |
|
150
142
|
|
151
143
|
_n.b. There are some other scripts defined in the `package.json` `"scripts"` field, but they are mostly for CI or cleanup post-build, etc. You shouldn't need them._
|
152
144
|
|
153
145
|
## Releasing
|
154
|
-
|
155
|
-
For more significant updates, the `beta` branch can be used for releasing incremental beta releases to test the bigger feature without releasing to production.
|
146
|
+
|
147
|
+
Incremental updates can be added to `main` directly via a PR. For more significant updates, the `beta` branch can be used for releasing incremental beta releases to test the bigger feature without releasing to production.
|
@@ -1,2 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* # `Breadcrumbs`
|
3
|
+
*
|
4
|
+
* Renders a hierarchy of matching links for all paths matching the current path.
|
5
|
+
*
|
6
|
+
* The rendered text of each link will default to the `name` value in each matching route's object, unless `meta.breadcrumbText` is set.
|
7
|
+
*
|
8
|
+
*
|
9
|
+
*/
|
1
10
|
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
2
11
|
export default _default;
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
export { PdapBreadcrumbs as Breadcrumbs };
|
1
|
+
export { default as Breadcrumbs } from './PdapBreadcrumbs.vue';
|
@@ -1,4 +1,13 @@
|
|
1
1
|
import { PdapButtonProps } from './types';
|
2
|
+
/**
|
3
|
+
* # `Button`
|
4
|
+
* Styled button with PDAP branding. DOM attributes are forwarded to the HTML element, and most functionality works well this way.
|
5
|
+
*
|
6
|
+
* ## Props
|
7
|
+
* @prop {'primary' | 'secondary' | 'tertiary'} intent controls the styling of the button
|
8
|
+
* @prop {boolean} isLoading loading state of button
|
9
|
+
*
|
10
|
+
*/
|
2
11
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapButtonProps>, {
|
3
12
|
intent: string;
|
4
13
|
isLoading: boolean;
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
export { PdapButton as Button };
|
1
|
+
export { default as Button } from './PdapButton.vue';
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { PdapDropdownProps, PdapDropdownTriggerType } from './types';
|
2
|
+
/**
|
3
|
+
* # `Dropdown`
|
4
|
+
* 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.
|
5
|
+
*
|
6
|
+
* ## Props
|
7
|
+
* @prop {boolean} defaultOpen Controls the initial `isOpen` state
|
8
|
+
* @prop {boolean} disabled Disabled state (forwarded to trigger button)
|
9
|
+
* @prop {PdapDropdownTriggerType} triggerType `'press' | 'hover'`
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapDropdownProps>, {
|
13
|
+
defaultOpen: boolean;
|
14
|
+
disabled: boolean;
|
15
|
+
triggerOn: PdapDropdownTriggerType;
|
16
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
17
|
+
press: (...args: any[]) => void;
|
18
|
+
"update:open": (...args: any[]) => void;
|
19
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapDropdownProps>, {
|
20
|
+
defaultOpen: boolean;
|
21
|
+
disabled: boolean;
|
22
|
+
triggerOn: PdapDropdownTriggerType;
|
23
|
+
}>>> & {
|
24
|
+
onPress?: ((...args: any[]) => any) | undefined;
|
25
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
26
|
+
}, {
|
27
|
+
defaultOpen: boolean;
|
28
|
+
disabled: boolean;
|
29
|
+
triggerOn: PdapDropdownTriggerType;
|
30
|
+
}, {}>, {
|
31
|
+
trigger?(_: {}): any;
|
32
|
+
content?(_: {}): any;
|
33
|
+
}>;
|
34
|
+
export default _default;
|
35
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
36
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
37
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
38
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
39
|
+
} : {
|
40
|
+
type: import('vue').PropType<T[K]>;
|
41
|
+
required: true;
|
42
|
+
};
|
43
|
+
};
|
44
|
+
type __VLS_WithDefaults<P, D> = {
|
45
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
46
|
+
default: D[K];
|
47
|
+
}> : P[K];
|
48
|
+
};
|
49
|
+
type __VLS_Prettify<T> = {
|
50
|
+
[K in keyof T]: T[K];
|
51
|
+
} & {};
|
52
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
53
|
+
new (): {
|
54
|
+
$slots: S;
|
55
|
+
};
|
56
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Dropdown } from './PdapDropdown.vue';
|
@@ -1,18 +1,84 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
import { ComponentPublicInstance } from 'vue';
|
2
|
+
import { PdapErrorBoundaryProps, PdapErrorEmitted } from './types';
|
3
|
+
/**
|
4
|
+
* # `ErrorBoundary`
|
5
|
+
* Intercepts uncaught errors from its children and renders an error UI in place of its children.
|
6
|
+
*
|
7
|
+
* ## Props
|
8
|
+
* @prop {string} component Optional: the component to render as a fallback, defaults to 'div'
|
9
|
+
* @prop {PdapErrorBoundaryProps['onError']} onError Optional: callback to run on error, accepts two arguments, the error and the element (optional)
|
10
|
+
* @prop {Record<string, string>} params Optional: parameters to be forwarded to fallback
|
11
|
+
*
|
12
|
+
* ## Emits
|
13
|
+
* @emits onError includes object with `error`, and optionally `info` and `vm
|
14
|
+
*
|
15
|
+
* @example Top level
|
16
|
+
*
|
17
|
+
* <template>
|
18
|
+
* <AuthWrapper>
|
19
|
+
* <Header :logo-image-src="lockup" />
|
20
|
+
* <ErrorBoundary component="main">
|
21
|
+
* <router-view />
|
22
|
+
* </ErrorBoundary>
|
23
|
+
* <Footer :logo-image-src="acronym" />
|
24
|
+
* </AuthWrapper>
|
25
|
+
* </template>
|
26
|
+
*
|
27
|
+
* @example Within a component
|
28
|
+
<ErrorBoundary
|
29
|
+
class="col-span-full items-start"
|
30
|
+
component="div"
|
31
|
+
@on-error="({ error, vm, info }) => console.debug({ error, vm, info })"
|
32
|
+
>
|
33
|
+
<div class="col-span-full">
|
34
|
+
<p>
|
35
|
+
This is the content that will render inside the error boundary if
|
36
|
+
there is no error
|
37
|
+
</p>
|
38
|
+
<Button @click="triggerError">Click here to trigger error</Button>
|
39
|
+
</div>
|
40
|
+
</ErrorBoundary>
|
41
|
+
*
|
42
|
+
*/
|
43
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapErrorBoundaryProps>, {
|
44
|
+
component: string;
|
45
|
+
onError: undefined;
|
46
|
+
params: undefined;
|
47
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
48
|
+
onError: (args_0: PdapErrorEmitted) => void;
|
49
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapErrorBoundaryProps>, {
|
16
50
|
component: string;
|
17
|
-
|
51
|
+
onError: undefined;
|
52
|
+
params: undefined;
|
53
|
+
}>>> & {
|
54
|
+
onOnError?: ((args_0: PdapErrorEmitted) => any) | undefined;
|
55
|
+
}, {
|
56
|
+
params: Record<string, string>;
|
57
|
+
onError: (error: Error, target?: ComponentPublicInstance | null | undefined, info?: string | undefined) => void;
|
58
|
+
component: string;
|
59
|
+
}, {}>, {
|
60
|
+
default?(_: {}): any;
|
61
|
+
}>;
|
18
62
|
export default _default;
|
63
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
64
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
65
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
66
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
67
|
+
} : {
|
68
|
+
type: import('vue').PropType<T[K]>;
|
69
|
+
required: true;
|
70
|
+
};
|
71
|
+
};
|
72
|
+
type __VLS_WithDefaults<P, D> = {
|
73
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
74
|
+
default: D[K];
|
75
|
+
}> : P[K];
|
76
|
+
};
|
77
|
+
type __VLS_Prettify<T> = {
|
78
|
+
[K in keyof T]: T[K];
|
79
|
+
} & {};
|
80
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
81
|
+
new (): {
|
82
|
+
$slots: S;
|
83
|
+
};
|
84
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as ErrorBoundary } from './PdapErrorBoundary.vue';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ComponentPublicInstance } from 'vue';
|
2
|
+
export interface PdapErrorEmitted {
|
3
|
+
error: Error;
|
4
|
+
vm: ComponentPublicInstance | null;
|
5
|
+
info?: string;
|
6
|
+
}
|
7
|
+
export interface PdapErrorBoundaryProps {
|
8
|
+
component: string;
|
9
|
+
onError?: (error: Error, target?: ComponentPublicInstance | null | undefined, info?: string) => void;
|
10
|
+
params?: Record<string, string>;
|
11
|
+
}
|
@@ -1,4 +1,12 @@
|
|
1
1
|
import { PdapFooterProps } from './types';
|
2
|
+
/**
|
3
|
+
* # `Footer`
|
4
|
+
*
|
5
|
+
* ## Props
|
6
|
+
* @prop {string} logoImageSrc Src for the PDAP logo image to be displayed
|
7
|
+
* @prop {string } logoImageAnchorPath Path for the link that wraps the PDAP logo image
|
8
|
+
*
|
9
|
+
*/
|
2
10
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapFooterProps>, {
|
3
11
|
logoImageSrc: string;
|
4
12
|
logoImageAnchorPath: string;
|
@@ -1,6 +1,109 @@
|
|
1
1
|
import { PdapFormProps } from './types';
|
2
|
-
|
3
|
-
|
2
|
+
/**
|
3
|
+
* # `Form`
|
4
|
+
* 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.
|
5
|
+
*
|
6
|
+
*
|
7
|
+
* ## Props
|
8
|
+
* @prop {string | undefined | null} error Error state. Only a non-falsy string results in a form-level error being displayed
|
9
|
+
* @prop {string} id Passed through to the `form` element as its `id`
|
10
|
+
* @prop {string} name Passed through to the `form` element as its `name`
|
11
|
+
* @prop {PdapFormSchema} schema Array of `PdapFormInputProps` objects.
|
12
|
+
*
|
13
|
+
* ## Notes
|
14
|
+
*
|
15
|
+
* - Form schema entries can look different depending on the type of input. We currently only use text inputs, so the example only displays these.
|
16
|
+
* - To properly submit the form, you must render a button with `type="submit"` _inside_ of the `Form` component.
|
17
|
+
* - `Form` emits a `submit` event and passes all values to the handler you pass to `on-submit`
|
18
|
+
* - Currently available form validations are defined by the `PdapFormValidators` interface:
|
19
|
+
*
|
20
|
+
* ```
|
21
|
+
* PdapFormValidators {
|
22
|
+
* maxLength: {
|
23
|
+
* message?: string;
|
24
|
+
* value: number;
|
25
|
+
* };
|
26
|
+
* minLength: {
|
27
|
+
* message?: string;
|
28
|
+
* value: number;
|
29
|
+
* };
|
30
|
+
* required: {
|
31
|
+
* message?: string;
|
32
|
+
* value: boolean;
|
33
|
+
* };
|
34
|
+
* }
|
35
|
+
* ```
|
36
|
+
*
|
37
|
+
*
|
38
|
+
* @example
|
39
|
+
*
|
40
|
+
* <template>
|
41
|
+
* <Form :schema="formSchema" :on-submit="handleSubmit" id="test-form" name="data-request-form">
|
42
|
+
* <Button intent="primary" type="submit">Click me</Button>
|
43
|
+
* </Form>
|
44
|
+
* </template>
|
45
|
+
*
|
46
|
+
*
|
47
|
+
* <st>
|
48
|
+
* import { Button, Form, PdapInputTypes } from 'pdap-design-system';
|
49
|
+
*
|
50
|
+
* export default {
|
51
|
+
* components: ['Button', 'Form'],
|
52
|
+
* data() {
|
53
|
+
* return {
|
54
|
+
* formSchema: [
|
55
|
+
* {
|
56
|
+
* id: 'testfirstname',
|
57
|
+
* name: 'firstName',
|
58
|
+
* label: 'First Name',
|
59
|
+
* type: 'text',
|
60
|
+
* placeholder: 'John',
|
61
|
+
* value: '',
|
62
|
+
* validators: {
|
63
|
+
* minLength: {
|
64
|
+
* value: 3
|
65
|
+
* },
|
66
|
+
* required: {
|
67
|
+
* message: 'Please provide this information',
|
68
|
+
* value: true
|
69
|
+
* }
|
70
|
+
* },
|
71
|
+
* },
|
72
|
+
* {
|
73
|
+
* id: 'testlastname',
|
74
|
+
* name: 'lastName',
|
75
|
+
* label: 'Last Name',
|
76
|
+
* type: 'text',
|
77
|
+
* placeholder: 'Doe',
|
78
|
+
* value: '',
|
79
|
+
* validators: {
|
80
|
+
* minLength: {
|
81
|
+
* value: 3
|
82
|
+
* },
|
83
|
+
* maxLength: {
|
84
|
+
* message: 'A thousand characters for your surname? Are you a bot?',
|
85
|
+
* value: 999
|
86
|
+
* },
|
87
|
+
* },
|
88
|
+
* {
|
89
|
+
* id: 'ice-cream',
|
90
|
+
* name: 'iceCream',
|
91
|
+
* label: 'Do you like ice cream?',
|
92
|
+
* type: 'checkbox',
|
93
|
+
* defaultChecked: true,
|
94
|
+
* }
|
95
|
+
* ]
|
96
|
+
* }
|
97
|
+
* },
|
98
|
+
* methods: {
|
99
|
+
* handleSubmit: async function(data) {
|
100
|
+
* await doRequestStuff(data);
|
101
|
+
* this.$router.push('/')
|
102
|
+
* }
|
103
|
+
* }
|
104
|
+
*}
|
105
|
+
* </scriptt>
|
106
|
+
*/
|
4
107
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapFormProps>, {
|
5
108
|
error: null;
|
6
109
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
@@ -1,4 +1,15 @@
|
|
1
1
|
import { PdapHeaderProps } from './types';
|
2
|
+
/**
|
3
|
+
* # `Header`
|
4
|
+
*
|
5
|
+
* ## Props
|
6
|
+
* @prop {string} logoImageSrc Src for the PDAP logo image to be displayed
|
7
|
+
* @prop {string } logoImageAnchorPath Path for the link that wraps the PDAP logo image
|
8
|
+
*
|
9
|
+
* ## Notes
|
10
|
+
* 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
|
11
|
+
*
|
12
|
+
*/
|
2
13
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapHeaderProps>, {
|
3
14
|
logoImageSrc: string;
|
4
15
|
logoImageAnchorPath: string;
|
@@ -1,4 +1,41 @@
|
|
1
1
|
import { PdapNavProps } from './types';
|
2
|
+
/**
|
3
|
+
* # `Nav`
|
4
|
+
*
|
5
|
+
* ## Notes
|
6
|
+
* 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.
|
7
|
+
*
|
8
|
+
* @example
|
9
|
+
*
|
10
|
+
*<template>
|
11
|
+
* <Header />
|
12
|
+
* <router-view />
|
13
|
+
* <Footer />
|
14
|
+
*</template>
|
15
|
+
*
|
16
|
+
*
|
17
|
+
*<scriptt>
|
18
|
+
*import { Footer, Header } from 'pdap-design-system';
|
19
|
+
*import { RouterView } from 'vue-router';
|
20
|
+
*
|
21
|
+
*...
|
22
|
+
*
|
23
|
+
*export default {
|
24
|
+
* name: 'Layout',
|
25
|
+
* components: ['Footer', 'Header'],
|
26
|
+
* provide: {
|
27
|
+
* navLinks: [
|
28
|
+
* { path: '/', text: 'Home', method: 'path' },
|
29
|
+
* { path: '/a', text: 'a', method: 'path' },
|
30
|
+
* { path: '/b', text: 'b', method: 'path' },
|
31
|
+
* { path: '/c', text: 'c', method: 'path' },
|
32
|
+
* { href: 'https://www.google.com', text: 'Go to Google', method: 'href' },
|
33
|
+
* ]
|
34
|
+
* }
|
35
|
+
* ...
|
36
|
+
*}
|
37
|
+
*</scriptt>
|
38
|
+
*/
|
2
39
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<PdapNavProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PdapNavProps>>>, {}, {}>;
|
3
40
|
export default _default;
|
4
41
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
@@ -1,3 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* # QuickSearchForm
|
3
|
+
* Renders a form to search the API `/search` endpoint with a search term and a location.
|
4
|
+
*
|
5
|
+
* ## Notes
|
6
|
+
*
|
7
|
+
* The different `mode` prop values result the following base url values in the eventual navigation
|
8
|
+
*
|
9
|
+
* | value | base url |
|
10
|
+
* | -------- | --------------------------------- |
|
11
|
+
* | `'dev'` | `'https://data-sources.pdap.dev'` |
|
12
|
+
* | `'prod'` | `'https://data-sources.pdap.io'` |
|
13
|
+
*
|
14
|
+
*/
|
1
15
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
2
16
|
baseUrlForRedirect: string;
|
3
17
|
}>, {
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import { PdapTileIconProps } from './types';
|
2
|
+
/**
|
3
|
+
* @deprecated unused
|
4
|
+
*/
|
2
5
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<PdapTileIconProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PdapTileIconProps>>>, {}, {}>;
|
3
6
|
export default _default;
|
4
7
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
@@ -1,12 +1,11 @@
|
|
1
1
|
export { Button } from './Button';
|
2
|
-
export {
|
2
|
+
export { ErrorBoundary } from './ErrorBoundary';
|
3
3
|
export { Footer } from './Footer';
|
4
4
|
export { Form } from './Form';
|
5
|
-
export { GridContainer } from './GridContainer';
|
6
|
-
export { GridItem } from './GridItem';
|
7
5
|
export { Input } from './Input';
|
8
6
|
export { Header } from './Header';
|
9
7
|
export { Nav } from './Nav';
|
10
8
|
export { QuickSearchForm } from './QuickSearchForm';
|
11
9
|
export { TileIcon } from './TileIcon';
|
10
|
+
export { Dropdown } from './Dropdown';
|
12
11
|
export { Breadcrumbs } from './Breadcrumbs';
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { DirectiveBinding } from 'vue';
|
2
|
+
type ElementWithClickOutside = Element & {
|
3
|
+
clickOutsideEvent: (event: Event) => void;
|
4
|
+
};
|
5
|
+
/**
|
6
|
+
* # Click outside directive
|
7
|
+
*
|
8
|
+
* Runs a callback on a click outside of the element to which the directive is applied
|
9
|
+
* @param el Element
|
10
|
+
* @param binding DirectiveBinding
|
11
|
+
*/
|
12
|
+
declare const _default: {
|
13
|
+
beforeMount(el: Element, binding: DirectiveBinding): void;
|
14
|
+
unmounted(element: ElementWithClickOutside): void;
|
15
|
+
};
|
16
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as vOnClickOutside } from './click-outside';
|