@true-engineering/true-react-common-ui-kit 4.0.0-alpha63 → 4.0.0-alpha65
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/components/FiltersPane/types.d.ts +1 -0
- package/dist/hooks/use-resize-ref.d.ts +2 -1
- package/dist/true-react-common-ui-kit.js +15 -17
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ControlWrapper/ControlWrapper.tsx +5 -9
- package/src/components/FiltersPane/FiltersPane.tsx +5 -1
- package/src/components/FiltersPane/types.ts +1 -0
- package/src/components/Input/InputBase.tsx +4 -8
- package/src/hooks/use-resize-ref.ts +11 -4
|
@@ -30,6 +30,7 @@ export type MultiSelectOptionType<Value> = Value | undefined extends IFilterMult
|
|
|
30
30
|
export interface IConfigItemBasicBase<Value> {
|
|
31
31
|
name: ReactNode;
|
|
32
32
|
isInline?: boolean;
|
|
33
|
+
isDisabled?: boolean;
|
|
33
34
|
isClearable?: boolean;
|
|
34
35
|
requiredFilledFilters?: string[];
|
|
35
36
|
localeKey?: IFilterLocaleKey;
|
|
@@ -2,6 +2,7 @@ import { RefCallback } from 'react';
|
|
|
2
2
|
export interface IResizeRefOptions {
|
|
3
3
|
/** @default false */
|
|
4
4
|
isDisabled?: boolean;
|
|
5
|
-
onChange
|
|
5
|
+
onChange?: (entry: ResizeObserverEntry) => void;
|
|
6
|
+
onTargetChange?: (target: Element) => void;
|
|
6
7
|
}
|
|
7
8
|
export declare const useResizeRef: (options: IResizeRefOptions) => RefCallback<Element>;
|
|
@@ -2717,13 +2717,18 @@ const useResizeRef = (options) => {
|
|
|
2717
2717
|
const observer = new ResizeObserver(([entry]) => {
|
|
2718
2718
|
const { current } = optionsRef;
|
|
2719
2719
|
if (!current.isDisabled) {
|
|
2720
|
-
current?.
|
|
2720
|
+
current.onChange?.(entry);
|
|
2721
|
+
current.onTargetChange?.(entry.target);
|
|
2721
2722
|
}
|
|
2722
2723
|
});
|
|
2723
2724
|
const observerRef = (node) => {
|
|
2724
2725
|
observer.disconnect();
|
|
2725
|
-
if (isNotEmpty(node)) {
|
|
2726
|
-
|
|
2726
|
+
if (!isNotEmpty(node)) {
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2729
|
+
observer.observe(node);
|
|
2730
|
+
if (!optionsRef.current.isDisabled) {
|
|
2731
|
+
optionsRef.current.onTargetChange?.(node);
|
|
2727
2732
|
}
|
|
2728
2733
|
};
|
|
2729
2734
|
return { ref: observerRef, disconnect: () => observer.disconnect() };
|
|
@@ -4148,13 +4153,9 @@ const ControlWrapper = ({
|
|
|
4148
4153
|
className: "tweakPreloader",
|
|
4149
4154
|
currentComponentName: "ControlWrapper"
|
|
4150
4155
|
});
|
|
4151
|
-
const startControlsRef =
|
|
4152
|
-
(
|
|
4153
|
-
|
|
4154
|
-
},
|
|
4155
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4156
|
-
[startIcon, size2]
|
|
4157
|
-
);
|
|
4156
|
+
const startControlsRef = useResizeRef({
|
|
4157
|
+
onTargetChange: (target) => setStartControlsWidth(target.clientWidth)
|
|
4158
|
+
});
|
|
4158
4159
|
const renderIconControl = ({ key, iconComponent, onClick, shouldResetSize = false }, iconType, index) => /* @__PURE__ */ jsx(
|
|
4159
4160
|
"div",
|
|
4160
4161
|
{
|
|
@@ -4376,12 +4377,9 @@ const InputBase = forwardRef(function InputBase2({
|
|
|
4376
4377
|
await onChange("", event, "clear");
|
|
4377
4378
|
inputRef.current?.focus();
|
|
4378
4379
|
};
|
|
4379
|
-
const unitsRef =
|
|
4380
|
-
(
|
|
4381
|
-
|
|
4382
|
-
},
|
|
4383
|
-
[units]
|
|
4384
|
-
);
|
|
4380
|
+
const unitsRef = useResizeRef({
|
|
4381
|
+
onTargetChange: (target) => setUnitsWidth(target.clientWidth)
|
|
4382
|
+
});
|
|
4385
4383
|
const props = {
|
|
4386
4384
|
className: clsx(classes.input, {
|
|
4387
4385
|
[classes.withUnits]: hasUnits,
|
|
@@ -8751,7 +8749,7 @@ function FiltersPane({
|
|
|
8751
8749
|
localeKey,
|
|
8752
8750
|
onChange: (value) => onChangeFilters({ ...values, [filterKey]: value }),
|
|
8753
8751
|
value: currentValue,
|
|
8754
|
-
isDisabled: isDisabled || filter2?.requiredFilledFilters?.some((item) => !values[item]),
|
|
8752
|
+
isDisabled: isDisabled || filter2?.isDisabled || filter2?.requiredFilledFilters?.some((item) => !values[item]),
|
|
8755
8753
|
tweakStyles: tweakFilterWrapperStyles,
|
|
8756
8754
|
data: shouldRenderDataId ? { id: filterKey } : void 0,
|
|
8757
8755
|
testId: getTestId(testId, `filter-${filterKey}`)
|