@planningcenter/tapestry-react 4.13.2 → 4.14.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.
@@ -1,2 +1,2 @@
1
- import{__rest as r,__assign as e}from'./../ext/tslib/tslib.es6.js';import*as t from"react";import{StackView as o}from"../StackView/StackView.js";function i(i){var a=i.children,c=i.type,n=r(i,["children","type"]);return t.createElement(o,e({padding:1,radius:3,stroke:"".concat(c,"-dark"),strokeAlign:"inside",strokeWeight:1,color:"dark-9",backgroundColor:"".concat(c,"-lighter")},n),a)}export{i as Alert,i as default};
1
+ import{__rest as r,__assign as e}from'./../ext/tslib/tslib.es6.js';import*as t from"react";import{StackView as o}from"../StackView/StackView.js";function i(i){var a=i.children,c=i.type,n=r(i,["children","type"]);return t.createElement(o,e({padding:1,radius:3,stroke:"".concat(c,"-dark"),strokeAlign:"inside",strokeWeight:1,color:"dark-9",backgroundColor:"".concat(c,"-lighter")},n),a)}export{i as Alert};
2
2
  //# sourceMappingURL=Alert.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as t}from'./../ext/tslib/tslib.es6.js';import{getMonth as n,getYear as r,isSameDay as i,format as a,isSameMonth as o,addMonths as s,addYears as l,isBefore as c,isAfter as u,isWithinInterval as d}from"date-fns";import m,{forwardRef as h,useRef as f,useState as g,useEffect as p,useImperativeHandle as b,Children as y}from"react";import{Box as S}from"../Box/Box.js";import{Button as k}from"../Button/Button.js";import{Group as v}from"../Group/Group.js";import z from"../HeadingUppercase/HeadingUppercase.js";import{useHover as D}from"../hooks/use-hover.js";import"mousetrap";import"../hooks/use-measure.js";import{StackView as C}from"../StackView/StackView.js";import{useThemeValue as x}from"../system/utils.js";import E from"./Day.js";import{MIN_MONTH_DEFAULT as w,MAX_MONTH_DEFAULT as O,MIN_YEAR_DEFAULT as j,MAX_YEAR_DEFAULT as W,getMonthWeekDays as M,getMonthWeeks as B,MONTHS as T,TODAY as I,getNextOccurrenceOfDay as A,getYears as F}from"./utils.js";var H={lg:{buttonSize:"sm",cellSize:7,fontSize:3,headerFontSize:2,trimWeekdays:3},md:{buttonSize:"sm",cellSize:5,fontSize:4,headerFontSize:2,trimWeekdays:3},sm:{buttonSize:"sm",cellSize:4,fontSize:4,headerFontSize:4,statusOffset:"12.5%",trimWeekdays:2}},R=h((function(d,h){var A=d.date,N=void 0===A?null:A,P=d.initialDate,G=void 0===P?I:P,U=d.maxDate,V=void 0===U?null:U,Y=d.minDate,_=void 0===Y?null:Y,q=d.onDateChange,J=void 0===q?null:q,K=d.onDateSelect,L=void 0===K?null:K,Q=d.renderDay,X=void 0===Q?function(e){return m.createElement(E,t({},e))}:Q,Z=d.selected,$=void 0===Z?null:Z,ee=d.size,te=void 0===ee?"md":ee,ne=d.weekStartsOn,re=void 0===ne?null:ne,ie=e(d,["date","initialDate","maxDate","minDate","onDateChange","onDateSelect","renderDay","selected","size","weekStartsOn"]),ae=x("calendar"),oe=f(N),se=D(),le=se.hover,ce=se.hoverProps,ue=g(N||G),de=ue[0],me=ue[1],he=g("calendar"),fe=he[0],ge=he[1],pe="calendar"===fe,be="years"===fe,ye="months"===fe,Se=n(de),ke=r(de),ve=F(ke),ze=n(_)||w,De=n(V)||O,Ce=r(_)||j,xe=r(V)||W,Ee=H[te],we=Ee.buttonSize,Oe=Ee.cellSize,je=Ee.fontSize,We=Ee.headerFontSize,Me=Ee.statusOffset,Be=Ee.trimWeekdays,Te=M({trimWeekdays:Be,weekStartsOn:re||ae.weekStartsOn||0}),Ie=B(de,{forceSixWeeks:!0,weekStartsOn:re||ae.weekStartsOn||0}),Ae=function(e,t){var n=t?"calendar":fe;R.isBeforeDay(e,_)?e=_:R.isAfterDay(e,V)&&(e=V),null===N?(me(e),ge(n)):ge(n),J&&J(e)},Fe=function(e){Ae(("years"===fe?l:s)(de,e))};return p((function(){null===N||i(oe.current,N)||me(N),oe.current=N}),[N]),b(h,(function(){return{navigateCalendar:Fe,setDate:Ae}})),m.createElement(C,t({innerRef:h},ce,ie),m.createElement(C,{axis:"horizontal",alignment:"center",distribution:"space-between",padding:.5,paddingBottom:0},m.createElement(C,{axis:"horizontal",spacing:.5},m.createElement(S,{"aria-label":ye?"Choose dates":"Choose month",as:"button",type:"button",backgroundColor:le?"highlight":"transparent",cursor:"pointer",fontSize:We,hover:{backgroundColor:"highlightSecondary"},lineHeight:3,onClick:function(){ge(ye?"calendar":"months")},padding:.25,radius:3,tabIndex:-1},a(de,"MMMM")),m.createElement(S,{"aria-label":be?"Choose dates":"Choose year",as:"button",type:"button",backgroundColor:le?"highlight":"transparent",cursor:"pointer",fontSize:We,hover:{backgroundColor:"highlightSecondary"},lineHeight:3,onClick:function(){ge(be?"calendar":"years")},padding:.25,radius:3,tabIndex:-1},ke)),m.createElement(v,{marginRight:.5,childProps:{size:we,variant:"outline"}},m.createElement(k,{disabled:be?ke<=Ce:o(de,_),icon:{name:"general.leftChevron",size:"xxs"},onClick:function(){return Fe(-1)},tabIndex:-1,title:"Previous month"}),m.createElement(k,{icon:{name:"tapestry.radio1"},onClick:function(){return Ae(I,!0)},tabIndex:-1,tooltip:{title:"Today"}}),m.createElement(k,{disabled:be?ke>=xe:o(de,V),icon:{name:"general.rightChevron",size:"xxs"},onClick:function(){return Fe(1)},tabIndex:-1,title:"Next month"}))),ye&&m.createElement(C,{axis:"horizontal",width:7*Oe,height:6*Oe+3.5,marginTop:.5,wrap:!0},T.map((function(e,t){var n=!R.isWithinRange(new Date(ke,t,1),{end:new Date(xe,De,1),start:new Date(Ce,ze,1)});return m.createElement(C,{key:e,as:"button",type:"button",basis:7*Oe/3,alignment:"center",distribution:"center",fontWeight:700,cursor:n?"not-allowed":"pointer",backgroundColor:Se===t?"surfaceSecondary":"transparent",opacity:n?.6:void 0,hover:{backgroundColor:n?void 0:"highlight"},disabled:n,onClick:function(){Ae(s(de,t-Se),!0)}},m.createElement(z,{cursor:"inherit"},e.substring(0,3)))}))),be&&m.createElement(C,{axis:"horizontal",width:7*Oe,height:6*Oe+3.5,marginTop:.5,wrap:!0},ve.map((function(e){var t=!(e>=Ce&&e<=xe);return m.createElement(C,{key:e,as:"button",type:"button",basis:7*Oe/3,alignment:"center",distribution:"center",fontWeight:700,cursor:t?"not-allowed":"pointer",backgroundColor:ke===e?"surfaceTertiary":"transparent",opacity:t?.6:void 0,hover:{backgroundColor:t?void 0:"highlight"},disabled:t,onClick:function(){Ae(l(de,e-ke),!0)}},m.createElement(z,{cursor:"inherit"},e))}))),pe&&m.createElement(C,null,m.createElement(C,{axis:"horizontal"},Te.map((function(e){return m.createElement(C,{key:e.full,alignment:"center",distribution:"center",width:Oe,height:4},m.createElement(z,{fontSize:6},e.trimmed))}))),Ie.map((function(e,t){return m.createElement(C,{key:t,axis:"horizontal"},y.toArray(e.map((function(e){var t=o(e,de),n=c(e,_),r=u(e,V),a=i(e,$),s=i(e,I);return X({backgroundColor:n||r?"surfaceSecondary":"inherit",cellSize:Oe,color:a?"white":t&&!(n||r)?"inherit":"foregroundTertiary",date:e,fontSize:je,inSameMonth:t,isMaxDate:r,isMinDate:n,isSelected:a,isToday:s,selectDate:L,statusOffset:Me})}))))}))))}));R.displayName="Calendar",R.TODAY=I,R.Day=E,R.getNextOccurrenceOfDay=A,R.getMonthWeeks=B,R.isAfterDay=function(e,t){return e&&t&&u(e,t)},R.isBeforeDay=function(e,t){return e&&t&&c(e,t)},R.isSameDay=function(e,t){return e&&t&&i(e,t)},R.isWithinRange=function(e,t){var n=t.start,r=t.end;if(e&&n&&r&&u(r,n))return d(e,{end:r,start:n})};export{R as default};
1
+ import{__rest as e,__assign as t}from'./../ext/tslib/tslib.es6.js';import{getMonth as n,getYear as r,isSameDay as i,format as a,isSameMonth as o,addMonths as s,addYears as l,isBefore as c,isAfter as u,isWithinInterval as d}from"date-fns";import m,{forwardRef as h,useRef as f,useState as g,useEffect as p,useImperativeHandle as b,Children as y}from"react";import{Box as S}from"../Box/Box.js";import{Button as k}from"../Button/Button.js";import{Group as v}from"../Group/Group.js";import z from"../HeadingUppercase/HeadingUppercase.js";import{useHover as D}from"../hooks/use-hover.js";import"mousetrap";import"../hooks/use-measure.js";import{StackView as C}from"../StackView/StackView.js";import{useThemeValue as x}from"../system/utils.js";import E from"./Day.js";import{TODAY as w,MIN_MONTH_DEFAULT as O,MAX_MONTH_DEFAULT as j,MIN_YEAR_DEFAULT as W,MAX_YEAR_DEFAULT as M,getMonthWeekDays as B,getMonthWeeks as T,MONTHS as I,getNextOccurrenceOfDay as A,getYears as F}from"./utils.js";var H={lg:{buttonSize:"sm",cellSize:7,fontSize:3,headerFontSize:2,trimWeekdays:3},md:{buttonSize:"sm",cellSize:5,fontSize:4,headerFontSize:2,trimWeekdays:3},sm:{buttonSize:"sm",cellSize:4,fontSize:4,headerFontSize:4,statusOffset:"12.5%",trimWeekdays:2}},R=h((function(d,h){var A=d.date,N=void 0===A?null:A,P=d.initialDate,G=void 0===P?w:P,U=d.maxDate,V=void 0===U?null:U,Y=d.minDate,_=void 0===Y?null:Y,q=d.onDateChange,J=void 0===q?null:q,K=d.onDateSelect,L=void 0===K?null:K,Q=d.renderDay,X=void 0===Q?function(e){return m.createElement(E,t({},e))}:Q,Z=d.selected,$=void 0===Z?null:Z,ee=d.size,te=void 0===ee?"md":ee,ne=d.weekStartsOn,re=void 0===ne?null:ne,ie=e(d,["date","initialDate","maxDate","minDate","onDateChange","onDateSelect","renderDay","selected","size","weekStartsOn"]),ae=x("calendar"),oe=f(N),se=D(),le=se.hover,ce=se.hoverProps,ue=g(N||G),de=ue[0],me=ue[1],he=g("calendar"),fe=he[0],ge=he[1],pe="calendar"===fe,be="years"===fe,ye="months"===fe,Se=n(de),ke=r(de),ve=F(ke),ze=n(_)||O,De=n(V)||j,Ce=r(_)||W,xe=r(V)||M,Ee=H[te],we=Ee.buttonSize,Oe=Ee.cellSize,je=Ee.fontSize,We=Ee.headerFontSize,Me=Ee.statusOffset,Be=Ee.trimWeekdays,Te=B({trimWeekdays:Be,weekStartsOn:re||ae.weekStartsOn||0}),Ie=T(de,{forceSixWeeks:!0,weekStartsOn:re||ae.weekStartsOn||0}),Ae=function(e,t){var n=t?"calendar":fe;R.isBeforeDay(e,_)?e=_:R.isAfterDay(e,V)&&(e=V),null===N?(me(e),ge(n)):ge(n),J&&J(e)},Fe=function(e){Ae(("years"===fe?l:s)(de,e))};return p((function(){null===N||i(oe.current,N)||me(N),oe.current=N}),[N]),b(h,(function(){return{navigateCalendar:Fe,setDate:Ae}})),m.createElement(C,t({innerRef:h},ce,ie),m.createElement(C,{axis:"horizontal",alignment:"center",distribution:"space-between",padding:.5,paddingBottom:0},m.createElement(C,{axis:"horizontal",spacing:.5},m.createElement(S,{"aria-label":ye?"Choose dates":"Choose month",as:"button",type:"button",backgroundColor:le?"highlight":"transparent",cursor:"pointer",fontSize:We,hover:{backgroundColor:"highlightSecondary"},lineHeight:3,onClick:function(){ge(ye?"calendar":"months")},padding:.25,radius:3,tabIndex:-1},a(de,"MMMM")),m.createElement(S,{"aria-label":be?"Choose dates":"Choose year",as:"button",type:"button",backgroundColor:le?"highlight":"transparent",cursor:"pointer",fontSize:We,hover:{backgroundColor:"highlightSecondary"},lineHeight:3,onClick:function(){ge(be?"calendar":"years")},padding:.25,radius:3,tabIndex:-1},ke)),m.createElement(v,{marginRight:.5,childProps:{size:we,variant:"outline"}},m.createElement(k,{disabled:be?ke<=Ce:o(de,_),icon:{name:"general.leftChevron",size:"xxs"},onClick:function(){return Fe(-1)},tabIndex:-1,title:"Previous month"}),m.createElement(k,{icon:{name:"tapestry.radio1"},onClick:function(){return Ae(w,!0)},tabIndex:-1,tooltip:{title:"Today"}}),m.createElement(k,{disabled:be?ke>=xe:o(de,V),icon:{name:"general.rightChevron",size:"xxs"},onClick:function(){return Fe(1)},tabIndex:-1,title:"Next month"}))),ye&&m.createElement(C,{axis:"horizontal",width:7*Oe,height:6*Oe+3.5,marginTop:.5,wrap:!0},I.map((function(e,t){var n=!R.isWithinRange(new Date(ke,t,1),{end:new Date(xe,De,1),start:new Date(Ce,ze,1)});return m.createElement(C,{key:e,as:"button",type:"button",basis:7*Oe/3,alignment:"center",distribution:"center",fontWeight:700,cursor:n?"not-allowed":"pointer",backgroundColor:Se===t?"surfaceSecondary":"transparent",opacity:n?.6:void 0,hover:{backgroundColor:n?void 0:"highlight"},disabled:n,onClick:function(){Ae(s(de,t-Se),!0)}},m.createElement(z,{cursor:"inherit"},e.substring(0,3)))}))),be&&m.createElement(C,{axis:"horizontal",width:7*Oe,height:6*Oe+3.5,marginTop:.5,wrap:!0},ve.map((function(e){var t=!(e>=Ce&&e<=xe);return m.createElement(C,{key:e,as:"button",type:"button",basis:7*Oe/3,alignment:"center",distribution:"center",fontWeight:700,cursor:t?"not-allowed":"pointer",backgroundColor:ke===e?"surfaceTertiary":"transparent",opacity:t?.6:void 0,hover:{backgroundColor:t?void 0:"highlight"},disabled:t,onClick:function(){Ae(l(de,e-ke),!0)}},m.createElement(z,{cursor:"inherit"},e))}))),pe&&m.createElement(C,null,m.createElement(C,{axis:"horizontal"},Te.map((function(e){return m.createElement(C,{key:e.full,alignment:"center",distribution:"center",width:Oe,height:4},m.createElement(z,{fontSize:6},e.trimmed))}))),Ie.map((function(e,t){return m.createElement(C,{key:t,axis:"horizontal"},y.toArray(e.map((function(e){var t=o(e,de),n=c(e,_),r=u(e,V),a=i(e,$),s=i(e,w);return X({backgroundColor:n||r?"surfaceSecondary":"inherit",cellSize:Oe,color:a?"white":t&&!(n||r)?"inherit":"foregroundTertiary",date:e,fontSize:je,inSameMonth:t,isMaxDate:r,isMinDate:n,isSelected:a,isToday:s,selectDate:L,statusOffset:Me})}))))}))))}));R.displayName="Calendar",R.TODAY=w,R.Day=E,R.getNextOccurrenceOfDay=A,R.getMonthWeeks=T,R.isAfterDay=function(e,t){return e&&t&&u(e,t)},R.isBeforeDay=function(e,t){return e&&t&&c(e,t)},R.isSameDay=function(e,t){return e&&t&&i(e,t)},R.isWithinRange=function(e,t){var n=t.start,r=t.end;if(e&&n&&r&&u(r,n))return d(e,{end:r,start:n})};export{R as default};
2
2
  //# sourceMappingURL=Calendar.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as o}from"@emotion/react";import{token as i}from"@planningcenter/tapestry";import{Box as e}from"../Box/Box.js";import{Button as t}from"../Button/Button.js";import{Divider as r}from"../Divider/Divider.js";import n from"../Heading/Heading.js";import{StackView as l}from"../StackView/StackView.js";var a={"&::backdrop":{backgroundColor:"rgba(0, 0, 0, 0.4)"},backgroundColor:i("--t-surface-color-card"),border:"none",borderRadius:"8px",boxShadow:"0px 0px 20px 0px hsla(0, 0%, 0%, 0.15)",color:i("--t-text-color"),minWidth:"400px",padding:0},c=function(c){var d=c.body,s=c.cancelText,p=void 0===s?"Cancel":s,u=c.confirmText,m=void 0===u?"Done":u,x=c.destroyText,g=void 0===x?"Delete":x,f=c.dialogRef,v=c.onCancelClick,h=void 0===v?function(){return f.current.close()}:v,C=c.onCloseClick,k=void 0===C?function(){return f.current.close()}:C,b=c.onConfirmClick,w=void 0===b?function(){return f.current.close()}:b,y=c.onDestroyClick,z=void 0===y?function(){return f.current.close()}:y,D=c.showCancel,H=void 0!==D&&D,j=c.showDestroy,S=void 0!==j&&j,B=c.subtitle,T=void 0===B?"":B,V=c.title;return o("dialog",{ref:f,css:a},o(e,{paddingTop:3,paddingHorizontal:4},o(l,{axis:"horizontal",distribution:"space-between"},o(n,{level:1,margin:0,fontSize:"25px",lineHeight:"35px",weight:500,color:i("--t-text-color-headline")},V),o(t,{title:"Close",icon:{color:i("--t-icon-color-dim"),name:"general.x"},radius:"circle",height:4,width:4,variant:"naked",onClick:k})),T&&o(n,{level:2,fontSize:"16px",lineHeight:"26px",weight:500,color:i("--t-text-color-secondary")},T)),o(e,{padding:4},d),o(r,null),o(e,{paddingVertical:3,paddingHorizontal:4},o(l,{axis:"horizontal",distribution:"space-between"},S?o(t,{onClick:z,title:g,theme:"error",variant:"outline"}):o(e,null),o(l,{axis:"horizontal",spacing:2},H&&o(t,{title:p,variant:"naked",onClick:h}),o(t,{title:m,onClick:w,theme:"primary"})))))};export{c as Dialog,c as default};
1
+ import{jsx as o}from"@emotion/react";import{token as i}from"@planningcenter/tapestry";import{Box as e}from"../Box/Box.js";import{Button as t}from"../Button/Button.js";import{Divider as r}from"../Divider/Divider.js";import n from"../Heading/Heading.js";import{StackView as l}from"../StackView/StackView.js";var a={"&::backdrop":{backgroundColor:"rgba(0, 0, 0, 0.4)"},backgroundColor:i("--t-surface-color-card"),border:"none",borderRadius:"8px",boxShadow:"0px 0px 20px 0px hsla(0, 0%, 0%, 0.15)",color:i("--t-text-color"),minWidth:"400px",padding:0},c=function(c){var d=c.body,s=c.cancelText,p=void 0===s?"Cancel":s,u=c.confirmText,m=void 0===u?"Done":u,x=c.destroyText,g=void 0===x?"Delete":x,f=c.dialogRef,v=c.onCancelClick,h=void 0===v?function(){return f.current.close()}:v,C=c.onCloseClick,k=void 0===C?function(){return f.current.close()}:C,b=c.onConfirmClick,w=void 0===b?function(){return f.current.close()}:b,y=c.onDestroyClick,z=void 0===y?function(){return f.current.close()}:y,D=c.showCancel,H=void 0!==D&&D,j=c.showDestroy,S=void 0!==j&&j,B=c.subtitle,T=void 0===B?"":B,V=c.title;return o("dialog",{ref:f,css:a},o(e,{paddingTop:3,paddingHorizontal:4},o(l,{axis:"horizontal",distribution:"space-between"},o(n,{level:1,margin:0,fontSize:"25px",lineHeight:"35px",weight:500,color:i("--t-text-color-headline")},V),o(t,{title:"Close",icon:{color:i("--t-icon-color-dim"),name:"general.x"},radius:"circle",height:4,width:4,variant:"naked",onClick:k})),T&&o(n,{level:2,fontSize:"16px",lineHeight:"26px",weight:500,color:i("--t-text-color-secondary")},T)),o(e,{padding:4},d),o(r,null),o(e,{paddingVertical:3,paddingHorizontal:4},o(l,{axis:"horizontal",distribution:"space-between"},S?o(t,{onClick:z,title:g,theme:"error",variant:"outline"}):o(e,null),o(l,{axis:"horizontal",spacing:2},H&&o(t,{title:p,variant:"naked",onClick:h}),o(t,{title:m,onClick:w,theme:"primary"})))))};export{c as Dialog};
2
2
  //# sourceMappingURL=Dialog.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as n from"@planningcenter/react-beautiful-dnd";import t from"mitt";import a,{createContext as o,useContext as i,useEffect as d,Fragment as l,Children as c,createElement as u}from"react";import{createPortal as p}from"react-dom";import{StackView as s}from"../StackView/StackView.js";import{useThemeValue as g}from"../system/utils.js";import{getThemeDataAttribute as f}from"../ThemeProvider/styles.js";var m=o(!1),D=o(!1),b=t(),v={},E=null,y=0;function h(){return i(m)}function I(t){var o=t.children,i=t.sourceOnly,l=t.onDragStart,c=t.onDragEnd,u=t.onDrop,p=e(t,["children","sourceOnly","onDragStart","onDragEnd","onDrop"]);return d((function(){function e(e){l&&e.source.droppableId===p.droppableId&&l(e)}return b.on("dragStart",e),function(){b.off("dragStart",e)}}),[l]),d((function(){function e(e){c&&e.source.droppableId===p.droppableId&&c(e),u&&e.destination&&e.destination.droppableId===p.droppableId&&u(e)}return b.on("dragEnd",e),function(){b.off("dragEnd",e)}}),[c,u]),a.createElement(D.Provider,{value:i},a.createElement(n.Droppable,r({isDropDisabled:i},p),(function(e,r){return i&&(e.placeholder=a.createElement("div",{style:{display:"none"}},e.placeholder)),o(e,r)})))}function S(t){var o=t.children,c=t.placeholder,u=t.data,s=e(t,["children","placeholder","data"]),g=i(D);return d((function(){return function(e,r){return v[e]=r,function(){delete v[e]}}(s.draggableId,u)}),[u]),a.createElement(n.Draggable,r({},s),(function(e,r){g&&(e.draggableProps.style=r.isDragging?e.draggableProps.style:{transform:"none",transition:"none"});var n=o(e,r);return r.isDragging?a.createElement(l,null,p(n,E),g&&c&&c()):n}))}var P={Draggable:S,Droppable:I,Provider:function(t){var o=t.onDragStart,i=t.onDragEnd,l=e(t,["onDragStart","onDragEnd"]),c=h(),u=g("id");return"undefined"!=typeof document&&null===E&&((E=document.createElement("div")).id="rbd-portal",E.className="tapestry-react-reset",E.setAttribute(f(u),"true"),document.body.appendChild(E)),d((function(){return y+=1,function(){0===(y-=1)&&(E=null)}}),[]),c?l.children:a.createElement(m.Provider,{value:!0},a.createElement(n.DragDropContext,r({onDragStart:function(e){var n=r(r({},e),{data:v[e.draggableId]||null});b.emit("dragStart",n),o&&o(n)},onDragEnd:function(e){var n=r(r({},e),{data:v[e.draggableId]||null});b.emit("dragEnd",n),i&&i(n)}},l)))},StaticList:function(n){var t=n.children,o=n.variants,i=n.id,d=e(n,["children","variants","id"]),p=r({item:function(e){return e},placeholder:{opacity:.5}},o);return a.createElement(I,{droppableId:i,isDropDisabled:!0},(function(n){return a.createElement(s,r({innerRef:n.innerRef},d),c.map(t,(function(n,t){var o=n.props,i=o.id,d=e(o,["id"]);return a.createElement(S,{key:n.key,draggableId:i,index:t},(function(e,t){return a.createElement(l,null,u(n.type,r(r(r(r({},d),e.draggableProps),e.dragHandleProps),{innerRef:e.innerRef,style:p.item(t.isDragging?e.draggableProps.style:{transform:"none",transition:"none"},t)})),t.isDragging&&u(n.type,r(r({},d),p.placeholder)))}))})),a.createElement("div",{style:{display:"none"}},n.placeholder))}))},useDragDrop:h};export{P as default};
1
+ import{__rest as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as n from"@planningcenter/react-beautiful-dnd";import t from"mitt";import a,{createContext as o,useContext as i,Children as d,Fragment as l,createElement as c,useEffect as u}from"react";import{createPortal as p}from"react-dom";import{StackView as s}from"../StackView/StackView.js";import{useThemeValue as g}from"../system/utils.js";import{getThemeDataAttribute as f}from"../ThemeProvider/styles.js";var m=o(!1),D=o(!1),b=t(),v={},E=null,y=0;function h(){return i(m)}function I(t){var o=t.children,i=t.sourceOnly,d=t.onDragStart,l=t.onDragEnd,c=t.onDrop,p=e(t,["children","sourceOnly","onDragStart","onDragEnd","onDrop"]);return u((function(){function e(e){d&&e.source.droppableId===p.droppableId&&d(e)}return b.on("dragStart",e),function(){b.off("dragStart",e)}}),[d]),u((function(){function e(e){l&&e.source.droppableId===p.droppableId&&l(e),c&&e.destination&&e.destination.droppableId===p.droppableId&&c(e)}return b.on("dragEnd",e),function(){b.off("dragEnd",e)}}),[l,c]),a.createElement(D.Provider,{value:i},a.createElement(n.Droppable,r({isDropDisabled:i},p),(function(e,r){return i&&(e.placeholder=a.createElement("div",{style:{display:"none"}},e.placeholder)),o(e,r)})))}function S(t){var o=t.children,d=t.placeholder,c=t.data,s=e(t,["children","placeholder","data"]),g=i(D);return u((function(){return function(e,r){return v[e]=r,function(){delete v[e]}}(s.draggableId,c)}),[c]),a.createElement(n.Draggable,r({},s),(function(e,r){g&&(e.draggableProps.style=r.isDragging?e.draggableProps.style:{transform:"none",transition:"none"});var n=o(e,r);return r.isDragging?a.createElement(l,null,p(n,E),g&&d&&d()):n}))}var P={Draggable:S,Droppable:I,Provider:function(t){var o=t.onDragStart,i=t.onDragEnd,d=e(t,["onDragStart","onDragEnd"]),l=h(),c=g("id");return"undefined"!=typeof document&&null===E&&((E=document.createElement("div")).id="rbd-portal",E.className="tapestry-react-reset",E.setAttribute(f(c),"true"),document.body.appendChild(E)),u((function(){return y+=1,function(){0===(y-=1)&&(E=null)}}),[]),l?d.children:a.createElement(m.Provider,{value:!0},a.createElement(n.DragDropContext,r({onDragStart:function(e){var n=r(r({},e),{data:v[e.draggableId]||null});b.emit("dragStart",n),o&&o(n)},onDragEnd:function(e){var n=r(r({},e),{data:v[e.draggableId]||null});b.emit("dragEnd",n),i&&i(n)}},d)))},StaticList:function(n){var t=n.children,o=n.variants,i=n.id,u=e(n,["children","variants","id"]),p=r({item:function(e){return e},placeholder:{opacity:.5}},o);return a.createElement(I,{droppableId:i,isDropDisabled:!0},(function(n){return a.createElement(s,r({innerRef:n.innerRef},u),d.map(t,(function(n,t){var o=n.props,i=o.id,d=e(o,["id"]);return a.createElement(S,{key:n.key,draggableId:i,index:t},(function(e,t){return a.createElement(l,null,c(n.type,r(r(r(r({},d),e.draggableProps),e.dragHandleProps),{innerRef:e.innerRef,style:p.item(t.isDragging?e.draggableProps.style:{transform:"none",transition:"none"},t)})),t.isDragging&&c(n.type,r(r({},d),p.placeholder)))}))})),a.createElement("div",{style:{display:"none"}},n.placeholder))}))},useDragDrop:h};export{P as default};
2
2
  //# sourceMappingURL=DragDrop.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as t,__assign as r}from'./../ext/tslib/tslib.es6.js';import e from"react";import{useThemeProps as i}from"../system/utils.js";import{Text as o}from"../Text/Text.js";import{markFuzzyMatchSubstring as n,markStartsWithMatchSubstring as a}from"./utils.js";var m=function(n){var m=n.marker,s=void 0===m?a:m,l=n.query,h=n.text,p=t(n,["marker","query","text"]),u=i("highlight",p),f=u.color,c=void 0===f?"primary":f,g=t(u,["color"]);return e.createElement(o,r({as:"span"},g),s(h,l).map((function(t,r){return e.createElement(o,{key:r,inline:!0,as:t.highlight?"mark":"span",color:t.highlight?c:void 0,backgroundColor:"transparent",fontWeight:"inherit",fontSize:"inherit"},t.text)})))};m.FUZZY=n,m.STARTS_WITH=a;export{m as default};
1
+ import{__rest as t,__assign as r}from'./../ext/tslib/tslib.es6.js';import e from"react";import{useThemeProps as i}from"../system/utils.js";import{Text as o}from"../Text/Text.js";import{markStartsWithMatchSubstring as n,markFuzzyMatchSubstring as a}from"./utils.js";var m=function(a){var m=a.marker,s=void 0===m?n:m,l=a.query,h=a.text,p=t(a,["marker","query","text"]),u=i("highlight",p),f=u.color,c=void 0===f?"primary":f,g=t(u,["color"]);return e.createElement(o,r({as:"span"},g),s(h,l).map((function(t,r){return e.createElement(o,{key:r,inline:!0,as:t.highlight?"mark":"span",color:t.highlight?c:void 0,backgroundColor:"transparent",fontWeight:"inherit",fontSize:"inherit"},t.text)})))};m.FUZZY=a,m.STARTS_WITH=n;export{m as default};
2
2
  //# sourceMappingURL=Highlight.js.map
@@ -1,2 +1,2 @@
1
- import{__extends as e,__spreadArray as t,__rest as n,__assign as o}from'./../ext/tslib/tslib.es6.js';import r from"lodash/isEqual";import i,{Component as l}from"react";import a from"../FocusGroup/FocusGroup.js";import u from"../Icon/Icon.js";import c from"../Input/Input.js";import p from"../ItemList/ItemList.js";import s from"../ItemList/ItemListController.js";import"../ItemList/ItemListItem.js";import d from"../Menu/Menu.js";import{Popover as f}from"../Popover/Popover.js";import m from"../Tooltip/Tooltip.js";import{joinChildren as b,generateId as v,isArray as g,isValueInArray as h,shallowEqual as O,callRef as y}from"../utils.js";import{SELECT_DISPLAY_NAME as P}from"./constants.js";import S from"./Context.js";import w from"./Inline.js";import j from"./Option.js";import V from"./OptionGroup.js";import{toggleValue as I,optionsToElements as x,getSelectedOptions as C,renderOptions as L}from"./utils.js";import k from"./Value.js";function E(e){return i.createElement(d,o({},e,{as:"ul"}))}var D=function(l){function d(){var e=null!==l&&l.apply(this,arguments)||this;return Object.defineProperty(e,"input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"popover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"itemList",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:v("select")}),Object.defineProperty(e,"canCallFocus",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(e,"mounted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(e,"contextValue",{enumerable:!0,configurable:!0,writable:!0,value:{canSelectOption:{current:!1},multiple:e.props.multiple}}),Object.defineProperty(e,"state",{enumerable:!0,configurable:!0,writable:!0,value:{isPopoverOpen:e.props.defaultOpen,isPopoverVisible:!1,selectedOptions:[],uncontrolledValue:void 0===e.props.defaultValue?e.props.multiple?[]:null:e.props.defaultValue}}),Object.defineProperty(e,"safeSetState",{enumerable:!0,configurable:!0,writable:!0,value:function(t,n){e.mounted&&e.setState(t,n)}}),Object.defineProperty(e,"addUserSelectStyle",{enumerable:!0,configurable:!0,writable:!0,value:function(){document.body.style.webkitUserSelect="none"}}),Object.defineProperty(e,"clearUserSelectStyle",{enumerable:!0,configurable:!0,writable:!0,value:function(){document.body.style.webkitUserSelect=""}}),Object.defineProperty(e,"openPopover",{enumerable:!0,configurable:!0,writable:!0,value:function(t){t&&(setTimeout((function(){e.contextValue.canSelectOption.current=!0}),300),setTimeout((function(){var t=e.state.selectedOptions;t.length>0&&e.itemList.scrollItemIntoViewByIndex(t[0].index)}))),e.setState({isPopoverOpen:!0,isPopoverVisible:t})}}),Object.defineProperty(e,"closePopover",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.contextValue.canSelectOption.current=!1,e.safeSetState({isPopoverOpen:!1,isPopoverVisible:!1}),e.itemList&&e.itemList.clearHighlightedIndex()}}),Object.defineProperty(e,"togglePopover",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.state.isPopoverVisible&&e.state.isPopoverOpen?e.closePopover():e.openPopover(!0)}}),Object.defineProperty(e,"getValue",{enumerable:!0,configurable:!0,writable:!0,value:function(){if(e.state.selectedOptions.length>0){var t=e.isControlled()?e.props.value:e.state.uncontrolledValue;return e.props.renderValue(g(t)?e.getSortedSelectedOptions(t):e.state.selectedOptions)}return e.props.emptyValue}}),Object.defineProperty(e,"getHiddenInputValues",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t=e.props.name,n=e.state.selectedOptions;return t&&n.length>0?n.map((function(e,n){return i.createElement("input",{key:n,name:t,type:"hidden",value:e.value})})):null}}),Object.defineProperty(e,"getSelected",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var n=e.props.value,o=e.state.uncontrolledValue;return e.isControlled()?"function"==typeof n?n(t):g(n)?h(n,t)>-1:n===t:g(o)?h(o,t)>-1:o===t}}),Object.defineProperty(e,"handleSelect",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var n=e.props,o=n.multiple,r=n.value,i=t;e.isControlled()?g(r)&&(i=d.toggleValue(e.props.value,t)):(o&&(i=d.toggleValue(e.state.uncontrolledValue,t)),e.setState({uncontrolledValue:i},e.setSelectedOptions)),e.props.onChange&&e.props.onChange({selectedValue:t,value:i}),!o&&e.state.isPopoverVisible&&e.focusInput()}}),Object.defineProperty(e,"highlightFirstSelectedOption",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t=e.state.selectedOptions;t.length>0?e.itemList.setHighlightedIndex(t[0].index):e.itemList.moveHighlightedIndex(1,{contain:!0})}}),Object.defineProperty(e,"highlightLastSelectedOption",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t=e.state.selectedOptions;t.length>0?e.itemList.setHighlightedIndex(t[Math.max(0,t.length-1)].index):e.itemList.moveHighlightedIndex(-1,{contain:!0})}}),Object.defineProperty(e,"focusInput",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.input&&(e.contextValue.canSelectOption.current=!1,e.setState({isPopoverVisible:!1}),e.canCallFocus=!1,e.input.focus(),e.canCallFocus=!0)}}),e}return e(d,l),Object.defineProperty(d.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.mounted=!0,"undefined"!=typeof document&&document.addEventListener("mouseup",this.clearUserSelectStyle),this.setSelectedOptions()}}),Object.defineProperty(d.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isControlled()&&this.setSelectedOptions()}}),Object.defineProperty(d.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.mounted=!1,"undefined"!=typeof document&&(document.removeEventListener("mouseup",this.clearUserSelectStyle),this.clearUserSelectStyle())}}),Object.defineProperty(d.prototype,"isControlled",{enumerable:!1,configurable:!0,writable:!0,value:function(){return void 0!==this.props.value}}),Object.defineProperty(d.prototype,"setSelectedOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props.options?x(this.props.options):this.props.children,t=C(e,this.getSelected);O(this.state.selectedOptions.map((function(e){return e.value})),t.map((function(e){return e.value})))&&r(this.state.selectedOptions.map((function(e){return e.children})),t.map((function(e){return e.children})))||this.setState({selectedOptions:t})}}),Object.defineProperty(d.prototype,"getSortedSelectedOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t([],this.state.selectedOptions,!0).sort((function(t,n){return h(e,t.value)-h(e,n.value)}))}}),Object.defineProperty(d.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props,r=t.children;t.defaultValue;var l=t.disabled;t.emptyValue;var d=t.innerRef;t.defaultOpen;var b=t.keepInView,v=t.lockScrollWhileOpen,g=t.matchWidths,h=t.multiple;t.name;var O=t.onBlur;t.onChange,t.onClick;var P=t.onFocus,w=t.onKeyDown,j=t.onMouseDown,V=t.onMouseUp,I=t.options,C=t.placement,k=t.popoverProps,D=t.renderTo;t.renderValue;var F=t.tooltip;t.value;var U=n(t,["children","defaultValue","disabled","emptyValue","innerRef","defaultOpen","keepInView","lockScrollWhileOpen","matchWidths","multiple","name","onBlur","onChange","onClick","onFocus","onKeyDown","onMouseDown","onMouseUp","options","placement","popoverProps","renderTo","renderValue","tooltip","value"]),H=this.state,T=H.isPopoverOpen,B=H.isPopoverVisible;return i.createElement(S.Provider,{value:this.contextValue},i.createElement(a,{onBlur:this.closePopover},(function(t){var n=t.requestBlur,a=t.setRef;return i.createElement(p,{ref:function(t){e.itemList=t},selected:e.getSelected,onSelect:e.handleSelect},(function(t){var p=t.getItemByText,S=t.getHighlightedIndex,H=t.moveHighlightedIndex,M=t.selectHighlightedItem,W=t.setHighlightedIndex,R=t.selectItemByIndex,K=t.stringSearch;return i.createElement(f,o({},k,{ref:function(t){e.popover=t},innerRef:function(t){a("".concat(e.id,"-popover"))(t)},as:E,tabIndex:-1,"aria-labelledby":e.id,"aria-multiselectable":h,role:"listbox",display:B?void 0:"none",minWidth:16,padding:0,elevation:2,matchWidths:g,lockScrollWhileOpen:!!B&&v,keepInView:b,placement:C,renderTo:D,open:T,onRequestClose:function(){return e.setState({isPopoverVisible:!1})},onBlur:n,onKeyDown:function(t){switch(t.key){case"ArrowUp":t.preventDefault(),B?H(-1,{contain:!0}):(e.openPopover(!0),setTimeout((function(){e.highlightLastSelectedOption()})));break;case"ArrowDown":t.preventDefault(),B?H(1,{contain:!0}):(e.openPopover(!0),setTimeout((function(){e.highlightFirstSelectedOption()})));break;case"Enter":B&&(t.preventDefault(),M());break;case"Escape":T&&!B&&(t.preventDefault(),e.closePopover());break;case" ":t.preventDefault(),null===S()?(e.togglePopover(),setTimeout((function(){e.highlightFirstSelectedOption()}))):B?M():e.openPopover(!0);break;default:K(t).then((function(e){var t=p(e);t&&(B?W(t.props.index):R(t.props.index))}))}},anchorElement:function(t){var r=l?{}:{onBlur:function(e){n(e),O&&O(e)},onFocus:function(t){e.canCallFocus&&e.openPopover(!1),P&&P(t)},onKeyDown:function(e){t.onKeyDown(e),w&&w(e)},onMouseDown:function(t){0===t.button&&(e.addUserSelectStyle(),e.canCallFocus=!1,e.togglePopover()),j&&j(t)},onMouseUp:function(t){e.canCallFocus=!0,V&&V(t)}};return i.createElement(s,null,(function(n){var p=n.getHighlightedItemId;return i.createElement(m,o({triggerOnHover:!B,triggerOnFocus:!B},F),i.createElement(c.InputBox,o({innerRef:function(n){t.innerRef&&y(t.innerRef,n),e.input=n,a("".concat(e.id,"-button"))(n),d&&d(n)},id:e.id,tabIndex:0,role:"combobox",disabled:l,"aria-disabled":l,"aria-haspopup":B,"aria-expanded":B,"aria-activedescendant":p(),cursor:"pointer",userSelect:"none",touchAction:"manipulation",focusChildrenOnFocus:!1,renderRight:i.createElement(u,{name:B?"general.upCaret":"general.downCaret"})},U,r),e.getValue(),e.getHiddenInputValues()))}))}}),L(I?x(I):r))}))})))}}),Object.defineProperty(d,"displayName",{enumerable:!0,configurable:!0,writable:!0,value:P}),Object.defineProperty(d,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{defaultOpen:!1,emptyValue:i.createElement(k,null,"Select an item"),lockScrollWhileOpen:!0,matchWidths:"minimum",renderValue:function(e){return i.createElement(k,null,b(e.map((function(e){return e.children}))))}}}),d}(l);D.Inline=w,D.Option=j,D.OptionGroup=V,D.Value=k,D.toggleValue=I;export{D as default};
1
+ import{__extends as e,__spreadArray as t,__rest as n,__assign as o}from'./../ext/tslib/tslib.es6.js';import r from"lodash/isEqual";import i,{Component as l}from"react";import a from"../FocusGroup/FocusGroup.js";import u from"../Icon/Icon.js";import c from"../Input/Input.js";import p from"../ItemList/ItemList.js";import s from"../ItemList/ItemListController.js";import"../ItemList/ItemListItem.js";import d from"../Menu/Menu.js";import{Popover as f}from"../Popover/Popover.js";import m from"../Tooltip/Tooltip.js";import{generateId as b,isArray as v,isValueInArray as g,shallowEqual as h,callRef as O,joinChildren as y}from"../utils.js";import{SELECT_DISPLAY_NAME as P}from"./constants.js";import S from"./Context.js";import w from"./Inline.js";import j from"./Option.js";import V from"./OptionGroup.js";import{optionsToElements as I,getSelectedOptions as x,renderOptions as C,toggleValue as L}from"./utils.js";import k from"./Value.js";function E(e){return i.createElement(d,o({},e,{as:"ul"}))}var D=function(l){function d(){var e=null!==l&&l.apply(this,arguments)||this;return Object.defineProperty(e,"input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"popover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"itemList",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:b("select")}),Object.defineProperty(e,"canCallFocus",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(e,"mounted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(e,"contextValue",{enumerable:!0,configurable:!0,writable:!0,value:{canSelectOption:{current:!1},multiple:e.props.multiple}}),Object.defineProperty(e,"state",{enumerable:!0,configurable:!0,writable:!0,value:{isPopoverOpen:e.props.defaultOpen,isPopoverVisible:!1,selectedOptions:[],uncontrolledValue:void 0===e.props.defaultValue?e.props.multiple?[]:null:e.props.defaultValue}}),Object.defineProperty(e,"safeSetState",{enumerable:!0,configurable:!0,writable:!0,value:function(t,n){e.mounted&&e.setState(t,n)}}),Object.defineProperty(e,"addUserSelectStyle",{enumerable:!0,configurable:!0,writable:!0,value:function(){document.body.style.webkitUserSelect="none"}}),Object.defineProperty(e,"clearUserSelectStyle",{enumerable:!0,configurable:!0,writable:!0,value:function(){document.body.style.webkitUserSelect=""}}),Object.defineProperty(e,"openPopover",{enumerable:!0,configurable:!0,writable:!0,value:function(t){t&&(setTimeout((function(){e.contextValue.canSelectOption.current=!0}),300),setTimeout((function(){var t=e.state.selectedOptions;t.length>0&&e.itemList.scrollItemIntoViewByIndex(t[0].index)}))),e.setState({isPopoverOpen:!0,isPopoverVisible:t})}}),Object.defineProperty(e,"closePopover",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.contextValue.canSelectOption.current=!1,e.safeSetState({isPopoverOpen:!1,isPopoverVisible:!1}),e.itemList&&e.itemList.clearHighlightedIndex()}}),Object.defineProperty(e,"togglePopover",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.state.isPopoverVisible&&e.state.isPopoverOpen?e.closePopover():e.openPopover(!0)}}),Object.defineProperty(e,"getValue",{enumerable:!0,configurable:!0,writable:!0,value:function(){if(e.state.selectedOptions.length>0){var t=e.isControlled()?e.props.value:e.state.uncontrolledValue;return e.props.renderValue(v(t)?e.getSortedSelectedOptions(t):e.state.selectedOptions)}return e.props.emptyValue}}),Object.defineProperty(e,"getHiddenInputValues",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t=e.props.name,n=e.state.selectedOptions;return t&&n.length>0?n.map((function(e,n){return i.createElement("input",{key:n,name:t,type:"hidden",value:e.value})})):null}}),Object.defineProperty(e,"getSelected",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var n=e.props.value,o=e.state.uncontrolledValue;return e.isControlled()?"function"==typeof n?n(t):v(n)?g(n,t)>-1:n===t:v(o)?g(o,t)>-1:o===t}}),Object.defineProperty(e,"handleSelect",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var n=e.props,o=n.multiple,r=n.value,i=t;e.isControlled()?v(r)&&(i=d.toggleValue(e.props.value,t)):(o&&(i=d.toggleValue(e.state.uncontrolledValue,t)),e.setState({uncontrolledValue:i},e.setSelectedOptions)),e.props.onChange&&e.props.onChange({selectedValue:t,value:i}),!o&&e.state.isPopoverVisible&&e.focusInput()}}),Object.defineProperty(e,"highlightFirstSelectedOption",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t=e.state.selectedOptions;t.length>0?e.itemList.setHighlightedIndex(t[0].index):e.itemList.moveHighlightedIndex(1,{contain:!0})}}),Object.defineProperty(e,"highlightLastSelectedOption",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t=e.state.selectedOptions;t.length>0?e.itemList.setHighlightedIndex(t[Math.max(0,t.length-1)].index):e.itemList.moveHighlightedIndex(-1,{contain:!0})}}),Object.defineProperty(e,"focusInput",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.input&&(e.contextValue.canSelectOption.current=!1,e.setState({isPopoverVisible:!1}),e.canCallFocus=!1,e.input.focus(),e.canCallFocus=!0)}}),e}return e(d,l),Object.defineProperty(d.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.mounted=!0,"undefined"!=typeof document&&document.addEventListener("mouseup",this.clearUserSelectStyle),this.setSelectedOptions()}}),Object.defineProperty(d.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isControlled()&&this.setSelectedOptions()}}),Object.defineProperty(d.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.mounted=!1,"undefined"!=typeof document&&(document.removeEventListener("mouseup",this.clearUserSelectStyle),this.clearUserSelectStyle())}}),Object.defineProperty(d.prototype,"isControlled",{enumerable:!1,configurable:!0,writable:!0,value:function(){return void 0!==this.props.value}}),Object.defineProperty(d.prototype,"setSelectedOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props.options?I(this.props.options):this.props.children,t=x(e,this.getSelected);h(this.state.selectedOptions.map((function(e){return e.value})),t.map((function(e){return e.value})))&&r(this.state.selectedOptions.map((function(e){return e.children})),t.map((function(e){return e.children})))||this.setState({selectedOptions:t})}}),Object.defineProperty(d.prototype,"getSortedSelectedOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t([],this.state.selectedOptions,!0).sort((function(t,n){return g(e,t.value)-g(e,n.value)}))}}),Object.defineProperty(d.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props,r=t.children;t.defaultValue;var l=t.disabled;t.emptyValue;var d=t.innerRef;t.defaultOpen;var b=t.keepInView,v=t.lockScrollWhileOpen,g=t.matchWidths,h=t.multiple;t.name;var y=t.onBlur;t.onChange,t.onClick;var P=t.onFocus,w=t.onKeyDown,j=t.onMouseDown,V=t.onMouseUp,x=t.options,L=t.placement,k=t.popoverProps,D=t.renderTo;t.renderValue;var F=t.tooltip;t.value;var U=n(t,["children","defaultValue","disabled","emptyValue","innerRef","defaultOpen","keepInView","lockScrollWhileOpen","matchWidths","multiple","name","onBlur","onChange","onClick","onFocus","onKeyDown","onMouseDown","onMouseUp","options","placement","popoverProps","renderTo","renderValue","tooltip","value"]),H=this.state,T=H.isPopoverOpen,B=H.isPopoverVisible;return i.createElement(S.Provider,{value:this.contextValue},i.createElement(a,{onBlur:this.closePopover},(function(t){var n=t.requestBlur,a=t.setRef;return i.createElement(p,{ref:function(t){e.itemList=t},selected:e.getSelected,onSelect:e.handleSelect},(function(t){var p=t.getItemByText,S=t.getHighlightedIndex,H=t.moveHighlightedIndex,M=t.selectHighlightedItem,W=t.setHighlightedIndex,R=t.selectItemByIndex,K=t.stringSearch;return i.createElement(f,o({},k,{ref:function(t){e.popover=t},innerRef:function(t){a("".concat(e.id,"-popover"))(t)},as:E,tabIndex:-1,"aria-labelledby":e.id,"aria-multiselectable":h,role:"listbox",display:B?void 0:"none",minWidth:16,padding:0,elevation:2,matchWidths:g,lockScrollWhileOpen:!!B&&v,keepInView:b,placement:L,renderTo:D,open:T,onRequestClose:function(){return e.setState({isPopoverVisible:!1})},onBlur:n,onKeyDown:function(t){switch(t.key){case"ArrowUp":t.preventDefault(),B?H(-1,{contain:!0}):(e.openPopover(!0),setTimeout((function(){e.highlightLastSelectedOption()})));break;case"ArrowDown":t.preventDefault(),B?H(1,{contain:!0}):(e.openPopover(!0),setTimeout((function(){e.highlightFirstSelectedOption()})));break;case"Enter":B&&(t.preventDefault(),M());break;case"Escape":T&&!B&&(t.preventDefault(),e.closePopover());break;case" ":t.preventDefault(),null===S()?(e.togglePopover(),setTimeout((function(){e.highlightFirstSelectedOption()}))):B?M():e.openPopover(!0);break;default:K(t).then((function(e){var t=p(e);t&&(B?W(t.props.index):R(t.props.index))}))}},anchorElement:function(t){var r=l?{}:{onBlur:function(e){n(e),y&&y(e)},onFocus:function(t){e.canCallFocus&&e.openPopover(!1),P&&P(t)},onKeyDown:function(e){t.onKeyDown(e),w&&w(e)},onMouseDown:function(t){0===t.button&&(e.addUserSelectStyle(),e.canCallFocus=!1,e.togglePopover()),j&&j(t)},onMouseUp:function(t){e.canCallFocus=!0,V&&V(t)}};return i.createElement(s,null,(function(n){var p=n.getHighlightedItemId;return i.createElement(m,o({triggerOnHover:!B,triggerOnFocus:!B},F),i.createElement(c.InputBox,o({innerRef:function(n){t.innerRef&&O(t.innerRef,n),e.input=n,a("".concat(e.id,"-button"))(n),d&&d(n)},id:e.id,tabIndex:0,role:"combobox",disabled:l,"aria-disabled":l,"aria-haspopup":B,"aria-expanded":B,"aria-activedescendant":p(),cursor:"pointer",userSelect:"none",touchAction:"manipulation",focusChildrenOnFocus:!1,renderRight:i.createElement(u,{name:B?"general.upCaret":"general.downCaret"})},U,r),e.getValue(),e.getHiddenInputValues()))}))}}),C(x?I(x):r))}))})))}}),Object.defineProperty(d,"displayName",{enumerable:!0,configurable:!0,writable:!0,value:P}),Object.defineProperty(d,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{defaultOpen:!1,emptyValue:i.createElement(k,null,"Select an item"),lockScrollWhileOpen:!0,matchWidths:"minimum",renderValue:function(e){return i.createElement(k,null,y(e.map((function(e){return e.children}))))}}}),d}(l);D.Inline=w,D.Option=j,D.OptionGroup=V,D.Value=k,D.toggleValue=L;export{D as default};
2
2
  //# sourceMappingURL=Select.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from'./../ext/tslib/tslib.es6.js';import e from"react";import{Box as t}from"../Box/Box.js";import{designTokens as i}from"../designTokens/index.js";import r from"../Icon/Icon.js";import{StackView as a}from"../StackView/StackView.js";import{convertToBaseUnit as d,useThemeValue as n}from"../system/utils.js";import{Text as l}from"../Text/Text.js";var c=i.tabNav,s=c.tab,p=c.tab,m=p.desktop,b=p.mobile,g=function(i){var c=i.badge,p=void 0===c?void 0:c,g=i.disabled,f=void 0!==g&&g,v=i.iconLeft,u=void 0===v?void 0:v,h=i.iconRight,x=void 0===h?void 0:h,C=i.isMobile,T=void 0!==C&&C,k=i.isSelected,S=void 0!==k&&k,B=i.label,z=i.onClick,j=void 0===z?void 0:z,w=i.selectedTabBackgroundColor,y={color:s.iconColor},E=o(o({},y),"string"==typeof u?{name:u}:u),N=o(o({},y),"string"==typeof x?{name:x}:x),I=o({backgroundColor:S&&!f?w:m.defaultBackgroundColor,fontSize:"".concat(m.fontSize,"px"),height:d(m.height),paddingHorizontal:d(m.paddingX),radiusTop:m.borderRadiusTop},!f&&{active:{backgroundColor:w,color:m.activeTextColor},hover:{backgroundColor:w,color:m.hoverTextColor}}),W={borderBottomColor:S?"primary":"transparent",borderBottomStyle:"solid",borderBottomWidth:b.borderBottomWidth,fontSize:"".concat(b.fontSize,"px"),height:d(b.height),paddingBottom:d(b.paddingBottom),paddingTop:d(b.paddingTop)},H=n("tabNav"),R=null==H?void 0:H.tab;return e.createElement(a,o({as:"button",alignment:"center","aria-disabled":f,axis:"horizontal",color:f?s.disabledTextColor:S?s.selectedTextColor:s.textColor,cursor:f?"not-allowed":S?"default":"pointer",role:"tab",spacing:1,tabIndex:0,userSelect:"none",onClick:j},T?W:I,R),u&&e.createElement(r,o({},E)),e.createElement(t,{as:"span",css:{color:"inherit",display:"block",flex:1,fontSize:"inherit",fontWeight:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},B),p&&e.createElement(a,{backgroundColor:s.badgeBackgroundColor,distribution:"center",paddingHorizontal:1,radius:"pill"},e.createElement(l,{color:s.badgeTextColor,size:"".concat(s.badgeFontSize,"px")},p)),x&&e.createElement(r,o({},N)))};g.displayName="TabNav.Tab";export{g as Tab,g as default};
1
+ import{__assign as o}from'./../ext/tslib/tslib.es6.js';import e from"react";import{Box as t}from"../Box/Box.js";import{designTokens as i}from"../designTokens/index.js";import r from"../Icon/Icon.js";import{StackView as a}from"../StackView/StackView.js";import{convertToBaseUnit as n,useThemeValue as d}from"../system/utils.js";import{Text as l}from"../Text/Text.js";var c=i.tabNav,s=c.tab,p=c.tab,m=p.desktop,b=p.mobile,g=function(i){var c=i.badge,p=void 0===c?void 0:c,g=i.disabled,f=void 0!==g&&g,v=i.iconLeft,u=void 0===v?void 0:v,h=i.iconRight,x=void 0===h?void 0:h,C=i.isMobile,T=void 0!==C&&C,k=i.isSelected,S=void 0!==k&&k,B=i.label,z=i.onClick,j=void 0===z?void 0:z,w=i.selectedTabBackgroundColor,y={color:s.iconColor},E=o(o({},y),"string"==typeof u?{name:u}:u),N=o(o({},y),"string"==typeof x?{name:x}:x),I=o({backgroundColor:S&&!f?w:m.defaultBackgroundColor,fontSize:"".concat(m.fontSize,"px"),height:n(m.height),paddingHorizontal:n(m.paddingX),radiusTop:m.borderRadiusTop},!f&&{active:{backgroundColor:w,color:m.activeTextColor},hover:{backgroundColor:w,color:m.hoverTextColor}}),W={borderBottomColor:S?"primary":"transparent",borderBottomStyle:"solid",borderBottomWidth:b.borderBottomWidth,fontSize:"".concat(b.fontSize,"px"),height:n(b.height),paddingBottom:n(b.paddingBottom),paddingTop:n(b.paddingTop)},H=d("tabNav"),R=null==H?void 0:H.tab;return e.createElement(a,o({as:"button",alignment:"center","aria-disabled":f,axis:"horizontal",color:f?s.disabledTextColor:S?s.selectedTextColor:s.textColor,cursor:f?"not-allowed":S?"default":"pointer",role:"tab",spacing:1,tabIndex:0,userSelect:"none",onClick:j},T?W:I,R),u&&e.createElement(r,o({},E)),e.createElement(t,{as:"span",css:{color:"inherit",display:"block",flex:1,fontSize:"inherit",fontWeight:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},B),p&&e.createElement(a,{backgroundColor:s.badgeBackgroundColor,distribution:"center",paddingHorizontal:1,radius:"pill"},e.createElement(l,{color:s.badgeTextColor,size:"".concat(s.badgeFontSize,"px")},p)),x&&e.createElement(r,o({},N)))};g.displayName="TabNav.Tab";export{g as Tab};
2
2
  //# sourceMappingURL=Tab.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from'./../ext/tslib/tslib.es6.js';import r from"react";import{designTokens as t}from"../designTokens/index.js";import"mousetrap";import"../hooks/use-measure.js";import{useMediaQuery as e}from"../hooks/use-media-query.js";import{StackView as a}from"../StackView/StackView.js";import{useThemeValue as i,convertToBaseUnit as s}from"../system/utils.js";import{Tab as d}from"./Tab.js";var m=t.tabNav,n=m.desktop,l=m.mobile,p=function(t){var m=t.selectedTabBackgroundColor,p=void 0===m?n.selectedTabBackgroundColor:m,b=t.tabs,c=e("(max-width: 600px)"),u={paddingHorizontal:s(n.paddingX),spacing:s(n.spacing)},g={backgroundColor:l.backgroundColor,borderBottomColor:l.borderBottomColor,borderBottomStyle:l.borderBottomStyle,borderBottomWidth:l.borderBottomWidth,paddingHorizontal:s(l.paddingX),spacing:s(l.spacing)},k=i("tabNav");return r.createElement(a,o({axis:"horizontal",overflowX:"auto",role:"tablist",spacing:2.5,width:"100%"},c?g:u,k),b.map((function(t,e){return r.createElement(d,o({key:e,isMobile:c,selectedTabBackgroundColor:p},t))})))};export{p as TabNav,p as default};
1
+ import{__assign as o}from'./../ext/tslib/tslib.es6.js';import r from"react";import{designTokens as t}from"../designTokens/index.js";import"mousetrap";import"../hooks/use-measure.js";import{useMediaQuery as e}from"../hooks/use-media-query.js";import{StackView as a}from"../StackView/StackView.js";import{useThemeValue as i,convertToBaseUnit as s}from"../system/utils.js";import{Tab as d}from"./Tab.js";var m=t.tabNav,n=m.desktop,l=m.mobile,p=function(t){var m=t.selectedTabBackgroundColor,p=void 0===m?n.selectedTabBackgroundColor:m,b=t.tabs,c=e("(max-width: 600px)"),u={paddingHorizontal:s(n.paddingX),spacing:s(n.spacing)},g={backgroundColor:l.backgroundColor,borderBottomColor:l.borderBottomColor,borderBottomStyle:l.borderBottomStyle,borderBottomWidth:l.borderBottomWidth,paddingHorizontal:s(l.paddingX),spacing:s(l.spacing)},k=i("tabNav");return r.createElement(a,o({axis:"horizontal",overflowX:"auto",role:"tablist",spacing:2.5,width:"100%"},c?g:u,k),b.map((function(t,e){return r.createElement(d,o({key:e,isMobile:c,selectedTabBackgroundColor:p},t))})))};export{p as TabNav};
2
2
  //# sourceMappingURL=TabNav.js.map
@@ -1,2 +1,2 @@
1
- import{__extends as e,__assign as t,__rest as r,__spreadArray as o}from'./../ext/tslib/tslib.es6.js';import{Global as n}from"@emotion/react";import i from"lodash/camelCase";import l from"lodash/snakeCase";import a,{Children as u,Fragment as c,PureComponent as d}from"react";import{Button as s}from"../Button/Button.js";import m from"../DragDrop/DragDrop.js";import f from"../HeadingUppercase/HeadingUppercase.js";import{useHover as p}from"../hooks/use-hover.js";import"mousetrap";import"../hooks/use-measure.js";import g from"../Pagination/Pagination.js";import{Spinner as b}from"../Spinner/Spinner.js";import{StackView as h}from"../StackView/StackView.js";import v from"../Summary/Summary.js";import{reorderArray as S,range as w}from"../utils.js";import y from"../vendor/react-measure/Measure.js";import"../vendor/react-measure/Viewport.js";import C from"./AvatarCell.js";import j from"./BodyCell.js";import R from"./BodyInnerCell.js";import P from"./BodyRow.js";import O from"./CheckboxCell.js";import k from"./ColumnPicker.js";import I from"./DateCell.js";import D from"./DragCell.js";import H from"./DragHandle.js";import x from"./HeaderCell.js";import E from"./HeaderInnerCell.js";import A from"./SubRowToggleCell.js";import T from"./TableBase.js";import W from"./TableWrapper.js";var M="undefined"!=typeof window&&window.CSS&&window.CSS.supports;function B(e){var t=e.children,r=p(),o=r.hover;return t({bindHover:r.hoverProps,isHover:o})}var z=function(d){function p(e){var r=d.call(this,e)||this;return Object.defineProperty(r,"handleSortStart",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.setState({isSorting:!0})}}),Object.defineProperty(r,"handleSortEnd",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.source,o=e.destination;r.setState({isSorting:!1}),r.props.onRowSort(S({endIndex:o.index,list:r.props.data,startIndex:t.index}))}}),Object.defineProperty(r,"handleColumnSort",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var o=r.getDefaultSort(r.props);r.setState((function(n){var i=t({},n.currentSort);if(i.columnId===e?i.direction=p.getOppositeSortDirection(i.direction):(i.columnId=e,i.direction=r.props.defaultSortDirection),i.order=r.getSortOrder({columnId:i.columnId,direction:i.direction}),r.props.onColumnSort){var l=i.columnId?i:o;r.props.onColumnSort(l)}return{currentSort:i}}))}}),Object.defineProperty(r,"getBodyCellMouseHandlers",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return r.props.highlightColumnOnHover?{onMouseOut:function(){r.setState({highlightedColumnIndex:null})},onMouseOver:function(){r.setState({highlightedColumnIndex:e})}}:{}}}),Object.defineProperty(r,"isAnySubRowOpen",{enumerable:!0,configurable:!0,writable:!0,value:function(){return r.state.openSubRowIndices.length>0}}),Object.defineProperty(r,"handleSubRowToggleAll",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.setState({openSubRowIndices:r.state.openSubRowIndices.length>0?[]:w(0,r.props.data.length)})}}),Object.defineProperty(r,"isSubRowOpen",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return r.state.openSubRowIndices.indexOf(e)>-1}}),Object.defineProperty(r,"handleSubRowToggle",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.setState((function(t){var r=o([],t.openSubRowIndices,!0),n=r.indexOf(e);return n>-1?r.splice(n,1):r.push(e),{openSubRowIndices:r}}))}}),Object.defineProperty(r,"handleMeasure",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=r.getColumns(),n=(t.length-1)/2,i=0;r.props.subRowData&&(i+=48),r.props.onRowSort&&(i+=48);var l=e?t.map((function(t,r){var o=e["".concat(r,"-0")];return o?o.height:0})):[],a=e?Math.max.apply(Math,o(o([],l,!0),[r.props.compactHeader?32:48],!1)):null,u=e?Object.keys(e).reduce((function(r,o){var n=o.split("-")[0],i=e[o],l=t[n];if(l){var a=l.width||i.width;r[n]||(r[n]=[]),r[n].push(a)}return r}),[]).map((function(e){return Math.max.apply(Math,e)})):[],c=e?u.reduce((function(e,t,r){return e+t}),i):null,d=M?t.reduce((function(e,t,r){return t.sticky&&(r<n?e.left+=u[r]:e.right+=u[r]),e}),{left:i,right:0}):{left:0,right:0};r.setState({columnWidths:u,getLeftOffset:function(e,t){return M&&e.sticky&&t<n?u.reduce((function(e,r,o){return o<t?e+r:e}),i)||i:void 0},getRightOffset:function(e,t){return M&&e.sticky&&t>=n?u.reduce((function(e,r,o){return o>t?e+r:e}),0)||0:void 0},headerHeight:a,headerHeights:l,offsets:d,rowWidth:c})}}),r.state={columnWidths:[],currentSort:r.getDefaultSort(e),getLeftOffset:function(){return null},getRightOffset:function(){return null},headerHeight:-1,headerHeights:[],highlightedColumnIndex:null,isSorting:!1,offsets:{left:0,right:0},openSubRowIndices:[],rowWidth:-1},r}return e(p,d),Object.defineProperty(p,"getOppositeSortDirection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===p.ASC?p.DESC:p.ASC}}),Object.defineProperty(p,"getIconDirection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===p.ASC?"general.upCaret":"general.downCaret"}}),Object.defineProperty(p.prototype,"getSortOrder",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.columnId,r=e.direction;return"".concat(r===p.ASC?"":"-").concat(l(t))}}),Object.defineProperty(p.prototype,"parseSortOrder",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="-"===e[0];return{columnId:i(t?e.substring(1):e),direction:t?p.DESC:p.ASC}}}),Object.defineProperty(p.prototype,"getDefaultSort",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.defaultSortColumnId,o=e.defaultSortDirection,n=e.defaultSortOrder,i=n?this.parseSortOrder(n):{columnId:r,direction:o};return t(t({},i),{order:this.getSortOrder(i)})}}),Object.defineProperty(p.prototype,"getColumns",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.props.columns.filter((function(t){return"object"==typeof t&&null!=t&&(t.alwaysVisible||-1===e.props.hiddenColumnIds.indexOf(t.id))})).map((function(e){e.alwaysVisible;var t=e.cell,o=e.divider,n=e.header,i=e.id,l=e.label,a=e.sortable,u=e.sticky,c=e.subRowCell,d=e.truncate,s=e.vertical,m=e.width;return{cell:t,columnProps:r(e,["alwaysVisible","cell","divider","header","id","label","sortable","sticky","subRowCell","truncate","vertical","width"]),divider:o,header:n,id:i,label:l,sortable:a,sticky:u,subRowCell:c,truncate:d,vertical:s,width:m}}))}}),Object.defineProperty(p.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,i=this.props,l=i.caption;i.children;var d=i.columnDividers;i.columns;var S=i.compactHeader,w=i.currentPage,C=i.data,O=void 0===C?[]:C;i.defaultSortColumnId;var k=i.defaultSortDirection;i.defaultSortOrder;var I=i.empty,M=i.getRowLink,z=i.headerColor;i.hiddenColumnIds,i.highlightColumnOnHover,i.innerRef;var V=i.keyboardShortcuts;i.layout;var L=i.loading,U=i.loadingTitle,K=i.minHeight,N=i.minRowHeight;i.onColumnSort;var _=i.onPageChange,q=i.onRowSort,F=i.rowDividers,G=i.subRowData,J=i.totalPages,Q=r(i,["caption","children","columnDividers","columns","compactHeader","currentPage","data","defaultSortColumnId","defaultSortDirection","defaultSortOrder","empty","getRowLink","headerColor","hiddenColumnIds","highlightColumnOnHover","innerRef","keyboardShortcuts","layout","loading","loadingTitle","minHeight","minRowHeight","onColumnSort","onPageChange","onRowSort","rowDividers","subRowData","totalPages"]),X=this.state,Y=X.highlightedColumnIndex,Z=X.currentSort,$=X.isSorting,ee=X.headerHeight,te=X.columnWidths,re=X.rowWidth,oe=X.offsets,ne=X.getLeftOffset,ie=X.getRightOffset,le=this.getColumns(),ae=L||O.length<=0;return a.createElement(W,t({},Q,{position:"relative"}),a.createElement(n,{styles:{html:{userSelect:this.state.isSorting?"none":null}}}),ae?a.createElement(h,{grow:1,alignment:"center",distribution:"center",minHeight:K,paddingVertical:8},L?a.createElement(v,{image:a.createElement(b,{size:"xl",color:"primary"}),title:U}):I):a.createElement(y,{updateOnMeasure:!1,onMeasure:this.handleMeasure},(function(r){var n=r.measureRef,i=u.toArray(o([G&&a.createElement(A,{toggled:e.isAnySubRowOpen(),height:ee+"px",onClick:e.handleSubRowToggleAll}),q&&a.createElement(D,{role:"columnheader",height:ee+"px",backgroundColor:"inherit"})],le.map((function(r,o){return a.createElement(B,{key:o},(function(i){var l=i.bindHover,u=i.isHover,c=te[o],d=t(t(t({},r.columnProps),l),{cursor:r.sortable?"pointer":"default",justifyContent:r.vertical?"start":r.columnProps.justifyContent,onClick:function(t){r.sortable&&e.handleColumnSort(r.id),r.columnProps&&r.columnProps.onClick&&r.columnProps.onClick(t)},position:r.sticky?"sticky":"relative",style:{height:r.vertical?ee+16:ee,left:ne(r,o),right:ie(r,o),width:c},zIndex:r.sticky?35:r.columnProps.zIndex});return r.sortable&&(d["aria-sort"]=Z.columnId===r.id?"ASC"===Z.direction?"ascending":"descending":"none"),a.createElement(x,t({},d),a.createElement(E,{innerRef:n("".concat(o,"-0")),height:S?4:6,transform:r.vertical&&"translate(".concat(r.width/2,"px, ").concat(16,"px) rotate(-90deg)")},"string"==typeof r.header?a.createElement(f,{truncate:!0,color:"grey-7",fontSize:S?"11px":"12px",cursor:r.sortable?"pointer":"default"},r.header):"function"==typeof r.header?r.header(o):r.header,r.sortable&&a.createElement(s,{title:"sort table",theme:!1,icon:{name:p.getIconDirection(Z.columnId===r.id?Z.direction:k)},size:"xs",opacity:Z.columnId===r.id?1:u?.35:0})))}))})),!0)),g=function(r,o){var i=o.subRowProps,l=void 0===i?{}:i,c=o.shouldRenderSubRowData,s=o.shouldRenderSubRowToggle,m=void 0!==s&&s;return Object.keys(r).map((function(o,i){var s=e.isSubRowOpen(i),f=r[o],p={index:i,key:i,keyboardShortcuts:V,onRowSort:q,row:f,rowIndex:i,style:{minWidth:re}},b={};if(M){var h=function(){var e=M(f);"string"==typeof e&&(window.location=e)};b.tabIndex=0,b.role="link",b.cursor="pointer",b.focus={backgroundColor:"hsla(0,0%,97%,1)"},b.hover={backgroundColor:"hsla(0,0%,97%,1)"},b.onClick=h,b.onKeyDown=function(e){"Enter"===e.key&&h()}}return $&&(b.pointerEvents="none"),(F&&0!==i||m)&&(b.borderTopWidth=1),[a.createElement(P,t({},p,b,l),(function(r){var o=r.isRowHovered,l=r.dragHandleProps;return u.toArray([G&&(m?a.createElement(A,{contentsHidden:!0}):a.createElement(A,{toggled:s,rowIndex:i,onClick:function(t){t.stopPropagation(),e.handleSubRowToggle(i)}})),q&&a.createElement(D,t({},l),a.createElement(H,null)),le.map((function(r,l){var u=te[l],c=m&&void 0!==r.subRowCell?r.subRowCell:r.cell;return a.createElement(j,t({key:l},r.columnProps,e.getBodyCellMouseHandlers(l),{position:r.sticky?"sticky":void 0,justifyContent:r.vertical?"center":r.columnProps.justifyContent,minHeight:m?5:N,borderColor:"grey-3",borderLeftWidth:!1!==r.divider&&(d&&(q||0!==l)?1:void 0),backgroundColor:Y===l?"grey-0":"inherit",color:m?"grey-9":"foreground",zIndex:r.sticky?35:void 0,style:t({left:ne(r,l),right:ie(r,l),width:u},r.columnProps.style)}),a.createElement(R,{innerRef:void 0===r.width?n("".concat(l,"-").concat(i+1),{formula:function(e){return{width:e.offsetWidth}}}):null,column:r,justifyContent:r.vertical?"center":r.columnProps.justifyContent},c&&("string"==typeof c?f[c]:c(f,{columnIndex:l,isRowHovered:o,rowIndex:i}))))}))])})),c&&s?g(G(f),{shouldRenderSubRowData:!1,shouldRenderSubRowToggle:!0,subRowProps:{backgroundColor:"hsla(0,0%,99%,1)"}}):null]}))},b=function(e){return a.createElement(T,t({},e,{columnWidths:o([G&&48,q&&48],te,!0).filter(Boolean),rowWidth:re,minHeight:K,offsets:oe,caption:l,header:i,headerColor:z,headerHeight:ee,body:g(O,{shouldRenderSubRowData:!!G})}))};return q?a.createElement(m.Provider,{onDragStart:e.handleSortStart,onDragEnd:e.handleSortEnd},a.createElement(m.Droppable,{droppableId:"table"},(function(e){return a.createElement(c,null,b(t({innerRef:e.innerRef},e.droppableProps)),e.placeholder)}))):b({})})),!ae&&a.createElement(g,{currentPage:w,totalPages:J,onPageChange:_,position:"sticky",bottom:0,zIndex:35,marginTop:"-1px",backgroundColor:"surface",borderTopWidth:1,borderTopColor:"grey-3",css:{"@media print":{position:"relative"}}}))}}),Object.defineProperty(p,"ColumnPicker",{enumerable:!0,configurable:!0,writable:!0,value:k}),Object.defineProperty(p,"AvatarCell",{enumerable:!0,configurable:!0,writable:!0,value:C}),Object.defineProperty(p,"CheckboxCell",{enumerable:!0,configurable:!0,writable:!0,value:O}),Object.defineProperty(p,"DateCell",{enumerable:!0,configurable:!0,writable:!0,value:I}),Object.defineProperty(p,"ASC",{enumerable:!0,configurable:!0,writable:!0,value:"ASC"}),Object.defineProperty(p,"DESC",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(p,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{currentPage:0,defaultSortColumnId:null,defaultSortDirection:p.ASC,defaultSortOrder:null,empty:"No results",headerColor:"grey-0",hiddenColumnIds:[],minHeight:48,minRowHeight:8,onPageChange:function(){return null},rowDividers:!0,totalPages:0}}),p}(d);export{z as default};
1
+ import{__extends as e,__assign as t,__spreadArray as r,__rest as o}from'./../ext/tslib/tslib.es6.js';import{Global as n}from"@emotion/react";import i from"lodash/camelCase";import l from"lodash/snakeCase";import a,{Children as u,Fragment as c,PureComponent as d}from"react";import{Button as s}from"../Button/Button.js";import m from"../DragDrop/DragDrop.js";import f from"../HeadingUppercase/HeadingUppercase.js";import{useHover as p}from"../hooks/use-hover.js";import"mousetrap";import"../hooks/use-measure.js";import g from"../Pagination/Pagination.js";import{Spinner as b}from"../Spinner/Spinner.js";import{StackView as h}from"../StackView/StackView.js";import v from"../Summary/Summary.js";import{reorderArray as S,range as w}from"../utils.js";import y from"../vendor/react-measure/Measure.js";import"../vendor/react-measure/Viewport.js";import C from"./AvatarCell.js";import j from"./BodyCell.js";import R from"./BodyInnerCell.js";import P from"./BodyRow.js";import O from"./CheckboxCell.js";import k from"./ColumnPicker.js";import I from"./DateCell.js";import D from"./DragCell.js";import H from"./DragHandle.js";import x from"./HeaderCell.js";import E from"./HeaderInnerCell.js";import A from"./SubRowToggleCell.js";import T from"./TableBase.js";import W from"./TableWrapper.js";var M="undefined"!=typeof window&&window.CSS&&window.CSS.supports;function B(e){var t=e.children,r=p(),o=r.hover;return t({bindHover:r.hoverProps,isHover:o})}var z=function(d){function p(e){var o=d.call(this,e)||this;return Object.defineProperty(o,"handleSortStart",{enumerable:!0,configurable:!0,writable:!0,value:function(){o.setState({isSorting:!0})}}),Object.defineProperty(o,"handleSortEnd",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.source,r=e.destination;o.setState({isSorting:!1}),o.props.onRowSort(S({endIndex:r.index,list:o.props.data,startIndex:t.index}))}}),Object.defineProperty(o,"handleColumnSort",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r=o.getDefaultSort(o.props);o.setState((function(n){var i=t({},n.currentSort);if(i.columnId===e?i.direction=p.getOppositeSortDirection(i.direction):(i.columnId=e,i.direction=o.props.defaultSortDirection),i.order=o.getSortOrder({columnId:i.columnId,direction:i.direction}),o.props.onColumnSort){var l=i.columnId?i:r;o.props.onColumnSort(l)}return{currentSort:i}}))}}),Object.defineProperty(o,"getBodyCellMouseHandlers",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return o.props.highlightColumnOnHover?{onMouseOut:function(){o.setState({highlightedColumnIndex:null})},onMouseOver:function(){o.setState({highlightedColumnIndex:e})}}:{}}}),Object.defineProperty(o,"isAnySubRowOpen",{enumerable:!0,configurable:!0,writable:!0,value:function(){return o.state.openSubRowIndices.length>0}}),Object.defineProperty(o,"handleSubRowToggleAll",{enumerable:!0,configurable:!0,writable:!0,value:function(){o.setState({openSubRowIndices:o.state.openSubRowIndices.length>0?[]:w(0,o.props.data.length)})}}),Object.defineProperty(o,"isSubRowOpen",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return o.state.openSubRowIndices.indexOf(e)>-1}}),Object.defineProperty(o,"handleSubRowToggle",{enumerable:!0,configurable:!0,writable:!0,value:function(e){o.setState((function(t){var o=r([],t.openSubRowIndices,!0),n=o.indexOf(e);return n>-1?o.splice(n,1):o.push(e),{openSubRowIndices:o}}))}}),Object.defineProperty(o,"handleMeasure",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=o.getColumns(),n=(t.length-1)/2,i=0;o.props.subRowData&&(i+=48),o.props.onRowSort&&(i+=48);var l=e?t.map((function(t,r){var o=e["".concat(r,"-0")];return o?o.height:0})):[],a=e?Math.max.apply(Math,r(r([],l,!0),[o.props.compactHeader?32:48],!1)):null,u=e?Object.keys(e).reduce((function(r,o){var n=o.split("-")[0],i=e[o],l=t[n];if(l){var a=l.width||i.width;r[n]||(r[n]=[]),r[n].push(a)}return r}),[]).map((function(e){return Math.max.apply(Math,e)})):[],c=e?u.reduce((function(e,t,r){return e+t}),i):null,d=M?t.reduce((function(e,t,r){return t.sticky&&(r<n?e.left+=u[r]:e.right+=u[r]),e}),{left:i,right:0}):{left:0,right:0};o.setState({columnWidths:u,getLeftOffset:function(e,t){return M&&e.sticky&&t<n?u.reduce((function(e,r,o){return o<t?e+r:e}),i)||i:void 0},getRightOffset:function(e,t){return M&&e.sticky&&t>=n?u.reduce((function(e,r,o){return o>t?e+r:e}),0)||0:void 0},headerHeight:a,headerHeights:l,offsets:d,rowWidth:c})}}),o.state={columnWidths:[],currentSort:o.getDefaultSort(e),getLeftOffset:function(){return null},getRightOffset:function(){return null},headerHeight:-1,headerHeights:[],highlightedColumnIndex:null,isSorting:!1,offsets:{left:0,right:0},openSubRowIndices:[],rowWidth:-1},o}return e(p,d),Object.defineProperty(p,"getOppositeSortDirection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===p.ASC?p.DESC:p.ASC}}),Object.defineProperty(p,"getIconDirection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===p.ASC?"general.upCaret":"general.downCaret"}}),Object.defineProperty(p.prototype,"getSortOrder",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.columnId,r=e.direction;return"".concat(r===p.ASC?"":"-").concat(l(t))}}),Object.defineProperty(p.prototype,"parseSortOrder",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="-"===e[0];return{columnId:i(t?e.substring(1):e),direction:t?p.DESC:p.ASC}}}),Object.defineProperty(p.prototype,"getDefaultSort",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.defaultSortColumnId,o=e.defaultSortDirection,n=e.defaultSortOrder,i=n?this.parseSortOrder(n):{columnId:r,direction:o};return t(t({},i),{order:this.getSortOrder(i)})}}),Object.defineProperty(p.prototype,"getColumns",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.props.columns.filter((function(t){return"object"==typeof t&&null!=t&&(t.alwaysVisible||-1===e.props.hiddenColumnIds.indexOf(t.id))})).map((function(e){e.alwaysVisible;var t=e.cell,r=e.divider,n=e.header,i=e.id,l=e.label,a=e.sortable,u=e.sticky,c=e.subRowCell,d=e.truncate,s=e.vertical,m=e.width;return{cell:t,columnProps:o(e,["alwaysVisible","cell","divider","header","id","label","sortable","sticky","subRowCell","truncate","vertical","width"]),divider:r,header:n,id:i,label:l,sortable:a,sticky:u,subRowCell:c,truncate:d,vertical:s,width:m}}))}}),Object.defineProperty(p.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,i=this.props,l=i.caption;i.children;var d=i.columnDividers;i.columns;var S=i.compactHeader,w=i.currentPage,C=i.data,O=void 0===C?[]:C;i.defaultSortColumnId;var k=i.defaultSortDirection;i.defaultSortOrder;var I=i.empty,M=i.getRowLink,z=i.headerColor;i.hiddenColumnIds,i.highlightColumnOnHover,i.innerRef;var V=i.keyboardShortcuts;i.layout;var L=i.loading,U=i.loadingTitle,K=i.minHeight,N=i.minRowHeight;i.onColumnSort;var _=i.onPageChange,q=i.onRowSort,F=i.rowDividers,G=i.subRowData,J=i.totalPages,Q=o(i,["caption","children","columnDividers","columns","compactHeader","currentPage","data","defaultSortColumnId","defaultSortDirection","defaultSortOrder","empty","getRowLink","headerColor","hiddenColumnIds","highlightColumnOnHover","innerRef","keyboardShortcuts","layout","loading","loadingTitle","minHeight","minRowHeight","onColumnSort","onPageChange","onRowSort","rowDividers","subRowData","totalPages"]),X=this.state,Y=X.highlightedColumnIndex,Z=X.currentSort,$=X.isSorting,ee=X.headerHeight,te=X.columnWidths,re=X.rowWidth,oe=X.offsets,ne=X.getLeftOffset,ie=X.getRightOffset,le=this.getColumns(),ae=L||O.length<=0;return a.createElement(W,t({},Q,{position:"relative"}),a.createElement(n,{styles:{html:{userSelect:this.state.isSorting?"none":null}}}),ae?a.createElement(h,{grow:1,alignment:"center",distribution:"center",minHeight:K,paddingVertical:8},L?a.createElement(v,{image:a.createElement(b,{size:"xl",color:"primary"}),title:U}):I):a.createElement(y,{updateOnMeasure:!1,onMeasure:this.handleMeasure},(function(o){var n=o.measureRef,i=u.toArray(r([G&&a.createElement(A,{toggled:e.isAnySubRowOpen(),height:ee+"px",onClick:e.handleSubRowToggleAll}),q&&a.createElement(D,{role:"columnheader",height:ee+"px",backgroundColor:"inherit"})],le.map((function(r,o){return a.createElement(B,{key:o},(function(i){var l=i.bindHover,u=i.isHover,c=te[o],d=t(t(t({},r.columnProps),l),{cursor:r.sortable?"pointer":"default",justifyContent:r.vertical?"start":r.columnProps.justifyContent,onClick:function(t){r.sortable&&e.handleColumnSort(r.id),r.columnProps&&r.columnProps.onClick&&r.columnProps.onClick(t)},position:r.sticky?"sticky":"relative",style:{height:r.vertical?ee+16:ee,left:ne(r,o),right:ie(r,o),width:c},zIndex:r.sticky?35:r.columnProps.zIndex});return r.sortable&&(d["aria-sort"]=Z.columnId===r.id?"ASC"===Z.direction?"ascending":"descending":"none"),a.createElement(x,t({},d),a.createElement(E,{innerRef:n("".concat(o,"-0")),height:S?4:6,transform:r.vertical&&"translate(".concat(r.width/2,"px, ").concat(16,"px) rotate(-90deg)")},"string"==typeof r.header?a.createElement(f,{truncate:!0,color:"grey-7",fontSize:S?"11px":"12px",cursor:r.sortable?"pointer":"default"},r.header):"function"==typeof r.header?r.header(o):r.header,r.sortable&&a.createElement(s,{title:"sort table",theme:!1,icon:{name:p.getIconDirection(Z.columnId===r.id?Z.direction:k)},size:"xs",opacity:Z.columnId===r.id?1:u?.35:0})))}))})),!0)),g=function(r,o){var i=o.subRowProps,l=void 0===i?{}:i,c=o.shouldRenderSubRowData,s=o.shouldRenderSubRowToggle,m=void 0!==s&&s;return Object.keys(r).map((function(o,i){var s=e.isSubRowOpen(i),f=r[o],p={index:i,key:i,keyboardShortcuts:V,onRowSort:q,row:f,rowIndex:i,style:{minWidth:re}},b={};if(M){var h=function(){var e=M(f);"string"==typeof e&&(window.location=e)};b.tabIndex=0,b.role="link",b.cursor="pointer",b.focus={backgroundColor:"hsla(0,0%,97%,1)"},b.hover={backgroundColor:"hsla(0,0%,97%,1)"},b.onClick=h,b.onKeyDown=function(e){"Enter"===e.key&&h()}}return $&&(b.pointerEvents="none"),(F&&0!==i||m)&&(b.borderTopWidth=1),[a.createElement(P,t({},p,b,l),(function(r){var o=r.isRowHovered,l=r.dragHandleProps;return u.toArray([G&&(m?a.createElement(A,{contentsHidden:!0}):a.createElement(A,{toggled:s,rowIndex:i,onClick:function(t){t.stopPropagation(),e.handleSubRowToggle(i)}})),q&&a.createElement(D,t({},l),a.createElement(H,null)),le.map((function(r,l){var u=te[l],c=m&&void 0!==r.subRowCell?r.subRowCell:r.cell;return a.createElement(j,t({key:l},r.columnProps,e.getBodyCellMouseHandlers(l),{position:r.sticky?"sticky":void 0,justifyContent:r.vertical?"center":r.columnProps.justifyContent,minHeight:m?5:N,borderColor:"grey-3",borderLeftWidth:!1!==r.divider&&(d&&(q||0!==l)?1:void 0),backgroundColor:Y===l?"grey-0":"inherit",color:m?"grey-9":"foreground",zIndex:r.sticky?35:void 0,style:t({left:ne(r,l),right:ie(r,l),width:u},r.columnProps.style)}),a.createElement(R,{innerRef:void 0===r.width?n("".concat(l,"-").concat(i+1),{formula:function(e){return{width:e.offsetWidth}}}):null,column:r,justifyContent:r.vertical?"center":r.columnProps.justifyContent},c&&("string"==typeof c?f[c]:c(f,{columnIndex:l,isRowHovered:o,rowIndex:i}))))}))])})),c&&s?g(G(f),{shouldRenderSubRowData:!1,shouldRenderSubRowToggle:!0,subRowProps:{backgroundColor:"hsla(0,0%,99%,1)"}}):null]}))},b=function(e){return a.createElement(T,t({},e,{columnWidths:r([G&&48,q&&48],te,!0).filter(Boolean),rowWidth:re,minHeight:K,offsets:oe,caption:l,header:i,headerColor:z,headerHeight:ee,body:g(O,{shouldRenderSubRowData:!!G})}))};return q?a.createElement(m.Provider,{onDragStart:e.handleSortStart,onDragEnd:e.handleSortEnd},a.createElement(m.Droppable,{droppableId:"table"},(function(e){return a.createElement(c,null,b(t({innerRef:e.innerRef},e.droppableProps)),e.placeholder)}))):b({})})),!ae&&a.createElement(g,{currentPage:w,totalPages:J,onPageChange:_,position:"sticky",bottom:0,zIndex:35,marginTop:"-1px",backgroundColor:"surface",borderTopWidth:1,borderTopColor:"grey-3",css:{"@media print":{position:"relative"}}}))}}),Object.defineProperty(p,"ColumnPicker",{enumerable:!0,configurable:!0,writable:!0,value:k}),Object.defineProperty(p,"AvatarCell",{enumerable:!0,configurable:!0,writable:!0,value:C}),Object.defineProperty(p,"CheckboxCell",{enumerable:!0,configurable:!0,writable:!0,value:O}),Object.defineProperty(p,"DateCell",{enumerable:!0,configurable:!0,writable:!0,value:I}),Object.defineProperty(p,"ASC",{enumerable:!0,configurable:!0,writable:!0,value:"ASC"}),Object.defineProperty(p,"DESC",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(p,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{currentPage:0,defaultSortColumnId:null,defaultSortDirection:p.ASC,defaultSortOrder:null,empty:"No results",headerColor:"grey-0",hiddenColumnIds:[],minHeight:48,minRowHeight:8,onPageChange:function(){return null},rowDividers:!0,totalPages:0}}),p}(d);export{z as default};
2
2
  //# sourceMappingURL=Table.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as n}from'./../ext/tslib/tslib.es6.js';import t,{useState as r,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 v,noop as s}from"../utils.js";import{addHoursToTime as m,addMinutesToTime as f,addTimeToDate as p,getTimeFromDate as w}from"./utils.js";var h="undefined"!=typeof window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),g=function(r){var o=r.twelveHourClock,a=void 0===o||o,i=r.controlled,u=void 0!==i&&i,l=e(r,["twelveHourClock","controlled"]);return u?t.createElement(k,n({twelveHourClock:a},l)):t.createElement(y,n({twelveHourClock:a},l))};g.addHoursToTime=m,g.addMinutesToTime=f,g.addTimeToDate=p,g.getTimeFromDate=w;var y=function(o){var a=o.value,i=e(o,["value"]),u=r(a),l=u[0],c=u[1];return t.createElement(k,n({},i,{onChange:function(e){c(e),i.onChange&&i.onChange(e)},value:l}))},k=function(r){var m=r.ignoredKeys;r.interval;var f=r.isIOS,p=void 0!==f&&f;r.max,r.min;var w=r.onChange,g=r.twelveHourClock,y=r.value,k=e(r,["ignoredKeys","interval","isIOS","max","min","onChange","twelveHourClock","value"]),A=o(null),C=y[0],b=y[1],M=a((function(){return C<12?"AM":"PM"}),[C]),D=a((function(){return g?0===C?12:C>12?C-12:C:C}),[C]),I=function(e){var n=C-e;return n<0?23:n},x=function(e){return(C+e)%24},E=function(){w("AM"===M?[C+12,b]:[C-12,b])};return h||p?t.createElement(u,n({},k,{type:"time",autoWidth:"".concat(C,":").concat(v(b,2)," ").concat(M),value:"".concat(v(C,2),":").concat(v(b,2)),onChange:function(e){var n=e.target.value.split(":"),t=n[0],r=n[1];w(t||r?[parseInt(t,10),parseInt(r,10)]:[0,0])}})):t.createElement(l,n({ref:A,inline:!0},k),t.createElement(d,{"aria-label":"Hours",autoWidth:!1,fontVariantNumeric:"tabular-nums",grow:0,max:g?12:23,min:0,moveFocusOnMax:!0,onChange:function(e){var n=function(e){var n=e.hours,t=e.twelveHourClock,r=e.meridiem;return t?"PM"===r&&n<12?n+12:"AM"===r&&12===n?0:n:n}({hours:"string"==typeof e?parseInt(e,10):e,meridiem:M,twelveHourClock:g});w([n,b])},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([x(1),b]),e.preventDefault()),"ArrowDown"===e.key&&(!function(e){w([I(e),b])}(1),e.preventDefault()))},pad:2,textAlign:"center",value:D,width:"2ch",disabled:k.disabled,ignoredKeys:m}),t.createElement(i,{as:"span",width:.5,textAlign:"center",userSelect:"none"},":"),t.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,t,r;"ArrowLeft"===e.key&&(null===(n=A.current)||void 0===n?void 0:n.node.children[0]).focus(),"ArrowRight"===e.key&&(null===(t=A.current)||void 0===t?void 0:t.node.children[3]).focus(),"ArrowUp"===e.key&&(w((r=b+1)<=59?[C,r]:[x(1),0]),e.preventDefault()),"ArrowDown"===e.key&&(!function(e){var n=b-e;w(n>=0?[C,n]:[I(1),59])}(1),e.preventDefault())},pad:2,textAlign:"center",value:b,width:"2ch",disabled:k.disabled,ignoredKeys:m}),g&&t.createElement(c,{"aria-label":"AM/PM",grow:0,highlightOnInteraction:!0,onChange:s,onInput:function(e){var n,t=(null!==(n=e.nativeEvent.data)&&void 0!==n?n:"").charAt(0).toLowerCase();("a"===t&&"PM"===M||"p"===t&&"AM"===M)&&E()},onKeyDown:function(e){var n;if(!m||!m.includes(e.key)){var t=e.key.toLowerCase();"Tab"===e.key||e.metaKey&&"r"===t||"a"===t&&"PM"===M||"p"===t&&"AM"===M||e.preventDefault(),"ArrowLeft"===e.key?(null===(n=A.current)||void 0===n?void 0:n.node.children[2]).focus():["ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),E())}},textAlign:"center",value:M,width:"2em",disabled:k.disabled}))};export{g as default};
1
+ import{__rest as e,__assign as n}from'./../ext/tslib/tslib.es6.js';import t,{useRef as r,useMemo as o,useState 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 v,noop as s}from"../utils.js";import{addHoursToTime as m,addMinutesToTime as f,addTimeToDate as p,getTimeFromDate as w}from"./utils.js";var h="undefined"!=typeof window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),g=function(r){var o=r.twelveHourClock,a=void 0===o||o,i=r.controlled,u=void 0!==i&&i,l=e(r,["twelveHourClock","controlled"]);return u?t.createElement(k,n({twelveHourClock:a},l)):t.createElement(y,n({twelveHourClock:a},l))};g.addHoursToTime=m,g.addMinutesToTime=f,g.addTimeToDate=p,g.getTimeFromDate=w;var y=function(r){var o=r.value,i=e(r,["value"]),u=a(o),l=u[0],c=u[1];return t.createElement(k,n({},i,{onChange:function(e){c(e),i.onChange&&i.onChange(e)},value:l}))},k=function(a){var m=a.ignoredKeys;a.interval;var f=a.isIOS,p=void 0!==f&&f;a.max,a.min;var w=a.onChange,g=a.twelveHourClock,y=a.value,k=e(a,["ignoredKeys","interval","isIOS","max","min","onChange","twelveHourClock","value"]),A=r(null),C=y[0],b=y[1],M=o((function(){return C<12?"AM":"PM"}),[C]),D=o((function(){return g?0===C?12:C>12?C-12:C:C}),[C]),I=function(e){var n=C-e;return n<0?23:n},x=function(e){return(C+e)%24},E=function(){w("AM"===M?[C+12,b]:[C-12,b])};return h||p?t.createElement(u,n({},k,{type:"time",autoWidth:"".concat(C,":").concat(v(b,2)," ").concat(M),value:"".concat(v(C,2),":").concat(v(b,2)),onChange:function(e){var n=e.target.value.split(":"),t=n[0],r=n[1];w(t||r?[parseInt(t,10),parseInt(r,10)]:[0,0])}})):t.createElement(l,n({ref:A,inline:!0},k),t.createElement(d,{"aria-label":"Hours",autoWidth:!1,fontVariantNumeric:"tabular-nums",grow:0,max:g?12:23,min:0,moveFocusOnMax:!0,onChange:function(e){var n=function(e){var n=e.hours,t=e.twelveHourClock,r=e.meridiem;return t?"PM"===r&&n<12?n+12:"AM"===r&&12===n?0:n:n}({hours:"string"==typeof e?parseInt(e,10):e,meridiem:M,twelveHourClock:g});w([n,b])},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([x(1),b]),e.preventDefault()),"ArrowDown"===e.key&&(!function(e){w([I(e),b])}(1),e.preventDefault()))},pad:2,textAlign:"center",value:D,width:"2ch",disabled:k.disabled,ignoredKeys:m}),t.createElement(i,{as:"span",width:.5,textAlign:"center",userSelect:"none"},":"),t.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,t,r;"ArrowLeft"===e.key&&(null===(n=A.current)||void 0===n?void 0:n.node.children[0]).focus(),"ArrowRight"===e.key&&(null===(t=A.current)||void 0===t?void 0:t.node.children[3]).focus(),"ArrowUp"===e.key&&(w((r=b+1)<=59?[C,r]:[x(1),0]),e.preventDefault()),"ArrowDown"===e.key&&(!function(e){var n=b-e;w(n>=0?[C,n]:[I(1),59])}(1),e.preventDefault())},pad:2,textAlign:"center",value:b,width:"2ch",disabled:k.disabled,ignoredKeys:m}),g&&t.createElement(c,{"aria-label":"AM/PM",grow:0,highlightOnInteraction:!0,onChange:s,onInput:function(e){var n,t=(null!==(n=e.nativeEvent.data)&&void 0!==n?n:"").charAt(0).toLowerCase();("a"===t&&"PM"===M||"p"===t&&"AM"===M)&&E()},onKeyDown:function(e){var n;if(!m||!m.includes(e.key)){var t=e.key.toLowerCase();"Tab"===e.key||e.metaKey&&"r"===t||"a"===t&&"PM"===M||"p"===t&&"AM"===M||e.preventDefault(),"ArrowLeft"===e.key?(null===(n=A.current)||void 0===n?void 0:n.node.children[2]).focus():["ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),E())}},textAlign:"center",value:M,width:"2em",disabled:k.disabled}))};export{g as default};
2
2
  //# sourceMappingURL=TimeField.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as t,__assign as e}from'./../ext/tslib/tslib.es6.js';import{token as o}from"@planningcenter/tapestry";import i from"react";import{Box as r}from"../Box/Box.js";import{StackView as l}from"../StackView/StackView.js";import"../system/colors/colors.js";import"polished";import"../utils.js";import"lodash/includes";import{useThemeProps as s}from"../system/utils.js";import"../system/style-names.js";import"../system/default-theme.js";import"@emotion/react";import"../system/cxs.js";import{Text as a}from"../Text/Text.js";import n from"../Tooltip/Tooltip.js";function m(m){var c,d=m.ariaLabel,p=void 0===d?void 0:d,f=m.disabled,h=void 0!==f&&f,u=m.id,b=void 0===u?void 0:u,v=m.isChecked,g=m.label,k=void 0===g?void 0:g,w=m.labelPosition,j=void 0===w?"after":w,x=m.onClick,y=m.size,C=void 0===y?"md":y,E=m.tooltip,D=void 0===E?void 0:E,T=t(m,["ariaLabel","disabled","id","isChecked","label","labelPosition","onClick","size","tooltip"]),z=s("toggleSwitch",T).backgroundColor,S={height:2.5,width:4.375},B={height:2,width:2};"sm"===C?(S={height:2.25,width:4},B={height:1.75,width:1.75}):"xs"===C&&(S={height:2,width:3.5},B={height:1.5,width:1.5});var L=h?((c={})["aria-disabled"]=!0,c.cursor="not-allowed",c.onClick=function(t){return t.preventDefault()},c.onKeyDown=function(t){"Enter"!==t.key&&" "!==t.key||t.preventDefault()},c):{};return i.createElement(n,{title:D,placement:h?"top":"bottom"},i.createElement(l,e({alignment:"center","aria-checked":v?"true":"false","aria-label":p||k,as:"button",flexDirection:"before"===j?"row-reverse":"row",id:b,cursor:"pointer",onClick:x,radius:"pill",role:"switch",spacing:"xs"===C?.5:"sm"===C?.75:1},L),i.createElement(r,e({backgroundColor:h?o("--t-fill-color-control-disabled"):v?z:o("--t-fill-color-control-neutral-off"),position:"relative",radius:"pill"},S),i.createElement(r,e({background:"#fff",left:.25,pointerEvents:"none",position:"absolute",radius:"circle",top:.25,transform:"translateX(".concat(v?"calc(100% - 1px)":"0%",")"),transition:"120ms"},B))),k&&i.createElement(a,{size:"xs"===C?5:"sm"===C?4:3},k)))}export{m as ToggleSwitch,m as default};
1
+ import{__rest as t,__assign as e}from'./../ext/tslib/tslib.es6.js';import{token as o}from"@planningcenter/tapestry";import i from"react";import{Box as r}from"../Box/Box.js";import{StackView as l}from"../StackView/StackView.js";import"../system/colors/colors.js";import"polished";import"../utils.js";import"lodash/includes";import{useThemeProps as s}from"../system/utils.js";import"../system/style-names.js";import"../system/default-theme.js";import"@emotion/react";import"../system/cxs.js";import{Text as a}from"../Text/Text.js";import n from"../Tooltip/Tooltip.js";function m(m){var c,d=m.ariaLabel,p=void 0===d?void 0:d,f=m.disabled,h=void 0!==f&&f,u=m.id,b=void 0===u?void 0:u,v=m.isChecked,g=m.label,k=void 0===g?void 0:g,w=m.labelPosition,j=void 0===w?"after":w,x=m.onClick,y=m.size,C=void 0===y?"md":y,E=m.tooltip,D=void 0===E?void 0:E,T=t(m,["ariaLabel","disabled","id","isChecked","label","labelPosition","onClick","size","tooltip"]),z=s("toggleSwitch",T).backgroundColor,S={height:2.5,width:4.375},B={height:2,width:2};"sm"===C?(S={height:2.25,width:4},B={height:1.75,width:1.75}):"xs"===C&&(S={height:2,width:3.5},B={height:1.5,width:1.5});var L=h?((c={})["aria-disabled"]=!0,c.cursor="not-allowed",c.onClick=function(t){return t.preventDefault()},c.onKeyDown=function(t){"Enter"!==t.key&&" "!==t.key||t.preventDefault()},c):{};return i.createElement(n,{title:D,placement:h?"top":"bottom"},i.createElement(l,e({alignment:"center","aria-checked":v?"true":"false","aria-label":p||k,as:"button",flexDirection:"before"===j?"row-reverse":"row",id:b,cursor:"pointer",onClick:x,radius:"pill",role:"switch",spacing:"xs"===C?.5:"sm"===C?.75:1},L),i.createElement(r,e({backgroundColor:h?o("--t-fill-color-control-disabled"):v?z:o("--t-fill-color-control-neutral-off"),position:"relative",radius:"pill"},S),i.createElement(r,e({background:"#fff",left:.25,pointerEvents:"none",position:"absolute",radius:"circle",top:.25,transform:"translateX(".concat(v?"calc(100% - 1px)":"0%",")"),transition:"120ms"},B))),k&&i.createElement(a,{size:"xs"===C?5:"sm"===C?4:3},k)))}export{m as ToggleSwitch};
2
2
  //# sourceMappingURL=ToggleSwitch.js.map
@@ -1,2 +1,2 @@
1
- import{__extends as e,__spreadArray as t,__rest as n,__assign as o}from'./../ext/tslib/tslib.es6.js';import r,{cloneElement as i,Component as a}from"react";import s from"../Input/InputBox.js";import{getBoxSize as u}from"../system/box-sizes.js";import"../system/colors/colors.js";import"polished";import"../utils.js";import"lodash/includes";import{navigateSize as l}from"../system/utils.js";import"../system/style-names.js";import"../system/default-theme.js";import"@emotion/react";import"../system/cxs.js";import{WrapView as p}from"../WrapView/WrapView.js";import{defaultRenderInput as c,defaultRenderToken as f}from"./default-renders.js";import d from"./DefaultToken.js";var b=function(a){function b(){var e=null!==a&&a.apply(this,arguments)||this;return Object.defineProperty(e,"inputBox",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"state",{enumerable:!0,configurable:!0,writable:!0,value:{inputValue:""}}),Object.defineProperty(e,"clearInputValue",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.setState({inputValue:""})}}),Object.defineProperty(e,"addToken",{enumerable:!0,configurable:!0,writable:!0,value:function(n){var o=t([],e.props.tokens,!0),r=o.indexOf(n);if(r>-1){var i=o.splice(r,1);o.push(i[0])}else o.push(n);e.props.onChange&&e.props.onChange({added:!0,token:n,tokenIndex:r,tokens:o}),e.clearInputValue()}}),Object.defineProperty(e,"removeToken",{enumerable:!0,configurable:!0,writable:!0,value:function(n,o){var r=t([],e.props.tokens,!0),i=-1;n.constructor===Array?n.some((function(e){return(i=r.indexOf(e))>-1&&(r.splice(i,1),!0)})):(i=r.indexOf(n))>-1&&r.splice(i,1),e.props.onChange&&e.props.onChange({added:!1,token:n,tokenIndex:i,tokens:r}),"number"==typeof o?setTimeout((function(){e.focus(o>=r.length?void 0:o)})):e.blur()}}),Object.defineProperty(e,"handleInputKeyDown",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var n=t.target,o=n.selectionStart,r=n.selectionEnd,i=0===o&&0===r;e.props.tokens.length>0&&i&&("Backspace"===t.key||"ArrowLeft"===t.key)&&(t.preventDefault(),e.focusLastToken())}}),Object.defineProperty(e,"handleInputChange",{enumerable:!0,configurable:!0,writable:!0,value:function(t){e.setState({inputValue:t.target.value})}}),Object.defineProperty(e,"blur",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.inputBox.blur()}}),Object.defineProperty(e,"focus",{enumerable:!0,configurable:!0,writable:!0,value:function(t){e.inputBox.focus(t)}}),Object.defineProperty(e,"focusFirstToken",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.focus(0)}}),Object.defineProperty(e,"focusLastToken",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.focus(e.props.tokens.length-1)}}),e}return e(b,a),Object.defineProperty(b.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.tokens.length!==this.props.tokens.length&&this.clearInputValue()}}),Object.defineProperty(b.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props;t.onChange;var a=t.renderInput,c=t.renderToken,f=t.tokens,b=n(t,["onChange","renderInput","renderToken","tokens"]),m={grow:1,onChange:this.handleInputChange,onKeyDown:this.handleInputKeyDown,paddingLeft:0,paddingRight:0,paddingVertical:0,shrink:1,size:l(b.size,-1),stroke:!1,strokeWeight:0,value:this.state.inputValue},k=u(b.size).paddingVertical;return r.createElement(p,o({as:s,innerRef:function(t){return e.inputBox=t},role:"group",focusChildIndex:f.length,evenPadding:!0,spacing:k},b),f.map((function(t,n){var o=e.removeToken.bind(e,t),a=e.focusFirstToken,s=e.focusLastToken,u=e.focus.bind(e,n+1),l=e.focus.bind(e,n-1),p=c(t,{keyboardControls:{onKeyDown:function(e){"Backspace"===e.key&&(e.preventDefault(),o(n)),"ArrowLeft"===e.key&&(e.preventDefault(),l()),"ArrowRight"===e.key&&(e.preventDefault(),u())},tabIndex:0},removeToken:o,selectFirstToken:a,selectLastToken:s,selectNextToken:u,selectPreviousToken:l,tokenIndex:n});return"string"==typeof p?r.createElement(d,{key:p,removeToken:o,selectFirstToken:a,selectLastToken:s,selectNextToken:u,selectPreviousToken:l,token:p,tokenIndex:n}):i(p,{key:JSON.stringify(t)})})),a(m,{addToken:this.addToken,clearInputValue:this.clearInputValue,removeToken:this.removeToken,selectFirstToken:this.focusFirstToken,selectLastToken:this.focusLastToken}))}}),Object.defineProperty(b,"Token",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(b,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{renderInput:c,renderToken:f,size:"md",tokens:null}}),b}(a);export{b as default};
1
+ import{__extends as e,__spreadArray as t,__rest as n,__assign as o}from'./../ext/tslib/tslib.es6.js';import r,{cloneElement as i,Component as a}from"react";import s from"../Input/InputBox.js";import{getBoxSize as u}from"../system/box-sizes.js";import"../system/colors/colors.js";import"polished";import"../utils.js";import"lodash/includes";import{navigateSize as l}from"../system/utils.js";import"../system/style-names.js";import"../system/default-theme.js";import"@emotion/react";import"../system/cxs.js";import{WrapView as p}from"../WrapView/WrapView.js";import{defaultRenderToken as c,defaultRenderInput as f}from"./default-renders.js";import d from"./DefaultToken.js";var b=function(a){function b(){var e=null!==a&&a.apply(this,arguments)||this;return Object.defineProperty(e,"inputBox",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(e,"state",{enumerable:!0,configurable:!0,writable:!0,value:{inputValue:""}}),Object.defineProperty(e,"clearInputValue",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.setState({inputValue:""})}}),Object.defineProperty(e,"addToken",{enumerable:!0,configurable:!0,writable:!0,value:function(n){var o=t([],e.props.tokens,!0),r=o.indexOf(n);if(r>-1){var i=o.splice(r,1);o.push(i[0])}else o.push(n);e.props.onChange&&e.props.onChange({added:!0,token:n,tokenIndex:r,tokens:o}),e.clearInputValue()}}),Object.defineProperty(e,"removeToken",{enumerable:!0,configurable:!0,writable:!0,value:function(n,o){var r=t([],e.props.tokens,!0),i=-1;n.constructor===Array?n.some((function(e){return(i=r.indexOf(e))>-1&&(r.splice(i,1),!0)})):(i=r.indexOf(n))>-1&&r.splice(i,1),e.props.onChange&&e.props.onChange({added:!1,token:n,tokenIndex:i,tokens:r}),"number"==typeof o?setTimeout((function(){e.focus(o>=r.length?void 0:o)})):e.blur()}}),Object.defineProperty(e,"handleInputKeyDown",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var n=t.target,o=n.selectionStart,r=n.selectionEnd,i=0===o&&0===r;e.props.tokens.length>0&&i&&("Backspace"===t.key||"ArrowLeft"===t.key)&&(t.preventDefault(),e.focusLastToken())}}),Object.defineProperty(e,"handleInputChange",{enumerable:!0,configurable:!0,writable:!0,value:function(t){e.setState({inputValue:t.target.value})}}),Object.defineProperty(e,"blur",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.inputBox.blur()}}),Object.defineProperty(e,"focus",{enumerable:!0,configurable:!0,writable:!0,value:function(t){e.inputBox.focus(t)}}),Object.defineProperty(e,"focusFirstToken",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.focus(0)}}),Object.defineProperty(e,"focusLastToken",{enumerable:!0,configurable:!0,writable:!0,value:function(){e.focus(e.props.tokens.length-1)}}),e}return e(b,a),Object.defineProperty(b.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.tokens.length!==this.props.tokens.length&&this.clearInputValue()}}),Object.defineProperty(b.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props;t.onChange;var a=t.renderInput,c=t.renderToken,f=t.tokens,b=n(t,["onChange","renderInput","renderToken","tokens"]),m={grow:1,onChange:this.handleInputChange,onKeyDown:this.handleInputKeyDown,paddingLeft:0,paddingRight:0,paddingVertical:0,shrink:1,size:l(b.size,-1),stroke:!1,strokeWeight:0,value:this.state.inputValue},k=u(b.size).paddingVertical;return r.createElement(p,o({as:s,innerRef:function(t){return e.inputBox=t},role:"group",focusChildIndex:f.length,evenPadding:!0,spacing:k},b),f.map((function(t,n){var o=e.removeToken.bind(e,t),a=e.focusFirstToken,s=e.focusLastToken,u=e.focus.bind(e,n+1),l=e.focus.bind(e,n-1),p=c(t,{keyboardControls:{onKeyDown:function(e){"Backspace"===e.key&&(e.preventDefault(),o(n)),"ArrowLeft"===e.key&&(e.preventDefault(),l()),"ArrowRight"===e.key&&(e.preventDefault(),u())},tabIndex:0},removeToken:o,selectFirstToken:a,selectLastToken:s,selectNextToken:u,selectPreviousToken:l,tokenIndex:n});return"string"==typeof p?r.createElement(d,{key:p,removeToken:o,selectFirstToken:a,selectLastToken:s,selectNextToken:u,selectPreviousToken:l,token:p,tokenIndex:n}):i(p,{key:JSON.stringify(t)})})),a(m,{addToken:this.addToken,clearInputValue:this.clearInputValue,removeToken:this.removeToken,selectFirstToken:this.focusFirstToken,selectLastToken:this.focusLastToken}))}}),Object.defineProperty(b,"Token",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(b,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{renderInput:f,renderToken:c,size:"md",tokens:null}}),b}(a);export{b as default};
2
2
  //# sourceMappingURL=TokenInput.js.map
@@ -1,2 +1,2 @@
1
- import{token as o}from"@planningcenter/tapestry";var l={black10:o("--t-fill-color-transparency-dark-010"),black40:o("--t-fill-color-transparency-dark-040"),black60:o("--t-fill-color-transparency-dark-060"),black80:o("--t-fill-color-transparency-dark-080"),lightNeutral40:"hsl(0, 0%, 40%)",lightNeutral68:"hsl(0, 0%, 68%)",lightNeutral88:o("--t-fill-color-neutral-050"),lightNeutral97:o("--t-fill-color-neutral-080"),white:o("--t-fill-color-neutral-100"),white45:o("--t-fill-color-transparency-light-050")},r={button:{borderRadius:o("--t-border-radius-md")},checkbox:{borderColor:l.lightNeutral68,disabledLabelColor:o("--t-text-color-disabled"),labelColor:o("--t-text-color")},radio:{borderColor:o("--t-border-color-control-neutral"),checkedColor:o("--t-fill-color-control"),checkedFillColor:l.white,disabled:{borderColor:o("--t-border-color-control-disabled"),checkedColor:o("--t-border-color-control-disabled"),checkedFillColor:o("--t-surface-color-card"),fillColor:o("--t-fill-color-neutral-070"),labelColor:o("--t-text-color-disabled")},error:{borderColor:o("--t-border-color-control-error"),fillColor:o("--t-fill-color-status-error-ghost")},fillColor:o("--t-surface-color-card"),labelColor:o("--t-text-color")},tabNav:{desktop:{paddingX:24,selectedTabBackgroundColor:l.white,spacing:8},mobile:{backgroundColor:l.white,borderBottomColor:l.lightNeutral88,borderBottomStyle:"solid",borderBottomWidth:1,paddingX:16,spacing:20},tab:{badgeBackgroundColor:l.black10,badgeFontSize:12,badgeTextColor:l.black80,desktop:{activeTextColor:l.black80,borderRadiusTop:4,defaultBackgroundColor:l.white45,fontSize:14,height:40,hoverTextColor:l.black80,paddingX:16},disabledTextColor:l.black40,iconColor:l.lightNeutral40,mobile:{borderBottomWidth:3,fontSize:16,height:44,paddingBottom:10,paddingTop:7},selectedTextColor:l.black80,textColor:l.black60}}};export{r as designTokens};
1
+ import{token as o}from"@planningcenter/tapestry";var l={black10:o("--t-fill-color-transparency-dark-010"),black40:o("--t-fill-color-transparency-dark-040"),black60:o("--t-fill-color-transparency-dark-060"),black80:o("--t-fill-color-transparency-dark-080"),lightNeutral40:"hsl(0, 0%, 40%)",lightNeutral88:o("--t-fill-color-neutral-050"),lightNeutral97:o("--t-fill-color-neutral-080"),white:o("--t-fill-color-neutral-100"),white45:o("--t-fill-color-transparency-light-050")},r={button:{borderRadius:o("--t-border-radius-md")},checkbox:{disabledLabelColor:o("--t-text-color-disabled"),labelColor:o("--t-text-color")},radio:{borderColor:o("--t-border-color-control-neutral"),checkedColor:o("--t-fill-color-control"),checkedFillColor:l.white,disabled:{borderColor:o("--t-border-color-control-disabled"),checkedColor:o("--t-border-color-control-disabled"),checkedFillColor:o("--t-surface-color-card"),fillColor:o("--t-fill-color-neutral-070"),labelColor:o("--t-text-color-disabled")},error:{borderColor:o("--t-border-color-control-error"),fillColor:o("--t-fill-color-status-error-ghost")},fillColor:o("--t-surface-color-card"),labelColor:o("--t-text-color")},tabNav:{desktop:{paddingX:24,selectedTabBackgroundColor:l.white,spacing:8},mobile:{backgroundColor:l.white,borderBottomColor:l.lightNeutral88,borderBottomStyle:"solid",borderBottomWidth:1,paddingX:16,spacing:20},tab:{badgeBackgroundColor:l.black10,badgeFontSize:12,badgeTextColor:l.black80,desktop:{activeTextColor:l.black80,borderRadiusTop:4,defaultBackgroundColor:l.white45,fontSize:14,height:40,hoverTextColor:l.black80,paddingX:16},disabledTextColor:l.black40,iconColor:l.lightNeutral40,mobile:{borderBottomWidth:3,fontSize:16,height:44,paddingBottom:10,paddingTop:7},selectedTextColor:l.black80,textColor:l.black60}}};export{r as designTokens};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as r,__spreadArray as t}from'./../../ext/tslib/tslib.es6.js';import{parseToRgb as n,setLightness as e,darken as c,getLuminance as o,rgba as a,parseToHsl as u,toColorString as i,mix as f}from"polished";import{getCSSProperty as s}from"../../utils.js";function v(r,t){if(void 0!==r){var e=n(t),c=e.red,o=e.green,a=e.blue;return"rgba(".concat(c,", ").concat(o,", ").concat(a,", ").concat(r,")")}return t}function l(r){var t,n=r.key,o=r.baseColor;return(t={})["".concat(n,"-lightest")]=e(.94,o),t["".concat(n,"-lighter")]=e(.92,o),t["".concat(n,"-light")]=e(.7,o),t[n]=o,t["".concat(n,"-dark")]=c(.04,o),t["".concat(n,"-darker")]=c(.08,o),t["".concat(n,"-darkest")]=c(.16,o),t}function d(t,n){return Object.keys(t).map((function(e){var c,o,a,u=t[e];return"string"==typeof u?((c={})[e]=u,o=c):o=Array.isArray(u)?u.reduce((function(t,n,c){var o;return r(r({},t),((o={})["".concat(e,"-").concat(c)]=n,o))}),{}):u.base?Object.keys(u).reduce((function(t,n){var c;return r(r({},t),((c={})["base"===n?e:"".concat(e,"-").concat(n)]=u[n],c))}),{}):Object.keys(u).reduce((function(t,n){var e;return r(r({},t),((e={})[n]=u[n],e))}),{}),n({colors:o,name:(a=e,a.charAt(0).toUpperCase()+a.slice(1))})}))}function m(t){var n=d(t,(function(r){return r.colors})).reduce((function(t,n){return r(r({},t),n)}),{});return Object.keys(n).reduce((function(t,e){var c,o=n[e],a="string"==typeof o?n[o]:void 0;return r(r({},t),((c={})[e]=a?s("colors",o):o,c))}),{})}var p=1e-7;function b(r,t){var e,c=n(t).alpha,u=void 0===c?1:c;if(0===r)e=a(0,0,0,u);else if(1===r)e=a(255,255,255,u);else{var i=20,s=function(t,n){var e=f(.5,t,n),c=o(e);return Math.abs(r-c)<p||!i--?e:c>r?s(t,e):s(e,n)};e=o(t)>r?s("#000",t):s(t,"#fff")}return e}function h(r,t){var n=u(t);return n.saturation+=n.saturation*r,i(n)}function y(r,t){return void 0===t&&(t=.5),function(n){var e=Math.min(Math.max(n,.05),.95);return h(-n*t,b(e,r))}}function k(r,n){var e=y(r,n),c=o(r),a=c/5,u=(1-c)/6,i=[4,3,2,1].map((function(r){return e(r*a)})),f=[5,4,3,2,1,0].map((function(r){return e(c+r*u)}));return t(t([],f,!0),i,!0)}export{b as adjustLightness,h as adjustSaturation,y as createTone,k as createTones,d as eachPalette,m as flattenPalette,l as generateColorScale,v as setAlphaChannel};
1
+ import{__assign as r,__spreadArray as t}from'./../../ext/tslib/tslib.es6.js';import{getLuminance as n,setLightness as e,darken as c,parseToRgb as o,parseToHsl as a,toColorString as u,rgba as i,mix as f}from"polished";import{getCSSProperty as s}from"../../utils.js";function v(r,t){if(void 0!==r){var n=o(t),e=n.red,c=n.green,a=n.blue;return"rgba(".concat(e,", ").concat(c,", ").concat(a,", ").concat(r,")")}return t}function l(r){var t,n=r.key,o=r.baseColor;return(t={})["".concat(n,"-lightest")]=e(.94,o),t["".concat(n,"-lighter")]=e(.92,o),t["".concat(n,"-light")]=e(.7,o),t[n]=o,t["".concat(n,"-dark")]=c(.04,o),t["".concat(n,"-darker")]=c(.08,o),t["".concat(n,"-darkest")]=c(.16,o),t}function d(t,n){return Object.keys(t).map((function(e){var c,o,a,u=t[e];return"string"==typeof u?((c={})[e]=u,o=c):o=Array.isArray(u)?u.reduce((function(t,n,c){var o;return r(r({},t),((o={})["".concat(e,"-").concat(c)]=n,o))}),{}):u.base?Object.keys(u).reduce((function(t,n){var c;return r(r({},t),((c={})["base"===n?e:"".concat(e,"-").concat(n)]=u[n],c))}),{}):Object.keys(u).reduce((function(t,n){var e;return r(r({},t),((e={})[n]=u[n],e))}),{}),n({colors:o,name:(a=e,a.charAt(0).toUpperCase()+a.slice(1))})}))}function m(t){var n=d(t,(function(r){return r.colors})).reduce((function(t,n){return r(r({},t),n)}),{});return Object.keys(n).reduce((function(t,e){var c,o=n[e],a="string"==typeof o?n[o]:void 0;return r(r({},t),((c={})[e]=a?s("colors",o):o,c))}),{})}var p=1e-7;function b(r,t){var e,c=o(t).alpha,a=void 0===c?1:c;if(0===r)e=i(0,0,0,a);else if(1===r)e=i(255,255,255,a);else{var u=20,s=function(t,e){var c=f(.5,t,e),o=n(c);return Math.abs(r-o)<p||!u--?c:o>r?s(t,c):s(c,e)};e=n(t)>r?s("#000",t):s(t,"#fff")}return e}function h(r,t){var n=a(t);return n.saturation+=n.saturation*r,u(n)}function y(r,t){return void 0===t&&(t=.5),function(n){var e=Math.min(Math.max(n,.05),.95);return h(-n*t,b(e,r))}}function k(r,e){var c=y(r,e),o=n(r),a=o/5,u=(1-o)/6,i=[4,3,2,1].map((function(r){return c(r*a)})),f=[5,4,3,2,1,0].map((function(r){return c(o+r*u)}));return t(t([],f,!0),i,!0)}export{b as adjustLightness,h as adjustSaturation,y as createTone,k as createTones,d as eachPalette,m as flattenPalette,l as generateColorScale,v as setAlphaChannel};
2
2
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/tapestry-react",
3
- "version": "4.13.2",
3
+ "version": "4.14.0",
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",
@@ -79,7 +79,7 @@
79
79
  "dependencies": {
80
80
  "@planningcenter/icons": ">=15.29.0",
81
81
  "@planningcenter/react-beautiful-dnd": "^13.4.0",
82
- "@planningcenter/tapestry": "^2.7.0",
82
+ "@planningcenter/tapestry": ">=2.7.0",
83
83
  "@popmotion/popcorn": "^0.4.4",
84
84
  "@popperjs/core": "^2.11.6",
85
85
  "@react-hook/window-size": "^3.1.1",