@pnkx-lib/ui 1.9.383 → 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.
@@ -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
- //! Render
43
- return /* @__PURE__ */ jsxs("div", { className: customStyleContainer, children: [
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
  };
@@ -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 || {};
@@ -117,6 +119,32 @@ const Select = (props) => {
117
119
  /* @__PURE__ */ jsx("span", { className: "pnkx-not-found-text-select", children: "Không có dữ liệu" })
118
120
  ] });
119
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
+ };
120
148
  //! Render
121
149
  return /* @__PURE__ */ jsxs(
122
150
  "div",
@@ -131,30 +159,7 @@ const Select = (props) => {
131
159
  classNameLabel
132
160
  }
133
161
  ),
134
- /* @__PURE__ */ jsx(
135
- Select$1,
136
- {
137
- ref: selectRef,
138
- suffixIcon,
139
- onChange: handleChange,
140
- onBlur,
141
- value,
142
- optionFilterProp: "label",
143
- status: (isTouched || isSubmitted) && Boolean(errorMessage) ? "error" : void 0,
144
- placeholder,
145
- className: twMerge(
146
- "w-full",
147
- restProps?.disabled && "pnkx-disable-select",
148
- Boolean(errorMessage) && (isTouched || isSubmitted) && "pnkx-error-select",
149
- classNameSelect
150
- ),
151
- mode,
152
- maxTagCount,
153
- maxTagTextLength,
154
- notFoundContent: renderNotFoundContent(),
155
- ...restProps
156
- }
157
- ),
162
+ wrapWithTooltip(renderSelect(), contentTooltip),
158
163
  renderErrorMessage()
159
164
  ]
160
165
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.383",
4
+ "version": "1.9.384",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -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;