@planningcenter/tapestry-react 4.3.1 → 4.3.2
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,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n}from'./../ext/tslib/tslib.es6.js';import r,{useState as t,useRef as o,useMemo as
|
|
1
|
+
import{__rest as e,__assign as n}from'./../ext/tslib/tslib.es6.js';import r,{useState as t,useRef as o,useMemo as a}from"react";import{Box as i}from"../Box/Box.js";import u from"../Input/Input.js";import l from"../Input/InputBox.js";import c from"../Input/InputField.js";import d from"../NumberField/NumberField.js";import{padNumber as s,noop as v}from"../utils.js";import{addHoursToTime as m,addMinutesToTime as f,addTimeToDate as p,getTimeFromDate as w}from"./utils.js";var g="undefined"!=typeof window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),h=function(t){var o=t.twelveHourClock,a=void 0===o||o,i=t.controlled,u=void 0!==i&&i,l=e(t,["twelveHourClock","controlled"]);return u?r.createElement(k,n({twelveHourClock:a},l)):r.createElement(y,n({twelveHourClock:a},l))};h.addHoursToTime=m,h.addMinutesToTime=f,h.addTimeToDate=p,h.getTimeFromDate=w;var y=function(o){var a=o.value,i=e(o,["value"]),u=t(a),l=u[0],c=u[1];return r.createElement(k,n({},i,{onChange:function(e){c(e),i.onChange&&i.onChange(e)},value:l}))},k=function(t){var m=t.ignoredKeys;t.interval;var f=t.isIOS,p=void 0!==f&&f;t.max,t.min;var w=t.onChange,h=t.twelveHourClock,y=t.value,k=e(t,["ignoredKeys","interval","isIOS","max","min","onChange","twelveHourClock","value"]),A=o(null),C=y[0],I=y[1],x=a((function(){return C<12?"AM":"PM"}),[C]),M=function(e){var n=e.hours;return e.twelveHourClock&&12!==n?0===n?-12:n>12?12:0:0}({hours:C,twelveHourClock:h}),b=a((function(){return h?0===C?12:C>12?C-12:C:C}),[C]),D=function(e){var n=C-e;return n<0?23:n},E=function(e){return(C+e)%24};return g||p?r.createElement(u,n({},k,{type:"time",autoWidth:"".concat(C,":").concat(s(I,2)," ").concat(x),value:"".concat(s(C,2),":").concat(s(I,2)),onChange:function(e){var n=e.target.value.split(":"),r=n[0],t=n[1];w(r||t?[parseInt(r,10),parseInt(t,10)]:[0,0])}})):r.createElement(l,n({ref:A,inline:!0},k),r.createElement(d,{"aria-label":"Hours",autoWidth:!1,fontVariantNumeric:"tabular-nums",grow:0,max:h?12:23,min:0,moveFocusOnMax:!0,onBlur:function(e){var n=parseInt(e.target.value,10);w([n+M,I])},onChange:function(e){var n="string"==typeof e?parseInt(e,10):e;w([n+M,I])},onKeyDown:function(e){var n;m&&m.includes(e.key)||("Backspace"===e.key&&e.preventDefault(),"ArrowRight"===e.key&&(null===(n=A.current)||void 0===n?void 0:n.node.children[2]).focus(),"ArrowUp"===e.key&&w([E(1),I]),"ArrowDown"===e.key&&function(e){w([D(e),I])}(1))},pad:2,textAlign:"center",value:b,width:"2ch",ignoredKeys:m}),r.createElement(i,{as:"span",width:.5,textAlign:"center",userSelect:"none"},":"),r.createElement(d,{"aria-label":"Minutes",autoWidth:!1,fontVariantNumeric:"tabular-nums",grow:0,max:59,min:0,moveFocusOnMax:!0,onChange:function(e){return w([C,"string"==typeof e?parseInt(e,10):e])},onKeyDown:function(e){var n,r,t;"ArrowLeft"===e.key&&(null===(n=A.current)||void 0===n?void 0:n.node.children[0]).focus(),"ArrowRight"===e.key&&(null===(r=A.current)||void 0===r?void 0:r.node.children[3]).focus(),"ArrowUp"===e.key&&w((t=I+1)<=59?[C,t]:[E(1),0]),"ArrowDown"===e.key&&function(e){var n=I-e;w(n>=0?[C,n]:[D(1),59])}(1)},pad:2,textAlign:"center",value:I,width:"2ch",ignoredKeys:m}),h&&r.createElement(c,{"aria-label":"AM/PM",grow:0,highlightOnInteraction:!0,onChange:v,onKeyDown:function(e){var n;m&&m.includes(e.key)||("Tab"===e.key||e.metaKey&&"r"===e.key||e.preventDefault(),"ArrowLeft"===e.key&&(null===(n=A.current)||void 0===n?void 0:n.node.children[2]).focus(),("a"===e.key.toLowerCase()&&"PM"===x||"p"===e.key.toLowerCase()&&"AM"===x||"ArrowUp"===e.key||"ArrowDown"===e.key)&&w("AM"===x?[C+12,I]:[C-12,I]))},textAlign:"center",value:x,width:"2em"}))};export{h as default};
|
|
2
2
|
//# sourceMappingURL=TimeField.js.map
|
package/dist/Tooltip/Tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n}from'./../ext/tslib/tslib.es6.js';import o from"mitt";import r,{forwardRef as t,useRef as u,useState as i,useEffect as c,useImperativeHandle as l,Children as s,cloneElement as p}from"react";import{Popover as a}from"../Popover/Popover.js";import"../system/colors/colors.js";import"polished";import{pageViewChange as m,composeEvents as d}from"../utils.js";import"lodash/includes";import{useThemeProps as f}from"../system/utils.js";import"../system/style-names.js";import"@planningcenter/icons/paths/general";import"@planningcenter/icons/paths/tapestry";import"@emotion/react";import"../system/cxs.js";var v=o(),T=null,g=!1;var O=t((function(o,t){var O=f("tooltip",o),y=O.children,E=O.openDelay,M=void 0===E?500:E,P=O.closeDelay,h=void 0===P?300:P,I=O.defaultOpen,L=void 0!==I&&I,j=O.keepInView,S=void 0===j||j,_=O.placement,x=O.popoverProps,D=O.renderTo,w=O.title,z=O.triggerOnFocus,F=void 0===z||z,b=O.triggerOnHover,k=void 0===b||b,C=O.zIndex,V=void 0===C?
|
|
1
|
+
import{__rest as e,__assign as n}from'./../ext/tslib/tslib.es6.js';import o from"mitt";import r,{forwardRef as t,useRef as u,useState as i,useEffect as c,useImperativeHandle as l,Children as s,cloneElement as p}from"react";import{Popover as a}from"../Popover/Popover.js";import"../system/colors/colors.js";import"polished";import{pageViewChange as m,composeEvents as d}from"../utils.js";import"lodash/includes";import{useThemeProps as f}from"../system/utils.js";import"../system/style-names.js";import"@planningcenter/icons/paths/general";import"@planningcenter/icons/paths/tapestry";import"@emotion/react";import"../system/cxs.js";var v=o(),T=null,g=!1;var O=t((function(o,t){var O=f("tooltip",o),y=O.children,E=O.openDelay,M=void 0===E?500:E,P=O.closeDelay,h=void 0===P?300:P,I=O.defaultOpen,L=void 0!==I&&I,j=O.keepInView,S=void 0===j||j,_=O.placement,x=O.popoverProps,D=O.renderTo,w=O.title,z=O.triggerOnFocus,F=void 0===z||z,b=O.triggerOnHover,k=void 0===b||b,C=O.zIndex,V=void 0===C?1e4:C,H=e(O,["children","openDelay","closeDelay","defaultOpen","keepInView","placement","popoverProps","renderTo","title","triggerOnFocus","triggerOnHover","zIndex"]),N=u(!0),B=u(!1),U=u(null),A=u(null),q=i(L),G=q[0],J=q[1];c((function(){var e=m((function(e){return setTimeout((function(){return N.current=e}))}));return v.on("CLOSE_OPEN_TOOLTIPS",Q),function(){v.off("CLOSE_OPEN_TOOLTIPS",Q),clearTimeout(U.current),clearTimeout(A.current),e()}}),[]);var K=function(){clearTimeout(A.current),A.current=null,J(!0)},Q=function(){clearTimeout(U.current),U.current=null,J(!1)},R=function(){J(!G)};l(t,(function(){return{close:Q,open:K,toggle:R}})),c((function(){!1===F&&Q()}),[F]),c((function(){!1===k&&Q()}),[k]);var W=function(){clearTimeout(T),null===U.current&&(clearTimeout(A.current),A.current=null,!1===G&&(v.emit("CLOSE_OPEN_TOOLTIPS"),U.current=setTimeout((function(){return K()}),g?0:M)))},X=function(){g=!0,T=setTimeout((function(){g=!1}),500),null===A.current&&(clearTimeout(U.current),U.current=null,A.current=setTimeout((function(){return Q()}),h))},Y=s.only(y),Z=Y.props,$=Z.onFocus,ee=Z.onBlur,ne=Z.onMouseEnter,oe=Z.onMouseLeave,re=Z.onMouseDown,te=Z.onMouseUp;return w?(F&&(H.onFocus=d((function(){N.current&&!B.current&&K()}),$),H.onBlur=d(Q,ee),H.onMouseDown=d((function(){B.current=!0,Q()}),re),H.onMouseUp=d((function(){B.current=!1}),te)),k&&(H.onMouseEnter=d(W,ne),H.onMouseLeave=d(X,oe)),r.createElement(a,n({shouldFlip:!0,paddingHorizontal:.75,paddingVertical:.25,fontSize:5,textAlign:"center",radius:2,backgroundColor:"grey-9",color:"rgba(255,255,255,0.94)",zIndex:V},x,{anchorElement:p(Y,H),onMouseEnter:W,onMouseLeave:X,keepInView:S,placement:_,renderTo:D,children:w,open:G}))):p(Y,H)}));export{O as default};
|
|
2
2
|
//# sourceMappingURL=Tooltip.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-react",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.2",
|
|
4
4
|
"description": "A collection of flexible React components to help you build resilient, accessible user interfaces quickly and effectively.",
|
|
5
5
|
"author": "Front End Systems Engineering <frontend@pco.bz>",
|
|
6
6
|
"main": "./dist/index.js",
|