@webority/mobile-ui 0.183.0 → 0.184.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.
Files changed (44) hide show
  1. package/dist/canvas-kit/kit.js +4 -4
  2. package/dist/canvas-kit/manifest.json +8 -1
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/lib/commonjs/components/Box/Box.js +1 -1
  5. package/lib/commonjs/components/Button/Button.js +1 -1
  6. package/lib/commonjs/components/Card/Card.js +1 -1
  7. package/lib/commonjs/components/Chip/Chip.js +1 -1
  8. package/lib/commonjs/components/EmptyState/EmptyState.js +1 -1
  9. package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
  10. package/lib/commonjs/components/FilterChipRow/FilterChipRow.js +1 -1
  11. package/lib/commonjs/components/Modal/Modal.js +1 -1
  12. package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +1 -1
  13. package/lib/commonjs/components/Screen/Screen.js +1 -1
  14. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
  15. package/lib/commonjs/components/Spinner/Spinner.js +1 -1
  16. package/lib/commonjs/components/SquircleFill/SquircleFill.js +1 -1
  17. package/lib/commonjs/components/SquircleView/SquircleView.js +1 -1
  18. package/lib/commonjs/components/Tabs/Tabs.js +1 -1
  19. package/lib/commonjs/theme/merge.js +1 -1
  20. package/lib/module/components/Box/Box.js +1 -1
  21. package/lib/module/components/Button/Button.js +1 -1
  22. package/lib/module/components/Card/Card.js +1 -1
  23. package/lib/module/components/Chip/Chip.js +1 -1
  24. package/lib/module/components/EmptyState/EmptyState.js +1 -1
  25. package/lib/module/components/FieldBase/FieldBase.js +1 -1
  26. package/lib/module/components/FilterChipRow/FilterChipRow.js +1 -1
  27. package/lib/module/components/Modal/Modal.js +1 -1
  28. package/lib/module/components/PickerTrigger/PickerTrigger.js +1 -1
  29. package/lib/module/components/Screen/Screen.js +1 -1
  30. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  31. package/lib/module/components/Spinner/Spinner.js +1 -1
  32. package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
  33. package/lib/module/components/SquircleView/SquircleView.js +1 -1
  34. package/lib/module/components/Tabs/Tabs.js +1 -1
  35. package/lib/module/theme/merge.js +1 -1
  36. package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +3 -3
  37. package/lib/typescript/commonjs/components/Screen/Screen.d.ts +2 -0
  38. package/lib/typescript/commonjs/components/SquircleFill/SquircleFill.d.ts +7 -1
  39. package/lib/typescript/commonjs/theme/types.d.ts +2 -0
  40. package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +3 -3
  41. package/lib/typescript/module/components/Screen/Screen.d.ts +2 -0
  42. package/lib/typescript/module/components/SquircleFill/SquircleFill.d.ts +7 -1
  43. package/lib/typescript/module/theme/types.d.ts +2 -0
  44. package/package.json +7 -7
@@ -2,7 +2,7 @@
2
2
  "kind": "WeborityPhone",
3
3
  "library": {
4
4
  "name": "@webority/mobile-ui",
5
- "version": "0.183.0"
5
+ "version": "0.184.0"
6
6
  },
7
7
  "rendererProtocolVersion": 14,
8
8
  "platform": "Phone",
@@ -13755,6 +13755,13 @@
13755
13755
  "required": false,
13756
13756
  "description": "Content pinned under the page, above the keyboard."
13757
13757
  },
13758
+ {
13759
+ "name": "footerHugsKeyboard",
13760
+ "type": "boolean",
13761
+ "required": false,
13762
+ "description": "Drops the footer's bottom padding while the keyboard is open, so the footer sits right on the keyboard.",
13763
+ "default": false
13764
+ },
13758
13765
  {
13759
13766
  "name": "gutter",
13760
13767
  "type": "boolean",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-phone",
3
- "version": "0.183.0",
3
+ "version": "0.184.0",
4
4
  "platform": "Phone",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 14,
7
7
  "library": {
8
8
  "name": "@webority/mobile-ui",
9
- "version": "0.183.0"
9
+ "version": "0.184.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "a5afe79a60e785d14d59e813d5922174fbf70adf2220226b709dd8a4c16d5739",
14
- "bytes": 674225
13
+ "sha256": "7a7ccaf7c25b6c5796b0d870c4cad09345bd41c058adabded5fd8c73bd7f6644",
14
+ "bytes": 674503
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "cd9e8aaac1e4c3e418e5151e67c532e778b89c99aaa6b3163742cfb2818e6946",
18
- "bytes": 5707167
17
+ "sha256": "544db27fc75e2b062f7ad6766e18fca4760ed02aa20c2bd44d01e247b85ae2e1",
18
+ "bytes": 5707927
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Box=Box,exports.Row=Row,exports.Spacer=void 0,exports.Stack=Stack,exports.resolveBoxStyle=exports.default=void 0;var _reactNative=require("react-native"),_index=require("../../theme/index.js"),_scale=require("../../theme/scale.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");const BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],space=(e,r)=>null==r?void 0:(0,_scale.spaceOf)(e,r),resolveBoxStyle=(e,r)=>({...null!=r.p?{padding:space(e,r.p)}:{},...null!=r.px?{paddingHorizontal:space(e,r.px)}:{},...null!=r.py?{paddingVertical:space(e,r.py)}:{},...null!=r.pt?{paddingTop:space(e,r.pt)}:{},...null!=r.pr?{paddingRight:space(e,r.pr)}:{},...null!=r.pb?{paddingBottom:space(e,r.pb)}:{},...null!=r.pl?{paddingLeft:space(e,r.pl)}:{},...null!=r.m?{margin:space(e,r.m)}:{},...null!=r.mx?{marginHorizontal:space(e,r.mx)}:{},...null!=r.my?{marginVertical:space(e,r.my)}:{},...null!=r.mt?{marginTop:space(e,r.mt)}:{},...null!=r.mr?{marginRight:space(e,r.mr)}:{},...null!=r.mb?{marginBottom:space(e,r.mb)}:{},...null!=r.ml?{marginLeft:space(e,r.ml)}:{},...null!=r.gap?{gap:space(e,r.gap)}:{},...null!=r.bg?{backgroundColor:(0,_guards.isOneOf)(BACKGROUND_TOKENS,r.bg)?e.colors[r.bg]:r.bg}:{},...null!=r.radius?{borderRadius:(0,_scale.radiusOf)(e,r.radius),borderCurve:_corners.smoothCorners.borderCurve}:{},...r.border?{borderWidth:e.size.border,borderColor:e.colors.border}:{},...null!=r.flex?{flex:r.flex}:{},...null!=r.align?{alignItems:r.align}:{},...null!=r.justify?{justifyContent:r.justify}:{},...null!=r.direction?{flexDirection:r.direction}:{},...r.wrap?{flexWrap:"wrap"}:{}});function Box(e){const r=(0,_index.useTheme)(),{p:l,px:t,py:i,pt:s,pr:o,pb:a,pl:n,m:u,mx:p,my:c,mt:d,mr:m,mb:x,ml:g,gap:b,bg:f,radius:y,border:_,flex:j,align:h,justify:S,direction:v,wrap:R,style:B,children:w,ref:q,...C}=e,O=resolveBoxStyle(r,{p:l,px:t,py:i,pt:s,pr:o,pb:a,pl:n,m:u,mx:p,my:c,mt:d,mr:m,mb:x,ml:g,gap:b,bg:f,radius:y,border:_,flex:j,align:h,justify:S,direction:v,wrap:R}),k="number"==typeof O.borderRadius?O.borderRadius:0,N="string"==typeof O.backgroundColor?O.backgroundColor:"transparent",z="string"==typeof O.borderColor?O.borderColor:void 0,D="number"==typeof O.borderWidth?O.borderWidth:0,F=(0,_SquircleFill.useSquircle)(null!=y&&(null!=f||Boolean(_)),k,C.onLayout),T=F.active?{...O,backgroundColor:"transparent",borderColor:"transparent"}:O;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:q,...C,onLayout:F.onLayout,style:[T,B],children:[F.active&&F.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:F.size.width,height:F.size.height,radius:k,fill:N,stroke:z,strokeWidth:D}):null,w]})}function Stack({gap:e="md",ref:r,...l}){return(0,_jsxRuntime.jsx)(Box,{ref:r,direction:"column",gap:e,...l})}function Row({gap:e="sm",align:r="center",ref:l,...t}){return(0,_jsxRuntime.jsx)(Box,{ref:l,direction:"row",gap:e,align:r,...t})}exports.resolveBoxStyle=resolveBoxStyle;const Spacer=({size:e,style:r,testID:l})=>{const t=(0,_index.useTheme)();if(null!=e){const i=(0,_scale.spaceOf)(t,e);return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:l,style:[{width:i,height:i},r]})}return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:l,style:[{flex:1},r]})};exports.Spacer=Spacer,Spacer.displayName="Spacer";var _default=exports.default=Box;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Box=Box,exports.Row=Row,exports.Spacer=void 0,exports.Stack=Stack,exports.resolveBoxStyle=exports.default=void 0;var _reactNative=require("react-native"),_index=require("../../theme/index.js"),_scale=require("../../theme/scale.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");const BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],space=(e,r)=>null==r?void 0:(0,_scale.spaceOf)(e,r),resolveBoxStyle=(e,r)=>({...null!=r.p?{padding:space(e,r.p)}:{},...null!=r.px?{paddingHorizontal:space(e,r.px)}:{},...null!=r.py?{paddingVertical:space(e,r.py)}:{},...null!=r.pt?{paddingTop:space(e,r.pt)}:{},...null!=r.pr?{paddingRight:space(e,r.pr)}:{},...null!=r.pb?{paddingBottom:space(e,r.pb)}:{},...null!=r.pl?{paddingLeft:space(e,r.pl)}:{},...null!=r.m?{margin:space(e,r.m)}:{},...null!=r.mx?{marginHorizontal:space(e,r.mx)}:{},...null!=r.my?{marginVertical:space(e,r.my)}:{},...null!=r.mt?{marginTop:space(e,r.mt)}:{},...null!=r.mr?{marginRight:space(e,r.mr)}:{},...null!=r.mb?{marginBottom:space(e,r.mb)}:{},...null!=r.ml?{marginLeft:space(e,r.ml)}:{},...null!=r.gap?{gap:space(e,r.gap)}:{},...null!=r.bg?{backgroundColor:(0,_guards.isOneOf)(BACKGROUND_TOKENS,r.bg)?e.colors[r.bg]:r.bg}:{},...null!=r.radius?{borderRadius:(0,_scale.radiusOf)(e,r.radius),borderCurve:_corners.smoothCorners.borderCurve}:{},...r.border?{borderWidth:e.size.border,borderColor:e.colors.border}:{},...null!=r.flex?{flex:r.flex}:{},...null!=r.align?{alignItems:r.align}:{},...null!=r.justify?{justifyContent:r.justify}:{},...null!=r.direction?{flexDirection:r.direction}:{},...r.wrap?{flexWrap:"wrap"}:{}});function Box(e){const r=(0,_index.useTheme)(),{p:l,px:t,py:i,pt:o,pr:s,pb:a,pl:n,m:u,mx:p,my:c,mt:d,mr:m,mb:x,ml:g,gap:b,bg:f,radius:y,border:_,flex:h,align:j,justify:S,direction:v,wrap:B,style:R,children:w,ref:q,...C}=e,O=resolveBoxStyle(r,{p:l,px:t,py:i,pt:o,pr:s,pb:a,pl:n,m:u,mx:p,my:c,mt:d,mr:m,mb:x,ml:g,gap:b,bg:f,radius:y,border:_,flex:h,align:j,justify:S,direction:v,wrap:B}),k="number"==typeof O.borderRadius?O.borderRadius:0,N="string"==typeof O.backgroundColor?O.backgroundColor:"transparent",z="string"==typeof O.borderColor?O.borderColor:void 0,D="number"==typeof O.borderWidth?O.borderWidth:0,F=(0,_SquircleFill.useSquircle)(null!=y&&(null!=f||Boolean(_)),k,C.onLayout),T=F.active?{...O,backgroundColor:"transparent",borderColor:"transparent"}:O;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:q,...C,onLayout:F.onLayout,style:[T,R],children:[F.active&&F.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:F.size.width,height:F.size.height,radius:k,fill:N,stroke:z,strokeWidth:D,hostBorderWidth:D}):null,w]})}function Stack({gap:e="md",ref:r,...l}){return(0,_jsxRuntime.jsx)(Box,{ref:r,direction:"column",gap:e,...l})}function Row({gap:e="sm",align:r="center",ref:l,...t}){return(0,_jsxRuntime.jsx)(Box,{ref:l,direction:"row",gap:e,align:r,...t})}exports.resolveBoxStyle=resolveBoxStyle;const Spacer=({size:e,style:r,testID:l})=>{const t=(0,_index.useTheme)();if(null!=e){const i=(0,_scale.spaceOf)(t,e);return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:l,style:[{width:i,height:i},r]})}return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:l,style:[{flex:1},r]})};exports.Spacer=Spacer,Spacer.displayName="Spacer";var _default=exports.default=Box;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BUTTON_VARIANTS=exports.BUTTON_TONES=void 0,exports.Button=Button,exports.buttonLabelInk=buttonLabelInk,exports.default=void 0,exports.isButtonTone=isButtonTone,exports.isButtonVariant=isButtonVariant;var _react=require("react"),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_buttonG=require("../../text/phone/button.g.js"),_index2=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_ariaState=require("../../utils/ariaState.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const BUTTON_VARIANTS=exports.BUTTON_VARIANTS=["solid","soft","outline","ghost","link","glass"],BUTTON_TONES=exports.BUTTON_TONES=["primary","success","warning","danger","info","neutral"];function isButtonVariant(e){return BUTTON_VARIANTS.some(t=>t===e)}function isButtonTone(e){return BUTTON_TONES.some(t=>t===e)}function Button({ref:e,...t}){const{label:r,variant:o,tone:s="primary",size:i,loading:n=!1,disabled:a=!1,fullWidth:l=!1,leftIcon:c,rightIcon:d,iconVariant:u,leftIconBadge:b=!1,haptic:g,rounded:_=!1,gradient:p,style:h,wrapperStyle:x,textStyle:m,pressAnimation:f,onPress:v,accessibilityLabel:y,accessibilityHint:T,accessibilityState:S,testID:j,onLayout:I,labels:C,...N}=t;(0,_assertValidValue.assertValidValue)("Button","variant",t.variant,["solid","soft","outline","ghost","link","glass"]),(0,_assertValidValue.assertValidValue)("Button","tone",t.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("Button","size",t.size,["xs","sm","md","lg","xl"]);const R=(0,_index2.useTheme)(),k=R.settings.components.button,V=o??k?.defaultVariant??"solid",w=i??k?.defaultSize??"md",F=(0,_index.useMobileUiText)("button",_buttonG.BUTTON_TEXT),O=(0,_react.useMemo)(()=>({...F,...C}),[F,C]),[q,B]=(0,_react.useState)(!1),L=(0,_react.useRef)(!1),A=n||q,P=!a&&!A,z={...S,disabled:!P,busy:A},U="link"===V,E=f??k?.defaultPressAnimation??(!U&&"scale"),W=(0,_usePressAnimation.usePressAnimation)({preset:E||"scale",enabled:!1!==E&&P}),D=(0,_useFlickGuard.useFlickGuard)(),H=(0,_react.useMemo)(()=>buildStyles(R),[R]),M=(0,_react.useMemo)(()=>(0,_index2.resolveButtonSize)(R,w),[R,w]),G=(0,_react.useMemo)(()=>toneFor(R,s),[R,s]),K=(0,_react.useMemo)(()=>variantFor(R,V,G,a),[R,V,G,a]),X=(0,_react.useMemo)(()=>!p||a||"solid"!==V?null:"string"==typeof p?R.settings.gradients[p]??null:p,[p,a,V,R.settings.gradients]),Y=_reactNative.StyleSheet.flatten(h)?.borderRadius,J=U?0:"number"==typeof Y?Y:_?R.radius.pill:M.radius,Q=(0,_SquircleFill.useSquircle)(!X&&"link"!==V,J,I),Z=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[$,ee]=(0,_react.useState)(0),[te,re]=(0,_react.useState)(null),oe=U?e=>ee(e.nativeEvent.layout.width):void 0,settlePending=()=>{L.current=!1,B(!1)},se=y??r,ie="outline"===V||"ghost"===V,ne=!ie&&!U,ae={color:K.textColor,size:M.icon,disabled:a},le=b&&!U&&Boolean(c),ce=R.space.xs,de=M["min-height"]-2*ce-2*K.borderWidth,ue={color:K.badgeInk,size:M["badge-icon"],disabled:a},be=A?(0,_jsxRuntime.jsx)(_index3.Spinner,{variant:"circular",size:"sm",color:le?K.badgeInk:K.textColor,accessibilityLabel:O.loading}):c?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(c,le?ue:ae,u)}):null,ge=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.contentRow,children:[le?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[H.iconLeft,H.iconBadge,{width:de,height:de,borderRadius:de/2,backgroundColor:K.badgeFill}],children:be}):be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconLeft,children:be}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:oe,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",numberOfLines:1,style:[H.label,{color:K.textColor,fontSize:M.text,lineHeight:Math.round(M.text*R.leading.body)},m],children:r}),U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[H.linkUnderline,{backgroundColor:K.textColor,transform:[{translateX:Z.interpolate({inputRange:[0,1],outputRange:[-$/2,0]})},{scaleX:Z.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}),d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconRight,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(d,ae,u)}):null]}),pe=U?null===te?LINK_HIT_SLOP:Math.max(LINK_HIT_SLOP,touchSlopFor(te)):touchSlopFor(M["min-height"]),he={top:pe,bottom:pe,left:U?LINK_HIT_SLOP:0,right:U?LINK_HIT_SLOP:0};return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[W.style,l?H.fullWidth:null,x],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:e,onPress:e=>{if(!P||L.current||D.isFlick(e))return;W.press();const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t);const r=v?.(e);return r instanceof Promise?(L.current=!0,B(!0),r.then(settlePending,e=>{throw settlePending(),e})):void 0},onPressIn:e=>{D.onPressIn(e),W.pressIn(),U&&P&&(Z.stopAnimation(),Z.setValue(0),_reactNative.Animated.timing(Z,{toValue:1,duration:R.motion.duration.slower,easing:_reactNative.Easing.bezier(...R.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver}).start())},onPressOut:()=>{W.pressOut()},disabled:!P,hitSlop:he,...(0,_hitSlop.hitSlopMarker)(he),accessibilityRole:"button",accessibilityLabel:se,accessibilityHint:T,accessibilityState:z,...(0,_ariaState.ariaFromState)(z),testID:j,onLayout:e=>{Q.onLayout(e),U&&re(e.nativeEvent.layout.height)},style:({pressed:e})=>[H.base,{paddingHorizontal:U?0:M["padding-x"],paddingVertical:U?0:le?ce:M["padding-y"],paddingLeft:le?ce:void 0,minHeight:U?void 0:M["min-height"],borderRadius:J,..._corners.smoothCorners,backgroundColor:X||Q.active?"transparent":K.backgroundColor,borderWidth:K.borderWidth,borderColor:Q.active?"transparent":K.borderColor,opacity:A?.55:1,overflow:Q.active||U?"visible":"hidden"},e&&ie&&!Q.active?{backgroundColor:R.colors["surface-pressed"]}:null,l?H.fullWidth:null,h],...N,"aria-disabled":!P,"aria-busy":A,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:e&&ie?R.colors["surface-pressed"]:K.backgroundColor,stroke:K.borderColor,strokeWidth:K.borderWidth}):null,X?(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:X,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:J,..._corners.smoothCorners}]}):null,e&&ne?Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:K.pressedTint,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[H.pressedOverlay,{borderRadius:J,backgroundColor:K.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,ge]})})})}const SOFT_FILL_OPACITY=.14,toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors["primary-text"],soft:(0,_color.tintOf)(e.colors.primary,.14,e.colors["primary-soft"])};case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"],soft:(0,_color.tintOf)(e.colors.success,.14,e.colors["bg-subtle"])};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"],soft:(0,_color.tintOf)(e.colors.warning,.14,e.colors["bg-subtle"])};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"],soft:(0,_color.tintOf)(e.colors.danger,.14,e.colors["bg-subtle"])};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"],soft:(0,_color.tintOf)(e.colors.info,.14,e.colors["bg-subtle"])};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"],soft:e.colors["bg-subtle"]}}},BUTTON_BORDER_WIDTH=1,MIN_TOUCH_TARGET=44,LINK_HIT_SLOP=8,touchSlopFor=e=>Math.max(0,Math.ceil((44-e)/2)),variantFor=(e,t,r,o)=>{const s=o?e.colors["text-disabled"]:r.fg,i={badgeFill:e.colors["surface-disabled"],badgeInk:e.colors["text-disabled"]},n=o?i:{badgeFill:r.on,badgeInk:r.base},a=o?i:{badgeFill:r.base,badgeInk:r.on};switch(t){case"solid":return{backgroundColor:o?e.colors["surface-disabled"]:r.base,borderColor:"transparent",borderWidth:1,textColor:o?e.colors["text-disabled"]:r.on,pressedTint:e.colors["surface-pressed"],...n};case"soft":return{backgroundColor:o?e.colors["surface-disabled"]:r.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"outline":return{backgroundColor:"transparent",borderColor:o?e.colors.border:r.outline,borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:o?e.colors["text-disabled"]:e.colors.link,pressedTint:e.colors["surface-pressed"],...a};case"glass":return{backgroundColor:e.colors["glass-fill"],borderColor:e.colors["glass-border"],borderWidth:1,textColor:o?e.colors["text-disabled"]:e.colors["on-glass"],pressedTint:_color.ACCENT_PRESSED_TINT,badgeFill:e.colors["glass-badge"],badgeInk:o?e.colors["text-disabled"]:r.base};default:return{backgroundColor:r.base,borderColor:"transparent",borderWidth:1,textColor:r.on,pressedTint:e.colors["surface-pressed"],...n}}};function buttonLabelInk(e,t){return variantFor(t,e.variant??"solid",toneFor(t,e.tone??"primary"),e.disabled??!1).textColor}const buildStyles=e=>_reactNative.StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:e.size.border},iconLeft:{marginRight:e.space.sm},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:e.space.sm},fullWidth:{alignSelf:"stretch"}});var _default=exports.default=Button;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BUTTON_VARIANTS=exports.BUTTON_TONES=void 0,exports.Button=Button,exports.buttonLabelInk=buttonLabelInk,exports.default=void 0,exports.isButtonTone=isButtonTone,exports.isButtonVariant=isButtonVariant;var _react=require("react"),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_buttonG=require("../../text/phone/button.g.js"),_index2=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_ariaState=require("../../utils/ariaState.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const BUTTON_VARIANTS=exports.BUTTON_VARIANTS=["solid","soft","outline","ghost","link","glass"],BUTTON_TONES=exports.BUTTON_TONES=["primary","success","warning","danger","info","neutral"];function isButtonVariant(e){return BUTTON_VARIANTS.some(t=>t===e)}function isButtonTone(e){return BUTTON_TONES.some(t=>t===e)}function Button({ref:e,...t}){const{label:r,variant:o,tone:s="primary",size:i,loading:n=!1,disabled:a=!1,fullWidth:l=!1,leftIcon:c,rightIcon:d,iconVariant:u,leftIconBadge:b=!1,haptic:g,rounded:_=!1,gradient:h,style:p,wrapperStyle:x,textStyle:m,pressAnimation:f,onPress:v,accessibilityLabel:y,accessibilityHint:T,accessibilityState:S,testID:j,onLayout:I,labels:C,...N}=t;(0,_assertValidValue.assertValidValue)("Button","variant",t.variant,["solid","soft","outline","ghost","link","glass"]),(0,_assertValidValue.assertValidValue)("Button","tone",t.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("Button","size",t.size,["xs","sm","md","lg","xl"]);const R=(0,_index2.useTheme)(),k=R.settings.components.button,V=o??k?.defaultVariant??"solid",w=i??k?.defaultSize??"md",F=(0,_index.useMobileUiText)("button",_buttonG.BUTTON_TEXT),O=(0,_react.useMemo)(()=>({...F,...C}),[F,C]),[B,q]=(0,_react.useState)(!1),L=(0,_react.useRef)(!1),A=n||B,P=!a&&!A,W={...S,disabled:!P,busy:A},z="link"===V,U=f??k?.defaultPressAnimation??(!z&&"scale"),E=(0,_usePressAnimation.usePressAnimation)({preset:U||"scale",enabled:!1!==U&&P}),D=(0,_useFlickGuard.useFlickGuard)(),H=(0,_react.useMemo)(()=>buildStyles(R),[R]),M=(0,_react.useMemo)(()=>(0,_index2.resolveButtonSize)(R,w),[R,w]),G=(0,_react.useMemo)(()=>toneFor(R,s),[R,s]),K=(0,_react.useMemo)(()=>variantFor(R,V,G,a),[R,V,G,a]),X=(0,_react.useMemo)(()=>!h||a||"solid"!==V?null:"string"==typeof h?R.settings.gradients[h]??null:h,[h,a,V,R.settings.gradients]),Y=_reactNative.StyleSheet.flatten(p)?.borderRadius,J=z?0:"number"==typeof Y?Y:_?R.radius.pill:M.radius,Q=(0,_SquircleFill.useSquircle)(!X&&"link"!==V,J,I),Z=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[$,ee]=(0,_react.useState)(0),[te,re]=(0,_react.useState)(null),oe=z?e=>ee(e.nativeEvent.layout.width):void 0,settlePending=()=>{L.current=!1,q(!1)},se=y??r,ie="outline"===V||"ghost"===V,ne=!ie&&!z,ae={color:K.textColor,size:M.icon,disabled:a},le=b&&!z&&Boolean(c),ce=R.space.xs,de=M["min-height"]-2*ce-2*K.borderWidth,ue={color:K.badgeInk,size:M["badge-icon"],disabled:a},be=A?(0,_jsxRuntime.jsx)(_index3.Spinner,{variant:"circular",size:"sm",color:le?K.badgeInk:K.textColor,accessibilityLabel:O.loading}):c?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(c,le?ue:ae,u)}):null,ge=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.contentRow,children:[le?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[H.iconLeft,H.iconBadge,{width:de,height:de,borderRadius:de/2,backgroundColor:K.badgeFill}],children:be}):be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconLeft,children:be}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:oe,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",numberOfLines:1,style:[H.label,{color:K.textColor,fontSize:M.text,lineHeight:Math.round(M.text*R.leading.body)},m],children:r}),z?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[H.linkUnderline,{backgroundColor:K.textColor,transform:[{translateX:Z.interpolate({inputRange:[0,1],outputRange:[-$/2,0]})},{scaleX:Z.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}),d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconRight,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(d,ae,u)}):null]}),he=z?null===te?LINK_HIT_SLOP:Math.max(LINK_HIT_SLOP,touchSlopFor(te)):touchSlopFor(M["min-height"]),pe={top:he,bottom:he,left:z?LINK_HIT_SLOP:0,right:z?LINK_HIT_SLOP:0};return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[E.style,l?H.fullWidth:null,x],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:e,onPress:e=>{if(!P||L.current||D.isFlick(e))return;E.press();const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t);const r=v?.(e);return r instanceof Promise?(L.current=!0,q(!0),r.then(settlePending,e=>{throw settlePending(),e})):void 0},onPressIn:e=>{D.onPressIn(e),E.pressIn(),z&&P&&(Z.stopAnimation(),Z.setValue(0),_reactNative.Animated.timing(Z,{toValue:1,duration:R.motion.duration.slower,easing:_reactNative.Easing.bezier(...R.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver}).start())},onPressOut:()=>{E.pressOut()},disabled:!P,hitSlop:pe,...(0,_hitSlop.hitSlopMarker)(pe),accessibilityRole:"button",accessibilityLabel:se,accessibilityHint:T,accessibilityState:W,...(0,_ariaState.ariaFromState)(W),testID:j,onLayout:e=>{Q.onLayout(e),z&&re(e.nativeEvent.layout.height)},style:({pressed:e})=>[H.base,{paddingHorizontal:z?0:M["padding-x"],paddingVertical:z?0:le?ce:M["padding-y"],paddingLeft:le?ce:void 0,minHeight:z?void 0:M["min-height"],borderRadius:J,..._corners.smoothCorners,backgroundColor:X||Q.active?"transparent":K.backgroundColor,borderWidth:K.borderWidth,borderColor:Q.active?"transparent":K.borderColor,opacity:A?.55:1,overflow:Q.active||z?"visible":"hidden"},e&&ie&&!Q.active?{backgroundColor:R.colors["surface-pressed"]}:null,l?H.fullWidth:null,p],...N,"aria-disabled":!P,"aria-busy":A,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:e&&ie?R.colors["surface-pressed"]:K.backgroundColor,stroke:K.borderColor,strokeWidth:K.borderWidth,hostBorderWidth:K.borderWidth}):null,X?(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:X,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:J,..._corners.smoothCorners}]}):null,e&&ne?Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:K.pressedTint,hostBorderWidth:K.borderWidth,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[H.pressedOverlay,{borderRadius:J,backgroundColor:K.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,ge]})})})}const SOFT_FILL_OPACITY=.14,toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors["primary-text"],soft:(0,_color.tintOf)(e.colors.primary,.14,e.colors["primary-soft"])};case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"],soft:(0,_color.tintOf)(e.colors.success,.14,e.colors["bg-subtle"])};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"],soft:(0,_color.tintOf)(e.colors.warning,.14,e.colors["bg-subtle"])};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"],soft:(0,_color.tintOf)(e.colors.danger,.14,e.colors["bg-subtle"])};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"],soft:(0,_color.tintOf)(e.colors.info,.14,e.colors["bg-subtle"])};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"],soft:e.colors["bg-subtle"]}}},BUTTON_BORDER_WIDTH=1,MIN_TOUCH_TARGET=44,LINK_HIT_SLOP=8,touchSlopFor=e=>Math.max(0,Math.ceil((44-e)/2)),variantFor=(e,t,r,o)=>{const s=o?e.colors["text-disabled"]:r.fg,i={badgeFill:e.colors["surface-disabled"],badgeInk:e.colors["text-disabled"]},n=o?i:{badgeFill:r.on,badgeInk:r.base},a=o?i:{badgeFill:r.base,badgeInk:r.on};switch(t){case"solid":return{backgroundColor:o?e.colors["surface-disabled"]:r.base,borderColor:"transparent",borderWidth:1,textColor:o?e.colors["text-disabled"]:r.on,pressedTint:e.colors["surface-pressed"],...n};case"soft":return{backgroundColor:o?e.colors["surface-disabled"]:r.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"outline":return{backgroundColor:"transparent",borderColor:o?e.colors.border:r.outline,borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:o?e.colors["text-disabled"]:e.colors.link,pressedTint:e.colors["surface-pressed"],...a};case"glass":return{backgroundColor:e.colors["glass-fill"],borderColor:e.colors["glass-border"],borderWidth:1,textColor:o?e.colors["text-disabled"]:e.colors["on-glass"],pressedTint:_color.ACCENT_PRESSED_TINT,badgeFill:e.colors["glass-badge"],badgeInk:o?e.colors["text-disabled"]:r.base};default:return{backgroundColor:r.base,borderColor:"transparent",borderWidth:1,textColor:r.on,pressedTint:e.colors["surface-pressed"],...n}}};function buttonLabelInk(e,t){return variantFor(t,e.variant??"solid",toneFor(t,e.tone??"primary"),e.disabled??!1).textColor}const buildStyles=e=>_reactNative.StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:e.size.border},iconLeft:{marginRight:e.space.sm},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:e.space.sm},fullWidth:{alignSelf:"stretch"}});var _default=exports.default=Button;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Card=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_useControllableState=require("../../hooks/useControllableState.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_cardG=require("../../text/phone/card.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_shadows=require("../../utils/shadows.js"),_squircle=require("../../utils/squircle.js"),_themeStyles=require("../../utils/themeStyles.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_index3=require("../Skeleton/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,s,a=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=a&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?a(r,s,i):r[s]=e[s]);return r}const OUTER_LAYOUT_KEYS=new Set(["flex","flexGrow","flexShrink","flexBasis","alignSelf","width","height","minWidth","maxWidth","minHeight","maxHeight","position","top","right","bottom","left","start","end","zIndex"]),splitOuterLayout=e=>{const t={},i={};for(const[s,a]of Object.entries(_reactNative.StyleSheet.flatten(e)??{}))(OUTER_LAYOUT_KEYS.has(s)||s.startsWith("margin")?t:i)[s]=a;return{outer:t,inner:i}},flexStyleOf=e=>void 0===e?[]:[{flex:e}],BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},CardRoot=_react.default.memo(function CardRoot({ref:e,...t}){const{children:i,variant:s,elevation:a="card",radius:r,padding:n,interactive:l=!1,pressAnimation:o="scale",bg:d,header:c,title:u,titleFont:x,lead:h,action:m,headerActions:_,collapsible:p=!1,collapsed:g,defaultCollapsed:b=!1,onCollapsedChange:j,collapsedSummary:y,onRemove:f,separatorHeight:v=_reactNative.StyleSheet.hairlineWidth,footer:R,imageSource:S,imageHeight:C=160,imageAspectRatio:w,imageOverlay:V,loading:A=!1,gradient:q,onPress:N,haptic:T,contextMenu:k,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:P,flex:B,style:I,headerStyle:L,bodyStyle:M,footerStyle:H,testID:z,labels:W,onLayout:E,...U}=t;(0,_assertValidValue.assertValidValue)("Card","variant",t.variant,["elevated","outline","filled","flat"]),(0,_assertValidValue.assertValidValue)("Card","radius",t.radius,["sm","md","lg","xl","pill"]),(0,_assertValidValue.assertValidValue)("Card","padding",t.padding,["none","sm","md","lg","xl"]),(0,_assertValidValue.assertValidValue)("Card","titleFont",t.titleFont,["sans","serif"]),(0,_assertValidValue.assertValidValue)("Card","pressAnimation",t.pressAnimation,["scale","bounce","fade","sink","pulse","dim","false"]);const D=(0,_index2.useTheme)(),G=D.settings.components.card,K=s??G?.defaultVariant??"elevated",Y=r??G?.defaultRadius??"lg",X=n??G?.defaultPadding??"md",$=x??G?.defaultTitleFont??"sans",J=(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),Q=(0,_react.useMemo)(()=>({...J,...W}),[J,W]),Z=l||"function"==typeof N,ee=(0,_useContextMenu.useContextMenu)(k,{haptic:T||!1,testID:z,accessibilityActions:U.accessibilityActions,onAccessibilityAction:U.onAccessibilityAction}),te=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(e,ee.hostRef),[e,ee.hostRef]),ie=Z||ee.enabled,{style:se,pressIn:ae,pressOut:re}=(0,_usePressAnimation.usePressAnimation)({preset:o||"scale",enabled:ie&&!1!==o}),ne=stylesFor(D),le=Boolean(S),oe=D.space[paddingMap[X]],de=(0,_react.useMemo)(()=>q?"string"==typeof q?D.settings.gradients[q]??null:q:null,[q,D.settings.gradients]),ce="flat"===K,ue=ce?D.radius.none:D.radius[Y],xe=resolveBackground(D,d),[he,me]=(0,_useControllableState.useControllableState)({value:g,defaultValue:b,onChange:j}),pe=p&&he,ge=hasBuiltInHeaderContent(t),be=Boolean(c)||ge,je=(0,_SquircleFill.useSquircle)(!le&&!de&&!ce,ue,E),ye=_reactNative.StyleSheet.flatten(I)??{},fe="string"==typeof ye.backgroundColor?ye.backgroundColor:void 0,ve="string"==typeof ye.borderColor?ye.borderColor:void 0,Re=fe??xe??("filled"===K?D.colors["bg-subtle"]:D.colors.surface),Se="outline"===K?D.size.border:0,Ce=ve??D.colors.border,we="none"===a?void 0:D.shadow[a],Ve="elevated"===K&&(0,_shadows.supportsBoxShadow)()&&we?(0,_shadows.toBoxShadow)(we):void 0,Ae=je.active&&"elevated"===K&&!Ve,qe=je.active&&!Ae?{backgroundColor:"transparent",borderColor:"transparent"}:null,Ne=(0,_react.useMemo)(()=>{const e={borderRadius:Ae&&je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue,..._corners.smoothCorners,padding:le||je.active?D.space.none:oe,overflow:je.active?"visible":"hidden"};switch(K){case"flat":return{...e,backgroundColor:xe??D.colors.surface,borderBottomWidth:v,borderBottomColor:D.colors.border};case"outline":return{...e,backgroundColor:je.active?"transparent":xe??D.colors.surface,borderWidth:D.size.border,borderColor:je.active?"transparent":D.colors.border};case"filled":return{...e,backgroundColor:je.active?"transparent":xe??D.colors["bg-subtle"]};default:return{...e,backgroundColor:xe??D.colors.surface,...Ve?{boxShadow:Ve}:we}}},[D,K,we,ue,le,oe,je.active,je.size,Ve,Ae,xe,v]),Te=(0,_react.useMemo)(()=>({..."number"==typeof w?{width:"100%",aspectRatio:w}:{width:"100%",height:C},borderTopLeftRadius:ue,borderTopRightRadius:ue,borderBottomLeftRadius:D.radius.none,borderBottomRightRadius:D.radius.none,..._corners.smoothCorners}),[D,ue,w,C]),ke=u??"",Fe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.titleColumn,children:[u?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",accessibilityRole:"header",style:titleFaceFor(D,$),children:u}):null,h?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",style:ne.lead,children:h}):null,pe&&y?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",style:ne.lead,children:y}):null]}),isCardTextAction(m)?(0,_jsxRuntime.jsx)(CardTextActionButton,{action:m,haptic:T}):m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:ne.actionNode,children:m}):null,_,p?(0,_jsxRuntime.jsx)(CardIconAction,{icon:pe?"chevron-down":"chevron-up",label:`${pe?Q.show:Q.hide} ${ke}`.trim(),expanded:!pe,onPress:()=>me(!pe),haptic:T}):null,f?(0,_jsxRuntime.jsx)(CardIconAction,{icon:"trash",label:Q.remove,onPress:f,color:D.colors["danger-text"],haptic:T}):null]}),Oe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.header,!c&&ne.headerRow,pe&&ne.headerFolded,L],children:c??Fe}):null,pe?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[be||R?ne.body:null,M],children:i}),R&&!pe?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.footer,H],children:R}):null]}),Pe=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.imageWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:S,resizeMode:"cover",style:Te,accessibilityLabel:"",accessible:!1}),V?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:ne.imageOverlay,children:V}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{padding:oe},children:Oe})]}):Oe,Be=de?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:de,style:_reactNative.StyleSheet.absoluteFill}),Pe]}):je.active&&je.size?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:je.size.width,height:je.size.height,radius:ue,fill:Re,stroke:Se?Ce:void 0,strokeWidth:Se}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.squircleClip,{padding:oe,borderRadius:je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue}],children:Pe})]}):Pe,{outer:Ie,inner:Le}=splitOuterLayout(I);let Me;if(ie){const handlePress=e=>{Z&&(T&&(0,_hapticUtils.triggerHaptic)(T),N?.(e))};Me=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[se,...flexStyleOf(B),Ie],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:te,onPress:handlePress,onPressIn:ae,onPressOut:re,accessibilityRole:P??(Z?"button":void 0),accessibilityLabel:F,accessibilityHint:O,testID:z,onLayout:je.onLayout,style:[Ne,Le,qe,ne.pressFill],...U,...ee.hostProps,children:Be})})}else Me=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:P,testID:z,onLayout:je.onLayout,style:[Ne,...flexStyleOf(B),I,qe],...U,children:Be});return A?(0,_jsxRuntime.jsx)(CardSkeleton,{...t}):ee.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Me,ee.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ne,I,qe,ne.preview],children:Be}))]}):Me}),CardSkeleton=({variant:e,elevation:t,radius:i,padding:s,bg:a,header:r,footer:n,imageSource:l,imageHeight:o=160,imageAspectRatio:d,headerStyle:c,bodyStyle:u,footerStyle:x,flex:h,style:m,labels:_,...p})=>{const g=(0,_index2.useTheme)(),b=g.settings.components.card,j=e??b?.defaultVariant??"elevated",y=i??b?.defaultRadius??"lg",f=s??b?.defaultPadding??"md",v={...(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),..._},R=paddingMap[f],S=g.space[R],C="flat"===j?g.radius.none:g.radius[y],w=void 0!==r||hasBuiltInHeaderContent(p),V=resolveBackground(g,a)??g.colors.surface,A="outline"===j?1:0,q="outline"===j?g.colors.border:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{backgroundColor:V,borderRadius:C,..._corners.smoothCorners,borderWidth:A,borderColor:q,overflow:"hidden"},...flexStyleOf(h),m],accessibilityRole:"progressbar",accessibilityLabel:v.loading,accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==l?(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:"100%",height:d?void 0:o,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,w?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingBottom:g.space.sm},c],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"text",width:"60%",height:18})}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S},u],children:(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:3,fontSize:g.text.base.size,lastLineWidth:"55%"})}),void 0!==n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingTop:g.space.sm,flexDirection:"row"},x],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton";const Card=exports.Card=Object.assign(CardRoot,{Skeleton:CardSkeleton});Card.displayName="Card";const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=e=>"object"==typeof e&&null!==e&&!_react.default.isValidElement(e)&&"label"in e&&"onPress"in e,HIT_TARGET=44,CardIconAction=({icon:e,label:t,onPress:i,expanded:s,color:a,haptic:r})=>{const n=(0,_index2.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===s?void 0:{expanded:s},"aria-expanded":s,onPress:()=>{r&&(0,_hapticUtils.triggerHaptic)(r),i()},style:iconActionStyle,children:(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,size:20,color:a??n.colors["text-body"]})})})},CardTextActionButton=({action:e,haptic:t})=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:textActionStyle,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",color:"brand",children:e.label})}),iconActionStyle={width:44,height:44,alignItems:"center",justifyContent:"center"},textActionStyle={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},titleFaceFor=(e,t)=>"serif"===t?(0,_index2.fontFor)(e,"semibold","display"):{fontFamily:void 0,...(0,_index2.fontFor)(e,"semibold")},resolveBackground=(e,t)=>{if(null!=t)return(0,_guards.isOneOf)(BACKGROUND_TOKENS,t)?e.colors[t]:t},buildStyles=e=>_reactNative.StyleSheet.create({header:{marginBottom:e.space.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.space.sm},headerFolded:{marginBottom:e.space.none},titleColumn:{flex:1},lead:{marginTop:e.space.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.space.md},imageWrapper:{position:"relative"},imageOverlay:{..._reactNative.StyleSheet.absoluteFill},squircleClip:{overflow:"hidden",..._corners.smoothCorners},pressFill:{flexGrow:1},preview:{margin:e.space.none,marginTop:e.space.none,marginBottom:e.space.none,marginLeft:e.space.none,marginRight:e.space.none,marginStart:e.space.none,marginEnd:e.space.none,marginHorizontal:e.space.none,marginVertical:e.space.none,position:"relative",top:0,left:0,width:"100%",height:"100%"}}),stylesFor=(0,_themeStyles.themeStyles)(buildStyles);var _default=exports.default=Card;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Card=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_useControllableState=require("../../hooks/useControllableState.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_cardG=require("../../text/phone/card.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_shadows=require("../../utils/shadows.js"),_squircle=require("../../utils/squircle.js"),_themeStyles=require("../../utils/themeStyles.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_index3=require("../Skeleton/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,s,a=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=a&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?a(r,s,i):r[s]=e[s]);return r}const OUTER_LAYOUT_KEYS=new Set(["flex","flexGrow","flexShrink","flexBasis","alignSelf","width","height","minWidth","maxWidth","minHeight","maxHeight","position","top","right","bottom","left","start","end","zIndex"]),splitOuterLayout=e=>{const t={},i={};for(const[s,a]of Object.entries(_reactNative.StyleSheet.flatten(e)??{}))(OUTER_LAYOUT_KEYS.has(s)||s.startsWith("margin")?t:i)[s]=a;return{outer:t,inner:i}},flexStyleOf=e=>void 0===e?[]:[{flex:e}],BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},CardRoot=_react.default.memo(function CardRoot({ref:e,...t}){const{children:i,variant:s,elevation:a="card",radius:r,padding:n,interactive:l=!1,pressAnimation:o="scale",bg:d,header:c,title:u,titleFont:x,lead:h,action:m,headerActions:_,collapsible:p=!1,collapsed:g,defaultCollapsed:b=!1,onCollapsedChange:j,collapsedSummary:y,onRemove:f,separatorHeight:v=_reactNative.StyleSheet.hairlineWidth,footer:R,imageSource:S,imageHeight:C=160,imageAspectRatio:w,imageOverlay:V,loading:A=!1,gradient:q,onPress:N,haptic:T,contextMenu:k,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:B,flex:P,style:I,headerStyle:L,bodyStyle:M,footerStyle:H,testID:z,labels:W,onLayout:E,...U}=t;(0,_assertValidValue.assertValidValue)("Card","variant",t.variant,["elevated","outline","filled","flat"]),(0,_assertValidValue.assertValidValue)("Card","radius",t.radius,["sm","md","lg","xl","pill"]),(0,_assertValidValue.assertValidValue)("Card","padding",t.padding,["none","sm","md","lg","xl"]),(0,_assertValidValue.assertValidValue)("Card","titleFont",t.titleFont,["sans","serif"]),(0,_assertValidValue.assertValidValue)("Card","pressAnimation",t.pressAnimation,["scale","bounce","fade","sink","pulse","dim","false"]);const D=(0,_index2.useTheme)(),G=D.settings.components.card,K=s??G?.defaultVariant??"elevated",Y=r??G?.defaultRadius??"lg",X=n??G?.defaultPadding??"md",$=x??G?.defaultTitleFont??"sans",J=(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),Q=(0,_react.useMemo)(()=>({...J,...W}),[J,W]),Z=l||"function"==typeof N,ee=(0,_useContextMenu.useContextMenu)(k,{haptic:T||!1,testID:z,accessibilityActions:U.accessibilityActions,onAccessibilityAction:U.onAccessibilityAction}),te=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(e,ee.hostRef),[e,ee.hostRef]),ie=Z||ee.enabled,{style:se,pressIn:ae,pressOut:re}=(0,_usePressAnimation.usePressAnimation)({preset:o||"scale",enabled:ie&&!1!==o}),ne=stylesFor(D),le=Boolean(S),oe=D.space[paddingMap[X]],de=(0,_react.useMemo)(()=>q?"string"==typeof q?D.settings.gradients[q]??null:q:null,[q,D.settings.gradients]),ce="flat"===K,ue=ce?D.radius.none:D.radius[Y],xe=resolveBackground(D,d),[he,me]=(0,_useControllableState.useControllableState)({value:g,defaultValue:b,onChange:j}),pe=p&&he,ge=hasBuiltInHeaderContent(t),be=Boolean(c)||ge,je=(0,_SquircleFill.useSquircle)(!le&&!de&&!ce,ue,E),ye=_reactNative.StyleSheet.flatten(I)??{},fe="string"==typeof ye.backgroundColor?ye.backgroundColor:void 0,ve="string"==typeof ye.borderColor?ye.borderColor:void 0,Re=fe??xe??("filled"===K?D.colors["bg-subtle"]:D.colors.surface),Se="outline"===K?D.size.border:0,Ce=ve??D.colors.border,we="none"===a?void 0:D.shadow[a],Ve="elevated"===K&&(0,_shadows.supportsBoxShadow)()&&we?(0,_shadows.toBoxShadow)(we):void 0,Ae=je.active&&"elevated"===K&&!Ve,qe=je.active&&!Ae?{backgroundColor:"transparent",borderColor:"transparent"}:null,Ne=(0,_react.useMemo)(()=>{const e={borderRadius:Ae&&je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue,..._corners.smoothCorners,padding:le||je.active?D.space.none:oe,overflow:je.active?"visible":"hidden"};switch(K){case"flat":return{...e,backgroundColor:xe??D.colors.surface,borderBottomWidth:v,borderBottomColor:D.colors.border};case"outline":return{...e,backgroundColor:je.active?"transparent":xe??D.colors.surface,borderWidth:D.size.border,borderColor:je.active?"transparent":D.colors.border};case"filled":return{...e,backgroundColor:je.active?"transparent":xe??D.colors["bg-subtle"]};default:return{...e,backgroundColor:xe??D.colors.surface,...Ve?{boxShadow:Ve}:we}}},[D,K,we,ue,le,oe,je.active,je.size,Ve,Ae,xe,v]),Te=(0,_react.useMemo)(()=>({..."number"==typeof w?{width:"100%",aspectRatio:w}:{width:"100%",height:C},borderTopLeftRadius:ue,borderTopRightRadius:ue,borderBottomLeftRadius:D.radius.none,borderBottomRightRadius:D.radius.none,..._corners.smoothCorners}),[D,ue,w,C]),ke=u??"",Fe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.titleColumn,children:[u?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",accessibilityRole:"header",style:titleFaceFor(D,$),children:u}):null,h?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",style:ne.lead,children:h}):null,pe&&y?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",style:ne.lead,children:y}):null]}),isCardTextAction(m)?(0,_jsxRuntime.jsx)(CardTextActionButton,{action:m,haptic:T}):m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:ne.actionNode,children:m}):null,_,p?(0,_jsxRuntime.jsx)(CardIconAction,{icon:pe?"chevron-down":"chevron-up",label:`${pe?Q.show:Q.hide} ${ke}`.trim(),expanded:!pe,onPress:()=>me(!pe),haptic:T}):null,f?(0,_jsxRuntime.jsx)(CardIconAction,{icon:"trash",label:Q.remove,onPress:f,color:D.colors["danger-text"],haptic:T}):null]}),Oe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.header,!c&&ne.headerRow,pe&&ne.headerFolded,L],children:c??Fe}):null,pe?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[be||R?ne.body:null,M],children:i}),R&&!pe?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.footer,H],children:R}):null]}),Be=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.imageWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:S,resizeMode:"cover",style:Te,accessibilityLabel:"",accessible:!1}),V?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:ne.imageOverlay,children:V}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{padding:oe},children:Oe})]}):Oe,Pe=de?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:de,style:_reactNative.StyleSheet.absoluteFill}),Be]}):je.active&&je.size?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:je.size.width,height:je.size.height,radius:ue,fill:Re,stroke:Se?Ce:void 0,strokeWidth:Se,hostBorderWidth:Se}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.squircleClip,{padding:oe,borderRadius:je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue}],children:Be})]}):Be,{outer:Ie,inner:Le}=splitOuterLayout(I);let Me;if(ie){const handlePress=e=>{Z&&(T&&(0,_hapticUtils.triggerHaptic)(T),N?.(e))};Me=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[se,...flexStyleOf(P),Ie],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:te,onPress:handlePress,onPressIn:ae,onPressOut:re,accessibilityRole:B??(Z?"button":void 0),accessibilityLabel:F,accessibilityHint:O,testID:z,onLayout:je.onLayout,style:[Ne,Le,qe,ne.pressFill],...U,...ee.hostProps,children:Pe})})}else Me=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:B,testID:z,onLayout:je.onLayout,style:[Ne,...flexStyleOf(P),I,qe],...U,children:Pe});return A?(0,_jsxRuntime.jsx)(CardSkeleton,{...t}):ee.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Me,ee.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ne,I,qe,ne.preview],children:Pe}))]}):Me}),CardSkeleton=({variant:e,elevation:t,radius:i,padding:s,bg:a,header:r,footer:n,imageSource:l,imageHeight:o=160,imageAspectRatio:d,headerStyle:c,bodyStyle:u,footerStyle:x,flex:h,style:m,labels:_,...p})=>{const g=(0,_index2.useTheme)(),b=g.settings.components.card,j=e??b?.defaultVariant??"elevated",y=i??b?.defaultRadius??"lg",f=s??b?.defaultPadding??"md",v={...(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),..._},R=paddingMap[f],S=g.space[R],C="flat"===j?g.radius.none:g.radius[y],w=void 0!==r||hasBuiltInHeaderContent(p),V=resolveBackground(g,a)??g.colors.surface,A="outline"===j?1:0,q="outline"===j?g.colors.border:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{backgroundColor:V,borderRadius:C,..._corners.smoothCorners,borderWidth:A,borderColor:q,overflow:"hidden"},...flexStyleOf(h),m],accessibilityRole:"progressbar",accessibilityLabel:v.loading,accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==l?(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:"100%",height:d?void 0:o,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,w?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingBottom:g.space.sm},c],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"text",width:"60%",height:18})}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S},u],children:(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:3,fontSize:g.text.base.size,lastLineWidth:"55%"})}),void 0!==n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingTop:g.space.sm,flexDirection:"row"},x],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton";const Card=exports.Card=Object.assign(CardRoot,{Skeleton:CardSkeleton});Card.displayName="Card";const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=e=>"object"==typeof e&&null!==e&&!_react.default.isValidElement(e)&&"label"in e&&"onPress"in e,HIT_TARGET=44,CardIconAction=({icon:e,label:t,onPress:i,expanded:s,color:a,haptic:r})=>{const n=(0,_index2.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===s?void 0:{expanded:s},"aria-expanded":s,onPress:()=>{r&&(0,_hapticUtils.triggerHaptic)(r),i()},style:iconActionStyle,children:(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,size:20,color:a??n.colors["text-body"]})})})},CardTextActionButton=({action:e,haptic:t})=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:textActionStyle,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",color:"brand",children:e.label})}),iconActionStyle={width:44,height:44,alignItems:"center",justifyContent:"center"},textActionStyle={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},titleFaceFor=(e,t)=>"serif"===t?(0,_index2.fontFor)(e,"semibold","display"):{fontFamily:void 0,...(0,_index2.fontFor)(e,"semibold")},resolveBackground=(e,t)=>{if(null!=t)return(0,_guards.isOneOf)(BACKGROUND_TOKENS,t)?e.colors[t]:t},buildStyles=e=>_reactNative.StyleSheet.create({header:{marginBottom:e.space.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.space.sm},headerFolded:{marginBottom:e.space.none},titleColumn:{flex:1},lead:{marginTop:e.space.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.space.md},imageWrapper:{position:"relative"},imageOverlay:{..._reactNative.StyleSheet.absoluteFill},squircleClip:{overflow:"hidden",..._corners.smoothCorners},pressFill:{flexGrow:1},preview:{margin:e.space.none,marginTop:e.space.none,marginBottom:e.space.none,marginLeft:e.space.none,marginRight:e.space.none,marginStart:e.space.none,marginEnd:e.space.none,marginHorizontal:e.space.none,marginVertical:e.space.none,position:"relative",top:0,left:0,width:"100%",height:"100%"}}),stylesFor=(0,_themeStyles.themeStyles)(buildStyles);var _default=exports.default=Card;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Chip=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_chipG=require("../../text/phone/chip.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors["primary-soft"],on:e.colors.primary,ink:e.colors["primary-text"],border:e.colors.primary,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"success":return{base:e.colors["bg-muted"],on:e.colors.success,ink:e.colors["success-text"],border:e.colors.success,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"warning":return{base:e.colors["bg-muted"],on:e.colors.warning,ink:e.colors["warning-text"],border:e.colors.warning,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"danger":return{base:e.colors["bg-muted"],on:e.colors.danger,ink:e.colors["danger-text"],border:e.colors.danger,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"info":return{base:e.colors["bg-muted"],on:e.colors.info,ink:e.colors["info-text"],border:e.colors.info,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};default:return{base:e.colors["bg-muted"],on:e.colors["text-body"],ink:e.colors["text-body"],border:e.colors.border,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,hasChipCount=e=>null!=e&&""!==e;function ChipRoot({ref:e,...t}){const{label:s,count:r,selected:i=!1,selectionMode:o="single",onPress:l,onRemove:a,leftIcon:n,iconVariant:c,variant:d="soft",tone:u="neutral",size:p="md",disabled:m=!1,loading:h=!1,accessibilityLabel:x,haptic:b,style:y,textStyle:_,countStyle:g,closeButtonStyle:f,closeIconStyle:S,labels:j,removeTestID:C,testID:v}=t;(0,_assertValidValue.assertValidValue)("Chip","variant",t.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("Chip","tone",t.tone,["primary","neutral","success","warning","danger","info"]),(0,_assertValidValue.assertValidValue)("Chip","size",t.size,["sm","md"]),(0,_assertValidValue.assertValidValue)("Chip","selectionMode",t.selectionMode,["single","multiple","radio"]);const k=(0,_index2.useTheme)(),I=(0,_index.useMobileUiText)("chip",_chipG.CHIP_TEXT),V=(0,_react.useMemo)(()=>({...I,...j}),[I,j]),R=!!l&&!m,w="radio"===o,z=!!l&&(!m||w),O=hasChipCount(r),{style:M,pressIn:T,pressOut:B}=(0,_usePressAnimation.usePressAnimation)({enabled:R}),q=(0,_react.useMemo)(()=>toneFor(k,u),[k,u]),P=(0,_react.useMemo)(()=>(0,_index2.resolveChipSize)(k,p),[k,p]),L=Math.max(0,Math.ceil((44-P["min-height"])/2)),A=w?{top:L,bottom:L}:void 0,N="solid"===d,H="soft"===d,D=(()=>{if(H){const e=i?q.selectedOn:q.on,t=i?.24:.14;return(0,_color.tintOf)(e,t,i?q.selectedBg:q.base)}return i?N?q.selectedBg:"transparent":N?q.base:"transparent"})(),F=H?"transparent":i?q.selectedBorder:N?"transparent":q.border,U=m?k.colors["text-disabled"]:i?H?k.colors["text-body"]:q.selectedInk:q.ink,E=N||H?0:k.size.border,handlePress=()=>{if(!R)return;const e=(0,_hapticUtils.resolveHaptic)(b,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),l?.()},G=x??(O?`${s}, ${r}`:s),Y=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:P.gap},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(n,{color:U,size:P.icon,disabled:m},c)}):null,(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"medium",numberOfLines:1,style:[styles.label,{color:U,fontSize:P.text,lineHeight:Math.round(P.text*k.leading.body)},_],children:s??" "}),O?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",numberOfLines:1,style:[styles.count,{color:U,fontSize:Math.min(k.text.xs.size,P.text),marginLeft:k.space.xs},g],children:r}):null,a?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{m||(!1!==b&&(0,_hapticUtils.triggerHaptic)("impactLight"),a?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:(0,_index.fillText)(V.removeText,{content:s}),accessibilityState:{disabled:m},"aria-disabled":m,testID:C,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),style:({pressed:e})=>[styles.close,{width:P["close-size"],height:P["close-size"],borderRadius:P["close-size"]/2,..._corners.smoothCorners,marginLeft:P.gap,backgroundColor:e?k.colors["surface-pressed"]:k.colors["surface-hover"]},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"bold",maxFontSizeMultiplier:1,style:[{color:U,fontSize:P["close-text"],lineHeight:P["close-text"]+2},S],children:"×"})}):null]}),$={paddingHorizontal:P["padding-x"],paddingVertical:P["padding-y"],minHeight:P["min-height"],borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden",backgroundColor:D,borderWidth:E,borderColor:F,opacity:m?.55:1};let W;return W=z?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[M,{alignSelf:"flex-start",borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:e,onPress:handlePress,onPressIn:T,onPressOut:B,disabled:!R,accessibilityRole:w?"radio":"multiple"===o?"checkbox":"button",accessibilityLabel:G,accessibilityState:w||"multiple"===o?{checked:i,disabled:m}:{selected:i,disabled:m},"aria-checked":w||"multiple"===o?i:void 0,"aria-selected":w||"multiple"===o?void 0:i,"aria-disabled":m,hitSlop:A,...A?(0,_hitSlop.hitSlopMarker)(A):{},android_ripple:{color:k.colors["surface-pressed"],borderless:!1},testID:v,style:({pressed:e})=>[styles.base,$,e&&"outline"===d?{backgroundColor:k.colors["surface-pressed"]}:null,y],children:Y})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,style:[styles.base,$,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:G,accessibilityState:{selected:i,disabled:m},"aria-selected":i,"aria-disabled":m,testID:v,children:Y}),h?(0,_jsxRuntime.jsx)(ChipSkeleton,{...t}):W}const ChipSkeleton=({label:e,count:t,size:s="md",leftIcon:r,onRemove:i,style:o})=>{const l=(0,_index2.useTheme)(),a=(0,_index2.resolveChipSize)(l,s),n=Math.max(40,Math.min(120,7*(e??"").length)),c=a["min-height"],d=c/2,u=n+2*a["padding-x"]+(hasChipCount(t)?a.gap/2+7*String(t).length:0)+(void 0!==r?a.gap+14:0)+(void 0!==i?a.gap+a["close-size"]:0);return(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:u,height:c,radius:d,style:[{alignSelf:"flex-start"},o]})};ChipSkeleton.displayName="ChipSkeleton";const Chip=exports.Chip=Object.assign(ChipRoot,{Skeleton:ChipSkeleton});Chip.displayName="Chip";const styles=_reactNative.StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{flexShrink:1,textAlign:"center"},count:{flexShrink:0,fontVariant:["tabular-nums"]},close:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Chip;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Chip=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_chipG=require("../../text/phone/chip.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors["primary-soft"],on:e.colors.primary,ink:e.colors["primary-text"],border:e.colors.primary,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"success":return{base:e.colors["bg-muted"],on:e.colors.success,ink:e.colors["success-text"],border:e.colors.success,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"warning":return{base:e.colors["bg-muted"],on:e.colors.warning,ink:e.colors["warning-text"],border:e.colors.warning,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"danger":return{base:e.colors["bg-muted"],on:e.colors.danger,ink:e.colors["danger-text"],border:e.colors.danger,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"info":return{base:e.colors["bg-muted"],on:e.colors.info,ink:e.colors["info-text"],border:e.colors.info,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};default:return{base:e.colors["bg-muted"],on:e.colors["text-body"],ink:e.colors["text-body"],border:e.colors.border,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,hasChipCount=e=>null!=e&&""!==e;function ChipRoot({ref:e,...t}){const{label:s,count:r,selected:i=!1,selectionMode:o="single",onPress:l,onRemove:a,leftIcon:n,iconVariant:c,variant:d="soft",tone:u="neutral",size:p="md",disabled:m=!1,loading:h=!1,accessibilityLabel:x,haptic:b,style:y,textStyle:_,countStyle:g,closeButtonStyle:f,closeIconStyle:S,labels:j,removeTestID:C,testID:v}=t;(0,_assertValidValue.assertValidValue)("Chip","variant",t.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("Chip","tone",t.tone,["primary","neutral","success","warning","danger","info"]),(0,_assertValidValue.assertValidValue)("Chip","size",t.size,["sm","md"]),(0,_assertValidValue.assertValidValue)("Chip","selectionMode",t.selectionMode,["single","multiple","radio"]);const k=(0,_index2.useTheme)(),I=(0,_index.useMobileUiText)("chip",_chipG.CHIP_TEXT),V=(0,_react.useMemo)(()=>({...I,...j}),[I,j]),R=!!l&&!m,w="radio"===o,O=!!l&&(!m||w),z=hasChipCount(r),{style:B,pressIn:M,pressOut:T}=(0,_usePressAnimation.usePressAnimation)({enabled:R}),q=(0,_react.useMemo)(()=>toneFor(k,u),[k,u]),P=(0,_react.useMemo)(()=>(0,_index2.resolveChipSize)(k,p),[k,p]),L=Math.max(0,Math.ceil((44-P["min-height"])/2)),A=w?{top:L,bottom:L}:void 0,N="solid"===d,H="soft"===d,D=(()=>{if(H){const e=i?q.selectedOn:q.on,t=i?.24:.14;return(0,_color.tintOf)(e,t,i?q.selectedBg:q.base)}return i?q.selectedBg:N?q.base:"transparent"})(),F=H?"transparent":i?N?q.selectedBorder:(0,_color.tintOf)(q.selectedBorder,.3,q.selectedBorder):N?"transparent":q.border,U=m?k.colors["text-disabled"]:i?H?k.colors["text-body"]:q.selectedInk:q.ink,E=N||H?0:k.size.border,handlePress=()=>{if(!R)return;const e=(0,_hapticUtils.resolveHaptic)(b,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),l?.()},G=x??(z?`${s}, ${r}`:s),Y=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:P.gap},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(n,{color:U,size:P.icon,disabled:m},c)}):null,(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"medium",numberOfLines:1,style:[styles.label,{color:U,fontSize:P.text,lineHeight:Math.round(P.text*k.leading.body)},_],children:s??" "}),z?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",numberOfLines:1,style:[styles.count,{color:U,fontSize:Math.min(k.text.xs.size,P.text),marginLeft:k.space.xs},g],children:r}):null,a?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{m||(!1!==b&&(0,_hapticUtils.triggerHaptic)("impactLight"),a?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:(0,_index.fillText)(V.removeText,{content:s}),accessibilityState:{disabled:m},"aria-disabled":m,testID:C,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),style:({pressed:e})=>[styles.close,{width:P["close-size"],height:P["close-size"],borderRadius:P["close-size"]/2,..._corners.smoothCorners,marginLeft:P.gap,backgroundColor:e?k.colors["surface-pressed"]:k.colors["surface-hover"]},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"bold",maxFontSizeMultiplier:1,style:[{color:U,fontSize:P["close-text"],lineHeight:P["close-text"]+2},S],children:"×"})}):null]}),$={paddingHorizontal:P["padding-x"],paddingVertical:P["padding-y"],minHeight:P["min-height"],borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden",backgroundColor:D,borderWidth:E,borderColor:F,opacity:m?.55:1};let W;return W=O?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[B,{alignSelf:"flex-start",borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:e,onPress:handlePress,onPressIn:M,onPressOut:T,disabled:!R,accessibilityRole:w?"radio":"multiple"===o?"checkbox":"button",accessibilityLabel:G,accessibilityState:w||"multiple"===o?{checked:i,disabled:m}:{selected:i,disabled:m},"aria-checked":w||"multiple"===o?i:void 0,"aria-selected":w||"multiple"===o?void 0:i,"aria-disabled":m,hitSlop:A,...A?(0,_hitSlop.hitSlopMarker)(A):{},android_ripple:{color:k.colors["surface-pressed"],borderless:!1},testID:v,style:({pressed:e})=>[styles.base,$,e&&"outline"===d?{backgroundColor:k.colors["surface-pressed"]}:null,y],children:Y})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,style:[styles.base,$,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:G,accessibilityState:{selected:i,disabled:m},"aria-selected":i,"aria-disabled":m,testID:v,children:Y}),h?(0,_jsxRuntime.jsx)(ChipSkeleton,{...t}):W}const ChipSkeleton=({label:e,count:t,size:s="md",leftIcon:r,onRemove:i,style:o})=>{const l=(0,_index2.useTheme)(),a=(0,_index2.resolveChipSize)(l,s),n=Math.max(40,Math.min(120,7*(e??"").length)),c=a["min-height"],d=c/2,u=n+2*a["padding-x"]+(hasChipCount(t)?a.gap/2+7*String(t).length:0)+(void 0!==r?a.gap+14:0)+(void 0!==i?a.gap+a["close-size"]:0);return(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:u,height:c,radius:d,style:[{alignSelf:"flex-start"},o]})};ChipSkeleton.displayName="ChipSkeleton";const Chip=exports.Chip=Object.assign(ChipRoot,{Skeleton:ChipSkeleton});Chip.displayName="Chip";const styles=_reactNative.StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{flexShrink:1,textAlign:"center"},count:{flexShrink:0,fontVariant:["tabular-nums"]},close:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Chip;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EmptyState=EmptyState,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const ActionButton=({action:e,variant:t})=>{const i=(0,_index.useTheme)(),{style:r,pressIn:s,pressOut:n}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),o=(0,_react.useMemo)(()=>buildActionStyles(i),[i]),a="primary"===t,l=(0,_SquircleFill.useSquircle)(!0,i.radius.md),fillFor=e=>a?e?i.colors["primary-hover"]:i.colors.primary:e?i.colors["surface-pressed"]:"transparent";return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:r,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{(0,_hapticUtils.triggerHaptic)("selection"),e.onPress()},onPressIn:s,onPressOut:n,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityHint:e.accessibilityHint,testID:e.testID,onLayout:l.onLayout,style:({pressed:e})=>[o.button,a?o.buttonPrimary:o.buttonSecondary,e&&!l.active?a?o.buttonPrimaryPressed:o.buttonSecondaryPressed:null,l.active?o.buttonSquircleHost:null],children:({pressed:t})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l.active&&l.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:l.size.width,height:l.size.height,radius:i.radius.md,fill:fillFor(t),stroke:a?void 0:i.colors.border,strokeWidth:a?0:1}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o.buttonText,a?o.buttonTextPrimary:o.buttonTextSecondary],numberOfLines:1,children:e.label})]})})})};function EmptyState({ref:e,...t}){const i=(0,_index.useTheme)(),r=Object.keys(i.components["empty-state"]);(0,_assertValidValue.assertValidValue)("EmptyState","size",t.size,r),(0,_assertValidValue.assertValidValue)("EmptyState","variant",t.variant,["block","inline"]);const{icon:s,illustration:n,title:o,description:a,action:l,secondaryAction:c,size:u,variant:d,fill:m=!1,style:x,testID:y}=t,b=i.settings.components["empty-state"],_=u??b?.defaultSize??"md",p=d??b?.defaultVariant??"block",j=r.includes(_)?_:"md",g=(0,_react.useMemo)(()=>(0,_index.resolveEmptyStateSize)(i,j),[i,j]),h=(0,_react.useMemo)(()=>buildStyles(i),[i]);return"inline"===p?(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityRole:"summary",testID:y,style:[h.inline,m?h.fill:null,x],children:(0,_jsxRuntime.jsx)(_index2.Text,{variant:"caption",weight:"medium",color:"secondary",align:"center",children:o})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:e,accessibilityRole:"summary",testID:y,style:[h.root,{paddingVertical:g["padding-y"]},m?h.fill:null,x],children:[null!=n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginBottom:g["title-gap"]},children:(0,_react.isValidElement)(n)?n:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:n,style:{width:g["illustration-size"],height:g["illustration-size"]},resizeMode:"contain",accessibilityIgnoresInvertColors:!0})}):s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[h.iconCircle,{width:g.icon,height:g.icon,marginBottom:g["title-gap"],borderRadius:i.radius.pill,..._corners.smoothCorners}],children:s}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[h.title,{fontSize:g["title-text"],...(0,_index.fontFor)(i,"semibold")}],children:o}),a?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[h.description,{fontSize:g["description-text"],marginTop:g["description-gap"]}],children:a}):null,l||c?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:h.actions,children:[l?(0,_jsxRuntime.jsx)(ActionButton,{action:l,variant:"primary"}):null,c?(0,_jsxRuntime.jsx)(ActionButton,{action:c,variant:"secondary"}):null]}):null]})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},inline:{alignItems:"center",justifyContent:"center"},fill:{flexGrow:1},iconCircle:{backgroundColor:e.colors["surface-disabled"],alignItems:"center",justifyContent:"center"},title:{color:e.colors["text-body"],textAlign:"center"},description:{color:e.colors["text-muted"],textAlign:"center",maxWidth:320,lineHeight:e.text.base.size*e.leading.body},actions:{flexDirection:"row",alignItems:"center",gap:e.space.sm,marginTop:e.space.lg}}),buildActionStyles=e=>_reactNative.StyleSheet.create({button:{paddingHorizontal:e.space.lg,paddingVertical:e.space.sm,minHeight:42,borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden",alignItems:"center",justifyContent:"center",flexDirection:"row"},buttonPrimary:{backgroundColor:e.colors.primary},buttonPrimaryPressed:{backgroundColor:e.colors["primary-hover"]},buttonSecondary:{backgroundColor:"transparent",borderWidth:1,borderColor:e.colors.border},buttonSecondaryPressed:{backgroundColor:e.colors["surface-pressed"]},buttonSquircleHost:{backgroundColor:"transparent",borderColor:"transparent",overflow:"visible"},buttonText:{fontSize:e.text.base.size,...(0,_index.fontFor)(e,"semibold")},buttonTextPrimary:{color:e.colors["on-primary"]},buttonTextSecondary:{color:e.colors["text-body"]}});var _default=exports.default=EmptyState;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EmptyState=EmptyState,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const ActionButton=({action:e,variant:t})=>{const i=(0,_index.useTheme)(),{style:r,pressIn:s,pressOut:n}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),o=(0,_react.useMemo)(()=>buildActionStyles(i),[i]),a="primary"===t,l=(0,_SquircleFill.useSquircle)(!0,i.radius.md),fillFor=e=>a?e?i.colors["primary-hover"]:i.colors.primary:e?i.colors["surface-pressed"]:"transparent";return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:r,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{(0,_hapticUtils.triggerHaptic)("selection"),e.onPress()},onPressIn:s,onPressOut:n,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityHint:e.accessibilityHint,testID:e.testID,onLayout:l.onLayout,style:({pressed:e})=>[o.button,a?o.buttonPrimary:o.buttonSecondary,e&&!l.active?a?o.buttonPrimaryPressed:o.buttonSecondaryPressed:null,l.active?o.buttonSquircleHost:null],children:({pressed:t})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l.active&&l.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:l.size.width,height:l.size.height,radius:i.radius.md,fill:fillFor(t),stroke:a?void 0:i.colors.border,strokeWidth:a?0:1,hostBorderWidth:a?0:1}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o.buttonText,a?o.buttonTextPrimary:o.buttonTextSecondary],numberOfLines:1,children:e.label})]})})})};function EmptyState({ref:e,...t}){const i=(0,_index.useTheme)(),r=Object.keys(i.components["empty-state"]);(0,_assertValidValue.assertValidValue)("EmptyState","size",t.size,r),(0,_assertValidValue.assertValidValue)("EmptyState","variant",t.variant,["block","inline"]);const{icon:s,illustration:n,title:o,description:a,action:l,secondaryAction:c,size:u,variant:d,fill:m=!1,style:x,testID:y}=t,b=i.settings.components["empty-state"],_=u??b?.defaultSize??"md",p=d??b?.defaultVariant??"block",j=r.includes(_)?_:"md",h=(0,_react.useMemo)(()=>(0,_index.resolveEmptyStateSize)(i,j),[i,j]),g=(0,_react.useMemo)(()=>buildStyles(i),[i]);return"inline"===p?(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityRole:"summary",testID:y,style:[g.inline,m?g.fill:null,x],children:(0,_jsxRuntime.jsx)(_index2.Text,{variant:"caption",weight:"medium",color:"secondary",align:"center",children:o})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:e,accessibilityRole:"summary",testID:y,style:[g.root,{paddingVertical:h["padding-y"]},m?g.fill:null,x],children:[null!=n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginBottom:h["title-gap"]},children:(0,_react.isValidElement)(n)?n:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:n,style:{width:h["illustration-size"],height:h["illustration-size"]},resizeMode:"contain",accessibilityIgnoresInvertColors:!0})}):s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[g.iconCircle,{width:h.icon,height:h.icon,marginBottom:h["title-gap"],borderRadius:i.radius.pill,..._corners.smoothCorners}],children:s}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[g.title,{fontSize:h["title-text"],...(0,_index.fontFor)(i,"semibold")}],children:o}),a?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[g.description,{fontSize:h["description-text"],marginTop:h["description-gap"]}],children:a}):null,l||c?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:g.actions,children:[l?(0,_jsxRuntime.jsx)(ActionButton,{action:l,variant:"primary"}):null,c?(0,_jsxRuntime.jsx)(ActionButton,{action:c,variant:"secondary"}):null]}):null]})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},inline:{alignItems:"center",justifyContent:"center"},fill:{flexGrow:1},iconCircle:{backgroundColor:e.colors["surface-disabled"],alignItems:"center",justifyContent:"center"},title:{color:e.colors["text-body"],textAlign:"center"},description:{color:e.colors["text-muted"],textAlign:"center",maxWidth:320,lineHeight:e.text.base.size*e.leading.body},actions:{flexDirection:"row",alignItems:"center",gap:e.space.sm,marginTop:e.space.lg}}),buildActionStyles=e=>_reactNative.StyleSheet.create({button:{paddingHorizontal:e.space.lg,paddingVertical:e.space.sm,minHeight:42,borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden",alignItems:"center",justifyContent:"center",flexDirection:"row"},buttonPrimary:{backgroundColor:e.colors.primary},buttonPrimaryPressed:{backgroundColor:e.colors["primary-hover"]},buttonSecondary:{backgroundColor:"transparent",borderWidth:1,borderColor:e.colors.border},buttonSecondaryPressed:{backgroundColor:e.colors["surface-pressed"]},buttonSquircleHost:{backgroundColor:"transparent",borderColor:"transparent",overflow:"visible"},buttonText:{fontSize:e.text.base.size,...(0,_index.fontFor)(e,"semibold")},buttonTextPrimary:{color:e.colors["on-primary"]},buttonTextSecondary:{color:e.colors["text-body"]}});var _default=exports.default=EmptyState;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveVariantColors=exports.resolveFieldTextStyle=exports.pickRepresentativeBorderColor=exports.hasFieldText=exports.fieldTextAsString=exports.default=exports.RequiredPlaceholder=exports.RequiredMark=exports.FieldMessage=exports.FieldLabel=exports.FieldErrorGlyph=exports.FieldBase=void 0;var _react=require("react"),_reactNative=require("react-native"),_useFieldErrorScroll=require("../../hooks/useFieldErrorScroll.js"),_index=require("../../theme/index.js"),_ariaState=require("../../utils/ariaState.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const expandColorSides=e=>"string"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??"transparent",right:e.right??"transparent",bottom:e.bottom??"transparent",left:e.left??"transparent"},expandWidthSides=e=>"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0},pickRepresentativeBorderColor=e=>{for(const t of["bottom","top","left","right"]){const r=e[t];if(r&&"transparent"!==r)return r}return e.bottom};exports.pickRepresentativeBorderColor=pickRepresentativeBorderColor;const resolveFieldTextStyle=(e,t={})=>{const{disabled:r=!1}=t;return{color:r?e.colors["field-text-disabled"]:e.colors["field-text"],placeholderColor:r?e.colors["field-placeholder-disabled"]:e.colors["field-placeholder"],weightStyle:(0,_index.fontFor)(e,"normal")}};exports.resolveFieldTextStyle=resolveFieldTextStyle;const RequiredMark=()=>{const e=(0,_index.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:e.colors["danger-text"]},..."web"===_reactNative.Platform.OS?{"aria-hidden":!0}:null,children:` ${e.settings.components.field?.requiredMarker??"*"}`})};exports.RequiredMark=RequiredMark;const RequiredPlaceholder=({text:e,color:t,fontSize:r,weightStyle:i,align:o="center",paddingTop:l,textAlign:s})=>(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{justifyContent:"top"===o?"flex-start":"center",paddingTop:l}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{accessible:!1,numberOfLines:1,style:{color:t,fontSize:r,...i,includeFontPadding:!1,textAlign:s},children:[e,(0,_jsxRuntime.jsx)(RequiredMark,{})]})});exports.RequiredPlaceholder=RequiredPlaceholder;const FieldErrorGlyph=({size:e,color:t})=>{const r=(0,_index.useTheme)().settings.icons.error??_defaultIcons.defaultIcons.error;return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:r({size:e,color:t})})};exports.FieldErrorGlyph=FieldErrorGlyph;const hasFieldText=e=>null!=e&&!1!==e&&!0!==e&&""!==e;exports.hasFieldText=hasFieldText;const fieldTextAsString=e=>"string"==typeof e?e:void 0;exports.fieldTextAsString=fieldTextAsString;const FieldLabel=({children:e,size:t="md",required:r=!1,help:i,color:o,style:l})=>{const s=(0,_index.useTheme)(),a=(0,_index.resolveFieldSize)(s,t),n=hasFieldText(i),d=(0,_textInk.useTextInk)(l,a["label-text"],o??s.colors["field-label"]),c=(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[familyStyles.label,{color:o??s.colors["field-label"],fontSize:a["label-text"],...(0,_index.fontFor)(s,"semibold"),marginBottom:n?s.space.none:a["label-gap"]},n?familyStyles.labelShrink:null,l],children:[(0,_jsxRuntime.jsx)(_textInk.TextInkContext,{value:d,children:e}),r?(0,_jsxRuntime.jsx)(RequiredMark,{}):null]});return n?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.labelRow,{marginBottom:a["label-gap"]}],children:[c,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[familyStyles.help,{marginLeft:s.space.xs}],children:"string"==typeof i||"number"==typeof i?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[familyStyles.helpText,{color:s.colors["text-muted"],fontSize:a["message-text"],...(0,_index.fontFor)(s,"normal")}],children:i}):i})]}):c};exports.FieldLabel=FieldLabel;const FieldMessage=({text:e,error:t=!1,size:r="md",style:i})=>{const o=(0,_index.useTheme)(),l=(0,_index.resolveFieldSize)(o,r),s=t?o.colors["field-message"]:o.colors["text-muted"],a=(0,_textInk.useTextInk)(i,l["message-text"],s);return hasFieldText(e)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.messageRow,{marginTop:l["message-gap"],columnGap:o.space.xs}],accessibilityLiveRegion:t?"polite":"none",children:[t?(0,_jsxRuntime.jsx)(FieldErrorGlyph,{size:l["message-text"],color:s}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[familyStyles.messageText,{color:s,fontSize:l["message-text"],...(0,_index.fontFor)(o,"normal")},i],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext,{value:a,children:e})})]}):null};exports.FieldMessage=FieldMessage;const familyStyles=_reactNative.StyleSheet.create({label:{includeFontPadding:!1},labelShrink:{flexShrink:1},labelRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0,alignItems:"center",justifyContent:"center"},helpText:{includeFontPadding:!1},messageRow:{flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1}}),resolveVariantColors=(e,t)=>{let r,i,o,l,s;"outline"===t?(r=e.colors["field-bg"],i=e.colors["field-bg-focus"],o=e.colors["field-bg-disabled"],l=e.colors["field-border"],s=e.size.border):"underline"===t?(r="transparent",i=void 0,o="transparent",l={bottom:e.colors["field-border"]},s={bottom:e.size.border}):(r=e.colors["field-bg"],i=void 0,o=e.colors["field-bg-disabled"],l="transparent",s=0);const wrapToIdleShape=e=>"string"==typeof l?e:{bottom:e},a=expandColorSides(l),n=expandColorSides(wrapToIdleShape(e.colors["field-border-focus"]));return{backgroundIdleEmpty:r,backgroundIdleFilled:r,backgroundFocused:i,backgroundError:void 0,backgroundDisabled:o,borderIdle:a,borderFocused:n,borderError:expandColorSides(wrapToIdleShape(e.colors["field-border-error"])),borderDisabled:expandColorSides(l),borderWidth:expandWidthSides(s),borderFocusedRepresentative:pickRepresentativeBorderColor(n)}};exports.resolveVariantColors=resolveVariantColors;const FieldBase=e=>{(0,_assertValidValue.assertValidValue)("FieldBase","variant",e.variant,["outline","filled","underline"]),(0,_assertValidValue.assertValidValue)("FieldBase","size",e.size,["sm","md","lg"]);const{size:t="md",variant:r,focused:i=!1,disabled:o=!1,error:l=!1,filled:s=!1,leading:a,leadingDivider:n=!1,trailing:d,slotAlign:c="center",slotLineHeight:u,topNotch:x,children:b,onPress:p,pressFeedback:m=!0,minHeight:g,maxHeight:h,width:f,height:_,paddingHorizontal:y,paddingLeft:v,paddingRight:R,paddingVertical:j,radius:S,borderTopLeftRadius:F,borderTopRightRadius:T,borderBottomLeftRadius:k,borderBottomRightRadius:C,borderWidth:V,borderTopWidth:I,borderRightWidth:q,borderBottomWidth:w,borderLeftWidth:N,gap:B,flushBottom:L=!1,style:z,testID:E,accessibilityRole:D,accessibilityLabel:M,accessibilityState:W,accessibilityHint:P}=e,A=(0,_index.useTheme)(),H=(0,_useFieldErrorScroll.useFieldErrorAnchor)(l),G=(0,_react.useMemo)(()=>buildStyles(),[]),O=r??A.settings.components.field?.defaultVariant??"outline",$=(0,_index.resolveFieldSize)(A,t),J=(0,_react.useMemo)(()=>resolveVariantColors(A,O),[A,O]),K=l?2:i?1:0,Q=(0,_react.useRef)((0,_index.createAnimatedValue)(K)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(Q,{toValue:K,duration:A.motion.duration.fast,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:!1});return e.start(),()=>e.stop()},[K,Q,A.motion.duration.fast,A.motion.ease["in-out"]]);const U=[0,1,2],X=s?J.backgroundIdleFilled:J.backgroundIdleEmpty,Y=J.backgroundFocused??X,Z=J.backgroundError??X,ee=o?J.backgroundDisabled:Q.interpolate({inputRange:U,outputRange:[X,Y,Z]}),te=J.borderIdle,re=J.borderFocused,ie=J.borderError,oe={top:I,right:q,bottom:w,left:N},le={top:oe.top??V??J.borderWidth.top,right:oe.right??V??J.borderWidth.right,bottom:oe.bottom??V??J.borderWidth.bottom,left:oe.left??V??J.borderWidth.left},se="underline"===O,ae=se?A.radius.none:S?A.radius[S]:$.radius,ne=se?{tl:A.radius.none,tr:A.radius.none,bl:A.radius.none,br:A.radius.none}:{tl:F??ae,tr:T??ae,bl:k??ae,br:C??ae},sideColor=e=>Q.interpolate({inputRange:U,outputRange:[te[e],re[e],ie[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,de=!se&&ne.tl===ne.tr&&ne.tl===ne.bl&&ne.tl===ne.br&&sameOnEverySide(le)&&sameOnEverySide(te)&&sameOnEverySide(re)&&sameOnEverySide(ie)&&sameOnEverySide(J.borderDisabled),ce=(0,_SquircleFill.useSquircle)(de,ne.tl),ue=ce.active?{borderTopColor:"transparent",borderRightColor:"transparent",borderBottomColor:"transparent",borderLeftColor:"transparent"}:o?{borderTopColor:J.borderDisabled.top,borderRightColor:J.borderDisabled.right,borderBottomColor:J.borderDisabled.bottom,borderLeftColor:J.borderDisabled.left}:{borderTopColor:sideColor("top"),borderRightColor:sideColor("right"),borderBottomColor:sideColor("bottom"),borderLeftColor:sideColor("left")},xe=o?J.borderDisabled.top:sideColor("top"),be={minHeight:_??g??$["min-height"],maxHeight:h,paddingHorizontal:y??$["padding-x"],paddingVertical:j??$["padding-y"],paddingLeft:v??y??$["padding-x"],paddingRight:R??y??$["padding-x"],backgroundColor:ce.active?"transparent":ee,columnGap:B??A.space.md,alignItems:"top"===c?"flex-start":"center",borderTopLeftRadius:ne.tl,borderTopRightRadius:ne.tr,borderBottomLeftRadius:ne.bl,borderBottomRightRadius:ne.br,borderCurve:_corners.smoothCorners.borderCurve,borderTopWidth:le.top,borderRightWidth:le.right,borderBottomWidth:le.bottom,borderLeftWidth:le.left,...ue,...void 0!==f?{width:f}:null,...void 0!==_?{height:_}:null},pe=(0,_react.useRef)(K);pe.current=K,(0,_react.useEffect)(()=>{Q.setValue(pe.current)},[J,Q]);const me=L?{marginBottom:A.space.none}:void 0,ge={disabled:o,...W},he="top"===c,fe=he?{alignSelf:"flex-start",marginTop:Math.max(0,((u??$.icon)-$.icon)/2)}:null,ye=_??g??$["min-height"],ve=(()=>{if(!x)return 0;const e=Math.min(ne.tl,ye/2),t=x.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),Re=x&&le.top>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-le.top,left:x.left-le.left,width:x.width,height:le.top+ve,backgroundColor:ee}}):null,renderInner=e=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[ce.active&&ce.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ce.size.width,height:ce.size.height,radius:ne.tl,fill:e&&!o?A.colors["surface-pressed"]:ee,stroke:xe,strokeWidth:le.top}):null,Re,null!=a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.slot,fe],children:a}):null,null!=a&&n?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[G.divider,fe,{height:$.icon,backgroundColor:A.colors["field-border"]}]}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.content,he?G.contentTop:null],children:b}),null!=d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.slot,fe],children:d}):null]}),je=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:H,onLayout:ce.onLayout,style:[G.box,be,p?null:me,z],accessibilityRole:D,accessibilityLabel:M,accessibilityHint:P,accessibilityState:ge,...(0,_ariaState.ariaFromState)(ge),testID:E,children:renderInner(!1)});return p&&!m?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:p,disabled:o,accessible:!1,style:me,testID:E?`${E}-press`:void 0,children:je}):p?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:p,disabled:o,style:me,accessibilityRole:D??"button",accessibilityLabel:M,accessibilityHint:P,accessibilityState:ge,...(0,_ariaState.ariaFromState)(ge),testID:E,children:({pressed:e})=>(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:H,onLayout:ce.onLayout,style:[G.box,be,!e||o||ce.active?null:{backgroundColor:A.colors["surface-pressed"]},z],children:renderInner(e)})}):je};exports.FieldBase=FieldBase,FieldBase.displayName="FieldBase";const buildStyles=()=>_reactNative.StyleSheet.create({box:{flexDirection:"row",alignItems:"center",overflow:"visible"},slot:{alignItems:"center",justifyContent:"center"},divider:{width:1,alignSelf:"center"},content:{flex:1,flexDirection:"row",alignItems:"center"},contentTop:{alignItems:"flex-start"}});var _default=exports.default=FieldBase;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveVariantColors=exports.resolveFieldTextStyle=exports.pickRepresentativeBorderColor=exports.hasFieldText=exports.fieldTextAsString=exports.default=exports.RequiredPlaceholder=exports.RequiredMark=exports.FieldMessage=exports.FieldLabel=exports.FieldErrorGlyph=exports.FieldBase=void 0;var _react=require("react"),_reactNative=require("react-native"),_useFieldErrorScroll=require("../../hooks/useFieldErrorScroll.js"),_index=require("../../theme/index.js"),_ariaState=require("../../utils/ariaState.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const expandColorSides=e=>"string"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??"transparent",right:e.right??"transparent",bottom:e.bottom??"transparent",left:e.left??"transparent"},expandWidthSides=e=>"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0},pickRepresentativeBorderColor=e=>{for(const t of["bottom","top","left","right"]){const r=e[t];if(r&&"transparent"!==r)return r}return e.bottom};exports.pickRepresentativeBorderColor=pickRepresentativeBorderColor;const resolveFieldTextStyle=(e,t={})=>{const{disabled:r=!1}=t;return{color:r?e.colors["field-text-disabled"]:e.colors["field-text"],placeholderColor:r?e.colors["field-placeholder-disabled"]:e.colors["field-placeholder"],weightStyle:(0,_index.fontFor)(e,"normal")}};exports.resolveFieldTextStyle=resolveFieldTextStyle;const RequiredMark=()=>{const e=(0,_index.useTheme)(),t=!1===e.settings.components.field?.requiredMarkerSpace?"⁠":" ";return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:e.colors["danger-text"]},..."web"===_reactNative.Platform.OS?{"aria-hidden":!0}:null,children:`${t}${e.settings.components.field?.requiredMarker??"*"}`})};exports.RequiredMark=RequiredMark;const RequiredPlaceholder=({text:e,color:t,fontSize:r,weightStyle:i,align:o="center",paddingTop:l,textAlign:s})=>(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{justifyContent:"top"===o?"flex-start":"center",paddingTop:l}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{accessible:!1,numberOfLines:1,style:{color:t,fontSize:r,...i,includeFontPadding:!1,textAlign:s},children:[e,(0,_jsxRuntime.jsx)(RequiredMark,{})]})});exports.RequiredPlaceholder=RequiredPlaceholder;const FieldErrorGlyph=({size:e,color:t})=>{const r=(0,_index.useTheme)().settings.icons.error??_defaultIcons.defaultIcons.error;return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:r({size:e,color:t})})};exports.FieldErrorGlyph=FieldErrorGlyph;const hasFieldText=e=>null!=e&&!1!==e&&!0!==e&&""!==e;exports.hasFieldText=hasFieldText;const fieldTextAsString=e=>"string"==typeof e?e:void 0;exports.fieldTextAsString=fieldTextAsString;const FieldLabel=({children:e,size:t="md",required:r=!1,help:i,color:o,style:l})=>{const s=(0,_index.useTheme)(),n=(0,_index.resolveFieldSize)(s,t),a=hasFieldText(i),d=(0,_textInk.useTextInk)(l,n["label-text"],o??s.colors["field-label"]),c=(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[familyStyles.label,{color:o??s.colors["field-label"],fontSize:n["label-text"],...(0,_index.fontFor)(s,"semibold"),marginBottom:a?s.space.none:n["label-gap"]},a?familyStyles.labelShrink:null,l],children:[(0,_jsxRuntime.jsx)(_textInk.TextInkContext,{value:d,children:e}),r?(0,_jsxRuntime.jsx)(RequiredMark,{}):null]});return a?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.labelRow,{marginBottom:n["label-gap"]}],children:[c,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[familyStyles.help,{marginLeft:s.space.xs}],children:"string"==typeof i||"number"==typeof i?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[familyStyles.helpText,{color:s.colors["text-muted"],fontSize:n["message-text"],...(0,_index.fontFor)(s,"normal")}],children:i}):i})]}):c};exports.FieldLabel=FieldLabel;const FieldMessage=({text:e,error:t=!1,size:r="md",style:i})=>{const o=(0,_index.useTheme)(),l=(0,_index.resolveFieldSize)(o,r),s=t?o.colors["field-message"]:o.colors["text-muted"],n=(0,_textInk.useTextInk)(i,l["message-text"],s);return hasFieldText(e)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.messageRow,{marginTop:l["message-gap"],columnGap:o.space.xs}],accessibilityLiveRegion:t?"polite":"none",children:[t?(0,_jsxRuntime.jsx)(FieldErrorGlyph,{size:l["message-text"],color:s}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[familyStyles.messageText,{color:s,fontSize:l["message-text"],...(0,_index.fontFor)(o,"normal")},i],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext,{value:n,children:e})})]}):null};exports.FieldMessage=FieldMessage;const familyStyles=_reactNative.StyleSheet.create({label:{includeFontPadding:!1},labelShrink:{flexShrink:1},labelRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0,alignItems:"center",justifyContent:"center"},helpText:{includeFontPadding:!1},messageRow:{flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1}}),resolveVariantColors=(e,t)=>{let r,i,o,l,s;"outline"===t?(r=e.colors["field-bg"],i=e.colors["field-bg-focus"],o=e.colors["field-bg-disabled"],l=e.colors["field-border"],s=e.size.border):"underline"===t?(r="transparent",i=void 0,o="transparent",l={bottom:e.colors["field-border"]},s={bottom:e.size.border}):(r=e.colors["field-bg"],i=void 0,o=e.colors["field-bg-disabled"],l="transparent",s=0);const wrapToIdleShape=e=>"string"==typeof l?e:{bottom:e},n=expandColorSides(l),a=expandColorSides(wrapToIdleShape(e.colors["field-border-focus"]));return{backgroundIdleEmpty:r,backgroundIdleFilled:r,backgroundFocused:i,backgroundError:void 0,backgroundDisabled:o,borderIdle:n,borderFocused:a,borderError:expandColorSides(wrapToIdleShape(e.colors["field-border-error"])),borderDisabled:expandColorSides(l),borderWidth:expandWidthSides(s),borderFocusedRepresentative:pickRepresentativeBorderColor(a)}};exports.resolveVariantColors=resolveVariantColors;const FieldBase=e=>{(0,_assertValidValue.assertValidValue)("FieldBase","variant",e.variant,["outline","filled","underline"]),(0,_assertValidValue.assertValidValue)("FieldBase","size",e.size,["sm","md","lg"]);const{size:t="md",variant:r,focused:i=!1,disabled:o=!1,error:l=!1,filled:s=!1,leading:n,leadingDivider:a=!1,trailing:d,slotAlign:c="center",slotLineHeight:u,topNotch:x,children:b,onPress:p,pressFeedback:m=!0,minHeight:h,maxHeight:g,width:f,height:_,paddingHorizontal:y,paddingLeft:v,paddingRight:R,paddingVertical:S,radius:j,borderTopLeftRadius:F,borderTopRightRadius:T,borderBottomLeftRadius:k,borderBottomRightRadius:C,borderWidth:V,borderTopWidth:I,borderRightWidth:q,borderBottomWidth:w,borderLeftWidth:B,gap:N,flushBottom:L=!1,style:z,testID:E,accessibilityRole:D,accessibilityLabel:M,accessibilityState:W,accessibilityHint:P}=e,A=(0,_index.useTheme)(),H=(0,_useFieldErrorScroll.useFieldErrorAnchor)(l),G=(0,_react.useMemo)(()=>buildStyles(),[]),O=r??A.settings.components.field?.defaultVariant??"outline",$=(0,_index.resolveFieldSize)(A,t),J=(0,_react.useMemo)(()=>resolveVariantColors(A,O),[A,O]),K=l?2:i?1:0,Q=(0,_react.useRef)((0,_index.createAnimatedValue)(K)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(Q,{toValue:K,duration:A.motion.duration.fast,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:!1});return e.start(),()=>e.stop()},[K,Q,A.motion.duration.fast,A.motion.ease["in-out"]]);const U=[0,1,2],X=s?J.backgroundIdleFilled:J.backgroundIdleEmpty,Y=J.backgroundFocused??X,Z=J.backgroundError??X,ee=o?J.backgroundDisabled:Q.interpolate({inputRange:U,outputRange:[X,Y,Z]}),te=J.borderIdle,re=J.borderFocused,ie=J.borderError,oe={top:I,right:q,bottom:w,left:B},le={top:oe.top??V??J.borderWidth.top,right:oe.right??V??J.borderWidth.right,bottom:oe.bottom??V??J.borderWidth.bottom,left:oe.left??V??J.borderWidth.left},se="underline"===O,ne=se?A.radius.none:j?A.radius[j]:$.radius,ae=se?{tl:A.radius.none,tr:A.radius.none,bl:A.radius.none,br:A.radius.none}:{tl:F??ne,tr:T??ne,bl:k??ne,br:C??ne},sideColor=e=>Q.interpolate({inputRange:U,outputRange:[te[e],re[e],ie[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,de=!se&&ae.tl===ae.tr&&ae.tl===ae.bl&&ae.tl===ae.br&&sameOnEverySide(le)&&sameOnEverySide(te)&&sameOnEverySide(re)&&sameOnEverySide(ie)&&sameOnEverySide(J.borderDisabled),ce=(0,_SquircleFill.useSquircle)(de,ae.tl),ue=ce.active?{borderTopColor:"transparent",borderRightColor:"transparent",borderBottomColor:"transparent",borderLeftColor:"transparent"}:o?{borderTopColor:J.borderDisabled.top,borderRightColor:J.borderDisabled.right,borderBottomColor:J.borderDisabled.bottom,borderLeftColor:J.borderDisabled.left}:{borderTopColor:sideColor("top"),borderRightColor:sideColor("right"),borderBottomColor:sideColor("bottom"),borderLeftColor:sideColor("left")},xe=o?J.borderDisabled.top:sideColor("top"),be={minHeight:_??h??$["min-height"],maxHeight:g,paddingHorizontal:y??$["padding-x"],paddingVertical:S??$["padding-y"],paddingLeft:v??y??$["padding-x"],paddingRight:R??y??$["padding-x"],backgroundColor:ce.active?"transparent":ee,columnGap:N??A.space.md,alignItems:"top"===c?"flex-start":"center",borderTopLeftRadius:ae.tl,borderTopRightRadius:ae.tr,borderBottomLeftRadius:ae.bl,borderBottomRightRadius:ae.br,borderCurve:_corners.smoothCorners.borderCurve,borderTopWidth:le.top,borderRightWidth:le.right,borderBottomWidth:le.bottom,borderLeftWidth:le.left,...ue,...void 0!==f?{width:f}:null,...void 0!==_?{height:_}:null},pe=(0,_react.useRef)(K);pe.current=K,(0,_react.useEffect)(()=>{Q.setValue(pe.current)},[J,Q]);const me=L?{marginBottom:A.space.none}:void 0,he={disabled:o,...W},ge="top"===c,fe=ge?{alignSelf:"flex-start",marginTop:Math.max(0,((u??$.icon)-$.icon)/2)}:null,ye=_??h??$["min-height"],ve=(()=>{if(!x)return 0;const e=Math.min(ae.tl,ye/2),t=x.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),Re=x&&le.top>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-le.top,left:x.left-le.left,width:x.width,height:le.top+ve,backgroundColor:ee}}):null,renderInner=e=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[ce.active&&ce.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ce.size.width,height:ce.size.height,radius:ae.tl,fill:e&&!o?A.colors["surface-pressed"]:ee,stroke:xe,strokeWidth:le.top,hostBorderWidth:le.top}):null,Re,null!=n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.slot,fe],children:n}):null,null!=n&&a?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[G.divider,fe,{height:$.icon,backgroundColor:A.colors["field-border"]}]}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.content,ge?G.contentTop:null],children:b}),null!=d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.slot,fe],children:d}):null]}),Se=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:H,onLayout:ce.onLayout,style:[G.box,be,p?null:me,z],accessibilityRole:D,accessibilityLabel:M,accessibilityHint:P,accessibilityState:he,...(0,_ariaState.ariaFromState)(he),testID:E,children:renderInner(!1)});return p&&!m?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:p,disabled:o,accessible:!1,style:me,testID:E?`${E}-press`:void 0,children:Se}):p?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:p,disabled:o,style:me,accessibilityRole:D??"button",accessibilityLabel:M,accessibilityHint:P,accessibilityState:he,...(0,_ariaState.ariaFromState)(he),testID:E,children:({pressed:e})=>(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{ref:H,onLayout:ce.onLayout,style:[G.box,be,!e||o||ce.active?null:{backgroundColor:A.colors["surface-pressed"]},z],children:renderInner(e)})}):Se};exports.FieldBase=FieldBase,FieldBase.displayName="FieldBase";const buildStyles=()=>_reactNative.StyleSheet.create({box:{flexDirection:"row",alignItems:"center",overflow:"visible"},slot:{alignItems:"center",justifyContent:"center"},divider:{width:1,alignSelf:"center"},content:{flex:1,flexDirection:"row",alignItems:"center"},contentTop:{alignItems:"flex-start"}});var _default=exports.default=FieldBase;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FilterChipRow=FilterChipRow,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_index3=require("../Chip/index.js"),_jsxRuntime=require("react/jsx-runtime");const FilterChipRowItem=(0,_react.memo)(({itemKey:e,label:t,count:a,disabled:r,testID:i,selected:s,size:n,variant:l,tone:c,haptic:o,onSelect:u,onItemLayout:d})=>{const _=(0,_react.useCallback)(()=>u(e),[u,e]),h=(0,_react.useCallback)(t=>d(e,t.nativeEvent.layout),[d,e]);return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:h,collapsable:!1,children:(0,_jsxRuntime.jsx)(_index3.Chip,{label:t,count:a,selected:s,selectionMode:"radio",disabled:r,testID:i,size:n,variant:l,tone:c,haptic:!s&&o,onPress:_})})});function FilterChipRow({ref:e,...t}){const{items:a,value:r,onChange:i,bleed:s=0,size:n,variant:l,tone:c,haptic:o,accessibilityLabel:u,style:d,contentContainerStyle:_,testID:h}=t;(0,_assertValidValue.assertValidValue)("FilterChipRow","size",t.size,["sm","md"]),(0,_assertValidValue.assertValidValue)("FilterChipRow","variant",t.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("FilterChipRow","tone",t.tone,["primary","success","warning","danger","info","neutral"]);const p=(0,_index2.useTheme)(),m=(0,_index.useReducedMotion)(),x=(0,_react.useRef)(null),v=(0,_react.useRef)({viewport:0,content:0,chips:{},revealed:null}),w=(0,_react.useRef)(r),C=(0,_react.useRef)(i);(0,_react.useEffect)(()=>{C.current=i},[i]);const b=(0,_react.useCallback)((e,t)=>{const a=v.current,r=a.chips[e];if(!r||0===a.viewport||0===a.content)return;const i=r.x+r.width/2-a.viewport/2,s=Math.min(Math.max(i,0),Math.max(a.content-a.viewport,0));x.current?.scrollTo({x:s,animated:t&&!m}),a.revealed=e},[m]),y=(0,_react.useCallback)(()=>{v.current.revealed!==w.current&&b(w.current,!1)},[b]);(0,_react.useEffect)(()=>{w.current=r,b(r,!0)},[r,b]);const R=(0,_react.useCallback)(e=>{v.current.viewport=e.nativeEvent.layout.width,y()},[y]),f=(0,_react.useCallback)(e=>{v.current.content=e,y()},[y]),V=(0,_react.useCallback)((e,t)=>{v.current.chips[e]={x:t.x,width:t.width},y()},[y]),j=(0,_react.useCallback)(e=>{e!==w.current?C.current(e):b(e,!0)},[b]),I=(0,_react.useMemo)(()=>[styles.row,{paddingHorizontal:s,columnGap:p.space.xs},_],[s,p.space.xs,_]);return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityRole:"radiogroup",accessibilityLabel:u,testID:h,style:[s>0?{marginHorizontal:-s}:null,d],children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:x,horizontal:!0,showsHorizontalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",contentContainerStyle:I,onLayout:R,onContentSizeChange:f,children:a.map(e=>(0,_jsxRuntime.jsx)(FilterChipRowItem,{itemKey:e.key,label:e.label,count:e.count,disabled:e.disabled,testID:e.testID,selected:e.key===r,size:n,variant:l,tone:c,haptic:o,onSelect:j,onItemLayout:V},e.key))})})}FilterChipRowItem.displayName="FilterChipRowItem";const styles=_reactNative.StyleSheet.create({row:{alignItems:"center"}});var _default=exports.default=FilterChipRow;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FilterChipRow=FilterChipRow,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_index3=require("../Chip/index.js"),_jsxRuntime=require("react/jsx-runtime");const FilterChipRowItem=(0,_react.memo)(({itemKey:e,label:t,count:a,disabled:i,testID:r,selected:s,size:n,variant:l,tone:c,haptic:o,onSelect:u,onItemLayout:d})=>{const _=(0,_react.useCallback)(()=>u(e),[u,e]),h=(0,_react.useCallback)(t=>d(e,t.nativeEvent.layout),[d,e]);return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:h,collapsable:!1,children:(0,_jsxRuntime.jsx)(_index3.Chip,{label:t,count:a,selected:s,selectionMode:"radio",disabled:i,testID:r,size:n,variant:l,tone:c,haptic:!s&&o,onPress:_})})});function FilterChipRow({ref:e,...t}){const{items:a,value:i,onChange:r,bleed:s=0,size:n,variant:l="outline",tone:c,haptic:o,accessibilityLabel:u,style:d,contentContainerStyle:_,testID:h}=t;(0,_assertValidValue.assertValidValue)("FilterChipRow","size",t.size,["sm","md"]),(0,_assertValidValue.assertValidValue)("FilterChipRow","variant",t.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("FilterChipRow","tone",t.tone,["primary","success","warning","danger","info","neutral"]);const p=(0,_index2.useTheme)(),m=(0,_index.useReducedMotion)(),x=(0,_react.useRef)(null),v=(0,_react.useRef)({viewport:0,content:0,chips:{},revealed:null}),w=(0,_react.useRef)(i),C=(0,_react.useRef)(r);(0,_react.useEffect)(()=>{C.current=r},[r]);const b=(0,_react.useCallback)((e,t)=>{const a=v.current,i=a.chips[e];if(!i||0===a.viewport||0===a.content)return;const r=i.x+i.width/2-a.viewport/2,s=Math.min(Math.max(r,0),Math.max(a.content-a.viewport,0));x.current?.scrollTo({x:s,animated:t&&!m}),a.revealed=e},[m]),y=(0,_react.useCallback)(()=>{v.current.revealed!==w.current&&b(w.current,!1)},[b]);(0,_react.useEffect)(()=>{w.current=i,b(i,!0)},[i,b]);const R=(0,_react.useCallback)(e=>{v.current.viewport=e.nativeEvent.layout.width,y()},[y]),f=(0,_react.useCallback)(e=>{v.current.content=e,y()},[y]),V=(0,_react.useCallback)((e,t)=>{v.current.chips[e]={x:t.x,width:t.width},y()},[y]),j=(0,_react.useCallback)(e=>{e!==w.current?C.current(e):b(e,!0)},[b]),I=(0,_react.useMemo)(()=>[styles.row,{paddingHorizontal:s,columnGap:p.space.xs},_],[s,p.space.xs,_]);return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityRole:"radiogroup",accessibilityLabel:u,testID:h,style:[s>0?{marginHorizontal:-s}:null,d],children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:x,horizontal:!0,showsHorizontalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",contentContainerStyle:I,onLayout:R,onContentSizeChange:f,children:a.map(e=>(0,_jsxRuntime.jsx)(FilterChipRowItem,{itemKey:e.key,label:e.label,count:e.count,disabled:e.disabled,testID:e.testID,selected:e.key===i,size:n,variant:l,tone:c,haptic:o,onSelect:j,onItemLayout:V},e.key))})})}FilterChipRowItem.displayName="FilterChipRowItem";const styles=_reactNative.StyleSheet.create({row:{alignItems:"center"}});var _default=exports.default=FilterChipRow;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MODAL_DISMISS_GRACE_MS=void 0,exports.Modal=Modal,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../text/index.js"),_modalG=require("../../text/phone/modal.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_placement=require("../../utils/placement.js"),_squircle=require("../../utils/squircle.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");const MODAL_PRESENTATIONS=["centered","bottom","fullScreen","anchored"],MODAL_DISMISS_GRACE_MS=exports.MODAL_DISMISS_GRACE_MS=300,SCALE_START_VALUE=.9;function Modal({ref:e,...t}){(0,_assertValidValue.assertValidValue)("Modal","presentation",t.presentation,MODAL_PRESENTATIONS);const{open:r,onClose:a,presentation:i="centered",backdropOpacity:n,backdropPressClose:o=!0,animationDuration:s,animateMount:c=!0,accessibilityLabel:l,hardwareBackPress:u=!0,children:d,contentStyle:m,backdropStyle:_,restoreFocusRef:p,onDismissed:f,haptic:v,labels:h,anchor:g,placement:b="auto",align:S="center",testID:x,bare:A=!1,onInsetsChange:M}=t,D=(0,_index2.useTheme)(),y=(0,_index.useMobileUiText)("modal",_modalG.MODAL_TEXT),N=(0,_react.useMemo)(()=>({...y,...h}),[y,h]),R=(0,_usePresenceMotion.usePresenceMotion)(),[C,j]=(0,_ModalSafeArea.useModalInsets)();(0,_react.useEffect)(()=>{M?.(C)},[C,M]);const{width:V,height:T}=(0,_reactNative.useWindowDimensions)(),[q,w]=(0,_react.useState)({width:0,height:0}),E=s??R.duration("default"),I=T,L=(0,_react.useRef)(!c&&r),P=L.current,O=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?1:SCALE_START_VALUE)).current,k=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?1:0)).current,z=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?0:I)).current,F=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?1:0)).current,H=(0,_react.useRef)(null),W=(0,_react.useRef)(!1),[U,G]=(0,_react.useState)(r),B=(0,_react.useMemo)(()=>buildStyles(D),[D]),K=(0,_react.useMemo)(()=>{if("anchored"!==i||void 0===g)return null;const e={width:V,height:T,insets:{top:C.top,bottom:C.bottom,left:0,right:0}},t=(0,_placement.computePlacement)(g,q,e,b,{align:S});return{...t,maxHeight:(0,_placement.placementMaxHeight)(t.placement,(0,_placement.placementRoom)(g,e))}},[i,g,q,b,S,V,T,C.top,C.bottom]),X=(0,_react.useMemo)(()=>{const e=D.colors.scrim;return"number"!=typeof n?"anchored"===i?(0,_color.transparentOf)(e):e:(0,_color.withAlpha)(e,n)??e},[D.colors.scrim,n,i]),Y=(0,_react.useMemo)(()=>F.interpolate({inputRange:[0,1],outputRange:[(0,_color.transparentOf)(X),X]}),[F,X]);(0,_react.useEffect)(()=>{r&&(_reactNative.Keyboard.dismiss(),G(!0))},[r]),(0,_react.useEffect)(()=>{const e=[];if(r&&U&&L.current)L.current=!1;else if(r&&U){const t=_reactNative.Animated.timing(F,{toValue:1,duration:R.duration("default"),useNativeDriver:!1});if(t.start(),e.push(t),R.reduced||"anchored"===i){k.setValue(0),z.setValue(0),O.setValue(1);const t=_reactNative.Animated.timing(k,{toValue:1,duration:E,useNativeDriver:_nativeDriver.nativeDriver});t.start(),e.push(t)}else if("bottom"===i){k.setValue(1);const t=_reactNative.Animated.spring(z,{toValue:0,damping:D.motion.spring.gentle.damping,stiffness:D.motion.spring.gentle.stiffness,mass:D.motion.spring.gentle.mass,useNativeDriver:_nativeDriver.nativeDriver});t.start(),e.push(t)}else{const t=_reactNative.Animated.parallel([_reactNative.Animated.spring(O,{toValue:1,damping:D.motion.spring.gentle.damping,stiffness:D.motion.spring.gentle.stiffness,mass:D.motion.spring.gentle.mass,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(k,{toValue:1,duration:E,useNativeDriver:_nativeDriver.nativeDriver})]);t.start(),e.push(t)}}else if(U){const t=R.duration("fast"),r=_reactNative.Easing.bezier(...D.motion.ease.accelerate),a=_reactNative.Animated.timing(k,{toValue:0,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}),n=R.reduced||"anchored"===i?a:"bottom"===i?_reactNative.Animated.timing(z,{toValue:I,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}):_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:SCALE_START_VALUE,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}),a]),o=_reactNative.Animated.parallel([n,_reactNative.Animated.timing(F,{toValue:0,duration:R.duration("default"),useNativeDriver:!1})]);o.start(({finished:e})=>{e&&(z.setValue(I),G(!1))}),e.push(o)}return()=>e.forEach(e=>{e.stop()})},[r,U,i,E,O,k,F,z,I,D.motion.spring.gentle.damping,D.motion.spring.gentle.stiffness,D.motion.spring.gentle.mass,R,D.motion.ease.accelerate]),(0,_react.useEffect)(()=>{if("web"===_reactNative.Platform.OS)return;let e,t;return r?(e=setTimeout(()=>{H.current&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(H.current,"focus")},150),W.current=!0):W.current&&(W.current=!1,p?.current&&(t=setTimeout(()=>{const e=p.current;e&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(e,"focus")},E))),()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[r,E,p]);const $=(0,_react.useRef)(f);$.current=f;const J=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{if(r)return void(J.current=!0);if(!J.current)return;J.current=!1;const e=setTimeout(()=>$.current?.(),MODAL_DISMISS_GRACE_MS);return()=>clearTimeout(e)},[r]);const Q=(0,_react.useCallback)(()=>{if(!o)return;const e=(0,_hapticUtils.resolveHaptic)(v,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),a()},[o,a,v]),Z=(0,_react.useCallback)(()=>{u&&a()},[u,a]),ee=(0,_SquircleFill.useSquircle)(!A&&"bottom"!==i&&"fullScreen"!==i&&"anchored"!==i,D.radius.xl),te=(0,_react.useCallback)(e=>{ee.onLayout(e);const{width:t,height:r}=e.nativeEvent.layout;w(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[ee.onLayout]),re=(0,_react.useMemo)(()=>A?"bottom"===i?B.bottomContent:"fullScreen"===i?B.fullScreenContent:B.bareCentredContent:"anchored"===i?[B.anchoredContent,{left:K?.x,top:K?.y,maxHeight:K?.maxHeight,backgroundColor:D.colors.surface,borderRadius:D.radius.lg,..._corners.smoothCorners},D.shadow.modal]:"fullScreen"===i?[B.fullScreenContent,{backgroundColor:D.colors.surface}]:"bottom"===i?[B.bottomContent,{backgroundColor:D.colors.surface,borderTopLeftRadius:D.radius.xl,borderTopRightRadius:D.radius.xl,..._corners.smoothCorners,paddingTop:D.space.lg,paddingHorizontal:D.space.lg,paddingBottom:D.space.lg+C.bottom},D.shadow.modal]:[B.centeredContent,{backgroundColor:D.colors.surface,borderRadius:ee.active&&ee.size?(0,_squircle.squircleHostRadius)(ee.size.width,ee.size.height,D.radius.xl):D.radius.xl,..._corners.smoothCorners,padding:D.space.xl},D.shadow.modal],[i,D,B,C.bottom,ee.active,ee.size,K,A]),ae=(0,_react.useMemo)(()=>"anchored"===i?B.anchoredWrapper:"bottom"===i?B.bottomWrapper:"fullScreen"===i?B.fullScreenWrapper:B.centeredWrapper,[i,B]),ie=(0,_react.useMemo)(()=>"bottom"===i?{opacity:k,transform:[{translateY:z}]}:"fullScreen"===i||"anchored"===i?{opacity:k}:{opacity:k,transform:[{scale:O}]},[i,O,k,z]);if("anchored"===i&&void 0===g)throw new Error('[@webority/mobile-ui] Modal: presentation "anchored" needs an anchor.');if(A&&"anchored"===i)throw new Error('[@webority/mobile-ui] Modal: presentation "anchored" bare does not combine with presentation anchored.');return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:U,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:Z,testID:x,children:(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t=>{H.current=t,"function"==typeof e?e(t):e&&(e.current=t)},style:B.root,accessible:!1,accessibilityViewIsModal:!0,accessibilityRole:"alert",accessibilityLabel:l,children:(0,_jsxRuntime.jsxs)(_ModalSafeArea.ModalSafeArea,{onInsets:j,children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{collapsable:!1,style:[_reactNative.StyleSheet.absoluteFill,ae,{backgroundColor:Y},_],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:Q,accessibilityRole:o?"button":void 0,accessibilityLabel:o?N.close:void 0,accessible:!!o&&void 0,importantForAccessibility:o?void 0:"no",disabled:!o,testID:x?`${x}-backdrop`:void 0}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[re,ie,q.height>0||"anchored"!==i?null:B.unmeasured,m],onLayout:te,pointerEvents:A&&"fullScreen"===i?"box-none":"auto",needsOffscreenAlphaCompositing:!0,children:[ee.active&&ee.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ee.size.width,height:ee.size.height,radius:D.radius.xl,fill:D.colors.surface}):null,d]})]}),(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{flex:1},centeredWrapper:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},centeredContent:{maxWidth:"90%",width:"90%"},bottomWrapper:{flex:1,justifyContent:"flex-end"},bottomContent:{width:"100%"},fullScreenWrapper:{flex:1},fullScreenContent:{flex:1},anchoredWrapper:{flex:1},anchoredContent:{position:"absolute"},unmeasured:{opacity:0},bareCentredContent:{alignSelf:"center"}});var _default=exports.default=Modal;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MODAL_DISMISS_GRACE_MS=void 0,exports.Modal=Modal,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../text/index.js"),_modalG=require("../../text/phone/modal.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_placement=require("../../utils/placement.js"),_squircle=require("../../utils/squircle.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");const MODAL_PRESENTATIONS=["centered","bottom","fullScreen","anchored"],MODAL_DISMISS_GRACE_MS=exports.MODAL_DISMISS_GRACE_MS=300,SCALE_START_VALUE=.9;function Modal({ref:e,...t}){(0,_assertValidValue.assertValidValue)("Modal","presentation",t.presentation,MODAL_PRESENTATIONS);const{open:r,onClose:a,presentation:i="centered",backdropOpacity:n,backdropPressClose:o=!0,animationDuration:s,animateMount:c=!0,accessibilityLabel:l,hardwareBackPress:u=!0,children:d,contentStyle:m,backdropStyle:_,restoreFocusRef:p,onDismissed:f,haptic:v,labels:h,anchor:g,placement:b="auto",align:S="center",testID:x,bare:A=!1,onInsetsChange:M}=t,D=(0,_index2.useTheme)(),y=(0,_index.useMobileUiText)("modal",_modalG.MODAL_TEXT),N=(0,_react.useMemo)(()=>({...y,...h}),[y,h]),R=(0,_usePresenceMotion.usePresenceMotion)(),[C,j]=(0,_ModalSafeArea.useModalInsets)();(0,_react.useEffect)(()=>{M?.(C)},[C,M]);const{width:V,height:T}=(0,_reactNative.useWindowDimensions)(),[q,w]=(0,_react.useState)({width:0,height:0}),E=s??R.duration("default"),I=T,L=(0,_react.useRef)(!c&&r),P=L.current,O=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?1:SCALE_START_VALUE)).current,k=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?1:0)).current,W=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?0:I)).current,z=(0,_react.useRef)((0,_index2.createAnimatedValue)(P?1:0)).current,F=(0,_react.useRef)(null),H=(0,_react.useRef)(!1),[U,G]=(0,_react.useState)(r),B=(0,_react.useMemo)(()=>buildStyles(D),[D]),K=(0,_react.useMemo)(()=>{if("anchored"!==i||void 0===g)return null;const e={width:V,height:T,insets:{top:C.top,bottom:C.bottom,left:0,right:0}},t=(0,_placement.computePlacement)(g,q,e,b,{align:S});return{...t,maxHeight:(0,_placement.placementMaxHeight)(t.placement,(0,_placement.placementRoom)(g,e))}},[i,g,q,b,S,V,T,C.top,C.bottom]),X=(0,_react.useMemo)(()=>{const e=D.colors.scrim;return"number"!=typeof n?"anchored"===i?(0,_color.transparentOf)(e):e:(0,_color.withAlpha)(e,n)??e},[D.colors.scrim,n,i]),Y=(0,_react.useMemo)(()=>z.interpolate({inputRange:[0,1],outputRange:[(0,_color.transparentOf)(X),X]}),[z,X]);(0,_react.useEffect)(()=>{r&&(_reactNative.Keyboard.dismiss(),G(!0))},[r]),(0,_react.useEffect)(()=>{const e=[];if(r&&U&&L.current)L.current=!1;else if(r&&U){const t=_reactNative.Animated.timing(z,{toValue:1,duration:R.duration("default"),useNativeDriver:!1});if(t.start(),e.push(t),R.reduced||"anchored"===i){k.setValue(0),W.setValue(0),O.setValue(1);const t=_reactNative.Animated.timing(k,{toValue:1,duration:E,useNativeDriver:_nativeDriver.nativeDriver});t.start(),e.push(t)}else if("bottom"===i){k.setValue(1);const t=_reactNative.Animated.spring(W,{toValue:0,damping:D.motion.spring.gentle.damping,stiffness:D.motion.spring.gentle.stiffness,mass:D.motion.spring.gentle.mass,useNativeDriver:_nativeDriver.nativeDriver});t.start(),e.push(t)}else{const t=_reactNative.Animated.parallel([_reactNative.Animated.spring(O,{toValue:1,damping:D.motion.spring.gentle.damping,stiffness:D.motion.spring.gentle.stiffness,mass:D.motion.spring.gentle.mass,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(k,{toValue:1,duration:E,useNativeDriver:_nativeDriver.nativeDriver})]);t.start(),e.push(t)}}else if(U){const t=R.duration("fast"),r=_reactNative.Easing.bezier(...D.motion.ease.accelerate),a=_reactNative.Animated.timing(k,{toValue:0,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}),n=R.reduced||"anchored"===i?a:"bottom"===i?_reactNative.Animated.timing(W,{toValue:I,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}):_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:SCALE_START_VALUE,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}),a]),o=_reactNative.Animated.parallel([n,_reactNative.Animated.timing(z,{toValue:0,duration:R.duration("default"),useNativeDriver:!1})]);o.start(({finished:e})=>{e&&(W.setValue(I),G(!1))}),e.push(o)}return()=>e.forEach(e=>{e.stop()})},[r,U,i,E,O,k,z,W,I,D.motion.spring.gentle.damping,D.motion.spring.gentle.stiffness,D.motion.spring.gentle.mass,R,D.motion.ease.accelerate]),(0,_react.useEffect)(()=>{if("web"===_reactNative.Platform.OS)return;let e,t;return r?(e=setTimeout(()=>{F.current&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(F.current,"focus")},150),H.current=!0):H.current&&(H.current=!1,p?.current&&(t=setTimeout(()=>{const e=p.current;e&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(e,"focus")},E))),()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[r,E,p]);const $=(0,_react.useRef)(f);$.current=f;const J=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{if(r)return void(J.current=!0);if(!J.current)return;J.current=!1;const e=setTimeout(()=>$.current?.(),MODAL_DISMISS_GRACE_MS);return()=>clearTimeout(e)},[r]);const Q=(0,_react.useCallback)(()=>{if(!o)return;const e=(0,_hapticUtils.resolveHaptic)(v,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),a()},[o,a,v]),Z=(0,_react.useCallback)(()=>{u&&a()},[u,a]),ee=(0,_SquircleFill.useSquircle)(!A&&"bottom"!==i&&"fullScreen"!==i&&"anchored"!==i,D.radius.xl),te=(0,_react.useCallback)(e=>{ee.onLayout(e);const{width:t,height:r}=e.nativeEvent.layout;w(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[ee.onLayout]),re=(0,_react.useMemo)(()=>A?"bottom"===i?B.bottomContent:"fullScreen"===i?B.fullScreenContent:B.bareCentredContent:"anchored"===i?[B.anchoredContent,{left:K?.x,top:K?.y,maxHeight:K?.maxHeight,backgroundColor:D.colors.surface,borderRadius:D.radius.lg,..._corners.smoothCorners},D.shadow.modal]:"fullScreen"===i?[B.fullScreenContent,{backgroundColor:D.colors.surface}]:"bottom"===i?[B.bottomContent,{backgroundColor:D.colors.surface,borderTopLeftRadius:D.radius.xl,borderTopRightRadius:D.radius.xl,..._corners.smoothCorners,paddingTop:D.space.lg,paddingHorizontal:D.space.lg,paddingBottom:D.space.lg+C.bottom},D.shadow.modal]:[B.centeredContent,{backgroundColor:D.colors.surface,borderRadius:ee.active&&ee.size?(0,_squircle.squircleHostRadius)(ee.size.width,ee.size.height,D.radius.xl):D.radius.xl,..._corners.smoothCorners,padding:D.space.xl},D.shadow.modal],[i,D,B,C.bottom,ee.active,ee.size,K,A]),ae=(0,_react.useMemo)(()=>"anchored"===i?B.anchoredWrapper:"bottom"===i?B.bottomWrapper:"fullScreen"===i?B.fullScreenWrapper:B.centeredWrapper,[i,B]),ie=(0,_react.useMemo)(()=>"bottom"===i?{opacity:k,transform:[{translateY:W}]}:"fullScreen"===i||"anchored"===i?{opacity:k}:{opacity:k,transform:[{scale:O}]},[i,O,k,W]);if("anchored"===i&&void 0===g)throw new Error('[@webority/mobile-ui] Modal: presentation "anchored" needs an anchor.');if(A&&"anchored"===i)throw new Error('[@webority/mobile-ui] Modal: presentation "anchored" bare does not combine with presentation anchored.');return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:U,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:Z,testID:x,children:(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t=>{F.current=t,"function"==typeof e?e(t):e&&(e.current=t)},style:B.root,accessible:!1,accessibilityViewIsModal:!0,accessibilityRole:"alert",accessibilityLabel:l,children:(0,_jsxRuntime.jsxs)(_ModalSafeArea.ModalSafeArea,{onInsets:j,children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{collapsable:!1,style:[_reactNative.StyleSheet.absoluteFill,ae,{backgroundColor:Y},_],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:Q,accessibilityRole:o?"button":void 0,accessibilityLabel:o?N.close:void 0,accessible:!!o&&void 0,importantForAccessibility:o?void 0:"no",disabled:!o,testID:x?`${x}-backdrop`:void 0}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[re,ie,q.height>0||"anchored"!==i?null:B.unmeasured,m],onLayout:te,pointerEvents:A&&"fullScreen"===i?"box-none":"auto",needsOffscreenAlphaCompositing:!0,children:[ee.active&&ee.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ee.size.width,height:ee.size.height,radius:D.radius.xl,fill:D.colors.surface,hostBorderWidth:0}):null,d]})]}),(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{flex:1},centeredWrapper:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},centeredContent:{maxWidth:"90%",width:"90%"},bottomWrapper:{flex:1,justifyContent:"flex-end"},bottomContent:{width:"100%"},fullScreenWrapper:{flex:1},fullScreenContent:{flex:1},anchoredWrapper:{flex:1},anchoredContent:{position:"absolute"},unmeasured:{opacity:0},bareCentredContent:{alignSelf:"center"}});var _default=exports.default=Modal;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PickerTrigger=PickerTrigger,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../text/index.js"),_pickerTriggerG=require("../../text/phone/pickerTrigger.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_index3=require("../FieldBase/index.js"),_Chevron=require("../FieldBase/Chevron.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function PickerTrigger(e){(0,_assertValidValue.assertValidValue)("PickerTrigger","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("PickerTrigger","variant",e.variant,["outline","filled","underline"]);const{value:i,placeholder:r,label:t,help:l,helperText:s,error:a,required:n=!1,onPress:d,clearable:o=!1,onClear:c,leftIcon:x,trailing:u,disabled:_=!1,size:g="md",variant:b,style:j,triggerStyle:v,valueStyle:y,labelStyle:h,messageStyle:T,accessibilityLabel:m,labels:p,testID:R}=e,S=(0,_index.useMobileUiText)("pickerTrigger",_pickerTriggerG.PICKER_TRIGGER_TEXT),f=(0,_react.useMemo)(()=>({...S,...p}),[S,p]),P=(0,_index2.useTheme)(),V=(0,_react.useMemo)(()=>buildStyles(P),[P]),q=(0,_index2.resolveFieldSize)(P,g),F=(0,_index3.resolveFieldTextStyle)(P,{disabled:_}),k="string"==typeof i&&i.length>0,z=!0===a||(0,_index3.hasFieldText)(a),w=(0,_index3.hasFieldText)(t),C=k?i:r??f.placeholder,I=k?F.color:F.placeholderColor,M=k?`${(0,_index3.fieldTextAsString)(t)??f.selection}: ${i}`:r??f.noSelection,L=m??M,G={disabled:_},N=void 0===u,B=o&&k&&!_;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.root,j],testID:R,children:[w?(0,_jsxRuntime.jsx)(_index3.FieldLabel,{size:g,required:n,help:l,style:h,children:t}):null,(0,_jsxRuntime.jsx)(_index3.FieldBase,{size:g,variant:b,disabled:_,error:z,filled:k,onPress:d,leading:x,trailing:B||N||null!==u?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:V.trailingRow,children:[B?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",onPress:()=>{_||c?.()},accessibilityRole:"button",accessibilityLabel:f.clear,style:{fontSize:q.icon,color:P.colors["text-muted"],paddingHorizontal:P.space.xs},children:"×"}):null,void 0!==u?u:N?(0,_jsxRuntime.jsx)(_Chevron.Chevron,{size:q.icon,color:_?P.colors["text-disabled"]:P.colors["text-subtle"]}):null]}):null,accessibilityLabel:L,accessibilityState:G,accessibilityRole:"button",style:v,children:(0,_jsxRuntime.jsxs)(_index4.Text,{variant:"body",numberOfLines:1,style:[V.valueText,{color:I,fontSize:q.text,...F.weightStyle},y],children:[C,k||!n||w?null:(0,_jsxRuntime.jsx)(_index3.RequiredMark,{})]})}),(0,_jsxRuntime.jsx)(_index3.FieldMessage,{size:g,error:z,text:z?a:s,style:T})]})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},label:{includeFontPadding:!1},valueText:{flex:1,includeFontPadding:!1},message:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center"}});var _default=exports.default=PickerTrigger;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PickerTrigger=PickerTrigger,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../text/index.js"),_pickerTriggerG=require("../../text/phone/pickerTrigger.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_index3=require("../FieldBase/index.js"),_Chevron=require("../FieldBase/Chevron.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function PickerTrigger({ref:e,...i}){(0,_assertValidValue.assertValidValue)("PickerTrigger","size",i.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("PickerTrigger","variant",i.variant,["outline","filled","underline"]);const{value:r,placeholder:t,label:l,help:s,helperText:a,error:n,required:d=!1,onPress:o,clearable:c=!1,onClear:x,leftIcon:u,trailing:_,disabled:g=!1,size:b="md",variant:j,style:v,triggerStyle:y,valueStyle:h,labelStyle:T,messageStyle:m,accessibilityLabel:p,labels:R,testID:f}=i,S=(0,_index.useMobileUiText)("pickerTrigger",_pickerTriggerG.PICKER_TRIGGER_TEXT),P=(0,_react.useMemo)(()=>({...S,...R}),[S,R]),V=(0,_index2.useTheme)(),q=(0,_react.useMemo)(()=>buildStyles(V),[V]),F=(0,_index2.resolveFieldSize)(V,b),k=(0,_index3.resolveFieldTextStyle)(V,{disabled:g}),z="string"==typeof r&&r.length>0,w=!0===n||(0,_index3.hasFieldText)(n),C=(0,_index3.hasFieldText)(l),I=z?r:t??P.placeholder,M=z?k.color:k.placeholderColor,L=z?`${(0,_index3.fieldTextAsString)(l)??P.selection}: ${r}`:t??P.noSelection,G=p??L,N={disabled:g},B=void 0===_,D=c&&z&&!g;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:e,style:[q.root,v],testID:f,children:[C?(0,_jsxRuntime.jsx)(_index3.FieldLabel,{size:b,required:d,help:s,style:T,children:l}):null,(0,_jsxRuntime.jsx)(_index3.FieldBase,{size:b,variant:j,disabled:g,error:w,filled:z,onPress:o,leading:u,trailing:D||B||null!==_?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:q.trailingRow,children:[D?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",onPress:()=>{g||x?.()},accessibilityRole:"button",accessibilityLabel:P.clear,style:{fontSize:F.icon,color:V.colors["text-muted"],paddingHorizontal:V.space.xs},children:"×"}):null,void 0!==_?_:B?(0,_jsxRuntime.jsx)(_Chevron.Chevron,{size:F.icon,color:g?V.colors["text-disabled"]:V.colors["text-subtle"]}):null]}):null,accessibilityLabel:G,accessibilityState:N,accessibilityRole:"button",style:y,children:(0,_jsxRuntime.jsxs)(_index4.Text,{variant:"body",numberOfLines:1,style:[q.valueText,{color:M,fontSize:F.text,...k.weightStyle},h],children:[I,z||!d||C?null:(0,_jsxRuntime.jsx)(_index3.RequiredMark,{})]})}),(0,_jsxRuntime.jsx)(_index3.FieldMessage,{size:b,error:w,text:w?n:a,style:m})]})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},label:{includeFontPadding:!1},valueText:{flex:1,includeFontPadding:!1},message:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center"}});var _default=exports.default=PickerTrigger;
@@ -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"),_contentPadding=require("../../utils/contentPadding.js"),_index2=require("../AppBar/index.js"),_index3=require("../KeyboardAwareScrollView/index.js"),_index4=require("../KeyboardToolbar/index.js"),_index5=require("../PagedList/index.js"),_ScrollHost=require("./ScrollHost.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{},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:o,largeTitle:r=!0,headerShadowOnScroll:n,onBack:a,rightActions:i,leading:l,trailing:s,children:c,onRefresh:d,refreshing:u=!1,footer:f,scroll:_=!0,list:g,edges:v=DEFAULT_EDGES,keyboardToolbar:h=!0,bottomInset:p=0,gutter:x,floatingAction:m,scrollRef:S,onScroll:b,contentContainerStyle:R,testID:y}=e,C=(0,_index.useTheme)(),j=x??void 0===g,T=C.space[C.components.screen.gutter],E=j?T:0,N=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),L=(0,_react.useMemo)(()=>buildStyles(C),[C]),[O]=(0,_react.useState)(()=>new _reactNative.Animated.Value(0)),[V,k]=(0,_react.useState)(0),[w,A]=(0,_react.useState)(0),q=void 0!==a,P=(0,_react.useRef)(a);P.current=a;const B=Boolean(t||o||a||l||s||i?.length),H=r&&void 0!==t,D=H&&(void 0!==g||_),M=D?V:0,z=B&&!D&&(n??C.settings.components.screen?.headerShadowOnScroll??!0),[I,K]=(0,_react.useState)(!1),F=(0,_react.useRef)(z);F.current=z;const headerGap=e=>e>0?e:B?C.space.lg:0,W=void 0!==f,{refreshControl:G}=(0,_useRefreshControl.useRefreshControl)({onRefresh:d??noop,refreshing:u}),U=d?(0,_react.cloneElement)(G,{progressViewOffset:M}):void 0,Y=(0,_reactNativeReanimated.useSharedValue)(0),$=(0,_reactNativeReanimated.useSharedValue)(0),J=(0,_reactNativeReanimated.useSharedValue)(0),Q=(0,_reactNativeReanimated.useSharedValue)(0),X=(0,_react.useRef)(null),Z=(0,_react.useRef)(0),ee=(0,_react.useRef)(0),te=(0,_react.useMemo)(()=>({top:Y,bottom:$,offset:J,maxOffset:Q,scrollTo:e=>{const t=X.current;t instanceof _reactNative.FlatList?t.scrollToOffset({offset:e,animated:!1}):t?.scrollTo({y:e,animated:!1})}}),[Y,$,J,Q]),oe=(0,_react.useCallback)(e=>{X.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]),re=(0,_react.useCallback)(()=>{Q.value=Math.max(0,Z.current-ee.current)},[Q]),ne=(0,_react.useRef)(b);ne.current=b;const ae=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{y:O}}}],{useNativeDriver:!1,listener:e=>{if(J.value=e.nativeEvent.contentOffset.y,F.current){const t=e.nativeEvent.contentOffset.y>0;K(e=>e===t?e:t)}ne.current?.(e)}}),[O,J]),ie=(0,_react.useCallback)(e=>{const{height:t}=e.nativeEvent.layout;k(e=>Math.max(e,t))},[]),le=(0,_react.useCallback)(e=>{A(e.nativeEvent.layout.height)},[]);(0,_react.useEffect)(()=>{if(!q)return;const e=_reactNative.BackHandler.addEventListener("hardwareBackPress",()=>(P.current?.(),!0));return()=>e.remove()},[q]);const se=v.includes("left")?N.left:0,ce=v.includes("right")?N.right:0,de=v.includes("bottom")?N.bottom:0,ue=v.includes("top")&&!B?N.top:0,fe=C.space[C.components["floating-action-button"]["bottom-offset"]],ge=m?.props.bottomOffset??fe,ve=m?(0,_index.resolveFloatingActionButtonSize)(C,m.props.size??"md").diameter+ge+C.space.lg:0,he=W?Math.max(0,w-N.bottom):p,pe=m?(0,_react.cloneElement)(m,{bottomOffset:ge+he,position:m.props.position??"bottomRight"}):null,xe=W?ve:Math.max(de,m?ve+N.bottom:0),me=p+xe-(W?0:de),Se=v.filter(e=>"top"!==e&&!("bottom"===e&&W)),be=B?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D?L.overlay:z?L.headerRaised:void 0,onLayout:D?ie:void 0,children:(0,_jsxRuntime.jsx)(_index2.AppBar,{title:t,subtitle:o,variant:H?"large":"default",scrollY:D?O:void 0,elevated:z&&I,onBack:a,rightActions:i,leading:l,trailing:s,gutter:T,testID:y?`${y}-app-bar`:void 0})}):null,Re=(0,_react.useCallback)(()=>{const e=X.current?.getNativeScrollRef();e&&e.measureInWindow((e,t,o,r)=>{ee.current=r,Y.value=t+M,$.value=t+r,re()})},[M,Y,$,re]);(0,_react.useEffect)(()=>{Re()},[Re]);const ye=(0,_react.useCallback)((e,t)=>{Z.current=t,re()},[re]);let Ce;if(void 0!==g){const e=(0,_contentPadding.topPaddingOf)([g.contentContainerStyle,R]);Ce=(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext,{value:te,children:(0,_jsxRuntime.jsx)(_index5.PagedList,{...g,ref:oe,onRefresh:g.state?void 0:d,refreshing:g.state?void 0:u,progressViewOffset:M,placeholderStyle:[L.flex,{paddingTop:M+headerGap(e)}],onScroll:ae,onLayout:e=>{Re(),g.onLayout?.(e)},onContentSizeChange:(e,t)=>{ye(e,t),g.onContentSizeChange?.(e,t)},scrollEventThrottle:SCROLL_EVENT_THROTTLE,style:L.flex,contentContainerStyle:[{paddingTop:M,paddingLeft:se+E,paddingRight:ce+E},g.contentContainerStyle,R,{paddingTop:M+headerGap(e),paddingBottom:(0,_contentPadding.bottomPaddingOf)([g.contentContainerStyle,R])+p+xe}]})})}else Ce=_?(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext,{value:te,children:(0,_jsxRuntime.jsxs)(_index3.KeyboardAwareScrollView,{ref:oe,refreshControl:U,onScroll:ae,scrollEventThrottle:SCROLL_EVENT_THROTTLE,onLayout:Re,onContentSizeChange:ye,safeAreaEdges:Se,style:L.flex,contentContainerStyle:[{paddingHorizontal:E},R,{paddingTop:M+headerGap((0,_contentPadding.topPaddingOf)(R))}],children:[c,me>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:me}}):null]})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[L.flex,{paddingLeft:se+E,paddingRight:ce+E},R,{paddingBottom:(0,_contentPadding.bottomPaddingOf)(R)+p+xe}],children:c});const je=W?(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardStickyView,{onLayout:le,style:[L.footer,{paddingLeft:se+T,paddingRight:ce+T,paddingBottom:de+p}],children:f}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:y,style:[L.root,{paddingTop:ue}],children:[D?null:be,Ce,je,pe,void 0!==g?c:null,D?be:null,h?(0,_jsxRuntime.jsx)(_index4.KeyboardToolbar,{}):null]})}
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"),_contentPadding=require("../../utils/contentPadding.js"),_index2=require("../AppBar/index.js"),_index3=require("../KeyboardAwareScrollView/index.js"),_index4=require("../KeyboardToolbar/index.js"),_index5=require("../PagedList/index.js"),_ScrollHost=require("./ScrollHost.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{},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:o,largeTitle:r=!0,headerShadowOnScroll:n,onBack:a,rightActions:i,leading:s,trailing:l,children:c,onRefresh:d,refreshing:u=!1,footer:f,scroll:_=!0,list:g,edges:v=DEFAULT_EDGES,keyboardToolbar:h=!0,footerHugsKeyboard:p=!1,bottomInset:x=0,gutter:m,floatingAction:S,scrollRef:b,onScroll:y,contentContainerStyle:R,testID:C}=e,j=(0,_index.useTheme)(),T=m??void 0===g,E=j.space[j.components.screen.gutter],N=T?E:0,L=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),O=(0,_react.useMemo)(()=>buildStyles(j),[j]),[V]=(0,_react.useState)(()=>new _reactNative.Animated.Value(0)),[k,w]=(0,_react.useState)(0),[A,q]=(0,_react.useState)(0),P=void 0!==a,H=(0,_react.useRef)(a);H.current=a;const B=Boolean(t||o||a||s||l||i?.length),D=r&&void 0!==t,K=D&&(void 0!==g||_),M=K?k:0,z=B&&!K&&(n??j.settings.components.screen?.headerShadowOnScroll??!0),[I,F]=(0,_react.useState)(!1),W=(0,_react.useRef)(z);W.current=z;const headerGap=e=>e>0?e:B?j.space.lg:0,G=void 0!==f,{refreshControl:U}=(0,_useRefreshControl.useRefreshControl)({onRefresh:d??noop,refreshing:u}),Y=d?(0,_react.cloneElement)(U,{progressViewOffset:M}):void 0,$=(0,_reactNativeReanimated.useSharedValue)(0),J=(0,_reactNativeReanimated.useSharedValue)(0),Q=(0,_reactNativeReanimated.useSharedValue)(0),X=(0,_reactNativeReanimated.useSharedValue)(0),Z=(0,_react.useRef)(null),ee=(0,_react.useRef)(0),te=(0,_react.useRef)(0),oe=(0,_react.useMemo)(()=>({top:$,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})}}),[$,J,Q,X]),re=(0,_react.useCallback)(e=>{Z.current=e,"function"==typeof b?b(e):b&&(b.current=e)},[b]),ne=(0,_react.useCallback)(()=>{X.value=Math.max(0,ee.current-te.current)},[X]),ae=(0,_react.useRef)(y);ae.current=y;const ie=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{y:V}}}],{useNativeDriver:!1,listener:e=>{if(Q.value=e.nativeEvent.contentOffset.y,W.current){const t=e.nativeEvent.contentOffset.y>0;F(e=>e===t?e:t)}ae.current?.(e)}}),[V,Q]),se=(0,_react.useCallback)(e=>{const{height:t}=e.nativeEvent.layout;w(e=>Math.max(e,t))},[]),le=(0,_react.useCallback)(e=>{q(e.nativeEvent.layout.height)},[]);(0,_react.useEffect)(()=>{if(!P)return;const e=_reactNative.BackHandler.addEventListener("hardwareBackPress",()=>(H.current?.(),!0));return()=>e.remove()},[P]);const ce=v.includes("left")?L.left:0,de=v.includes("right")?L.right:0,ue=v.includes("bottom")?L.bottom:0,fe=v.includes("top")&&!B?L.top:0,ge=j.space[j.components["floating-action-button"]["bottom-offset"]],ve=S?.props.bottomOffset??ge,he=S?(0,_index.resolveFloatingActionButtonSize)(j,S.props.size??"md").diameter+ve+j.space.lg:0,pe=G?Math.max(0,A-L.bottom):x,xe=S?(0,_react.cloneElement)(S,{bottomOffset:ve+pe,position:S.props.position??"bottomRight"}):null,me=G?he:Math.max(ue,S?he+L.bottom:0),Se=x+me-(G?0:ue),be=v.filter(e=>"top"!==e&&!("bottom"===e&&G)),ye=B?(0,_jsxRuntime.jsx)(_reactNative.View,{style:K?O.overlay:z?O.headerRaised:void 0,onLayout:K?se:void 0,children:(0,_jsxRuntime.jsx)(_index2.AppBar,{title:t,subtitle:o,variant:D?"large":"default",scrollY:K?V:void 0,elevated:z&&I,onBack:a,rightActions:i,leading:s,trailing:l,gutter:E,testID:C?`${C}-app-bar`:void 0})}):null,Re=(0,_react.useCallback)(()=>{const e=Z.current?.getNativeScrollRef();e&&e.measureInWindow((e,t,o,r)=>{te.current=r,$.value=t+M,J.value=t+r,ne()})},[M,$,J,ne]);(0,_react.useEffect)(()=>{Re()},[Re]);const Ce=(0,_react.useCallback)((e,t)=>{ee.current=t,ne()},[ne]);let je;if(void 0!==g){const e=(0,_contentPadding.topPaddingOf)([g.contentContainerStyle,R]);je=(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext,{value:oe,children:(0,_jsxRuntime.jsx)(_index5.PagedList,{...g,ref:re,onRefresh:g.state?void 0:d,refreshing:g.state?void 0:u,progressViewOffset:M,placeholderStyle:[O.flex,{paddingTop:M+headerGap(e)}],onScroll:ie,onLayout:e=>{Re(),g.onLayout?.(e)},onContentSizeChange:(e,t)=>{Ce(e,t),g.onContentSizeChange?.(e,t)},scrollEventThrottle:SCROLL_EVENT_THROTTLE,style:O.flex,contentContainerStyle:[{paddingTop:M,paddingLeft:ce+N,paddingRight:de+N},g.contentContainerStyle,R,{paddingTop:M+headerGap(e),paddingBottom:(0,_contentPadding.bottomPaddingOf)([g.contentContainerStyle,R])+x+me}]})})}else je=_?(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext,{value:oe,children:(0,_jsxRuntime.jsxs)(_index3.KeyboardAwareScrollView,{ref:re,refreshControl:Y,onScroll:ie,scrollEventThrottle:SCROLL_EVENT_THROTTLE,onLayout:Re,onContentSizeChange:Ce,safeAreaEdges:be,style:O.flex,contentContainerStyle:[{paddingHorizontal:N},R,{paddingTop:M+headerGap((0,_contentPadding.topPaddingOf)(R))}],children:[c,Se>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:Se}}):null]})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[O.flex,{paddingLeft:ce+N,paddingRight:de+N},R,{paddingBottom:(0,_contentPadding.bottomPaddingOf)(R)+x+me}],children:c});const Te=G?(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardStickyView,{onLayout:le,offset:{opened:p?ue+x:0},style:[O.footer,{paddingLeft:ce+E,paddingRight:de+E,paddingBottom:ue+x}],children:f}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:C,style:[O.root,{paddingTop:fe}],children:[K?null:ye,je,Te,xe,void 0!==g?c:null,K?ye:null,h?(0,_jsxRuntime.jsx)(_index4.KeyboardToolbar,{}):null]})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentedControl=SegmentedControl,exports.default=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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.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"];case"info":return e.colors["info-text"]}};function SegmentedControl({ref:e,...t}){const{segments:i,label:r,helperText:s,error:n,value:l,defaultValue:a,onChange:o,size:c="md",fullWidth:d=!0,disabled:u=!1,tone:m="primary",variant:x="segmented",radius:h,labelLines:g=1,haptic:_,accessibilityLabel:b,style:v,segmentStyle:p,selectedIndicatorStyle:f,textStyle:y,labelStyle:S,testID:j}=t;(0,_assertValidValue.assertValidValue)("SegmentedControl","size",t.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("SegmentedControl","tone",t.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("SegmentedControl","variant",t.variant,["underline","pills","segmented"]);const[w]=i;if(void 0===w)throw new Error("SegmentedControl needs at least one segment");const[V,C]=(0,_index.useControllableState)({value:l,defaultValue:a??w.value,onChange:e=>{null!==e&&o?.(e)}}),I=(0,_index2.useTheme)(),R=I.components["segmented-control"],q=(0,_react.useMemo)(()=>buildStyles(I),[I]),L=(0,_react.useMemo)(()=>(0,_index2.resolveSegmentedControlSize)(I,c),[I,c]),k=g>=2?2:1,F=k>1,N="segmented"===x,z="underline"===x,E="pills"===x,M=N?I.space[R["track-padding"]]:0,T=Math.ceil(L.text*LABEL_LINE_HEIGHT_RATIO)*(k-1),A=R["underline-height"],D=I.space[R["pill-inset"]],H="number"==typeof h?h:h?I.radius[h]:void 0,B=H??I.radius.md,W=void 0===H?I.radius.sm:Math.max(H-M,0),O=H??I.radius.pill,P=H??I.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===V)),Q=G[K],U=Q?.x,Y=(0,_react.useCallback)(e=>{const t=I.motion.spring.snappy,i=_reactNative.Animated.spring(J,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:_nativeDriver.nativeDriver});return i.start(),i},[I.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 s=t[e];if(s&&s.x===i&&s.width===r)return t;const n=t.slice();return n[e]={x:i,width:r},n})},[]),ee=(0,_react.useCallback)(e=>{if(u)return;if(e.value===V)return;const t=(0,_index3.resolveHaptic)(_,"selection");t&&(0,_index3.triggerHaptic)(t),C(e.value)},[u,C,V,_]),te=N?I.colors.thumb:E?I.colors["primary-soft"]:I.colors.primary,ie=N?W:E?O:P,re=activeInkFor(I,m),se=I.colors["bg-muted"],ne=(0,_SquircleFill.useSquircle)(N,B),le=!0===n||(0,_index4.hasFieldText)(n),ae=le&&!u,oe=I.colors["field-border-error"],ce=I.size.border,de=(0,_index4.hasFieldText)(r),ue=le?n:s,me=(0,_index4.hasFieldText)(ue),xe=b??("string"==typeof r?r:void 0),he=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:e,accessibilityRole:"radiogroup",accessibilityLabel:xe,testID:j,style:[q.track,{...F?{minHeight:L.height+T}:{height:L.height},opacity:u?.55:1,alignSelf:d?"stretch":"flex-start"},N?{borderRadius:B,..._corners.smoothCorners,backgroundColor:ne.active?"transparent":se,padding:M}:z?{borderBottomColor:ae?oe:I.colors["border-subtle"],borderBottomWidth:_reactNative.StyleSheet.hairlineWidth}:null,v],onLayout:ne.onLayout,children:[ne.active&&ne.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ne.size.width,height:ne.size.height,radius:B,fill:se,stroke:ae?oe:void 0,strokeWidth:ce}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:q.row,children:[Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[q.thumb,N?F?{top:0,bottom:0}:{top:0,height:L.height-2*M}:E?{top:D,bottom:D,left:D}:{bottom:0,height:A},{width:E?Math.max(Q.width-2*D,0):Q.width,borderRadius:ie,..._corners.smoothCorners,backgroundColor:te,transform:[{translateX:J}]},f]}):null,i.map((e,t)=>{const i=e.value===V,r=i?re:I.colors["text-subtle"],s=(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:L.icon,selected:i,disabled:u}),n=Boolean(s);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,F?q.segmentMultiline:null,{paddingHorizontal:L["padding-x"],opacity:e&&!i?.7:1},p],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:q.segmentIcon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:s}):null,(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:i?"semibold":"medium",style:[q.segmentLabel,F?q.segmentLabelMultiline:null,{color:r,fontSize:L.text},y,S],numberOfLines:k,children:e.label})]},String(e.value))})]}),!ae||z||ne.active?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{borderWidth:ce,borderColor:oe,borderRadius:N?B:O,..._corners.smoothCorners}]})]});return de||me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{alignSelf:d?"stretch":"flex-start"},children:[de?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:c,children:r}):null,he,me?(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:c,text:ue,error:le}):null]}):he}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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentedControl=SegmentedControl,exports.default=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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.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"];case"info":return e.colors["info-text"]}};function SegmentedControl({ref:e,...t}){const{segments:i,label:r,helperText:s,error:n,value:l,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:v,segmentStyle:p,selectedIndicatorStyle:f,textStyle:y,labelStyle:S,testID:j}=t;(0,_assertValidValue.assertValidValue)("SegmentedControl","size",t.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("SegmentedControl","tone",t.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("SegmentedControl","variant",t.variant,["underline","pills","segmented"]);const[w]=i;if(void 0===w)throw new Error("SegmentedControl needs at least one segment");const[V,C]=(0,_index.useControllableState)({value:l,defaultValue:a??w.value,onChange:e=>{null!==e&&o?.(e)}}),I=(0,_index2.useTheme)(),R=I.components["segmented-control"],q=(0,_react.useMemo)(()=>buildStyles(I),[I]),L=(0,_react.useMemo)(()=>(0,_index2.resolveSegmentedControlSize)(I,d),[I,d]),k=g>=2?2:1,F=k>1,N="segmented"===x,z="underline"===x,E="pills"===x,M=N?I.space[R["track-padding"]]:0,T=Math.ceil(L.text*LABEL_LINE_HEIGHT_RATIO)*(k-1),A=R["underline-height"],D=I.space[R["pill-inset"]],H="number"==typeof h?h:h?I.radius[h]:void 0,B=H??I.radius.md,W=void 0===H?I.radius.sm:Math.max(H-M,0),O=H??I.radius.pill,P=H??I.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===V)),Q=G[K],U=Q?.x,Y=(0,_react.useCallback)(e=>{const t=I.motion.spring.snappy,i=_reactNative.Animated.spring(J,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:_nativeDriver.nativeDriver});return i.start(),i},[I.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 s=t[e];if(s&&s.x===i&&s.width===r)return t;const n=t.slice();return n[e]={x:i,width:r},n})},[]),ee=(0,_react.useCallback)(e=>{if(u)return;if(e.value===V)return;const t=(0,_index3.resolveHaptic)(_,"selection");t&&(0,_index3.triggerHaptic)(t),C(e.value)},[u,C,V,_]),te=N?I.colors.thumb:E?I.colors["primary-soft"]:I.colors.primary,ie=N?W:E?O:P,re=activeInkFor(I,m),se=I.colors["bg-muted"],ne=(0,_SquircleFill.useSquircle)(N,B),le=!0===n||(0,_index4.hasFieldText)(n),ae=le&&!u,oe=I.colors["field-border-error"],de=I.size.border,ce=(0,_index4.hasFieldText)(r),ue=le?n:s,me=(0,_index4.hasFieldText)(ue),xe=b??("string"==typeof r?r:void 0),he=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:e,accessibilityRole:"radiogroup",accessibilityLabel:xe,testID:j,style:[q.track,{...F?{minHeight:L.height+T}:{height:L.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},N?{borderRadius:B,..._corners.smoothCorners,backgroundColor:ne.active?"transparent":se,padding:M}:z?{borderBottomColor:ae?oe:I.colors["border-subtle"],borderBottomWidth:_reactNative.StyleSheet.hairlineWidth}:null,v],onLayout:ne.onLayout,children:[ne.active&&ne.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ne.size.width,height:ne.size.height,radius:B,fill:se,stroke:ae?oe:void 0,strokeWidth:de,hostBorderWidth:0}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:q.row,children:[Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[q.thumb,N?F?{top:0,bottom:0}:{top:0,height:L.height-2*M}:E?{top:D,bottom:D,left:D}:{bottom:0,height:A},{width:E?Math.max(Q.width-2*D,0):Q.width,borderRadius:ie,..._corners.smoothCorners,backgroundColor:te,transform:[{translateX:J}]},f]}):null,i.map((e,t)=>{const i=e.value===V,r=i?re:I.colors["text-subtle"],s=(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:L.icon,selected:i,disabled:u}),n=Boolean(s);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,F?q.segmentMultiline:null,{paddingHorizontal:L["padding-x"],opacity:e&&!i?.7:1},p],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:q.segmentIcon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:s}):null,(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:i?"semibold":"medium",style:[q.segmentLabel,F?q.segmentLabelMultiline:null,{color:r,fontSize:L.text},y,S],numberOfLines:k,children:e.label})]},String(e.value))})]}),!ae||z||ne.active?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{borderWidth:de,borderColor:oe,borderRadius:N?B:O,..._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:le}):null]}):he}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.Spinner=Spinner,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../text/index.js"),_spinnerG=require("../../text/phone/spinner.g.js"),_index2=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_squircle=require("../../utils/squircle.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeMap={sm:20,md:32,lg:48},CONTAINER_RATIO=1.5,DOT_NAMES=["first","second","third"],DOT_STAGGER_MS=150,DOT_CYCLE_MS=600,DOT_GROW_SCALE=1.4,DOT_PULSE_MIN_OPACITY=.4,Dot=({size:e,color:t,delay:i,duration:r,reduced:n})=>{const a=(0,_index2.useTheme)(),s=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.delay(i),_reactNative.Animated.timing(s,{toValue:1,duration:r/2,easing:_reactNative.Easing.out(_reactNative.Easing.quad),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(s,{toValue:0,duration:r/2,easing:_reactNative.Easing.in(_reactNative.Easing.quad),useNativeDriver:_nativeDriver.nativeDriver})]));return e.start(),()=>{e.stop()}},[s,i,r]);const o=(0,_react.useMemo)(()=>({grow:s.interpolate({inputRange:[0,1],outputRange:[1,1.4]}),fade:s.interpolate({inputRange:[0,1],outputRange:[.4,1]})}),[s]);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{width:e,height:e,borderRadius:a.radius.pill,..._corners.smoothCorners,backgroundColor:t,...n?{opacity:o.fade}:{transform:[{scale:o.grow}]}}})};function Spinner({ref:e,...t}){const{size:i="md",color:r,message:n,overlay:a=!1,backdropColor:s,variant:o="circular",accessibilityLabel:l,labels:c,style:u,testID:d}=t;(0,_assertValidValue.assertValidValue)("Spinner","size",t.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Spinner","variant",t.variant,["circular","dots","contained"]);const _=(0,_index.useMobileUiText)("spinner",_spinnerG.SPINNER_TEXT),m=(0,_react.useMemo)(()=>({..._,...c}),[_,c]),v="contained"===o,g=a&&!v,x=(0,_index2.useTheme)(),p=(0,_usePresenceMotion.usePresenceMotion)(),h=p.duration("default"),y=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current;(0,_react.useEffect)(()=>{_reactNative.Animated.timing(y,{toValue:1,duration:h,easing:_reactNative.Easing.bezier(...x.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver}).start()},[y,x,h]);const j=(0,_react.useMemo)(()=>buildStyles(x),[x]),f=sizeMap[i],R=r??x.colors.primary,N=s??x.colors.scrim,b=(0,_react.useMemo)(()=>{if("contained"===o){const e=Math.round(f*CONTAINER_RATIO);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[j.container,{width:e,height:e,borderRadius:x.radius.pill,backgroundColor:(0,_color.blendOf)(R,.14,x.colors.surface,x.colors["bg-subtle"])}],children:(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{color:R,size:"sm"===i?"small":"large",style:{width:f,height:f}})})}if("dots"===o){const e=Math.max(6,Math.round(f/4));return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[j.dotsRow,{gap:Math.round(e/2)}],children:DOT_NAMES.map((t,i)=>(0,_jsxRuntime.jsx)(Dot,{size:e,color:R,delay:i*DOT_STAGGER_MS,duration:DOT_CYCLE_MS,reduced:p.reduced},t))})}return(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{color:R,size:"sm"===i?"small":"large",style:{width:f,height:f}})},[o,i,f,R,j.dotsRow,j.container,p.reduced,x.radius.pill,x.colors.surface,x.colors["bg-subtle"]]),S=l??n??m.loading,C=(0,_react.useRef)(S);C.current=S,(0,_react.useEffect)(()=>{v&&(0,_announce.announce)(C.current)},[v]);const q=(0,_SquircleFill.useSquircle)(g,x.radius.lg),A=q.active&&q.size?{borderRadius:(0,_squircle.squircleHostRadius)(q.size.width,q.size.height,x.radius.lg)}:null;let M=j.inlineContent;g?M=j.overlayContent:v&&(M=j.containedContent);const T=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:e,accessible:!0,accessibilityRole:"progressbar",accessibilityLiveRegion:v?"none":"polite",accessibilityLabel:S,accessibilityState:{busy:!0},"aria-busy":!0,testID:d,onLayout:q.onLayout,style:[M,A,{opacity:y}],children:[q.active&&q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:q.size.width,height:q.size.height,radius:x.radius.lg,fill:x.colors.surface}):null,b,n?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"medium",style:[j.message,{marginTop:x.space.md}],numberOfLines:2,children:n}):null]});return g?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"auto",style:[j.overlay,{backgroundColor:N},u],children:T}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v?j.containedFill:j.inline,u],children:T})}const buildStyles=e=>_reactNative.StyleSheet.create({inline:{alignItems:"center",justifyContent:"center"},inlineContent:{alignItems:"center",justifyContent:"center"},containedFill:{flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",minHeight:Math.round(sizeMap.lg*CONTAINER_RATIO)+2*e.space.xl},containedContent:{alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},container:{alignItems:"center",justifyContent:"center"},overlay:{..._reactNative.StyleSheet.absoluteFill,alignItems:"center",justifyContent:"center",zIndex:1e3},overlayContent:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.surface,borderRadius:e.radius.lg,..._corners.smoothCorners,paddingHorizontal:e.space.xl,paddingVertical:e.space.xl,minWidth:140,...e.shadow.popover},dotsRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},message:{textAlign:"center"}});var _default=exports.default=Spinner;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Spinner=Spinner,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../text/index.js"),_spinnerG=require("../../text/phone/spinner.g.js"),_index2=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_squircle=require("../../utils/squircle.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeMap={sm:20,md:32,lg:48},CONTAINER_RATIO=1.5,DOT_NAMES=["first","second","third"],DOT_STAGGER_MS=150,DOT_CYCLE_MS=600,DOT_GROW_SCALE=1.4,DOT_PULSE_MIN_OPACITY=.4,Dot=({size:e,color:t,delay:i,duration:r,reduced:n})=>{const a=(0,_index2.useTheme)(),s=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.delay(i),_reactNative.Animated.timing(s,{toValue:1,duration:r/2,easing:_reactNative.Easing.out(_reactNative.Easing.quad),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(s,{toValue:0,duration:r/2,easing:_reactNative.Easing.in(_reactNative.Easing.quad),useNativeDriver:_nativeDriver.nativeDriver})]));return e.start(),()=>{e.stop()}},[s,i,r]);const o=(0,_react.useMemo)(()=>({grow:s.interpolate({inputRange:[0,1],outputRange:[1,1.4]}),fade:s.interpolate({inputRange:[0,1],outputRange:[.4,1]})}),[s]);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{width:e,height:e,borderRadius:a.radius.pill,..._corners.smoothCorners,backgroundColor:t,...n?{opacity:o.fade}:{transform:[{scale:o.grow}]}}})};function Spinner({ref:e,...t}){const{size:i="md",color:r,message:n,overlay:a=!1,backdropColor:s,variant:o="circular",accessibilityLabel:l,labels:c,style:u,testID:d}=t;(0,_assertValidValue.assertValidValue)("Spinner","size",t.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Spinner","variant",t.variant,["circular","dots","contained"]);const _=(0,_index.useMobileUiText)("spinner",_spinnerG.SPINNER_TEXT),m=(0,_react.useMemo)(()=>({..._,...c}),[_,c]),v="contained"===o,g=a&&!v,x=(0,_index2.useTheme)(),p=(0,_usePresenceMotion.usePresenceMotion)(),h=p.duration("default"),y=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current;(0,_react.useEffect)(()=>{_reactNative.Animated.timing(y,{toValue:1,duration:h,easing:_reactNative.Easing.bezier(...x.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver}).start()},[y,x,h]);const j=(0,_react.useMemo)(()=>buildStyles(x),[x]),f=sizeMap[i],R=r??x.colors.primary,N=s??x.colors.scrim,b=(0,_react.useMemo)(()=>{if("contained"===o){const e=Math.round(f*CONTAINER_RATIO);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[j.container,{width:e,height:e,borderRadius:x.radius.pill,backgroundColor:(0,_color.blendOf)(R,.14,x.colors.surface,x.colors["bg-subtle"])}],children:(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{color:R,size:"sm"===i?"small":"large",style:{width:f,height:f}})})}if("dots"===o){const e=Math.max(6,Math.round(f/4));return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[j.dotsRow,{gap:Math.round(e/2)}],children:DOT_NAMES.map((t,i)=>(0,_jsxRuntime.jsx)(Dot,{size:e,color:R,delay:i*DOT_STAGGER_MS,duration:DOT_CYCLE_MS,reduced:p.reduced},t))})}return(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{color:R,size:"sm"===i?"small":"large",style:{width:f,height:f}})},[o,i,f,R,j.dotsRow,j.container,p.reduced,x.radius.pill,x.colors.surface,x.colors["bg-subtle"]]),S=l??n??m.loading,C=(0,_react.useRef)(S);C.current=S,(0,_react.useEffect)(()=>{v&&(0,_announce.announce)(C.current)},[v]);const q=(0,_SquircleFill.useSquircle)(g,x.radius.lg),A=q.active&&q.size?{borderRadius:(0,_squircle.squircleHostRadius)(q.size.width,q.size.height,x.radius.lg)}:null;let M=j.inlineContent;g?M=j.overlayContent:v&&(M=j.containedContent);const T=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:e,accessible:!0,accessibilityRole:"progressbar",accessibilityLiveRegion:v?"none":"polite",accessibilityLabel:S,accessibilityState:{busy:!0},"aria-busy":!0,testID:d,onLayout:q.onLayout,style:[M,A,{opacity:y}],children:[q.active&&q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:q.size.width,height:q.size.height,radius:x.radius.lg,fill:x.colors.surface,hostBorderWidth:0}):null,b,n?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"medium",style:[j.message,{marginTop:x.space.md}],numberOfLines:2,children:n}):null]});return g?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"auto",style:[j.overlay,{backgroundColor:N},u],children:T}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v?j.containedFill:j.inline,u],children:T})}const buildStyles=e=>_reactNative.StyleSheet.create({inline:{alignItems:"center",justifyContent:"center"},inlineContent:{alignItems:"center",justifyContent:"center"},containedFill:{flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",minHeight:Math.round(sizeMap.lg*CONTAINER_RATIO)+2*e.space.xl},containedContent:{alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},container:{alignItems:"center",justifyContent:"center"},overlay:{..._reactNative.StyleSheet.absoluteFill,alignItems:"center",justifyContent:"center",zIndex:1e3},overlayContent:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.surface,borderRadius:e.radius.lg,..._corners.smoothCorners,paddingHorizontal:e.space.xl,paddingVertical:e.space.xl,minWidth:140,...e.shadow.popover},dotsRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},message:{textAlign:"center"}});var _default=exports.default=Spinner;