@coopdigital/react 0.52.3 → 0.54.0
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/README.md +3 -3
- package/dist/components/AlertBanner/AlertBanner.d.ts +3 -1
- package/dist/components/AlertBanner/AlertBanner.js +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +4 -3
- package/dist/components/Card/Card.d.ts +15 -5
- package/dist/components/Card/Card.js +8 -7
- package/dist/components/DatePicker/DatePicker.js +3 -3
- package/dist/components/Expandable/Expandable.d.ts +16 -2
- package/dist/components/Expandable/Expandable.js +13 -8
- package/dist/components/Field/Field.d.ts +15 -5
- package/dist/components/Field/Field.js +4 -4
- package/dist/components/Fieldset/Fieldset.d.ts +15 -5
- package/dist/components/Fieldset/Fieldset.js +4 -4
- package/dist/components/Pill/Pill.d.ts +3 -1
- package/dist/components/Pill/Pill.js +2 -2
- package/dist/components/Popover/Popover.d.ts +12 -4
- package/dist/components/Popover/Popover.js +5 -5
- package/dist/components/Searchbox/Searchbox.d.ts +20 -4
- package/dist/components/Searchbox/Searchbox.js +42 -28
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Signpost/Signpost.js +1 -1
- package/dist/components/Squircle/Squircle.js +1 -1
- package/dist/hooks/useSlots.d.ts +2 -1
- package/dist/hooks/useSlots.js +8 -3
- package/dist/types/colors.d.ts +1 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +4 -1
- package/package.json +20 -17
- package/src/components/AlertBanner/AlertBanner.tsx +1 -1
- package/src/components/Button/Button.tsx +9 -13
- package/src/components/Card/Card.tsx +8 -11
- package/src/components/DatePicker/DatePicker.tsx +2 -2
- package/src/components/Expandable/Expandable.tsx +26 -9
- package/src/components/Field/Field.tsx +4 -9
- package/src/components/Fieldset/Fieldset.tsx +4 -9
- package/src/components/Pill/Pill.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -7
- package/src/components/Searchbox/Searchbox.tsx +66 -56
- package/src/components/Select/Select.tsx +2 -3
- package/src/components/Signpost/Signpost.tsx +1 -1
- package/src/components/Squircle/Squircle.tsx +1 -1
- package/src/hooks/useSlots.ts +12 -4
- package/src/types/colors.ts +1 -3
- package/src/types/index.ts +1 -0
- package/src/utils/index.ts +4 -0
- /package/dist/components/{Icon → icons}/AddIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AddIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowDownIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowDownIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowLeftIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowLeftIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowRightIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowRightIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowUpIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowUpIcon.js +0 -0
- /package/dist/components/{Icon → icons}/AvatarAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AvatarAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/AvatarIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AvatarIcon.js +0 -0
- /package/dist/components/{Icon → icons}/BasketIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/BasketIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CalendarIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CalendarIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronDownIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronDownIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronLeftIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronLeftIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronRightIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronRightIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronUpIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronUpIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ClockIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ClockIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CloseAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CloseAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CloseIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CloseIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopCardIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopCardIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopLocationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopLocationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/DownloadIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/DownloadIcon.js +0 -0
- /package/dist/components/{Icon → icons}/HomeIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/HomeIcon.js +0 -0
- /package/dist/components/{Icon → icons}/InformationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/InformationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/LoadingIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/LoadingIcon.js +0 -0
- /package/dist/components/{Icon → icons}/LocationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/LocationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MailIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MailIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MenuIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MenuIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MessageIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MessageIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MinusIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MinusIcon.js +0 -0
- /package/dist/components/{Icon → icons}/OpenNewIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/OpenNewIcon.js +0 -0
- /package/dist/components/{Icon → icons}/PencilIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/PencilIcon.js +0 -0
- /package/dist/components/{Icon → icons}/PhoneIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/PhoneIcon.js +0 -0
- /package/dist/components/{Icon → icons}/QuestionIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/QuestionIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ScooterIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ScooterIcon.js +0 -0
- /package/dist/components/{Icon → icons}/SearchIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/SearchIcon.js +0 -0
- /package/dist/components/{Icon → icons}/SettingsIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/SettingsIcon.js +0 -0
- /package/dist/components/{Icon → icons}/TickAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/TickAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/TickIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/TickIcon.js +0 -0
- /package/dist/components/{Icon → icons}/VanIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/VanIcon.js +0 -0
- /package/dist/components/{Icon → icons}/WarningIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/WarningIcon.js +0 -0
- /package/dist/components/{Icon → icons}/WriteIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/WriteIcon.js +0 -0
- /package/dist/components/{Icon → icons}/index.d.ts +0 -0
- /package/dist/components/{Icon → icons}/index.js +0 -0
- /package/src/components/{Icon → icons}/AddIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowDownIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowLeftIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowRightIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowUpIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/AvatarAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/AvatarIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/BasketIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CalendarIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronDownIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronLeftIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronRightIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronUpIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ClockIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CloseAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CloseIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopCardIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopLocationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/DownloadIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/HomeIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/InformationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/LoadingIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/LocationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MailIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MenuIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MessageIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MinusIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/OpenNewIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/PencilIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/PhoneIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/QuestionIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ScooterIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/SearchIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/SettingsIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/TickAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/TickIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/VanIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/WarningIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/WriteIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/index.ts +0 -0
package/README.md
CHANGED
|
@@ -25,18 +25,18 @@ npm install @coopdigital/react
|
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
28
|
-
Import the components that you need, along with the
|
|
28
|
+
Import the components that you need, along with the foundations stylesheet and the corresponding component styles:
|
|
29
29
|
|
|
30
30
|
```
|
|
31
31
|
import { Pill } from "@coopdigital/react"
|
|
32
|
-
import "@coopdigital/styles/
|
|
32
|
+
import "@coopdigital/styles/foundations.css"
|
|
33
33
|
import "@coopdigital/styles/components/Pill.css"
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Alternatively if your project uses SASS you can import the source stylesheets:
|
|
37
37
|
|
|
38
38
|
```
|
|
39
|
-
@use "@coopdigital/styles/src/
|
|
39
|
+
@use "@coopdigital/styles/src/foundations.scss"
|
|
40
40
|
@use "@coopdigital/styles/src/components/Pill.scss"
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -19,7 +19,9 @@ export declare const AlertBanner: {
|
|
|
19
19
|
({ children, className, ref, variant, ...props }: AlertBannerProps): JSX.Element;
|
|
20
20
|
Heading: {
|
|
21
21
|
({ children, className }: AlertBannerHeadingProps): JSX.Element;
|
|
22
|
-
|
|
22
|
+
config: {
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
export default AlertBanner;
|
|
@@ -12,7 +12,7 @@ const AlertBanner = ({ children, className, ref, variant = "default", ...props }
|
|
|
12
12
|
const AlertBannerHeading = ({ children, className }) => {
|
|
13
13
|
return jsx("h2", { className: className, children: children });
|
|
14
14
|
};
|
|
15
|
-
AlertBannerHeading.
|
|
15
|
+
AlertBannerHeading.config = { name: "AlertBannerHeading" };
|
|
16
16
|
AlertBanner.Heading = AlertBannerHeading;
|
|
17
17
|
|
|
18
18
|
export { AlertBanner, AlertBanner as default };
|
|
@@ -24,7 +24,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
24
24
|
/** **(Optional)** Specify the Button size. */
|
|
25
25
|
size?: "sm" | "md" | "lg";
|
|
26
26
|
/** **(Optional)** Specify the Button variant. */
|
|
27
|
-
variant?: "
|
|
27
|
+
variant?: "solid" | "ghost" | "text";
|
|
28
28
|
}
|
|
29
29
|
export declare const Button: ({ as, children, className, href, isDisabled, isFullWidth, isLoading, loadingText, onClick, ref, size, variant, ...props }: ButtonProps) => JSX.Element;
|
|
30
30
|
export default Button;
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import React__default, { useState, useCallback } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { hasUserBg } from '../../utils/index.js';
|
|
7
|
+
import { LoadingIcon } from '../icons/LoadingIcon.js';
|
|
7
8
|
|
|
8
|
-
const Button = ({ as, children, className, href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, ref, size = "md", variant = "
|
|
9
|
+
const Button = ({ as, children, className, href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, ref, size = "md", variant = "solid", ...props }) => {
|
|
9
10
|
const element = as !== null && as !== void 0 ? as : (href ? "a" : "button");
|
|
10
11
|
const [isPending, setIsPending] = useState(false);
|
|
11
12
|
const handleClick = useCallback(async (event) => {
|
|
@@ -22,7 +23,7 @@ const Button = ({ as, children, className, href, isDisabled = false, isFullWidth
|
|
|
22
23
|
const componentProps = {
|
|
23
24
|
"aria-disabled": isDisabled ? true : undefined,
|
|
24
25
|
"aria-live": "assertive",
|
|
25
|
-
className: clsx(variant == "text" ? "coop-link" : "coop-button", className),
|
|
26
|
+
className: clsx(variant == "text" ? "coop-link" : "coop-button", !hasUserBg(className) && variant === "solid" && "bg-teal", className),
|
|
26
27
|
"data-loading": isLoading || isPending ? true : undefined,
|
|
27
28
|
"data-size": size.length && size !== "md" ? size : undefined,
|
|
28
29
|
"data-variant": variant !== "text" ? variant : undefined,
|
|
@@ -52,23 +52,33 @@ export declare const Card: {
|
|
|
52
52
|
({ chevron, children, className, href, hrefAs, imagePosition, orientation, ref, ...props }: CardProps): JSX.Element;
|
|
53
53
|
Label: {
|
|
54
54
|
({ children, className }: CardLabelProps): JSX.Element;
|
|
55
|
-
|
|
55
|
+
config: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
56
58
|
};
|
|
57
59
|
Heading: {
|
|
58
60
|
({ as, children, className }: CardHeadingProps): JSX.Element;
|
|
59
|
-
|
|
61
|
+
config: {
|
|
62
|
+
name: string;
|
|
63
|
+
};
|
|
60
64
|
};
|
|
61
65
|
Badge: {
|
|
62
66
|
({ align, children, position, ...props }: CardBadgeProps): JSX.Element;
|
|
63
|
-
|
|
67
|
+
config: {
|
|
68
|
+
name: string;
|
|
69
|
+
};
|
|
64
70
|
};
|
|
65
71
|
Body: {
|
|
66
72
|
({ children }: CardBodyProps): JSX.Element;
|
|
67
|
-
|
|
73
|
+
config: {
|
|
74
|
+
name: string;
|
|
75
|
+
};
|
|
68
76
|
};
|
|
69
77
|
Image: {
|
|
70
78
|
(props: CardImageProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
-
|
|
79
|
+
config: {
|
|
80
|
+
name: string;
|
|
81
|
+
};
|
|
72
82
|
};
|
|
73
83
|
};
|
|
74
84
|
export default Card;
|
|
@@ -2,7 +2,8 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
5
|
-
import {
|
|
5
|
+
import { hasUserBg } from '../../utils/index.js';
|
|
6
|
+
import { ChevronRightIcon } from '../icons/ChevronRightIcon.js';
|
|
6
7
|
import { Image } from '../Image/Image.js';
|
|
7
8
|
|
|
8
9
|
const componentSlots = {
|
|
@@ -28,7 +29,7 @@ const Card = ({ chevron = false, children, className, href, hrefAs, imagePositio
|
|
|
28
29
|
const innerProps = { className: "coop-card--inner" };
|
|
29
30
|
const hasLinkWrapper = href && !slots.CardHeading;
|
|
30
31
|
const componentProps = {
|
|
31
|
-
className: clsx("coop-card", className),
|
|
32
|
+
className: clsx("coop-card", !hasUserBg(className) && "bg-white", className),
|
|
32
33
|
"data-image-pos": imagePosition,
|
|
33
34
|
"data-orientation": orientation !== "vertical" ? orientation : undefined,
|
|
34
35
|
...props,
|
|
@@ -41,24 +42,24 @@ const Card = ({ chevron = false, children, className, href, hrefAs, imagePositio
|
|
|
41
42
|
const CardHeading = ({ as = "h3", children, className }) => {
|
|
42
43
|
return React__default.createElement(as, { className: clsx("coop-card--heading", className) }, children);
|
|
43
44
|
};
|
|
44
|
-
CardHeading.displayName = "Card.Heading";
|
|
45
45
|
const CardLabel = ({ children, className }) => {
|
|
46
46
|
return jsx("span", { className: clsx("coop-card--label", className), children: children });
|
|
47
47
|
};
|
|
48
|
-
CardLabel.displayName = "Card.Label";
|
|
49
48
|
const CardBadge = ({ align = "right", children, position = "popout", ...props }) => {
|
|
50
49
|
return (jsx("div", { className: "coop-card--badge", "data-align": align, "data-position": position, ...props, children: children }));
|
|
51
50
|
};
|
|
52
|
-
CardBadge.displayName = "Card.Badge";
|
|
53
51
|
const CardBody = ({ children }) => {
|
|
54
52
|
return jsx(Fragment, { children: children });
|
|
55
53
|
};
|
|
56
|
-
CardBody.displayName = "Card.Body";
|
|
57
54
|
const CardImage = (props) => {
|
|
58
55
|
var _a;
|
|
59
56
|
return jsx(Image, { ...props, crop: (_a = props.crop) !== null && _a !== void 0 ? _a : "wide" });
|
|
60
57
|
};
|
|
61
|
-
|
|
58
|
+
CardLabel.config = { name: "CardLabel" };
|
|
59
|
+
CardHeading.config = { name: "CardHeading" };
|
|
60
|
+
CardBadge.config = { name: "CardBadge" };
|
|
61
|
+
CardBody.config = { name: "CardBody" };
|
|
62
|
+
CardImage.config = { name: "CardImage" };
|
|
62
63
|
Card.Label = CardLabel;
|
|
63
64
|
Card.Heading = CardHeading;
|
|
64
65
|
Card.Badge = CardBadge;
|
|
@@ -5,8 +5,8 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { useMemo, useReducer, useCallback } from 'react';
|
|
6
6
|
import { useId } from '../../hooks/useId.js';
|
|
7
7
|
import { Button } from '../Button/Button.js';
|
|
8
|
-
import { CloseIcon } from '../
|
|
9
|
-
import { TickIcon } from '../
|
|
8
|
+
import { CloseIcon } from '../icons/CloseIcon.js';
|
|
9
|
+
import { TickIcon } from '../icons/TickIcon.js';
|
|
10
10
|
import { Popover } from '../Popover/Popover.js';
|
|
11
11
|
import { TextInput } from '../TextInput/TextInput.js';
|
|
12
12
|
import { getInitialDate, getStartDate, getEndDate, getDefaultMonth, getDateValues, shouldClose, shouldSkipParsing } from './datepicker-utils.js';
|
|
@@ -130,7 +130,7 @@ const DatePicker = ({ className, closeOnSelect = true, dateFormat = "dd/MM/yyyy"
|
|
|
130
130
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
131
131
|
autoFocus: true, captionLayout: "dropdown",
|
|
132
132
|
//defaultMonth={defaultMonth}
|
|
133
|
-
disabled: disabledDates, endMonth: endDate, month: state.view, onMonthChange: setView, onSelect: updateValues, startMonth: startDate, ...calendarProps[mode] }), jsxs("div", { className: "coop-datepicker-actions", children: [jsxs(Button, { "aria-label": "Cancel", onClick: resetState, size: "sm",
|
|
133
|
+
disabled: disabledDates, endMonth: endDate, month: state.view, onMonthChange: setView, onSelect: updateValues, startMonth: startDate, ...calendarProps[mode] }), jsxs("div", { className: "coop-datepicker-actions", children: [jsxs(Button, { "aria-label": "Cancel", className: "bg-tint-grey", onClick: resetState, size: "sm", children: ["Clear ", jsx(CloseIcon, { stroke: "black", strokeWidth: 1 })] }), jsx(Popover.Close, { asChild: true, children: jsxs(Button, { "aria-label": "Accept", size: "sm", children: ["OK ", jsx(TickIcon, { stroke: "white", strokeWidth: 1 })] }) })] })] })] }), jsx("div", { "aria-live": "assertive", className: "sr-only coop-datepicker-status", role: "status", children: (_g = state.message) !== null && _g !== void 0 ? _g : footerMessage[mode] }), mode === "single" && jsx("input", { ...valueProps, value: (_j = (_h = state.single) === null || _h === void 0 ? void 0 : _h.field) !== null && _j !== void 0 ? _j : "" }), mode === "multiple" && jsx("input", { ...valueProps, value: (_l = (_k = state.multiple) === null || _k === void 0 ? void 0 : _k.field) !== null && _l !== void 0 ? _l : "" }), mode === "range" && (jsxs(Fragment, { children: [jsx("input", { ...baseValueProps, id: `${uid}_start`, name: `${name}_start`, value: (_p = (_o = (_m = state.range) === null || _m === void 0 ? void 0 : _m.field) === null || _o === void 0 ? void 0 : _o.from) !== null && _p !== void 0 ? _p : "" }), jsx("input", { ...baseValueProps, id: `${uid}_end`, name: `${name}_end`, value: (_s = (_r = (_q = state.range) === null || _q === void 0 ? void 0 : _q.field) === null || _r === void 0 ? void 0 : _r.to) !== null && _s !== void 0 ? _s : "" })] }))] }));
|
|
134
134
|
};
|
|
135
135
|
DatePicker.config = componentConfig;
|
|
136
136
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DetailsHTMLAttributes, HTMLAttributes, JSX, Ref } from "react";
|
|
2
2
|
export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
|
|
3
|
-
/** Main content inside the component
|
|
3
|
+
/** Main content inside the component. This should be an `Expandable.Summary` and `Expandable.Content`. */
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
6
6
|
className?: string;
|
|
@@ -13,11 +13,25 @@ interface ExpandableSummaryProps extends HTMLAttributes<HTMLElement> {
|
|
|
13
13
|
/** **(Optional)** Specify additional CSS classes to be applied to the Summary. */
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
+
interface ExpandableContentProps extends HTMLAttributes<HTMLElement> {
|
|
17
|
+
/** **(Optional)** Content inside the Expandable. */
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the content wrapper. */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
16
22
|
export declare const Expandable: {
|
|
17
23
|
({ children, className, ref, ...props }: ExpandableProps): JSX.Element;
|
|
18
24
|
Summary: {
|
|
19
25
|
({ children, className, ...props }: ExpandableSummaryProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
|
|
26
|
+
config: {
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
Content: {
|
|
31
|
+
({ children, className, ...props }: ExpandableContentProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
config: {
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
21
35
|
};
|
|
22
36
|
};
|
|
23
37
|
export default Expandable;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
4
|
-
import { hasUserBg
|
|
4
|
+
import { hasUserBg } from '../../utils/index.js';
|
|
5
5
|
import 'react';
|
|
6
|
-
import { ChevronDownIcon } from '../
|
|
6
|
+
import { ChevronDownIcon } from '../icons/ChevronDownIcon.js';
|
|
7
7
|
|
|
8
8
|
const componentSlots = {
|
|
9
|
-
|
|
9
|
+
ExpandableContent: null,
|
|
10
10
|
ExpandableSummary: null,
|
|
11
11
|
};
|
|
12
12
|
const Expandable = ({ children, className, ref, ...props }) => {
|
|
@@ -15,15 +15,20 @@ const Expandable = ({ children, className, ref, ...props }) => {
|
|
|
15
15
|
className: clsx("coop-expandable", !hasUserBg(className) && "bg-tint-grey", className),
|
|
16
16
|
...props,
|
|
17
17
|
};
|
|
18
|
-
componentProps.style = {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return (jsxs("details", { ...componentProps, ref: ref, children: [slots.ExpandableSummary,
|
|
18
|
+
// componentProps.style = {
|
|
19
|
+
// "--bg": `var(--color-${bgClassToColor(componentProps.className)})`,
|
|
20
|
+
// }
|
|
21
|
+
return (jsxs("details", { ...componentProps, ref: ref, children: [slots.ExpandableSummary, slots.ExpandableContent] }));
|
|
22
22
|
};
|
|
23
23
|
const ExpandableSummary = ({ children, className, ...props }) => {
|
|
24
24
|
return (jsxs("summary", { ...props, className: className, children: [children, jsx(ChevronDownIcon, { className: "coop-expandable--icon", stroke: "currentColor", strokeWidth: 2, width: "12" })] }));
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const ExpandableContent = ({ children, className, ...props }) => {
|
|
27
|
+
return (jsx("div", { className: clsx("coop-expandable--content", className), ...props, children: children }));
|
|
28
|
+
};
|
|
29
|
+
ExpandableSummary.config = { name: "ExpandableSummary" };
|
|
30
|
+
ExpandableContent.config = { name: "ExpandableContent" };
|
|
27
31
|
Expandable.Summary = ExpandableSummary;
|
|
32
|
+
Expandable.Content = ExpandableContent;
|
|
28
33
|
|
|
29
34
|
export { Expandable, Expandable as default };
|
|
@@ -27,24 +27,34 @@ interface ControlProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
27
27
|
}
|
|
28
28
|
export declare const FieldControl: {
|
|
29
29
|
({ children, className, ...props }: ControlProps): JSX.Element;
|
|
30
|
-
|
|
30
|
+
config: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
31
33
|
};
|
|
32
34
|
export declare const Field: (({ boxed, children, className, error, hideErrorBar, ref, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
33
35
|
Control: {
|
|
34
36
|
({ children, className, ...props }: ControlProps): JSX.Element;
|
|
35
|
-
|
|
37
|
+
config: {
|
|
38
|
+
name: string;
|
|
39
|
+
};
|
|
36
40
|
};
|
|
37
41
|
Error: {
|
|
38
42
|
(props: ErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
|
|
43
|
+
config: {
|
|
44
|
+
name: string;
|
|
45
|
+
};
|
|
40
46
|
};
|
|
41
47
|
Hint: {
|
|
42
48
|
(props: HintProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
|
|
49
|
+
config: {
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
44
52
|
};
|
|
45
53
|
Label: {
|
|
46
54
|
(props: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
|
|
55
|
+
config: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
48
58
|
};
|
|
49
59
|
};
|
|
50
60
|
export default Field;
|
|
@@ -61,13 +61,13 @@ const Root = ({ boxed = false, children, className, error = false, hideErrorBar
|
|
|
61
61
|
const FieldControl = ({ children, className, ...props }) => {
|
|
62
62
|
return (jsx("div", { className: clsx("coop-field-control ", className), ...props, children: children }));
|
|
63
63
|
};
|
|
64
|
-
FieldControl.displayName = "Field.Control";
|
|
65
64
|
const FieldLabel = (props) => jsx(Label, { ...props });
|
|
66
|
-
FieldLabel.displayName = "Field.Label";
|
|
67
65
|
const FieldHint = (props) => jsx(Hint, { ...props });
|
|
68
|
-
FieldHint.displayName = "Field.Hint";
|
|
69
66
|
const FieldError = (props) => jsx(Error, { ...props });
|
|
70
|
-
|
|
67
|
+
FieldControl.config = { name: "FieldControl" };
|
|
68
|
+
FieldLabel.config = { name: "FieldLabel" };
|
|
69
|
+
FieldHint.config = { name: "FieldHint" };
|
|
70
|
+
FieldError.config = { name: "FieldError" };
|
|
71
71
|
const Field = Object.assign(Root, {
|
|
72
72
|
Control: FieldControl,
|
|
73
73
|
Error: FieldError,
|
|
@@ -33,24 +33,34 @@ interface FieldsetFieldsProps {
|
|
|
33
33
|
}
|
|
34
34
|
export declare const FieldsetFields: {
|
|
35
35
|
({ boxed, children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
|
|
36
|
-
|
|
36
|
+
config: {
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
37
39
|
};
|
|
38
40
|
export declare const Fieldset: (({ children, className, disabled, error, hideErrorBar, ref, size, ...props }: FieldsetProps) => JSX.Element) & {
|
|
39
41
|
Error: {
|
|
40
42
|
(props: ErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
|
|
43
|
+
config: {
|
|
44
|
+
name: string;
|
|
45
|
+
};
|
|
42
46
|
};
|
|
43
47
|
Fields: {
|
|
44
48
|
({ boxed, children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
|
|
45
|
-
|
|
49
|
+
config: {
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
46
52
|
};
|
|
47
53
|
Hint: {
|
|
48
54
|
(props: HintProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
-
|
|
55
|
+
config: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
50
58
|
};
|
|
51
59
|
Legend: {
|
|
52
60
|
(props: LegendProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
|
|
61
|
+
config: {
|
|
62
|
+
name: string;
|
|
63
|
+
};
|
|
54
64
|
};
|
|
55
65
|
};
|
|
56
66
|
export default Fieldset;
|
|
@@ -25,13 +25,13 @@ const FieldsetFields = ({ boxed = false, children, className, orientation = "ver
|
|
|
25
25
|
};
|
|
26
26
|
return jsx("div", { ...componentProps, children: children });
|
|
27
27
|
};
|
|
28
|
-
FieldsetFields.displayName = "Fieldset.Fields";
|
|
29
28
|
const FieldsetLegend = (props) => jsx(Legend, { ...props });
|
|
30
|
-
FieldsetLegend.displayName = "Fieldset.Legend";
|
|
31
29
|
const FieldsetHint = (props) => jsx(Hint, { ...props });
|
|
32
|
-
FieldsetHint.displayName = "Fieldset.Hint";
|
|
33
30
|
const FieldsetError = (props) => jsx(Error, { ...props });
|
|
34
|
-
|
|
31
|
+
FieldsetFields.config = { name: "FieldsetField" };
|
|
32
|
+
FieldsetLegend.config = { name: "FieldsetLegend" };
|
|
33
|
+
FieldsetHint.config = { name: "FieldsetHint" };
|
|
34
|
+
FieldsetError.config = { name: "FieldsetError" };
|
|
35
35
|
const Fieldset = Object.assign(Root, {
|
|
36
36
|
Error: FieldsetError,
|
|
37
37
|
Fields: FieldsetFields,
|
|
@@ -25,7 +25,9 @@ export declare const Pill: {
|
|
|
25
25
|
({ as, children, className, href, ref, size, ...props }: PillProps): JSX.Element;
|
|
26
26
|
Badge: {
|
|
27
27
|
({ children, className }: PillBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
|
|
28
|
+
config: {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
33
|
export default Pill;
|
|
@@ -22,9 +22,9 @@ const Pill = ({ as, children, className, href, ref, size = "md", ...props }) =>
|
|
|
22
22
|
return React__default.createElement(element, { ...componentProps, ref }, slots.PillBadge, slots.Children);
|
|
23
23
|
};
|
|
24
24
|
const PillBadge = ({ children, className }) => {
|
|
25
|
-
return (jsx("span", { className: clsx("coop-pill--badge", !hasUserBg(className) && "bg-
|
|
25
|
+
return (jsx("span", { className: clsx("coop-pill--badge", !hasUserBg(className) && "bg-red", className), children: children }));
|
|
26
26
|
};
|
|
27
|
-
PillBadge.
|
|
27
|
+
PillBadge.config = { name: "PillBadge" };
|
|
28
28
|
Pill.Badge = PillBadge;
|
|
29
29
|
|
|
30
30
|
export { Pill, Pill as default };
|
|
@@ -56,19 +56,27 @@ export declare const Popover: {
|
|
|
56
56
|
({ children, ...props }: PopoverProps): JSX.Element;
|
|
57
57
|
Trigger: {
|
|
58
58
|
({ asChild, children, className, ...props }: PopoverTriggerProps): JSX.Element;
|
|
59
|
-
|
|
59
|
+
config: {
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
60
62
|
};
|
|
61
63
|
Content: {
|
|
62
64
|
({ align, alignOffset, asChild, avoidCollisions, children, className, collisionPadding, ref, side, sideOffset, style, ...props }: PopoverContentProps): JSX.Element;
|
|
63
|
-
|
|
65
|
+
config: {
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
64
68
|
};
|
|
65
69
|
Close: {
|
|
66
70
|
({ asChild, children, className, ...props }: PopoverCloseProps): JSX.Element;
|
|
67
|
-
|
|
71
|
+
config: {
|
|
72
|
+
name: string;
|
|
73
|
+
};
|
|
68
74
|
};
|
|
69
75
|
Anchor: {
|
|
70
76
|
({ asChild, children, ...props }: PopoverAnchorProps): JSX.Element;
|
|
71
|
-
|
|
77
|
+
config: {
|
|
78
|
+
name: string;
|
|
79
|
+
};
|
|
72
80
|
};
|
|
73
81
|
};
|
|
74
82
|
export default Popover;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Root as Root2, Portal, Content as Content2, Arrow as Arrow2,
|
|
2
|
+
import { Root as Root2, Portal, Trigger, Content as Content2, Arrow as Arrow2, Close, Anchor as Anchor2 } from '../../node_modules/@radix-ui/react-popover/dist/index.js';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
5
5
|
import { hasUserBg, bgClassToColor } from '../../utils/index.js';
|
|
@@ -33,7 +33,6 @@ const PopoverContent = ({ align = "center", alignOffset = 0, asChild = false, av
|
|
|
33
33
|
};
|
|
34
34
|
return (jsxs(Content2, { ref: ref, ...componentProps, children: [children, jsx(Arrow2, { className: "coop-popover-arrow" })] }));
|
|
35
35
|
};
|
|
36
|
-
PopoverContent.displayName = "Popover.Content";
|
|
37
36
|
const PopoverTrigger = ({ asChild = false, children, className, ...props }) => {
|
|
38
37
|
const componentProps = {
|
|
39
38
|
// There is a known issue with aria-controls being set to target
|
|
@@ -49,7 +48,6 @@ const PopoverTrigger = ({ asChild = false, children, className, ...props }) => {
|
|
|
49
48
|
};
|
|
50
49
|
return jsx(Trigger, { ...componentProps, children: children });
|
|
51
50
|
};
|
|
52
|
-
PopoverTrigger.displayName = "Popover.Trigger";
|
|
53
51
|
const PopoverClose = ({ asChild = false, children, className, ...props }) => {
|
|
54
52
|
const componentProps = {
|
|
55
53
|
asChild,
|
|
@@ -58,7 +56,6 @@ const PopoverClose = ({ asChild = false, children, className, ...props }) => {
|
|
|
58
56
|
};
|
|
59
57
|
return (jsx(Close, { "aria-label": "Close", ...componentProps, children: children }));
|
|
60
58
|
};
|
|
61
|
-
PopoverClose.displayName = "Popover.Close";
|
|
62
59
|
const PopoverAnchor = ({ asChild = false, children, ...props }) => {
|
|
63
60
|
const componentProps = {
|
|
64
61
|
asChild,
|
|
@@ -66,7 +63,10 @@ const PopoverAnchor = ({ asChild = false, children, ...props }) => {
|
|
|
66
63
|
};
|
|
67
64
|
return jsx(Anchor2, { ...componentProps, children: children });
|
|
68
65
|
};
|
|
69
|
-
|
|
66
|
+
PopoverTrigger.config = { name: "PopoverTrigger" };
|
|
67
|
+
PopoverContent.config = { name: "PopoverContent" };
|
|
68
|
+
PopoverClose.config = { name: "PopoverClose" };
|
|
69
|
+
PopoverAnchor.config = { name: "PopoverAnchor" };
|
|
70
70
|
Popover.Trigger = PopoverTrigger;
|
|
71
71
|
Popover.Content = PopoverContent;
|
|
72
72
|
Popover.Close = PopoverClose;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormHTMLAttributes, JSX, Ref } from "react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { StandardSizes } from "../../types";
|
|
4
4
|
import { type ButtonProps } from "../Button";
|
|
5
|
-
|
|
5
|
+
import { TextInputProps } from "../TextInput";
|
|
6
|
+
export interface SearchboxProps extends FormHTMLAttributes<HTMLFormElement> {
|
|
6
7
|
/** **(Optional)** Specify a server endpoint to submit the form. Will be ignored if onSubmit is also set. */
|
|
7
8
|
action?: string;
|
|
8
9
|
/** **(Optional)** Specify props to forward to the Button element. Use `label` to set Button text. */
|
|
@@ -28,7 +29,22 @@ export interface SearchboxProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
28
29
|
/** **(Optional)** Specify the Searchbox size. */
|
|
29
30
|
size?: StandardSizes;
|
|
30
31
|
/** **(Optional)** Specify the Searchbox variant. */
|
|
31
|
-
variant?: "
|
|
32
|
+
variant?: "solid" | "ghost";
|
|
32
33
|
}
|
|
33
|
-
export declare const Searchbox:
|
|
34
|
+
export declare const Searchbox: {
|
|
35
|
+
({ action, children, className, id, label, labelVisible, onSubmit, ref, size, variant, ...props }: SearchboxProps): JSX.Element;
|
|
36
|
+
Button: {
|
|
37
|
+
({ children, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
config: {
|
|
39
|
+
name: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
Input: {
|
|
43
|
+
(props: TextInputProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
config: {
|
|
45
|
+
isField: boolean;
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
34
50
|
export default Searchbox;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import React__default, { useState, useCallback } from 'react';
|
|
6
6
|
import { useId } from '../../hooks/useId.js';
|
|
7
|
+
import { useSlots } from '../../hooks/useSlots.js';
|
|
8
|
+
import { hasUserBorder } from '../../utils/index.js';
|
|
7
9
|
import { Button } from '../Button/Button.js';
|
|
8
10
|
import { Field } from '../Field/Field.js';
|
|
9
|
-
import {
|
|
10
|
-
import { SearchIcon } from '../Icon/SearchIcon.js';
|
|
11
|
+
import { SearchIcon } from '../icons/SearchIcon.js';
|
|
11
12
|
import { TextInput } from '../TextInput/TextInput.js';
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const componentSlots = {
|
|
15
|
+
SearchboxButton: null,
|
|
16
|
+
SearchboxInput: null,
|
|
16
17
|
};
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const defaultButtonText = React__default.createElement(SearchIcon, {
|
|
19
|
+
alt: "Search",
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeWidth: 2,
|
|
22
|
+
});
|
|
23
|
+
const Searchbox = ({ action, children, className, id, label, labelVisible = false, onSubmit, ref, size = "md", variant = "solid", ...props }) => {
|
|
24
|
+
const slots = useSlots(componentSlots, children);
|
|
19
25
|
const [isPending, setIsPending] = useState(false);
|
|
20
26
|
const uid = useId(id);
|
|
21
27
|
const handleSubmit = useCallback(async (event) => {
|
|
@@ -30,37 +36,45 @@ const Searchbox = ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize
|
|
|
30
36
|
setIsPending(false);
|
|
31
37
|
}
|
|
32
38
|
}, [onSubmit, isPending]);
|
|
39
|
+
let borderClass = "";
|
|
40
|
+
if (!hasUserBorder(className)) {
|
|
41
|
+
borderClass = variant === "ghost" ? "border-teal" : "border-grey";
|
|
42
|
+
}
|
|
33
43
|
const formProps = {
|
|
34
44
|
action: action !== null && action !== void 0 ? action : undefined,
|
|
35
|
-
className: clsx("coop-searchbox", className),
|
|
45
|
+
className: clsx("coop-searchbox", borderClass, className),
|
|
36
46
|
"data-size": size && size !== "md" ? size : undefined,
|
|
37
|
-
"data-variant": variant.length && variant !== "
|
|
38
|
-
id: uid,
|
|
47
|
+
"data-variant": variant.length && variant !== "solid" ? variant : undefined,
|
|
48
|
+
id: uid + "-form",
|
|
39
49
|
onSubmit: onSubmit ? handleSubmit : undefined,
|
|
50
|
+
...props,
|
|
40
51
|
};
|
|
41
|
-
|
|
42
|
-
className: button === null || button === void 0 ? void 0 : button.className,
|
|
52
|
+
slots.SearchboxButton = React__default.cloneElement(slots.SearchboxButton, {
|
|
43
53
|
isLoading: isPending,
|
|
44
|
-
loadingText: (_a = button === null || button === void 0 ? void 0 : button.loadingText) !== null && _a !== void 0 ? _a : "",
|
|
45
54
|
size,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
autoCapitalize,
|
|
51
|
-
autoComplete,
|
|
52
|
-
id: uid + "--input",
|
|
53
|
-
name,
|
|
54
|
-
placeholder,
|
|
55
|
+
});
|
|
56
|
+
slots.SearchboxInput = React__default.cloneElement(slots.SearchboxInput, {
|
|
57
|
+
autoCapitalize: "off",
|
|
58
|
+
id: uid,
|
|
55
59
|
size,
|
|
56
|
-
|
|
57
|
-
...props,
|
|
58
|
-
};
|
|
60
|
+
});
|
|
59
61
|
const labelProps = {
|
|
60
|
-
htmlFor: uid
|
|
62
|
+
htmlFor: uid,
|
|
61
63
|
isVisible: labelVisible,
|
|
62
64
|
};
|
|
63
|
-
return (jsxs("form", { ...formProps, ref: ref, children: [label && jsx(Label, { ...labelProps, children: label }), jsxs("div", { className: "coop-searchbox--inner", children: [jsx(Field, { children:
|
|
65
|
+
return (jsxs("form", { ...formProps, ref: ref, children: [label && jsx(Field.Label, { ...labelProps, children: label }), jsxs("div", { className: clsx("coop-searchbox--inner"), children: [jsx(Field, { children: slots.SearchboxInput }), slots.SearchboxButton] })] }));
|
|
66
|
+
};
|
|
67
|
+
const SearchboxButton = ({ children, ...props }) => {
|
|
68
|
+
const buttonProps = {
|
|
69
|
+
children: children !== null && children !== void 0 ? children : defaultButtonText,
|
|
70
|
+
...props,
|
|
71
|
+
};
|
|
72
|
+
return jsx(Button, { ...buttonProps });
|
|
64
73
|
};
|
|
74
|
+
const SearchboxInput = (props) => jsx(TextInput, { ...props });
|
|
75
|
+
Searchbox.Button = SearchboxButton;
|
|
76
|
+
Searchbox.Input = SearchboxInput;
|
|
77
|
+
SearchboxButton.config = { name: "SearchboxButton" };
|
|
78
|
+
SearchboxInput.config = { isField: true, name: "SearchboxInput" };
|
|
65
79
|
|
|
66
80
|
export { Searchbox, Searchbox as default };
|