@pushwoosh/kit-helpers 1.3.3 → 1.3.4
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/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -8
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,
|
|
1
|
+
!function(n,e){for(var t in e)n[t]=e[t]}(exports,function(n){var e={};function t(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return n[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var i in n)t.d(r,i,function(e){return n[e]}.bind(null,i));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="/",t(t.s=5)}([function(n,e){n.exports=require("react")},function(n,e){n.exports=require("tslib")},function(n,e){n.exports=require("styled-components")},function(n,e){n.exports=require("react-transition-group")},function(n,e){n.exports=require("classnames")},function(n,e,t){"use strict";t.r(e),t.d(e,"GridContainer",(function(){return s})),t.d(e,"Horizontal",(function(){return f})),t.d(e,"Vertical",(function(){return d})),t.d(e,"usePersistentFunction",(function(){return h})),t.d(e,"subscribeClickAway",(function(){return g})),t.d(e,"useClickAway",(function(){return v})),t.d(e,"VerticalExpand",(function(){return _}));var r,i,o,a=t(1),c=t(2),u=t.n(c),l=function(n){return"number"==typeof n},s=u.a.div.withConfig({displayName:"GridContainer",componentId:"sc-td6pqh-0"})(r||(r=Object(a.__makeTemplateObject)(["\n display: grid;\n ","\n ","\n ","\n ","\n"],["\n display: grid;\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.justify;return e&&"justify-content: ".concat(e,";")})),f=u()(s).withConfig({displayName:"Horizontal",componentId:"sc-td6pqh-1"})(i||(i=Object(a.__makeTemplateObject)(["\n grid-auto-flow: column;\n"],["\n grid-auto-flow: column;\n"]))),d=u()(s).withConfig({displayName:"Vertical",componentId:"sc-td6pqh-2"})(o||(o=Object(a.__makeTemplateObject)(["\n grid-auto-flow: row;\n"],["\n grid-auto-flow: row;\n"]))),p=t(0),m=t.n(p);function h(n){var e=Object(p.useRef)(n);return e.current=n,Object(p.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){return t=function(t){n&&!n.contains(t.target)&&e(t)},(r=["mousedown","touchstart"]).forEach((function(n){document.addEventListener(n,t)})),function(){r.forEach((function(n){document.removeEventListener(n,t)}))};var t,r}function v(n,e,t){var r=h(t);Object(p.useEffect)((function(){if(n)return g(e.current,r)}),[n,e,r])}var y,b=t(3),j=t(4),x=t.n(j),O=u()((function(n){var e=n.className,t=n.externalClassName,r=n.internalClassName,i=n.timeout,o=void 0===i?100:i,c=n.children,u=Object(a.__rest)(n,["className","externalClassName","internalClassName","timeout","children"]),l=Object(p.useRef)(null),s=Object(p.useRef)(null),f=Object(p.useState)(),d=f[0],h=f[1];function g(){var n=s.current.getBoundingClientRect();h({"--timeout":"".concat(o,"ms"),"--width":"".concat(n.width,"px"),"--height":"".concat(n.height,"px")})}return Object(p.useEffect)(g,[o]),m.a.createElement(b.CSSTransition,Object(a.__assign)({},u,{timeout:o,classNames:e,onEnter:g,onExit:g,nodeRef:l}),m.a.createElement("div",{ref:l,className:x()(e,t),style:d},m.a.createElement("div",{ref:s,className:r},c)))})).withConfig({displayName:"ExpandTransition",componentId:"sc-7jjhp8-0"})(y||(y=Object(a.__makeTemplateObject)(["\n overflow: hidden;\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n opacity: 0;\n height: 0;\n }\n\n &-enter-active {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n opacity: 0;\n height: 0;\n }\n"],["\n overflow: hidden;\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n opacity: 0;\n height: 0;\n }\n\n &-enter-active {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n opacity: 0;\n height: 0;\n }\n"]))),_=function(n){var e=n.expanded,t=n.children,r=Object(a.__rest)(n,["expanded","children"]);return m.a.createElement(b.TransitionGroup,{component:null},e&&m.a.createElement(O,Object(a.__assign)({},r,{key:0}),"function"==typeof t?t():t))}}]));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"tslib\"","webpack:///external \"styled-components\"","webpack:///./node_modules/lodash/isNumber.js","webpack:///external \"react-transition-group\"","webpack:///./node_modules/lodash/_baseGetTag.js","webpack:///./node_modules/lodash/_Symbol.js","webpack:///./node_modules/lodash/isFunction.js","webpack:///external \"classnames\"","webpack:///./node_modules/lodash/_root.js","webpack:///./node_modules/lodash/_freeGlobal.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/lodash/_getRawTag.js","webpack:///./node_modules/lodash/_objectToString.js","webpack:///./node_modules/lodash/isObjectLike.js","webpack:///./node_modules/lodash/isObject.js","webpack:///./src/grid.tsx","webpack:///./src/hooks.ts","webpack:///./src/expand.tsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","baseGetTag","isObjectLike","getRawTag","objectToString","symToStringTag","undefined","isObject","tag","freeGlobal","freeSelf","self","root","Function","global","g","this","e","window","objectProto","nativeObjectToString","toString","isOwn","unmasked","result","type","GridContainer","styled","div","_a","gap","isNumber","columns","padding","justify","Horizontal","Vertical","usePersistentFunction","callback","ref","useRef","current","useCallback","_i","args","subscribeClickAway","element","handler","event","contains","target","events","forEach","eventName","document","addEventListener","removeEventListener","useClickAway","use","cb","mcb","useEffect","ExpandTransition","className","externalClassName","internalClassName","_b","timeout","children","rest","refExternal","refInternal","useState","externalStyle","setExternalStyle","updateStyle","rect","getBoundingClientRect","width","height","React","CSSTransition","classNames","onEnter","onExit","nodeRef","cn","style","VerticalExpand","expanded","TransitionGroup","component","isFunction"],"mappings":"6DACE,IAAIA,EAAmB,CAAC,EAGxB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,CAAC,GAUX,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,OACf,CAyDA,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,GAEhE,EAGAZ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VG,IAKX,IAEqD,sEAA5BzC,CAA4B,wuBAgCxC6D,EAA0C,SAAC3D,GACtD,IAAA4D,EAAQ,WACRrB,EAAQ,WACLC,EAAI,mBAH+C,yBAIlD,OACJW,kBAACU,kBAAe,CAACC,UAAW,MACzBF,GACCT,kBAAClB,EAAgB,sBACXO,EAAI,CACR9E,IAAK,IAEJqG,IAAWxB,GAAYA,IAAaA,G","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 16);\n","module.exports = require(\"react\");","module.exports = require(\"tslib\");","module.exports = require(\"styled-components\");","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar numberTag = '[object Number]';\n\n/**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\nfunction isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n}\n\nmodule.exports = isNumber;\n","module.exports = require(\"react-transition-group\");","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","module.exports = require(\"classnames\");","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","import styled from 'styled-components';\nimport isNumber from 'lodash/isNumber';\n\nexport const GridContainer = styled.div<{\n gap?: number | string;\n columns?: number | string;\n padding?: number | string;\n justify?: 'center' | 'start' | 'end' | 'space-between';\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 ${({ justify }): any => justify && `justify-content: ${justify};`}\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","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\nfunction subscribeHandler(handler: EventListener): () => void {\n const events = ['mousedown', 'touchstart'];\n events.forEach((eventName) => {\n document.addEventListener(eventName, handler);\n });\n return (): void => {\n events.forEach((eventName) => {\n document.removeEventListener(eventName, handler);\n });\n };\n}\n\nexport function subscribeClickAway(element: any, callback: EventListener): () => void {\n return subscribeHandler((event) => {\n if (element && !element.contains(event.target)) {\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","/* eslint-disable react/require-default-props, react/jsx-no-bind */\n\nimport React, {\n FC, useEffect, useRef, useState,\n} from 'react';\nimport isFunction from 'lodash/isFunction';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport styled from 'styled-components';\nimport cn from 'classnames';\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 as HTMLDivElement).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={cn(className, externalClassName)}\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 ExpandTransition = styled(ExpandTransitionComp)`\n overflow: hidden;\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n opacity: 0;\n height: 0;\n }\n\n &-enter-active {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n opacity: 0;\n height: 0;\n }\n`;\n\ntype VerticalExpandProps = {\n expanded: boolean;\n timeout?: number;\n externalClassName?: string;\n internalClassName?: string;\n\n};\nexport const VerticalExpand: FC<VerticalExpandProps> = ({\n expanded,\n children,\n ...rest\n}) => (\n <TransitionGroup component={null}>\n {expanded && (\n <ExpandTransition\n {...rest}\n key={0}\n >\n {isFunction(children) ? children() : children}\n </ExpandTransition>\n )}\n </TransitionGroup>\n);\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"tslib\"","webpack:///external \"styled-components\"","webpack:///external \"react-transition-group\"","webpack:///external \"classnames\"","webpack:///./src/grid.tsx","webpack:///./src/hooks.ts","webpack:///./src/expand.tsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","isNumber","GridContainer","styled","div","_a","gap","columns","padding","justify","Horizontal","Vertical","usePersistentFunction","callback","ref","useRef","current","useCallback","_i","args","subscribeClickAway","element","handler","event","contains","target","events","forEach","eventName","document","addEventListener","removeEventListener","useClickAway","use","cb","mcb","useEffect","ExpandTransition","className","externalClassName","internalClassName","_b","timeout","children","rest","refExternal","refInternal","useState","externalStyle","setExternalStyle","updateStyle","rect","getBoundingClientRect","width","height","React","CSSTransition","classNames","onEnter","onExit","nodeRef","cn","style","V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Q,WACLC,EAAI,mBAH+C,yBAIlD,OACJW,kBAACU,kBAAe,CAACC,UAAW,MACzBF,GACCT,kBAAClB,EAAgB,sBACXO,EAAI,CACRrD,IAAK,IAEgB,mBAAboD,EAA0BA,IAAaA,G","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n","module.exports = require(\"react\");","module.exports = require(\"tslib\");","module.exports = require(\"styled-components\");","module.exports = require(\"react-transition-group\");","module.exports = require(\"classnames\");","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 justify?: 'center' | 'start' | 'end' | 'space-between';\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 ${({ justify }): any => justify && `justify-content: ${justify};`}\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","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\nfunction subscribeHandler(handler: EventListener): () => void {\n const events = ['mousedown', 'touchstart'];\n events.forEach((eventName) => {\n document.addEventListener(eventName, handler);\n });\n return (): void => {\n events.forEach((eventName) => {\n document.removeEventListener(eventName, handler);\n });\n };\n}\n\nexport function subscribeClickAway(element: any, callback: EventListener): () => void {\n return subscribeHandler((event) => {\n if (element && !element.contains(event.target)) {\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","/* 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 from 'styled-components';\nimport cn from 'classnames';\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 as HTMLDivElement).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={cn(className, externalClassName)}\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 ExpandTransition = styled(ExpandTransitionComp)`\n overflow: hidden;\n transition: height var(--timeout) linear, opacity var(--timeout) linear;\n\n &-enter {\n opacity: 0;\n height: 0;\n }\n\n &-enter-active {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit {\n opacity: 1;\n height: var(--height);\n }\n\n &-exit-active {\n opacity: 0;\n height: 0;\n }\n`;\n\ntype VerticalExpandProps = {\n expanded: boolean;\n timeout?: number;\n externalClassName?: string;\n internalClassName?: string;\n\n};\nexport const VerticalExpand: FC<VerticalExpandProps> = ({\n expanded,\n children,\n ...rest\n}) => (\n <TransitionGroup component={null}>\n {expanded && (\n <ExpandTransition\n {...rest}\n key={0}\n >\n {typeof children === 'function' ? children() : children}\n </ExpandTransition>\n )}\n </TransitionGroup>\n);\n"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/kit-helpers",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "React component for build Pushwoosh products",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -20,12 +20,10 @@
|
|
|
20
20
|
"@babel/core": "^7.15.8",
|
|
21
21
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
22
22
|
"@babel/preset-env": "^7.15.8",
|
|
23
|
-
"@babel/runtime-corejs3": "^7.15.4",
|
|
24
23
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
|
|
25
24
|
"@pushwoosh/kit-constants": "^1.5.0",
|
|
26
25
|
"@pushwoosh/kit-icons": "^1.4.2",
|
|
27
26
|
"@pushwoosh/kit-typography": "^1.4.0",
|
|
28
|
-
"@types/lodash": "^4.14.178",
|
|
29
27
|
"@types/react": "^16.14.20",
|
|
30
28
|
"@types/react-dom": "^16.9.14",
|
|
31
29
|
"@types/react-transition-group": "^4.4.5",
|
|
@@ -37,7 +35,6 @@
|
|
|
37
35
|
"babel-plugin-styled-components": "^1.13.3",
|
|
38
36
|
"classnames": "^2.3.2",
|
|
39
37
|
"clean-webpack-plugin": "^3.0.0",
|
|
40
|
-
"core-js": "^3.19.0",
|
|
41
38
|
"cross-env": "^7.0.3",
|
|
42
39
|
"dotenv": "^10.0.0",
|
|
43
40
|
"eslint": "^7.32.0",
|
|
@@ -49,7 +46,6 @@
|
|
|
49
46
|
"eslint-plugin-react": "^7.26.1",
|
|
50
47
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
51
48
|
"html-webpack-plugin": "^4.5.2",
|
|
52
|
-
"lodash": "^4.17.0",
|
|
53
49
|
"pre-commit": "^1.2.2",
|
|
54
50
|
"react": "^16.14.0",
|
|
55
51
|
"react-dom": "^16.14.0",
|
|
@@ -66,10 +62,7 @@
|
|
|
66
62
|
"webpack-merge": "^5.8.0"
|
|
67
63
|
},
|
|
68
64
|
"peerDependencies": {
|
|
69
|
-
"@babel/runtime-corejs3": "^7.15.4",
|
|
70
65
|
"classnames": "^2.0.0",
|
|
71
|
-
"core-js": "^3.19.0",
|
|
72
|
-
"lodash": "^4.17.0",
|
|
73
66
|
"react": "^16.14.0",
|
|
74
67
|
"react-transition-group": "^4.4.4",
|
|
75
68
|
"styled-components": "^5.3.3",
|