@tidbcloud/uikit 2.8.4 → 2.8.6
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/CHANGELOG.md +13 -0
- package/dist/biz/DateTimePicker/index.cjs +8 -2
- package/dist/biz/DateTimePicker/index.mjs +8 -2
- package/dist/biz/DateTimePicker/types.d.cts +7 -0
- package/dist/biz/DateTimePicker/types.d.mts +7 -0
- package/dist/biz/Form/FormErrorMessage.cjs +14 -1
- package/dist/biz/Form/FormErrorMessage.mjs +14 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @tidbcloud/uikit
|
|
2
2
|
|
|
3
|
+
## 2.8.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(Form): restrict error message HTML ([#659](https://github.com/tidbcloud/tidbcloud-uikit/pull/659))
|
|
8
|
+
- fix(ci): authorize and isolate snapshot publishing ([#660](https://github.com/tidbcloud/tidbcloud-uikit/pull/660))
|
|
9
|
+
|
|
10
|
+
## 2.8.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- fix(DateTimePicker): recover from invalid date values ([#657](https://github.com/tidbcloud/tidbcloud-uikit/pull/657))
|
|
15
|
+
|
|
3
16
|
## 2.8.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -24,6 +24,10 @@ const DatePicker = require("../../node_modules/.pnpm/@mantine_dates@7.17.8_@mant
|
|
|
24
24
|
const Divider = require("../../node_modules/.pnpm/@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/node_modules/@mantine/core/esm/components/Divider/Divider.cjs");
|
|
25
25
|
const TimeInput = require("../../node_modules/.pnpm/@mantine_dates@7.17.8_@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hoo_itsuscsie4edrhi6ero4lpb3hq/node_modules/@mantine/dates/esm/components/TimeInput/TimeInput.cjs");
|
|
26
26
|
const Flex = require("../../node_modules/.pnpm/@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/node_modules/@mantine/core/esm/components/Flex/Flex.cjs");
|
|
27
|
+
const getValidDate = (value) => {
|
|
28
|
+
const date = value ? dayjs.dayjs(value) : void 0;
|
|
29
|
+
return (date == null ? void 0 : date.isValid()) ? date : void 0;
|
|
30
|
+
};
|
|
27
31
|
const DateTimePicker = ({
|
|
28
32
|
placeholder = "Select time",
|
|
29
33
|
format = helpers$1.DEFAULT_TIME_FORMAT,
|
|
@@ -45,9 +49,11 @@ const DateTimePicker = ({
|
|
|
45
49
|
const [opened, { close, open }] = useDisclosure.useDisclosure(false);
|
|
46
50
|
const currentDay = dayjs.dayjs(today).startOf("day");
|
|
47
51
|
const minimumDate = dayjs.dayjs(startDate);
|
|
52
|
+
const initialValue = getValidDate(defaultValue) ?? dayjs.dayjs();
|
|
53
|
+
const fallbackValue = initialValue.isBefore(minimumDate) ? minimumDate : initialValue.isAfter(endDate) ? dayjs.dayjs(endDate) : initialValue;
|
|
48
54
|
const [currentValue, setCurrentValue] = useUncontrolled.useUncontrolled({
|
|
49
|
-
value:
|
|
50
|
-
defaultValue:
|
|
55
|
+
value: getValidDate(value),
|
|
56
|
+
defaultValue: fallbackValue,
|
|
51
57
|
onChange: (v) => {
|
|
52
58
|
onChange == null ? void 0 : onChange(v.toDate());
|
|
53
59
|
}
|
|
@@ -22,6 +22,10 @@ import { DatePicker } from "../../node_modules/.pnpm/@mantine_dates@7.17.8_@mant
|
|
|
22
22
|
import { Divider } from "../../node_modules/.pnpm/@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/node_modules/@mantine/core/esm/components/Divider/Divider.mjs";
|
|
23
23
|
import { TimeInput } from "../../node_modules/.pnpm/@mantine_dates@7.17.8_@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hoo_itsuscsie4edrhi6ero4lpb3hq/node_modules/@mantine/dates/esm/components/TimeInput/TimeInput.mjs";
|
|
24
24
|
import { Flex } from "../../node_modules/.pnpm/@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/node_modules/@mantine/core/esm/components/Flex/Flex.mjs";
|
|
25
|
+
const getValidDate = (value) => {
|
|
26
|
+
const date = value ? dayjs(value) : void 0;
|
|
27
|
+
return (date == null ? void 0 : date.isValid()) ? date : void 0;
|
|
28
|
+
};
|
|
25
29
|
const DateTimePicker = ({
|
|
26
30
|
placeholder = "Select time",
|
|
27
31
|
format = DEFAULT_TIME_FORMAT,
|
|
@@ -43,9 +47,11 @@ const DateTimePicker = ({
|
|
|
43
47
|
const [opened, { close, open }] = useDisclosure(false);
|
|
44
48
|
const currentDay = dayjs(today).startOf("day");
|
|
45
49
|
const minimumDate = dayjs(startDate);
|
|
50
|
+
const initialValue = getValidDate(defaultValue) ?? dayjs();
|
|
51
|
+
const fallbackValue = initialValue.isBefore(minimumDate) ? minimumDate : initialValue.isAfter(endDate) ? dayjs(endDate) : initialValue;
|
|
46
52
|
const [currentValue, setCurrentValue] = useUncontrolled({
|
|
47
|
-
value:
|
|
48
|
-
defaultValue:
|
|
53
|
+
value: getValidDate(value),
|
|
54
|
+
defaultValue: fallbackValue,
|
|
49
55
|
onChange: (v) => {
|
|
50
56
|
onChange == null ? void 0 : onChange(v.toDate());
|
|
51
57
|
}
|
|
@@ -50,7 +50,14 @@ export interface DateTimePickerProps extends Omit<TextInputProps, 'value' | 'onC
|
|
|
50
50
|
* @deprecated
|
|
51
51
|
*/
|
|
52
52
|
utcOffset?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Initial date for an uncontrolled picker. Missing or invalid dates fall back
|
|
55
|
+
* to the current time within the selectable range.
|
|
56
|
+
*/
|
|
53
57
|
defaultValue?: Date;
|
|
58
|
+
/**
|
|
59
|
+
* Controlled date. Invalid dates are treated as missing values.
|
|
60
|
+
*/
|
|
54
61
|
value?: Date;
|
|
55
62
|
/**
|
|
56
63
|
* The current date used to highlight "today" in the calendar.
|
|
@@ -50,7 +50,14 @@ export interface DateTimePickerProps extends Omit<TextInputProps, 'value' | 'onC
|
|
|
50
50
|
* @deprecated
|
|
51
51
|
*/
|
|
52
52
|
utcOffset?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Initial date for an uncontrolled picker. Missing or invalid dates fall back
|
|
55
|
+
* to the current time within the selectable range.
|
|
56
|
+
*/
|
|
53
57
|
defaultValue?: Date;
|
|
58
|
+
/**
|
|
59
|
+
* Controlled date. Invalid dates are treated as missing values.
|
|
60
|
+
*/
|
|
54
61
|
value?: Date;
|
|
55
62
|
/**
|
|
56
63
|
* The current date used to highlight "today" in the calendar.
|
|
@@ -42,7 +42,20 @@ const FormErrorMessage = ({
|
|
|
42
42
|
},
|
|
43
43
|
...rest,
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
dangerouslySetInnerHTML: {
|
|
49
|
+
__html: DOMPurify.sanitize(message, {
|
|
50
|
+
ALLOWED_TAGS: ["a", "b", "br", "code", "em", "i", "li", "ol", "p", "span", "strong", "ul"],
|
|
51
|
+
ALLOWED_ATTR: ["href", "title"],
|
|
52
|
+
ALLOW_ARIA_ATTR: false,
|
|
53
|
+
ALLOW_DATA_ATTR: false,
|
|
54
|
+
ALLOWED_URI_REGEXP: /^(?:(?:https?|mailto):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
),
|
|
46
59
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: bottomRef })
|
|
47
60
|
]
|
|
48
61
|
}
|
|
@@ -40,7 +40,20 @@ const FormErrorMessage = ({
|
|
|
40
40
|
},
|
|
41
41
|
...rest,
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
dangerouslySetInnerHTML: {
|
|
47
|
+
__html: DOMPurify.sanitize(message, {
|
|
48
|
+
ALLOWED_TAGS: ["a", "b", "br", "code", "em", "i", "li", "ol", "p", "span", "strong", "ul"],
|
|
49
|
+
ALLOWED_ATTR: ["href", "title"],
|
|
50
|
+
ALLOW_ARIA_ATTR: false,
|
|
51
|
+
ALLOW_DATA_ATTR: false,
|
|
52
|
+
ALLOWED_URI_REGEXP: /^(?:(?:https?|mailto):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
),
|
|
44
57
|
/* @__PURE__ */ jsx("div", { ref: bottomRef })
|
|
45
58
|
]
|
|
46
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidbcloud/uikit",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.6",
|
|
4
4
|
"description": "tidbcloud uikit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/primitive/index.cjs",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"ahooks": "^3.7.8",
|
|
71
71
|
"clsx": "^2.1.1",
|
|
72
72
|
"dayjs": "^1.11.5",
|
|
73
|
-
"dompurify": "^3.
|
|
73
|
+
"dompurify": "^3.4.17",
|
|
74
74
|
"embla-carousel-react": "^7.0.5",
|
|
75
75
|
"google-libphonenumber": "^3.2.30",
|
|
76
76
|
"html-react-parser": "5.1.18",
|