@pushwoosh/kit-helpers 1.9.0 → 2.0.0

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/lib/grid.d.ts CHANGED
@@ -1,14 +1,21 @@
1
1
  export declare const GridContainer: import("styled-components").StyledComponent<"div", any, {
2
2
  gap?: string | number | undefined;
3
- columns?: string | number | undefined;
4
3
  padding?: string | number | undefined;
5
4
  margin?: string | number | undefined;
6
5
  justify?: "center" | "start" | "end" | "space-between" | undefined;
7
6
  alignItems?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
8
7
  }, never>;
8
+ export declare const Columns: import("styled-components").StyledComponent<"div", any, {
9
+ gap?: string | number | undefined;
10
+ padding?: string | number | undefined;
11
+ margin?: string | number | undefined;
12
+ justify?: "center" | "start" | "end" | "space-between" | undefined;
13
+ alignItems?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
14
+ } & {
15
+ columns: number | string;
16
+ }, never>;
9
17
  export declare const Horizontal: import("styled-components").StyledComponent<"div", any, {
10
18
  gap?: string | number | undefined;
11
- columns?: string | number | undefined;
12
19
  padding?: string | number | undefined;
13
20
  margin?: string | number | undefined;
14
21
  justify?: "center" | "start" | "end" | "space-between" | undefined;
@@ -16,7 +23,6 @@ export declare const Horizontal: import("styled-components").StyledComponent<"di
16
23
  }, never>;
17
24
  export declare const Vertical: import("styled-components").StyledComponent<"div", any, {
18
25
  gap?: string | number | undefined;
19
- columns?: string | number | undefined;
20
26
  padding?: string | number | undefined;
21
27
  margin?: string | number | undefined;
22
28
  justify?: "center" | "start" | "end" | "space-between" | undefined;
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var n={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},d:(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};n.r(e),n.d(e,{Collapse:()=>O,ExpandTransition:()=>T,GridContainer:()=>s,Horizontal:()=>u,Vertical:()=>d,elementAddListener:()=>f,subscribeClickAway:()=>v,useClickAway:()=>g,usePersistentFunction:()=>m});const t=require("tslib"),i=require("styled-components");var a,o,r,c=n.n(i),l=function(n){return"number"==typeof n},s=c().div.withConfig({displayName:"GridContainer",componentId:"sc-td6pqh-0"})(a||(a=(0,t.__makeTemplateObject)(["\n display: grid;\n ","\n ","\n ","\n ","\n ","\n ","\n"],["\n display: grid;\n ","\n ","\n ","\n ","\n ","\n ","\n"])),(function(n){var e=n.gap;return e&&"grid-gap: ".concat(l(e)?"".concat(e,"px"):e,";")}),(function(n){var e=n.columns;return e&&"grid-template-columns: ".concat(l(e)?"repeat(".concat(e,", 1fr)"):e,";")}),(function(n){var e=n.padding;return e&&"padding: ".concat(l(e)?"".concat(e,"px"):e,";")}),(function(n){var e=n.margin;return e&&"margin: ".concat(l(e)?"".concat(e,"px"):e,";")}),(function(n){var e=n.justify;return e&&"justify-content: ".concat(e,";")}),(function(n){var e=n.alignItems;return e&&"align-items: ".concat(e,";")})),u=c()(s).withConfig({displayName:"Horizontal",componentId:"sc-td6pqh-1"})(o||(o=(0,t.__makeTemplateObject)(["\n grid-auto-flow: column;\n"],["\n grid-auto-flow: column;\n"]))),d=c()(s).withConfig({displayName:"Vertical",componentId:"sc-td6pqh-2"})(r||(r=(0,t.__makeTemplateObject)(["\n grid-auto-flow: row;\n"],["\n grid-auto-flow: row;\n"])));const p=require("react");var h=n.n(p);function m(n){var e=(0,p.useRef)(n);return e.current=n,(0,p.useCallback)((function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.current.apply(e,n)}),[])}function f(n,e,t){var i=Array.isArray(e)?e:[e];return i.forEach((function(e){n.addEventListener(e,t)})),function(){i.forEach((function(e){n.removeEventListener(e,t)}))}}function v(n,e){return f(document,["mousedown","touchstart"],(function(t){n&&!n.contains(t.target)&&e(t)}))}function g(n,e,t){var i=m(t);(0,p.useEffect)((function(){if(n)return v(e.current,i)}),[n,e,i])}const y=require("react-transition-group");var w,_,x,b,C=function(n){var e=n.className,i=n.externalClassName,a=n.internalClassName,o=n.timeout,r=void 0===o?100:o,c=n.children,l=(0,t.__rest)(n,["className","externalClassName","internalClassName","timeout","children"]),s=(0,p.useRef)(null),u=(0,p.useRef)(null),d=(0,p.useState)(),m=d[0],f=d[1];function v(){var n=u.current.getBoundingClientRect();f({"--timeout":"".concat(r,"ms"),"--width":"".concat(n.width,"px"),"--height":"".concat(n.height,"px")})}return(0,p.useEffect)(v,[r]),h().createElement(y.CSSTransition,(0,t.__assign)({},l,{timeout:r,classNames:e,onEnter:v,onExit:v,nodeRef:s}),h().createElement("div",{ref:s,className:i?"".concat(e," ").concat(i):e,style:m},h().createElement("div",{ref:u,className:a},c)))},j=c()(C).withConfig({displayName:"CollapseTransition",componentId:"sc-7jjhp8-0"})(w||(w=(0,t.__makeTemplateObject)(["\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n\n &-enter-active, &-exit {\n overflow: hidden;\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n"],["\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n\n &-enter-active, &-exit {\n overflow: hidden;\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n"]))),N=(0,i.css)(_||(_=(0,t.__makeTemplateObject)(["\n overflow: hidden;\n position: relative;\n width: 1px;\n height: 1px;\n\n & > * {\n position: absolute;\n top: calc(var(--height) / -2);\n left: calc(var(--width) / -2);\n }\n"],["\n overflow: hidden;\n position: relative;\n width: 1px;\n height: 1px;\n\n & > * {\n position: absolute;\n top: calc(var(--height) / -2);\n left: calc(var(--width) / -2);\n }\n"]))),E=(0,i.css)(x||(x=(0,t.__makeTemplateObject)(["\n overflow: hidden;\n position: relative;\n width: var(--width);\n height: var(--height);\n\n & > * {\n position: absolute;\n top: 0;\n left: 0;\n }\n"],["\n overflow: hidden;\n position: relative;\n width: var(--width);\n height: var(--height);\n\n & > * {\n position: absolute;\n top: 0;\n left: 0;\n }\n"]))),T=c()(C).withConfig({displayName:"ExpandTransition",componentId:"sc-7jjhp8-1"})(b||(b=(0,t.__makeTemplateObject)(["\n transition: all var(--timeout) ease-out;\n\n & > * {\n transition: all var(--timeout) ease-out;\n }\n\n &-enter { "," }\n\n &-enter-active, &-exit { "," }\n\n &-exit-active { "," }\n"],["\n transition: all var(--timeout) ease-out;\n\n & > * {\n transition: all var(--timeout) ease-out;\n }\n\n &-enter { "," }\n\n &-enter-active, &-exit { "," }\n\n &-exit-active { "," }\n"])),N,E,N),O=function(n){var e=n.expanded,i=n.children,a=n.className,o=(0,t.__rest)(n,["expanded","children","className"]);return h().createElement(y.TransitionGroup,{component:null},e&&h().createElement(j,(0,t.__assign)({},o,{externalClassName:a,key:0}),"function"==typeof i?i():i))},k=exports;for(var S in e)k[S]=e[S];e.__esModule&&Object.defineProperty(k,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var n={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},d:(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};n.r(e),n.d(e,{Collapse:()=>q,Columns:()=>d,ExpandTransition:()=>k,GridContainer:()=>u,Horizontal:()=>p,Vertical:()=>m,elementAddListener:()=>g,subscribeClickAway:()=>y,useClickAway:()=>w,usePersistentFunction:()=>v});const t=require("tslib"),i=require("styled-components");var a,o,r,c,l=n.n(i),s=function(n){return"number"==typeof n},u=l().div.withConfig({displayName:"GridContainer",componentId:"sc-td6pqh-0"})(a||(a=(0,t.__makeTemplateObject)(["\n display: grid;\n ","\n ","\n ","\n ","\n ","\n"],["\n display: grid;\n ","\n ","\n ","\n ","\n ","\n"])),(function(n){var e=n.gap;return e&&"grid-gap: ".concat(s(e)?"".concat(e,"px"):e,";")}),(function(n){var e=n.padding;return e&&"padding: ".concat(s(e)?"".concat(e,"px"):e,";")}),(function(n){var e=n.margin;return e&&"margin: ".concat(s(e)?"".concat(e,"px"):e,";")}),(function(n){var e=n.justify;return e&&"justify-content: ".concat(e,";")}),(function(n){var e=n.alignItems;return e&&"align-items: ".concat(e,";")})),d=l()(u).withConfig({displayName:"Columns",componentId:"sc-td6pqh-1"})(o||(o=(0,t.__makeTemplateObject)(["\n grid-template-columns: ",";\n"],["\n grid-template-columns: ",";\n"])),(function(n){var e=n.columns;return s(e)?"repeat(".concat(e,", 1fr)"):e})),p=l()(u).withConfig({displayName:"Horizontal",componentId:"sc-td6pqh-2"})(r||(r=(0,t.__makeTemplateObject)(["\n grid-auto-flow: column;\n"],["\n grid-auto-flow: column;\n"]))),m=l()(u).withConfig({displayName:"Vertical",componentId:"sc-td6pqh-3"})(c||(c=(0,t.__makeTemplateObject)(["\n grid-auto-flow: row;\n"],["\n grid-auto-flow: row;\n"])));const h=require("react");var f=n.n(h);function v(n){var e=(0,h.useRef)(n);return e.current=n,(0,h.useCallback)((function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.current.apply(e,n)}),[])}function g(n,e,t){var i=Array.isArray(e)?e:[e];return i.forEach((function(e){n.addEventListener(e,t)})),function(){i.forEach((function(e){n.removeEventListener(e,t)}))}}function y(n,e){return g(document,["mousedown","touchstart"],(function(t){n&&!n.contains(t.target)&&e(t)}))}function w(n,e,t){var i=v(t);(0,h.useEffect)((function(){if(n)return y(e.current,i)}),[n,e,i])}const _=require("react-transition-group");var b,x,C,j,N=function(n){var e=n.className,i=n.externalClassName,a=n.internalClassName,o=n.timeout,r=void 0===o?100:o,c=n.children,l=(0,t.__rest)(n,["className","externalClassName","internalClassName","timeout","children"]),s=(0,h.useRef)(null),u=(0,h.useRef)(null),d=(0,h.useState)(),p=d[0],m=d[1];function v(){var n=u.current.getBoundingClientRect();m({"--timeout":"".concat(r,"ms"),"--width":"".concat(n.width,"px"),"--height":"".concat(n.height,"px")})}return(0,h.useEffect)(v,[r]),f().createElement(_.CSSTransition,(0,t.__assign)({},l,{timeout:r,classNames:e,onEnter:v,onExit:v,nodeRef:s}),f().createElement("div",{ref:s,className:i?"".concat(e," ").concat(i):e,style:p},f().createElement("div",{ref:u,className:a},c)))},E=l()(N).withConfig({displayName:"CollapseTransition",componentId:"sc-7jjhp8-0"})(b||(b=(0,t.__makeTemplateObject)(["\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n\n &-enter-active, &-exit {\n overflow: hidden;\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n"],["\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n\n &-enter-active, &-exit {\n overflow: hidden;\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n"]))),T=(0,i.css)(x||(x=(0,t.__makeTemplateObject)(["\n overflow: hidden;\n position: relative;\n width: 1px;\n height: 1px;\n\n & > * {\n position: absolute;\n top: calc(var(--height) / -2);\n left: calc(var(--width) / -2);\n }\n"],["\n overflow: hidden;\n position: relative;\n width: 1px;\n height: 1px;\n\n & > * {\n position: absolute;\n top: calc(var(--height) / -2);\n left: calc(var(--width) / -2);\n }\n"]))),O=(0,i.css)(C||(C=(0,t.__makeTemplateObject)(["\n overflow: hidden;\n position: relative;\n width: var(--width);\n height: var(--height);\n\n & > * {\n position: absolute;\n top: 0;\n left: 0;\n }\n"],["\n overflow: hidden;\n position: relative;\n width: var(--width);\n height: var(--height);\n\n & > * {\n position: absolute;\n top: 0;\n left: 0;\n }\n"]))),k=l()(N).withConfig({displayName:"ExpandTransition",componentId:"sc-7jjhp8-1"})(j||(j=(0,t.__makeTemplateObject)(["\n transition: all var(--timeout) ease-out;\n\n & > * {\n transition: all var(--timeout) ease-out;\n }\n\n &-enter { "," }\n\n &-enter-active, &-exit { "," }\n\n &-exit-active { "," }\n"],["\n transition: all var(--timeout) ease-out;\n\n & > * {\n transition: all var(--timeout) ease-out;\n }\n\n &-enter { "," }\n\n &-enter-active, &-exit { "," }\n\n &-exit-active { "," }\n"])),T,O,T),q=function(n){var e=n.expanded,i=n.children,a=n.className,o=(0,t.__rest)(n,["expanded","children","className"]);return f().createElement(_.TransitionGroup,{component:null},e&&f().createElement(E,(0,t.__assign)({},o,{externalClassName:a,key:0}),"function"==typeof i?i():i))},S=exports;for(var I in e)S[I]=e[I];e.__esModule&&Object.defineProperty(S,"__esModule",{value:!0})})();
2
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EA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,EAEeE,EAETF,GASPK,EAA8B,SAAC/E,GAC1C,IAAAgF,EAAQhF,EAAAgF,SACR7B,EAAQnD,EAAAmD,SACRL,EAAS9C,EAAA8C,UACNM,GAAIC,EAAAA,EAAAA,QAAArD,EAJmC,qCAKtC,OACJiE,IAAAA,cAACgB,EAAAA,gBAAe,CAACC,UAAW,MACzBF,GACCf,IAAAA,cAACQ,GAAkBN,EAAAA,EAAAA,UAAA,GACbf,EAAI,CACRL,kBAAmBD,EACnBpE,IAAK,IAEgB,mBAAbyE,EAA0BA,IAAaA,G","sources":["webpack://@pushwoosh/kit-helpers/webpack/bootstrap","webpack://@pushwoosh/kit-helpers/webpack/runtime/compat get default export","webpack://@pushwoosh/kit-helpers/webpack/runtime/define property getters","webpack://@pushwoosh/kit-helpers/webpack/runtime/hasOwnProperty shorthand","webpack://@pushwoosh/kit-helpers/webpack/runtime/make namespace object","webpack://@pushwoosh/kit-helpers/external commonjs \"tslib\"","webpack://@pushwoosh/kit-helpers/external commonjs \"styled-components\"","webpack://@pushwoosh/kit-helpers/./src/grid.tsx","webpack://@pushwoosh/kit-helpers/external commonjs \"react\"","webpack://@pushwoosh/kit-helpers/./src/hooks.ts","webpack://@pushwoosh/kit-helpers/external commonjs \"react-transition-group\"","webpack://@pushwoosh/kit-helpers/./src/expand.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"tslib\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"styled-components\");","import styled from 'styled-components';\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number';\n\nexport const GridContainer = styled.div<{\n gap?: number | string;\n columns?: number | string;\n padding?: number | string;\n margin?: number | string;\n justify?: 'center' | 'start' | 'end' | 'space-between';\n alignItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';\n}>`\n display: grid;\n ${({ gap }): any => gap && `grid-gap: ${isNumber(gap) ? `${gap}px` : gap};`}\n ${({ columns }): any => columns && `grid-template-columns: ${isNumber(columns) ? `repeat(${columns}, 1fr)` : columns};`}\n ${({ padding }): any => padding && `padding: ${isNumber(padding) ? `${padding}px` : padding};`}\n ${({ margin }): any => margin && `margin: ${isNumber(margin) ? `${margin}px` : margin};`}\n ${({ justify }): any => justify && `justify-content: ${justify};`}\n ${({ alignItems }): any => alignItems && `align-items: ${alignItems};`}\n`;\n\nexport const Horizontal = styled(GridContainer)`\n grid-auto-flow: column;\n`;\n\nexport const Vertical = styled(GridContainer)`\n grid-auto-flow: row;\n`;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","import { useRef, useCallback, useEffect } from 'react';\n\nexport function usePersistentFunction<T extends (...args: any[]) => any>(callback: T): T {\n const ref = useRef(callback);\n ref.current = callback;\n return useCallback((...args: any) => ref.current(...args), []) as T;\n}\n\nexport function elementAddListener<K extends keyof HTMLElementEventMap, E extends HTMLElement>(\n element: E,\n eventNames: K | K[],\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void,\n): () => void {\n const eventNamesArray = Array.isArray(eventNames) ? eventNames : [eventNames];\n eventNamesArray.forEach((eventName) => {\n element.addEventListener(eventName, listener);\n });\n return (): void => {\n eventNamesArray.forEach((eventName) => {\n element.removeEventListener(eventName, listener);\n });\n };\n}\n\nexport function subscribeClickAway<T extends HTMLElement>(element: T, callback: EventListener): () => void {\n return elementAddListener(document as any, ['mousedown', 'touchstart'], (event) => {\n if (element && !element.contains(event.target as any)) {\n callback(event);\n }\n });\n}\n\nexport function useClickAway(use: boolean, ref: any, cb: EventListener): void {\n const mcb = usePersistentFunction(cb);\n\n useEffect(() => { // eslint-disable-line consistent-return\n if (use) {\n return subscribeClickAway(ref.current, mcb) as any;\n }\n }, [use, ref, mcb]);\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-transition-group\");","/* eslint-disable react/require-default-props, react/jsx-no-bind */\n\nimport React, {\n FC, useEffect, useRef, useState,\n} from 'react';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport styled, { css } from 'styled-components';\n\ntype ExpandTransitionProps = {\n className?: string;\n timeout?: number;\n externalClassName?: string;\n internalClassName?: string;\n};\nconst ExpandTransitionComp: FC<ExpandTransitionProps> = ({\n className,\n externalClassName,\n internalClassName,\n timeout = 100,\n children,\n ...rest\n}) => {\n const refExternal = useRef<HTMLDivElement>(null);\n const refInternal = useRef<HTMLDivElement>(null);\n const [externalStyle, setExternalStyle] = useState<Record<string, string>>();\n\n function updateStyle(): void {\n const rect = refInternal.current!.getBoundingClientRect();\n setExternalStyle({\n '--timeout': `${timeout}ms`,\n '--width': `${rect.width}px`,\n '--height': `${rect.height}px`,\n });\n }\n useEffect(updateStyle, [timeout]);\n\n return (\n <CSSTransition\n {...rest}\n timeout={timeout}\n classNames={className}\n onEnter={updateStyle}\n onExit={updateStyle}\n nodeRef={refExternal}\n >\n <div\n ref={refExternal}\n className={externalClassName ? `${className} ${externalClassName}` : className}\n style={externalStyle}\n >\n <div\n ref={refInternal}\n className={internalClassName}\n >\n {children}\n </div>\n </div>\n </CSSTransition>\n );\n};\n\nconst CollapseTransition = styled(ExpandTransitionComp)`\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n\n &-enter-active, &-exit {\n overflow: hidden;\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n`;\n\nconst enterExpandCss = css`\n overflow: hidden;\n position: relative;\n width: 1px;\n height: 1px;\n\n & > * {\n position: absolute;\n top: calc(var(--height) / -2);\n left: calc(var(--width) / -2);\n }\n`;\n\nconst exitExpandCss = css`\n overflow: hidden;\n position: relative;\n width: var(--width);\n height: var(--height);\n\n & > * {\n position: absolute;\n top: 0;\n left: 0;\n }\n`;\n\nexport const ExpandTransition = styled(ExpandTransitionComp)`\n transition: all var(--timeout) ease-out;\n\n & > * {\n transition: all var(--timeout) ease-out;\n }\n\n &-enter { ${enterExpandCss} }\n\n &-enter-active, &-exit { ${exitExpandCss} }\n\n &-exit-active { ${enterExpandCss} }\n`;\n\ntype CollapseProps = {\n expanded: boolean;\n timeout?: number;\n className?: string;\n internalClassName?: string;\n};\nexport const Collapse: FC<CollapseProps> = ({\n expanded,\n children,\n className,\n ...rest\n}) => (\n <TransitionGroup component={null}>\n {expanded && (\n <CollapseTransition\n {...rest}\n externalClassName={className}\n key={0}\n >\n {typeof children === 'function' ? children() : children}\n </CollapseTransition>\n )}\n </TransitionGroup>\n);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","isNumber","GridContainer","styled","displayName","componentId","templateObject_1","__makeTemplateObject","_a","gap","concat","columns","padding","margin","justify","alignItems","Horizontal","withConfig","templateObject_2","Vertical","templateObject_3","usePersistentFunction","callback","ref","useRef","current","useCallback","args","_i","arguments","length","apply","elementAddListener","element","eventNames","listener","eventNamesArray","Array","isArray","forEach","eventName","addEventListener","removeEventListener","subscribeClickAway","document","event","contains","target","useClickAway","use","cb","mcb","useEffect","ExpandTransitionComp","className","externalClassName","internalClassName","_b","timeout","children","rest","__rest","refExternal","refInternal","_c","useState","externalStyle","setExternalStyle","updateStyle","rect","getBoundingClientRect","width","height","React","CSSTransition","__assign","classNames","onEnter","onExit","nodeRef","style","CollapseTransition","enterExpandCss","css","exitExpandCss","ExpandTransition","templateObject_4","Collapse","expanded","TransitionGroup","component"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,8NCL9D,MAAM,EAA+BC,QAAQ,SCAvC,EAA+BA,QAAQ,qB,qBCEvCC,EAAW,SAACF,GAAoC,MAAiB,iBAAVA,CAAP,EAEzCG,EAAgBC,IAAAA,IAAAA,WAAU,CAAAC,YAAA,gBAAAC,YAAA,eAAVF,CAAUG,IAAAA,GAAAC,EAAAA,EAAAA,sBAAA,6DAMrC,yBAE2E,OACmB,OACN,OACvB,OACK,SAJpE,SAACC,G,IAAEC,EAAGD,EAAAC,IAAY,OAAAA,GAAO,aAAAC,OAAaT,EAASQ,GAAO,GAAAC,OAAGD,EAAG,MAAOA,E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AAA,eAAaC,EAAAA,EAAAA,UAAA,GACRf,EAAI,CACRF,QAASA,EACTkB,WAAYtB,EACZuB,QAAST,EACTU,OAAQV,EACRW,QAASjB,IAETW,IAAAA,cAAA,OACElD,IAAKuC,EACLR,UAAWC,EAAoB,GAAA/C,OAAG8C,EAAS,KAAA9C,OAAI+C,GAAsBD,EACrE0B,MAAOd,GAEPO,IAAAA,cAAA,OACElD,IAAKwC,EACLT,UAAWE,GAEVG,IAKX,EAEMsB,EAAqBhF,IAAOoD,GAAqBvC,WAAA,CAAAZ,YAAA,qBAAAC,YAAA,eAA5BF,CAA4BG,IAAAA,GAAAC,EAAAA,EAAAA,sBAAA,mrBAsBjD6E,GAAiBC,EAAAA,EAAAA,KAAGpE,IAAAA,GAAAV,EAAAA,EAAAA,sBAAA,6YAapB+E,GAAgBD,EAAAA,EAAAA,KAAGjE,IAAAA,GAAAb,EAAAA,EAAAA,sBAAA,yVAaZgF,EAAmBpF,IAAOoD,GAAqBvC,WAAA,CAAAZ,YAAA,mBAAAC,YAAA,eAA5BF,CAA4BmB,IAAAA,GAAAf,EAAAA,EAAAA,sBAAA,uUAOhC,oCAEc,2BAER,UAJpB6E,EAEeE,EAETF,GASPI,EAA8B,SAAChF,GAC1C,IAAAiF,EAAQjF,EAAAiF,SACR5B,EAAQrD,EAAAqD,SACRL,EAAShD,EAAAgD,UACNM,GAAIC,EAAAA,EAAAA,QAAAvD,EAJmC,qCAKtC,OACJmE,IAAAA,cAACe,EAAAA,gBAAe,CAACC,UAAW,MACzBF,GACCd,IAAAA,cAACQ,GAAkBN,EAAAA,EAAAA,UAAA,GACbf,EAAI,CACRL,kBAAmBD,EACnBtE,IAAK,IAEgB,mBAAb2E,EAA0BA,IAAaA,G","sources":["webpack://@pushwoosh/kit-helpers/webpack/bootstrap","webpack://@pushwoosh/kit-helpers/webpack/runtime/compat get default export","webpack://@pushwoosh/kit-helpers/webpack/runtime/define property getters","webpack://@pushwoosh/kit-helpers/webpack/runtime/hasOwnProperty shorthand","webpack://@pushwoosh/kit-helpers/webpack/runtime/make namespace object","webpack://@pushwoosh/kit-helpers/external commonjs \"tslib\"","webpack://@pushwoosh/kit-helpers/external commonjs \"styled-components\"","webpack://@pushwoosh/kit-helpers/./src/grid.tsx","webpack://@pushwoosh/kit-helpers/external commonjs \"react\"","webpack://@pushwoosh/kit-helpers/./src/hooks.ts","webpack://@pushwoosh/kit-helpers/external commonjs \"react-transition-group\"","webpack://@pushwoosh/kit-helpers/./src/expand.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"tslib\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"styled-components\");","import styled from 'styled-components';\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number';\n\nexport const GridContainer = styled.div<{\n gap?: number | string;\n padding?: number | string;\n margin?: number | string;\n justify?: 'center' | 'start' | 'end' | 'space-between';\n alignItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';\n}>`\n display: grid;\n ${({ gap }): any => gap && `grid-gap: ${isNumber(gap) ? `${gap}px` : gap};`}\n ${({ padding }): any => padding && `padding: ${isNumber(padding) ? `${padding}px` : padding};`}\n ${({ margin }): any => margin && `margin: ${isNumber(margin) ? `${margin}px` : margin};`}\n ${({ justify }): any => justify && `justify-content: ${justify};`}\n ${({ alignItems }): any => alignItems && `align-items: ${alignItems};`}\n`;\n\nexport const Columns = styled(GridContainer)<{\n columns: number | string;\n}>`\n grid-template-columns: ${({ columns }) => (isNumber(columns) ? `repeat(${columns}, 1fr)` : columns)};\n`;\n\nexport const Horizontal = styled(GridContainer)`\n grid-auto-flow: column;\n`;\n\nexport const Vertical = styled(GridContainer)`\n grid-auto-flow: row;\n`;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","import { useRef, useCallback, useEffect } from 'react';\n\nexport function usePersistentFunction<T extends (...args: any[]) => any>(callback: T): T {\n const ref = useRef(callback);\n ref.current = callback;\n return useCallback((...args: any) => ref.current(...args), []) as T;\n}\n\nexport function elementAddListener<K extends keyof HTMLElementEventMap, E extends HTMLElement>(\n element: E,\n eventNames: K | K[],\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void,\n): () => void {\n const eventNamesArray = Array.isArray(eventNames) ? eventNames : [eventNames];\n eventNamesArray.forEach((eventName) => {\n element.addEventListener(eventName, listener);\n });\n return (): void => {\n eventNamesArray.forEach((eventName) => {\n element.removeEventListener(eventName, listener);\n });\n };\n}\n\nexport function subscribeClickAway<T extends HTMLElement>(element: T, callback: EventListener): () => void {\n return elementAddListener(document as any, ['mousedown', 'touchstart'], (event) => {\n if (element && !element.contains(event.target as any)) {\n callback(event);\n }\n });\n}\n\nexport function useClickAway(use: boolean, ref: any, cb: EventListener): void {\n const mcb = usePersistentFunction(cb);\n\n useEffect(() => { // eslint-disable-line consistent-return\n if (use) {\n return subscribeClickAway(ref.current, mcb) as any;\n }\n }, [use, ref, mcb]);\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-transition-group\");","/* eslint-disable react/require-default-props, react/jsx-no-bind */\n\nimport React, {\n FC, useEffect, useRef, useState,\n} from 'react';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport styled, { css } from 'styled-components';\n\ntype ExpandTransitionProps = {\n className?: string;\n timeout?: number;\n externalClassName?: string;\n internalClassName?: string;\n};\nconst ExpandTransitionComp: FC<ExpandTransitionProps> = ({\n className,\n externalClassName,\n internalClassName,\n timeout = 100,\n children,\n ...rest\n}) => {\n const refExternal = useRef<HTMLDivElement>(null);\n const refInternal = useRef<HTMLDivElement>(null);\n const [externalStyle, setExternalStyle] = useState<Record<string, string>>();\n\n function updateStyle(): void {\n const rect = refInternal.current!.getBoundingClientRect();\n setExternalStyle({\n '--timeout': `${timeout}ms`,\n '--width': `${rect.width}px`,\n '--height': `${rect.height}px`,\n });\n }\n useEffect(updateStyle, [timeout]);\n\n return (\n <CSSTransition\n {...rest}\n timeout={timeout}\n classNames={className}\n onEnter={updateStyle}\n onExit={updateStyle}\n nodeRef={refExternal}\n >\n <div\n ref={refExternal}\n className={externalClassName ? `${className} ${externalClassName}` : className}\n style={externalStyle}\n >\n <div\n ref={refInternal}\n className={internalClassName}\n >\n {children}\n </div>\n </div>\n </CSSTransition>\n );\n};\n\nconst CollapseTransition = styled(ExpandTransitionComp)`\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n\n &-enter-active, &-exit {\n overflow: hidden;\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n overflow: hidden;\n opacity: 0;\n height: 0;\n }\n`;\n\nconst enterExpandCss = css`\n overflow: hidden;\n position: relative;\n width: 1px;\n height: 1px;\n\n & > * {\n position: absolute;\n top: calc(var(--height) / -2);\n left: calc(var(--width) / -2);\n }\n`;\n\nconst exitExpandCss = css`\n overflow: hidden;\n position: relative;\n width: var(--width);\n height: var(--height);\n\n & > * {\n position: absolute;\n top: 0;\n left: 0;\n }\n`;\n\nexport const ExpandTransition = styled(ExpandTransitionComp)`\n transition: all var(--timeout) ease-out;\n\n & > * {\n transition: all var(--timeout) ease-out;\n }\n\n &-enter { ${enterExpandCss} }\n\n &-enter-active, &-exit { ${exitExpandCss} }\n\n &-exit-active { ${enterExpandCss} }\n`;\n\ntype CollapseProps = {\n expanded: boolean;\n timeout?: number;\n className?: string;\n internalClassName?: string;\n};\nexport const Collapse: FC<CollapseProps> = ({\n expanded,\n children,\n className,\n ...rest\n}) => (\n <TransitionGroup component={null}>\n {expanded && (\n <CollapseTransition\n {...rest}\n externalClassName={className}\n key={0}\n >\n {typeof children === 'function' ? children() : children}\n </CollapseTransition>\n )}\n </TransitionGroup>\n);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","isNumber","GridContainer","styled","displayName","componentId","templateObject_1","__makeTemplateObject","_a","gap","concat","padding","margin","justify","alignItems","Columns","withConfig","templateObject_2","columns","Horizontal","templateObject_3","Vertical","templateObject_4","usePersistentFunction","callback","ref","useRef","current","useCallback","args","_i","arguments","length","apply","elementAddListener","element","eventNames","listener","eventNamesArray","Array","isArray","forEach","eventName","addEventListener","removeEventListener","subscribeClickAway","document","event","contains","target","useClickAway","use","cb","mcb","useEffect","ExpandTransitionComp","className","externalClassName","internalClassName","_b","timeout","children","rest","__rest","refExternal","refInternal","_c","useState","externalStyle","setExternalStyle","updateStyle","rect","getBoundingClientRect","width","height","React","CSSTransition","__assign","classNames","onEnter","onExit","nodeRef","style","CollapseTransition","enterExpandCss","css","exitExpandCss","ExpandTransition","Collapse","expanded","TransitionGroup","component"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-helpers",
3
- "version": "1.9.0",
3
+ "version": "2.0.0",
4
4
  "description": "React component for build Pushwoosh products",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",