@bcgov/design-system-react-components 0.0.3 → 0.0.5

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 (31) hide show
  1. package/README.md +35 -11
  2. package/dist/cjs/index.cjs +295 -326
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/types/components/Button/Button.d.ts +12 -0
  5. package/dist/cjs/types/components/Footer/Footer.d.ts +37 -0
  6. package/dist/cjs/types/components/Footer/index.d.ts +2 -0
  7. package/dist/cjs/types/components/Header/Header.d.ts +29 -0
  8. package/dist/cjs/types/components/Header/index.d.ts +2 -0
  9. package/dist/cjs/types/components/Select/Select.d.ts +9 -3
  10. package/dist/cjs/types/components/SvgBcLogo/SvgBcLogo.d.ts +3 -0
  11. package/dist/cjs/types/components/SvgBcLogo/index.d.ts +1 -0
  12. package/dist/cjs/types/components/Tag/Tag.d.ts +7 -1
  13. package/dist/cjs/types/components/TagGroup/TagGroup.d.ts +9 -0
  14. package/dist/cjs/types/components/TagList/TagList.d.ts +3 -0
  15. package/dist/cjs/types/components/index.d.ts +3 -1
  16. package/dist/esm/index.js +293 -326
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/types/components/Button/Button.d.ts +12 -0
  19. package/dist/esm/types/components/Footer/Footer.d.ts +37 -0
  20. package/dist/esm/types/components/Footer/index.d.ts +2 -0
  21. package/dist/esm/types/components/Header/Header.d.ts +29 -0
  22. package/dist/esm/types/components/Header/index.d.ts +2 -0
  23. package/dist/esm/types/components/Select/Select.d.ts +9 -3
  24. package/dist/esm/types/components/SvgBcLogo/SvgBcLogo.d.ts +3 -0
  25. package/dist/esm/types/components/SvgBcLogo/index.d.ts +1 -0
  26. package/dist/esm/types/components/Tag/Tag.d.ts +7 -1
  27. package/dist/esm/types/components/TagGroup/TagGroup.d.ts +9 -0
  28. package/dist/esm/types/components/TagList/TagList.d.ts +3 -0
  29. package/dist/esm/types/components/index.d.ts +3 -1
  30. package/dist/index.d.ts +108 -18
  31. package/package.json +19 -19
@@ -1,9 +1,21 @@
1
1
  import { ButtonProps as ReactAriaButtonProps } from "react-aria-components";
2
2
  import "./Button.css";
3
3
  export interface ButtonProps extends ReactAriaButtonProps {
4
+ /**
5
+ * Defaults to `medium`. `small` is shorter vertically.
6
+ */
4
7
  size?: "small" | "medium";
8
+ /**
9
+ * Defaults to `primary`.
10
+ */
5
11
  variant?: "primary" | "secondary" | "tertiary" | "link";
12
+ /**
13
+ * For destructive/deletion actions.
14
+ */
6
15
  danger?: boolean;
16
+ /**
17
+ * If true, renders a square button intended for a single icon.
18
+ */
7
19
  isIconButton?: boolean;
8
20
  }
9
21
  export default function Button({ size, variant, danger, isIconButton, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import "./Footer.css";
3
+ export interface FooterProps {
4
+ /**
5
+ * Land acknowledgement block (defaults to Gov.bc.ca land acknowledgement)
6
+ */
7
+ acknowledgement?: React.ReactElement;
8
+ /**
9
+ * Logo slot (defaults to BC Gov horizontal logo)
10
+ */
11
+ logo?: React.ReactElement;
12
+ /**
13
+ * Contact information block (defaults to Gov.bc.ca contact information)
14
+ */
15
+ contact?: React.ReactElement;
16
+ /**
17
+ * Link list block (defaults to Gov.bc.ca link list)
18
+ */
19
+ links?: React.ReactElement;
20
+ /**
21
+ * Copyright string (defaults to current year)
22
+ */
23
+ copyright?: string;
24
+ /**
25
+ * Hide the acknowledgement section
26
+ */
27
+ hideAcknowledgement?: boolean;
28
+ /**
29
+ * Hide the logo, contact information, and links section
30
+ */
31
+ hideLogoAndLinks?: boolean;
32
+ /**
33
+ * Hide the copyright string
34
+ */
35
+ hideCopyright?: boolean;
36
+ }
37
+ export default function Footer({ acknowledgement, logo, contact, links, copyright, hideAcknowledgement, hideLogoAndLinks, hideCopyright, }: FooterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Footer";
2
+ export type { FooterProps } from "./Footer";
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import "./Header.css";
3
+ export interface HeaderProps {
4
+ /**
5
+ * Link element that surrounds the logo. Use what's appropriate for your
6
+ * router, like a `<Link>`. Defaults to a generic HTML link element like
7
+ * `<a href="/" title="Government of British Columbia">`.
8
+ */
9
+ logoLinkElement?: React.ReactElement;
10
+ /**
11
+ * Image used for the logo. Defaults to an SVG of the Government of B.C. logo.
12
+ */
13
+ logoImage?: JSX.Element;
14
+ /**
15
+ * Array of link elements that are not visible until they are focused. Used
16
+ * for accessibility for keyboard users, to let them easily skip to main
17
+ * content, navigation, etc.
18
+ */
19
+ skipLinks?: React.ReactElement[];
20
+ /**
21
+ * Header title text that appears to the right of the logo.
22
+ */
23
+ title?: string;
24
+ /**
25
+ * Desired element that renders the `title` string. Defaults to `<span>`.
26
+ */
27
+ titleElement?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "p";
28
+ }
29
+ export default function Header({ children, logoLinkElement, logoImage, skipLinks, title, titleElement, }: React.PropsWithChildren<HeaderProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Header";
2
+ export type { HeaderProps } from "./Header";
@@ -6,7 +6,7 @@ export interface ListBoxItemProps extends ReactAriaListBoxItemProps {
6
6
  label: string;
7
7
  /** Descriptive text that appears below the option's label */
8
8
  description?: string;
9
- /** Marks an option visually with red text to indicate danger */
9
+ /** Marks an option visually with red text to indicate a destructive/dangerous option */
10
10
  isDestructive?: boolean;
11
11
  /** Left icon slot */
12
12
  iconLeft?: React.ReactElement;
@@ -14,17 +14,23 @@ export interface ListBoxItemProps extends ReactAriaListBoxItemProps {
14
14
  iconRight?: React.ReactElement;
15
15
  }
16
16
  export interface SelectionSectionProps {
17
- /** Display name for the section */
18
17
  id: Key;
18
+ /** Label for the section */
19
19
  header?: string;
20
+ /** Flat list of options within the section */
20
21
  items: ListBoxItemProps[];
21
22
  }
22
23
  export interface SelectProps<T extends object> extends ReactAriaSelectProps<T> {
24
+ /** Use `items` for a flat list of options */
23
25
  items?: ListBoxItemProps[];
26
+ /** Use `sections` for a sectioned list with `items` options in each section */
24
27
  sections?: SelectionSectionProps[];
25
28
  /** Text label for the Select component */
26
29
  label?: string;
30
+ /** Temporary text that occupies the select input when no option has been selected. */
31
+ placeholder?: string;
27
32
  /** Defaults to `medium` */
28
33
  size?: "small" | "medium";
29
34
  }
30
- export default function Select<T extends object>({ items, sections, label, size, ...props }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
35
+ /** Select displays a collapsible list of options and allows a user to select one of them. */
36
+ export default function Select<T extends object>({ items, sections, label, placeholder, size, ...props }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export default function SvgBcLogo({ id }: {
2
+ id?: string | undefined;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from "./SvgBcLogo";
@@ -2,7 +2,13 @@
2
2
  import { TagProps as ReactAriaTagProps } from "react-aria-components";
3
3
  import "./Tag.css";
4
4
  export interface TagProps extends ReactAriaTagProps {
5
+ /**
6
+ * Icon that appears to the left of the `textValue` field
7
+ */
5
8
  icon?: React.ReactNode;
9
+ /**
10
+ * Background color
11
+ */
6
12
  color?: "bc-blue" | "bc-gold" | "blue" | "dark" | "gray" | "grey" | "green" | "red" | "yellow";
7
13
  }
8
- export default function Tag({ className, color, icon, id, textValue, }: TagProps): import("react/jsx-runtime").JSX.Element;
14
+ export default function Tag({ color, icon, id, textValue }: TagProps): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,17 @@
1
1
  import { TagGroupProps as ReactAriaTagGroupProps } from "react-aria-components";
2
2
  import "./TagGroup.css";
3
3
  export interface TagGroupProps extends ReactAriaTagGroupProps {
4
+ /**
5
+ * Labels the TagGroup, appears above the tags.
6
+ */
4
7
  label?: string;
8
+ /**
9
+ * Extended description of the TagGroup, appears below the tags.
10
+ */
5
11
  description?: string;
12
+ /**
13
+ * Error message, appears below the tags and below the optional description.
14
+ */
6
15
  errorMessage?: string;
7
16
  }
8
17
  export default function TagGroup({ children, label, description, errorMessage, ...props }: TagGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,9 @@ import { TagProps } from "../Tag";
3
3
  import "./TagList.css";
4
4
  export interface TagListProps<T> extends Pick<ReactAriaTagListProps<T>, "children" | "renderEmptyState"> {
5
5
  items: TagProps[];
6
+ /**
7
+ * Used to set the `flex-direction` on the TagList.
8
+ */
6
9
  orientation?: "horizontal" | "vertical";
7
10
  }
8
11
  export default function TagList<T extends object>({ items, orientation, renderEmptyState, ...props }: TagListProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,9 @@
1
1
  import "@bcgov/design-tokens/css/variables.css";
2
2
  export { default as Button } from "./Button";
3
+ export { default as Header } from "./Header";
4
+ export { default as Footer } from "./Footer";
3
5
  export { default as Select } from "./Select";
4
- export { default as SelectItem } from "./SelectItem";
6
+ export { default as SvgBcLogo } from "./SvgBcLogo";
5
7
  export { default as Tag } from "./Tag";
6
8
  export { default as TagGroup } from "./TagGroup";
7
9
  export { default as TagList } from "./TagList";
package/dist/index.d.ts CHANGED
@@ -4,19 +4,95 @@ import { ButtonProps as ButtonProps$1, SelectProps as SelectProps$1, ListBoxItem
4
4
  import React$1 from 'react';
5
5
 
6
6
  interface ButtonProps extends ButtonProps$1 {
7
+ /**
8
+ * Defaults to `medium`. `small` is shorter vertically.
9
+ */
7
10
  size?: "small" | "medium";
11
+ /**
12
+ * Defaults to `primary`.
13
+ */
8
14
  variant?: "primary" | "secondary" | "tertiary" | "link";
15
+ /**
16
+ * For destructive/deletion actions.
17
+ */
9
18
  danger?: boolean;
19
+ /**
20
+ * If true, renders a square button intended for a single icon.
21
+ */
10
22
  isIconButton?: boolean;
11
23
  }
12
24
  declare function Button({ size, variant, danger, isIconButton, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
13
25
 
26
+ interface HeaderProps {
27
+ /**
28
+ * Link element that surrounds the logo. Use what's appropriate for your
29
+ * router, like a `<Link>`. Defaults to a generic HTML link element like
30
+ * `<a href="/" title="Government of British Columbia">`.
31
+ */
32
+ logoLinkElement?: React$1.ReactElement;
33
+ /**
34
+ * Image used for the logo. Defaults to an SVG of the Government of B.C. logo.
35
+ */
36
+ logoImage?: JSX.Element;
37
+ /**
38
+ * Array of link elements that are not visible until they are focused. Used
39
+ * for accessibility for keyboard users, to let them easily skip to main
40
+ * content, navigation, etc.
41
+ */
42
+ skipLinks?: React$1.ReactElement[];
43
+ /**
44
+ * Header title text that appears to the right of the logo.
45
+ */
46
+ title?: string;
47
+ /**
48
+ * Desired element that renders the `title` string. Defaults to `<span>`.
49
+ */
50
+ titleElement?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "p";
51
+ }
52
+ declare function Header({ children, logoLinkElement, logoImage, skipLinks, title, titleElement, }: React$1.PropsWithChildren<HeaderProps>): react_jsx_runtime.JSX.Element;
53
+
54
+ interface FooterProps {
55
+ /**
56
+ * Land acknowledgement block (defaults to Gov.bc.ca land acknowledgement)
57
+ */
58
+ acknowledgement?: React$1.ReactElement;
59
+ /**
60
+ * Logo slot (defaults to BC Gov horizontal logo)
61
+ */
62
+ logo?: React$1.ReactElement;
63
+ /**
64
+ * Contact information block (defaults to Gov.bc.ca contact information)
65
+ */
66
+ contact?: React$1.ReactElement;
67
+ /**
68
+ * Link list block (defaults to Gov.bc.ca link list)
69
+ */
70
+ links?: React$1.ReactElement;
71
+ /**
72
+ * Copyright string (defaults to current year)
73
+ */
74
+ copyright?: string;
75
+ /**
76
+ * Hide the acknowledgement section
77
+ */
78
+ hideAcknowledgement?: boolean;
79
+ /**
80
+ * Hide the logo, contact information, and links section
81
+ */
82
+ hideLogoAndLinks?: boolean;
83
+ /**
84
+ * Hide the copyright string
85
+ */
86
+ hideCopyright?: boolean;
87
+ }
88
+ declare function Footer({ acknowledgement, logo, contact, links, copyright, hideAcknowledgement, hideLogoAndLinks, hideCopyright, }: FooterProps): react_jsx_runtime.JSX.Element;
89
+
14
90
  interface ListBoxItemProps extends ListBoxItemProps$1 {
15
91
  /** Text label for the option. Provide an `id` if this is not unique. */
16
92
  label: string;
17
93
  /** Descriptive text that appears below the option's label */
18
94
  description?: string;
19
- /** Marks an option visually with red text to indicate danger */
95
+ /** Marks an option visually with red text to indicate a destructive/dangerous option */
20
96
  isDestructive?: boolean;
21
97
  /** Left icon slot */
22
98
  iconLeft?: React$1.ReactElement;
@@ -24,52 +100,66 @@ interface ListBoxItemProps extends ListBoxItemProps$1 {
24
100
  iconRight?: React$1.ReactElement;
25
101
  }
26
102
  interface SelectionSectionProps {
27
- /** Display name for the section */
28
103
  id: Key;
104
+ /** Label for the section */
29
105
  header?: string;
106
+ /** Flat list of options within the section */
30
107
  items: ListBoxItemProps[];
31
108
  }
32
109
  interface SelectProps<T extends object> extends SelectProps$1<T> {
110
+ /** Use `items` for a flat list of options */
33
111
  items?: ListBoxItemProps[];
112
+ /** Use `sections` for a sectioned list with `items` options in each section */
34
113
  sections?: SelectionSectionProps[];
35
114
  /** Text label for the Select component */
36
115
  label?: string;
116
+ /** Temporary text that occupies the select input when no option has been selected. */
117
+ placeholder?: string;
37
118
  /** Defaults to `medium` */
38
119
  size?: "small" | "medium";
39
120
  }
40
- declare function Select<T extends object>({ items, sections, label, size, ...props }: SelectProps<T>): react_jsx_runtime.JSX.Element;
121
+ /** Select displays a collapsible list of options and allows a user to select one of them. */
122
+ declare function Select<T extends object>({ items, sections, label, placeholder, size, ...props }: SelectProps<T>): react_jsx_runtime.JSX.Element;
41
123
 
42
- interface SelectItemProps extends ListBoxItemProps$1 {
43
- /** Text label for the option. Provide an `id` if this is not unique. */
44
- label: string;
45
- /** Descriptive text that appears below the option's label */
46
- description?: string;
47
- /** Marks an option visually with red text to indicate danger */
48
- isDestructive?: boolean;
49
- /** Left icon slot */
50
- iconLeft?: React$1.ReactElement;
51
- /** Right icon slot */
52
- iconRight?: React$1.ReactElement;
53
- }
54
- declare function SelectItem({ description, id, iconLeft, iconRight, isDestructive, label, }: SelectItemProps): react_jsx_runtime.JSX.Element;
124
+ declare function SvgBcLogo({ id }: {
125
+ id?: string | undefined;
126
+ }): react_jsx_runtime.JSX.Element;
55
127
 
56
128
  interface TagProps extends TagProps$1 {
129
+ /**
130
+ * Icon that appears to the left of the `textValue` field
131
+ */
57
132
  icon?: React.ReactNode;
133
+ /**
134
+ * Background color
135
+ */
58
136
  color?: "bc-blue" | "bc-gold" | "blue" | "dark" | "gray" | "grey" | "green" | "red" | "yellow";
59
137
  }
60
- declare function Tag({ className, color, icon, id, textValue, }: TagProps): react_jsx_runtime.JSX.Element;
138
+ declare function Tag({ color, icon, id, textValue }: TagProps): react_jsx_runtime.JSX.Element;
61
139
 
62
140
  interface TagGroupProps extends TagGroupProps$1 {
141
+ /**
142
+ * Labels the TagGroup, appears above the tags.
143
+ */
63
144
  label?: string;
145
+ /**
146
+ * Extended description of the TagGroup, appears below the tags.
147
+ */
64
148
  description?: string;
149
+ /**
150
+ * Error message, appears below the tags and below the optional description.
151
+ */
65
152
  errorMessage?: string;
66
153
  }
67
154
  declare function TagGroup({ children, label, description, errorMessage, ...props }: TagGroupProps): react_jsx_runtime.JSX.Element;
68
155
 
69
156
  interface TagListProps<T> extends Pick<TagListProps$1<T>, "children" | "renderEmptyState"> {
70
157
  items: TagProps[];
158
+ /**
159
+ * Used to set the `flex-direction` on the TagList.
160
+ */
71
161
  orientation?: "horizontal" | "vertical";
72
162
  }
73
163
  declare function TagList<T extends object>({ items, orientation, renderEmptyState, ...props }: TagListProps<T>): react_jsx_runtime.JSX.Element;
74
164
 
75
- export { Button, Select, SelectItem, Tag, TagGroup, TagList };
165
+ export { Button, Footer, Header, Select, SvgBcLogo, Tag, TagGroup, TagList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bcgov/design-system-react-components",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "rollup": "rollup -c --bundleConfigAsCjs",
@@ -19,7 +19,7 @@
19
19
  "types": "dist/index.d.ts",
20
20
  "dependencies": {
21
21
  "@bcgov/design-tokens": "^2.0.1",
22
- "react-aria-components": "1.0.1"
22
+ "react-aria-components": "1.1.1"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@bcgov/bc-sans": "^2.1.0",
@@ -27,35 +27,35 @@
27
27
  "react-dom": "^16.14.0 || ^17.0.0-rc.1 || ^18.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@react-stately/data": "^3.10.3",
30
+ "@react-stately/data": "^3.11.2",
31
31
  "@rollup/plugin-commonjs": "^25.0.7",
32
32
  "@rollup/plugin-json": "^6.1.0",
33
33
  "@rollup/plugin-node-resolve": "^15.2.3",
34
34
  "@rollup/plugin-typescript": "^11.1.6",
35
- "@storybook/addon-essentials": "^8.0.0-alpha.17",
36
- "@storybook/addon-interactions": "^8.0.0-alpha.17",
37
- "@storybook/addon-links": "^8.0.0-alpha.17",
38
- "@storybook/blocks": "^8.0.0-alpha.17",
39
- "@storybook/react": "^8.0.0-alpha.17",
40
- "@storybook/react-vite": "^8.0.0-alpha.17",
35
+ "@storybook/addon-essentials": "^8.0.0-rc.3",
36
+ "@storybook/addon-interactions": "^8.0.0-rc.3",
37
+ "@storybook/addon-links": "^8.0.0-rc.3",
38
+ "@storybook/blocks": "^8.0.0-rc.3",
39
+ "@storybook/react": "^8.0.0-rc.3",
40
+ "@storybook/react-vite": "^8.0.0-rc.3",
41
41
  "@storybook/testing-library": "^0.2.2",
42
- "@types/react": "^18.2.51",
43
- "@types/react-dom": "^18.2.18",
44
- "@typescript-eslint/eslint-plugin": "^6.20.0",
45
- "@typescript-eslint/parser": "^6.20.0",
42
+ "@types/react": "^18.2.64",
43
+ "@types/react-dom": "^18.2.21",
44
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
45
+ "@typescript-eslint/parser": "^7.1.1",
46
46
  "@vitejs/plugin-react": "^4.2.1",
47
- "eslint": "^8.56.0",
47
+ "eslint": "^8.57.0",
48
48
  "eslint-plugin-react-hooks": "^4.6.0",
49
49
  "eslint-plugin-react-refresh": "^0.4.5",
50
- "eslint-plugin-storybook": "^0.6.15",
51
- "rollup": "^4.9.6",
50
+ "eslint-plugin-storybook": "^0.8.0",
51
+ "rollup": "^4.12.1",
52
52
  "rollup-plugin-dts": "^6.1.0",
53
53
  "rollup-plugin-peer-deps-external": "^2.2.4",
54
54
  "rollup-plugin-postcss": "^4.0.2",
55
- "storybook": "^8.0.0-alpha.17",
55
+ "storybook": "^8.0.0-rc.3",
56
56
  "tslib": "^2.6.2",
57
- "typescript": "^5.3.3",
58
- "vite": "^5.0.12"
57
+ "typescript": "^5.4.2",
58
+ "vite": "^5.1.5"
59
59
  },
60
60
  "author": "Tyler Krys <Tyler.Krys@gov.bc.ca>",
61
61
  "license": "Apache-2.0",