@zonos/amino 5.1.32 → 5.1.33
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime"),r=require("react"),
|
|
1
|
+
"use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime"),r=require("react"),o=require("styled-components"),t=require("../button/Button.js"),i=require("../text/Text.js"),a=require("../../icons/ChevronDownIcon.js"),l=require("../../icons/MinusCircleDuotoneIcon.js"),s=require("../../icons/PlusCircleDuotoneIcon.js"),d=require("../../styles/constants/theme.js");function u(e){return e&&e.__esModule?e:{default:e}}require("../button/RippleGroup.js"),require("framer-motion"),require("uuid"),require("../button/_Ripple.js"),require("../button/useRipple.js"),require("../spinner/Spinner.js"),require("../../icons/icon-base/_IconBase.js");var c,p,m,x,b,f,h=u(o),g=h.default.div(c||(c=e.__makeTemplateObject(["\n position: relative;\n"],["\n position: relative;\n"]))),v=h.default.div(p||(p=e.__makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n border-radius: 100px;\n border: 1px dashed ",";\n background-color: transparent;\n color: ",";\n\n &.active {\n border: ",";\n }\n"],["\n display: inline-flex;\n align-items: center;\n border-radius: 100px;\n border: 1px dashed ",";\n background-color: transparent;\n color: ",";\n\n &.active {\n border: ",";\n }\n"])),d.theme.gray200,d.theme.gray700,d.theme.border),y=h.default.div(m||(m=e.__makeTemplateObject(["\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: ",";\n padding: "," ",";\n border-radius: 100px;\n\n border-top-right-radius: ",";\n border-bottom-right-radius: ",";\n\n border-right: 1px solid ",";\n\n &:hover {\n background-color: ",";\n }\n"],["\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: ",";\n padding: "," ",";\n border-radius: 100px;\n\n border-top-right-radius: ",";\n border-bottom-right-radius: ",";\n\n border-right: 1px solid ",";\n\n &:hover {\n background-color: ",";\n }\n"])),d.theme.space8,d.theme.space4,d.theme.space8,(function(e){return e.hasFilter?"0px":"100px"}),(function(e){return e.hasFilter?"0px":"100px"}),(function(e){return e.active?d.theme.borderColor:d.theme.gray200}),d.theme.gray100),j=h.default.div(x||(x=e.__makeTemplateObject(["\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: ",";\n padding: "," ",";\n border-radius: 100px;\n\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n\n &:hover {\n background-color: ",";\n }\n"],["\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: ",";\n padding: "," ",";\n border-radius: 100px;\n\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n\n &:hover {\n background-color: ",";\n }\n"])),d.theme.space8,d.theme.space4,d.theme.space8,d.theme.gray100),_=h.default.div(b||(b=e.__makeTemplateObject(["\n z-index: 1;\n min-width: 400px;\n position: absolute;\n border-radius: 14px;\n border: ",";\n background-color: ",";\n padding: ",";\n display: flex;\n flex-direction: column;\n gap: ",";\n outline: none;\n max-height: 600px;\n overflow: auto;\n"],["\n z-index: 1;\n min-width: 400px;\n position: absolute;\n border-radius: 14px;\n border: ",";\n background-color: ",";\n padding: ",";\n display: flex;\n flex-direction: column;\n gap: ",";\n outline: none;\n max-height: 600px;\n overflow: auto;\n"])),d.theme.border,d.theme.gray0,d.theme.space24,d.theme.space16),k=h.default.div(f||(f=e.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: ",";\n"],["\n display: flex;\n flex-direction: column;\n gap: ",";\n"])),d.theme.space12);exports.useFilterWrapper=function(o){var d=o.className,u=o.dropdownTitle,c=o.filterExists,p=o.label,m=o.onApply,x=o.onRemove,b=e.__read(r.useState(!1),2),f=b[0],h=b[1],q=e.__read(r.useState(!1),2),C=q[0],T=q[1],w=e.__read(r.useState("Filter"),2),E=w[0],I=w[1],D=r.useRef(null),F=r.useRef(null),S=function(){h(!0),m(I),T(!1)},O=function(e){"Escape"===e.key&&T(!1),"Enter"===e.key&&S()},R=r.useCallback((function(e){var n,r=e.target;r instanceof Element&&!(null===(n=D.current)||void 0===n?void 0:n.contains(r))&&T(!1)}),[]);r.useEffect((function(){var e,n,r;return null===(e=document.querySelector("body"))||void 0===e||e.addEventListener("mousedown",R),(null===(n=D.current)||void 0===n?void 0:n.contains(document.activeElement))||null===(r=D.current)||void 0===r||r.focus(),function(){var e;null===(e=document.querySelector("body"))||void 0===e||e.removeEventListener("mousedown",R)}}),[C,R]),r.useEffect((function(){var e;if(C){var n=null===(e=D.current)||void 0===e?void 0:e.querySelector("input");null==n||n.focus()}}),[C]);var z=function(e){e.stopPropagation(),T(!0)},W=function(){c?(h(!f),x()):T(!0)};r.useEffect((function(){c||h(!1)}),[c]);return{handleApplyFilter:S,renderWrapper:function(e){return n.jsxs(g,{ref:F,children:[n.jsxs(v,{className:[d,f&&"active"].join(" "),onClick:W,children:[n.jsxs(y,{active:f,hasFilter:f&&c,children:[f?n.jsx(l.MinusCircleDuotoneIcon,{color:"gray0",secondaryColor:"gray600",size:24}):n.jsx(s.PlusCircleDuotoneIcon,{color:"gray0",secondaryColor:"gray600",size:24}),n.jsx(i.Text,{fontWeight:600,children:p})]}),f&&c&&n.jsxs(j,{onClick:z,children:[n.jsx(i.Text,{color:"blue600",fontWeight:600,children:E}),n.jsx(a.ChevronDownIcon,{size:24})]})]}),C&&n.jsxs(_,{ref:D,onKeyDown:O,tabIndex:-1,children:[n.jsx(i.Text,{type:"bold-subheader",children:u}),n.jsx(k,{children:e}),n.jsx(t.Button,{onClick:S,variant:"primary",children:"Apply"})]})]})},setFilterText:I}};
|