@xaypay/tui 0.2.21 → 0.2.23
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/index.es.js +26 -13
- package/dist/index.js +26 -13
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1837,9 +1837,11 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
1837
1837
|
}, ref) => {
|
|
1838
1838
|
const inpRef = useRef(null);
|
|
1839
1839
|
const labelRef = useRef(null);
|
|
1840
|
+
const parentlRef = useRef(null);
|
|
1840
1841
|
const memoizedItems = useMemo(() => filesArray, [filesArray]);
|
|
1841
1842
|
const [error, setError] = useState('');
|
|
1842
1843
|
const [isHover, setIsHover] = useState(false);
|
|
1844
|
+
const [removeID, setRemoveID] = useState('');
|
|
1843
1845
|
const [classProps, setClassProps] = useState({});
|
|
1844
1846
|
const [singleFile, setSingleFile] = useState(null);
|
|
1845
1847
|
const [configStyles, setConfigStyles] = useState({});
|
|
@@ -2074,14 +2076,10 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
2074
2076
|
}
|
|
2075
2077
|
};
|
|
2076
2078
|
const handleClick = () => {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2079
|
+
if (!image && !singleFile) {
|
|
2080
|
+
inpRef.current.files = null;
|
|
2081
|
+
inpRef.current.value = null;
|
|
2080
2082
|
inpRef.current.click();
|
|
2081
|
-
} else {
|
|
2082
|
-
if (!image) {
|
|
2083
|
-
inpRef.current.click();
|
|
2084
|
-
}
|
|
2085
2083
|
}
|
|
2086
2084
|
};
|
|
2087
2085
|
const handleDrop = e => {
|
|
@@ -2117,18 +2115,21 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
2117
2115
|
return width;
|
|
2118
2116
|
};
|
|
2119
2117
|
const handleLabelMouseEnter = event => {
|
|
2118
|
+
event.preventDefault();
|
|
2119
|
+
setRemoveID(() => v4());
|
|
2120
2120
|
if (labelRef.current) {
|
|
2121
|
+
const parentElem = parentlRef.current.getBoundingClientRect();
|
|
2121
2122
|
const rect = labelRef.current.getBoundingClientRect();
|
|
2122
2123
|
const top = rect.top;
|
|
2123
2124
|
const left = rect.left;
|
|
2124
2125
|
const height = rect.height;
|
|
2125
2126
|
const elementWidth = rect.width;
|
|
2126
2127
|
const x = event.clientX - rect.left;
|
|
2128
|
+
const parentWidth = parentElem.width;
|
|
2127
2129
|
const textWidth = getRenderedTextWidth(labelRef.current);
|
|
2128
|
-
|
|
2129
|
-
console.log(elementWidth, ' - - - - elementWidth');
|
|
2130
|
-
if (textWidth > elementWidth) {
|
|
2130
|
+
if (textWidth > Math.ceil(elementWidth)) {
|
|
2131
2131
|
const newTooltipElem = document.createElement('div');
|
|
2132
|
+
newTooltipElem.id = `fake_id_for_remove_dom${removeID}`;
|
|
2132
2133
|
const newTootltipTextElem = document.createElement('p');
|
|
2133
2134
|
const newTooltipChildElem = document.createElement('div');
|
|
2134
2135
|
const newTooltipDecorElem = document.createElement('div');
|
|
@@ -2138,7 +2139,7 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
2138
2139
|
newTooltipElem.style.height = 'fit-content';
|
|
2139
2140
|
newTooltipElem.style.boxSizing = 'border-box';
|
|
2140
2141
|
newTooltipElem.style.top = top + height + 'px';
|
|
2141
|
-
newTooltipElem.style.width =
|
|
2142
|
+
newTooltipElem.style.width = parentWidth + 'px';
|
|
2142
2143
|
newTooltipChildElem.style.width = '100%';
|
|
2143
2144
|
newTooltipChildElem.style.position = 'relative';
|
|
2144
2145
|
newTooltipChildElem.style.height = 'fit-content';
|
|
@@ -2152,7 +2153,7 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
2152
2153
|
newTooltipDecorElem.style.height = '18px';
|
|
2153
2154
|
newTooltipDecorElem.style.rotate = '45deg';
|
|
2154
2155
|
newTooltipDecorElem.style.position = 'absolute';
|
|
2155
|
-
newTooltipDecorElem.style.left = x > elementWidth / 2 ? 'calc(100% -
|
|
2156
|
+
newTooltipDecorElem.style.left = x > elementWidth / 2 ? 'calc(100% - 40px)' : '23px';
|
|
2156
2157
|
newTooltipDecorElem.style.backgroundColor = labelTooltipBackgroundColor ?? configStyles.FILE.label.tooltip.backgroundColor;
|
|
2157
2158
|
newTootltipTextElem.innerText = label;
|
|
2158
2159
|
newTootltipTextElem.style.color = labelTooltipColor ?? configStyles.FILE.label.tooltip.color;
|
|
@@ -2169,9 +2170,14 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
2169
2170
|
}
|
|
2170
2171
|
};
|
|
2171
2172
|
const handleLabelMouseLeave = () => {
|
|
2173
|
+
const removableElem = document.getElementById(`fake_id_for_remove_dom${removeID}`);
|
|
2174
|
+
if (removableElem) {
|
|
2175
|
+
document.body.removeChild(removableElem);
|
|
2176
|
+
}
|
|
2172
2177
|
if (tooltipElem) {
|
|
2173
2178
|
document.body.removeChild(tooltipElem);
|
|
2174
2179
|
}
|
|
2180
|
+
setRemoveID(() => '');
|
|
2175
2181
|
};
|
|
2176
2182
|
useImperativeHandle(ref, () => ({
|
|
2177
2183
|
handleReset() {
|
|
@@ -2246,6 +2252,7 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
2246
2252
|
};
|
|
2247
2253
|
}, []);
|
|
2248
2254
|
return configStyles.FILE && /*#__PURE__*/React__default.createElement("div", {
|
|
2255
|
+
ref: parentlRef,
|
|
2249
2256
|
style: {
|
|
2250
2257
|
width: '100%',
|
|
2251
2258
|
maxWidth: maxWidth ?? configStyles.FILE.maxWidth
|
|
@@ -5856,11 +5863,13 @@ const Select = ({
|
|
|
5856
5863
|
labelMarginBottom,
|
|
5857
5864
|
labelTextTransform,
|
|
5858
5865
|
cursor,
|
|
5866
|
+
errorIcon,
|
|
5859
5867
|
errorSize,
|
|
5860
5868
|
errorColor,
|
|
5861
5869
|
errorStyle,
|
|
5862
5870
|
errorFamily,
|
|
5863
5871
|
errorWeight,
|
|
5872
|
+
showErrorIcon,
|
|
5864
5873
|
selectedColor,
|
|
5865
5874
|
selectedRadius,
|
|
5866
5875
|
selectedPadding,
|
|
@@ -6136,15 +6145,17 @@ const Select = ({
|
|
|
6136
6145
|
}))) : null)), errorMessage ? /*#__PURE__*/React__default.createElement("span", {
|
|
6137
6146
|
style: {
|
|
6138
6147
|
position: 'absolute',
|
|
6148
|
+
columnGap: '4px',
|
|
6139
6149
|
color: errorColor ?? configStyles.SELECT.error.color,
|
|
6140
6150
|
fontSize: errorSize ?? configStyles.SELECT.error.font.size,
|
|
6141
6151
|
fontStyle: errorStyle ?? configStyles.SELECT.error.font.style,
|
|
6152
|
+
display: errorIcon && showErrorIcon ? 'inline-flex' : 'inline',
|
|
6142
6153
|
fontFamily: errorFamily ?? configStyles.SELECT.error.font.family,
|
|
6143
6154
|
fontWeight: errorWeight ?? configStyles.SELECT.error.font.weight,
|
|
6144
6155
|
zIndex: errorZindex ?? configStyles.SELECT.error.zIndex,
|
|
6145
6156
|
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.SELECT.error.marginTop})`
|
|
6146
6157
|
}
|
|
6147
|
-
}, errorMessage) : '');
|
|
6158
|
+
}, showErrorIcon ? errorIcon ? errorIcon : configStyles.SELECT.error?.icon ? configStyles.SELECT.error?.icon : '' : '', errorMessage) : '');
|
|
6148
6159
|
};
|
|
6149
6160
|
Select.propTypes = {
|
|
6150
6161
|
dots: PropTypes.bool,
|
|
@@ -6179,6 +6190,8 @@ Select.propTypes = {
|
|
|
6179
6190
|
cursor: PropTypes.string,
|
|
6180
6191
|
errorSize: PropTypes.string,
|
|
6181
6192
|
errorColor: PropTypes.string,
|
|
6193
|
+
errorIcon: PropTypes.element,
|
|
6194
|
+
showErrorIcon: PropTypes.bool,
|
|
6182
6195
|
selectedColor: PropTypes.string,
|
|
6183
6196
|
selectedRadius: PropTypes.string,
|
|
6184
6197
|
selectedMinHeight: PropTypes.string,
|
package/dist/index.js
CHANGED
|
@@ -1868,9 +1868,11 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
1868
1868
|
}, ref) => {
|
|
1869
1869
|
const inpRef = React.useRef(null);
|
|
1870
1870
|
const labelRef = React.useRef(null);
|
|
1871
|
+
const parentlRef = React.useRef(null);
|
|
1871
1872
|
const memoizedItems = React.useMemo(() => filesArray, [filesArray]);
|
|
1872
1873
|
const [error, setError] = React.useState('');
|
|
1873
1874
|
const [isHover, setIsHover] = React.useState(false);
|
|
1875
|
+
const [removeID, setRemoveID] = React.useState('');
|
|
1874
1876
|
const [classProps, setClassProps] = React.useState({});
|
|
1875
1877
|
const [singleFile, setSingleFile] = React.useState(null);
|
|
1876
1878
|
const [configStyles, setConfigStyles] = React.useState({});
|
|
@@ -2105,14 +2107,10 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
2105
2107
|
}
|
|
2106
2108
|
};
|
|
2107
2109
|
const handleClick = () => {
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2110
|
+
if (!image && !singleFile) {
|
|
2111
|
+
inpRef.current.files = null;
|
|
2112
|
+
inpRef.current.value = null;
|
|
2111
2113
|
inpRef.current.click();
|
|
2112
|
-
} else {
|
|
2113
|
-
if (!image) {
|
|
2114
|
-
inpRef.current.click();
|
|
2115
|
-
}
|
|
2116
2114
|
}
|
|
2117
2115
|
};
|
|
2118
2116
|
const handleDrop = e => {
|
|
@@ -2148,18 +2146,21 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
2148
2146
|
return width;
|
|
2149
2147
|
};
|
|
2150
2148
|
const handleLabelMouseEnter = event => {
|
|
2149
|
+
event.preventDefault();
|
|
2150
|
+
setRemoveID(() => v4());
|
|
2151
2151
|
if (labelRef.current) {
|
|
2152
|
+
const parentElem = parentlRef.current.getBoundingClientRect();
|
|
2152
2153
|
const rect = labelRef.current.getBoundingClientRect();
|
|
2153
2154
|
const top = rect.top;
|
|
2154
2155
|
const left = rect.left;
|
|
2155
2156
|
const height = rect.height;
|
|
2156
2157
|
const elementWidth = rect.width;
|
|
2157
2158
|
const x = event.clientX - rect.left;
|
|
2159
|
+
const parentWidth = parentElem.width;
|
|
2158
2160
|
const textWidth = getRenderedTextWidth(labelRef.current);
|
|
2159
|
-
|
|
2160
|
-
console.log(elementWidth, ' - - - - elementWidth');
|
|
2161
|
-
if (textWidth > elementWidth) {
|
|
2161
|
+
if (textWidth > Math.ceil(elementWidth)) {
|
|
2162
2162
|
const newTooltipElem = document.createElement('div');
|
|
2163
|
+
newTooltipElem.id = `fake_id_for_remove_dom${removeID}`;
|
|
2163
2164
|
const newTootltipTextElem = document.createElement('p');
|
|
2164
2165
|
const newTooltipChildElem = document.createElement('div');
|
|
2165
2166
|
const newTooltipDecorElem = document.createElement('div');
|
|
@@ -2169,7 +2170,7 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
2169
2170
|
newTooltipElem.style.height = 'fit-content';
|
|
2170
2171
|
newTooltipElem.style.boxSizing = 'border-box';
|
|
2171
2172
|
newTooltipElem.style.top = top + height + 'px';
|
|
2172
|
-
newTooltipElem.style.width =
|
|
2173
|
+
newTooltipElem.style.width = parentWidth + 'px';
|
|
2173
2174
|
newTooltipChildElem.style.width = '100%';
|
|
2174
2175
|
newTooltipChildElem.style.position = 'relative';
|
|
2175
2176
|
newTooltipChildElem.style.height = 'fit-content';
|
|
@@ -2183,7 +2184,7 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
2183
2184
|
newTooltipDecorElem.style.height = '18px';
|
|
2184
2185
|
newTooltipDecorElem.style.rotate = '45deg';
|
|
2185
2186
|
newTooltipDecorElem.style.position = 'absolute';
|
|
2186
|
-
newTooltipDecorElem.style.left = x > elementWidth / 2 ? 'calc(100% -
|
|
2187
|
+
newTooltipDecorElem.style.left = x > elementWidth / 2 ? 'calc(100% - 40px)' : '23px';
|
|
2187
2188
|
newTooltipDecorElem.style.backgroundColor = labelTooltipBackgroundColor ?? configStyles.FILE.label.tooltip.backgroundColor;
|
|
2188
2189
|
newTootltipTextElem.innerText = label;
|
|
2189
2190
|
newTootltipTextElem.style.color = labelTooltipColor ?? configStyles.FILE.label.tooltip.color;
|
|
@@ -2200,9 +2201,14 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
2200
2201
|
}
|
|
2201
2202
|
};
|
|
2202
2203
|
const handleLabelMouseLeave = () => {
|
|
2204
|
+
const removableElem = document.getElementById(`fake_id_for_remove_dom${removeID}`);
|
|
2205
|
+
if (removableElem) {
|
|
2206
|
+
document.body.removeChild(removableElem);
|
|
2207
|
+
}
|
|
2203
2208
|
if (tooltipElem) {
|
|
2204
2209
|
document.body.removeChild(tooltipElem);
|
|
2205
2210
|
}
|
|
2211
|
+
setRemoveID(() => '');
|
|
2206
2212
|
};
|
|
2207
2213
|
React.useImperativeHandle(ref, () => ({
|
|
2208
2214
|
handleReset() {
|
|
@@ -2277,6 +2283,7 @@ const File = /*#__PURE__*/React.forwardRef(({
|
|
|
2277
2283
|
};
|
|
2278
2284
|
}, []);
|
|
2279
2285
|
return configStyles.FILE && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2286
|
+
ref: parentlRef,
|
|
2280
2287
|
style: {
|
|
2281
2288
|
width: '100%',
|
|
2282
2289
|
maxWidth: maxWidth ?? configStyles.FILE.maxWidth
|
|
@@ -5887,11 +5894,13 @@ const Select = ({
|
|
|
5887
5894
|
labelMarginBottom,
|
|
5888
5895
|
labelTextTransform,
|
|
5889
5896
|
cursor,
|
|
5897
|
+
errorIcon,
|
|
5890
5898
|
errorSize,
|
|
5891
5899
|
errorColor,
|
|
5892
5900
|
errorStyle,
|
|
5893
5901
|
errorFamily,
|
|
5894
5902
|
errorWeight,
|
|
5903
|
+
showErrorIcon,
|
|
5895
5904
|
selectedColor,
|
|
5896
5905
|
selectedRadius,
|
|
5897
5906
|
selectedPadding,
|
|
@@ -6167,15 +6176,17 @@ const Select = ({
|
|
|
6167
6176
|
}))) : null)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6168
6177
|
style: {
|
|
6169
6178
|
position: 'absolute',
|
|
6179
|
+
columnGap: '4px',
|
|
6170
6180
|
color: errorColor ?? configStyles.SELECT.error.color,
|
|
6171
6181
|
fontSize: errorSize ?? configStyles.SELECT.error.font.size,
|
|
6172
6182
|
fontStyle: errorStyle ?? configStyles.SELECT.error.font.style,
|
|
6183
|
+
display: errorIcon && showErrorIcon ? 'inline-flex' : 'inline',
|
|
6173
6184
|
fontFamily: errorFamily ?? configStyles.SELECT.error.font.family,
|
|
6174
6185
|
fontWeight: errorWeight ?? configStyles.SELECT.error.font.weight,
|
|
6175
6186
|
zIndex: errorZindex ?? configStyles.SELECT.error.zIndex,
|
|
6176
6187
|
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.SELECT.error.marginTop})`
|
|
6177
6188
|
}
|
|
6178
|
-
}, errorMessage) : '');
|
|
6189
|
+
}, showErrorIcon ? errorIcon ? errorIcon : configStyles.SELECT.error?.icon ? configStyles.SELECT.error?.icon : '' : '', errorMessage) : '');
|
|
6179
6190
|
};
|
|
6180
6191
|
Select.propTypes = {
|
|
6181
6192
|
dots: PropTypes__default["default"].bool,
|
|
@@ -6210,6 +6221,8 @@ Select.propTypes = {
|
|
|
6210
6221
|
cursor: PropTypes__default["default"].string,
|
|
6211
6222
|
errorSize: PropTypes__default["default"].string,
|
|
6212
6223
|
errorColor: PropTypes__default["default"].string,
|
|
6224
|
+
errorIcon: PropTypes__default["default"].element,
|
|
6225
|
+
showErrorIcon: PropTypes__default["default"].bool,
|
|
6213
6226
|
selectedColor: PropTypes__default["default"].string,
|
|
6214
6227
|
selectedRadius: PropTypes__default["default"].string,
|
|
6215
6228
|
selectedMinHeight: PropTypes__default["default"].string,
|