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
package/README.md CHANGED
@@ -120,24 +120,25 @@ Use these [brand assets](https://docs.pdap.io/meta/about/staff/brand-assets). Us
120
120
 
121
121
  ## Scripts reference
122
122
 
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
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 |
141
142
 
142
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._
143
144
 
@@ -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
- import PdapBreadcrumbs from './PdapBreadcrumbs.vue';
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
- import PdapButton from './PdapButton.vue';
2
- export { PdapButton as Button };
1
+ export { default as Button } from './PdapButton.vue';
@@ -1,4 +1,14 @@
1
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
+ */
2
12
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PdapDropdownProps>, {
3
13
  defaultOpen: boolean;
4
14
  disabled: boolean;
@@ -1,18 +1,84 @@
1
- declare const _default: import("vue").DefineComponent<{
2
- component: {
3
- type: StringConstructor;
4
- default: string;
5
- };
6
- }, any, {
7
- error: boolean;
8
- }, {}, {
9
- interceptError(error: any): void;
10
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
- component: {
12
- type: StringConstructor;
13
- default: string;
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
- declare const v$: import("vue").Ref<import("@vuelidate/core").Validation<{}, Record<string, string>>>;
3
- export type VuelidateInstance = typeof v$.value;
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,9 +1,7 @@
1
1
  export { Button } from './Button';
2
- export { FlexContainer } from './FlexContainer';
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';