@coopdigital/react 1.22.3 → 1.22.4

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 (76) hide show
  1. package/dist/components/AlertBanner/AlertBanner.d.ts +9 -7
  2. package/dist/components/Author/Author.d.ts +9 -7
  3. package/dist/components/Box/Box.d.ts +10 -7
  4. package/dist/components/Button/Button.d.ts +15 -12
  5. package/dist/components/Card/Card.d.ts +42 -32
  6. package/dist/components/Checkbox/Checkbox.d.ts +7 -7
  7. package/dist/components/DatePicker/DatePicker.d.ts +17 -17
  8. package/dist/components/Dialog/Dialog.d.ts +19 -19
  9. package/dist/components/Expandable/Expandable.d.ts +10 -8
  10. package/dist/components/Field/Field.d.ts +8 -8
  11. package/dist/components/FieldMarkers/Error.d.ts +4 -4
  12. package/dist/components/FieldMarkers/Hint.d.ts +4 -4
  13. package/dist/components/FieldMarkers/Label.d.ts +5 -5
  14. package/dist/components/FieldMarkers/Label.js +3 -2
  15. package/dist/components/FieldMarkers/Legend.d.ts +5 -5
  16. package/dist/components/Fieldset/Fieldset.d.ts +14 -14
  17. package/dist/components/Flourish/Flourish.d.ts +5 -5
  18. package/dist/components/Form/Form.d.ts +4 -4
  19. package/dist/components/Image/Image.d.ts +3 -7
  20. package/dist/components/Image/Image.js +2 -0
  21. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -6
  22. package/dist/components/Logo/Logo.d.ts +6 -7
  23. package/dist/components/PasswordInput/PasswordInput.d.ts +3 -3
  24. package/dist/components/PasswordInput/PasswordInput.js +2 -2
  25. package/dist/components/Picture/Picture.d.ts +7 -5
  26. package/dist/components/Pill/Pill.d.ts +13 -8
  27. package/dist/components/Popover/Popover.d.ts +25 -22
  28. package/dist/components/Prose/Prose.d.ts +7 -7
  29. package/dist/components/Radio/Radio.d.ts +7 -7
  30. package/dist/components/Searchbox/Searchbox.d.ts +8 -16
  31. package/dist/components/Select/Select.d.ts +13 -13
  32. package/dist/components/Signpost/Signpost.d.ts +10 -7
  33. package/dist/components/SkipNav/SkipNav.d.ts +6 -5
  34. package/dist/components/Squircle/Squircle.d.ts +6 -4
  35. package/dist/components/Tag/Tag.d.ts +9 -6
  36. package/dist/components/TextInput/TextInput.d.ts +15 -15
  37. package/dist/components/TextInput/TextInput.js +1 -2
  38. package/dist/components/Textarea/Textarea.d.ts +22 -18
  39. package/dist/components/Textarea/Textarea.js +1 -2
  40. package/dist/components/ValidationSummary/ValidationSummary.d.ts +19 -14
  41. package/package.json +2 -2
  42. package/src/components/AlertBanner/AlertBanner.tsx +9 -7
  43. package/src/components/Author/Author.tsx +9 -7
  44. package/src/components/Box/Box.tsx +10 -7
  45. package/src/components/Button/Button.tsx +15 -12
  46. package/src/components/Card/Card.tsx +42 -37
  47. package/src/components/Checkbox/Checkbox.tsx +7 -7
  48. package/src/components/DatePicker/DatePicker.tsx +17 -18
  49. package/src/components/Dialog/Dialog.tsx +19 -19
  50. package/src/components/Expandable/Expandable.tsx +10 -8
  51. package/src/components/Field/Field.tsx +8 -8
  52. package/src/components/FieldMarkers/Error.tsx +4 -4
  53. package/src/components/FieldMarkers/Hint.tsx +4 -4
  54. package/src/components/FieldMarkers/Label.tsx +9 -6
  55. package/src/components/FieldMarkers/Legend.tsx +5 -5
  56. package/src/components/Fieldset/Fieldset.tsx +14 -14
  57. package/src/components/Flourish/Flourish.tsx +5 -5
  58. package/src/components/Form/Form.tsx +4 -4
  59. package/src/components/Image/Image.tsx +8 -9
  60. package/src/components/LoadingSpinner/LoadingSpinner.tsx +2 -6
  61. package/src/components/Logo/Logo.tsx +6 -7
  62. package/src/components/PasswordInput/PasswordInput.tsx +4 -3
  63. package/src/components/Picture/Picture.tsx +7 -5
  64. package/src/components/Pill/Pill.tsx +13 -8
  65. package/src/components/Popover/Popover.tsx +25 -22
  66. package/src/components/Prose/Prose.tsx +7 -7
  67. package/src/components/Radio/Radio.tsx +7 -7
  68. package/src/components/Searchbox/Searchbox.tsx +8 -14
  69. package/src/components/Select/Select.tsx +13 -13
  70. package/src/components/Signpost/Signpost.tsx +10 -7
  71. package/src/components/SkipNav/SkipNav.tsx +6 -5
  72. package/src/components/Squircle/Squircle.tsx +6 -4
  73. package/src/components/Tag/Tag.tsx +9 -6
  74. package/src/components/TextInput/TextInput.tsx +16 -16
  75. package/src/components/Textarea/Textarea.tsx +23 -19
  76. package/src/components/ValidationSummary/ValidationSummary.tsx +19 -14
@@ -1,19 +1,21 @@
1
1
  import { HTMLAttributes, JSX, ReactNode, Ref } from "react";
2
2
  //#region src/components/AlertBanner/AlertBanner.d.ts
3
3
  export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
4
- /** **(Optional)** Main content inside the banner. It can be any valid JSX or string. */
5
- children?: string | ReactNode;
6
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
4
+ /** Content inside the component.
5
+ *
6
+ * This should be an `<AlertBanner.Heading>` followed by any valid JSX. */
7
+ children?: ReactNode;
8
+ /** Specify additional CSS classes. */
7
9
  className?: string;
8
- /** **(Optional)** Specify a custom React ref for this component. */
10
+ /** Specify a custom React ref for this component. */
9
11
  ref?: Ref<HTMLDivElement>;
10
- /** **(Optional)** Specify the AlertBanner variant. */
12
+ /** Specify the component variant. */
11
13
  variant?: "black" | "default";
12
14
  }
13
15
  interface AlertBannerHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
14
- /** **(Optional)** Content inside the Heading. */
16
+ /** Content inside the component. */
15
17
  children?: React.ReactNode;
16
- /** **(Optional)** Specify additional CSS classes to be applied to the Heading. */
18
+ /** Specify additional CSS classes. */
17
19
  className?: string;
18
20
  }
19
21
  declare const AlertBanner: {
@@ -3,19 +3,21 @@ import "../Image/index.js";
3
3
  import { HTMLAttributes, JSX, Ref } from "react";
4
4
  //#region src/components/Author/Author.d.ts
5
5
  export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
6
- /** **(Optional)** Specify the Author name. */
6
+ /** Specify the Author name. */
7
7
  author?: string;
8
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
8
+ /** Specify additional CSS classes. */
9
9
  className?: string;
10
- /** **(Optional)** Specify the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
10
+ /** Specify the date.
11
+ *
12
+ * Recommended format `dd mmmm yyyy` eg: 1 January 2000. */
11
13
  date?: string;
12
- /** **(Optional)** Specify the text that will prefix the date, e.g. "Updated". */
14
+ /** Specify the text that will prefix the date, e.g. "Updated". */
13
15
  datePrefix?: string;
14
- /** **(Optional)** Specify properties of the Author Image. */
16
+ /** Specify properties of the Author Image. */
15
17
  image?: ImageProps;
16
- /** **(Optional)** Specify a custom React ref for this component. */
18
+ /** Specify a custom React ref for this component. */
17
19
  ref?: Ref<HTMLDivElement>;
18
- /** **(Optional)** Specify the Author size. */
20
+ /** Specify the component size. */
19
21
  size?: "sm" | "md";
20
22
  }
21
23
  declare const Author: {
@@ -2,17 +2,20 @@ import { StandardSizesWithNone } from "../../types/index.js";
2
2
  import React, { ForwardRefExoticComponent, HTMLAttributes, JSX, ReactNode, Ref } from "react";
3
3
  //#region src/components/Box/Box.d.ts
4
4
  export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
5
- /** **(Optional)** Specify a custom element to override default `div` */
5
+ /** Specify a custom element for the component
6
+ *
7
+ * Default: `<div>`
8
+ */
6
9
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
7
- /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
8
- children?: string | ReactNode;
9
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
10
+ /** Content inside the component. */
11
+ children?: ReactNode;
12
+ /** Specify additional CSS classes. */
10
13
  className?: string;
11
- /** **(Optional)** Specify the Box padding. */
14
+ /** Specify the padding. */
12
15
  padding?: StandardSizesWithNone;
13
- /** **(Optional)** Specify the Box border radius. */
16
+ /** Specify the border radius. */
14
17
  radius?: StandardSizesWithNone;
15
- /** **(Optional)** Specify a custom React ref for this component. */
18
+ /** Specify a custom React ref for this component. */
16
19
  ref?: Ref<HTMLDivElement>;
17
20
  }
18
21
  export declare const Box: ({ as, children, className, padding, radius, ref, ...props }: BoxProps) => JSX.Element;
@@ -1,29 +1,32 @@
1
1
  import React, { ButtonHTMLAttributes, ForwardRefExoticComponent, JSX, Ref } from "react";
2
2
  //#region src/components/Button/Button.d.ts
3
3
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
- /** **(Optional)** Specify a custom element to override default `a` or `button`. */
4
+ /** Specify a custom element for the component.
5
+ *
6
+ * Default: `<button>` or `<a>`.
7
+ */
5
8
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
6
- /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
9
+ /** Content inside the component. */
7
10
  children?: React.ReactNode;
8
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
11
+ /** Specify additional CSS classes. */
9
12
  className?: string;
10
- /** **(Optional)** Specify the URL that the Button component will link to when clicked. */
13
+ /** Specify the target URL. */
11
14
  href?: string;
12
- /** **(Optional)** Specify whether the Button should be disabled. This will not actually disable the button, just make it look disabled. Refer to Experience Library guidance on disabled buttons and accessibility. */
15
+ /** Specify whether the Button should be disabled. This will not actually disable the button, just make it look disabled. */
13
16
  isDisabled?: boolean;
14
- /** **(Optional)** Specify whether the Button should be full width. Refer to Experience Library guidance on full width buttons. */
17
+ /** Specify whether the Button should be full width. */
15
18
  isFullWidth?: boolean;
16
- /** **(Optional)** Force the Button into a loading state. */
19
+ /** Force the Button into a loading state. */
17
20
  isLoading?: boolean;
18
- /** **(Optional)** Specify text to show when the Button is in a loading state. */
21
+ /** Specify text to show when the Button is in a loading state. */
19
22
  loadingText?: string;
20
- /** **(Optional)** Callback to run when the button is pressed. If this is an async function, it will be awaited and the button will be in a pending state until the promise is resolved. */
23
+ /** Callback to run when clicked. If this is an async function, it will be awaited and the button will be in a pending state until the promise is resolved. */
21
24
  onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
22
- /** **(Optional)** Specify a custom React ref for this component. */
25
+ /** Specify a custom React ref for this component. */
23
26
  ref?: Ref<HTMLElement>;
24
- /** **(Optional)** Specify the Button size. */
27
+ /** Specify the component size. */
25
28
  size?: "sm" | "md" | "lg";
26
- /** **(Optional)** Specify the Button variant. */
29
+ /** Specify the component variant. */
27
30
  variant?: "solid" | "ghost" | "text";
28
31
  }
29
32
  declare const Button: {
@@ -6,86 +6,96 @@ import "../Picture/index.js";
6
6
  import React, { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
7
7
  //#region src/components/Card/Card.d.ts
8
8
  export interface CardProps extends HTMLAttributes<HTMLDivElement> {
9
- /** **(Optional)** Specify how the Card behaves across screen sizes.
9
+ /** Specify how the Card behaves across screen sizes.
10
10
  *
11
11
  * For finer control, use utility classes or custom CSS to control flex-direction. */
12
12
  adaptive?: "sm" | "md";
13
- /** **(Optional)** Specify an element to use for the container.
13
+ /** Specify an element for the component.
14
14
  *
15
- * Default: `article`
15
+ * Default: `<article>`
16
16
  */
17
17
  as?: "article" | "section" | "figure" | "div";
18
- /** **(Optional)** Content inside the component. */
18
+ /** Content inside the component.
19
+ *
20
+ * This should be a set of `<Card.Badge>`, `<Card.Content>` and / or `<Card.Picture>`. */
19
21
  children?: React.ReactNode;
20
- /** **(Optional)** Specify additional CSS classes. */
22
+ /** Specify additional CSS classes. */
21
23
  className?: string;
22
- /** **(Optional)** Specify the Card orientation. */
24
+ /** Specify the component orientation. */
23
25
  orientation?: "vertical" | "horizontal";
24
- /** **(Optional)** Specify the Card padding. */
26
+ /** Specify the component padding. */
25
27
  padding?: StandardSizes;
26
- /** **(Optional)** Specify the Card border radius. */
28
+ /** Specify the component border radius. */
27
29
  radius?: StandardSizes;
28
- /** **(Optional)** Specify a custom React ref for this component. */
30
+ /** Specify a custom React ref for this component. */
29
31
  ref?: Ref<HTMLDivElement>;
30
- /** **(Optional)** Enable additional styles to use the Card as a signpost.
32
+ /** Enable additional styles to use the Card as a signpost.
31
33
  *
32
34
  * Text is vertically aligned centrally and the Icon is enlarged. */
33
35
  signpost?: boolean;
34
36
  }
35
37
  interface CardHeadingProps extends HTMLAttributes<HTMLDivElement> {
36
- /** **(Optional)** Specify an element to use for the heading.
38
+ /** Specify a custom element for the component.
37
39
  *
38
- * Default: `h3`
40
+ * Default: `<h3>`
39
41
  */
40
42
  as?: "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "strong" | "figcaption";
41
- /** **(Optional)** Content inside the component. */
43
+ /** Content inside the component. */
42
44
  children?: React.ReactNode;
43
- /** **(Optional)** Specify additional CSS classes. */
45
+ /** Specify additional CSS classes. */
44
46
  className?: string;
45
47
  }
46
48
  interface CardIconProps extends HTMLAttributes<HTMLDivElement> {
47
- /** **(Optional)** Content inside the component. */
49
+ /** Content inside the component. */
48
50
  children?: React.ReactNode;
49
- /** **(Optional)** Specify additional CSS classes. */
51
+ /** Specify additional CSS classes. */
50
52
  className?: string;
51
53
  }
52
54
  interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
53
- /** **(Optional)** Content inside the component. */
55
+ /** Content inside the component.
56
+ *
57
+ * This should be a set of `<Card.Link>`, `<Card.Heading>` and / or `<Card.Icon>` followed by any valid JSX.
58
+ */
54
59
  children?: React.ReactNode;
55
- /** **(Optional)** Specify additional CSS classes. */
60
+ /** Specify additional CSS classes. */
56
61
  className?: string;
57
62
  }
58
63
  interface CardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
59
- /** **(Optional)** Specify an element to use instead of native `a`. */
64
+ /** Specify an element for the component.
65
+ *
66
+ * Default: `<a>`.
67
+ */
60
68
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
61
- /** **(Optional)** Content inside the component. */
69
+ /** Content inside the component.
70
+ *
71
+ * Usually this will be a `<Card.Heading>` but can be any valid JSX.
72
+ */
62
73
  children?: React.ReactNode;
63
- /** **(Optional)** Specify additional CSS classes. */
74
+ /** Specify additional CSS classes. */
64
75
  className?: string;
65
76
  }
66
77
  interface CardBadgeProps extends HTMLAttributes<HTMLDivElement> {
67
- /** **(Optional)** Specify alignment relative to container.
78
+ /** Specify alignment relative to container.
68
79
  *
69
- * Default: `right`
80
+ * Default: `right`.
70
81
  */
71
82
  align?: "left" | "right";
72
- /** **(Optional)** Content inside the component. */
83
+ /** Content inside the component. */
73
84
  children?: React.ReactNode;
74
- /** **(Optional)** Specify additional CSS classes. */
85
+ /** Specify additional CSS classes. */
75
86
  className?: string;
76
- /** **(Optional)** Specify position relative to top corner.
87
+ /** Specify position relative to top corner.
77
88
  *
78
- * Default: `popout`
89
+ * Default: `popout`.
79
90
  */
80
91
  position?: "inset" | "popout";
81
92
  }
82
93
  interface CardPictureProps extends PictureProps {
83
- /** **(Optional)** Specify on which side the Picture should appear. */
94
+ /** Specify alignment relative to container.
95
+ *
96
+ * Default: `left`.
97
+ */
84
98
  align?: "left" | "right";
85
- /** **(Optional)** Content inside the component. */
86
- children?: React.ReactNode;
87
- /** **(Optional)** Specify additional CSS classes. */
88
- className?: string;
89
99
  }
90
100
  declare const Card: {
91
101
  ({ adaptive, as, children, className, orientation, padding, radius, ref, signpost, ...props }: CardProps): JSX.Element;
@@ -2,19 +2,19 @@ import { StandardSizes } from "../../types/index.js";
2
2
  import { InputHTMLAttributes, JSX, Ref } from "react";
3
3
  //#region src/components/Checkbox/Checkbox.d.ts
4
4
  export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
5
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
5
+ /** Specify additional CSS classes. */
6
6
  className?: string;
7
- /** **(Optional)** Specify whether the Checkbox should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
7
+ /** Specify the disabled state. */
8
8
  disabled?: boolean;
9
- /** **(Optional)** Specify the Checkbox error state. */
9
+ /** Specify the component error state. */
10
10
  error?: boolean;
11
- /** **(Optional)** Specify the Checkbox id. Will be auto-generated if not set. */
11
+ /** Specify the component id. Will be auto-generated if not set. */
12
12
  id?: string;
13
- /** Specify the Checkbox name. */
13
+ /** Specify the component name. */
14
14
  name: string;
15
- /** **(Optional)** Specify a custom React ref for this component. */
15
+ /** Specify a custom React ref for this component. */
16
16
  ref?: Ref<HTMLInputElement>;
17
- /** **(Optional)** Specify the Checkbox size. */
17
+ /** Specify the component size. */
18
18
  size?: StandardSizes;
19
19
  }
20
20
  declare const Checkbox: {
@@ -8,49 +8,49 @@ type OnDateSelectHandler = (selected: string | string[] | {
8
8
  to?: string;
9
9
  } | undefined) => void;
10
10
  export interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onSelect" | "onChange" | "onChangeCapture" | "size" | "type"> {
11
- /** **(Optional)** Specify additional CSS classes to be applied to the wrapper. */
11
+ /** Specify additional CSS classes. */
12
12
  className?: string;
13
- /** **(Optional)** Specify whether the picker should close when selecting a date. Has no effect in range mode. */
13
+ /** Specify whether the DatePicker should close when selecting a date. Has no effect in range mode. */
14
14
  closeOnSelect?: boolean;
15
- /** **(Optional)** Specify the date format. This affects the values displayed to users and the accepted format for manual inputs. */
15
+ /** Specify the date format. This affects the values displayed to users and the accepted format for manual inputs. */
16
16
  dateFormat?: string;
17
- /** **(Optional)** Specify whether the Date Picker should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
17
+ /** Specify whether the DatePicker should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
18
18
  disabled?: boolean;
19
- /** **(Optional)** Specify dates to be disabled. Refer to react-daypicker docs for full configuration. */
19
+ /** Specify dates to be disabled. Refer to react-day-picker docs for full configuration. */
20
20
  disabledDates?: DayPickerProps["disabled"];
21
- /** **(Optional)** Specify the upper bound for the picker.
21
+ /** Specify the upper bound for the DatePicker.
22
22
  *
23
23
  * Default: today plus one year.
24
24
  */
25
25
  endDate?: Date;
26
- /** **(Optional)** Specify the Date Picker error state. */
26
+ /** Specify the component error state. */
27
27
  error?: boolean;
28
- /** **(Optional)** Specify the Date Picker id. Will be auto-generated if not set. */
28
+ /** Specify the component id. Will be auto-generated if not set. */
29
29
  id?: string;
30
- /** **(Optional)** Specify the initial month view for the picker. Combine with `initialSelected` to pre-select a date.
30
+ /** Specify the initial month view for the DatePicker. Combine with `initialSelected` to pre-select a date.
31
31
  *
32
32
  * Default: today.
33
33
  */
34
34
  initialDate?: Date | DateRange;
35
- /** **(Optional)** Specify whether the initial date should be pre-selected. */
35
+ /** Specify whether the initial date should be pre-selected. */
36
36
  initialSelected?: boolean;
37
- /** **(Optional)** Specify the picker mode. */
37
+ /** Specify the DatePicker mode. */
38
38
  mode?: Mode;
39
- /** Specify the Datepicker name. */
39
+ /** Specify the component name. */
40
40
  name: string;
41
41
  /** Provided only for compatibility with form libraries. Use `onSelect` instead. */
42
42
  onChange?: OnDateSelectHandler;
43
- /** **(Optional)** Callback to run when a date is selected and validated.
43
+ /** Callback to run when a date is selected and validated.
44
44
  *
45
45
  * Contains the selected value, which is either an ISO-8601 formatted date string, or an object with from and to values. */
46
46
  onSelect?: OnDateSelectHandler;
47
- /** **(Optional)** Specify a custom React ref for this component. */
47
+ /** Specify a custom React ref for this component. */
48
48
  ref?: Ref<HTMLInputElement>;
49
- /** **(Optional)** Specify whether this is a required field. */
49
+ /** Specify whether this is a required field. */
50
50
  required?: boolean;
51
- /** **(Optional)** Specify the DatePicker size. */
51
+ /** Specify the component size. */
52
52
  size?: StandardSizes;
53
- /** **(Optional)** Specify the lower bound for the picker.
53
+ /** Specify the lower bound for the DatePicker.
54
54
  *
55
55
  * Default: today minus one year.
56
56
  */
@@ -1,64 +1,64 @@
1
1
  import React, { DialogHTMLAttributes, HTMLAttributes, JSX, ReactEventHandler, ReactNode, Ref } from "react";
2
2
  //#region src/components/Dialog/Dialog.d.ts
3
3
  export interface DialogProps extends Omit<DialogHTMLAttributes<HTMLDialogElement>, "closedby"> {
4
- /** Content inside the Dialog.
4
+ /** Content inside the component.
5
5
  *
6
- * This should be a `<Dialog.Header>` and `<Dialog.Body>`, although arbitrary JSX children are also accepted. */
7
- children: string | ReactNode;
8
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
6
+ * This should be a set of `<Dialog.Header>` and `<Dialog.Body>`. */
7
+ children?: ReactNode;
8
+ /** Specify additional CSS classes. */
9
9
  className?: string;
10
- /** **(Optional)** Specify how the dialog can be closed. Set this to `none` to disable escape key and click-outside behaviour.
10
+ /** Specify how the Dialog can be closed. Set this to `none` to disable escape key and click-outside behaviour.
11
11
  *
12
12
  * Default: `any` */
13
13
  closedBy?: "any" | "none";
14
- /** **(Optional)** Specify the Dialog id. Will be auto-generated if not set. */
14
+ /** Specify the component id. Will be auto-generated if not set. */
15
15
  id?: string;
16
- /** Specify an accessible label for the dialog that will be read out by screen readers. */
16
+ /** Specify an accessible label for the Dialog that will be read out by screen readers. */
17
17
  label: string;
18
- /** **(Optional)** Specify the Dialog mode.
18
+ /** Specify the Dialog mode.
19
19
  *
20
20
  * Default: `dialog`
21
21
  */
22
22
  mode?: "sheet" | "dialog";
23
- /** **(Optional)** Specific a callback to run when the Dialog closes. */
23
+ /** Specify a callback to run when the Dialog closes. */
24
24
  onClose?: ReactEventHandler<HTMLDialogElement>;
25
- /** **(Optional)** Specific a callback to run when the Dialog opens. */
25
+ /** Specify a callback to run when the Dialog opens. */
26
26
  onOpen?: ReactEventHandler<HTMLDialogElement>;
27
- /** **(Optional)** Specific a callback to run when the Dialog opens or closes. */
27
+ /** Specify a callback to run when the Dialog opens or closes. */
28
28
  onToggle?: ReactEventHandler<HTMLDialogElement>;
29
29
  /** Specify the Dialog open state. This should reflect the value of your `useState`.
30
30
  *
31
31
  * Default: `false`
32
32
  */
33
33
  open: boolean;
34
- /** **(Optional)** Specify the Dialog position. This only applies when the `mode` is set to `sheet`.
34
+ /** Specify the Dialog position. This only applies when the `mode` is set to `sheet`.
35
35
  *
36
36
  * Default: `bottom`
37
37
  */
38
38
  position?: "right" | "bottom" | "left";
39
- /** **(Optional)** Specify a custom React ref for this component. */
39
+ /** Specify a custom React ref for this component. */
40
40
  ref?: Ref<HTMLDialogElement>;
41
- /** **(Optional)** Specify an ARIA role for the dialog. Use `alertdialog` if the message includes urgent information that requires an explicit user action.
41
+ /** Specify an ARIA role for the Dialog. Use `alertdialog` if the message includes urgent information that requires an explicit user action.
42
42
  *
43
43
  * Default: `dialog`
44
44
  */
45
45
  role?: "dialog" | "alertdialog";
46
46
  }
47
47
  interface DialogHeaderProps extends HTMLAttributes<HTMLDivElement> {
48
- /** **(Optional)** Content inside the Dialog Header. */
48
+ /** Content inside the component. */
49
49
  children?: React.ReactNode;
50
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
50
+ /** Specify additional CSS classes. */
51
51
  className?: string;
52
- /** **(Optional)** Specify whether to render the close button.
52
+ /** Specify whether to render the close button.
53
53
  *
54
54
  * Default: `true`
55
55
  */
56
56
  closeButton?: boolean;
57
57
  }
58
58
  interface DialogBodyProps extends HTMLAttributes<HTMLDivElement> {
59
- /** **(Optional)** Content inside the Dialog Body. */
59
+ /** Content inside the component. */
60
60
  children?: React.ReactNode;
61
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
61
+ /** Specify additional CSS classes. */
62
62
  className?: string;
63
63
  }
64
64
  declare const Dialog: {
@@ -1,23 +1,25 @@
1
1
  import { DetailsHTMLAttributes, HTMLAttributes, JSX, Ref } from "react";
2
2
  //#region src/components/Expandable/Expandable.d.ts
3
3
  export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
4
- /** Main content inside the component. This should be an `Expandable.Summary` and `Expandable.Content`. */
5
- children: React.ReactNode;
6
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
4
+ /** Content inside the component.
5
+ *
6
+ * This should be a set of `<Expandable.Summary>` and `<Expandable.Content>`. */
7
+ children?: React.ReactNode;
8
+ /** Specify additional CSS classes. */
7
9
  className?: string;
8
- /** **(Optional)** Specify a custom React ref for this component. */
10
+ /** Specify a custom React ref for this component. */
9
11
  ref?: Ref<HTMLDetailsElement>;
10
12
  }
11
13
  interface ExpandableSummaryProps extends HTMLAttributes<HTMLElement> {
12
- /** **(Optional)** Content inside the Summary. */
14
+ /** Content inside the component. */
13
15
  children?: React.ReactNode;
14
- /** **(Optional)** Specify additional CSS classes to be applied to the Summary. */
16
+ /** Specify additional CSS classes. */
15
17
  className?: string;
16
18
  }
17
19
  interface ExpandableContentProps extends HTMLAttributes<HTMLElement> {
18
- /** **(Optional)** Content inside the Expandable. */
20
+ /** Content inside the component. */
19
21
  children?: React.ReactNode;
20
- /** **(Optional)** Specify additional CSS classes to be applied to the content wrapper. */
22
+ /** Specify additional CSS classes. */
21
23
  className?: string;
22
24
  }
23
25
  declare const Expandable: {
@@ -4,19 +4,19 @@ import { LabelProps } from "../FieldMarkers/Label.js";
4
4
  import React, { HTMLAttributes, JSX, Ref } from "react";
5
5
  //#region src/components/Field/Field.d.ts
6
6
  interface FieldProps extends HTMLAttributes<HTMLDivElement> {
7
- /** **(Optional)** Specify whether the Field should render inside a box. */
7
+ /** Specify whether the Field should render inside a box. */
8
8
  boxed?: boolean;
9
- /** Form elements inside the Field.
9
+ /** Content inside the component.
10
10
  *
11
- * Usually this will be a combination of `Field.Label`, `Field.Hint`, `Field.Error` and an associated control such as `TextInput` or `Checkbox`. */
12
- children: React.ReactNode;
13
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
11
+ * This should be a set of `<Field.Label>`, `<Field.Hint>`, `<Field.Error>` and an associated form component. */
12
+ children?: React.ReactNode;
13
+ /** Specify additional CSS classes. */
14
14
  classname?: string;
15
- /** **(Optional)** Specify the Field error state. Use this to apply visual styling to the field control. */
15
+ /** Specify the component error state. */
16
16
  error?: boolean;
17
- /** **(Optional)** Specify whether the Field should show the left-hand error bar if it is in an error state. */
17
+ /** Specify whether the Field should show the left-hand error bar if it is in an error state. */
18
18
  hideErrorBar?: boolean;
19
- /** **(Optional)** Specify a custom React ref for this component. */
19
+ /** Specify a custom React ref for this component. */
20
20
  ref?: Ref<HTMLDivElement>;
21
21
  }
22
22
  declare const Field: {
@@ -1,11 +1,11 @@
1
1
  import { HTMLAttributes, JSX, ReactNode, Ref } from "react";
2
2
  //#region src/components/FieldMarkers/Error.d.ts
3
3
  export interface ErrorProps extends HTMLAttributes<HTMLSpanElement> {
4
- /** **(Optional)** Error text for the form element. Accepts any valid JSX or string. */
5
- children?: string | ReactNode;
6
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
4
+ /** Content inside the component. */
5
+ children?: ReactNode;
6
+ /** Specify additional CSS classes. */
7
7
  className?: string;
8
- /** **(Optional)** Specify a custom React ref for this component. */
8
+ /** Specify a custom React ref for this component. */
9
9
  ref?: Ref<HTMLSpanElement>;
10
10
  }
11
11
  //#endregion
@@ -1,11 +1,11 @@
1
1
  import { HTMLAttributes, JSX, ReactNode, Ref } from "react";
2
2
  //#region src/components/FieldMarkers/Hint.d.ts
3
3
  export interface HintProps extends HTMLAttributes<HTMLDivElement> {
4
- /** **(Optional)** Hint text for the form element. Accepts any valid JSX or string. */
5
- children?: string | ReactNode;
6
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
4
+ /** Content inside the component. */
5
+ children?: ReactNode;
6
+ /** Specify additional CSS classes. */
7
7
  className?: string;
8
- /** **(Optional)** Specify a custom React ref for this component. */
8
+ /** Specify a custom React ref for this component. */
9
9
  ref?: Ref<HTMLDivElement>;
10
10
  }
11
11
  //#endregion
@@ -1,13 +1,13 @@
1
1
  import { JSX, LabelHTMLAttributes, Ref } from "react";
2
2
  //#region src/components/FieldMarkers/Label.d.ts
3
3
  export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
4
- /** **(Optional)** Main label for the form element. Accepts any valid JSX or string. */
5
- children?: string | React.ReactNode;
6
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
4
+ /** Content inside the component. */
5
+ children?: React.ReactNode;
6
+ /** Specify additional CSS classes. */
7
7
  className?: string;
8
- /** **(Optional)** Specify whether the label is visible for humans or only for screen readers. */
8
+ /** Specify whether the Label is visible to humans or screen readers only. */
9
9
  isVisible?: boolean;
10
- /** **(Optional)** Specify a custom React ref for this component. */
10
+ /** Specify a custom React ref for this component. */
11
11
  ref?: Ref<HTMLLabelElement>;
12
12
  }
13
13
  //#endregion
@@ -2,11 +2,12 @@ import { useField } from "../Field/Field.context.js";
2
2
  import clsx from "clsx";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/components/FieldMarkers/Label.tsx
5
- const Label = ({ children, className, isVisible = true, ref, ...props }) => {
5
+ const Label = ({ children, className, htmlFor, id, isVisible = true, ref, ...props }) => {
6
6
  const field = useField();
7
7
  const componentProps = {
8
8
  className: clsx("coop-field-label", !isVisible && "sr-only", className),
9
- htmlFor: props.htmlFor ?? (field?.id ? field.id + (field?.suffix ?? "") : void 0),
9
+ htmlFor: htmlFor ?? (field?.id ? field.id + (field?.suffix ?? "") : void 0),
10
+ id: id ?? (field?.id ? field.id + "_label" : void 0),
10
11
  ...props
11
12
  };
12
13
  return /* @__PURE__ */ jsx("label", {
@@ -1,13 +1,13 @@
1
1
  import { HTMLAttributes, JSX, Ref } from "react";
2
2
  //#region src/components/FieldMarkers/Legend.d.ts
3
3
  export interface LegendProps extends HTMLAttributes<HTMLLegendElement> {
4
- /** **(Optional)** Main legend for the fieldset. Accepts any valid JSX or string. */
5
- children?: string | React.ReactNode;
6
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
4
+ /** Content inside the component. */
5
+ children?: React.ReactNode;
6
+ /** Specify additional CSS classes. */
7
7
  className?: string;
8
- /** **(Optional)** Specify whether the legend should be visible to humans or screen readers. */
8
+ /** Specify whether the Legend is visible to humans or screen readers only. */
9
9
  isVisible?: boolean;
10
- /** **(Optional)** Specify a custom React ref for this component. */
10
+ /** Specify a custom React ref for this component. */
11
11
  ref?: Ref<HTMLLegendElement>;
12
12
  }
13
13
  //#endregion