@coopdigital/react 1.22.2 → 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
@@ -2,40 +2,40 @@ import { StandardSizes } from "../../types/index.js";
2
2
  import { InputHTMLAttributes, JSX, Ref } from "react";
3
3
  //#region src/components/TextInput/TextInput.d.ts
4
4
  export interface TextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "prefix" | "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 TextInput 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 TextInput error state. */
9
+ /** Specify the component error state. */
10
10
  error?: boolean;
11
- /** **(Optional)** Specify the wrapper behaviour. When true, width is fit-content, otherwise it expands to 100%.
11
+ /** Specify the wrapper behaviour. When true, width is fit-content, otherwise it expands to 100%.
12
12
  *
13
13
  * Default: false
14
14
  */
15
15
  fit?: boolean;
16
- /** **(Optional)** Specify the TextInput id. Will be auto-generated if not set. */
16
+ /** Specify the component id. Will be auto-generated if not set. */
17
17
  id?: string;
18
- /** Specify the TextInput name. */
18
+ /** Specify the component name. */
19
19
  name: string;
20
- /** **(Optional)** Specify the TextInput placeholder text. Do not use in place of a form label. */
20
+ /** Specify placeholder text. Do not use in place of a form label. */
21
21
  placeholder?: string;
22
- /** **(Optional)** Specify the prefix. It can be any valid JSX or string. */
22
+ /** Specify the prefix. */
23
23
  prefix?: React.ReactNode;
24
- /** **(Optional)** Specify whether the prefix should be rendered inside the input. */
24
+ /** Specify whether the prefix should be rendered inside the input. */
25
25
  prefixInline?: boolean;
26
- /** **(Optional)** Specify a custom React ref for this component. */
26
+ /** Specify a custom React ref for this component. */
27
27
  ref?: Ref<HTMLInputElement>;
28
- /** **(Optional)** Specify the TextInput size. */
28
+ /** Specify the component size. */
29
29
  size?: StandardSizes;
30
- /** **(Optional)** Specify the suffix. It can be any valid JSX or string. */
30
+ /** Specify the suffix. */
31
31
  suffix?: React.ReactNode;
32
- /** **(Optional)** Specify whether the suffix should be rendered inside the input. */
32
+ /** Specify whether the suffix should be rendered inside the input. */
33
33
  suffixInline?: boolean;
34
- /** **(Optional)** Specify the TextInput type. */
34
+ /** Specify the underlying input type. */
35
35
  type?: "text" | "email" | "number" | "password" | "search" | "tel" | "url" | "date" | "datetime-local" | "week" | "month" | "time";
36
36
  }
37
37
  declare const TextInput: {
38
- ({ "aria-placeholder": ariaPlaceholder, className, disabled, error, fit, id, name, placeholder, prefix, prefixInline, ref, size, suffix, suffixInline, type, ...props }: TextInputProps): JSX.Element;
38
+ ({ className, disabled, error, fit, id, name, placeholder, prefix, prefixInline, ref, size, suffix, suffixInline, type, ...props }: TextInputProps): JSX.Element;
39
39
  slot: {
40
40
  field: boolean;
41
41
  name: string;
@@ -3,10 +3,9 @@ import { useField } from "../Field/Field.context.js";
3
3
  import clsx from "clsx";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/components/TextInput/TextInput.tsx
6
- const TextInput = ({ "aria-placeholder": ariaPlaceholder, className, disabled, error = false, fit = false, id, name, placeholder, prefix, prefixInline = false, ref, size, suffix, suffixInline = false, type = "text", ...props }) => {
6
+ const TextInput = ({ className, disabled, error = false, fit = false, id, name, placeholder, prefix, prefixInline = false, ref, size, suffix, suffixInline = false, type = "text", ...props }) => {
7
7
  const field = useField();
8
8
  const componentProps = {
9
- "aria-placeholder": placeholder ?? ariaPlaceholder ?? void 0,
10
9
  className: clsx("coop-text-input", className),
11
10
  "data-error": error || void 0,
12
11
  "data-fit": fit || void 0,
@@ -2,43 +2,47 @@ import { StandardSizes } from "../../types/index.js";
2
2
  import { JSX, Ref, TextareaHTMLAttributes } from "react";
3
3
  //#region src/components/Textarea/Textarea.d.ts
4
4
  export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
5
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
5
+ /** Specify additional CSS classes. */
6
6
  className?: string;
7
- /** Specify the number of columns (characters per row) in the Textarea. Defaults to `30`. */
7
+ /** Specify the number of columns (characters per row) in the Textarea.
8
+ *
9
+ * Default: `30`.
10
+ */
8
11
  cols?: number;
9
- /** **(Optional)** Specify whether to show the character counter underneath the Textarea. */
12
+ /** Specify whether to show the character counter underneath the Textarea. */
10
13
  counter?: boolean;
11
- /** **(Optional)** Specify whether the Textarea should allow more characters than its `maxLength` value.
14
+ /** Specify whether the Textarea should allow more characters than its `maxLength` value.
12
15
  *
13
- * Defaults to `false`, meaning users can enter more characters than the maximum but will be warned if they go over the limit.
16
+ * Default: `false`. Users can enter more characters than the maximum but will be warned if they go over the limit.
14
17
  */
15
18
  cutoff?: boolean;
16
- /** **(Optional)** Specify whether the Textarea should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
19
+ /** Specify the disabled state. */
17
20
  disabled?: boolean;
18
- /** **(Optional)** Specify the Textarea error state */
21
+ /** Specify the component error state */
19
22
  error?: boolean;
20
- /** **(Optional)** Specify the wrapper behaviour. When true, width is fit-content, otherwise it expands to 100%.
23
+ /** Specify the wrapper behaviour. When true, width is fit-content, otherwise it expands to 100%.
21
24
  *
22
- * Default: false
25
+ * Default: `false`
23
26
  */
24
27
  fit?: boolean;
25
- /** **(Optional)** Specify the Textarea id. Will be auto-generated if not set. */
28
+ /** Specify the component id. Will be auto-generated if not set. */
26
29
  id?: string;
27
- /** **(Optional)** Specify the Textarea maxLength. This is the maximum number of characters users can enter. */
28
- maxLength?: number;
29
- /** Specify the Textarea name. */
30
+ /** Specify the component name. */
30
31
  name: string;
31
- /** **(Optional)** Specify the Textarea placeholder text. Do not use in place of a form label. */
32
+ /** Specify placeholder text. Do not use in place of a form label. */
32
33
  placeholder?: string;
33
- /** **(Optional)** Specify a custom React ref for this component. */
34
+ /** Specify a custom React ref for this component. */
34
35
  ref?: Ref<HTMLTextAreaElement>;
35
- /** **(Optional)** Specify the number of rows (lines of text) in the Textarea. Defaults to `4`. */
36
+ /** Specify the number of rows (lines of text) in the Textarea.
37
+ *
38
+ * Default: `4`.
39
+ */
36
40
  rows?: number;
37
- /** **(Optional)** Specify the Textarea size. */
41
+ /** Specify the component size. */
38
42
  size?: StandardSizes;
39
43
  }
40
44
  declare const Textarea: {
41
- ({ "aria-placeholder": ariaPlaceholder, className, cols, counter, cutoff, disabled, error, fit, id, maxLength, name, onChange: userOnChange, placeholder, ref, rows, size, ...props }: TextareaProps): JSX.Element;
45
+ ({ className, cols, counter, cutoff, disabled, error, fit, id, maxLength, name, onChange: userOnChange, placeholder, ref, rows, size, ...props }: TextareaProps): JSX.Element;
42
46
  slot: {
43
47
  field: boolean;
44
48
  name: string;
@@ -9,10 +9,9 @@ const DEBOUNCE_DELAY = 750;
9
9
  const charCountMessage = (remaining) => {
10
10
  return `You have ${Math.abs(remaining).toLocaleString()} ${Math.abs(remaining) === 1 ? "character" : "characters"} ${remaining < 0 ? "too many" : "remaining"}`;
11
11
  };
12
- const Textarea = ({ "aria-placeholder": ariaPlaceholder, className, cols = 30, counter = false, cutoff = false, disabled = false, error = false, fit = false, id, maxLength, name, onChange: userOnChange, placeholder, ref, rows = 4, size, ...props }) => {
12
+ const Textarea = ({ className, cols = 30, counter = false, cutoff = false, disabled = false, error = false, fit = false, id, maxLength, name, onChange: userOnChange, placeholder, ref, rows = 4, size, ...props }) => {
13
13
  const field = useField();
14
14
  const componentProps = {
15
- "aria-placeholder": placeholder ?? ariaPlaceholder ?? void 0,
16
15
  className: clsx("coop-textarea", className),
17
16
  cols,
18
17
  "data-error": error ?? void 0,
@@ -1,38 +1,43 @@
1
1
  import React, { HTMLAttributes, JSX, ReactNode, Ref } from "react";
2
2
  //#region src/components/ValidationSummary/ValidationSummary.d.ts
3
3
  export interface ValidationSummaryProps extends HTMLAttributes<HTMLDivElement> {
4
- /** **(Optional)** Specify if the summary should be focused and the parent form scrolled into view if there are errors.
4
+ /** Specify if the summary should be focused and the parent form scrolled into view if there are errors.
5
5
  *
6
- * Default: true
6
+ * Default: `true`
7
7
  */
8
8
  autoScroll?: boolean;
9
- /** **(Optional)** This should be a set of `ValidationSummary.Heading`, `ValidationSummary.Prompt` and `ValidationSummary.Errors` components. */
9
+ /** Content inside the component.
10
+ *
11
+ * This should be a set of `<ValidationSummary.Heading>`, `<ValidationSummary.Prompt>` and `<ValidationSummary.Errors>`. */
10
12
  children?: ReactNode;
11
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
13
+ /** Specify additional CSS classes. */
12
14
  className?: string;
13
- /** **(Optional)** Specify if the summary should always render regardless of error state. Use this if you want to control the logic in your own code.
15
+ /** Specify if the summary should always render regardless of error state. Use this if you want to control the logic in your own code.
14
16
  *
15
- * Default: false
17
+ * Default: `false`
16
18
  */
17
19
  forceMount?: boolean;
18
- /** **(Optional)** Specify a custom React ref for this component. */
20
+ /** Specify a custom React ref for this component. */
19
21
  ref?: Ref<HTMLDivElement>;
20
22
  }
21
23
  interface ValidationSummaryHeadingProps extends HTMLAttributes<HTMLDivElement> {
22
- /** **(Optional)** Specify a custom element to use instead of `h2`. */
24
+ /** Specify a custom element for the component.
25
+ *
26
+ * Default: `<h2>`.
27
+ */
23
28
  as?: "h2" | "h3" | "h4" | "h5" | "h6";
24
- /** **(Optional)** Content inside the Heading.
29
+ /** Content inside the component.
25
30
  *
26
- * Defaults to `There's a problem`.
31
+ * Default: `There's a problem`.
27
32
  */
28
33
  children?: React.ReactNode;
29
- /** **(Optional)** Specify additional CSS classes to be applied to the Heading. */
34
+ /** Specify additional CSS classes. */
30
35
  className?: string;
31
36
  }
32
37
  interface ValidationSummaryPromptProps extends HTMLAttributes<HTMLDivElement> {
33
- /** **(Optional)** Content inside the Prompt.
38
+ /** Content inside the component.
34
39
  *
35
- * Defaults to `Check the form. You must:`.
40
+ * Default: `Check the form. You must:`.
36
41
  */
37
42
  children?: React.ReactNode;
38
43
  }
@@ -45,7 +50,7 @@ interface FieldError {
45
50
  type?: string | number;
46
51
  }
47
52
  interface ValidationSummaryErrorsProps extends HTMLAttributes<HTMLDivElement> {
48
- /** **(Optional)** Content inside the Errors. */
53
+ /** Specify the validation error array. Refer to the FieldError type for the shape.. */
49
54
  errors?: Record<string, FieldError>;
50
55
  }
51
56
  declare const ValidationSummary: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.22.2",
4
+ "version": "1.22.4",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -110,5 +110,5 @@
110
110
  "merge-refs": "^2.0.0",
111
111
  "react-day-picker": "^10.0.1"
112
112
  },
113
- "gitHead": "2b2ef6224f2d46240d7ecc496680337e919d02dc"
113
+ "gitHead": "164ef51c388796f63366ab6103fab9e5bd068465"
114
114
  }
@@ -3,20 +3,22 @@ import type { HTMLAttributes, JSX, ReactNode, Ref } from "react"
3
3
  import clsx from "clsx"
4
4
 
5
5
  export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
6
- /** **(Optional)** Main content inside the banner. It can be any valid JSX or string. */
7
- children?: string | ReactNode
8
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
6
+ /** Content inside the component.
7
+ *
8
+ * This should be an `<AlertBanner.Heading>` followed by any valid JSX. */
9
+ children?: ReactNode
10
+ /** Specify additional CSS classes. */
9
11
  className?: string
10
- /** **(Optional)** Specify a custom React ref for this component. */
12
+ /** Specify a custom React ref for this component. */
11
13
  ref?: Ref<HTMLDivElement>
12
- /** **(Optional)** Specify the AlertBanner variant. */
14
+ /** Specify the component variant. */
13
15
  variant?: "black" | "default"
14
16
  }
15
17
 
16
18
  interface AlertBannerHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
17
- /** **(Optional)** Content inside the Heading. */
19
+ /** Content inside the component. */
18
20
  children?: React.ReactNode
19
- /** **(Optional)** Specify additional CSS classes to be applied to the Heading. */
21
+ /** Specify additional CSS classes. */
20
22
  className?: string
21
23
  }
22
24
 
@@ -5,19 +5,21 @@ import clsx from "clsx"
5
5
  import { Image, ImageProps } from "@/components/Image"
6
6
 
7
7
  export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
8
- /** **(Optional)** Specify the Author name. */
8
+ /** Specify the Author name. */
9
9
  author?: string
10
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
10
+ /** Specify additional CSS classes. */
11
11
  className?: string
12
- /** **(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. */
12
+ /** Specify the date.
13
+ *
14
+ * Recommended format `dd mmmm yyyy` eg: 1 January 2000. */
13
15
  date?: string
14
- /** **(Optional)** Specify the text that will prefix the date, e.g. "Updated". */
16
+ /** Specify the text that will prefix the date, e.g. "Updated". */
15
17
  datePrefix?: string
16
- /** **(Optional)** Specify properties of the Author Image. */
18
+ /** Specify properties of the Author Image. */
17
19
  image?: ImageProps
18
- /** **(Optional)** Specify a custom React ref for this component. */
20
+ /** Specify a custom React ref for this component. */
19
21
  ref?: Ref<HTMLDivElement>
20
- /** **(Optional)** Specify the Author size. */
22
+ /** Specify the component size. */
21
23
  size?: "sm" | "md"
22
24
  }
23
25
 
@@ -5,18 +5,21 @@ import React from "react"
5
5
 
6
6
  import { StandardSizesWithNone } from "@/types"
7
7
  export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
8
- /** **(Optional)** Specify a custom element to override default `div` */
8
+ /** Specify a custom element for the component
9
+ *
10
+ * Default: `<div>`
11
+ */
9
12
  // oxlint-disable-next-line typescript/no-explicit-any
10
13
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string
11
- /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
12
- children?: string | ReactNode
13
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
14
+ /** Content inside the component. */
15
+ children?: ReactNode
16
+ /** Specify additional CSS classes. */
14
17
  className?: string
15
- /** **(Optional)** Specify the Box padding. */
18
+ /** Specify the padding. */
16
19
  padding?: StandardSizesWithNone
17
- /** **(Optional)** Specify the Box border radius. */
20
+ /** Specify the border radius. */
18
21
  radius?: StandardSizesWithNone
19
- /** **(Optional)** Specify a custom React ref for this component. */
22
+ /** Specify a custom React ref for this component. */
20
23
  ref?: Ref<HTMLDivElement>
21
24
  }
22
25
 
@@ -9,30 +9,33 @@ import { LoadingSpinner } from "@/components/LoadingSpinner"
9
9
  import { hasUserBg } from "@/utils"
10
10
 
11
11
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
12
- /** **(Optional)** Specify a custom element to override default `a` or `button`. */
12
+ /** Specify a custom element for the component.
13
+ *
14
+ * Default: `<button>` or `<a>`.
15
+ */
13
16
  // oxlint-disable-next-line typescript/no-explicit-any
14
17
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string
15
- /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
18
+ /** Content inside the component. */
16
19
  children?: React.ReactNode
17
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
20
+ /** Specify additional CSS classes. */
18
21
  className?: string
19
- /** **(Optional)** Specify the URL that the Button component will link to when clicked. */
22
+ /** Specify the target URL. */
20
23
  href?: string
21
- /** **(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. */
24
+ /** Specify whether the Button should be disabled. This will not actually disable the button, just make it look disabled. */
22
25
  isDisabled?: boolean
23
- /** **(Optional)** Specify whether the Button should be full width. Refer to Experience Library guidance on full width buttons. */
26
+ /** Specify whether the Button should be full width. */
24
27
  isFullWidth?: boolean
25
- /** **(Optional)** Force the Button into a loading state. */
28
+ /** Force the Button into a loading state. */
26
29
  isLoading?: boolean
27
- /** **(Optional)** Specify text to show when the Button is in a loading state. */
30
+ /** Specify text to show when the Button is in a loading state. */
28
31
  loadingText?: string
29
- /** **(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. */
32
+ /** 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. */
30
33
  onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>
31
- /** **(Optional)** Specify a custom React ref for this component. */
34
+ /** Specify a custom React ref for this component. */
32
35
  ref?: Ref<HTMLElement>
33
- /** **(Optional)** Specify the Button size. */
36
+ /** Specify the component size. */
34
37
  size?: "sm" | "md" | "lg"
35
- /** **(Optional)** Specify the Button variant. */
38
+ /** Specify the component variant. */
36
39
  variant?: "solid" | "ghost" | "text"
37
40
  }
38
41
 
@@ -16,98 +16,103 @@ import { StandardSizes } from "@/types"
16
16
  import { hasUserBg } from "@/utils"
17
17
 
18
18
  export interface CardProps extends HTMLAttributes<HTMLDivElement> {
19
- /** **(Optional)** Specify how the Card behaves across screen sizes.
19
+ /** Specify how the Card behaves across screen sizes.
20
20
  *
21
21
  * For finer control, use utility classes or custom CSS to control flex-direction. */
22
22
  adaptive?: "sm" | "md"
23
- /** **(Optional)** Specify an element to use for the container.
23
+ /** Specify an element for the component.
24
24
  *
25
- * Default: `article`
25
+ * Default: `<article>`
26
26
  */
27
27
  as?: "article" | "section" | "figure" | "div"
28
- /** **(Optional)** Content inside the component. */
28
+ /** Content inside the component.
29
+ *
30
+ * This should be a set of `<Card.Badge>`, `<Card.Content>` and / or `<Card.Picture>`. */
29
31
  children?: React.ReactNode
30
- /** **(Optional)** Specify additional CSS classes. */
32
+ /** Specify additional CSS classes. */
31
33
  className?: string
32
- /** **(Optional)** Specify the Card orientation. */
34
+ /** Specify the component orientation. */
33
35
  orientation?: "vertical" | "horizontal"
34
- /** **(Optional)** Specify the Card padding. */
36
+ /** Specify the component padding. */
35
37
  padding?: StandardSizes
36
- /** **(Optional)** Specify the Card border radius. */
38
+ /** Specify the component border radius. */
37
39
  radius?: StandardSizes
38
- /** **(Optional)** Specify a custom React ref for this component. */
40
+ /** Specify a custom React ref for this component. */
39
41
  ref?: Ref<HTMLDivElement>
40
- /** **(Optional)** Enable additional styles to use the Card as a signpost.
42
+ /** Enable additional styles to use the Card as a signpost.
41
43
  *
42
44
  * Text is vertically aligned centrally and the Icon is enlarged. */
43
45
  signpost?: boolean
44
46
  }
45
47
 
46
48
  interface CardHeadingProps extends HTMLAttributes<HTMLDivElement> {
47
- /** **(Optional)** Specify an element to use for the heading.
49
+ /** Specify a custom element for the component.
48
50
  *
49
- * Default: `h3`
51
+ * Default: `<h3>`
50
52
  */
51
53
  as?: "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "strong" | "figcaption"
52
- /** **(Optional)** Content inside the component. */
54
+ /** Content inside the component. */
53
55
  children?: React.ReactNode
54
- /** **(Optional)** Specify additional CSS classes. */
56
+ /** Specify additional CSS classes. */
55
57
  className?: string
56
58
  }
57
59
 
58
- // interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
59
- // /** **(Optional)** Content inside the Body. */
60
- // children?: React.ReactNode
61
- // }
62
-
63
60
  interface CardIconProps extends HTMLAttributes<HTMLDivElement> {
64
- /** **(Optional)** Content inside the component. */
61
+ /** Content inside the component. */
65
62
  children?: React.ReactNode
66
- /** **(Optional)** Specify additional CSS classes. */
63
+ /** Specify additional CSS classes. */
67
64
  className?: string
68
65
  }
69
66
 
70
67
  interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
71
- /** **(Optional)** Content inside the component. */
68
+ /** Content inside the component.
69
+ *
70
+ * This should be a set of `<Card.Link>`, `<Card.Heading>` and / or `<Card.Icon>` followed by any valid JSX.
71
+ */
72
72
  children?: React.ReactNode
73
- /** **(Optional)** Specify additional CSS classes. */
73
+ /** Specify additional CSS classes. */
74
74
  className?: string
75
75
  }
76
76
 
77
77
  interface CardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
78
- /** **(Optional)** Specify an element to use instead of native `a`. */
78
+ /** Specify an element for the component.
79
+ *
80
+ * Default: `<a>`.
81
+ */
79
82
  // oxlint-disable-next-line typescript/no-explicit-any
80
83
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string
81
- /** **(Optional)** Content inside the component. */
84
+ /** Content inside the component.
85
+ *
86
+ * Usually this will be a `<Card.Heading>` but can be any valid JSX.
87
+ */
82
88
  children?: React.ReactNode
83
- /** **(Optional)** Specify additional CSS classes. */
89
+ /** Specify additional CSS classes. */
84
90
  className?: string
85
91
  }
86
92
 
87
93
  interface CardBadgeProps extends HTMLAttributes<HTMLDivElement> {
88
- /** **(Optional)** Specify alignment relative to container.
94
+ /** Specify alignment relative to container.
89
95
  *
90
- * Default: `right`
96
+ * Default: `right`.
91
97
  */
92
98
  align?: "left" | "right"
93
- /** **(Optional)** Content inside the component. */
99
+ /** Content inside the component. */
94
100
  children?: React.ReactNode
95
- /** **(Optional)** Specify additional CSS classes. */
101
+ /** Specify additional CSS classes. */
96
102
  className?: string
97
- /** **(Optional)** Specify position relative to top corner.
103
+ /** Specify position relative to top corner.
98
104
  *
99
- * Default: `popout`
105
+ * Default: `popout`.
100
106
  */
101
107
  position?: "inset" | "popout"
102
108
  }
103
109
 
104
110
  interface CardPictureProps extends PictureProps {
105
- /** **(Optional)** Specify on which side the Picture should appear. */
111
+ /** Specify alignment relative to container.
112
+ *
113
+ * Default: `left`.
114
+ */
106
115
  align?: "left" | "right"
107
- /** **(Optional)** Content inside the component. */
108
- children?: React.ReactNode
109
- /** **(Optional)** Specify additional CSS classes. */
110
- className?: string
111
116
  }
112
117
 
113
118
  const componentSlots = {
@@ -10,19 +10,19 @@ export interface CheckboxProps extends Omit<
10
10
  InputHTMLAttributes<HTMLInputElement>,
11
11
  "size" | "type"
12
12
  > {
13
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
13
+ /** Specify additional CSS classes. */
14
14
  className?: string
15
- /** **(Optional)** Specify whether the Checkbox should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
15
+ /** Specify the disabled state. */
16
16
  disabled?: boolean
17
- /** **(Optional)** Specify the Checkbox error state. */
17
+ /** Specify the component error state. */
18
18
  error?: boolean
19
- /** **(Optional)** Specify the Checkbox id. Will be auto-generated if not set. */
19
+ /** Specify the component id. Will be auto-generated if not set. */
20
20
  id?: string
21
- /** Specify the Checkbox name. */
21
+ /** Specify the component name. */
22
22
  name: string
23
- /** **(Optional)** Specify a custom React ref for this component. */
23
+ /** Specify a custom React ref for this component. */
24
24
  ref?: Ref<HTMLInputElement>
25
- /** **(Optional)** Specify the Checkbox size. */
25
+ /** Specify the component size. */
26
26
  size?: StandardSizes
27
27
  }
28
28
 
@@ -58,50 +58,49 @@ export interface DatePickerProps extends Omit<
58
58
  InputHTMLAttributes<HTMLInputElement>,
59
59
  "onSelect" | "onChange" | "onChangeCapture" | "size" | "type"
60
60
  > {
61
- /** **(Optional)** Specify additional CSS classes to be applied to the wrapper. */
61
+ /** Specify additional CSS classes. */
62
62
  className?: string
63
- /** **(Optional)** Specify whether the picker should close when selecting a date. Has no effect in range mode. */
63
+ /** Specify whether the DatePicker should close when selecting a date. Has no effect in range mode. */
64
64
  closeOnSelect?: boolean
65
- /** **(Optional)** Specify the date format. This affects the values displayed to users and the accepted format for manual inputs. */
65
+ /** Specify the date format. This affects the values displayed to users and the accepted format for manual inputs. */
66
66
  dateFormat?: string
67
- /** **(Optional)** Specify whether the Date Picker should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
67
+ /** Specify whether the DatePicker should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
68
68
  disabled?: boolean
69
- /** **(Optional)** Specify dates to be disabled. Refer to react-daypicker docs for full configuration. */
69
+ /** Specify dates to be disabled. Refer to react-day-picker docs for full configuration. */
70
70
  disabledDates?: DayPickerProps["disabled"]
71
- /** **(Optional)** Specify the upper bound for the picker.
71
+ /** Specify the upper bound for the DatePicker.
72
72
  *
73
73
  * Default: today plus one year.
74
74
  */
75
75
  endDate?: Date
76
- /** **(Optional)** Specify the Date Picker error state. */
76
+ /** Specify the component error state. */
77
77
  error?: boolean
78
- /** **(Optional)** Specify the Date Picker id. Will be auto-generated if not set. */
78
+ /** Specify the component id. Will be auto-generated if not set. */
79
79
  id?: string
80
- /** **(Optional)** Specify the initial month view for the picker. Combine with `initialSelected` to pre-select a date.
80
+ /** Specify the initial month view for the DatePicker. Combine with `initialSelected` to pre-select a date.
81
81
  *
82
82
  * Default: today.
83
83
  */
84
84
  initialDate?: Date | DateRange
85
- /** **(Optional)** Specify whether the initial date should be pre-selected. */
85
+ /** Specify whether the initial date should be pre-selected. */
86
86
  initialSelected?: boolean
87
-
88
- /** **(Optional)** Specify the picker mode. */
87
+ /** Specify the DatePicker mode. */
89
88
  mode?: Mode
90
- /** Specify the Datepicker name. */
89
+ /** Specify the component name. */
91
90
  name: string
92
91
  /** Provided only for compatibility with form libraries. Use `onSelect` instead. */
93
92
  onChange?: OnDateSelectHandler
94
- /** **(Optional)** Callback to run when a date is selected and validated.
93
+ /** Callback to run when a date is selected and validated.
95
94
  *
96
95
  * Contains the selected value, which is either an ISO-8601 formatted date string, or an object with from and to values. */
97
96
  onSelect?: OnDateSelectHandler
98
- /** **(Optional)** Specify a custom React ref for this component. */
97
+ /** Specify a custom React ref for this component. */
99
98
  ref?: Ref<HTMLInputElement>
100
- /** **(Optional)** Specify whether this is a required field. */
99
+ /** Specify whether this is a required field. */
101
100
  required?: boolean
102
- /** **(Optional)** Specify the DatePicker size. */
101
+ /** Specify the component size. */
103
102
  size?: StandardSizes
104
- /** **(Optional)** Specify the lower bound for the picker.
103
+ /** Specify the lower bound for the DatePicker.
105
104
  *
106
105
  * Default: today minus one year.
107
106
  */