@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
|
@@ -36,11 +36,15 @@ export declare const Select: {
|
|
|
36
36
|
({ children, className, disabled, error, id, name, ref, size, ...props }: SelectProps): JSX.Element;
|
|
37
37
|
OptionGroup: {
|
|
38
38
|
({ children, ...props }: SelectOptionGroupProps): JSX.Element;
|
|
39
|
-
|
|
39
|
+
config: {
|
|
40
|
+
name: string;
|
|
41
|
+
};
|
|
40
42
|
};
|
|
41
43
|
Option: {
|
|
42
44
|
({ children, className, ...props }: SelectOptionProps): JSX.Element;
|
|
43
|
-
|
|
45
|
+
config: {
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
44
48
|
};
|
|
45
49
|
config: {
|
|
46
50
|
isField: true;
|
|
@@ -18,11 +18,11 @@ const Select = ({ children, className, disabled, error, id, name, ref, size = "m
|
|
|
18
18
|
const SelectOptionGroup = ({ children, ...props }) => {
|
|
19
19
|
return jsx("optgroup", { ...props, children: children });
|
|
20
20
|
};
|
|
21
|
-
SelectOptionGroup.displayName = "Select.OptionGroup";
|
|
22
21
|
const SelectOption = ({ children, className, ...props }) => {
|
|
23
22
|
return (jsx("option", { className: clsx("coop-select--option", className), ...props, children: children }));
|
|
24
23
|
};
|
|
25
|
-
SelectOption.
|
|
24
|
+
SelectOption.config = { name: "SelectOption" };
|
|
25
|
+
SelectOptionGroup.config = { name: "SelectOptionGroup" };
|
|
26
26
|
Select.OptionGroup = SelectOptionGroup;
|
|
27
27
|
Select.Option = SelectOption;
|
|
28
28
|
Select.config = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { ChevronRightIcon } from '../
|
|
4
|
+
import { ChevronRightIcon } from '../icons/ChevronRightIcon.js';
|
|
5
5
|
import { Image } from '../Image/Image.js';
|
|
6
6
|
|
|
7
7
|
const Signpost = ({ as, children, className, headingLevel = "h3", href, image, ref, ...props }) => {
|
|
@@ -4,7 +4,7 @@ import { hasUserBg } from '../../utils/index.js';
|
|
|
4
4
|
|
|
5
5
|
const Squircle = ({ children, className, ref, size = "lg", ...props }) => {
|
|
6
6
|
const componentProps = {
|
|
7
|
-
className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer
|
|
7
|
+
className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer", className),
|
|
8
8
|
"data-size": size.length && size !== "lg" ? size : undefined,
|
|
9
9
|
...props,
|
|
10
10
|
};
|
package/dist/hooks/useSlots.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ReactNodeWithConfig } from "src/types";
|
|
2
3
|
type Slots<T> = Record<keyof T, React.ReactNode>;
|
|
3
4
|
export declare function isKey<T extends object>(x: T, k: PropertyKey): k is keyof T;
|
|
4
|
-
export declare function getSlotName(node:
|
|
5
|
+
export declare function getSlotName(node: ReactNodeWithConfig): string | false;
|
|
5
6
|
export declare function useSlots<T>(componentSlots: Slots<T>, children: React.ReactNode, options?: {
|
|
6
7
|
collect?: string[];
|
|
7
8
|
}): Slots<T>;
|
package/dist/hooks/useSlots.js
CHANGED
|
@@ -4,9 +4,14 @@ function isKey(x, k) {
|
|
|
4
4
|
return k in x;
|
|
5
5
|
}
|
|
6
6
|
function getSlotName(node) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
if (React__default.isValidElement(node) &&
|
|
9
|
+
node.type &&
|
|
10
|
+
typeof node.type !== "string" &&
|
|
11
|
+
typeof node.type !== "symbol") {
|
|
12
|
+
return (_c = (_b = (_a = node.type) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : node.type.name;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
10
15
|
}
|
|
11
16
|
function useSlots(componentSlots, children, options) {
|
|
12
17
|
return React__default.Children.toArray(children).reduce((slots, child) => {
|
package/dist/types/colors.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export type Darks = "dark-blue" | "dark-yellow" | "dark-green" | "dark-lilac" | "dark-orange" | "dark-pink" | "dark-purple" | "dark-red";
|
|
2
2
|
export type Tints = "tint-blue" | "tint-brown" | "tint-yellow" | "tint-green" | "tint-grey" | "tint-lilac" | "tint-orange" | "tint-pink" | "tint-purple" | "tint-red";
|
|
3
3
|
export type Lights = "light-blue" | "light-yellow" | "light-green" | "light-lilac" | "light-orange" | "light-pink" | "light-purple" | "light-red";
|
|
4
|
-
export type Greys = "dark-grey" | "mid-dark-grey" | "mid-grey" | "mid-light-grey" | "light-grey";
|
|
5
4
|
export type White = "white";
|
|
6
5
|
export type Black = "black";
|
|
7
6
|
export type None = "none";
|
|
8
7
|
export type BrandBlue = "brand-blue";
|
|
9
|
-
export type OfferRed = "offer
|
|
8
|
+
export type OfferRed = "offer";
|
|
10
9
|
export type Green = "green";
|
|
11
10
|
export type Blue = "blue";
|
package/dist/types/index.d.ts
CHANGED
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const bgPropToClass: (color: string, userClasses?: string) => string;
|
|
2
2
|
export declare const hasUserBg: (userClasses?: string) => boolean;
|
|
3
|
+
export declare const hasUserBorder: (userClasses?: string) => boolean;
|
|
3
4
|
export declare const bgClassToColor: (userClasses: string) => string | null;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const hasUserBg = (userClasses) => {
|
|
2
2
|
return typeof userClasses === "string" && (userClasses === null || userClasses === void 0 ? void 0 : userClasses.includes("bg-")) ? true : false;
|
|
3
3
|
};
|
|
4
|
+
const hasUserBorder = (userClasses) => {
|
|
5
|
+
return typeof userClasses === "string" && (userClasses === null || userClasses === void 0 ? void 0 : userClasses.includes("border-")) ? true : false;
|
|
6
|
+
};
|
|
4
7
|
const bgClassToColor = (userClasses) => {
|
|
5
8
|
var _a, _b;
|
|
6
9
|
return (_b = (_a = /bg-([^\s]+)/.exec(userClasses)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : null;
|
|
@@ -12,4 +15,4 @@ const bgClassToColor = (userClasses) => {
|
|
|
12
15
|
// )
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
export { bgClassToColor, hasUserBg };
|
|
18
|
+
export { bgClassToColor, hasUserBg, hasUserBorder };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.54.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
-
"./
|
|
15
|
-
"types": "./dist/components
|
|
16
|
-
"default": "./dist/components
|
|
14
|
+
"./components/*": {
|
|
15
|
+
"types": "./dist/components/*/*.d.ts",
|
|
16
|
+
"default": "./dist/components/*/*.js"
|
|
17
|
+
},
|
|
18
|
+
"./icons": {
|
|
19
|
+
"types": "./dist/components/icons/index.d.ts",
|
|
20
|
+
"default": "./dist/components/icons/index.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"files": [
|
|
@@ -43,34 +47,33 @@
|
|
|
43
47
|
"build": "tsx scripts build",
|
|
44
48
|
"build:docs": "tsx scripts build-docs",
|
|
45
49
|
"build:icons": "tsx scripts build-icons",
|
|
46
|
-
"build:storybook": "storybook build --disable-telemetry
|
|
50
|
+
"build:storybook": "storybook build --disable-telemetry",
|
|
47
51
|
"build:storybook:test": "storybook build --test --disable-telemetry --output-dir storybook-test",
|
|
48
52
|
"serve:storybook:test": "serve -p 9000 ./storybook-test",
|
|
49
53
|
"build:storybook:local": "storybook build --disable-telemetry",
|
|
50
54
|
"serve:storybook:local": "serve -p 9000 ./storybook-static",
|
|
51
|
-
"storybook": "storybook dev -p 6006"
|
|
52
|
-
"storybook:fix-paths": "tsx scripts/storybook-fix-paths.ts"
|
|
55
|
+
"storybook": "storybook dev -p 6006"
|
|
53
56
|
},
|
|
54
57
|
"author": "",
|
|
55
58
|
"license": "MIT",
|
|
56
59
|
"description": "React components for the Experience Library design system",
|
|
57
60
|
"devDependencies": {
|
|
58
|
-
"@axe-core/playwright": "^4.11.
|
|
61
|
+
"@axe-core/playwright": "^4.11.1",
|
|
59
62
|
"@playwright/test": "^1.58.1",
|
|
60
|
-
"@storybook/addon-a11y": "^10.2.
|
|
61
|
-
"@storybook/addon-docs": "^10.2.
|
|
62
|
-
"@storybook/addon-onboarding": "^10.2.
|
|
63
|
-
"@storybook/react-vite": "^10.2.
|
|
63
|
+
"@storybook/addon-a11y": "^10.2.7",
|
|
64
|
+
"@storybook/addon-docs": "^10.2.7",
|
|
65
|
+
"@storybook/addon-onboarding": "^10.2.7",
|
|
66
|
+
"@storybook/react-vite": "^10.2.7",
|
|
64
67
|
"@testing-library/jest-dom": "^6.9.1",
|
|
65
68
|
"@testing-library/react": "^16.3.2",
|
|
66
|
-
"@types/react": "^19.2.
|
|
69
|
+
"@types/react": "^19.2.13",
|
|
67
70
|
"@types/react-dom": "^19.2.3",
|
|
68
71
|
"react": "^19.2.4",
|
|
69
72
|
"react-dom": "^19.2.4",
|
|
70
73
|
"resize-observer-polyfill": "^1.5.1",
|
|
71
74
|
"serve": "^14.2.5",
|
|
72
|
-
"storybook": "^10.2.
|
|
73
|
-
"storybook-addon-tag-badges": "^3.0.
|
|
75
|
+
"storybook": "^10.2.7",
|
|
76
|
+
"storybook-addon-tag-badges": "^3.0.6"
|
|
74
77
|
},
|
|
75
78
|
"peerDependencies": {
|
|
76
79
|
"react": "^19.1.0",
|
|
@@ -80,10 +83,10 @@
|
|
|
80
83
|
"storybook": "$storybook"
|
|
81
84
|
},
|
|
82
85
|
"dependencies": {
|
|
83
|
-
"@coopdigital/styles": "^0.
|
|
86
|
+
"@coopdigital/styles": "^0.45.0",
|
|
84
87
|
"@radix-ui/react-popover": "^1.1.15",
|
|
85
88
|
"clsx": "^2.1.1",
|
|
86
89
|
"react-day-picker": "^9.12.0"
|
|
87
90
|
},
|
|
88
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "d15d7ae0d231bf28986a18a9e097537802f845db"
|
|
89
92
|
}
|
|
@@ -44,7 +44,7 @@ const AlertBannerHeading = ({ children, className }: AlertBannerHeadingProps): J
|
|
|
44
44
|
return <h2 className={className}>{children}</h2>
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
AlertBannerHeading.
|
|
47
|
+
AlertBannerHeading.config = { name: "AlertBannerHeading" }
|
|
48
48
|
|
|
49
49
|
AlertBanner.Heading = AlertBannerHeading
|
|
50
50
|
|
|
@@ -5,7 +5,8 @@ import type { ButtonHTMLAttributes, ForwardRefExoticComponent, JSX, Ref } from "
|
|
|
5
5
|
import clsx from "clsx"
|
|
6
6
|
import React, { useCallback, useState } from "react"
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { hasUserBg } from "../../utils"
|
|
9
|
+
import { LoadingIcon } from "../icons"
|
|
9
10
|
|
|
10
11
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
12
|
/** **(Optional)** Specify a custom element to override default `a` or `button`. */
|
|
@@ -32,16 +33,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
32
33
|
/** **(Optional)** Specify the Button size. */
|
|
33
34
|
size?: "sm" | "md" | "lg"
|
|
34
35
|
/** **(Optional)** Specify the Button variant. */
|
|
35
|
-
variant?:
|
|
36
|
-
| "green"
|
|
37
|
-
| "blue"
|
|
38
|
-
| "white"
|
|
39
|
-
| "grey"
|
|
40
|
-
| "green-ghost"
|
|
41
|
-
| "blue-ghost"
|
|
42
|
-
| "white-ghost"
|
|
43
|
-
| "grey-ghost"
|
|
44
|
-
| "text"
|
|
36
|
+
variant?: "solid" | "ghost" | "text"
|
|
45
37
|
}
|
|
46
38
|
|
|
47
39
|
type OnClickHandler =
|
|
@@ -60,7 +52,7 @@ export const Button = ({
|
|
|
60
52
|
onClick,
|
|
61
53
|
ref,
|
|
62
54
|
size = "md",
|
|
63
|
-
variant = "
|
|
55
|
+
variant = "solid",
|
|
64
56
|
...props
|
|
65
57
|
}: ButtonProps): JSX.Element => {
|
|
66
58
|
const element: ButtonProps["as"] = as ?? (href ? "a" : "button")
|
|
@@ -85,7 +77,11 @@ export const Button = ({
|
|
|
85
77
|
const componentProps = {
|
|
86
78
|
"aria-disabled": isDisabled ? true : undefined,
|
|
87
79
|
"aria-live": "assertive" as keyof ButtonHTMLAttributes<HTMLButtonElement>["aria-live"],
|
|
88
|
-
className: clsx(
|
|
80
|
+
className: clsx(
|
|
81
|
+
variant == "text" ? "coop-link" : "coop-button",
|
|
82
|
+
!hasUserBg(className) && variant === "solid" && "bg-teal",
|
|
83
|
+
className
|
|
84
|
+
),
|
|
89
85
|
"data-loading": isLoading || isPending ? true : undefined,
|
|
90
86
|
"data-size": size.length && size !== "md" ? size : undefined,
|
|
91
87
|
"data-variant": variant !== "text" ? variant : undefined,
|
|
@@ -4,7 +4,8 @@ import clsx from "clsx"
|
|
|
4
4
|
import React from "react"
|
|
5
5
|
|
|
6
6
|
import { useSlots } from "../../hooks/useSlots"
|
|
7
|
-
import {
|
|
7
|
+
import { hasUserBg } from "../../utils"
|
|
8
|
+
import { ChevronRightIcon } from "../icons/ChevronRightIcon"
|
|
8
9
|
import { Image, ImageProps } from "../Image"
|
|
9
10
|
|
|
10
11
|
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -99,7 +100,7 @@ export const Card = ({
|
|
|
99
100
|
const hasLinkWrapper = href && !slots.CardHeading
|
|
100
101
|
|
|
101
102
|
const componentProps = {
|
|
102
|
-
className: clsx("coop-card", className),
|
|
103
|
+
className: clsx("coop-card", !hasUserBg(className) && "bg-white", className),
|
|
103
104
|
"data-image-pos": imagePosition,
|
|
104
105
|
"data-orientation": orientation !== "vertical" ? orientation : undefined,
|
|
105
106
|
...props,
|
|
@@ -136,14 +137,10 @@ const CardHeading = ({ as = "h3", children, className }: CardHeadingProps): JSX.
|
|
|
136
137
|
return React.createElement(as, { className: clsx("coop-card--heading", className) }, children)
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
CardHeading.displayName = "Card.Heading"
|
|
140
|
-
|
|
141
140
|
const CardLabel = ({ children, className }: CardLabelProps): JSX.Element => {
|
|
142
141
|
return <span className={clsx("coop-card--label", className)}>{children}</span>
|
|
143
142
|
}
|
|
144
143
|
|
|
145
|
-
CardLabel.displayName = "Card.Label"
|
|
146
|
-
|
|
147
144
|
const CardBadge = ({
|
|
148
145
|
align = "right",
|
|
149
146
|
children,
|
|
@@ -157,19 +154,19 @@ const CardBadge = ({
|
|
|
157
154
|
)
|
|
158
155
|
}
|
|
159
156
|
|
|
160
|
-
CardBadge.displayName = "Card.Badge"
|
|
161
|
-
|
|
162
157
|
const CardBody = ({ children }: CardBodyProps): JSX.Element => {
|
|
163
158
|
return <>{children}</>
|
|
164
159
|
}
|
|
165
160
|
|
|
166
|
-
CardBody.displayName = "Card.Body"
|
|
167
|
-
|
|
168
161
|
const CardImage = (props: CardImageProps) => {
|
|
169
162
|
return <Image {...{ ...props, crop: props.crop ?? "wide" }} />
|
|
170
163
|
}
|
|
171
164
|
|
|
172
|
-
|
|
165
|
+
CardLabel.config = { name: "CardLabel" }
|
|
166
|
+
CardHeading.config = { name: "CardHeading" }
|
|
167
|
+
CardBadge.config = { name: "CardBadge" }
|
|
168
|
+
CardBody.config = { name: "CardBody" }
|
|
169
|
+
CardImage.config = { name: "CardImage" }
|
|
173
170
|
|
|
174
171
|
Card.Label = CardLabel
|
|
175
172
|
Card.Heading = CardHeading
|
|
@@ -24,7 +24,7 @@ import type {
|
|
|
24
24
|
|
|
25
25
|
import { useId } from "../../hooks/useId"
|
|
26
26
|
import Button from "../Button"
|
|
27
|
-
import { CloseIcon, TickIcon } from "../
|
|
27
|
+
import { CloseIcon, TickIcon } from "../icons"
|
|
28
28
|
import Popover from "../Popover"
|
|
29
29
|
import TextInput from "../TextInput"
|
|
30
30
|
import {
|
|
@@ -330,7 +330,7 @@ export const DatePicker = ({
|
|
|
330
330
|
{...calendarProps[mode]}
|
|
331
331
|
/>
|
|
332
332
|
<div className="coop-datepicker-actions">
|
|
333
|
-
<Button aria-label="Cancel" onClick={resetState} size="sm"
|
|
333
|
+
<Button aria-label="Cancel" className="bg-tint-grey" onClick={resetState} size="sm">
|
|
334
334
|
Clear <CloseIcon stroke="black" strokeWidth={1} />
|
|
335
335
|
</Button>
|
|
336
336
|
<Popover.Close asChild>
|
|
@@ -3,11 +3,11 @@ import type { DetailsHTMLAttributes, HTMLAttributes, JSX, Ref } from "react"
|
|
|
3
3
|
import { clsx } from "clsx"
|
|
4
4
|
|
|
5
5
|
import { useSlots } from "../../hooks/useSlots"
|
|
6
|
-
import {
|
|
7
|
-
import { ChevronDownIcon } from "../
|
|
6
|
+
import { hasUserBg } from "../../utils"
|
|
7
|
+
import { ChevronDownIcon } from "../icons"
|
|
8
8
|
|
|
9
9
|
export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
|
|
10
|
-
/** Main content inside the component
|
|
10
|
+
/** Main content inside the component. This should be an `Expandable.Summary` and `Expandable.Content`. */
|
|
11
11
|
children: React.ReactNode
|
|
12
12
|
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
13
13
|
className?: string
|
|
@@ -22,8 +22,15 @@ interface ExpandableSummaryProps extends HTMLAttributes<HTMLElement> {
|
|
|
22
22
|
className?: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
interface ExpandableContentProps extends HTMLAttributes<HTMLElement> {
|
|
26
|
+
/** **(Optional)** Content inside the Expandable. */
|
|
27
|
+
children?: React.ReactNode
|
|
28
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the content wrapper. */
|
|
29
|
+
className?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
const componentSlots = {
|
|
26
|
-
|
|
33
|
+
ExpandableContent: null,
|
|
27
34
|
ExpandableSummary: null,
|
|
28
35
|
}
|
|
29
36
|
|
|
@@ -40,14 +47,14 @@ export const Expandable = ({
|
|
|
40
47
|
...props,
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
componentProps.style = {
|
|
44
|
-
|
|
45
|
-
}
|
|
50
|
+
// componentProps.style = {
|
|
51
|
+
// "--bg": `var(--color-${bgClassToColor(componentProps.className)})`,
|
|
52
|
+
// }
|
|
46
53
|
|
|
47
54
|
return (
|
|
48
55
|
<details {...componentProps} ref={ref}>
|
|
49
56
|
{slots.ExpandableSummary}
|
|
50
|
-
|
|
57
|
+
{slots.ExpandableContent}
|
|
51
58
|
</details>
|
|
52
59
|
)
|
|
53
60
|
}
|
|
@@ -66,8 +73,18 @@ const ExpandableSummary = ({ children, className, ...props }: ExpandableSummaryP
|
|
|
66
73
|
)
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
const ExpandableContent = ({ children, className, ...props }: ExpandableContentProps) => {
|
|
77
|
+
return (
|
|
78
|
+
<div className={clsx("coop-expandable--content", className)} {...props}>
|
|
79
|
+
{children}
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
ExpandableSummary.config = { name: "ExpandableSummary" }
|
|
85
|
+
ExpandableContent.config = { name: "ExpandableContent" }
|
|
70
86
|
|
|
71
87
|
Expandable.Summary = ExpandableSummary
|
|
88
|
+
Expandable.Content = ExpandableContent
|
|
72
89
|
|
|
73
90
|
export default Expandable
|
|
@@ -132,19 +132,14 @@ export const FieldControl = ({ children, className, ...props }: ControlProps): J
|
|
|
132
132
|
)
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
FieldControl.displayName = "Field.Control"
|
|
136
|
-
|
|
137
135
|
const FieldLabel = (props: LabelProps) => <BaseLabel {...props} />
|
|
138
|
-
|
|
139
|
-
FieldLabel.displayName = "Field.Label"
|
|
140
|
-
|
|
141
136
|
const FieldHint = (props: HintProps) => <BaseHint {...props} />
|
|
142
|
-
|
|
143
|
-
FieldHint.displayName = "Field.Hint"
|
|
144
|
-
|
|
145
137
|
const FieldError = (props: ErrorProps) => <BaseError {...props} />
|
|
146
138
|
|
|
147
|
-
|
|
139
|
+
FieldControl.config = { name: "FieldControl" }
|
|
140
|
+
FieldLabel.config = { name: "FieldLabel" }
|
|
141
|
+
FieldHint.config = { name: "FieldHint" }
|
|
142
|
+
FieldError.config = { name: "FieldError" }
|
|
148
143
|
|
|
149
144
|
export const Field = Object.assign(Root, {
|
|
150
145
|
Control: FieldControl,
|
|
@@ -79,19 +79,14 @@ export const FieldsetFields = ({
|
|
|
79
79
|
return <div {...componentProps}>{children}</div>
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
FieldsetFields.displayName = "Fieldset.Fields"
|
|
83
|
-
|
|
84
82
|
const FieldsetLegend = (props: LegendProps) => <BaseLegend {...props} />
|
|
85
|
-
|
|
86
|
-
FieldsetLegend.displayName = "Fieldset.Legend"
|
|
87
|
-
|
|
88
83
|
const FieldsetHint = (props: HintProps) => <BaseHint {...props} />
|
|
89
|
-
|
|
90
|
-
FieldsetHint.displayName = "Fieldset.Hint"
|
|
91
|
-
|
|
92
84
|
const FieldsetError = (props: ErrorProps) => <BaseError {...props} />
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
FieldsetFields.config = { name: "FieldsetField" }
|
|
87
|
+
FieldsetLegend.config = { name: "FieldsetLegend" }
|
|
88
|
+
FieldsetHint.config = { name: "FieldsetHint" }
|
|
89
|
+
FieldsetError.config = { name: "FieldsetError" }
|
|
95
90
|
|
|
96
91
|
export const Fieldset = Object.assign(Root, {
|
|
97
92
|
Error: FieldsetError,
|
|
@@ -62,13 +62,13 @@ export const Pill = ({
|
|
|
62
62
|
|
|
63
63
|
const PillBadge = ({ children, className }: PillBadgeProps) => {
|
|
64
64
|
return (
|
|
65
|
-
<span className={clsx("coop-pill--badge", !hasUserBg(className) && "bg-
|
|
65
|
+
<span className={clsx("coop-pill--badge", !hasUserBg(className) && "bg-red", className)}>
|
|
66
66
|
{children}
|
|
67
67
|
</span>
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
PillBadge.
|
|
71
|
+
PillBadge.config = { name: "PillBadge" }
|
|
72
72
|
|
|
73
73
|
Pill.Badge = PillBadge
|
|
74
74
|
|
|
@@ -127,8 +127,6 @@ const PopoverContent = ({
|
|
|
127
127
|
)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
PopoverContent.displayName = "Popover.Content"
|
|
131
|
-
|
|
132
130
|
const PopoverTrigger = ({
|
|
133
131
|
asChild = false,
|
|
134
132
|
children,
|
|
@@ -152,8 +150,6 @@ const PopoverTrigger = ({
|
|
|
152
150
|
return <RadixPopover.Trigger {...componentProps}>{children}</RadixPopover.Trigger>
|
|
153
151
|
}
|
|
154
152
|
|
|
155
|
-
PopoverTrigger.displayName = "Popover.Trigger"
|
|
156
|
-
|
|
157
153
|
const PopoverClose = ({
|
|
158
154
|
asChild = false,
|
|
159
155
|
children,
|
|
@@ -173,8 +169,6 @@ const PopoverClose = ({
|
|
|
173
169
|
)
|
|
174
170
|
}
|
|
175
171
|
|
|
176
|
-
PopoverClose.displayName = "Popover.Close"
|
|
177
|
-
|
|
178
172
|
const PopoverAnchor = ({
|
|
179
173
|
asChild = false,
|
|
180
174
|
children,
|
|
@@ -188,7 +182,10 @@ const PopoverAnchor = ({
|
|
|
188
182
|
return <RadixPopover.Anchor {...componentProps}>{children}</RadixPopover.Anchor>
|
|
189
183
|
}
|
|
190
184
|
|
|
191
|
-
|
|
185
|
+
PopoverTrigger.config = { name: "PopoverTrigger" }
|
|
186
|
+
PopoverContent.config = { name: "PopoverContent" }
|
|
187
|
+
PopoverClose.config = { name: "PopoverClose" }
|
|
188
|
+
PopoverAnchor.config = { name: "PopoverAnchor" }
|
|
192
189
|
|
|
193
190
|
Popover.Trigger = PopoverTrigger
|
|
194
191
|
Popover.Content = PopoverContent
|