@farmzone/fz-react-ui 1.0.11 → 1.0.13
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.cjs +29 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tw.css +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ var buttonVariants = cva(
|
|
|
48
48
|
carousel: "bg-white border border-gray-300 hover:bg-gray-100 hover:text-black rounded-full",
|
|
49
49
|
accent: "btn-grad text-white rounded-full",
|
|
50
50
|
metal: "btn-metal text-white min-w-22",
|
|
51
|
-
ghost: "p-1 h-auto rounded-sm bg-transparent
|
|
51
|
+
ghost: "p-1 h-auto rounded-sm bg-transparent text-sub-darkgray transition-colors hover:bg-gray-100",
|
|
52
52
|
link: "bg-transparent border-none text-main-blue underline-offset-4 hover:underline h-auto p-0"
|
|
53
53
|
},
|
|
54
54
|
size: {
|
|
@@ -4707,15 +4707,26 @@ function Table(props) {
|
|
|
4707
4707
|
if (!isDynamicHeight) return;
|
|
4708
4708
|
const el = scrollRef.current;
|
|
4709
4709
|
if (!el) return;
|
|
4710
|
+
const pageContainer = el.parentElement?.parentElement;
|
|
4711
|
+
const isContainerConstrained = (container2) => {
|
|
4712
|
+
if (!container2) return false;
|
|
4713
|
+
const style = window.getComputedStyle(container2);
|
|
4714
|
+
return style.overflow === "hidden" || style.overflowY === "hidden";
|
|
4715
|
+
};
|
|
4716
|
+
const getContainerBottom = () => {
|
|
4717
|
+
if (isContainerConstrained(pageContainer)) {
|
|
4718
|
+
return Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight);
|
|
4719
|
+
}
|
|
4720
|
+
return window.innerHeight;
|
|
4721
|
+
};
|
|
4710
4722
|
const update = () => {
|
|
4711
4723
|
const top = el.getBoundingClientRect().top;
|
|
4712
4724
|
const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
|
|
4713
|
-
setTableHeight(
|
|
4725
|
+
setTableHeight(getContainerBottom() - top - footerH - 24);
|
|
4714
4726
|
};
|
|
4715
4727
|
update();
|
|
4716
4728
|
window.addEventListener("resize", update);
|
|
4717
4729
|
const observer = new ResizeObserver(update);
|
|
4718
|
-
const pageContainer = el.parentElement?.parentElement;
|
|
4719
4730
|
if (pageContainer) observer.observe(pageContainer);
|
|
4720
4731
|
const footer = footerRef.current;
|
|
4721
4732
|
if (footer) observer.observe(footer);
|
|
@@ -4728,9 +4739,15 @@ function Table(props) {
|
|
|
4728
4739
|
if (!isDynamicHeight) return;
|
|
4729
4740
|
const el = scrollRef.current;
|
|
4730
4741
|
if (!el) return;
|
|
4742
|
+
const pageContainer = el.parentElement?.parentElement;
|
|
4731
4743
|
const top = el.getBoundingClientRect().top;
|
|
4732
4744
|
const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
|
|
4733
|
-
|
|
4745
|
+
const isContainerConstrained = !!pageContainer && (() => {
|
|
4746
|
+
const style = window.getComputedStyle(pageContainer);
|
|
4747
|
+
return style.overflow === "hidden" || style.overflowY === "hidden";
|
|
4748
|
+
})();
|
|
4749
|
+
const containerBottom = isContainerConstrained ? Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight) : window.innerHeight;
|
|
4750
|
+
setTableHeight(containerBottom - top - footerH - 24);
|
|
4734
4751
|
}, [showSkeleton, showEmpty]);
|
|
4735
4752
|
const selectedKeysRef = useRef(selectedKeys);
|
|
4736
4753
|
selectedKeysRef.current = selectedKeys;
|
|
@@ -7204,9 +7221,13 @@ function SelectWithInputField(props) {
|
|
|
7204
7221
|
}, [defaultPrefix, formValue, options]);
|
|
7205
7222
|
const [selectedPrefix, setSelectedPrefix] = useState(prefix);
|
|
7206
7223
|
const [prevFormValue, setPrevFormValue] = useState(formValue);
|
|
7224
|
+
const isUserInputChangeRef = useRef(false);
|
|
7207
7225
|
if (prevFormValue !== formValue) {
|
|
7208
7226
|
setPrevFormValue(formValue);
|
|
7209
|
-
|
|
7227
|
+
if (!isUserInputChangeRef.current) {
|
|
7228
|
+
setSelectedPrefix(formValue ? prefix : defaultPrefix);
|
|
7229
|
+
}
|
|
7230
|
+
isUserInputChangeRef.current = false;
|
|
7210
7231
|
}
|
|
7211
7232
|
useLayoutEffect(() => {
|
|
7212
7233
|
if (readOnly) return;
|
|
@@ -7215,9 +7236,7 @@ function SelectWithInputField(props) {
|
|
|
7215
7236
|
}
|
|
7216
7237
|
}, [formValue, normalizedFormValue, onChange, readOnly]);
|
|
7217
7238
|
if (readOnly) {
|
|
7218
|
-
|
|
7219
|
-
const displayText = inputPart ? `${prefixLabel} ${inputPart}` : prefix ? prefixLabel : "\u2014";
|
|
7220
|
-
return /* @__PURE__ */ jsx("div", { className: fieldControlWrapClass(className), children: /* @__PURE__ */ jsx("span", { className: FIELD_READONLY_TEXT_CLASS, children: displayText || "\u2014" }) });
|
|
7239
|
+
return /* @__PURE__ */ jsx("div", { className: fieldControlWrapClass(className), children: /* @__PURE__ */ jsx("span", { className: FIELD_READONLY_TEXT_CLASS, children: formValue }) });
|
|
7221
7240
|
}
|
|
7222
7241
|
const updateCombined = (nextPrefix, nextInput) => {
|
|
7223
7242
|
onChange(combineSelectWithInputValue(nextPrefix, nextInput));
|
|
@@ -7231,6 +7250,7 @@ function SelectWithInputField(props) {
|
|
|
7231
7250
|
if (normalized) {
|
|
7232
7251
|
validationCtx?.markFieldHadValue(String(config.name));
|
|
7233
7252
|
}
|
|
7253
|
+
isUserInputChangeRef.current = true;
|
|
7234
7254
|
updateCombined(selectedPrefix, normalized);
|
|
7235
7255
|
};
|
|
7236
7256
|
const selectClass = resolveSelectClassNameProp(selectWithInputClassNames?.selectClassName, {
|
|
@@ -7269,6 +7289,7 @@ function SelectWithInputField(props) {
|
|
|
7269
7289
|
},
|
|
7270
7290
|
onBlur: (e) => {
|
|
7271
7291
|
const normalized = normalizeInput(e.target.value.normalize("NFKC"));
|
|
7292
|
+
isUserInputChangeRef.current = true;
|
|
7272
7293
|
updateCombined(selectedPrefix, normalized);
|
|
7273
7294
|
onBlur();
|
|
7274
7295
|
}
|