@pnkx-lib/ui 1.9.382 → 1.9.384
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/es/chunks/wapper-Bk3PQCcg.js +20 -0
- package/es/fields/DateRangePicker.js +16 -11
- package/es/fields/InputRangePicker.js +3 -1
- package/es/fields/Select.js +29 -25
- package/package.json +1 -1
- package/types/components/fields/DateRangePicker.d.ts +1 -0
- package/types/components/fields/InputRangePicker.d.ts +1 -0
- package/types/components/fields/Select.d.ts +1 -0
- package/types/helpers/wapper.d.ts +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Tooltip } from '../ui/Tooltip.js';
|
|
3
|
+
|
|
4
|
+
const wrapWithTooltip = (node, contentTooltip) => {
|
|
5
|
+
if (contentTooltip) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
Tooltip,
|
|
8
|
+
{
|
|
9
|
+
trigger: ["hover"],
|
|
10
|
+
title: contentTooltip,
|
|
11
|
+
placement: "topLeft",
|
|
12
|
+
classNames: { root: "numeric-input" },
|
|
13
|
+
children: node
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
return node;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { wrapWithTooltip as w };
|
|
@@ -4,6 +4,7 @@ import { g as get } from '../chunks/get-DPccfEM4.js';
|
|
|
4
4
|
import { ErrorMessage } from '../ui/ErrorMessage.js';
|
|
5
5
|
import { Label } from '../ui/Label.js';
|
|
6
6
|
import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
|
|
7
|
+
import { w as wrapWithTooltip } from '../chunks/wapper-Bk3PQCcg.js';
|
|
7
8
|
|
|
8
9
|
const { RangePicker: RangePickerPnkx } = DatePicker;
|
|
9
10
|
const RangePicker = (props) => {
|
|
@@ -17,6 +18,7 @@ const RangePicker = (props) => {
|
|
|
17
18
|
customStyleContainer,
|
|
18
19
|
customStyleDatePicker,
|
|
19
20
|
classNameLabel,
|
|
21
|
+
contentTooltip,
|
|
20
22
|
...restProps
|
|
21
23
|
} = props;
|
|
22
24
|
const { name, value, onChange, onBlur } = field || {};
|
|
@@ -39,17 +41,8 @@ const RangePicker = (props) => {
|
|
|
39
41
|
}
|
|
40
42
|
);
|
|
41
43
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
label && /* @__PURE__ */ jsx(
|
|
45
|
-
Label,
|
|
46
|
-
{
|
|
47
|
-
label,
|
|
48
|
-
required,
|
|
49
|
-
classNameLabel
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
44
|
+
const renderDateRangePicker = () => {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
53
46
|
RangePickerPnkx,
|
|
54
47
|
{
|
|
55
48
|
value,
|
|
@@ -62,7 +55,19 @@ const RangePicker = (props) => {
|
|
|
62
55
|
status: (isTouched || isSubmitted) && errorMessage ? "error" : void 0,
|
|
63
56
|
...restProps
|
|
64
57
|
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
//! Render
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", { className: customStyleContainer, children: [
|
|
62
|
+
label && /* @__PURE__ */ jsx(
|
|
63
|
+
Label,
|
|
64
|
+
{
|
|
65
|
+
label,
|
|
66
|
+
required,
|
|
67
|
+
classNameLabel
|
|
68
|
+
}
|
|
65
69
|
),
|
|
70
|
+
wrapWithTooltip(renderDateRangePicker(), contentTooltip),
|
|
66
71
|
renderErrorMessage()
|
|
67
72
|
] });
|
|
68
73
|
};
|
|
@@ -5,6 +5,7 @@ import { g as get } from '../chunks/get-DPccfEM4.js';
|
|
|
5
5
|
import { ErrorMessage } from '../ui/ErrorMessage.js';
|
|
6
6
|
import { Label } from '../ui/Label.js';
|
|
7
7
|
import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
|
|
8
|
+
import { w as wrapWithTooltip } from '../chunks/wapper-Bk3PQCcg.js';
|
|
8
9
|
|
|
9
10
|
const InputRangePicker = (props) => {
|
|
10
11
|
//! State
|
|
@@ -21,6 +22,7 @@ const InputRangePicker = (props) => {
|
|
|
21
22
|
thousandSeparator = true,
|
|
22
23
|
placeholderFrom = "Từ",
|
|
23
24
|
placeholderTo = "Đến",
|
|
25
|
+
contentTooltip,
|
|
24
26
|
...restProps
|
|
25
27
|
} = props;
|
|
26
28
|
const { name, value, onChange, onBlur } = field || {};
|
|
@@ -155,7 +157,7 @@ const InputRangePicker = (props) => {
|
|
|
155
157
|
};
|
|
156
158
|
return /* @__PURE__ */ jsxs("div", { className: twMerge("w-full", classNameContainer), children: [
|
|
157
159
|
renderLabel(),
|
|
158
|
-
renderInput(),
|
|
160
|
+
wrapWithTooltip(renderInput(), contentTooltip),
|
|
159
161
|
renderErrorMessage()
|
|
160
162
|
] });
|
|
161
163
|
};
|
package/es/fields/Select.js
CHANGED
|
@@ -7,6 +7,7 @@ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
|
|
|
7
7
|
import { R as RefIcon } from '../chunks/CloseOutlined-D9hb-IcI.js';
|
|
8
8
|
import { R as RefIcon$1 } from '../chunks/DownOutlined-CkHKgaSi.js';
|
|
9
9
|
import { useRef } from 'react';
|
|
10
|
+
import { w as wrapWithTooltip } from '../chunks/wapper-Bk3PQCcg.js';
|
|
10
11
|
import { M as MAX_TAG_TEXT_LENGTH, a as MAX_TAG_COUNT } from '../chunks/common-BcURBmQ-.js';
|
|
11
12
|
|
|
12
13
|
const SelectClearIcon = ({
|
|
@@ -73,6 +74,7 @@ const Select = (props) => {
|
|
|
73
74
|
allowClear,
|
|
74
75
|
onClear,
|
|
75
76
|
classNameLabel,
|
|
77
|
+
contentTooltip,
|
|
76
78
|
...restProps
|
|
77
79
|
} = props;
|
|
78
80
|
const { name, value, onChange, onBlur } = field || {};
|
|
@@ -104,7 +106,6 @@ const Select = (props) => {
|
|
|
104
106
|
afterOnChange?.(null);
|
|
105
107
|
onClear?.();
|
|
106
108
|
};
|
|
107
|
-
console.log("value", value);
|
|
108
109
|
const suffixIcon = allowClear ? /* @__PURE__ */ jsx(
|
|
109
110
|
SelectClearIcon,
|
|
110
111
|
{
|
|
@@ -118,6 +119,32 @@ const Select = (props) => {
|
|
|
118
119
|
/* @__PURE__ */ jsx("span", { className: "pnkx-not-found-text-select", children: "Không có dữ liệu" })
|
|
119
120
|
] });
|
|
120
121
|
};
|
|
122
|
+
const renderSelect = () => {
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
Select$1,
|
|
125
|
+
{
|
|
126
|
+
ref: selectRef,
|
|
127
|
+
suffixIcon,
|
|
128
|
+
onChange: handleChange,
|
|
129
|
+
onBlur,
|
|
130
|
+
value,
|
|
131
|
+
optionFilterProp: "label",
|
|
132
|
+
status: (isTouched || isSubmitted) && Boolean(errorMessage) ? "error" : void 0,
|
|
133
|
+
placeholder,
|
|
134
|
+
className: twMerge(
|
|
135
|
+
"w-full",
|
|
136
|
+
restProps?.disabled && "pnkx-disable-select",
|
|
137
|
+
Boolean(errorMessage) && (isTouched || isSubmitted) && "pnkx-error-select",
|
|
138
|
+
classNameSelect
|
|
139
|
+
),
|
|
140
|
+
mode,
|
|
141
|
+
maxTagCount,
|
|
142
|
+
maxTagTextLength,
|
|
143
|
+
notFoundContent: renderNotFoundContent(),
|
|
144
|
+
...restProps
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
};
|
|
121
148
|
//! Render
|
|
122
149
|
return /* @__PURE__ */ jsxs(
|
|
123
150
|
"div",
|
|
@@ -132,30 +159,7 @@ const Select = (props) => {
|
|
|
132
159
|
classNameLabel
|
|
133
160
|
}
|
|
134
161
|
),
|
|
135
|
-
|
|
136
|
-
Select$1,
|
|
137
|
-
{
|
|
138
|
-
ref: selectRef,
|
|
139
|
-
suffixIcon,
|
|
140
|
-
onChange: handleChange,
|
|
141
|
-
onBlur,
|
|
142
|
-
value,
|
|
143
|
-
optionFilterProp: "label",
|
|
144
|
-
status: (isTouched || isSubmitted) && Boolean(errorMessage) ? "error" : void 0,
|
|
145
|
-
placeholder,
|
|
146
|
-
className: twMerge(
|
|
147
|
-
"w-full",
|
|
148
|
-
restProps?.disabled && "pnkx-disable-select",
|
|
149
|
-
Boolean(errorMessage) && (isTouched || isSubmitted) && "pnkx-error-select",
|
|
150
|
-
classNameSelect
|
|
151
|
-
),
|
|
152
|
-
mode,
|
|
153
|
-
maxTagCount,
|
|
154
|
-
maxTagTextLength,
|
|
155
|
-
notFoundContent: renderNotFoundContent(),
|
|
156
|
-
...restProps
|
|
157
|
-
}
|
|
158
|
-
),
|
|
162
|
+
wrapWithTooltip(renderSelect(), contentTooltip),
|
|
159
163
|
renderErrorMessage()
|
|
160
164
|
]
|
|
161
165
|
}
|
package/package.json
CHANGED
|
@@ -10,5 +10,6 @@ export interface RangePickerFieldProps extends Omit<RangePickerProps, "value" |
|
|
|
10
10
|
customStyleContainer?: string;
|
|
11
11
|
customStyleDatePicker?: string;
|
|
12
12
|
classNameLabel?: string;
|
|
13
|
+
contentTooltip?: string;
|
|
13
14
|
}
|
|
14
15
|
export declare const RangePicker: (props: RangePickerFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,5 +13,6 @@ export interface InputRangePickerProps extends Omit<InputNumberProps, "value" |
|
|
|
13
13
|
thousandSeparator?: boolean;
|
|
14
14
|
placeholderFrom?: string;
|
|
15
15
|
placeholderTo?: string;
|
|
16
|
+
contentTooltip?: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const InputRangePicker: (props: InputRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,5 +13,6 @@ export interface SelectFieldProps extends SelectProps {
|
|
|
13
13
|
maxTagCount?: number | "responsive";
|
|
14
14
|
onClear?: () => void;
|
|
15
15
|
classNameLabel?: string;
|
|
16
|
+
contentTooltip?: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const Select: (props: SelectFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const wrapWithTooltip: (node: React.ReactNode, contentTooltip?: string) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null | undefined;
|