@true-engineering/true-react-common-ui-kit 4.0.0-alpha28 → 4.0.0-alpha29
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/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +13 -8
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +13 -8
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +5 -0
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.tsx +4 -1
- package/src/components/WithPopup/WithPopup.tsx +7 -6
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
addDataAttributes,
|
|
5
5
|
addDataTestId,
|
|
6
6
|
getTestId,
|
|
7
|
+
isArrayLikeNotEmpty,
|
|
8
|
+
isArrayNotEmpty,
|
|
7
9
|
isNotEmpty,
|
|
8
10
|
} from '@true-engineering/true-react-platform-helpers';
|
|
9
11
|
import { useOnClickOutside, useTweakStyles } from '../../../../hooks';
|
|
@@ -99,6 +101,7 @@ export function FiltersPaneSearch<Value>({
|
|
|
99
101
|
className={clsx(classes.root, {
|
|
100
102
|
[classes.focused]: isInputFocused,
|
|
101
103
|
[classes.disabled]: isDisabled,
|
|
104
|
+
[classes.hasValue]: isArrayLikeNotEmpty(value),
|
|
102
105
|
})}
|
|
103
106
|
ref={refRoot}
|
|
104
107
|
{...addDataAttributes(data, testId)}
|
|
@@ -117,7 +120,7 @@ export function FiltersPaneSearch<Value>({
|
|
|
117
120
|
|
|
118
121
|
<div className={classes.selectWrapper}>
|
|
119
122
|
{/* Select block */}
|
|
120
|
-
{fields
|
|
123
|
+
{isArrayNotEmpty(fields) && (
|
|
121
124
|
<div
|
|
122
125
|
className={classes.selectBlock}
|
|
123
126
|
onClick={!isDisabled ? () => setIsOpen(!isOpen) : undefined}
|
|
@@ -116,13 +116,14 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
116
116
|
const classes = useStyles({ theme: tweakStyles });
|
|
117
117
|
|
|
118
118
|
const [isOpen, setIsOpen] = useState(false);
|
|
119
|
+
const isActive = isOpen && !isDisabled;
|
|
119
120
|
|
|
120
121
|
const arrowRef = useRef<SVGSVGElement>(null);
|
|
121
122
|
|
|
122
|
-
const handleToggle = (
|
|
123
|
+
const handleToggle = (next: boolean, event?: IWithPopupToggleEvent) => {
|
|
123
124
|
event?.stopPropagation();
|
|
124
|
-
onToggle?.(
|
|
125
|
-
setIsOpen(
|
|
125
|
+
onToggle?.(next, event);
|
|
126
|
+
setIsOpen(next);
|
|
126
127
|
};
|
|
127
128
|
|
|
128
129
|
const handleClose = (event?: IWithPopupToggleEvent) => {
|
|
@@ -130,7 +131,7 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
130
131
|
};
|
|
131
132
|
|
|
132
133
|
const { refs, floatingStyles, context } = useFloating({
|
|
133
|
-
open:
|
|
134
|
+
open: isActive,
|
|
134
135
|
middleware: [
|
|
135
136
|
offset(popupOffset),
|
|
136
137
|
canBeFlipped && flip({ fallbackAxisSideDirection: 'start' }),
|
|
@@ -177,7 +178,7 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
177
178
|
const triggerElement = applyAction(trigger, {
|
|
178
179
|
referenceProps: !isTriggerWrapped ? referenceProps : undefined,
|
|
179
180
|
triggerProps: {
|
|
180
|
-
isActive
|
|
181
|
+
isActive,
|
|
181
182
|
isDisabled,
|
|
182
183
|
...(!isTriggerWrapped && { data, testId, ...referenceProps }),
|
|
183
184
|
},
|
|
@@ -190,7 +191,7 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
190
191
|
className={clsx(classes.trigger, {
|
|
191
192
|
[classes.clickable]: eventType === 'click',
|
|
192
193
|
[classes.disabled]: isDisabled,
|
|
193
|
-
[classes.active]:
|
|
194
|
+
[classes.active]: isActive,
|
|
194
195
|
})}
|
|
195
196
|
{...referenceProps}
|
|
196
197
|
{...addDataAttributes(data, testId)}
|