@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
30 lines • 1.38 kB
JavaScript
import * as React from "react";
import cx from "clsx";
import ButtonLink from "../../ButtonLink";
const FilterWrapper = ({
child,
children,
onOnlySelection,
onlySelectionText
}) => {
const {
value,
label,
disabled
} = child.props;
return /*#__PURE__*/React.createElement("div", {
className: cx("h-form-box-small pl-xxs box-border flex w-full items-center rounded-[4px]", !disabled && "hover:[@media(hover)_and_(pointer:fine)]:bg-blue-light focus-within:[@media(hover)_and_(pointer:fine)]:bg-blue-light group")
}, children, onOnlySelection && !disabled && /*#__PURE__*/React.createElement("div", {
className: cx("orbit-choice-group-filter-wrapper", "[@media(hover)_and_(pointer:fine)]:invisible [@media(hover)_and_(pointer:fine)]:opacity-0", "[@media(hover:none)]:visible [@media(hover:none)]:opacity-30 hover:[@media(hover:none)]:opacity-100", "group-hover:[@media(hover)_and_(pointer:fine)]:visible group-hover:[@media(hover)_and_(pointer:fine)]:opacity-100", "group-focus-within:[@media(hover)_and_(pointer:fine)]:visible group-focus-within:[@media(hover)_and_(pointer:fine)]:opacity-100")
}, /*#__PURE__*/React.createElement(ButtonLink, {
type: "secondary",
size: "small",
onClick: ev => {
onOnlySelection(ev, {
value,
label
});
}
}, onlySelectionText)));
};
export default FilterWrapper;