@netu-si/netu-react-dsf-components 0.0.1 → 0.0.3

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.
Files changed (39) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/components/DSFBackLink/DSFBackLink.d.ts +11 -0
  3. package/dist/cjs/components/DSFDateInput/DSFDateInput.d.ts +2 -2
  4. package/dist/cjs/components/DSFFieldSet/DSFFieldSet.d.ts +2 -2
  5. package/dist/cjs/components/DSFFileUpload/DSFFileUpload.d.ts +5 -3
  6. package/dist/cjs/components/DSFFooter/DSFFooter.d.ts +8 -1
  7. package/dist/cjs/components/DSFFormGroup/DSFFormGroup.d.ts +2 -2
  8. package/dist/cjs/components/DSFHeader/DSFHeader.d.ts +3 -2
  9. package/dist/cjs/components/DSFLoadingBox/DSFLoadingBox.d.ts +2 -3
  10. package/dist/cjs/components/DSFMain/DSFMain.d.ts +3 -1
  11. package/dist/cjs/components/DSFPage/DSFPage.d.ts +46 -0
  12. package/dist/cjs/components/DSFPage/index.d.ts +1 -0
  13. package/dist/cjs/components/DSFPanel/DSFPanel.d.ts +2 -2
  14. package/dist/cjs/components/DSFRadio/DSFRadio.d.ts +0 -2
  15. package/dist/cjs/components/DSFSelect/DSFSelect.d.ts +1 -0
  16. package/dist/cjs/components/DSFTable/DSFTable.d.ts +8 -7
  17. package/dist/cjs/components/index.d.ts +2 -0
  18. package/dist/cjs/index.js +1 -1
  19. package/dist/cjs/index.js.map +1 -1
  20. package/dist/esm/components/DSFBackLink/DSFBackLink.d.ts +11 -0
  21. package/dist/esm/components/DSFDateInput/DSFDateInput.d.ts +2 -2
  22. package/dist/esm/components/DSFFieldSet/DSFFieldSet.d.ts +2 -2
  23. package/dist/esm/components/DSFFileUpload/DSFFileUpload.d.ts +5 -3
  24. package/dist/esm/components/DSFFooter/DSFFooter.d.ts +8 -1
  25. package/dist/esm/components/DSFFormGroup/DSFFormGroup.d.ts +2 -2
  26. package/dist/esm/components/DSFHeader/DSFHeader.d.ts +3 -2
  27. package/dist/esm/components/DSFLoadingBox/DSFLoadingBox.d.ts +2 -3
  28. package/dist/esm/components/DSFMain/DSFMain.d.ts +3 -1
  29. package/dist/esm/components/DSFPage/DSFPage.d.ts +46 -0
  30. package/dist/esm/components/DSFPage/index.d.ts +1 -0
  31. package/dist/esm/components/DSFPanel/DSFPanel.d.ts +2 -2
  32. package/dist/esm/components/DSFRadio/DSFRadio.d.ts +0 -2
  33. package/dist/esm/components/DSFSelect/DSFSelect.d.ts +1 -0
  34. package/dist/esm/components/DSFTable/DSFTable.d.ts +8 -7
  35. package/dist/esm/components/index.d.ts +2 -0
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/index.d.ts +98 -16
  39. package/package.json +7 -8
package/README.md CHANGED
@@ -5,21 +5,21 @@ An implementation of the [GOV-CY Design System](https://gov-cy.github.io/govcy-d
5
5
  ## Usage
6
6
 
7
7
  ```sh
8
- npm install govuk-react styled-components @types/styled-components --save
8
+ yarn install @netu-si/netu-react-dsf-components
9
9
  ```
10
10
 
11
11
  ```jsx
12
- import { Button } from 'govuk-react';
12
+ import { DSFButton } from 'netu-react-dsf-components';
13
13
 
14
14
  const MyComponent = ({ title }) => (
15
15
  <div>
16
16
  <h1>{title}</h1>
17
- <Button />
17
+ <DSFButton id="submitBtn">Submit</DSFButton>
18
18
  </div>
19
19
  );
20
20
  ```
21
21
 
22
- See the [Storybook](https://govuk-react.github.io/govuk-react) for examples of all available components.
22
+ See the [Storybook](https://animated-adventure-ey7gv1m.pages.github.io/) for examples of all available components.
23
23
 
24
24
  ## Related sites and projects
25
25
 
@@ -1,8 +1,19 @@
1
+ /**
2
+ * ### References:
3
+ *
4
+ * - https://github.com/netu-si/netu-react-dsf-components/tree/main/src/components/DSFBackLink
5
+ */
1
6
  import { FC } from 'react';
2
7
  import '../../resources/css/dsf.main.min.css';
3
8
  import { LinkProps } from 'react-router-dom';
4
9
  export interface DSFBackLinkProps extends LinkProps {
5
10
  onBackClick?: () => void;
6
11
  }
12
+ /**
13
+ * Use the back link component to help users go back to the previous page in a multi-page transaction.
14
+ *
15
+ * - https://animated-adventure-ey7gv1m.pages.github.io/?path=/docs/navigation-dsfbacklink--docs
16
+ * - https://gov-cy.github.io/govcy-design-system-docs/components/back_link
17
+ */
7
18
  declare const DSFBackLink: FC<DSFBackLinkProps>;
8
19
  export default DSFBackLink;
@@ -1,5 +1,5 @@
1
1
  import '../../resources/css/dsf.main.min.css';
2
- import React, { RefObject } from 'react';
2
+ import React, { RefObject, FC } from 'react';
3
3
  import { DSFInputProps } from '../DSFInput/DSFInput';
4
4
  interface InputRefObject {
5
5
  day: RefObject<HTMLInputElement>;
@@ -79,5 +79,5 @@ export interface DSFDateInputProps {
79
79
  };
80
80
  };
81
81
  }
82
- declare const DSFDateInput: React.FC<DSFDateInputProps>;
82
+ declare const DSFDateInput: FC<DSFDateInputProps>;
83
83
  export default DSFDateInput;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React, { FC } from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
3
  export interface DSFFieldSetProps {
4
4
  legend: React.ReactNode;
5
5
  children?: React.ReactNode;
6
6
  }
7
- declare const DSFFieldSet: React.FC<DSFFieldSetProps>;
7
+ declare const DSFFieldSet: FC<DSFFieldSetProps>;
8
8
  export default DSFFieldSet;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ForwardRefExoticComponent, RefAttributes } from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
3
  export interface DSFFileUploadProps extends React.InputHTMLAttributes<HTMLInputElement> {
4
4
  id: string;
@@ -8,8 +8,10 @@ export interface DSFFileUploadProps extends React.InputHTMLAttributes<HTMLInputE
8
8
  };
9
9
  label: string;
10
10
  hint?: string;
11
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
11
+ multiple?: boolean;
12
12
  acceptedFormats?: string;
13
+ name?: string;
14
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
13
15
  }
14
- declare const DSFFileUpload: React.ForwardRefExoticComponent<DSFFileUploadProps & React.RefAttributes<HTMLInputElement>>;
16
+ declare const DSFFileUpload: ForwardRefExoticComponent<DSFFileUploadProps & RefAttributes<HTMLInputElement>>;
15
17
  export default DSFFileUpload;
@@ -1,16 +1,23 @@
1
1
  import React from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
+ import '../../resources/css/custom.css';
3
4
  export interface DSFFooterProps {
4
5
  privacyStatementUrl?: string;
5
6
  cookiePolicyUrl?: string;
6
7
  accessibilityStatementUrl?: string;
8
+ privacyStatementText?: string;
9
+ cookiePolicyText?: string;
10
+ accessibilityStatementText?: string;
11
+ cyprusRepublicText?: string;
12
+ hasScroll?: boolean;
7
13
  }
8
14
  declare const DSFFooter: {
9
- ({ privacyStatementUrl, cookiePolicyUrl, accessibilityStatementUrl }: DSFFooterProps): React.JSX.Element;
15
+ ({ privacyStatementUrl, cookiePolicyUrl, accessibilityStatementUrl, privacyStatementText, cookiePolicyText, accessibilityStatementText, cyprusRepublicText, hasScroll, }: DSFFooterProps): React.JSX.Element;
10
16
  defaultProps: {
11
17
  privacyStatementUrl: undefined;
12
18
  cookiePolicyUrl: undefined;
13
19
  accessibilityStatementUrl: undefined;
20
+ hasScroll: boolean;
14
21
  };
15
22
  displayName: string;
16
23
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { FC } from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
3
  export interface DSFFormGroupProps {
4
4
  label?: string;
@@ -13,5 +13,5 @@ export interface IFormGroupContext {
13
13
  childrenCount: number;
14
14
  }
15
15
  export declare const FormGroupContext: React.Context<IFormGroupContext>;
16
- declare const DSFFormGroup: React.FC<DSFFormGroupProps>;
16
+ declare const DSFFormGroup: FC<DSFFormGroupProps>;
17
17
  export default DSFFormGroup;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ChangeEvent } from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
3
  export type NavMenuItem = {
4
4
  label: string;
@@ -8,9 +8,10 @@ export interface DSFHeaderProps {
8
8
  headerTitle: string;
9
9
  showLang?: boolean;
10
10
  menu?: NavMenuItem[];
11
+ languageHandler?: (event: ChangeEvent<HTMLSelectElement>) => void;
11
12
  }
12
13
  declare const DSFHeader: {
13
- ({ headerTitle, menu, showLang }: DSFHeaderProps): React.JSX.Element;
14
+ ({ headerTitle, menu, showLang, languageHandler }: DSFHeaderProps): React.JSX.Element;
14
15
  defaultProps: {
15
16
  showLang: boolean;
16
17
  menu: undefined;
@@ -1,9 +1,8 @@
1
- import React from 'react';
1
+ import React, { FC } from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
3
  export interface DSFLoadingBoxProps {
4
4
  loading: boolean;
5
- spinnerColor?: string;
6
5
  children?: React.ReactNode;
7
6
  }
8
- declare const DSFLoadingBox: React.FC<DSFLoadingBoxProps>;
7
+ declare const DSFLoadingBox: FC<DSFLoadingBoxProps>;
9
8
  export default DSFLoadingBox;
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
3
  export interface DSFMainProps {
4
+ id?: string;
4
5
  children: React.ReactNode;
5
6
  }
6
7
  declare const DSFMain: {
7
- ({ children }: DSFMainProps): React.JSX.Element;
8
+ ({ id, children }: DSFMainProps): React.JSX.Element;
8
9
  defaultProps: {
10
+ id: string;
9
11
  children: undefined;
10
12
  };
11
13
  displayName: string;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * ### References:
3
+ *
4
+ * - https://github.com/alphagov/govuk-frontend/tree/main/src/govuk/components/back-link
5
+ */
6
+ import React, { FC } from 'react';
7
+ import '../../resources/css/dsf.main.min.css';
8
+ export interface DSFPageProps {
9
+ /**
10
+ * Page contents
11
+ */
12
+ children?: React.ReactNode;
13
+ /**
14
+ * ID for page content
15
+ */
16
+ id?: string;
17
+ /**
18
+ * Override the default page header component.
19
+ */
20
+ header?: React.ReactNode;
21
+ /**
22
+ * Override the default page footer component.
23
+ */
24
+ footer?: React.ReactNode;
25
+ /**
26
+ * Content that needs to appear after body starts and before other components
27
+ */
28
+ bodyStartContainer?: React.ReactNode;
29
+ /**
30
+ * Content that needs to appear immediately before body ends
31
+ */
32
+ bodyEndContainer?: React.ReactNode;
33
+ /**
34
+ * Content that needs to appear outside the main page wrapper (see `main`).
35
+ * For example: A back link component, breadcrumbs, user login component
36
+ */
37
+ beforeMainContainer?: React.ReactNode;
38
+ }
39
+ /**
40
+ * Use the back link component to help users go back to the previous page in a multi-page transaction.
41
+ *
42
+ * - https://govuk-react.github.io/govuk-react/?path=/docs/back-link
43
+ * - https://design-system.service.gov.uk/components/back-link/
44
+ */
45
+ declare const DSFPage: FC<DSFPageProps>;
46
+ export default DSFPage;
@@ -0,0 +1 @@
1
+ export { default } from './DSFPage';
@@ -1,5 +1,5 @@
1
- import React, { FC } from "react";
2
- import "../../resources/css/dsf.main.min.css";
1
+ import React, { FC } from 'react';
2
+ import '../../resources/css/dsf.main.min.css';
3
3
  export interface DSFPanelProps {
4
4
  /** Panel title text */
5
5
  title: string;
@@ -1,6 +1,4 @@
1
1
  import React from 'react';
2
- import '../../resources/js/bootstrap.bundle.min.js';
3
- import '../../resources/js/app.min.js';
4
2
  import '../../resources/css/dsf.main.min.css';
5
3
  export interface DSFRadioProps extends React.InputHTMLAttributes<HTMLInputElement> {
6
4
  hint?: React.ReactNode;
@@ -10,6 +10,7 @@ export interface DSFSelectProps {
10
10
  touched?: boolean;
11
11
  };
12
12
  children: React.ReactNode;
13
+ defaultValue?: string | number;
13
14
  }
14
15
  declare const DSFSelect: FC<DSFSelectProps>;
15
16
  export default DSFSelect;
@@ -1,12 +1,13 @@
1
- import React from 'react';
1
+ import React, { FC } from 'react';
2
2
  import '../../resources/css/dsf.main.min.css';
3
- interface TableColumn {
4
- header: string;
5
- type?: 'text' | 'number';
6
- }
7
3
  export interface DSFTableProps {
8
4
  columns: TableColumn[];
9
- rowData: (string | number)[][];
5
+ rowData: (string | number | React.ReactNode)[][];
6
+ hideNumberingColumn?: boolean;
7
+ }
8
+ declare const DSFTable: FC<DSFTableProps>;
9
+ interface TableColumn {
10
+ header: string;
11
+ align?: 'left' | 'right';
10
12
  }
11
- declare const DSFTable: React.FC<DSFTableProps>;
12
13
  export default DSFTable;
@@ -23,3 +23,5 @@ export { default as DSFFormGroup } from './DSFFormGroup';
23
23
  export { default as DSFRadio } from './DSFRadio';
24
24
  export { default as DSFTable } from './DSFTable';
25
25
  export { default as DSFUserSignOut } from './DSFUserSignOut';
26
+ export { default as DSFPage } from './DSFPage';
27
+ export { default as DSFFileUpload } from './DSFFileUpload';