@webority/mobile-ui 0.131.0 → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-kit/kit.js +6126 -5992
- package/dist/canvas-kit/manifest.json +48 -3
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/commonjs/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/commonjs/components/AuthedImage/imageStore.js +1 -0
- package/lib/commonjs/components/AuthedImage/imageStore.web.js +1 -0
- package/lib/commonjs/components/BarChart/BarChart.js +1 -1
- package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/commonjs/components/Composer/Composer.js +1 -1
- package/lib/commonjs/components/FileViewer/FileViewer.js +1 -1
- package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
- package/lib/commonjs/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/commonjs/components/Screen/Screen.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/Switch/Switch.js +1 -1
- package/lib/commonjs/components/WheelPicker/Wheel.js +1 -1
- package/lib/commonjs/navigation/NavigationScreen.js +1 -1
- package/lib/commonjs/network/NetworkStatusBanner.js +1 -1
- package/lib/commonjs/theme/merge.js +1 -1
- package/lib/commonjs/theme/tokens.generated.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/module/components/AuthedImage/imageStore.js +1 -0
- package/lib/module/components/AuthedImage/imageStore.web.js +1 -0
- package/lib/module/components/BarChart/BarChart.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/Composer/Composer.js +1 -1
- package/lib/module/components/FileViewer/FileViewer.js +1 -1
- package/lib/module/components/OTPInput/OTPInput.js +1 -1
- package/lib/module/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/module/components/Screen/Screen.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/Switch/Switch.js +1 -1
- package/lib/module/components/WheelPicker/Wheel.js +1 -1
- package/lib/module/navigation/NavigationScreen.js +1 -1
- package/lib/module/network/NetworkStatusBanner.js +1 -1
- package/lib/module/theme/merge.js +1 -1
- package/lib/module/theme/tokens.generated.js +1 -1
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +3 -1
- package/lib/typescript/commonjs/components/AuthedImage/imageStore.d.ts +7 -0
- package/lib/typescript/commonjs/components/AuthedImage/imageStore.web.d.ts +7 -0
- package/lib/typescript/commonjs/components/ChoiceGroup/ChoiceGroup.d.ts +3 -3
- package/lib/typescript/commonjs/components/Composer/Composer.d.ts +3 -0
- package/lib/typescript/commonjs/components/Screen/Screen.d.ts +4 -0
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/commonjs/navigation/NavigationScreen.d.ts +2 -2
- package/lib/typescript/commonjs/network/NetworkStatusBanner.d.ts +7 -2
- package/lib/typescript/commonjs/theme/tokens.generated.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +5 -1
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +3 -1
- package/lib/typescript/module/components/AuthedImage/imageStore.d.ts +7 -0
- package/lib/typescript/module/components/AuthedImage/imageStore.web.d.ts +7 -0
- package/lib/typescript/module/components/ChoiceGroup/ChoiceGroup.d.ts +3 -3
- package/lib/typescript/module/components/Composer/Composer.d.ts +3 -0
- package/lib/typescript/module/components/Screen/Screen.d.ts +4 -0
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/module/navigation/NavigationScreen.d.ts +2 -2
- package/lib/typescript/module/network/NetworkStatusBanner.d.ts +7 -2
- package/lib/typescript/module/theme/tokens.generated.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +5 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Screen=Screen;var _react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=require("react-native-reanimated"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useRefreshControl=require("../../hooks/useRefreshControl.js"),_index=require("../../theme/index.js"),_index2=require("../AppBar/index.js"),_index3=require("../AsyncBlock/index.js"),_index4=require("../EmptyState/index.js"),_index5=require("../KeyboardAwareScrollView/index.js"),_index6=require("../KeyboardToolbar/index.js"),_index7=require("../PagedListFooter/index.js"),_ScrollHost=require("./ScrollHost.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return(0,_react.isValidElement)(e)?e:e?(0,_react.createElement)(e):null}const topPaddingOf=e=>{const t=_reactNative.StyleSheet.flatten(e),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Screen=Screen;var _react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=require("react-native-reanimated"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useRefreshControl=require("../../hooks/useRefreshControl.js"),_index=require("../../theme/index.js"),_index2=require("../AppBar/index.js"),_index3=require("../AsyncBlock/index.js"),_index4=require("../EmptyState/index.js"),_index5=require("../KeyboardAwareScrollView/index.js"),_index6=require("../KeyboardToolbar/index.js"),_index7=require("../PagedListFooter/index.js"),_ScrollHost=require("./ScrollHost.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return(0,_react.isValidElement)(e)?e:e?(0,_react.createElement)(e):null}const topPaddingOf=e=>{const t=_reactNative.StyleSheet.flatten(e),r=t?.paddingTop??t?.paddingVertical??t?.padding;return"number"==typeof r?r:0},buildStyles=e=>_reactNative.StyleSheet.create({flex:{flex:1},root:{flex:1,backgroundColor:e.colors.bg},overlay:{position:"absolute",top:0,left:0,right:0},headerRaised:{zIndex:1},footer:{backgroundColor:e.colors.bg,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:e.colors.border}});function Screen(e){const{title:t,subtitle:r,largeTitle:o=!0,headerShadowOnScroll:n,onBack:a,rightActions:i,leading:l,trailing:s,children:c,onRefresh:d,refreshing:u=!1,footer:_,scroll:f=!0,list:h,edges:m=DEFAULT_EDGES,keyboardToolbar:p=!0,bottomInset:x=0,gutter:v,floatingAction:g,scrollRef:S,onScroll:y,contentContainerStyle:R,testID:b}=e,j=(0,_index.useTheme)(),C=v??void 0===h,E=j.space[j.components.screen.gutter],T=C?E:0,L=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>buildStyles(j),[j]),[k]=(0,_react.useState)(()=>new _reactNative.Animated.Value(0)),[O,A]=(0,_react.useState)(0),[V,q]=(0,_react.useState)(0),w=void 0!==a,B=(0,_react.useRef)(a);B.current=a;const F=Boolean(t||r||a||l||s||i?.length),M=o&&void 0!==t,H=M&&(void 0!==h||f),P=H?O:0,z=F&&!H&&(n??j.settings.components.screen?.headerShadowOnScroll??!0),[D,K]=(0,_react.useState)(!1),I=(0,_react.useRef)(z);I.current=z;const headerGap=e=>e>0?e:F?j.space.lg:0,W=void 0!==_,{refreshControl:G}=(0,_useRefreshControl.useRefreshControl)({onRefresh:d??noop,refreshing:u}),U=d?(0,_react.cloneElement)(G,{progressViewOffset:P}):void 0,Y=(0,_reactNativeReanimated.useSharedValue)(0),J=(0,_reactNativeReanimated.useSharedValue)(0),Q=(0,_reactNativeReanimated.useSharedValue)(0),X=(0,_reactNativeReanimated.useSharedValue)(0),Z=(0,_react.useRef)(null),$=(0,_react.useRef)(0),ee=(0,_react.useRef)(0),te=(0,_react.useMemo)(()=>({top:Y,bottom:J,offset:Q,maxOffset:X,scrollTo:e=>{const t=Z.current;t instanceof _reactNative.FlatList?t.scrollToOffset({offset:e,animated:!1}):t?.scrollTo({y:e,animated:!1})}}),[Y,J,Q,X]),re=(0,_react.useCallback)(e=>{Z.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]),oe=(0,_react.useCallback)(()=>{X.value=Math.max(0,$.current-ee.current)},[X]),ne=(0,_react.useRef)(y);ne.current=y;const ae=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{y:k}}}],{useNativeDriver:!1,listener:e=>{if(Q.value=e.nativeEvent.contentOffset.y,I.current){const t=e.nativeEvent.contentOffset.y>0;K(e=>e===t?e:t)}ne.current?.(e)}}),[k,Q]),ie=(0,_react.useCallback)(e=>{const{height:t}=e.nativeEvent.layout;A(e=>Math.max(e,t))},[]),le=(0,_react.useCallback)(e=>{q(e.nativeEvent.layout.height)},[]);(0,_react.useEffect)(()=>{if(!w)return;const e=_reactNative.BackHandler.addEventListener("hardwareBackPress",()=>(B.current?.(),!0));return()=>e.remove()},[w]);const se=m.includes("left")?L.left:0,ce=m.includes("right")?L.right:0,de=m.includes("bottom")?L.bottom:0,ue=m.includes("top")&&!F?L.top:0,fe=j.space[j.components["floating-action-button"]["bottom-offset"]],he=g?.props.bottomOffset??fe,me=g?(0,_index.resolveFloatingActionButtonSize)(j,g.props.size??"md").diameter+he+j.space.lg:0,pe=W?Math.max(0,V-L.bottom):x,xe=g?(0,_react.cloneElement)(g,{bottomOffset:he+pe,position:g.props.position??"bottomRight"}):null,ve=W?me:Math.max(de,g?me+L.bottom:0),ge=x+ve-(W?0:de),Se=m.filter(e=>"top"!==e&&!("bottom"===e&&W)),ye=F?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H?N.overlay:z?N.headerRaised:void 0,onLayout:H?ie:void 0,children:(0,_jsxRuntime.jsx)(_index2.AppBar,{title:t,subtitle:r,variant:M?"large":"default",scrollY:H?k:void 0,elevated:z&&D,onBack:a,rightActions:i,leading:l,trailing:s,gutter:E})}):null,Re=(0,_react.useCallback)(()=>{const e=Z.current?.getNativeScrollRef();e&&e.measureInWindow((e,t,r,o)=>{ee.current=o,Y.value=t+P,J.value=t+o,oe()})},[P,Y,J,oe]);(0,_react.useEffect)(()=>{Re()},[Re]);const be=(0,_react.useCallback)((e,t)=>{$.current=t,oe()},[oe]);let je;if(void 0!==h){const{state:e,paging:t,...r}=h,o=topPaddingOf([r.contentContainerStyle,R]),handleEndReached=e=>{t?.hasMore&&!t.loadingMore&&null==t.errorMore&&t.loadMore(),r.onEndReached?.(e)},n=(0,_jsxRuntime.jsx)(_reactNative.FlatList,{keyboardShouldPersistTaps:"handled",onEndReachedThreshold:t?.5:void 0,...r,ref:re,refreshControl:U,onScroll:ae,onLayout:e=>{Re(),r.onLayout?.(e)},onContentSizeChange:(e,t)=>{be(e,t),r.onContentSizeChange?.(e,t)},onEndReached:t?handleEndReached:r.onEndReached,ListEmptyComponent:e?.empty?(0,_jsxRuntime.jsx)(_index4.EmptyState,{...e.empty}):void 0,ListFooterComponent:t||r.ListFooterComponent?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[renderFooter(r.ListFooterComponent),t?(0,_jsxRuntime.jsx)(_index7.PagedListFooter,{paging:t}):null]}):void 0,scrollEventThrottle:SCROLL_EVENT_THROTTLE,style:N.flex,contentContainerStyle:[{paddingTop:P,paddingLeft:se+T,paddingRight:ce+T},{paddingBottom:x+ve},r.contentContainerStyle,R,{paddingTop:P+headerGap(o)}]});je=(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext.Provider,{value:te,children:e?(0,_jsxRuntime.jsx)(_index3.AsyncBlock,{loading:e.loading,error:e.error,errorTitle:e.errorTitle,onRetry:e.onRetry,skeleton:e.skeleton,style:[N.flex,{paddingTop:P+headerGap(o)}],children:n}):n})}else je=f?(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext.Provider,{value:te,children:(0,_jsxRuntime.jsxs)(_index5.KeyboardAwareScrollView,{ref:re,refreshControl:U,onScroll:ae,scrollEventThrottle:SCROLL_EVENT_THROTTLE,onLayout:Re,onContentSizeChange:be,safeAreaEdges:Se,style:N.flex,contentContainerStyle:[{paddingHorizontal:T},R,{paddingTop:P+headerGap(topPaddingOf(R))}],children:[c,ge>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:ge}}):null]})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[N.flex,{paddingLeft:se+T,paddingRight:ce+T,paddingBottom:x+ve},R],children:c});const Ce=W?(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardStickyView,{onLayout:le,style:[N.footer,{paddingLeft:se+E,paddingRight:ce+E,paddingBottom:de+x}],children:_}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:b,style:[N.root,{paddingTop:ue}],children:[H?null:ye,je,Ce,xe,void 0!==h?c:null,H?ye:null,p?(0,_jsxRuntime.jsx)(_index6.KeyboardToolbar,{}):null]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SegmentedControl=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../FieldBase/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SegmentedControl=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../FieldBase/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:i,label:r,helperText:n,error:l,value:s,defaultValue:a,onChange:o,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:x="segmented",radius:h,labelLines:g=1,haptic:_,accessibilityLabel:b,style:p,containerStyle:v,segmentStyle:f,selectedIndicatorStyle:y,textStyle:S,labelStyle:j,testID:w}=e;(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[I,C]=(0,_index.useControllableState)({value:s,defaultValue:a??i[0]?.value,onChange:o}),R=(0,_index2.useTheme)(),V=R.components["segmented-control"],q=(0,_react.useMemo)(()=>buildStyles(R),[R]),k=(0,_react.useMemo)(()=>(0,_index2.resolveSegmentedControlSize)(R,d),[R,d]),F=g>=2?2:1,L=F>1,N="segmented"===x,z="underline"===x,M="pills"===x,T=N?R.space[V["track-padding"]]:0,E=Math.ceil(1.25*k.text)*(F-1),A=V["underline-height"],D=R.space[V["pill-inset"]],H="number"==typeof h?h:h?R.radius[h]:void 0,B=H??R.radius.md,W=void 0===H?R.radius.sm:Math.max(H-T,0),P=H??R.radius.pill,O=H??R.radius.none,[G,X]=(0,_react.useState)([]),J=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,K=Math.max(0,i.findIndex(e=>e.value===I)),Q=G[K],U=Q?.x,Y=(0,_react.useCallback)(e=>{const t=R.motion.spring.snappy,i=_reactNative.Animated.spring(J,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!0});return i.start(),i},[R.motion.spring.snappy,J]);(0,_react.useEffect)(()=>{X(e=>e.length===i.length||0===e.length?e:[])},[i.length]);const Z=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(void 0===U)return;const e=null!==Z.current&&Z.current!==K;if(Z.current=K,!e)return void J.setValue(U);const t=Y(U);return()=>t.stop()},[K,U,Y,J]);const $=(0,_react.useCallback)((e,t)=>{const{x:i,width:r}=t.nativeEvent.layout;X(t=>{const n=t[e];if(n&&n.x===i&&n.width===r)return t;const l=t.slice();return l[e]={x:i,width:r},l})},[]),ee=(0,_react.useCallback)(e=>{if(u)return;if(e.value===I)return;const t=(0,_index3.resolveHaptic)(_,"selection");t&&(0,_index3.triggerHaptic)(t),C(e.value)},[u,C,I,_]),te=N?R.colors.thumb:M?R.colors["primary-soft"]:R.colors.primary,ie=N?W:M?P:O,re=activeInkFor(R,m),ne=R.colors["bg-muted"],le=(0,_SquircleFill.useSquircle)(N,B),se=!0===l||(0,_index4.hasFieldText)(l),ae=se&&!u,oe=R.colors["field-border-error"],de=R.size.border,ce=(0,_index4.hasFieldText)(r),ue=se?l:n,me=(0,_index4.hasFieldText)(ue),xe=b??("string"==typeof r?r:void 0),he=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:xe,testID:w,style:[q.track,{...L?{minHeight:k.height+E}:{height:k.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},N?{borderRadius:B,..._corners.smoothCorners,backgroundColor:le.active?"transparent":ne,padding:T}:z?{borderBottomColor:ae?oe:R.colors["border-subtle"],borderBottomWidth:_reactNative.StyleSheet.hairlineWidth}:null,v,p],onLayout:le.onLayout,children:[le.active&&le.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:le.size.width,height:le.size.height,radius:B,fill:ne,stroke:ae?oe:void 0,strokeWidth:de}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:q.row,children:[Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[q.thumb,N?L?{top:0,bottom:0}:{top:0,height:k.height-2*T}:M?{top:D,bottom:D,left:D}:{bottom:0,height:A},{width:M?Math.max(Q.width-2*D,0):Q.width,borderRadius:ie,..._corners.smoothCorners,backgroundColor:te,transform:[{translateX:J}]},y]}):null,i.map((e,t)=>{const i=e.value===I,r=i?re:R.colors["text-subtle"],n=(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:k.icon,selected:i,disabled:u});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>ee(e),onLayout:e=>$(t,e),disabled:u,accessibilityRole:"radio",accessibilityLabel:e.label,accessibilityState:{checked:i,selected:i,disabled:u},"aria-checked":i,"aria-disabled":u,style:({pressed:e})=>[q.segment,L?q.segmentMultiline:null,{paddingHorizontal:k["padding-x"],opacity:e&&!i?.7:1},f],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:q.segmentIcon,children:n}):null,(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:i?"semibold":"medium",style:[q.segmentLabel,L?q.segmentLabelMultiline:null,{color:r,fontSize:k.text},S,j],numberOfLines:F,children:e.label})]},String(e.value))})]}),!ae||z||le.active?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{borderWidth:de,borderColor:oe,borderRadius:N?B:P,..._corners.smoothCorners}]})]});return ce||me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{alignSelf:c?"stretch":"flex-start"},children:[ce?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:d,children:r}):null,he,me?(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:d,text:ue,error:se}):null]}):he});SegmentedControl.displayName="SegmentedControl";const buildStyles=e=>_reactNative.StyleSheet.create({track:{flexDirection:"row",alignItems:"stretch",position:"relative"},row:{flex:1,flexDirection:"row",alignItems:"stretch",position:"relative",overflow:"hidden"},thumb:{position:"absolute",left:0},segment:{flexGrow:1,flexShrink:1,flexBasis:"auto",flexDirection:"row",alignItems:"center",justifyContent:"center"},segmentIcon:{marginRight:e.space.xs},segmentMultiline:{paddingVertical:e.space.xs},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});var _default=exports.default=SegmentedControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Switch=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");const toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;default:return e.colors.primary}},Switch=exports.Switch=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:r,onChange:s,disabled:a=!1,size:n="md",tone:o="primary",label:l,description:c,helperText:d,error:u,layout:p="inline",accessibilityLabel:h,haptic:_="selection",bounce:m=!1,style:x,containerStyle:b,trackStyle:f,thumbStyle:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Switch=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");const toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;default:return e.colors.primary}},Switch=exports.Switch=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:r,onChange:s,disabled:a=!1,size:n="md",tone:o="primary",label:l,description:c,helperText:d,error:u,layout:p="inline",accessibilityLabel:h,haptic:_="selection",bounce:m=!1,style:x,containerStyle:b,trackStyle:f,thumbStyle:w,testID:g,hitSlop:y,...v}=e,S=(0,_index2.useTheme)(),j=Object.keys(S.components.switch);(0,_warnInvalidValue.warnInvalidValue)("Switch","size",e.size,j),(0,_warnInvalidValue.warnInvalidValue)("Switch","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Switch","layout",e.layout,["inline","row"]);const[R,N]=(0,_index.useControllableState)({value:i,defaultValue:r??!1,onChange:s}),T=j.includes(n)?n:"md",V=(0,_react.useMemo)(()=>(0,_index2.resolveSwitchSize)(S,T),[S,T]),C=S.colors["switch-thumb"],k=(0,_react.useMemo)(()=>buildStyles(S),[S]),A="dark"===S.mode?S.colors.neutral:S.colors["surface-disabled"],I=toneColor(S,o),q=y??8,F=(0,_react.useRef)((0,_index2.createAnimatedValue)(R?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.spring(F,{toValue:R?1:0,damping:S.motion.spring.snappy.damping,stiffness:S.motion.spring.snappy.stiffness,mass:S.motion.spring.snappy.mass,useNativeDriver:!0});return e.start(),()=>e.stop()},[R,F,S.motion.spring.snappy]);const B=(0,_react.useRef)((0,_index2.createAnimatedValue)(R?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(B,{toValue:R?1:0,duration:S.motion.duration.fast,easing:_reactNative.Easing.out(_reactNative.Easing.ease),useNativeDriver:!1});return e.start(),()=>e.stop()},[R,B,S.motion.duration.fast]);const D=V.padding,z=V["track-width"]-V["thumb-size"]-V.padding,E=F.interpolate({inputRange:[0,1],outputRange:[D,z]}),H=B.interpolate({inputRange:[0,1],outputRange:[A,I]}),P=(0,_react.useRef)((0,_index2.createAnimatedValue)(1)).current,M=(0,_react.useRef)(!0);(0,_react.useEffect)(()=>{if(!m)return;if(M.current)return void(M.current=!1);const e=_reactNative.Animated.sequence([_reactNative.Animated.spring(P,{toValue:1.15,damping:10,stiffness:220,mass:1,useNativeDriver:!0}),_reactNative.Animated.spring(P,{toValue:1,damping:14,stiffness:240,mass:1,useNativeDriver:!0})]);return e.start(),()=>e.stop()},[R,m,P]);const handlePress=e=>{a||(!1!==_&&(0,_hapticUtils.triggerHaptic)(_),N(!R),v.onPressOut?.(e))},L=h??(0,_FieldBase.fieldTextAsString)(l),O="string"==typeof u?u:void 0,U=(0,_ChoiceText.hasChoiceDetail)({description:c,error:O,helperText:d}),W=(0,_FieldBase.hasFieldText)(l)||U,X=(!0===u||(0,_FieldBase.hasFieldText)(u))&&!R&&!a,G="row"===p&&W,J=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[k.track,{width:V["track-width"],height:V["track-height"],borderRadius:S.radius.pill,..._corners.smoothCorners,backgroundColor:H},f],children:[X?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[k.errorRing,{borderRadius:S.radius.pill,..._corners.smoothCorners,borderWidth:S.size.border,borderColor:S.colors["field-border-error"]}]}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[k.thumb,S.shadow.card,{backgroundColor:C,width:V["thumb-size"],height:V["thumb-size"],borderRadius:S.radius.pill,..._corners.smoothCorners,transform:[{translateX:E},{scale:P}]},w]})]});if(G)return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:t,onPress:handlePress,disabled:a,accessibilityRole:"switch",accessibilityLabel:L,accessibilityHint:v.accessibilityHint??(0,_FieldBase.fieldTextAsString)(c),accessibilityState:{checked:R,disabled:a},"aria-checked":R,"aria-disabled":a,testID:g,hitSlop:y,...null==y?{}:(0,_hitSlop.hitSlopMarker)(y),...v,style:({pressed:e})=>[k.row,k.spreadRow,U?k.rowTop:null,{opacity:a?.55:e?.9:1},b,x],children:[(0,_jsxRuntime.jsx)(_ChoiceText.ChoiceText,{label:l,description:c,helperText:d,error:O,disabled:a,style:k.spreadText}),J]});const K=(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:handlePress,disabled:a,accessibilityRole:"switch",accessibilityLabel:L,accessibilityHint:v.accessibilityHint??(0,_FieldBase.fieldTextAsString)(c),accessibilityState:{checked:R,disabled:a},"aria-checked":R,"aria-disabled":a,testID:g,hitSlop:q,...(0,_hitSlop.hitSlopMarker)(q),...v,style:({pressed:e})=>[{opacity:a?.55:e?.9:1},W?null:x],children:J});return W?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[k.row,U?k.rowTop:null,b,x],children:[K,(0,_jsxRuntime.jsx)(_ChoiceText.ChoiceText,{label:l,description:c,helperText:d,error:O,disabled:a,style:k.text})]}):b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:b,children:K}):K});Switch.displayName="Switch";const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},track:{justifyContent:"center"},thumb:{position:"absolute",top:2},errorRing:{..._reactNative.StyleSheet.absoluteFill},rowTop:{alignItems:"flex-start"},text:{marginLeft:e.space.sm},spreadRow:{minHeight:44,justifyContent:"space-between"},spreadText:{flex:1,marginRight:e.space.md}});var _default=exports.default=Switch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wheel=exports.WHEEL_VISIBLE_ITEMS=exports.WHEEL_CENTER_OFFSET=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const WHEEL_VISIBLE_ITEMS=exports.WHEEL_VISIBLE_ITEMS=5,WHEEL_CENTER_OFFSET=exports.WHEEL_CENTER_OFFSET=Math.floor(WHEEL_VISIBLE_ITEMS/2),HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=(0,_react.memo)(({label:e,index:t,scrollY:a,itemHeight:n,selected:r,theme:i,reducedMotion:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wheel=exports.WHEEL_VISIBLE_ITEMS=exports.WHEEL_CENTER_OFFSET=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const WHEEL_VISIBLE_ITEMS=exports.WHEEL_VISIBLE_ITEMS=5,WHEEL_CENTER_OFFSET=exports.WHEEL_CENTER_OFFSET=Math.floor(WHEEL_VISIBLE_ITEMS/2),HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=(0,_react.memo)(({label:e,index:t,scrollY:a,itemHeight:n,selected:r,theme:i,reducedMotion:c,onPress:s,editor:l})=>{const{opacity:o,scale:u}=(0,_react.useMemo)(()=>{const e=_reactNative.Animated.subtract(_reactNative.Animated.divide(a,n),t);return{opacity:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.3,.6,1,.6,.3],extrapolate:"clamp"}),scale:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.85,.95,1.05,.95,.85],extrapolate:"clamp"})}},[a,n,t]),d=(0,_jsxRuntime.jsx)(_index2.Text,{variant:"h3",weight:r?"semibold":"medium",color:r?"primary":"secondary",numberOfLines:1,maxFontSizeMultiplier:1.5,style:{letterSpacing:i["letter-spacing"].normal},children:e});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.row,{height:n},c?{opacity:o}:{opacity:o,transform:[{scale:u}]}],accessible:!1,importantForAccessibility:"no",children:l??(s?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{focusable:!1,accessible:!1,onPress:()=>s(t),style:styles.rowPress,children:d}):d)})}),Wheel=({label:e,items:t,selectedIndex:a,onIndexChange:n,itemHeight:r,width:i,theme:c,haptic:s,disabled:l,reducedMotion:o,typeable:u,testID:d})=>{const m="web"===_reactNative.Platform.OS,[_,b]=(0,_react.useState)(null),x=(0,_react.useRef)(!1),h=(0,_react.useRef)(null),E=(0,_react.useRef)((0,_index.createAnimatedValue)(a*r)).current,y=(0,_react.useRef)(a*r),p=(0,_react.useRef)(a*r),f=(0,_react.useRef)(a),v=(0,_react.useRef)(0),S=(0,_react.useRef)(null),T=(0,_react.useRef)(()=>{}),g=t.length-1;(0,_react.useEffect)(()=>{f.current=a;const e=a*r;if(p.current===e)return;if(p.current=e,Math.abs(y.current-e)<1)return;y.current=e,m||(0,_index.setNativeValue)(E,e);const t=requestAnimationFrame(()=>{h.current?.scrollTo({y:e,animated:!1})});return()=>cancelAnimationFrame(t)},[a,r,E,m]),(0,_react.useEffect)(()=>{const e=y.current,t=requestAnimationFrame(()=>{h.current?.scrollTo({y:e,animated:!1})});return()=>cancelAnimationFrame(t)},[]),(0,_react.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]);const M=(0,_react.useCallback)((e,r)=>{if(!(e===a||e<0||e>g)){if("accessibility"===r){const e=(0,_hapticUtils.resolveHaptic)(s,"denseTick");e&&(0,_hapticUtils.triggerHaptic)(e)}if("keyboard"!==r){const a=t[e];a&&(0,_announce.announce)(a.accessibilityLabel??a.label)}n(e)}},[a,g,t,s,n]),R=(0,_react.useCallback)(()=>{!l&&u&&(x.current=!0,b(String(t[a]?.value??"")))},[l,u,t,a]),I=(0,_react.useCallback)(e=>{if(!x.current)return;x.current=!1,b(null);const a=e.trim();if(!/^\d+$/.test(a))return;const n=Number(a),r=t.findIndex(e=>e.value===n);r>=0&&M(r,"keyboard")},[t,M]);T.current=()=>{S.current=null;const e=Math.max(0,Math.min(g,Math.round(y.current/r))),t=e*r;Math.abs(y.current-t)>=1&&h.current?.scrollTo({y:t,animated:!o}),M(e,"scroll")};const j=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{y:E}}}],{useNativeDriver:!m,listener:e=>{const t=e.nativeEvent.contentOffset.y;y.current=t;const a=Math.round(t/r);if(a!==f.current&&a>=0&&a<=g){const e=Date.now();if(e-v.current>=35){const t=(0,_hapticUtils.resolveHaptic)(s,"denseTick");t&&(0,_hapticUtils.triggerHaptic)(t),v.current=e}f.current=a}m&&(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>T.current(),120))}}),[E,r,g,s,m]),L=(0,_react.useCallback)(e=>{const t=e.nativeEvent.contentOffset.y;M(Math.max(0,Math.min(g,Math.round(t/r))),"scroll")},[M,g,r]),w=(0,_react.useCallback)(e=>{if(l)return;const t=e.nativeEvent.actionName;"increment"===t?M(Math.min(g,a+1),"accessibility"):"decrement"===t&&M(Math.max(0,a-1),"accessibility")},[l,M,g,a]),A=(0,_react.useCallback)(e=>{l||h.current?.scrollTo({y:e*r,animated:!o})},[l,r,o]),C=(0,_react.useCallback)(({item:t,index:n})=>{const i=n===a,s=i&&null!==_;return(0,_jsxRuntime.jsx)(WheelRow,{label:t.label,index:n,scrollY:E,itemHeight:r,selected:i,theme:c,reducedMotion:o,onPress:i&&u?R:m?A:void 0,editor:s?(0,_jsxRuntime.jsx)(_reactNative.TextInput,{autoFocus:!0,selectTextOnFocus:!0,keyboardType:"number-pad",returnKeyType:"done",accessibilityLabel:e,value:_,onChangeText:b,onSubmitEditing:()=>I(_),onBlur:()=>I(_),style:{width:"100%",padding:c.space.none,textAlign:"center",fontSize:c.text.xl.size,color:c.colors["text-body"],fontWeight:c.weight.semibold,letterSpacing:c["letter-spacing"].normal}}):void 0})},[E,r,a,c,o,m,A,u,R,_,I,e]),N=(0,_react.useCallback)((e,t)=>`${String(e.value)}-${t}`,[]),F=t[a]?t[a].accessibilityLabel??t[a].label:"",H=m?{focusable:!0,role:"spinbutton","aria-label":e,"aria-valuetext":F,"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":g,"aria-disabled":l,onKeyDown:e=>{if(l)return;const t={ArrowDown:Math.min(g,a+1),PageDown:Math.min(g,a+1),ArrowUp:Math.max(0,a-1),PageUp:Math.max(0,a-1),Home:0,End:g}[e.key];void 0!==t&&(e.preventDefault?.(),M(t,"keyboard"))}}:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[void 0===i?styles.columnFlex:{width:i},{height:r*WHEEL_VISIBLE_ITEMS},styles.column,l?styles.disabled:null],testID:d,...H,children:[m?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:styles.a11yLayer,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:e,accessibilityValue:{text:F},accessibilityState:{disabled:Boolean(l)},"aria-disabled":Boolean(l),accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:w}),(0,_jsxRuntime.jsx)(_reactNative.Animated.ScrollView,{ref:h,showsVerticalScrollIndicator:!1,snapToInterval:r,snapToAlignment:"start",decelerationRate:"fast",bounces:!1,scrollEnabled:!l,nestedScrollEnabled:!0,scrollEventThrottle:16,onScroll:j,onMomentumScrollEnd:L,contentOffset:{x:0,y:a*r},contentContainerStyle:{paddingVertical:r*WHEEL_CENTER_OFFSET},style:[styles.list,{height:r*WHEEL_VISIBLE_ITEMS}],importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:t.map((e,t)=>(0,_jsxRuntime.jsx)(_react.Fragment,{children:C({item:e,index:t})},N(e,t)))})]})};exports.Wheel=Wheel;const styles=_reactNative.StyleSheet.create({column:{overflow:"hidden"},columnFlex:{flex:1},disabled:{opacity:.5},list:{flexGrow:0},row:{alignItems:"center",justifyContent:"center"},rowPress:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",flex:1},a11yLayer:{..._reactNative.StyleSheet.absoluteFill,zIndex:2}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NavigationScreen=NavigationScreen;var _bottomTabs=require("@react-navigation/bottom-tabs"),_native=require("@react-navigation/native"),_react=require("react"),_index=require("../components/Screen/index.js"),_index2=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const TAB_EDGES=["top"];function NavigationScreen({kind:e="pushed",appBar:t=!0,onBack:i,...n}){const o=(0,_native.useNavigation)(),r=(0,_react.useContext)(_bottomTabs.BottomTabBarHeightContext),a=!0===(0,_index2.useTheme)().settings.components.screen?.tabBarFloats,s=t?n:{...n,title:void 0,subtitle:void 0,leading:void 0,rightActions:void 0};return"tab"===e?(0,_jsxRuntime.jsx)(_index.Screen,{...s,largeTitle:!
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NavigationScreen=NavigationScreen;var _bottomTabs=require("@react-navigation/bottom-tabs"),_native=require("@react-navigation/native"),_react=require("react"),_index=require("../components/Screen/index.js"),_index2=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const TAB_EDGES=["top"];function NavigationScreen({kind:e="pushed",appBar:t=!0,onBack:i,...n}){const o=(0,_native.useNavigation)(),r=(0,_react.useContext)(_bottomTabs.BottomTabBarHeightContext),a=!0===(0,_index2.useTheme)().settings.components.screen?.tabBarFloats,s=t?n:{...n,title:void 0,subtitle:void 0,leading:void 0,trailing:void 0,rightActions:void 0};return"tab"===e?(0,_jsxRuntime.jsx)(_index.Screen,{...s,largeTitle:!1,edges:TAB_EDGES,bottomInset:a?r??0:0}):(0,_jsxRuntime.jsx)(_index.Screen,{...s,largeTitle:!1,onBack:"root"!==e&&t?i??o.goBack:void 0})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.NetworkStatusBanner=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../hooks/usePresenceMotion.js"),_index=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const NetworkStatusBanner=({message:e="You are offline. Some features may be unavailable.",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.NetworkStatusBanner=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../hooks/usePresenceMotion.js"),_index=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const NetworkStatusBanner=({message:e="You are offline. Some features may be unavailable.",restoredMessage:t="You are back online.",restoredDuration:a=2e3,position:r="top",style:o,disabled:n=!1,safeArea:i=!0})=>{const s=(0,_index.useTheme)(),u=(0,_usePresenceMotion.usePresenceMotion)(),c=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),l=i?"top"===r?c.top:c.bottom:0,[d,f]=(0,_react.useState)(0),m=d>0?d:56+l,{isConnected:_,isInternetReachable:p}=(0,_mobileCore.useNetworkStatus)(),v=!(n||_&&!1!==p),[b,x]=(0,_react.useState)("hidden"),[N,g]=(0,_react.useState)("offline");(0,_react.useEffect)(()=>{"hidden"!==b&&g(b)},[b]),(0,_react.useEffect)(()=>{x(v?"offline":n?"hidden":e=>"offline"===e?"restored":e)},[v,n]),(0,_react.useEffect)(()=>{if("restored"!==b)return;const e=setTimeout(()=>x("hidden"),a);return()=>clearTimeout(e)},[b,a]);const S="hidden"!==b,h="restored"===b||"hidden"===b&&"restored"===N,y=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current,A=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current,w=u.duration("default");(0,_react.useEffect)(()=>{_reactNative.Animated.parallel([_reactNative.Animated.timing(y,{toValue:S?1:0,duration:s.motion.duration.default,useNativeDriver:!0}),_reactNative.Animated.timing(A,{toValue:S?1:0,duration:w,useNativeDriver:!0})]).start()},[S,y,A,s.motion.duration.default,w]);const R=(0,_react.useMemo)(()=>buildStyles(s),[s]),j=y.interpolate({inputRange:[0,1],outputRange:u.range("top"===r?-m:m,0)});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:S?"auto":"none",accessibilityRole:"alert",accessibilityLiveRegion:S?"polite":"none",onLayout:e=>f(e.nativeEvent.layout.height),style:[R.container,"top"===r?R.top:R.bottom,"top"===r?{paddingTop:s.space.sm+l}:{paddingBottom:s.space.sm+l},{backgroundColor:h?s.colors["online-fill"]:s.colors["offline-fill"],opacity:A,transform:[{translateY:j}]},o],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:h?s.colors["on-success"]:s.colors["on-danger"],fontSize:s.text.sm.size,...(0,_index.fontFor)(s,"semibold"),textAlign:"center"},numberOfLines:2,children:h?t:e})})};exports.NetworkStatusBanner=NetworkStatusBanner;const buildStyles=e=>_reactNative.StyleSheet.create({container:{position:"absolute",left:0,right:0,paddingVertical:e.space.sm,paddingHorizontal:e.space.lg,zIndex:1e3,elevation:8},top:{top:0},bottom:{bottom:0}});var _default=exports.default=NetworkStatusBanner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.mergeBrand=void 0;var _componentSizes=require("./componentSizes.js"),_tokensGenerated=require("./tokens.generated.js"),_toneInk=require("./toneInk.js");const HINT="Run webority upgrade to rename old names.",BRAND_KEYS=["colors","radius","font"],COLOR_MODES=["light","dark"],FIXED_RADII=["none","pill"],RADIUS_ALLOWED="sm, md, lg, xl",SETTINGS_KEYS=["icons","gradients","textVariants","maxFontSizeMultiplier","components"],COMPONENT_SETTING_KEYS={field:{defaultVariant:!0,requiredMarker:!0},input:{defaultVariant:!0,defaultLabelMode:!0,tintLabelOnFocus:!0,shakeOnError:!0},"search-bar":{defaultVariant:!0},select:{defaultVariant:!0},"otp-input":{shakeOnError:!0},"option-sheet":{selectedMarker:!0},"profile-picker":{defaultTone:!0,defaultVariant:!0,defaultAvatarTone:!0},slider:{thumbPressAnimation:!0},rating:{pulseOnPress:!0},stepper:{pulseAnimation:!0},tooltip:{enableScaleAnimation:!0},toast:{enableSwipeDismiss:!0,defaultDurationMs:!0},button:{defaultVariant:!0,defaultSize:!0,defaultPressAnimation:!0},card:{defaultVariant:!0,defaultPadding:!0,defaultRadius:!0,defaultTitleFont:!0},"section-header":{defaultVariant:!0,defaultFlush:!0},"empty-state":{defaultSize:!0,defaultVariant:!0},screen:{tabBarFloats:!0}},isPlainObject=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),validateBrand=e=>{if(void 0===e)return;if(!isPlainObject(e))throw new Error(`A brand is an object of colors, radius and font; got ${typeof e}. ${HINT}`);for(const t of Object.keys(e))if(!BRAND_KEYS.includes(t))throw new Error(`A brand sets colors, radius and font only; ${t} is not allowed (allowed: colors, radius, font). ${HINT}`);const t=e.colors;if(void 0!==t&&!isPlainObject(t))throw new Error(`A brand's colors is an object of light and dark; got ${typeof t}. ${HINT}`);for(const e of Object.keys(t??{})){if(!COLOR_MODES.includes(e))throw new Error(`A brand sets colours under light and dark only; ${e} is not allowed (allowed: light, dark). ${HINT}`);const o=t[e];for(const e of Object.keys(o)){if(!_tokensGenerated.COLOR_NAMES.includes(e))throw new Error(`unknown colour ${e}; allowed: ${_tokensGenerated.COLOR_NAMES.join(", ")}. ${HINT}`);if(void 0!==o[e]&&"string"!=typeof o[e])throw new Error(`colour ${e} must be a string; got ${typeof o[e]}.`)}}const o=e.radius;if(void 0!==o&&!isPlainObject(o))throw new Error(`A brand's radius is an object of radius names; got ${typeof o}. ${HINT}`);for(const e of Object.keys(o??{})){const t=o[e];if(!_tokensGenerated.RADIUS_NAMES.includes(e))throw new Error(`unknown radius ${e}; allowed: ${RADIUS_ALLOWED}. ${HINT}`);if(FIXED_RADII.includes(e))throw new Error(`radius ${e} is fixed by the library; allowed: ${RADIUS_ALLOWED}.`);if("number"!=typeof t||!Number.isFinite(t))throw new Error(`radius ${e} must be a number; got ${typeof t}.`)}const n=e.font;if(void 0!==n&&!isPlainObject(n))throw new Error(`A brand's font is an object of font names; got ${typeof n}. ${HINT}`);for(const e of Object.keys(n??{})){if(!_tokensGenerated.FONT_NAMES.includes(e))throw new Error(`unknown font ${e}; allowed: ${_tokensGenerated.FONT_NAMES.join(", ")}. ${HINT}`);const t=n[e];if(!isPlainObject(t))throw new Error(`font ${e} must be an object of weights; got ${typeof t}. ${HINT}`);for(const o of Object.keys(t)){if(!_tokensGenerated.WEIGHT_NAMES.includes(o))throw new Error(`unknown font weight ${o} in font ${e}; allowed: ${_tokensGenerated.WEIGHT_NAMES.join(", ")}. ${HINT}`);const n=t[o];if("string"!=typeof n||0===n.length)throw new Error(`font ${e} weight ${o} must be a non-empty string.`)}}},validateSettings=e=>{if(void 0===e)return;if(!isPlainObject(e))throw new Error(`Theme settings is an object; got ${typeof e}. ${HINT}`);for(const t of Object.keys(e))if(!SETTINGS_KEYS.includes(t))throw new Error(`Theme settings take ${SETTINGS_KEYS.join(", ")} only; ${t} is not allowed. ${HINT}`);const t=e.components;if(void 0===t)return;if(!isPlainObject(t))throw new Error(`Theme settings components is an object of component names; got ${typeof t}. ${HINT}`);const o=COMPONENT_SETTING_KEYS;for(const e of Object.keys(t)){if(!Object.keys(o).includes(e))throw new Error(`unknown component ${e} in theme settings; allowed: ${Object.keys(COMPONENT_SETTING_KEYS).join(", ")}. ${HINT}`);const n=t[e];if(void 0===n)continue;if(!isPlainObject(n))throw new Error(`theme settings for ${e} is an object; got ${typeof n}. ${HINT}`);const r=o[e];for(const t of Object.keys(n))if(!(t in r))throw new Error(`unknown setting ${t} for ${e}; allowed: ${Object.keys(r).join(", ")}. ${HINT}`)}},TONES=["primary","success","warning","danger","info"],mergeBrand=(e,t,o)=>{validateBrand(t),validateSettings(o);const n=Object.fromEntries(Object.entries(t?.colors?.[e.mode]??{}).filter(([,e])=>void 0!==e)),r={...e.colors,...n},s={...e.radius,...t?.radius},i={...e.font};for(const o of Object.keys(t?.font??{}))i[o]={...e.font[o],...t?.font?.[o]};const a=[r.bg,r["bg-subtle"],r["bg-muted"]],d={};for(const t of TONES){const o="string"==typeof n[t];let s=r[t];if(o||"string"==typeof n[`on-${t}`]){const e=(0,_toneInk.deriveSolidFill)(s,r[`on-${t}`]);e!==s&&(d[t]=e,s=e)}if(o&&"string"!=typeof n[`${t}-text`]&&(d[`${t}-text`]=(0,_toneInk.deriveToneInk)(s,a,e.mode)),"primary"===t&&(o||void 0!==d.primary)){const t=(0,_toneInk.deriveStateFills)(s,r["on-primary"],{fill:e.colors.primary,hover:e.colors["primary-hover"],pressed:e.colors["primary-pressed"]});"string"!=typeof n["primary-hover"]&&(d["primary-hover"]=t.hover),"string"!=typeof n["primary-pressed"]&&(d["primary-pressed"]=t.pressed)}}const l={},f=new Set([...Object.keys(e.settings.components),...Object.keys(o?.components??{})]);for(const t of f)l[t]={...e.settings.components[t],...o?.components?.[t]};const c=o?.maxFontSizeMultiplier??e.settings.maxFontSizeMultiplier,u={icons:{...e.settings.icons,...o?.icons},gradients:{...e.settings.gradients,...o?.gradients},textVariants:{...e.settings.textVariants,...o?.textVariants},components:l,...void 0===c?{}:{maxFontSizeMultiplier:c}},p={...e,colors:{...r,...d},radius:s,font:i,settings:u};return(0,_componentSizes.validateComponentTokens)(p),p};exports.mergeBrand=mergeBrand;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.mergeBrand=void 0;var _componentSizes=require("./componentSizes.js"),_tokensGenerated=require("./tokens.generated.js"),_toneInk=require("./toneInk.js");const HINT="Run webority upgrade to rename old names.",BRAND_KEYS=["colors","radius","font"],COLOR_MODES=["light","dark"],FIXED_RADII=["none","pill"],RADIUS_ALLOWED="sm, md, lg, xl",SETTINGS_KEYS=["icons","gradients","textVariants","maxFontSizeMultiplier","components"],COMPONENT_SETTING_KEYS={field:{defaultVariant:!0,requiredMarker:!0},input:{defaultVariant:!0,defaultLabelMode:!0,tintLabelOnFocus:!0,shakeOnError:!0},"search-bar":{defaultVariant:!0},select:{defaultVariant:!0},"otp-input":{shakeOnError:!0},"option-sheet":{selectedMarker:!0},"profile-picker":{defaultTone:!0,defaultVariant:!0,defaultAvatarTone:!0},slider:{thumbPressAnimation:!0},rating:{pulseOnPress:!0},stepper:{pulseAnimation:!0},tooltip:{enableScaleAnimation:!0},toast:{enableSwipeDismiss:!0,defaultDurationMs:!0},button:{defaultVariant:!0,defaultSize:!0,defaultPressAnimation:!0},card:{defaultVariant:!0,defaultPadding:!0,defaultRadius:!0,defaultTitleFont:!0},"section-header":{defaultVariant:!0,defaultFlush:!0},"empty-state":{defaultSize:!0,defaultVariant:!0},screen:{tabBarFloats:!0,headerShadowOnScroll:!0}},isPlainObject=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),validateBrand=e=>{if(void 0===e)return;if(!isPlainObject(e))throw new Error(`A brand is an object of colors, radius and font; got ${typeof e}. ${HINT}`);for(const t of Object.keys(e))if(!BRAND_KEYS.includes(t))throw new Error(`A brand sets colors, radius and font only; ${t} is not allowed (allowed: colors, radius, font). ${HINT}`);const t=e.colors;if(void 0!==t&&!isPlainObject(t))throw new Error(`A brand's colors is an object of light and dark; got ${typeof t}. ${HINT}`);for(const e of Object.keys(t??{})){if(!COLOR_MODES.includes(e))throw new Error(`A brand sets colours under light and dark only; ${e} is not allowed (allowed: light, dark). ${HINT}`);const o=t[e];for(const e of Object.keys(o)){if(!_tokensGenerated.COLOR_NAMES.includes(e))throw new Error(`unknown colour ${e}; allowed: ${_tokensGenerated.COLOR_NAMES.join(", ")}. ${HINT}`);if(void 0!==o[e]&&"string"!=typeof o[e])throw new Error(`colour ${e} must be a string; got ${typeof o[e]}.`)}}const o=e.radius;if(void 0!==o&&!isPlainObject(o))throw new Error(`A brand's radius is an object of radius names; got ${typeof o}. ${HINT}`);for(const e of Object.keys(o??{})){const t=o[e];if(!_tokensGenerated.RADIUS_NAMES.includes(e))throw new Error(`unknown radius ${e}; allowed: ${RADIUS_ALLOWED}. ${HINT}`);if(FIXED_RADII.includes(e))throw new Error(`radius ${e} is fixed by the library; allowed: ${RADIUS_ALLOWED}.`);if("number"!=typeof t||!Number.isFinite(t))throw new Error(`radius ${e} must be a number; got ${typeof t}.`)}const n=e.font;if(void 0!==n&&!isPlainObject(n))throw new Error(`A brand's font is an object of font names; got ${typeof n}. ${HINT}`);for(const e of Object.keys(n??{})){if(!_tokensGenerated.FONT_NAMES.includes(e))throw new Error(`unknown font ${e}; allowed: ${_tokensGenerated.FONT_NAMES.join(", ")}. ${HINT}`);const t=n[e];if(!isPlainObject(t))throw new Error(`font ${e} must be an object of weights; got ${typeof t}. ${HINT}`);for(const o of Object.keys(t)){if(!_tokensGenerated.WEIGHT_NAMES.includes(o))throw new Error(`unknown font weight ${o} in font ${e}; allowed: ${_tokensGenerated.WEIGHT_NAMES.join(", ")}. ${HINT}`);const n=t[o];if("string"!=typeof n||0===n.length)throw new Error(`font ${e} weight ${o} must be a non-empty string.`)}}},validateSettings=e=>{if(void 0===e)return;if(!isPlainObject(e))throw new Error(`Theme settings is an object; got ${typeof e}. ${HINT}`);for(const t of Object.keys(e))if(!SETTINGS_KEYS.includes(t))throw new Error(`Theme settings take ${SETTINGS_KEYS.join(", ")} only; ${t} is not allowed. ${HINT}`);const t=e.components;if(void 0===t)return;if(!isPlainObject(t))throw new Error(`Theme settings components is an object of component names; got ${typeof t}. ${HINT}`);const o=COMPONENT_SETTING_KEYS;for(const e of Object.keys(t)){if(!Object.keys(o).includes(e))throw new Error(`unknown component ${e} in theme settings; allowed: ${Object.keys(COMPONENT_SETTING_KEYS).join(", ")}. ${HINT}`);const n=t[e];if(void 0===n)continue;if(!isPlainObject(n))throw new Error(`theme settings for ${e} is an object; got ${typeof n}. ${HINT}`);const r=o[e];for(const t of Object.keys(n))if(!(t in r))throw new Error(`unknown setting ${t} for ${e}; allowed: ${Object.keys(r).join(", ")}. ${HINT}`)}},TONES=["primary","success","warning","danger","info"],mergeBrand=(e,t,o)=>{validateBrand(t),validateSettings(o);const n=Object.fromEntries(Object.entries(t?.colors?.[e.mode]??{}).filter(([,e])=>void 0!==e)),r={...e.colors,...n},s={...e.radius,...t?.radius},i={...e.font};for(const o of Object.keys(t?.font??{}))i[o]={...e.font[o],...t?.font?.[o]};const a=[r.bg,r["bg-subtle"],r["bg-muted"]],d={};for(const t of TONES){const o="string"==typeof n[t];let s=r[t];if(o||"string"==typeof n[`on-${t}`]){const e=(0,_toneInk.deriveSolidFill)(s,r[`on-${t}`]);e!==s&&(d[t]=e,s=e)}if(o&&"string"!=typeof n[`${t}-text`]&&(d[`${t}-text`]=(0,_toneInk.deriveToneInk)(s,a,e.mode)),"primary"===t&&(o||void 0!==d.primary)){const t=(0,_toneInk.deriveStateFills)(s,r["on-primary"],{fill:e.colors.primary,hover:e.colors["primary-hover"],pressed:e.colors["primary-pressed"]});"string"!=typeof n["primary-hover"]&&(d["primary-hover"]=t.hover),"string"!=typeof n["primary-pressed"]&&(d["primary-pressed"]=t.pressed)}}const l={},f=new Set([...Object.keys(e.settings.components),...Object.keys(o?.components??{})]);for(const t of f)l[t]={...e.settings.components[t],...o?.components?.[t]};const c=o?.maxFontSizeMultiplier??e.settings.maxFontSizeMultiplier,u={icons:{...e.settings.icons,...o?.icons},gradients:{...e.settings.gradients,...o?.gradients},textVariants:{...e.settings.textVariants,...o?.textVariants},components:l,...void 0===c?{}:{maxFontSizeMultiplier:c}},p={...e,colors:{...r,...d},radius:s,font:i,settings:u};return(0,_componentSizes.validateComponentTokens)(p),p};exports.mergeBrand=mergeBrand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lightTokens=exports.darkTokens=exports.WEIGHT_NAMES=exports.TEXT_NAMES=exports.SPACE_NAMES=exports.SIZE_NAMES=exports.SHADOW_NAMES=exports.RADIUS_NAMES=exports.LETTER_SPACING_NAMES=exports.LEADING_NAMES=exports.FONT_NAMES=exports.EASE_NAMES=exports.DURATION_NAMES=exports.COMPONENT_KINDS=exports.COLOR_NAMES=void 0;const COLOR_NAMES=exports.COLOR_NAMES=["bg","bg-subtle","bg-muted","surface","surface-inverse","surface-dark","surface-dark-border","on-surface-dark","on-surface-dark-muted","text","text-body","text-muted","text-subtle","text-inverse","link","border","border-subtle","field-bg","field-border","field-border-focus","focus-ring","scrim","on-scrim","thumb","primary","primary-hover","primary-soft","primary-text","on-primary","primary-wash","primary-wash-strong","neutral","neutral-hover","neutral-text","on-neutral","success","success-soft","success-text","on-success","warning","warning-soft","warning-text","on-warning","danger","danger-soft","danger-border","danger-text","on-danger","info","info-soft","info-text","on-info","primary-pressed","on-neutral-strong","text-disabled","surface-pressed","surface-hover","surface-selected","surface-disabled","skeleton","skeleton-highlight","glass-fill","glass-border","on-glass","glass-badge","field-bg-focus","field-bg-disabled","field-border-error","field-label","field-text","field-text-disabled","field-placeholder","field-placeholder-disabled","field-icon","field-icon-focus","field-icon-disabled","field-caret","field-message","avatar-1","avatar-2","avatar-3","avatar-4","avatar-5","avatar-6","avatar-7","avatar-8"],SPACE_NAMES=exports.SPACE_NAMES=["none","xxs","xs","sm","md","lg","xl","2xl","3xl","4xl"],RADIUS_NAMES=exports.RADIUS_NAMES=["none","sm","md","lg","xl","pill"],TEXT_NAMES=exports.TEXT_NAMES=["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl"],WEIGHT_NAMES=exports.WEIGHT_NAMES=["normal","medium","semibold","bold"],LEADING_NAMES=exports.LEADING_NAMES=["heading","body","display"],LETTER_SPACING_NAMES=exports.LETTER_SPACING_NAMES=["tight","normal","wide"],FONT_NAMES=exports.FONT_NAMES=["ui","display","mono"],SHADOW_NAMES=exports.SHADOW_NAMES=["card","elevated","popover","modal","drawer"],DURATION_NAMES=exports.DURATION_NAMES=["instant","fast","default","slow","slower"],EASE_NAMES=exports.EASE_NAMES=["in-out","accelerate","decelerate","sharp"],SIZE_NAMES=exports.SIZE_NAMES=["border"],COMPONENT_KINDS=exports.COMPONENT_KINDS={field:{radius:"radius","padding-x":"space","padding-y":"space","min-height":"px",text:"text",icon:"px","label-text":"text","label-gap":"space","message-text":"text","message-gap":"space"},press:{opacity:"number"},disabled:{opacity:"number"},button:{"padding-x":"space","padding-y":"space","min-height":"px",text:"text",radius:"radius",icon:"px","badge-icon":"px"},input:{"multiline-min-height":"px"},"search-bar":{radius:"radius"},"empty-state":{icon:"px","illustration-size":"px","title-text":"text","description-text":"text","padding-y":"space","title-gap":"space","description-gap":"space"},"list-item":{"padding-y":"space","title-text":"text","subtitle-text":"text","min-height":"px"},badge:{text:"text","min-width":"px",height:"px","padding-x":"space","dot-size":"px","border-width":"px","anchor-offset":"px"},chip:{"padding-x":"space","padding-y":"space",text:"text","min-height":"px","close-size":"px","close-text":"text",gap:"space",icon:"px"},checkbox:{"box-size":"px","label-gap":"space"},radio:{outer:"px",inner:"px","label-gap":"space"},switch:{"track-width":"px","track-height":"px","thumb-size":"px",padding:"space"},"otp-input":{cell:"px",text:"text",radius:"radius",gap:"space"},"segmented-control":{height:"px",text:"text","padding-x":"space",icon:"px","track-padding":"space","underline-height":"px","pill-inset":"space"},tabs:{text:"text","padding-y":"space","padding-x":"space","scrollable-padding-x":"space",icon:"px","icon-gap":"space","track-padding":"space","underline-height":"px","pill-inset":"space","disabled-opacity":"number","badge-gap":"space"},slider:{"track-height":"px","thumb-diameter":"px"},"floating-action-button":{diameter:"px",icon:"px",text:"text","label-padding-x":"space","edge-offset":"space","bottom-offset":"space","secondary-gap":"space","stagger-ms":"ms"},dialog:{"icon-wrapper-size":"px","action-button-min-height":"px"},toast:{"icon-circle-size":"px","icon-glyph-text":"text","tint-bar-width":"px","action-min-height":"px"},banner:{"tint-bar-width":"px"},screen:{gutter:"space"}},lightTokens=exports.lightTokens={mode:"light",colors:{bg:"#ffffff","bg-subtle":"#f8f8fb","bg-muted":"#f1f1f5",surface:"#ffffff","surface-inverse":"#0f0f1a","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#252f4a","text-body":"#0f0f1a","text-muted":"#52525b","text-subtle":"#62626b","text-inverse":"#ffffff",link:"#5b5bd6",border:"#e5e5ec","border-subtle":"#efeff3","field-bg":"#f9fbfc","field-border":"#ebedf3","field-border-focus":"#bed2f9","focus-ring":"#5b5bd6",scrim:"#0f0f1a80","on-scrim":"#ffffff",thumb:"#ffffff",primary:"#5b5bd6","primary-hover":"#4f4fbf","primary-soft":"#eeeefc","primary-text":"#4f4fd3","on-primary":"#ffffff","primary-wash":"#5b5bd614","primary-wash-strong":"#5b5bd633",neutral:"#f4f4f8","neutral-hover":"#e9e9f0","neutral-text":"#52525b","on-neutral":"#0f0f1a",success:"#18864f","success-soft":"#e8faee","success-text":"#147042","on-success":"#ffffff",warning:"#f59e0b","warning-soft":"#fff8e6","warning-text":"#8f5c06","on-warning":"#0f0f1a",danger:"#e12c32","danger-soft":"#ffeaef","danger-border":"#e5484d","danger-text":"#bc1b20","on-danger":"#ffffff",info:"#1b6ef5","info-soft":"#e9f3ff","info-text":"#0958d9","on-info":"#ffffff","primary-pressed":"#4040a8","on-neutral-strong":"#ffffff","text-disabled":"#b4b4bb","surface-pressed":"#0f0f1a0f","surface-hover":"#0f0f1a0a","surface-selected":"#5b5bd61a","surface-disabled":"#f1f1f5",skeleton:"#ebedf3","skeleton-highlight":"#f5f6fa","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#ffffff","field-bg-disabled":"#f5f6fa","field-border-error":"#fdbfce","field-label":"#242f4a","field-text":"#252f4a","field-text-disabled":"#7a8197","field-placeholder":"#626d8b","field-placeholder-disabled":"#7a8197","field-icon":"#7a849f","field-icon-focus":"#4b5675","field-icon-disabled":"#c4cada","field-caret":"#5b8dee","field-message":"#d81736","avatar-1":"#5b5bd6","avatar-2":"#0a7979","avatar-3":"#a45a05","avatar-4":"#cd226e","avatar-5":"#2462eb","avatar-6":"#7c3aed","avatar-7":"#047c57","avatar-8":"#d42222"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.059,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.078,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.102,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}},darkTokens=exports.darkTokens={mode:"dark",colors:{bg:"#0b0b12","bg-subtle":"#13131c","bg-muted":"#1c1c26",surface:"#1c1c26","surface-inverse":"#fafafa","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#e2e2e2","text-body":"#fafafa","text-muted":"#b4b4bb","text-subtle":"#919199","text-inverse":"#0f0f1a",link:"#9292ee",border:"#27272f","border-subtle":"#1c1c26","field-bg":"#13131c","field-border":"#27272f","field-border-focus":"#3d5fb0","focus-ring":"#7c7ce8",scrim:"#000000a6","on-scrim":"#ffffff",thumb:"#ffffff",primary:"#7c7ce8","primary-hover":"#9292ee","primary-soft":"#1f1f3d","primary-text":"#8989ea","on-primary":"#0f0f1a","primary-wash":"#7c7ce814","primary-wash-strong":"#7c7ce833",neutral:"#1f1f26","neutral-hover":"#2a2a33","neutral-text":"#b4b4bb","on-neutral":"#fafafa",success:"#30c780","success-soft":"#04b4402e","success-text":"#30c780","on-success":"#0f0f1a",warning:"#fbbf24","warning-soft":"#dfa0002e","warning-text":"#fbbf24","on-warning":"#0f0f1a",danger:"#f87171","danger-soft":"#e826462e","danger-border":"#f87171","danger-text":"#f87171","on-danger":"#0f0f1a",info:"#60a5fa","info-soft":"#056ee92e","info-text":"#60a5fa","on-info":"#0f0f1a","primary-pressed":"#a8a8f2","on-neutral-strong":"#0f0f1a","text-disabled":"#52525b","surface-pressed":"#ffffff14","surface-hover":"#ffffff0d","surface-selected":"#7c7ce82e","surface-disabled":"#1c1c26",skeleton:"#1c1c26","skeleton-highlight":"#27272f","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#0b0b12","field-bg-disabled":"#1c1c26","field-border-error":"#8a2f42","field-label":"#e4e6ee","field-text":"#fafafa","field-text-disabled":"#71717a","field-placeholder":"#84848d","field-placeholder-disabled":"#71717a","field-icon":"#8b8b95","field-icon-focus":"#d4d4db","field-icon-disabled":"#52525b","field-caret":"#7c9ef0","field-message":"#f87171","avatar-1":"#8b8bee","avatar-2":"#2dd4bf","avatar-3":"#fcd34d","avatar-4":"#f472b6","avatar-5":"#60a5fa","avatar-6":"#a78bfa","avatar-7":"#34d399","avatar-8":"#f87171"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.502,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.549,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lightTokens=exports.darkTokens=exports.WEIGHT_NAMES=exports.TEXT_NAMES=exports.SPACE_NAMES=exports.SIZE_NAMES=exports.SHADOW_NAMES=exports.RADIUS_NAMES=exports.LETTER_SPACING_NAMES=exports.LEADING_NAMES=exports.FONT_NAMES=exports.EASE_NAMES=exports.DURATION_NAMES=exports.COMPONENT_KINDS=exports.COLOR_NAMES=void 0;const COLOR_NAMES=exports.COLOR_NAMES=["bg","bg-subtle","bg-muted","surface","surface-inverse","surface-dark","surface-dark-border","on-surface-dark","on-surface-dark-muted","text","text-body","text-muted","text-subtle","text-inverse","link","border","border-subtle","field-bg","field-border","field-border-focus","focus-ring","scrim","on-scrim","thumb","primary","primary-hover","primary-soft","primary-text","on-primary","primary-wash","primary-wash-strong","neutral","neutral-hover","neutral-text","on-neutral","success","success-soft","success-text","on-success","warning","warning-soft","warning-text","on-warning","danger","danger-soft","danger-border","danger-text","offline-fill","online-fill","on-danger","info","info-soft","info-text","on-info","primary-pressed","switch-thumb","on-neutral-strong","text-disabled","surface-pressed","surface-hover","surface-selected","surface-disabled","skeleton","skeleton-highlight","glass-fill","glass-border","on-glass","glass-badge","field-bg-focus","field-bg-disabled","field-border-error","field-label","field-text","field-text-disabled","field-placeholder","field-placeholder-disabled","field-icon","field-icon-focus","field-icon-disabled","field-caret","field-message","avatar-1","avatar-2","avatar-3","avatar-4","avatar-5","avatar-6","avatar-7","avatar-8"],SPACE_NAMES=exports.SPACE_NAMES=["none","xxs","xs","sm","md","lg","xl","2xl","3xl","4xl"],RADIUS_NAMES=exports.RADIUS_NAMES=["none","sm","md","lg","xl","pill"],TEXT_NAMES=exports.TEXT_NAMES=["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl"],WEIGHT_NAMES=exports.WEIGHT_NAMES=["normal","medium","semibold","bold"],LEADING_NAMES=exports.LEADING_NAMES=["heading","body","display"],LETTER_SPACING_NAMES=exports.LETTER_SPACING_NAMES=["tight","normal","wide"],FONT_NAMES=exports.FONT_NAMES=["ui","display","mono"],SHADOW_NAMES=exports.SHADOW_NAMES=["card","elevated","popover","modal","drawer"],DURATION_NAMES=exports.DURATION_NAMES=["instant","fast","default","slow","slower"],EASE_NAMES=exports.EASE_NAMES=["in-out","accelerate","decelerate","sharp"],SIZE_NAMES=exports.SIZE_NAMES=["border"],COMPONENT_KINDS=exports.COMPONENT_KINDS={field:{radius:"radius","padding-x":"space","padding-y":"space","min-height":"px",text:"text",icon:"px","label-text":"text","label-gap":"space","message-text":"text","message-gap":"space"},press:{opacity:"number"},disabled:{opacity:"number"},button:{"padding-x":"space","padding-y":"space","min-height":"px",text:"text",radius:"radius",icon:"px","badge-icon":"px"},input:{"multiline-min-height":"px"},"search-bar":{radius:"radius"},"empty-state":{icon:"px","illustration-size":"px","title-text":"text","description-text":"text","padding-y":"space","title-gap":"space","description-gap":"space"},"list-item":{"padding-y":"space","title-text":"text","subtitle-text":"text","min-height":"px"},badge:{text:"text","min-width":"px",height:"px","padding-x":"space","dot-size":"px","border-width":"px","anchor-offset":"px"},chip:{"padding-x":"space","padding-y":"space",text:"text","min-height":"px","close-size":"px","close-text":"text",gap:"space",icon:"px"},checkbox:{"box-size":"px","label-gap":"space"},radio:{outer:"px",inner:"px","label-gap":"space"},switch:{"track-width":"px","track-height":"px","thumb-size":"px",padding:"space"},"otp-input":{cell:"px",text:"text",radius:"radius",gap:"space"},"segmented-control":{height:"px",text:"text","padding-x":"space",icon:"px","track-padding":"space","underline-height":"px","pill-inset":"space"},tabs:{text:"text","padding-y":"space","padding-x":"space","scrollable-padding-x":"space",icon:"px","icon-gap":"space","track-padding":"space","underline-height":"px","pill-inset":"space","disabled-opacity":"number","badge-gap":"space"},slider:{"track-height":"px","thumb-diameter":"px"},"floating-action-button":{diameter:"px",icon:"px",text:"text","label-padding-x":"space","edge-offset":"space","bottom-offset":"space","secondary-gap":"space","stagger-ms":"ms"},dialog:{"icon-wrapper-size":"px","action-button-min-height":"px"},toast:{"icon-circle-size":"px","icon-glyph-text":"text","tint-bar-width":"px","action-min-height":"px"},banner:{"tint-bar-width":"px"},screen:{gutter:"space"}},lightTokens=exports.lightTokens={mode:"light",colors:{bg:"#ffffff","bg-subtle":"#f8f8fb","bg-muted":"#f1f1f5",surface:"#ffffff","surface-inverse":"#0f0f1a","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#252f4a","text-body":"#0f0f1a","text-muted":"#52525b","text-subtle":"#62626b","text-inverse":"#ffffff",link:"#5b5bd6",border:"#e5e5ec","border-subtle":"#efeff3","field-bg":"#f9fbfc","field-border":"#ebedf3","field-border-focus":"#bed2f9","focus-ring":"#5b5bd6",scrim:"#0f0f1a80","on-scrim":"#ffffff",thumb:"#ffffff",primary:"#5b5bd6","primary-hover":"#4f4fbf","primary-soft":"#eeeefc","primary-text":"#4f4fd3","on-primary":"#ffffff","primary-wash":"#5b5bd614","primary-wash-strong":"#5b5bd633",neutral:"#f4f4f8","neutral-hover":"#e9e9f0","neutral-text":"#52525b","on-neutral":"#0f0f1a",success:"#18864f","success-soft":"#e8faee","success-text":"#147042","on-success":"#ffffff",warning:"#f59e0b","warning-soft":"#fff8e6","warning-text":"#8f5c06","on-warning":"#0f0f1a",danger:"#e12c32","danger-soft":"#ffeaef","danger-border":"#e5484d","danger-text":"#bc1b20","offline-fill":"#e82646","online-fill":"#04b440","on-danger":"#ffffff",info:"#1b6ef5","info-soft":"#e9f3ff","info-text":"#0958d9","on-info":"#ffffff","primary-pressed":"#4040a8","switch-thumb":"#ffffff","on-neutral-strong":"#ffffff","text-disabled":"#b4b4bb","surface-pressed":"#0f0f1a0f","surface-hover":"#0f0f1a0a","surface-selected":"#5b5bd61a","surface-disabled":"#f1f1f5",skeleton:"#ebedf3","skeleton-highlight":"#f5f6fa","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#ffffff","field-bg-disabled":"#f5f6fa","field-border-error":"#fdbfce","field-label":"#242f4a","field-text":"#252f4a","field-text-disabled":"#7a8197","field-placeholder":"#626d8b","field-placeholder-disabled":"#7a8197","field-icon":"#7a849f","field-icon-focus":"#4b5675","field-icon-disabled":"#c4cada","field-caret":"#5b8dee","field-message":"#d81736","avatar-1":"#5b5bd6","avatar-2":"#0a7979","avatar-3":"#a45a05","avatar-4":"#cd226e","avatar-5":"#2462eb","avatar-6":"#7c3aed","avatar-7":"#047c57","avatar-8":"#d42222"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.059,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.078,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.102,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}},darkTokens=exports.darkTokens={mode:"dark",colors:{bg:"#0b0b12","bg-subtle":"#13131c","bg-muted":"#1c1c26",surface:"#1c1c26","surface-inverse":"#fafafa","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#e2e2e2","text-body":"#fafafa","text-muted":"#b4b4bb","text-subtle":"#919199","text-inverse":"#0f0f1a",link:"#9292ee",border:"#27272f","border-subtle":"#1c1c26","field-bg":"#13131c","field-border":"#27272f","field-border-focus":"#3d5fb0","focus-ring":"#7c7ce8",scrim:"#000000a6","on-scrim":"#ffffff",thumb:"#3a3e49",primary:"#7c7ce8","primary-hover":"#9292ee","primary-soft":"#1f1f3d","primary-text":"#8989ea","on-primary":"#0f0f1a","primary-wash":"#7c7ce814","primary-wash-strong":"#7c7ce833",neutral:"#1f1f26","neutral-hover":"#2a2a33","neutral-text":"#b4b4bb","on-neutral":"#fafafa",success:"#30c780","success-soft":"#04b4402e","success-text":"#30c780","on-success":"#0f0f1a",warning:"#fbbf24","warning-soft":"#dfa0002e","warning-text":"#fbbf24","on-warning":"#0f0f1a",danger:"#f87171","danger-soft":"#e826462e","danger-border":"#f87171","danger-text":"#f87171","offline-fill":"#e82646","online-fill":"#04b440","on-danger":"#0f0f1a",info:"#60a5fa","info-soft":"#056ee92e","info-text":"#60a5fa","on-info":"#0f0f1a","primary-pressed":"#a8a8f2","switch-thumb":"#ffffff","on-neutral-strong":"#0f0f1a","text-disabled":"#52525b","surface-pressed":"#ffffff14","surface-hover":"#ffffff0d","surface-selected":"#7c7ce82e","surface-disabled":"#1c1c26",skeleton:"#1c1c26","skeleton-highlight":"#27272f","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#0b0b12","field-bg-disabled":"#1c1c26","field-border-error":"#8a2f42","field-label":"#e4e6ee","field-text":"#fafafa","field-text-disabled":"#71717a","field-placeholder":"#84848d","field-placeholder-disabled":"#71717a","field-icon":"#8b8b95","field-icon-focus":"#d4d4db","field-icon-disabled":"#52525b","field-caret":"#7c9ef0","field-message":"#f87171","avatar-1":"#8b8bee","avatar-2":"#2dd4bf","avatar-3":"#fcd34d","avatar-4":"#f472b6","avatar-5":"#60a5fa","avatar-6":"#a78bfa","avatar-7":"#34d399","avatar-8":"#f87171"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.502,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.549,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Fragment,forwardRef,useCallback,useMemo,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Menu}from"../Menu/index.js";import{Text as ThemedText}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4;export const DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"});const variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1};case"large":return{height:56,titleSize:e.text["2xl"].size,titleWeight:"bold",subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1}}},ActionButton=forwardRef(({action:e,side:t,badgeStyle:i,haptic:n,flush:
|
|
1
|
+
"use strict";import{Fragment,forwardRef,useCallback,useMemo,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Menu}from"../Menu/index.js";import{Text as ThemedText}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4;export const DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"});const variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1};case"large":return{height:56,titleSize:e.text["2xl"].size,titleWeight:"bold",subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1}}},ActionButton=forwardRef(({action:e,side:t,badgeStyle:i,haptic:n,flush:l,onPress:o},s)=>{const r=useTheme(),{style:a,pressIn:c,pressOut:d}=usePressAnimation({enabled:!0}),p=useMemo(()=>buildActionStyles(r),[r]),u=e.badge,h=void 0!==u&&0!==u,g=void 0!==e.label;return _jsx(Animated.View,{style:a,children:_jsxs(Pressable,{ref:s,onPress:t=>{const i=resolveHaptic(n,"selection");i&&triggerHaptic(i),"onPress"in e&&e.onPress(),o?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:r.colors["surface-pressed"],borderless:!g},style:({pressed:e})=>[g?p.textButton:p.actionButton,l?null:"left"===t?p.actionLeft:p.actionRight,e&&!g?p.actionPressed:null,e&&g?p.textPressed:null],children:[g?_jsx(ThemedText,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):_jsx(View,{style:p.iconWrap,children:e.icon}),h?_jsx(View,{style:[p.badge,i],pointerEvents:"none",children:_jsx(ThemedText,{variant:"caption",weight:"semibold",numberOfLines:1,style:p.badgeText,children:String(u)})}):null,e.dot?_jsx(View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:p.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,AppBar=forwardRef((e,t)=>{const{title:i,subtitle:n,titleAlignment:l="left",leftAction:o,rightActions:s,leading:r,trailing:a,onBack:c,gutter:d,titleVariant:p,titleOffset:u,height:h,divider:g,elevated:m=!1,variant:x="default",transparent:f=!1,scrollY:b,style:y,containerStyle:A,titleStyle:S,subtitleStyle:j,badgeStyle:w,haptic:_,labels:v,testID:I}=e;warnInvalidValue("AppBar","variant",e.variant,["default","large","compact"]),warnInvalidValue("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const T=useMemo(()=>({...DEFAULT_APP_BAR_LABELS,...v}),[v]),B=useTheme(),L=useSafeAreaInsets(),R=useMemo(()=>variantSize(B,x),[B,x]),C=useMemo(()=>buildStyles(B),[B]),z="large"===x,P=z&&void 0!==b,[V,O]=useState(40),D=useCallback(e=>O(e.nativeEvent.layout.height),[]),W=o??(c?{icon:_jsx(AppIcon,{name:"arrow-left",size:24,color:B.colors["text-body"]}),onPress:c,accessibilityLabel:T.back}:void 0),E=a?void 0:s?.[s.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?B.space.sm:Math.max((44-(e.glyphSize??24))/2,0),k=void 0===d?null:{paddingLeft:Math.max(d-opticalInset(W),0),paddingRight:Math.max(d-opticalInset(E),0)},H=void 0!==u,F=Boolean(W)||Boolean(r),M=!H&&"left"===l&&Boolean(W),N=H||M||!F&&"left"===l,$="default"!==x||F?R.titleSize:B.text.xl.size,U=g??!1,G=StyleSheet.hairlineWidth,Z=useMemo(()=>b?{rootHeight:b.interpolate({inputRange:[0,60],outputRange:[L.top+R.height+V,L.top+R.height],extrapolate:"clamp"}),titleRowOpacity:b.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),compactTitleOpacity:b.interpolate({inputRange:[30,60],outputRange:[0,1],extrapolate:"clamp"}),borderOpacity:b.interpolate({inputRange:[0,60],outputRange:[0,1],extrapolate:"clamp"})}:null,[b,L.top,R.height,V]),Y=i?p?_jsx(ThemedText,{variant:p,align:"center"===l?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[C.titleVariant,S],children:i}):_jsx(Animated.Text,{accessibilityRole:"header",style:[C.title,{fontSize:$,fontWeight:B.weight[R.titleWeight],textAlign:"center"===l?"center":"left"},n?C.stackedText:null,S],numberOfLines:1,children:i}):null,q=P&&Z&&i?_jsx(Animated.Text,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[C.title,{fontSize:B.text.lg.size,fontWeight:B.weight.semibold,textAlign:"center"===l?"center":"left",opacity:Z.compactTitleOpacity}],numberOfLines:1,children:i}):null,J=n?_jsx(Animated.Text,{style:[C.subtitle,{textAlign:"center"===l?"center":"left"},j],numberOfLines:R.subtitleLines,children:n}):null,K=_jsxs(View,{style:[C.titleColumn,"center"===l?C.titleColumnCenter:null],children:[Y,J]}),Q=P?Animated.View:View,X=P&&Z?{height:Z.rootHeight,overflow:"hidden"}:z&&void 0===h?null:{height:(h??R.height)+L.top};return _jsxs(Q,{ref:t,testID:I,style:[C.root,{paddingTop:L.top,backgroundColor:f?"transparent":B.colors.surface},X,!P&&U?{borderBottomWidth:G,borderBottomColor:B.colors.border}:null,m&&!f?B.shadow.card:null,A,y],children:[P&&Z&&U?_jsx(Animated.View,{pointerEvents:"none",style:[C.animatedBorder,{backgroundColor:B.colors.border,opacity:Z.borderOpacity}]}):null,_jsxs(View,{testID:z&&I?`${I}-bar-row`:void 0,style:[C.row,z?{height:R.height}:{flex:1},k],children:[_jsxs(View,{testID:I?`${I}-leading-slot`:void 0,style:[C.sideSlot,N?C.sideSlotCompact:null],children:[W?_jsx(ActionButton,{action:W,side:"left",haptic:_,flush:H||M}):null,null!=r&&!1!==r?_jsx(View,{style:C.slotNode,children:r}):null]}),_jsx(View,{pointerEvents:"none",style:[C.center,"center"===l?C.centerAligned:C.centerLeft,H?{paddingLeft:F?u:B.space.none,paddingRight:B.space.none}:N?{paddingLeft:B.space.none}:null],children:z?q:K}),_jsxs(View,{style:[C.sideSlot,C.sideSlotRight,H?C.sideSlotCompact:null],children:[s?.map((e,t)=>_jsx(Fragment,{children:"menu"in e?_jsx(Menu,{items:e.menu,title:e.menuTitle,haptic:_,trigger:_jsx(ActionButton,{action:e,side:"right",badgeStyle:w,haptic:_,flush:H})}):_jsx(ActionButton,{action:e,side:"right",badgeStyle:w,haptic:_,flush:H})},`appbar-right-${t}`)),null!=a&&!1!==a?_jsx(View,{style:C.slotNode,children:a}):null]})]}),z?_jsx(Animated.View,{testID:I?`${I}-title-row`:void 0,onLayout:P?D:void 0,pointerEvents:"none",style:[{paddingHorizontal:d??B.space.md,paddingBottom:B.space.sm},P&&Z?{opacity:Z.titleRowOpacity}:null],children:K}):null]})});AppBar.displayName="AppBar";const buildStyles=e=>StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.xs},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},slotNode:{flexDirection:"row",alignItems:"center"},center:{flex:1,minWidth:0,paddingHorizontal:e.space.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column",maxWidth:"100%"},titleColumnCenter:{alignItems:"center"},title:{color:e.colors["text-body"]},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},stackedText:{includeFontPadding:!1},subtitle:{includeFontPadding:!1,color:e.colors["text-subtle"],fontSize:e.text.sm.size,fontWeight:e.weight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:StyleSheet.hairlineWidth}}),buildActionStyles=e=>StyleSheet.create({actionButton:{width:44,height:44,borderRadius:e.radius.pill,...smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:e.space.xs},actionRight:{marginLeft:e.space.xs},actionPressed:{backgroundColor:e.colors["surface-pressed"]},textButton:{minWidth:44,minHeight:44,paddingHorizontal:e.space.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},dot:{position:"absolute",top:10,right:10,width:8,height:8,borderRadius:e.radius.pill,backgroundColor:e.colors.danger},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:4,right:4,minWidth:16,height:16,paddingHorizontal:e.space.xs,borderRadius:e.radius.pill,...smoothCorners,backgroundColor:e.colors.danger,alignItems:"center",justifyContent:"center"},badgeText:{color:e.colors["on-danger"],fontSize:e.text.xs.size,fontWeight:e.weight.semibold,lineHeight:13}});export{AppBar};export default AppBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{ACCESS_TOKEN_KEY,getConfigValue,getToken,isStorageAvailable,Logger,publicClient,Storage}from"@webority/mobile-core";import{
|
|
1
|
+
"use strict";import{ACCESS_TOKEN_KEY,getConfigValue,getToken,isStorageAvailable,Logger,publicClient,Storage}from"@webority/mobile-core";import{AppState}from"react-native";import{hashString}from"../../utils/hashString.js";import{clearImages,deleteImage,imageExists,imageUri,listImageNames,writeImage}from"./imageStore";const INDEX_KEY="@webority/authed-image/v2/index",LEGACY_PREFIX="@webority/authed-image/v1/",DEFAULT_BYTE_CEILING=52428800,TOUCH_PERSIST_MS=36e5,PERSIST_DELAY_MS=1e3;export const DEFAULT_TTL_MS=6048e5;let byteCeiling=52428800;export const setAuthedImageCacheLimit=e=>{if(!Number.isFinite(e)||e<=0)throw new Error(`[@webority/mobile-ui] setAuthedImageCacheLimit() needs a positive number of bytes, received ${String(e)}. Pass e.g. 50 * 1024 * 1024 for 50 MB.`);byteCeiling=e};export const getAuthedImageCacheLimit=()=>byteCeiling;export const deriveCacheKey=(e,t)=>hashString(t??e);const toMeta=({fetchedAt:e,bytes:t,contentType:s,lastAccessedAt:r})=>({fetchedAt:e,bytes:t,contentType:s,lastAccessedAt:r});let index=null,indexBytes=0,indexLoad=null,persistTimer=null,persistTarget=null,appStateSub=null;const persistIndex=async e=>{if(!isStorageAvailable())return;const t={};for(const[s,r]of e)t[s]={...r,persistedAccessAt:r.lastAccessedAt};if(await Storage.setItem(INDEX_KEY,JSON.stringify(t)))for(const t of e.values())t.persistedAccessAt=t.lastAccessedAt},schedulePersist=e=>{persistTarget=e,null===appStateSub&&(appStateSub=AppState.addEventListener("change",e=>{"active"!==e&&flushAuthedImageIndex()})),null===persistTimer&&(persistTimer=setTimeout(()=>{flushAuthedImageIndex()},1e3))};export const flushAuthedImageIndex=async()=>{null!==persistTimer&&(clearTimeout(persistTimer),persistTimer=null);const e=persistTarget;persistTarget=null,null!==e&&await persistIndex(e)};const removeLegacyEntries=async()=>{const e=(await Storage.getAllKeys()).filter(e=>e.startsWith(LEGACY_PREFIX));e.length>0&&await Storage.multiRemove(e)},removeOrphanFiles=e=>{try{const t=new Set([...e.values()].map(e=>e.fileName));for(const e of listImageNames())t.has(e)||deleteImage(e)}catch(e){Logger.warn("[@webority/mobile-ui] AuthedImage could not tidy the image cache folder",e)}},readStoredIndex=async()=>{const e=new Map;if(!isStorageAvailable())return e;const t=await Storage.getItem(INDEX_KEY);if(!t)return await removeLegacyEntries(),e;try{for(const[s,r]of Object.entries(JSON.parse(t)))e.set(s,r)}catch{}return e},loadIndex=()=>index?Promise.resolve(index):(indexLoad||(indexLoad=readStoredIndex().then(e=>{removeOrphanFiles(e);for(const[t,s]of e)imageExists(s.fileName)||e.delete(t);return index=e,indexBytes=[...e.values()].reduce((e,t)=>e+t.bytes,0),e}).finally(()=>{indexLoad=null})),indexLoad),deleteFile=e=>{try{deleteImage(e)}catch(e){Logger.warn("[@webority/mobile-ui] AuthedImage could not delete a cached image file",e)}};export const readEntry=async e=>{const t=await loadIndex(),s=t.get(e);return s?imageExists(s.fileName)?{fileUri:imageUri(s.fileName),meta:toMeta(s)}:(t.delete(e),indexBytes-=s.bytes,schedulePersist(t),null):null};export const removeEntry=async e=>{const t=await loadIndex(),s=t.get(e);s&&(t.delete(e),indexBytes-=s.bytes,deleteFile(s.fileName),schedulePersist(t))};export class AuthedImageHttpError extends Error{constructor(e,t){super(e),this.name="AuthedImageHttpError",this.status=t}}export const isPermanentRefusal=e=>e instanceof AuthedImageHttpError&&e.status>=400&&e.status<500&&408!==e.status&&429!==e.status;export const isFresh=(e,t,s=Date.now())=>s-e.fetchedAt<t;export const touchEntry=async e=>{const t=await loadIndex(),s=t.get(e);s&&(s.lastAccessedAt=Date.now(),s.lastAccessedAt-s.persistedAccessAt>=36e5&&schedulePersist(t))};const evictIfNeeded=e=>{let t=indexBytes;if(t<=byteCeiling)return 0;const s=[...e].sort(([,e],[,t])=>e.lastAccessedAt-t.lastAccessedAt);let r=0;for(const[i,a]of s){if(t<=byteCeiling)break;e.delete(i),indexBytes-=a.bytes,deleteFile(a.fileName),t-=a.bytes,r+=1}return r};export const clearAuthedImageCache=async()=>{null!==persistTimer&&(clearTimeout(persistTimer),persistTimer=null),persistTarget=null;(await loadIndex()).clear(),indexBytes=0,clearImages(),isStorageAvailable()&&await Storage.removeItem(INDEX_KEY)};export const authedImageCacheStats=async()=>{const e=await loadIndex();let t=0;for(const s of e.values())t+=s.bytes;return{entries:e.size,bytes:t}};const responseHeader=(e,t)=>{if(!e||"object"!=typeof e)return;const s=e.get,r="function"==typeof s?s.call(e,t):e[t];return"string"==typeof r?r:void 0},originOf=e=>{const t=/^([a-z][a-z0-9+.-]*:\/\/[^/?#]+)/i.exec(e);return t?t[1].toLowerCase():null},isOwnApiAddress=e=>{const t=originOf(e);if(null===t)return!0;const s=getConfigValue("baseUrl");return"string"==typeof s&&originOf(s)===t},fetchAndStore=async(e,t,s)=>{const r={Accept:"image/*",...t.headers};if(!t.client&&t.authenticated&&isOwnApiAddress(t.uri)){const e=await getToken(ACCESS_TOKEN_KEY);e?.token&&(r.Authorization=`Bearer ${e.token}`)}const i=t.client??publicClient;let a;try{a=await i.get(t.uri,{headers:r,responseType:"arraybuffer",signal:s})}catch(e){const s=e?.response?.status;if("number"!=typeof s)throw e;throw new AuthedImageHttpError(`[@webority/mobile-ui] AuthedImage could not load "${t.uri}": the server answered ${s}. Check the URL and whether the request needs to be signed in (pass the signed-in client as \`client\`, or authenticated={false} for public media).`,s)}const n=new Uint8Array(a.data??new ArrayBuffer(0));if(0===n.byteLength)throw new AuthedImageHttpError(`[@webority/mobile-ui] AuthedImage could not load "${t.uri}": the server answered with an empty body, so the address holds no image.`,404);const o=responseHeader(a.headers,"content-type"),l=(o?o.split(";")[0].trim():"")||"image/jpeg",c=await loadIndex(),d=Date.now(),u=`${e}-${d.toString(36)}`;let g;try{g=writeImage(u,n,l)}catch(e){throw new Error(`[@webority/mobile-ui] AuthedImage fetched "${t.uri}" but could not write it to the app's cache folder: ${e instanceof Error?e.message:String(e)}. The device may be out of storage.`)}const m={fetchedAt:d,bytes:n.byteLength,contentType:l,lastAccessedAt:d,fileName:u,persistedAccessAt:d},h=c.get(e);h&&(indexBytes-=h.bytes),c.set(e,m),indexBytes+=m.bytes,h&&h.fileName!==u&&deleteFile(h.fileName);const p=evictIfNeeded(c);return schedulePersist(c),p>0&&Logger.info(`[@webority/mobile-ui] AuthedImage evicted ${p} cached image(s) over the byte ceiling`),{fileUri:g,meta:toMeta(m)}},inFlight=new Map;export const acquireFetch=(e,t)=>{const s=inFlight.get(e);if(s)return s.waiters+=1,s;const r=new AbortController,i={controller:r,waiters:1,promise:Promise.resolve()};return i.promise=fetchAndStore(e,t,r.signal).finally(()=>{inFlight.get(e)===i&&inFlight.delete(e)}),inFlight.set(e,i),i};export const releaseFetch=(e,t)=>{t.waiters-=1,t.waiters>0||(inFlight.get(e)===t&&inFlight.delete(e),t.controller.abort())};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{Directory,File,Paths}from"expo-file-system";const FOLDER="authed-images",imageFile=e=>new File(Paths.cache,FOLDER,e);export const writeImage=(e,t,i)=>{const s=imageFile(e);return s.create({intermediates:!0,overwrite:!0}),s.write(t),s.uri};export const imageUri=e=>imageFile(e).uri;export const imageExists=e=>imageFile(e).exists;export const deleteImage=e=>{const t=imageFile(e);t.exists&&t.delete()};export const listImageNames=()=>{const e=new Directory(Paths.cache,FOLDER);return e.exists?e.list().map(e=>e.uri.slice(e.uri.lastIndexOf("/")+1)):[]};export const clearImages=()=>{const e=new Directory(Paths.cache,FOLDER);e.exists&&e.delete()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const urls=new Map;export const writeImage=(e,t,s)=>{const r=urls.get(e);void 0!==r&&URL.revokeObjectURL(r);const o=URL.createObjectURL(new Blob([t],{type:s}));return urls.set(e,o),o};export const imageUri=e=>urls.get(e)??"";export const imageExists=e=>urls.has(e);export const deleteImage=e=>{const t=urls.get(e);void 0!==t&&(URL.revokeObjectURL(t),urls.delete(e))};export const listImageNames=()=>[...urls.keys()];export const clearImages=()=>{for(const e of urls.values())URL.revokeObjectURL(e);urls.clear()};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{formatCompactNumber,formatNumber}from"@webority/mobile-core";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{Gesture,GestureDetector}from"react-native-gesture-handler";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{Text}from"../Text/index.js";import{barScale}from"./scale.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export const DEFAULT_BAR_CHART_LABELS=Object.freeze({chart:"Bar chart",noData:"no data",highest:(e,t)=>`Highest: ${e}, ${t}`});const AUTO_VALUES_MAX_BARS=7,MAX_BAR_WIDTH=40,BAR_SHARE=.6,MIN_BAR_HEIGHT=2,VALUE_LABEL_ROOM=20,PLOT_PAD=6,HEADER_MIN_HEIGHT=48,AXIS_LABEL_MIN_WIDTH=44,CHAR_WIDTH=
|
|
1
|
+
"use strict";import{formatCompactNumber,formatNumber}from"@webority/mobile-core";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{Gesture,GestureDetector}from"react-native-gesture-handler";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{Text}from"../Text/index.js";import{barScale}from"./scale.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export const DEFAULT_BAR_CHART_LABELS=Object.freeze({chart:"Bar chart",noData:"no data",highest:(e,t)=>`Highest: ${e}, ${t}`});const AUTO_VALUES_MAX_BARS=7,MAX_BAR_WIDTH=40,BAR_SHARE=.6,MIN_BAR_HEIGHT=2,VALUE_LABEL_ROOM=20,PLOT_PAD=6,HEADER_MIN_HEIGHT=48,AXIS_LABEL_MIN_WIDTH=44,CHAR_WIDTH=8,SWATCH_SIZE=10,STACK_TONES=["primary","info","success","warning","danger","neutral"],FONT_SCALE_CAP=1.2,toneColor=(e,t)=>"neutral"===t?e.colors["text-muted"]:e.colors[`${t}-text`],safe=e=>"number"==typeof e&&Number.isFinite(e)?e:0,defaultFormatValue=e=>formatNumber(e),defaultFormatTick=e=>formatCompactNumber(e),BarChart=forwardRef((e,t)=>{const{data:r,tone:a="primary",color:s,series:o,height:i=160,label:l,summary:n,formatValue:c=defaultFormatValue,formatTick:u=defaultFormatTick,showValues:m,selection:h,defaultSelection:d=null,onSelect:p,haptic:x,labels:f,style:b,testID:y}=e;warnInvalidValue("BarChart","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const _=useMemo(()=>({...DEFAULT_BAR_CHART_LABELS,...f}),[f]),g=useTheme(),w=r.length,[S,j]=useState(0),[T,C]=useControllableState({value:h,defaultValue:d,onChange:p}),M=null!==T&&T>=0&&T<w?T:null,v=useRef(M);v.current=M;const R=useRef(-1),A=resolveHaptic(x,"tick"),L=useCallback(()=>{A&&triggerHaptic(A)},[A]),V=m??(w>0&&w<=7),I=void 0!==o&&o.length>0,D=useMemo(()=>I?o.map((e,t)=>e.tone??STACK_TONES[t%STACK_TONES.length]):[],[I,o]),E=useMemo(()=>I?o.map(e=>e.key):[],[I,o]),$=useMemo(()=>I?r.map(e=>o.map(t=>safe(e.values?.[t.key]))):null,[r,o,I]),k=useMemo(()=>$?$.map(e=>e.reduce((e,t)=>e+t,0)):r.map(e=>safe(e.value)),[r,$]),B=useMemo(()=>$?$.flatMap(e=>[e.reduce((e,t)=>t>0?e+t:e,0),e.reduce((e,t)=>t<0?e+t:e,0)]):k,[$,k]),H=useMemo(()=>barScale(B),[B]),O=V?20:6,F=V&&H.min<0?20:6,N=Math.max(1,i-O-F),G=useCallback(e=>O+(H.max-e)/(H.max-H.min)*N,[O,H.max,H.min,N]),W=G(0),U=useMemo(()=>H.ticks.map(e=>u(e)),[H.ticks,u]),z=Math.ceil(8*Math.max(...U.map(e=>e.length),1)*1.2)+g.space.xs,P=w>0?S/w:0,X=Math.max(1,Math.ceil(44/Math.max(1,P||44))),K=useCallback(e=>{const t=r[e];return t.accessibilityLabel?t.accessibilityLabel:$&&o?`${t.label}, ${o.map((t,r)=>`${t.label} ${c($[e][r])}`).join(", ")}`:`${t.label}, ${c(k[e])}`},[r,c,k,$,o]),J=useMemo(()=>{let e=-1;return k.forEach((t,r)=>{(-1===e||t>k[e])&&(e=r)}),e},[k]),Y=n??(J>=0?_.highest(r[J].label,c(k[J])):""),Z=useRef({fire:L,setSelected:C,count:w,plotWidth:S});Z.current={fire:L,setSelected:C,count:w,plotWidth:S};const q=useMemo(()=>{const indexAt=e=>{const{count:t,plotWidth:r}=Z.current;return 0===t||r<=0||!Number.isFinite(e)?-1:Math.min(t-1,Math.max(0,Math.floor(e/r*t)))},scrubTo=e=>{const t=indexAt(e);t<0||t===R.current||(R.current=t,Z.current.fire(),Z.current.setSelected(t))},e=Gesture.Pan().runOnJS(!0).activeOffsetX([-8,8]).failOffsetY([-12,12]).onStart(e=>{R.current=v.current??-1,scrubTo(e.x)}).onUpdate(e=>scrubTo(e.x)).withTestId(y?`${y}-pan`:"bar-chart-pan"),t=Gesture.Tap().runOnJS(!0).onEnd((e,t)=>{if(!t)return;const r=indexAt(e.x);r<0||(Z.current.fire(),R.current=r,Z.current.setSelected(r===v.current?null:r))}).withTestId(y?`${y}-tap`:"bar-chart-tap");return Gesture.Race(e,t)},[y]),Q=useCallback(e=>{if(0===w)return;const t=v.current,r="increment"===e.nativeEvent.actionName?null===t?0:Math.min(w-1,t+1):null===t?w-1:Math.max(0,t-1);r!==t&&(L(),C(r))},[w,L,C]),ee=useCallback(e=>{const t=Math.round(e.nativeEvent.layout.width);j(e=>e===t?e:t)},[]),te=s??toneColor(g,a),re=g.radius.sm,ae=l??_.chart,se=0===w?`${ae}, ${_.noData}`:Y?`${ae}, ${Y}`:ae,oe=null===M?Y:K(M),ie=Math.min(40,Math.max(4,.6*P)),renderStack=(e,t,r)=>{const a=e.reduce((e,t)=>t>0?e+t:e,0),s=e.reduce((e,t)=>t<0?e+t:e,0);if(0===a&&0===s)return null;const o=G(a),i=[];let l=0,n=0;return e.forEach((e,r)=>{if(0===e)return;const a=e>0?l:n,s=a+e;e>0?l=s:n=s;const c=G(a),u=G(s);i.push(_jsx(View,{testID:y?`${y}-bar-${t}-series-${r}`:void 0,style:{position:"absolute",left:0,right:0,top:Math.min(c,u)-o,height:Math.abs(c-u),backgroundColor:toneColor(g,D[r])}},E[r]))}),_jsx(View,{testID:y?`${y}-bar-${t}`:void 0,style:{position:"absolute",left:(P-ie)/2,top:o,width:ie,height:Math.max(2,G(s)-o),overflow:"hidden",opacity:r?.4:1,...smoothCorners,...a>0?{borderTopLeftRadius:re,borderTopRightRadius:re}:null,...s<0?{borderBottomLeftRadius:re,borderBottomRightRadius:re}:null},children:i})},le=k.map((e,t)=>{const r=G(e),a=e>=0?r:W,s=0===e?0:Math.max(2,Math.abs(r-W)),o=null!==M&&M!==t;return _jsxs(View,{style:[styles.slot,{height:i}],children:[S>0&&$?renderStack($[t],t,o):null,S>0&&!$&&s>0?_jsx(View,{testID:y?`${y}-bar-${t}`:void 0,style:{position:"absolute",left:(P-ie)/2,top:a,width:ie,height:s,backgroundColor:te,opacity:o?.4:1,...smoothCorners,...e>=0?{borderTopLeftRadius:re,borderTopRightRadius:re}:{borderBottomLeftRadius:re,borderBottomRightRadius:re}}}):null,V&&S>0?_jsx(Text,{variant:"caption",color:"secondary",align:"center",numberOfLines:1,maxFontSizeMultiplier:1.2,style:{position:"absolute",left:0,right:0,top:e>=0?($?G(B[2*t]):r)-20+2:($?G(B[2*t+1]):r)+2},children:u(e)}):null]},t)});return 0===w?_jsx(View,{ref:t,accessible:!0,accessibilityRole:"image",accessibilityLabel:se,testID:y,style:[styles.root,b],children:_jsx(Text,{variant:"bodySmall",color:"secondary",children:"No data"})}):_jsxs(View,{ref:t,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:se,accessibilityValue:{min:0,max:w-1,now:M??0,text:oe},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:Q,testID:y,style:[styles.root,b],children:[_jsx(View,{style:[styles.header,{minHeight:48,marginBottom:g.space.sm}],children:null===M?Y?_jsx(Text,{variant:"bodySmall",color:"secondary",children:Y}):null:_jsxs(_Fragment,{children:[_jsx(Text,{variant:"caption",color:"secondary",numberOfLines:1,children:r[M].label}),_jsx(Text,{variant:"h3",numberOfLines:1,testID:y?`${y}-callout`:void 0,children:c(k[M])})]})}),_jsxs(View,{style:styles.body,children:[_jsx(View,{style:{width:z,height:i},children:H.ticks.map((e,t)=>_jsx(Text,{variant:"caption",color:"tertiary",align:"right",numberOfLines:1,maxFontSizeMultiplier:1.2,style:{position:"absolute",right:g.space.xs,left:0,top:G(e)-8},children:U[t]},e))}),_jsxs(View,{style:styles.plotColumn,children:[_jsx(GestureDetector,{gesture:q,children:_jsxs(View,{style:{height:i},onLayout:ee,testID:y?`${y}-plot`:void 0,children:[H.ticks.map(e=>_jsx(View,{pointerEvents:"none",style:{position:"absolute",left:0,right:0,top:G(e)-(0===e?.75:StyleSheet.hairlineWidth),height:0===e?1.5:2*StyleSheet.hairlineWidth,backgroundColor:0===e?g.colors["text-subtle"]:g.colors["border-subtle"]}},e)),_jsx(View,{style:[styles.slots,{height:i}],children:le})]})}),_jsx(View,{style:styles.axis,children:r.map((e,t)=>_jsx(View,{style:styles.axisSlot,children:t%X===0?_jsx(Text,{variant:"caption",color:M===t?"primary":"tertiary",weight:M===t?"semibold":void 0,align:"center",numberOfLines:1,maxFontSizeMultiplier:1.2,style:P>0?{width:P*X}:void 0,children:e.axisLabel??e.label}):null},t))})]})]}),o&&I?_jsx(View,{style:[styles.legend,{marginTop:g.space.sm,columnGap:g.space.md,rowGap:g.space.xs}],children:o.map((e,t)=>_jsxs(View,{style:[styles.legendItem,{columnGap:g.space.xs}],children:[_jsx(View,{style:{width:10,height:10,borderRadius:g.radius.sm,...smoothCorners,backgroundColor:toneColor(g,D[t])}}),_jsx(Text,{variant:"caption",color:"secondary",numberOfLines:1,maxFontSizeMultiplier:1.2,children:e.label})]},e.key))}):null]})});BarChart.displayName="BarChart";const styles=StyleSheet.create({root:{alignSelf:"stretch"},header:{justifyContent:"center"},body:{flexDirection:"row"},plotColumn:{flex:1},slots:{flexDirection:"row"},slot:{flex:1},axis:{flexDirection:"row"},legend:{flexDirection:"row",flexWrap:"wrap"},legendItem:{flexDirection:"row",alignItems:"center"},axisSlot:{flex:1,alignItems:"center",overflow:"visible"}});export{BarChart};export default BarChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useMemo}from"react";import{Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{RadioDot}from"../Radio/RadioDot.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const sizeTokensOf=e=>({sm:{paddingHorizontal:e.space.sm,chipPaddingHorizontal:e.space.md,paddingVertical:e.space.xs,fontSize:e.text.sm.size,minHeight:32,iconSize:14},md:{paddingHorizontal:e.space.md,chipPaddingHorizontal:e.space.lg,paddingVertical:e.space.sm,fontSize:e.text.base.size,minHeight:40,iconSize:16},lg:{paddingHorizontal:e.space.lg,chipPaddingHorizontal:e.space.xl,paddingVertical:e.space.md,fontSize:e.text.lg.size,minHeight:48,iconSize:18}}),ChoiceGroup=forwardRef((e,i)=>{const{options:o,getOptionLabel:t,getOptionValue:r,isOptionDisabled:l,getOptionDescription:a,getOptionIcon:s,getOptionColor:n,renderOption:d,variant:c="card",indicatorPosition:p="trailing",direction:u="row",gap:m,wrap:g=!1,fullWidth:h,disabled:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useMemo}from"react";import{Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{RadioDot}from"../Radio/RadioDot.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const sizeTokensOf=e=>({sm:{paddingHorizontal:e.space.sm,chipPaddingHorizontal:e.space.md,paddingVertical:e.space.xs,fontSize:e.text.sm.size,minHeight:32,iconSize:14},md:{paddingHorizontal:e.space.md,chipPaddingHorizontal:e.space.lg,paddingVertical:e.space.sm,fontSize:e.text.base.size,minHeight:40,iconSize:16},lg:{paddingHorizontal:e.space.lg,chipPaddingHorizontal:e.space.xl,paddingVertical:e.space.md,fontSize:e.text.lg.size,minHeight:48,iconSize:18}}),ChoiceGroup=forwardRef((e,i)=>{const{options:o,getOptionLabel:t,getOptionValue:r,isOptionDisabled:l,getOptionDescription:a,getOptionIcon:s,getOptionColor:n,renderOption:d,variant:c="card",indicatorPosition:p="trailing",direction:u="row",gap:m,wrap:g=!1,fullWidth:h,disabled:x=!1,size:b="md",labelLines:f,descriptionLines:y=2,haptic:z,accessibilityLabel:C,style:j,optionStyle:S,description:v,helperText:w,error:H,testID:V}=e,T=useTheme(),_=useMemo(()=>buildStyles(T),[T]),k=useMemo(()=>sizeTokensOf(T)[b],[T,b]);warnInvalidValue("ChoiceGroup","variant",e.variant,["card","chip"]),warnInvalidValue("ChoiceGroup","size",e.size,["sm","md","lg"]),warnInvalidValue("ChoiceGroup","direction",e.direction,["row","column"]),warnInvalidValue("ChoiceGroup","indicatorPosition",e.indicatorPosition,["leading","trailing"]),warnInvalidValue("ChoiceGroup","selectionMode",e.selectionMode,["single","multiple"]);const I=useCallback(e=>t?t(e):e.label??"",[t]),D=useCallback(e=>r?r(e):e.value,[r]),O=useCallback(e=>l?l(e):!0===e.disabled,[l]),G=useCallback(e=>a?a(e):e.description,[a]),L=useCallback(e=>s?s(e):e.icon,[s]),M=useCallback(e=>n?n(e):e.color,[n]),P="multiple"===e.selectionMode,{min:R,max:F}=e,[W,B]=useControllableState({value:e.value,defaultValue:e.defaultValue??(P?[]:void 0),onChange:e.onChange}),A=Array.isArray(W)?W:[],$=useCallback(e=>{const i=D(e);if(P){const e=A.includes(i);if(e&&null!=R&&A.length<=R)return;if(!e&&null!=F&&A.length>=F)return;const o=resolveHaptic(z,"selection");return o&&triggerHaptic(o),void B(e?A.filter(e=>e!==i):[...A,i])}const o=resolveHaptic(z,"selection");o&&triggerHaptic(o),B(i)},[z,P,R,F,A,B,D]),N=h??("card"===c&&"row"===u&&!g),q=g||N&&"row"===u,E=T.radius.md,surfaceFor=(e,i,o)=>i?{borderColor:T.colors.border,backgroundColor:T.colors["surface-disabled"]}:{borderColor:e?o:T.colors.border,backgroundColor:e?tintOf(o,.12,T.colors["surface-selected"]):T.colors.bg},renderIcon=(e,i,o,t)=>{const r=L(e);if(null==r)return null;return renderSlotIcon("string"==typeof r&&i?{name:r,variant:"bold"}:r,{color:o,size:k.iconSize,disabled:t})},renderChip=e=>{const{option:i,selected:o,disabled:t,color:r}=e,l=t?T.colors["text-disabled"]:o?r:T.colors["text-body"],a=renderIcon(i,o,l,t);return _jsxs(View,{style:[_.chip,{minHeight:k.minHeight,paddingHorizontal:k.chipPaddingHorizontal,paddingVertical:k.paddingVertical,borderRadius:T.radius.pill,...smoothCorners,borderWidth:T.size.border,...surfaceFor(o,t,r),columnGap:T.space.xs}],children:[a?_jsx(View,{children:a}):null,_jsx(Text,{weight:"medium",numberOfLines:f,ellipsizeMode:"tail",style:[_.cardLabel,{color:l,fontSize:k.fontSize,lineHeight:Math.round(k.fontSize*T.leading.body)}],children:I(i)})]})},renderDefaultCard=e=>{const{option:i,selected:o,disabled:t,color:r}=e,l=M(i),a=t?T.colors["text-disabled"]:l??T.colors["text-body"],s=G(i),n=renderIcon(i,o,a,t),d=_jsx(RadioDot,{selected:o,color:r,disabled:t,size:b});return _jsxs(View,{style:[_.card,{minHeight:k.minHeight,paddingHorizontal:k.paddingHorizontal,paddingVertical:k.paddingVertical,borderRadius:E,...smoothCorners,borderWidth:T.size.border,...surfaceFor(o,t,r),columnGap:T.space.sm}],children:["leading"===p?d:null,n?_jsx(View,{children:n}):null,_jsxs(View,{style:_.cardTextWrap,children:[_jsx(Text,{weight:"medium",numberOfLines:f,ellipsizeMode:"tail",style:[_.cardLabel,{color:a,fontSize:k.fontSize,lineHeight:Math.round(k.fontSize*T.leading.body)}],children:I(i)}),s?_jsx(Text,{numberOfLines:y,ellipsizeMode:"tail",style:[_.cardDescription,{color:o?T.colors["text-muted"]:T.colors["text-subtle"],fontSize:T.text.xs.size,lineHeight:Math.round(T.text.xs.size*T.leading.body)}],children:s}):null]}),"trailing"===p?d:null]})},J="string"==typeof H&&""!==H?H:void 0,K=!0===H||void 0!==J?null:w,Q=_jsx(View,{ref:i,accessibilityRole:P?void 0:"radiogroup",accessibilityLabel:C,accessibilityState:{disabled:x},"aria-disabled":x,testID:V,style:[{flexDirection:u,gap:m??T.space.sm,flexWrap:q?"wrap":"nowrap"},j],children:o.map((e,i)=>{const o=D(e),t=P?A.includes(o):W===o,r=P&&null!=F&&!t&&A.length>=F,l=x||r||O(e),a=M(e)??T.colors.primary,s=d||"card"!==c?void 0:G(e);return _jsx(Pressable,{testID:e.testID,onPress:()=>{l||$(e)},disabled:l,accessibilityRole:P?"checkbox":"radio",accessibilityLabel:s?`${I(e)}, ${s}`:I(e),accessibilityState:{checked:t,disabled:l},"aria-checked":t,"aria-disabled":l,style:[N?_.stretchOption:null,{opacity:l&&d?.55:1},S],children:({pressed:o})=>{const r={option:e,index:i,selected:t,pressed:o&&!l,disabled:l,color:a};return _jsx(_Fragment,{children:d?d(r):"chip"===c?renderChip(r):renderDefaultCard(r)})}},String(o))})});return hasChoiceDetail({description:v,error:J,helperText:K??void 0})?_jsxs(View,{children:[v?_jsx(Text,{variant:"bodySmall",color:"secondary",style:{marginBottom:T.space.xs},children:v}):null,Q,void 0!==J?_jsx(Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",style:{marginTop:T.space.xs},children:J}):K?_jsx(Text,{variant:"caption",color:"tertiary",style:{marginTop:T.space.xs},children:K}):null]}):Q});ChoiceGroup.displayName="ChoiceGroup";const buildStyles=e=>StyleSheet.create({stretchOption:{flexGrow:1,flexShrink:0,flexBasis:"auto"},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flexGrow:1,flexShrink:1,flexBasis:"auto"},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:e.space.xxs}});export{ChoiceGroup};export default ChoiceGroup;
|