@coopdigital/react 1.1.1 → 1.1.3
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/DatePicker/DatePicker.js +4 -2
- package/dist/components/DatePicker/datepicker-utils.js +2 -0
- package/dist/components/Fieldset/Fieldset.d.ts +2 -2
- package/dist/components/Pill/Pill.js +0 -2
- package/dist/components/Searchbox/Searchbox.js +1 -1
- package/package.json +12 -11
- package/src/components/DatePicker/DatePicker.tsx +8 -2
- package/src/components/DatePicker/datepicker-utils.ts +2 -0
- package/src/components/Fieldset/Fieldset.tsx +2 -2
- package/src/components/Pill/Pill.tsx +0 -2
- package/src/components/Searchbox/Searchbox.tsx +1 -1
|
@@ -44,8 +44,10 @@ const DatePicker = ({ className, closeOnSelect = true, dateFormat = "dd/MM/yyyy"
|
|
|
44
44
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
45
45
|
const uid = useId(id);
|
|
46
46
|
initialDate = getInitialDate(mode, initialDate);
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const startDateProp = startDate;
|
|
48
|
+
const endDateProp = endDate;
|
|
49
|
+
startDate = useMemo(() => startDateProp !== null && startDateProp !== void 0 ? startDateProp : getStartDate(initialDate), [initialDate, startDateProp]);
|
|
50
|
+
endDate = useMemo(() => endDateProp !== null && endDateProp !== void 0 ? endDateProp : getEndDate(initialDate), [initialDate, endDateProp]);
|
|
49
51
|
const defaultMonth = useMemo(() => getDefaultMonth(initialDate), [initialDate]);
|
|
50
52
|
let initialValues = {
|
|
51
53
|
state: undefined,
|
|
@@ -204,8 +204,10 @@ const shouldClose = (mode, value, closeOnSelect) => {
|
|
|
204
204
|
else
|
|
205
205
|
return false;
|
|
206
206
|
};
|
|
207
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
207
208
|
const isSingle = (m, d) => m === "single";
|
|
208
209
|
const isMultiple = (m, d) => m === "multiple";
|
|
209
210
|
const isRange = (m, d) => m === "range";
|
|
211
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
210
212
|
|
|
211
213
|
export { getDateValues, getDefaultMonth, getEndDate, getISODateString, getInitialDate, getMultipleDate, getRangeDate, getRangeFromString, getSingleDate, getStartDate, isMultiple, isRange, isSingle, isValidDate, isValidRangeFrom, isValidRangeTo, shouldClose, shouldSkipParsing };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FieldsetHTMLAttributes, type JSX, Ref } from "react";
|
|
1
|
+
import { type FieldsetHTMLAttributes, HTMLAttributes, type JSX, Ref } from "react";
|
|
2
2
|
import { StandardSizes } from "../../../src/types";
|
|
3
3
|
import { type ErrorProps } from "../FieldMarkers/Error";
|
|
4
4
|
import { type HintProps } from "../FieldMarkers/Hint";
|
|
@@ -48,7 +48,7 @@ export declare const Fieldset: {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
interface FieldsetFieldsProps {
|
|
51
|
+
interface FieldsetFieldsProps extends HTMLAttributes<HTMLDivElement> {
|
|
52
52
|
/** **(Optional)** Specify whether all descendent Fields should render inside a box. */
|
|
53
53
|
boxed?: boolean;
|
|
54
54
|
/** **(Optional)** Form elements inside the Fieldset.Fields container. */
|
|
@@ -17,8 +17,6 @@ const Pill = ({ as, children, className, href, ref, size = "md", ...props }) =>
|
|
|
17
17
|
href,
|
|
18
18
|
...props,
|
|
19
19
|
};
|
|
20
|
-
// https://github.com/facebook/react/issues/34775
|
|
21
|
-
// eslint-disable-next-line react-hooks/refs
|
|
22
20
|
return React.createElement(element, { ...componentProps, ref }, slots.PillBadge, slots.Children);
|
|
23
21
|
};
|
|
24
22
|
const PillBadge = ({ children, className }) => {
|
|
@@ -21,7 +21,7 @@ const defaultButtonText = React.createElement(SearchIcon, {
|
|
|
21
21
|
width: 24,
|
|
22
22
|
});
|
|
23
23
|
const Searchbox = ({ action, children, className, id, label, labelVisible = false, onSubmit, ref, size = "md", variant = "solid", ...props }) => {
|
|
24
|
-
const slots = useSlots(componentSlots, children);
|
|
24
|
+
const slots = { ...useSlots(componentSlots, children) };
|
|
25
25
|
const [isPending, setIsPending] = useState(false);
|
|
26
26
|
const uid = useId(id);
|
|
27
27
|
const handleSubmit = useCallback(async (event) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"serve:storybook:test": "serve -p 9000 ./storybook-test",
|
|
53
53
|
"build:storybook:local": "storybook build --disable-telemetry",
|
|
54
54
|
"serve:storybook:local": "serve -p 9000 ./storybook-static",
|
|
55
|
-
"storybook": "storybook dev -p 6006"
|
|
55
|
+
"storybook": "storybook dev -p 6006",
|
|
56
|
+
"typecheck": "tsc --noEmit --jsx preserve --skipLibCheck"
|
|
56
57
|
},
|
|
57
58
|
"author": "",
|
|
58
59
|
"license": "MIT",
|
|
@@ -60,19 +61,19 @@
|
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@axe-core/playwright": "^4.11.1",
|
|
62
63
|
"@playwright/test": "^1.59.1",
|
|
63
|
-
"@storybook/addon-a11y": "^10.3.
|
|
64
|
-
"@storybook/addon-docs": "^10.3.
|
|
65
|
-
"@storybook/addon-onboarding": "^10.3.
|
|
66
|
-
"@storybook/react-vite": "^10.3.
|
|
64
|
+
"@storybook/addon-a11y": "^10.3.5",
|
|
65
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
66
|
+
"@storybook/addon-onboarding": "^10.3.5",
|
|
67
|
+
"@storybook/react-vite": "^10.3.5",
|
|
67
68
|
"@testing-library/jest-dom": "^6.9.1",
|
|
68
69
|
"@testing-library/react": "^16.3.2",
|
|
69
70
|
"@types/react": "^19.2.14",
|
|
70
71
|
"@types/react-dom": "^19.2.3",
|
|
71
|
-
"react": "^19.2.
|
|
72
|
-
"react-dom": "^19.2.
|
|
72
|
+
"react": "^19.2.5",
|
|
73
|
+
"react-dom": "^19.2.5",
|
|
73
74
|
"resize-observer-polyfill": "^1.5.1",
|
|
74
75
|
"serve": "^14.2.6",
|
|
75
|
-
"storybook": "^10.3.
|
|
76
|
+
"storybook": "^10.3.5",
|
|
76
77
|
"storybook-addon-tag-badges": "^3.1.0"
|
|
77
78
|
},
|
|
78
79
|
"peerDependencies": {
|
|
@@ -83,10 +84,10 @@
|
|
|
83
84
|
"storybook": "$storybook"
|
|
84
85
|
},
|
|
85
86
|
"dependencies": {
|
|
86
|
-
"@coopdigital/styles": "^1.1.
|
|
87
|
+
"@coopdigital/styles": "^1.1.2",
|
|
87
88
|
"@radix-ui/react-popover": "^1.1.15",
|
|
88
89
|
"clsx": "^2.1.1",
|
|
89
90
|
"react-day-picker": "^9.12.0"
|
|
90
91
|
},
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "fd986750a8a2cbc8d0540f7d6d4345984eb8ce85"
|
|
92
93
|
}
|
|
@@ -186,8 +186,14 @@ export const DatePicker = ({
|
|
|
186
186
|
|
|
187
187
|
initialDate = getInitialDate(mode, initialDate)
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
const startDateProp = startDate
|
|
190
|
+
const endDateProp = endDate
|
|
191
|
+
|
|
192
|
+
startDate = useMemo(
|
|
193
|
+
() => startDateProp ?? getStartDate(initialDate),
|
|
194
|
+
[initialDate, startDateProp]
|
|
195
|
+
)
|
|
196
|
+
endDate = useMemo(() => endDateProp ?? getEndDate(initialDate), [initialDate, endDateProp])
|
|
191
197
|
|
|
192
198
|
const defaultMonth = useMemo(() => getDefaultMonth(initialDate), [initialDate])
|
|
193
199
|
|
|
@@ -264,6 +264,8 @@ export const shouldClose = (mode: Mode, value: DateType, closeOnSelect?: boolean
|
|
|
264
264
|
else return false
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
267
268
|
export const isSingle = (m: Mode, d: DateType): d is Date & DateBase => m === "single"
|
|
268
269
|
export const isMultiple = (m: Mode, d: DateType): d is Date[] & DateBase => m === "multiple"
|
|
269
270
|
export const isRange = (m: Mode, d: DateType): d is DateRange & DateBase => m === "range"
|
|
271
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
|
-
import { type FieldsetHTMLAttributes, type JSX, Ref } from "react"
|
|
2
|
+
import { type FieldsetHTMLAttributes, HTMLAttributes, type JSX, Ref } from "react"
|
|
3
3
|
|
|
4
4
|
import { StandardSizes } from "../../../src/types"
|
|
5
5
|
import { Error as BaseError, type ErrorProps } from "../FieldMarkers/Error"
|
|
@@ -51,7 +51,7 @@ export const Fieldset = ({
|
|
|
51
51
|
)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
interface FieldsetFieldsProps {
|
|
54
|
+
interface FieldsetFieldsProps extends HTMLAttributes<HTMLDivElement> {
|
|
55
55
|
/** **(Optional)** Specify whether all descendent Fields should render inside a box. */
|
|
56
56
|
boxed?: boolean
|
|
57
57
|
/** **(Optional)** Form elements inside the Fieldset.Fields container. */
|
|
@@ -65,7 +65,7 @@ export const Searchbox = ({
|
|
|
65
65
|
variant = "solid",
|
|
66
66
|
...props
|
|
67
67
|
}: SearchboxProps): JSX.Element => {
|
|
68
|
-
const slots = useSlots(componentSlots, children)
|
|
68
|
+
const slots = { ...useSlots(componentSlots, children) }
|
|
69
69
|
|
|
70
70
|
const [isPending, setIsPending] = useState(false)
|
|
71
71
|
const uid = useId(id)
|