@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.
- package/dist/components/AlertBanner/AlertBanner.d.ts +9 -7
- package/dist/components/Author/Author.d.ts +9 -7
- package/dist/components/Box/Box.d.ts +10 -7
- package/dist/components/Button/Button.d.ts +15 -12
- package/dist/components/Card/Card.d.ts +42 -32
- package/dist/components/Checkbox/Checkbox.d.ts +7 -7
- package/dist/components/DatePicker/DatePicker.d.ts +17 -17
- package/dist/components/Dialog/Dialog.d.ts +19 -19
- package/dist/components/Expandable/Expandable.d.ts +10 -8
- package/dist/components/Field/Field.d.ts +8 -8
- package/dist/components/FieldMarkers/Error.d.ts +4 -4
- package/dist/components/FieldMarkers/Hint.d.ts +4 -4
- package/dist/components/FieldMarkers/Label.d.ts +5 -5
- package/dist/components/FieldMarkers/Label.js +3 -2
- package/dist/components/FieldMarkers/Legend.d.ts +5 -5
- package/dist/components/Fieldset/Fieldset.d.ts +14 -14
- package/dist/components/Flourish/Flourish.d.ts +5 -5
- package/dist/components/Form/Form.d.ts +4 -4
- package/dist/components/Image/Image.d.ts +3 -7
- package/dist/components/Image/Image.js +2 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -6
- package/dist/components/Logo/Logo.d.ts +6 -7
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -3
- package/dist/components/PasswordInput/PasswordInput.js +2 -2
- package/dist/components/Picture/Picture.d.ts +7 -5
- package/dist/components/Pill/Pill.d.ts +13 -8
- package/dist/components/Popover/Popover.d.ts +25 -22
- package/dist/components/Prose/Prose.d.ts +7 -7
- package/dist/components/Radio/Radio.d.ts +7 -7
- package/dist/components/Searchbox/Searchbox.d.ts +8 -16
- package/dist/components/Select/Select.d.ts +13 -13
- package/dist/components/Signpost/Signpost.d.ts +10 -7
- package/dist/components/SkipNav/SkipNav.d.ts +6 -5
- package/dist/components/Squircle/Squircle.d.ts +6 -4
- package/dist/components/Tag/Tag.d.ts +9 -6
- package/dist/components/TextInput/TextInput.d.ts +15 -15
- package/dist/components/TextInput/TextInput.js +1 -2
- package/dist/components/Textarea/Textarea.d.ts +22 -18
- package/dist/components/Textarea/Textarea.js +1 -2
- package/dist/components/ValidationSummary/ValidationSummary.d.ts +19 -14
- package/package.json +2 -2
- package/src/components/AlertBanner/AlertBanner.tsx +9 -7
- package/src/components/Author/Author.tsx +9 -7
- package/src/components/Box/Box.tsx +10 -7
- package/src/components/Button/Button.tsx +15 -12
- package/src/components/Card/Card.tsx +42 -37
- package/src/components/Checkbox/Checkbox.tsx +7 -7
- package/src/components/DatePicker/DatePicker.tsx +17 -18
- package/src/components/Dialog/Dialog.tsx +19 -19
- package/src/components/Expandable/Expandable.tsx +10 -8
- package/src/components/Field/Field.tsx +8 -8
- package/src/components/FieldMarkers/Error.tsx +4 -4
- package/src/components/FieldMarkers/Hint.tsx +4 -4
- package/src/components/FieldMarkers/Label.tsx +9 -6
- package/src/components/FieldMarkers/Legend.tsx +5 -5
- package/src/components/Fieldset/Fieldset.tsx +14 -14
- package/src/components/Flourish/Flourish.tsx +5 -5
- package/src/components/Form/Form.tsx +4 -4
- package/src/components/Image/Image.tsx +8 -9
- package/src/components/LoadingSpinner/LoadingSpinner.tsx +2 -6
- package/src/components/Logo/Logo.tsx +6 -7
- package/src/components/PasswordInput/PasswordInput.tsx +4 -3
- package/src/components/Picture/Picture.tsx +7 -5
- package/src/components/Pill/Pill.tsx +13 -8
- package/src/components/Popover/Popover.tsx +25 -22
- package/src/components/Prose/Prose.tsx +7 -7
- package/src/components/Radio/Radio.tsx +7 -7
- package/src/components/Searchbox/Searchbox.tsx +8 -14
- package/src/components/Select/Select.tsx +13 -13
- package/src/components/Signpost/Signpost.tsx +10 -7
- package/src/components/SkipNav/SkipNav.tsx +6 -5
- package/src/components/Squircle/Squircle.tsx +6 -4
- package/src/components/Tag/Tag.tsx +9 -6
- package/src/components/TextInput/TextInput.tsx +16 -16
- package/src/components/Textarea/Textarea.tsx +23 -19
- 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
|
-
/**
|
|
5
|
+
/** Specify additional CSS classes. */
|
|
6
6
|
className?: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Specify the disabled state. */
|
|
8
8
|
disabled?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/** Specify the component error state. */
|
|
10
10
|
error?: boolean;
|
|
11
|
-
/**
|
|
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
|
-
/**
|
|
16
|
+
/** Specify the component id. Will be auto-generated if not set. */
|
|
17
17
|
id?: string;
|
|
18
|
-
/** Specify the
|
|
18
|
+
/** Specify the component name. */
|
|
19
19
|
name: string;
|
|
20
|
-
/**
|
|
20
|
+
/** Specify placeholder text. Do not use in place of a form label. */
|
|
21
21
|
placeholder?: string;
|
|
22
|
-
/**
|
|
22
|
+
/** Specify the prefix. */
|
|
23
23
|
prefix?: React.ReactNode;
|
|
24
|
-
/**
|
|
24
|
+
/** Specify whether the prefix should be rendered inside the input. */
|
|
25
25
|
prefixInline?: boolean;
|
|
26
|
-
/**
|
|
26
|
+
/** Specify a custom React ref for this component. */
|
|
27
27
|
ref?: Ref<HTMLInputElement>;
|
|
28
|
-
/**
|
|
28
|
+
/** Specify the component size. */
|
|
29
29
|
size?: StandardSizes;
|
|
30
|
-
/**
|
|
30
|
+
/** Specify the suffix. */
|
|
31
31
|
suffix?: React.ReactNode;
|
|
32
|
-
/**
|
|
32
|
+
/** Specify whether the suffix should be rendered inside the input. */
|
|
33
33
|
suffixInline?: boolean;
|
|
34
|
-
/**
|
|
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
|
-
({
|
|
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 = ({
|
|
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
|
-
/**
|
|
5
|
+
/** Specify additional CSS classes. */
|
|
6
6
|
className?: string;
|
|
7
|
-
/** Specify the number of columns (characters per row) in the Textarea.
|
|
7
|
+
/** Specify the number of columns (characters per row) in the Textarea.
|
|
8
|
+
*
|
|
9
|
+
* Default: `30`.
|
|
10
|
+
*/
|
|
8
11
|
cols?: number;
|
|
9
|
-
/**
|
|
12
|
+
/** Specify whether to show the character counter underneath the Textarea. */
|
|
10
13
|
counter?: boolean;
|
|
11
|
-
/**
|
|
14
|
+
/** Specify whether the Textarea should allow more characters than its `maxLength` value.
|
|
12
15
|
*
|
|
13
|
-
*
|
|
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
|
-
/**
|
|
19
|
+
/** Specify the disabled state. */
|
|
17
20
|
disabled?: boolean;
|
|
18
|
-
/**
|
|
21
|
+
/** Specify the component error state */
|
|
19
22
|
error?: boolean;
|
|
20
|
-
/**
|
|
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
|
-
/**
|
|
28
|
+
/** Specify the component id. Will be auto-generated if not set. */
|
|
26
29
|
id?: string;
|
|
27
|
-
/**
|
|
28
|
-
maxLength?: number;
|
|
29
|
-
/** Specify the Textarea name. */
|
|
30
|
+
/** Specify the component name. */
|
|
30
31
|
name: string;
|
|
31
|
-
/**
|
|
32
|
+
/** Specify placeholder text. Do not use in place of a form label. */
|
|
32
33
|
placeholder?: string;
|
|
33
|
-
/**
|
|
34
|
+
/** Specify a custom React ref for this component. */
|
|
34
35
|
ref?: Ref<HTMLTextAreaElement>;
|
|
35
|
-
/**
|
|
36
|
+
/** Specify the number of rows (lines of text) in the Textarea.
|
|
37
|
+
*
|
|
38
|
+
* Default: `4`.
|
|
39
|
+
*/
|
|
36
40
|
rows?: number;
|
|
37
|
-
/**
|
|
41
|
+
/** Specify the component size. */
|
|
38
42
|
size?: StandardSizes;
|
|
39
43
|
}
|
|
40
44
|
declare const Textarea: {
|
|
41
|
-
({
|
|
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 = ({
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
13
|
+
/** Specify additional CSS classes. */
|
|
12
14
|
className?: string;
|
|
13
|
-
/**
|
|
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
|
-
/**
|
|
20
|
+
/** Specify a custom React ref for this component. */
|
|
19
21
|
ref?: Ref<HTMLDivElement>;
|
|
20
22
|
}
|
|
21
23
|
interface ValidationSummaryHeadingProps extends HTMLAttributes<HTMLDivElement> {
|
|
22
|
-
/**
|
|
24
|
+
/** Specify a custom element for the component.
|
|
25
|
+
*
|
|
26
|
+
* Default: `<h2>`.
|
|
27
|
+
*/
|
|
23
28
|
as?: "h2" | "h3" | "h4" | "h5" | "h6";
|
|
24
|
-
/**
|
|
29
|
+
/** Content inside the component.
|
|
25
30
|
*
|
|
26
|
-
*
|
|
31
|
+
* Default: `There's a problem`.
|
|
27
32
|
*/
|
|
28
33
|
children?: React.ReactNode;
|
|
29
|
-
/**
|
|
34
|
+
/** Specify additional CSS classes. */
|
|
30
35
|
className?: string;
|
|
31
36
|
}
|
|
32
37
|
interface ValidationSummaryPromptProps extends HTMLAttributes<HTMLDivElement> {
|
|
33
|
-
/**
|
|
38
|
+
/** Content inside the component.
|
|
34
39
|
*
|
|
35
|
-
*
|
|
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
|
-
/**
|
|
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.
|
|
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": "
|
|
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
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
/**
|
|
12
|
+
/** Specify a custom React ref for this component. */
|
|
11
13
|
ref?: Ref<HTMLDivElement>
|
|
12
|
-
/**
|
|
14
|
+
/** Specify the component variant. */
|
|
13
15
|
variant?: "black" | "default"
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
interface AlertBannerHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
17
|
-
/**
|
|
19
|
+
/** Content inside the component. */
|
|
18
20
|
children?: React.ReactNode
|
|
19
|
-
/**
|
|
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
|
-
/**
|
|
8
|
+
/** Specify the Author name. */
|
|
9
9
|
author?: string
|
|
10
|
-
/**
|
|
10
|
+
/** Specify additional CSS classes. */
|
|
11
11
|
className?: string
|
|
12
|
-
/**
|
|
12
|
+
/** Specify the date.
|
|
13
|
+
*
|
|
14
|
+
* Recommended format `dd mmmm yyyy` eg: 1 January 2000. */
|
|
13
15
|
date?: string
|
|
14
|
-
/**
|
|
16
|
+
/** Specify the text that will prefix the date, e.g. "Updated". */
|
|
15
17
|
datePrefix?: string
|
|
16
|
-
/**
|
|
18
|
+
/** Specify properties of the Author Image. */
|
|
17
19
|
image?: ImageProps
|
|
18
|
-
/**
|
|
20
|
+
/** Specify a custom React ref for this component. */
|
|
19
21
|
ref?: Ref<HTMLDivElement>
|
|
20
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
12
|
-
children?:
|
|
13
|
-
/**
|
|
14
|
+
/** Content inside the component. */
|
|
15
|
+
children?: ReactNode
|
|
16
|
+
/** Specify additional CSS classes. */
|
|
14
17
|
className?: string
|
|
15
|
-
/**
|
|
18
|
+
/** Specify the padding. */
|
|
16
19
|
padding?: StandardSizesWithNone
|
|
17
|
-
/**
|
|
20
|
+
/** Specify the border radius. */
|
|
18
21
|
radius?: StandardSizesWithNone
|
|
19
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
18
|
+
/** Content inside the component. */
|
|
16
19
|
children?: React.ReactNode
|
|
17
|
-
/**
|
|
20
|
+
/** Specify additional CSS classes. */
|
|
18
21
|
className?: string
|
|
19
|
-
/**
|
|
22
|
+
/** Specify the target URL. */
|
|
20
23
|
href?: string
|
|
21
|
-
/**
|
|
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
|
-
/**
|
|
26
|
+
/** Specify whether the Button should be full width. */
|
|
24
27
|
isFullWidth?: boolean
|
|
25
|
-
/**
|
|
28
|
+
/** Force the Button into a loading state. */
|
|
26
29
|
isLoading?: boolean
|
|
27
|
-
/**
|
|
30
|
+
/** Specify text to show when the Button is in a loading state. */
|
|
28
31
|
loadingText?: string
|
|
29
|
-
/**
|
|
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
|
-
/**
|
|
34
|
+
/** Specify a custom React ref for this component. */
|
|
32
35
|
ref?: Ref<HTMLElement>
|
|
33
|
-
/**
|
|
36
|
+
/** Specify the component size. */
|
|
34
37
|
size?: "sm" | "md" | "lg"
|
|
35
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
23
|
+
/** Specify an element for the component.
|
|
24
24
|
*
|
|
25
|
-
* Default:
|
|
25
|
+
* Default: `<article>`
|
|
26
26
|
*/
|
|
27
27
|
as?: "article" | "section" | "figure" | "div"
|
|
28
|
-
/**
|
|
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
|
-
/**
|
|
32
|
+
/** Specify additional CSS classes. */
|
|
31
33
|
className?: string
|
|
32
|
-
/**
|
|
34
|
+
/** Specify the component orientation. */
|
|
33
35
|
orientation?: "vertical" | "horizontal"
|
|
34
|
-
/**
|
|
36
|
+
/** Specify the component padding. */
|
|
35
37
|
padding?: StandardSizes
|
|
36
|
-
/**
|
|
38
|
+
/** Specify the component border radius. */
|
|
37
39
|
radius?: StandardSizes
|
|
38
|
-
/**
|
|
40
|
+
/** Specify a custom React ref for this component. */
|
|
39
41
|
ref?: Ref<HTMLDivElement>
|
|
40
|
-
/**
|
|
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
|
-
/**
|
|
49
|
+
/** Specify a custom element for the component.
|
|
48
50
|
*
|
|
49
|
-
* Default:
|
|
51
|
+
* Default: `<h3>`
|
|
50
52
|
*/
|
|
51
53
|
as?: "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "strong" | "figcaption"
|
|
52
|
-
/**
|
|
54
|
+
/** Content inside the component. */
|
|
53
55
|
children?: React.ReactNode
|
|
54
|
-
/**
|
|
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
|
-
/**
|
|
61
|
+
/** Content inside the component. */
|
|
65
62
|
children?: React.ReactNode
|
|
66
|
-
/**
|
|
63
|
+
/** Specify additional CSS classes. */
|
|
67
64
|
className?: string
|
|
68
65
|
}
|
|
69
66
|
|
|
70
67
|
interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
71
|
-
/**
|
|
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
|
-
/**
|
|
73
|
+
/** Specify additional CSS classes. */
|
|
74
74
|
className?: string
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
interface CardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
78
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
89
|
+
/** Specify additional CSS classes. */
|
|
84
90
|
className?: string
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
interface CardBadgeProps extends HTMLAttributes<HTMLDivElement> {
|
|
88
|
-
/**
|
|
94
|
+
/** Specify alignment relative to container.
|
|
89
95
|
*
|
|
90
|
-
* Default: `right
|
|
96
|
+
* Default: `right`.
|
|
91
97
|
*/
|
|
92
98
|
align?: "left" | "right"
|
|
93
|
-
/**
|
|
99
|
+
/** Content inside the component. */
|
|
94
100
|
children?: React.ReactNode
|
|
95
|
-
/**
|
|
101
|
+
/** Specify additional CSS classes. */
|
|
96
102
|
className?: string
|
|
97
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
13
|
+
/** Specify additional CSS classes. */
|
|
14
14
|
className?: string
|
|
15
|
-
/**
|
|
15
|
+
/** Specify the disabled state. */
|
|
16
16
|
disabled?: boolean
|
|
17
|
-
/**
|
|
17
|
+
/** Specify the component error state. */
|
|
18
18
|
error?: boolean
|
|
19
|
-
/**
|
|
19
|
+
/** Specify the component id. Will be auto-generated if not set. */
|
|
20
20
|
id?: string
|
|
21
|
-
/** Specify the
|
|
21
|
+
/** Specify the component name. */
|
|
22
22
|
name: string
|
|
23
|
-
/**
|
|
23
|
+
/** Specify a custom React ref for this component. */
|
|
24
24
|
ref?: Ref<HTMLInputElement>
|
|
25
|
-
/**
|
|
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
|
-
/**
|
|
61
|
+
/** Specify additional CSS classes. */
|
|
62
62
|
className?: string
|
|
63
|
-
/**
|
|
63
|
+
/** Specify whether the DatePicker should close when selecting a date. Has no effect in range mode. */
|
|
64
64
|
closeOnSelect?: boolean
|
|
65
|
-
/**
|
|
65
|
+
/** Specify the date format. This affects the values displayed to users and the accepted format for manual inputs. */
|
|
66
66
|
dateFormat?: string
|
|
67
|
-
/**
|
|
67
|
+
/** Specify whether the DatePicker should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
|
|
68
68
|
disabled?: boolean
|
|
69
|
-
/**
|
|
69
|
+
/** Specify dates to be disabled. Refer to react-day-picker docs for full configuration. */
|
|
70
70
|
disabledDates?: DayPickerProps["disabled"]
|
|
71
|
-
/**
|
|
71
|
+
/** Specify the upper bound for the DatePicker.
|
|
72
72
|
*
|
|
73
73
|
* Default: today plus one year.
|
|
74
74
|
*/
|
|
75
75
|
endDate?: Date
|
|
76
|
-
/**
|
|
76
|
+
/** Specify the component error state. */
|
|
77
77
|
error?: boolean
|
|
78
|
-
/**
|
|
78
|
+
/** Specify the component id. Will be auto-generated if not set. */
|
|
79
79
|
id?: string
|
|
80
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
97
|
+
/** Specify a custom React ref for this component. */
|
|
99
98
|
ref?: Ref<HTMLInputElement>
|
|
100
|
-
/**
|
|
99
|
+
/** Specify whether this is a required field. */
|
|
101
100
|
required?: boolean
|
|
102
|
-
/**
|
|
101
|
+
/** Specify the component size. */
|
|
103
102
|
size?: StandardSizes
|
|
104
|
-
/**
|
|
103
|
+
/** Specify the lower bound for the DatePicker.
|
|
105
104
|
*
|
|
106
105
|
* Default: today minus one year.
|
|
107
106
|
*/
|