@webority/mobile-ui 0.133.0 → 0.134.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 (48) hide show
  1. package/dist/canvas-kit/kit.js +2162 -2048
  2. package/dist/canvas-kit/manifest.json +2 -2
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/lib/commonjs/components/AppIcon/slotIcon.js +1 -1
  5. package/lib/commonjs/components/Banner/Banner.js +1 -1
  6. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
  7. package/lib/commonjs/components/Button/Button.js +1 -1
  8. package/lib/commonjs/components/Card/Card.js +1 -1
  9. package/lib/commonjs/components/Chip/Chip.js +1 -1
  10. package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
  11. package/lib/commonjs/components/DateSeparator/DateSeparator.js +1 -1
  12. package/lib/commonjs/components/Dialog/OverlayActions.js +1 -1
  13. package/lib/commonjs/components/IconButton/IconButton.js +1 -1
  14. package/lib/commonjs/components/Input/Input.js +1 -1
  15. package/lib/commonjs/components/Menu/MenuSurface.js +1 -1
  16. package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
  17. package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
  18. package/lib/commonjs/components/SearchBar/SearchPanel.js +1 -1
  19. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
  20. package/lib/commonjs/components/Select/Select.js +1 -1
  21. package/lib/commonjs/components/StatTile/StatTile.js +1 -1
  22. package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
  23. package/lib/commonjs/components/Tabs/Tabs.js +1 -1
  24. package/lib/module/components/AppIcon/slotIcon.js +1 -1
  25. package/lib/module/components/Banner/Banner.js +1 -1
  26. package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
  27. package/lib/module/components/Button/Button.js +1 -1
  28. package/lib/module/components/Card/Card.js +1 -1
  29. package/lib/module/components/Chip/Chip.js +1 -1
  30. package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
  31. package/lib/module/components/DateSeparator/DateSeparator.js +1 -1
  32. package/lib/module/components/Dialog/OverlayActions.js +1 -1
  33. package/lib/module/components/IconButton/IconButton.js +1 -1
  34. package/lib/module/components/Input/Input.js +1 -1
  35. package/lib/module/components/Menu/MenuSurface.js +1 -1
  36. package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
  37. package/lib/module/components/SearchBar/SearchBar.js +1 -1
  38. package/lib/module/components/SearchBar/SearchPanel.js +1 -1
  39. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  40. package/lib/module/components/Select/Select.js +1 -1
  41. package/lib/module/components/StatTile/StatTile.js +1 -1
  42. package/lib/module/components/Swipeable/Swipeable.js +1 -1
  43. package/lib/module/components/Tabs/Tabs.js +1 -1
  44. package/lib/typescript/commonjs/components/AppIcon/slotIcon.d.ts +8 -0
  45. package/lib/typescript/commonjs/components/DateSeparator/DateSeparator.d.ts +2 -3
  46. package/lib/typescript/module/components/AppIcon/slotIcon.d.ts +8 -0
  47. package/lib/typescript/module/components/DateSeparator/DateSeparator.d.ts +2 -3
  48. 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.133.0"
5
+ "version": "0.134.0"
6
6
  },
7
7
  "rendererProtocolVersion": 13,
8
8
  "platform": "Phone",
@@ -5737,7 +5737,7 @@
5737
5737
  }
5738
5738
  ],
5739
5739
  "a11y": [
5740
- "The text uses an accessibility header role so screen reader users can navigate through a conversation by day.",
5740
+ "The date is plain text, as on the web chat, so a conversation has no heading per day.",
5741
5741
  "The centred text element is announced directly to assistive technologies."
5742
5742
  ]
5743
5743
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-phone",
3
- "version": "0.133.0",
3
+ "version": "0.134.0",
4
4
  "platform": "Phone",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 13,
7
7
  "library": {
8
8
  "name": "@webority/mobile-ui",
9
- "version": "0.133.0"
9
+ "version": "0.134.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "b162bbd39238c17412c39a8c70888cb8252d03fcf8ba95e1ac72d4ee7370ef11",
14
- "bytes": 663823
13
+ "sha256": "09966f3dc6db83042828f9683cca3262935f696089bee51fbf8b046309808c87",
14
+ "bytes": 663799
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "a75d6d7ebe4fdfdb55863d16edc0eb9fac10f27a3bd8580f750c8129ea5d5949",
18
- "bytes": 6111202
17
+ "sha256": "590df97bdbaefb529db3206c49848c736c24d956564139eaf92355d8e76bbc6b",
18
+ "bytes": 6114994
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.renderSlotIcon=renderSlotIcon;var _react=_interopRequireDefault(require("react")),_AppIcon=require("./AppIcon.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const isIconRef=e=>"object"==typeof e&&null!==e&&!_react.default.isValidElement(e)&&"name"in e&&"string"==typeof e.name;function renderSlotIcon(e,n,r){return null==e||!1===e?null:"string"==typeof e?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,variant:r,size:n.size,color:n.color}):"function"==typeof e?e(n):isIconRef(e)?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e.name,variant:e.variant??r,size:n.size,color:n.color}):e}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isDecorativeSlotIcon=void 0,exports.renderSlotIcon=renderSlotIcon,exports.slotIconView=slotIconView;var _react=_interopRequireDefault(require("react")),_reactNative=require("react-native"),_AppIcon=require("./AppIcon.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const isIconRef=e=>"object"==typeof e&&null!==e&&!_react.default.isValidElement(e)&&"name"in e&&"string"==typeof e.name;function renderSlotIcon(e,t,n){return null==e||!1===e?null:"string"==typeof e?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,variant:n,size:t.size,color:t.color}):"function"==typeof e?e(t):isIconRef(e)?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e.name,variant:e.variant??n,size:t.size,color:t.color}):e}const isDecorativeSlotIcon=e=>"string"==typeof e||isIconRef(e);function slotIconView(e,t){return isDecorativeSlotIcon(e)?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:t}):(0,_jsxRuntime.jsx)(_reactNative.View,{children:t})}exports.isDecorativeSlotIcon=isDecorativeSlotIcon;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_BANNER_LABELS=exports.Banner=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../IconBadge/index.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_BANNER_LABELS=exports.DEFAULT_BANNER_LABELS=Object.freeze({dismiss:"Dismiss banner"}),Banner=exports.Banner=(0,_react.forwardRef)((e,t)=>{const{title:r,message:n,tone:i="neutral",variant:s="bar",icon:a,actions:o,dismissible:l=!1,onClose:c,haptic:d,open:u=!0,animateMount:x=!0,loading:m=!1,accessibilityRole:p="alert",accessibilityLabel:_,labels:g,style:h,containerStyle:y,iconCircleStyle:b,tintBarStyle:v,closeButtonStyle:f,actionButtonStyle:j,testID:w}=e;(0,_warnInvalidValue.warnInvalidValue)("Banner","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","variant",e.variant,["bar","wash","tint"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","accessibilityRole",e.accessibilityRole,["alert","summary","none"]);const R=(0,_index.useTheme)(),B=(0,_usePresenceMotion.usePresenceMotion)(),S=(0,_react.useMemo)(()=>buildStyles(R),[R]),N=(0,_react.useMemo)(()=>tintFor(R,i),[R,i]),I=(0,_react.useMemo)(()=>({...DEFAULT_BANNER_LABELS,...g}),[g]),[C,V]=B.range(-20,0),k=(0,_react.useRef)((0,_index.createAnimatedValue)(x&&u?C:0)).current,L=(0,_react.useRef)((0,_index.createAnimatedValue)(x&&u?0:u?1:0)).current,[A,D]=(0,_react.useState)(u),E=(0,_react.useRef)(!0);if((0,_react.useEffect)(()=>{if(E.current&&(E.current=!1,!x))return;let e;return u?(D(!0),e=_reactNative.Animated.parallel([_reactNative.Animated.timing(k,{toValue:V,duration:R.motion.duration.default,useNativeDriver:!0}),_reactNative.Animated.timing(L,{toValue:1,duration:B.duration("default"),useNativeDriver:!0})]),e.start()):A&&(e=_reactNative.Animated.parallel([_reactNative.Animated.timing(k,{toValue:C,duration:R.motion.duration.fast,useNativeDriver:!0}),_reactNative.Animated.timing(L,{toValue:0,duration:B.duration("fast"),useNativeDriver:!0})]),e.start(()=>{D(!1)})),()=>e?.stop()},[u]),!A)return null;const T=r??" ",q="string"==typeof n?n??" ":"",M="wash"===s,H="bar"!==s,z="alert"===p?"danger"===i?"assertive":"polite":"none",P=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:t,accessibilityRole:p,accessibilityLiveRegion:z,accessibilityLabel:_,testID:w,style:[S.container,{backgroundColor:H?N.soft:R.colors["bg-subtle"],borderRadius:M?R.radius.sm:R.radius.md,..._corners.smoothCorners,padding:R.space.md,opacity:L,transform:[{translateY:k}]},y,h],children:[!M&&R.components.banner["tint-bar-width"]>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[S.tintBar,{backgroundColor:N.bar},v]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[S.row,void 0===r&&S.rowCentred],children:[!1===a?null:a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:S.iconWrap,children:(0,_slotIcon.renderSlotIcon)(a,{color:N.ink,size:R.text.xl.size,disabled:!1})}):(0,_jsxRuntime.jsx)(_index2.IconBadge,{dimension:ICON_CIRCLE_SIZE,color:N.bar,icon:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"bold",accessible:!1,style:[S.iconGlyph,{color:N.ink}],children:N.glyph}),style:[S.iconCircle,b]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:S.textBlock,children:[r||m?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"semibold",numberOfLines:2,style:{lineHeight:20,...M?{color:N.ink}:null},children:T}):null,"string"==typeof n||m?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",style:{lineHeight:18,marginTop:r?R.space.xxs:0},children:q||" "}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:r?R.space.xxs:0},children:n})]}),l?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:I.dismiss,onPress:()=>{const e=(0,_hapticUtils.resolveHaptic)(d,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),c?.()},hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),style:({pressed:e})=>[S.closeBtn,{backgroundColor:e?R.colors["surface-pressed"]:"transparent"},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",weight:"bold",color:"secondary",accessible:!1,style:{lineHeight:17},children:"×"})}):null]}),o&&o.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:S.actionsRow,children:o.map((e,t)=>{(0,_warnInvalidValue.warnInvalidValue)("Banner","action.tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","action.variant",e.variant,["solid","outline","ghost"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","action.size",e.size,["sm","md"]);const r=e.tone??"primary",n=e.variant??"ghost",i="primary"===r?N.glyphColor:"neutral"===r?R.colors["text-muted"]:R.colors[r],s="primary"===r?N.ink:"neutral"===r?R.colors["text-muted"]:R.colors[`${r}-text`],a="primary"===r?N.on:"neutral"===r?R.colors["on-neutral-strong"]:R.colors[`on-${r}`],o="solid"===n;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,testID:e.testID,onPress:()=>{const t=(0,_hapticUtils.resolveHaptic)(d,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:({pressed:t})=>[S.actionBtn,"md"===e.size&&S.actionBtnMd,"outline"===n&&{borderWidth:1,borderColor:s},{backgroundColor:o?i:t?R.colors["surface-pressed"]:"transparent",opacity:o&&t?.85:1},j],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:o?a:s},children:e.label})},`${e.label}-${t}`)})}):null]});return m?(0,_jsxRuntime.jsx)(BannerSkeleton,{...e}):P});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:t,icon:r,containerStyle:n,style:i})=>{const s=(0,_index.useTheme)(),a=!1!==r;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:s.colors.surface,borderRadius:s.radius.md,..._corners.smoothCorners,padding:s.space.md,borderWidth:1,borderColor:s.colors.border},n,i],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:s.space.sm},children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"circle",width:32,height:32})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[void 0!==e?(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:s.space.xs}}):null,(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:2,fontSize:s.text.sm.size,lastLineWidth:"70%"}),t&&t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:s.space.sm},children:t.map((e,t)=>(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:s.space.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,t)=>{switch(t){case"success":return{soft:e.colors["success-soft"],bar:e.colors.success,glyphColor:e.colors.success,ink:e.colors["success-text"],on:e.colors["on-success"],glyph:"✓"};case"warning":return{soft:e.colors["warning-soft"],bar:e.colors.warning,glyphColor:e.colors.warning,ink:e.colors["warning-text"],on:e.colors["on-warning"],glyph:"⚠"};case"danger":return{soft:e.colors["danger-soft"],bar:e.colors.danger,glyphColor:e.colors.danger,ink:e.colors["danger-text"],on:e.colors["on-danger"],glyph:"✗"};case"neutral":return{soft:e.colors["bg-subtle"],bar:e.colors["text-subtle"],glyphColor:e.colors["text-muted"],ink:e.colors["text-muted"],on:e.colors["on-neutral-strong"],glyph:"i"};case"primary":return{soft:e.colors["primary-soft"],bar:e.colors.primary,glyphColor:e.colors.primary,ink:e.colors["primary-text"],on:e.colors["on-primary"],glyph:"i"};case"info":return{soft:e.colors["info-soft"],bar:e.colors.info,glyphColor:e.colors.info,ink:e.colors["info-text"],on:e.colors["on-info"],glyph:"i"};default:return tintFor(e,"neutral")}},ICON_CIRCLE_SIZE=28,buildStyles=e=>{const t=e.components.banner,r=e.space.sm;return _reactNative.StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.space.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:t["tint-bar-width"]},row:{flexDirection:"row",alignItems:"flex-start"},rowCentred:{alignItems:"center"},iconWrap:{marginRight:r},iconCircle:{marginRight:r},iconGlyph:{lineHeight:17},textBlock:{flex:1,paddingRight:e.space.xs},closeBtn:{width:28,height:28,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.space.xxs},actionsRow:{flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-end",marginTop:e.space.xs,columnGap:e.space.xs,rowGap:e.space.xs},actionBtn:{paddingHorizontal:e.space.sm,paddingVertical:e.space.xs,borderRadius:e.radius.sm,..._corners.smoothCorners,maxWidth:"100%",alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.space.md}})};var _default=exports.default=Banner;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_BANNER_LABELS=exports.Banner=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../IconBadge/index.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_BANNER_LABELS=exports.DEFAULT_BANNER_LABELS=Object.freeze({dismiss:"Dismiss banner"}),Banner=exports.Banner=(0,_react.forwardRef)((e,t)=>{const{title:r,message:n,tone:i="neutral",variant:s="bar",icon:a,actions:o,dismissible:l=!1,onClose:c,haptic:d,open:u=!0,animateMount:m=!0,loading:x=!1,accessibilityRole:p="alert",accessibilityLabel:_,labels:g,style:h,containerStyle:y,iconCircleStyle:b,tintBarStyle:v,closeButtonStyle:f,actionButtonStyle:j,testID:w}=e;(0,_warnInvalidValue.warnInvalidValue)("Banner","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","variant",e.variant,["bar","wash","tint"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","accessibilityRole",e.accessibilityRole,["alert","summary","none"]);const R=(0,_index.useTheme)(),B=(0,_usePresenceMotion.usePresenceMotion)(),S=(0,_react.useMemo)(()=>buildStyles(R),[R]),N=(0,_react.useMemo)(()=>tintFor(R,i),[R,i]),I=(0,_react.useMemo)(()=>({...DEFAULT_BANNER_LABELS,...g}),[g]),[C,V]=B.range(-20,0),k=(0,_react.useRef)((0,_index.createAnimatedValue)(m&&u?C:0)).current,A=(0,_react.useRef)((0,_index.createAnimatedValue)(m&&u?0:u?1:0)).current,[L,E]=(0,_react.useState)(u),D=(0,_react.useRef)(!0);if((0,_react.useEffect)(()=>{if(D.current&&(D.current=!1,!m))return;let e;return u?(E(!0),e=_reactNative.Animated.parallel([_reactNative.Animated.timing(k,{toValue:V,duration:R.motion.duration.default,useNativeDriver:!0}),_reactNative.Animated.timing(A,{toValue:1,duration:B.duration("default"),useNativeDriver:!0})]),e.start()):L&&(e=_reactNative.Animated.parallel([_reactNative.Animated.timing(k,{toValue:C,duration:R.motion.duration.fast,useNativeDriver:!0}),_reactNative.Animated.timing(A,{toValue:0,duration:B.duration("fast"),useNativeDriver:!0})]),e.start(()=>{E(!1)})),()=>e?.stop()},[u]),!L)return null;const T=r??" ",q="string"==typeof n?n??" ":"",H="wash"===s,M="bar"!==s,z="alert"===p?"danger"===i?"assertive":"polite":"none",P=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:t,accessibilityRole:p,accessibilityLiveRegion:z,accessibilityLabel:_,testID:w,style:[S.container,{backgroundColor:M?N.soft:R.colors["bg-subtle"],borderRadius:H?R.radius.sm:R.radius.md,..._corners.smoothCorners,padding:R.space.md,opacity:A,transform:[{translateY:k}]},y,h],children:[!H&&R.components.banner["tint-bar-width"]>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[S.tintBar,{backgroundColor:N.bar},v]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[S.row,void 0===r&&S.rowCentred],children:[!1===a?null:a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:S.iconWrap,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(a,{color:N.ink,size:R.text.xl.size,disabled:!1})}):(0,_jsxRuntime.jsx)(_index2.IconBadge,{dimension:ICON_CIRCLE_SIZE,color:N.bar,icon:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"bold",accessible:!1,style:[S.iconGlyph,{color:N.ink}],children:N.glyph}),style:[S.iconCircle,b]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:S.textBlock,children:[r||x?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"semibold",numberOfLines:2,style:{lineHeight:20,...H?{color:N.ink}:null},children:T}):null,"string"==typeof n||x?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",style:{lineHeight:18,marginTop:r?R.space.xxs:0},children:q||" "}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:r?R.space.xxs:0},children:n})]}),l?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:I.dismiss,onPress:()=>{const e=(0,_hapticUtils.resolveHaptic)(d,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),c?.()},hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),style:({pressed:e})=>[S.closeBtn,{backgroundColor:e?R.colors["surface-pressed"]:"transparent"},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",weight:"bold",color:"secondary",accessible:!1,style:{lineHeight:17},children:"×"})}):null]}),o&&o.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:S.actionsRow,children:o.map((e,t)=>{(0,_warnInvalidValue.warnInvalidValue)("Banner","action.tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","action.variant",e.variant,["solid","outline","ghost"]),(0,_warnInvalidValue.warnInvalidValue)("Banner","action.size",e.size,["sm","md"]);const r=e.tone??"primary",n=e.variant??"ghost",i="primary"===r?N.glyphColor:"neutral"===r?R.colors["text-muted"]:R.colors[r],s="primary"===r?N.ink:"neutral"===r?R.colors["text-muted"]:R.colors[`${r}-text`],a="primary"===r?N.on:"neutral"===r?R.colors["on-neutral-strong"]:R.colors[`on-${r}`],o="solid"===n;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,testID:e.testID,onPress:()=>{const t=(0,_hapticUtils.resolveHaptic)(d,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:({pressed:t})=>[S.actionBtn,"md"===e.size&&S.actionBtnMd,"outline"===n&&{borderWidth:1,borderColor:s},{backgroundColor:o?i:t?R.colors["surface-pressed"]:"transparent",opacity:o&&t?.85:1},j],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:o?a:s},children:e.label})},`${e.label}-${t}`)})}):null]});return x?(0,_jsxRuntime.jsx)(BannerSkeleton,{...e}):P});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:t,icon:r,containerStyle:n,style:i})=>{const s=(0,_index.useTheme)(),a=!1!==r;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:s.colors.surface,borderRadius:s.radius.md,..._corners.smoothCorners,padding:s.space.md,borderWidth:1,borderColor:s.colors.border},n,i],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:s.space.sm},children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"circle",width:32,height:32})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[void 0!==e?(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:s.space.xs}}):null,(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:2,fontSize:s.text.sm.size,lastLineWidth:"70%"}),t&&t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:s.space.sm},children:t.map((e,t)=>(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:s.space.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,t)=>{switch(t){case"success":return{soft:e.colors["success-soft"],bar:e.colors.success,glyphColor:e.colors.success,ink:e.colors["success-text"],on:e.colors["on-success"],glyph:"✓"};case"warning":return{soft:e.colors["warning-soft"],bar:e.colors.warning,glyphColor:e.colors.warning,ink:e.colors["warning-text"],on:e.colors["on-warning"],glyph:"⚠"};case"danger":return{soft:e.colors["danger-soft"],bar:e.colors.danger,glyphColor:e.colors.danger,ink:e.colors["danger-text"],on:e.colors["on-danger"],glyph:"✗"};case"neutral":return{soft:e.colors["bg-subtle"],bar:e.colors["text-subtle"],glyphColor:e.colors["text-muted"],ink:e.colors["text-muted"],on:e.colors["on-neutral-strong"],glyph:"i"};case"primary":return{soft:e.colors["primary-soft"],bar:e.colors.primary,glyphColor:e.colors.primary,ink:e.colors["primary-text"],on:e.colors["on-primary"],glyph:"i"};case"info":return{soft:e.colors["info-soft"],bar:e.colors.info,glyphColor:e.colors.info,ink:e.colors["info-text"],on:e.colors["on-info"],glyph:"i"};default:return tintFor(e,"neutral")}},ICON_CIRCLE_SIZE=28,buildStyles=e=>{const t=e.components.banner,r=e.space.sm;return _reactNative.StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.space.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:t["tint-bar-width"]},row:{flexDirection:"row",alignItems:"flex-start"},rowCentred:{alignItems:"center"},iconWrap:{marginRight:r},iconCircle:{marginRight:r},iconGlyph:{lineHeight:17},textBlock:{flex:1,paddingRight:e.space.xs},closeBtn:{width:28,height:28,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.space.xxs},actionsRow:{flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-end",marginTop:e.space.xs,columnGap:e.space.xs,rowGap:e.space.xs},actionBtn:{paddingHorizontal:e.space.sm,paddingVertical:e.space.xs,borderRadius:e.radius.sm,..._corners.smoothCorners,maxWidth:"100%",alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.space.md}})};var _default=exports.default=Banner;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_BOTTOM_NAVIGATION_LABELS=exports.BottomNavigation=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_shadows=require("../../utils/shadows.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index3=require("../AppIcon/index.js"),_index4=require("../Badge/index.js"),_index5=require("../Text/index.js"),_useScreenReaderEnabled=require("./useScreenReaderEnabled.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,a,n=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(a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((i=n&&Object.getOwnPropertyDescriptor(e,a))&&(i.get||i.set)?n(r,a,i):r[a]=e[a]);return r}const DEFAULT_BOTTOM_NAVIGATION_LABELS=exports.DEFAULT_BOTTOM_NAVIGATION_LABELS=Object.freeze({switchesTo:e=>`Switches to ${e}`,unread:e=>`${e} unread`,newUpdates:"new updates"}),DEFAULT_ICON_SIZE=18,DEFAULT_LABEL_MAX_FONT_SCALE=1.2,ICON_WRAP_AIR=4,PILL_AIR=8,DEFAULT_PILL_MAX_WIDTH=64,TILE_MAX_WIDTH=96,DEFAULT_UNDERLINE_HEIGHT=3,DEFAULT_BUBBLE_SIZE=48,DEFAULT_BUBBLE_LIFT=14,DEFAULT_CENTER_SIZE=48,DEFAULT_CENTER_ICON_SIZE=24,CENTER_KEY="__center_action__",EXPANDED_FLEX=1.5,SOLID_INACTIVE_OPACITY=.7,TILE_INSET=2,badgeVariantOf=e=>null==e||!1===e?null:!0===e||"·"===e?"dot":"number"==typeof e?e>0?"standard":null:e.length>0?"standard":null,badgeAccessibilitySuffix=(e,t)=>null==e||!1===e?"":"number"==typeof e?e>0?`, ${t.unread(e)}`:"":!0===e||"·"===e?`, ${t.newUpdates}`:"string"==typeof e&&e.length>0?`, ${e}`:"",BottomNavigation=exports.BottomNavigation=(0,_react.forwardRef)((e,t)=>{const{tabs:i,centerAction:a,activeTab:n,onChange:r,haptic:o="selection",showLabels:s=!0,variant:l="pill",indicatorPosition:d="bottom",radius:c,indicatorRadius:u="auto",elevation:p,iconSize:h,marginHorizontal:_,marginVertical:m,paddingHorizontal:g,paddingVertical:b,border:x,minimizeOnScroll:f=!1,scrollDirection:y="idle",accessory:v,style:R,indicatorStyle:N,labelStyle:w,labelMaxFontScale:j,labels:S,testID:A}=e;(0,_warnInvalidValue.warnInvalidValue)("BottomNavigation","variant",e.variant,["pill","underline","floating","bubble","expand","solid","tile"]),(0,_warnInvalidValue.warnInvalidValue)("BottomNavigation","indicatorPosition",e.indicatorPosition,["top","bottom"]);const I=(0,_react.useMemo)(()=>S?{...DEFAULT_BOTTOM_NAVIGATION_LABELS,...S}:DEFAULT_BOTTOM_NAVIGATION_LABELS,[S]),E=(0,_index.useTheme)(),T=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),L=(0,_react.useMemo)(()=>buildStyles(E),[E]),V=h??18,M=V+4+8,B=E.space.lg,C=E.space.lg,D=E.radius.xl,O=(0,_useReducedMotion.useReducedMotion)(),k=(0,_useScreenReaderEnabled.useScreenReaderEnabled)(f),[P,z]=_react.default.useState(null);(0,_react.useEffect)(()=>{null!==P&&P!==y&&z(null)},[P,y]);const F=f&&!k&&"down"===y&&null===P,[H,W]=_react.default.useState(F);(0,_react.useEffect)(()=>{H!==F&&(O||"web"===_reactNative.Platform.OS||_reactNative.LayoutAnimation.configureNext(_reactNative.LayoutAnimation.Presets.easeInEaseOut),W(F))},[H,F,O]);const q="function"==typeof v?v({minimized:H}):v,U=null!=q&&!1!==q,$=H&&U,[X,G]=_react.default.useState(0),Z=U&&!$?X+E.space.xs:0,Y="tile"===l,K="floating"===l||Y,J="bubble"===l,Q="expand"===l,ee="solid"===l,te="pill"===l||K||ee,ie=Math.max(0,i.findIndex(e=>e.key===n)),[ae,ne]=_react.default.useState(0),[re,oe]=_react.default.useState(0),se=a?Math.ceil(i.length/2):i.length,le=i.length+(a?1:0),[de,ce]=_react.default.useState({width:0,height:0}),ue=a?.size??48,pe=void 0!==a?.gap,he=Math.max(0,a?.gap??0),me=pe?(de.width||ue)+2*he:0,ge=pe?i.length>0?Math.max(0,ae-me)/i.length:0:le>0?ae/le:0,be=pe?me:ge,xe=(0,_react.useRef)((0,_index.createAnimatedValue)(ie)).current,fe=(0,_react.useRef)({}),ye=(0,_react.useRef)({});i.forEach(e=>{fe.current[e.key]||(fe.current[e.key]=new _reactNative.Animated.Value(1)),ye.current[e.key]||(ye.current[e.key]=(0,_index.createAnimatedValue)(e.key===n?1:0))});const ve=ge>0?Y?Math.min(ge-4,96):Math.min(ge-B,64):0,Re=ge>0?(ge-ve)/2:0,Ne=ge>0?(ge-48)/2:0,hasLabel=e=>s&&!H&&!1!==e.showLabel&&e.label.trim().length>0,we=i[ie],je=we&&!hasLabel(we)&&re>0?re/2:E.space.xs+(V+4)/2,Se=je-14-24,Ae=Math.max(0,re-4),Ie=Y?2:je-M/2,Ee=(0,_react.useRef)(ie);(0,_react.useEffect)(()=>{if(Ee.current===ie)return;Ee.current=ie;const e=_reactNative.Animated.spring(xe,{toValue:ie,tension:120,friction:14,useNativeDriver:!0});return e.start(),()=>e.stop()},[ie,xe]);const Te=Math.max(1,i.length-1),Le=(0,_react.useMemo)(()=>{const e=[],t=[];for(let i=0;i<=Te;i++)e.push(i),t.push(i<se?i*ge:i*ge+be);return xe.interpolate({inputRange:e,outputRange:t})},[xe,Te,se,ge,be]),Ve=i.map(e=>e.key).join(" "),Me=J||Q;(0,_react.useEffect)(()=>{const e=Ve.split(" ").flatMap(e=>{const t=e===n?1:0,i=ye.current[e];return i?Me?[_reactNative.Animated.spring(i,{toValue:t,tension:140,friction:13,useNativeDriver:!1})]:(i.setValue(t),[]):[]});if(0===e.length)return;const t=_reactNative.Animated.parallel(e);return t.start(),()=>t.stop()},[n,Ve,Me]);const popIcon=e=>{_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:1.15,duration:120,useNativeDriver:!0}),_reactNative.Animated.spring(e,{toValue:1,tension:200,friction:8,useNativeDriver:!0})]).start()},Be=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current,{colors:Ce}=E,De=ee?Ce.primary:Ce.surface,Oe=ee?Ce["on-primary"]:Ce.primary,ke=ee?Ce["on-primary"]:Y?Ce["text-body"]:Ce["text-subtle"],Pe=ee?Ce["on-primary"]:Ce["primary-soft"],ze=ee?Ce.primary:J?Ce["on-primary"]:Oe,Fe=_??C,He=m??(K?C:0),We=He>0,qe=b??E.space.sm,Ue=g??(K?E.space.sm:E.space.xs),$e=We?qe:Math.max(qe,T.bottom),Xe=We?Math.max(He,T.bottom>0?T.bottom+E.space.sm:0):0,Ge="pill"===c,Ze=K?re+Z+2*qe+2*_reactNative.StyleSheet.hairlineWidth:re+Z+qe+$e,Ye=Ge?re>0?Ze/2:E.radius.pill:c??(Y?E.radius.pill:K?D:E.radius.none),Ke=void 0!==c,activeBgRadius=(e,t)=>"number"==typeof u?Math.max(0,Math.min(u,e/2)):"auto"===u&&Ke?Math.min(Ye,e/2):t,Je="underline"===l?Math.max(Ue,Ge&&0===re?0:Ye):Ue,Qe=p??"none",et="none"===Qe?void 0:E.shadow[Qe],tt=void 0===et?null:(0,_shadows.supportsBoxShadow)()?{boxShadow:(0,_shadows.toBoxShadow)(et)}:et,it=x?_reactNative.StyleSheet.hairlineWidth:0,at=ee?Ce.primary:Ce.border,nt=a?.lift??0,rt=qe+it+Z,ot=a&&re>0?Math.max(0,(de.height||ue)/2+nt-re/2-rt):0,st=a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[L.centerCell,pe?{flex:0,marginHorizontal:he}:null],pointerEvents:"box-none",children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>{if(!a)return;const e=a.haptic??o;!1!==e&&(0,_index2.triggerHaptic)(e),popIcon(Be),a.onPress()},onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;ce(e=>e.width===t&&e.height===i?e:{width:t,height:i})},accessibilityRole:"button",accessibilityLabel:a.label,hitSlop:{top:6,bottom:6,left:6,right:6},...(0,_hitSlop.hitSlopMarker)({top:6,bottom:6,left:6,right:6}),style:({pressed:e})=>[L.centerPressable,{top:-nt},e?{opacity:.85}:null],testID:a.testID??(A?`${A}-center`:void 0),children:[a.content?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Be}]},children:a.content}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[L.centerCircle,{width:ue,height:ue,borderRadius:E.radius.pill,..._corners.smoothCorners,backgroundColor:a.color??Ce.primary}],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Be}]},children:(0,_index3.renderSlotIcon)(a.icon??"add",{color:a.iconColor??Ce["on-primary"],size:a.iconSize??24,disabled:!1})})}),(lt=a,s&&!H&&lt.label.trim().length>0?(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",numberOfLines:1,maxFontSizeMultiplier:j??E.settings.maxFontSizeMultiplier??1.2,style:[L.label,{color:ke,opacity:ee?.7:1},w],children:a.label}):null)]})},CENTER_KEY):null;var lt;const dt=U?(0,_jsxRuntime.jsx)(_reactNative.View,{style:$?L.accessoryInline:L.accessoryStacked,onLayout:e=>G(e.nativeEvent.layout.height),testID:A?`${A}-accessory`:void 0,children:q}):null,ct=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$?[L.tabRow,L.tabRowInline]:L.tabRow,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;ne(t),oe(i)},children:[te&&ve>0&&(!Y||Ae>0)?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[L.pill,{width:ve,height:Y?Ae:M,left:Re,top:Ie,backgroundColor:Pe,borderRadius:Y?activeBgRadius(Ae,Ae/2):activeBgRadius(M,E.radius.pill),..._corners.smoothCorners,transform:[{translateX:Le}]},N]}):null,J&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[L.bubble,E.shadow.elevated,{width:48,height:48,borderRadius:E.radius.pill,..._corners.smoothCorners,left:Ne,top:Se,backgroundColor:Ce.primary,borderColor:Ce.surface,transform:[{translateX:Le}]},N]}):null,(ut=i.map(e=>{const t=e.key===n,i=t?Oe:ke,a=t?ze:ke,s="string"==typeof e.icon?{name:e.icon,variant:"bold"}:e.icon,l=t?e.activeIcon??s:e.icon,d=fe.current[e.key],c=ye.current[e.key],u=badgeVariantOf(e.badge??null),p=badgeAccessibilitySuffix(e.badge??null,I),h=ee&&!t?.7:1,_=J&&t||ee?Ce.primary:Ce.surface,m=hasLabel(e),g=m&&(!Q||t),b=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[L.iconWrap,{width:V+4,height:V+4,opacity:h,transform:[{scale:d}]}],children:[(0,_index3.renderSlotIcon)(l,{color:a,size:V,focused:t,disabled:!1}),u?(0,_jsxRuntime.jsx)(_index4.Badge,{variant:u,value:"standard"===u?e.badge:void 0,tone:"danger",accessible:!1,style:"dot"===u?L.badgeDotPosition:L.badgePillPosition,badgeStyle:["dot"===u?L.badgeDot:L.badgePill,{borderColor:_}],textStyle:L.badgeText}):null]}),x=J?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{top:c.interpolate({inputRange:[0,1],outputRange:[0,-14]})},children:b}):b,f=g?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{numberOfLines:1,maxFontSizeMultiplier:j??E.settings.maxFontSizeMultiplier??1.2,style:[L.label,Q?L.labelInline:null,{color:i,opacity:Q?c:h,fontWeight:t?E.weight.semibold:E.weight.normal},w],children:e.label}):null,v=(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>(e=>{H&&z(y),e.key!==n&&!1!==o&&(0,_index2.triggerHaptic)(o);const t=fe.current[e.key];t&&popIcon(t),r(e.key)})(e),accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:`${e.label}${p}`,accessibilityHint:I.switchesTo(e.label),hitSlop:{top:6,bottom:6,left:6,right:6},...(0,_hitSlop.hitSlopMarker)({top:6,bottom:6,left:6,right:6}),style:({pressed:e})=>[L.tab,Y?L.tabTile:null,e?{opacity:.85}:null],testID:A?`${A}-tab-${e.key}`:void 0,children:Q?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[L.expandPill,{height:M,paddingHorizontal:t&&m?E.space.md:Math.max(0,(M-(V+4))/2)}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[L.expandFill,{borderRadius:activeBgRadius(M,M/2),..._corners.smoothCorners,backgroundColor:t?Ce["primary-soft"]:"transparent"},t?N:null]}),x,f]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[x,f]})},e.key);return Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{flex:c.interpolate({inputRange:[0,1],outputRange:[1,m?1.5:1]})},children:v},e.key):v}),st?[...ut.slice(0,se),st,...ut.slice(se)]:ut),"underline"===l&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[L.underline,"top"===d?L.underlineTop:L.underlineBottom,"top"===d?{top:-qe-Z}:{bottom:-qe},{width:ge,height:3,backgroundColor:Ce.primary,transform:[{translateX:Le}]},N]}):null]});var ut;return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,testID:A,accessibilityRole:"tablist",style:[L.outer,{paddingHorizontal:Fe,paddingTop:Math.max(He,ot),paddingBottom:Xe},R],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[K?L.floatingBar:L.dockedBar,$?L.barInline:null,tt,{backgroundColor:De,borderColor:at,borderRadius:Ye,..._corners.smoothCorners},K?{borderWidth:it,paddingHorizontal:Ue,paddingVertical:qe}:{borderTopWidth:it,borderBottomWidth:it,borderLeftWidth:it,borderRightWidth:it,paddingHorizontal:Je,paddingTop:qe,paddingBottom:$e}],children:[dt,ct]})})});BottomNavigation.displayName="BottomNavigation";const buildStyles=e=>_reactNative.StyleSheet.create({outer:{backgroundColor:"transparent"},dockedBar:{paddingHorizontal:e.space.xs},floatingBar:{paddingVertical:e.space.sm,paddingHorizontal:e.space.sm},tabRow:{flexDirection:"row",alignItems:"stretch",position:"relative"},tabRowInline:{flex:1},barInline:{flexDirection:"row",alignItems:"center"},accessoryStacked:{marginBottom:e.space.xs},accessoryInline:{flexShrink:0,marginRight:e.space.xs},tab:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center",paddingVertical:e.space.xs,gap:e.space.xs},tabTile:{paddingVertical:e.space.sm,gap:e.space.xxs},centerCell:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center"},centerPressable:{alignItems:"center",maxWidth:"100%",gap:e.space.xs},centerCircle:{alignItems:"center",justifyContent:"center"},iconWrap:{alignItems:"center",justifyContent:"center",position:"relative"},label:{fontSize:e.text.xs.size,lineHeight:e.text.xs.size*e.leading.heading,textAlign:"center",includeFontPadding:!1},labelInline:{fontSize:e.text.sm.size,lineHeight:e.text.sm.size*e.leading.heading,flexShrink:1,includeFontPadding:!1},expandPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:e.space.xs},expandFill:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"},pill:{position:"absolute",left:0},bubble:{position:"absolute",left:0,borderWidth:3},underline:{position:"absolute",left:0,height:3},underlineBottom:{borderTopLeftRadius:e.radius.none,borderTopRightRadius:e.radius.none,..._corners.smoothCorners},underlineTop:{borderBottomLeftRadius:e.radius.none,borderBottomRightRadius:e.radius.none,..._corners.smoothCorners},badgePillPosition:{position:"absolute",top:-4,right:-8},badgePill:{minWidth:18,height:18,paddingHorizontal:e.space.xs,paddingVertical:e.space.xxs,borderWidth:1.5},badgeDotPosition:{position:"absolute",top:-2,right:-2},badgeDot:{width:10,height:10,borderRadius:e.radius.pill,borderWidth:1.5},badgeText:{lineHeight:13}});var _default=exports.default=BottomNavigation;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_BOTTOM_NAVIGATION_LABELS=exports.BottomNavigation=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_shadows=require("../../utils/shadows.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index3=require("../AppIcon/index.js"),_index4=require("../Badge/index.js"),_index5=require("../Text/index.js"),_useScreenReaderEnabled=require("./useScreenReaderEnabled.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,a,n=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(a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((i=n&&Object.getOwnPropertyDescriptor(e,a))&&(i.get||i.set)?n(r,a,i):r[a]=e[a]);return r}const DEFAULT_BOTTOM_NAVIGATION_LABELS=exports.DEFAULT_BOTTOM_NAVIGATION_LABELS=Object.freeze({switchesTo:e=>`Switches to ${e}`,unread:e=>`${e} unread`,newUpdates:"new updates"}),DEFAULT_ICON_SIZE=18,DEFAULT_LABEL_MAX_FONT_SCALE=1.2,ICON_WRAP_AIR=4,PILL_AIR=8,DEFAULT_PILL_MAX_WIDTH=64,TILE_MAX_WIDTH=96,DEFAULT_UNDERLINE_HEIGHT=3,DEFAULT_BUBBLE_SIZE=48,DEFAULT_BUBBLE_LIFT=14,DEFAULT_CENTER_SIZE=48,DEFAULT_CENTER_ICON_SIZE=24,CENTER_KEY="__center_action__",EXPANDED_FLEX=1.5,SOLID_INACTIVE_OPACITY=.7,TILE_INSET=2,badgeVariantOf=e=>null==e||!1===e?null:!0===e||"·"===e?"dot":"number"==typeof e?e>0?"standard":null:e.length>0?"standard":null,badgeAccessibilitySuffix=(e,t)=>null==e||!1===e?"":"number"==typeof e?e>0?`, ${t.unread(e)}`:"":!0===e||"·"===e?`, ${t.newUpdates}`:"string"==typeof e&&e.length>0?`, ${e}`:"",BottomNavigation=exports.BottomNavigation=(0,_react.forwardRef)((e,t)=>{const{tabs:i,centerAction:a,activeTab:n,onChange:r,haptic:o="selection",showLabels:s=!0,variant:l="pill",indicatorPosition:d="bottom",radius:c,indicatorRadius:u="auto",elevation:p,iconSize:h,marginHorizontal:_,marginVertical:m,paddingHorizontal:g,paddingVertical:b,border:x,minimizeOnScroll:f=!1,scrollDirection:y="idle",accessory:v,style:R,indicatorStyle:N,labelStyle:j,labelMaxFontScale:w,labels:A,testID:S}=e;(0,_warnInvalidValue.warnInvalidValue)("BottomNavigation","variant",e.variant,["pill","underline","floating","bubble","expand","solid","tile"]),(0,_warnInvalidValue.warnInvalidValue)("BottomNavigation","indicatorPosition",e.indicatorPosition,["top","bottom"]);const I=(0,_react.useMemo)(()=>A?{...DEFAULT_BOTTOM_NAVIGATION_LABELS,...A}:DEFAULT_BOTTOM_NAVIGATION_LABELS,[A]),E=(0,_index.useTheme)(),T=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),L=(0,_react.useMemo)(()=>buildStyles(E),[E]),V=h??18,M=V+4+8,B=E.space.lg,C=E.space.lg,D=E.radius.xl,O=(0,_useReducedMotion.useReducedMotion)(),k=(0,_useScreenReaderEnabled.useScreenReaderEnabled)(f),[P,z]=_react.default.useState(null);(0,_react.useEffect)(()=>{null!==P&&P!==y&&z(null)},[P,y]);const F=f&&!k&&"down"===y&&null===P,[H,W]=_react.default.useState(F);(0,_react.useEffect)(()=>{H!==F&&(O||"web"===_reactNative.Platform.OS||_reactNative.LayoutAnimation.configureNext(_reactNative.LayoutAnimation.Presets.easeInEaseOut),W(F))},[H,F,O]);const q="function"==typeof v?v({minimized:H}):v,U=null!=q&&!1!==q,$=H&&U,[X,G]=_react.default.useState(0),Z=U&&!$?X+E.space.xs:0,Y="tile"===l,K="floating"===l||Y,J="bubble"===l,Q="expand"===l,ee="solid"===l,te="pill"===l||K||ee,ie=Math.max(0,i.findIndex(e=>e.key===n)),[ae,ne]=_react.default.useState(0),[re,oe]=_react.default.useState(0),se=a?Math.ceil(i.length/2):i.length,le=i.length+(a?1:0),[de,ce]=_react.default.useState({width:0,height:0}),ue=a?.size??48,pe=void 0!==a?.gap,he=Math.max(0,a?.gap??0),me=pe?(de.width||ue)+2*he:0,ge=pe?i.length>0?Math.max(0,ae-me)/i.length:0:le>0?ae/le:0,be=pe?me:ge,xe=(0,_react.useRef)((0,_index.createAnimatedValue)(ie)).current,fe=(0,_react.useRef)({}),ye=(0,_react.useRef)({});i.forEach(e=>{fe.current[e.key]||(fe.current[e.key]=new _reactNative.Animated.Value(1)),ye.current[e.key]||(ye.current[e.key]=(0,_index.createAnimatedValue)(e.key===n?1:0))});const ve=ge>0?Y?Math.min(ge-4,96):Math.min(ge-B,64):0,Re=ge>0?(ge-ve)/2:0,Ne=ge>0?(ge-48)/2:0,hasLabel=e=>s&&!H&&!1!==e.showLabel&&e.label.trim().length>0,je=i[ie],we=je&&!hasLabel(je)&&re>0?re/2:E.space.xs+(V+4)/2,Ae=we-14-24,Se=Math.max(0,re-4),Ie=Y?2:we-M/2,Ee=(0,_react.useRef)(ie);(0,_react.useEffect)(()=>{if(Ee.current===ie)return;Ee.current=ie;const e=_reactNative.Animated.spring(xe,{toValue:ie,tension:120,friction:14,useNativeDriver:!0});return e.start(),()=>e.stop()},[ie,xe]);const Te=Math.max(1,i.length-1),Le=(0,_react.useMemo)(()=>{const e=[],t=[];for(let i=0;i<=Te;i++)e.push(i),t.push(i<se?i*ge:i*ge+be);return xe.interpolate({inputRange:e,outputRange:t})},[xe,Te,se,ge,be]),Ve=i.map(e=>e.key).join(" "),Me=J||Q;(0,_react.useEffect)(()=>{const e=Ve.split(" ").flatMap(e=>{const t=e===n?1:0,i=ye.current[e];return i?Me?[_reactNative.Animated.spring(i,{toValue:t,tension:140,friction:13,useNativeDriver:!1})]:(i.setValue(t),[]):[]});if(0===e.length)return;const t=_reactNative.Animated.parallel(e);return t.start(),()=>t.stop()},[n,Ve,Me]);const popIcon=e=>{_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:1.15,duration:120,useNativeDriver:!0}),_reactNative.Animated.spring(e,{toValue:1,tension:200,friction:8,useNativeDriver:!0})]).start()},Be=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current,{colors:Ce}=E,De=ee?Ce.primary:Ce.surface,Oe=ee?Ce["on-primary"]:Ce.primary,ke=ee?Ce["on-primary"]:Y?Ce["text-body"]:Ce["text-subtle"],Pe=ee?Ce["on-primary"]:Ce["primary-soft"],ze=ee?Ce.primary:J?Ce["on-primary"]:Oe,Fe=_??C,He=m??(K?C:0),We=He>0,qe=b??E.space.sm,Ue=g??(K?E.space.sm:E.space.xs),$e=We?qe:Math.max(qe,T.bottom),Xe=We?Math.max(He,T.bottom>0?T.bottom+E.space.sm:0):0,Ge="pill"===c,Ze=K?re+Z+2*qe+2*_reactNative.StyleSheet.hairlineWidth:re+Z+qe+$e,Ye=Ge?re>0?Ze/2:E.radius.pill:c??(Y?E.radius.pill:K?D:E.radius.none),Ke=void 0!==c,activeBgRadius=(e,t)=>"number"==typeof u?Math.max(0,Math.min(u,e/2)):"auto"===u&&Ke?Math.min(Ye,e/2):t,Je="underline"===l?Math.max(Ue,Ge&&0===re?0:Ye):Ue,Qe=p??"none",et="none"===Qe?void 0:E.shadow[Qe],tt=void 0===et?null:(0,_shadows.supportsBoxShadow)()?{boxShadow:(0,_shadows.toBoxShadow)(et)}:et,it=x?_reactNative.StyleSheet.hairlineWidth:0,at=ee?Ce.primary:Ce.border,nt=a?.lift??0,rt=qe+it+Z,ot=a&&re>0?Math.max(0,(de.height||ue)/2+nt-re/2-rt):0,st=a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[L.centerCell,pe?{flex:0,marginHorizontal:he}:null],pointerEvents:"box-none",children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>{if(!a)return;const e=a.haptic??o;!1!==e&&(0,_index2.triggerHaptic)(e),popIcon(Be),a.onPress()},onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;ce(e=>e.width===t&&e.height===i?e:{width:t,height:i})},accessibilityRole:"button",accessibilityLabel:a.label,hitSlop:{top:6,bottom:6,left:6,right:6},...(0,_hitSlop.hitSlopMarker)({top:6,bottom:6,left:6,right:6}),style:({pressed:e})=>[L.centerPressable,{top:-nt},e?{opacity:.85}:null],testID:a.testID??(S?`${S}-center`:void 0),children:[a.content?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Be}]},children:a.content}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[L.centerCircle,{width:ue,height:ue,borderRadius:E.radius.pill,..._corners.smoothCorners,backgroundColor:a.color??Ce.primary}],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Be}]},children:(0,_index3.renderSlotIcon)(a.icon??"add",{color:a.iconColor??Ce["on-primary"],size:a.iconSize??24,disabled:!1})})}),(lt=a,s&&!H&&lt.label.trim().length>0?(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",numberOfLines:1,maxFontSizeMultiplier:w??E.settings.maxFontSizeMultiplier??1.2,style:[L.label,{color:ke,opacity:ee?.7:1},j],children:a.label}):null)]})},CENTER_KEY):null;var lt;const dt=U?(0,_jsxRuntime.jsx)(_reactNative.View,{style:$?L.accessoryInline:L.accessoryStacked,onLayout:e=>G(e.nativeEvent.layout.height),testID:S?`${S}-accessory`:void 0,children:q}):null,ct=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$?[L.tabRow,L.tabRowInline]:L.tabRow,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;ne(t),oe(i)},children:[te&&ve>0&&(!Y||Se>0)?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[L.pill,{width:ve,height:Y?Se:M,left:Re,top:Ie,backgroundColor:Pe,borderRadius:Y?activeBgRadius(Se,Se/2):activeBgRadius(M,E.radius.pill),..._corners.smoothCorners,transform:[{translateX:Le}]},N]}):null,J&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[L.bubble,E.shadow.elevated,{width:48,height:48,borderRadius:E.radius.pill,..._corners.smoothCorners,left:Ne,top:Ae,backgroundColor:Ce.primary,borderColor:Ce.surface,transform:[{translateX:Le}]},N]}):null,(ut=i.map(e=>{const t=e.key===n,i=t?Oe:ke,a=t?ze:ke,s="string"==typeof e.icon?{name:e.icon,variant:"bold"}:e.icon,l=t?e.activeIcon??s:e.icon,d=fe.current[e.key],c=ye.current[e.key],u=badgeVariantOf(e.badge??null),p=badgeAccessibilitySuffix(e.badge??null,I),h=ee&&!t?.7:1,_=J&&t||ee?Ce.primary:Ce.surface,m=hasLabel(e),g=m&&(!Q||t),b=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[L.iconWrap,{width:V+4,height:V+4,opacity:h,transform:[{scale:d}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_index3.renderSlotIcon)(l,{color:a,size:V,focused:t,disabled:!1})}),u?(0,_jsxRuntime.jsx)(_index4.Badge,{variant:u,value:"standard"===u?e.badge:void 0,tone:"danger",accessible:!1,style:"dot"===u?L.badgeDotPosition:L.badgePillPosition,badgeStyle:["dot"===u?L.badgeDot:L.badgePill,{borderColor:_}],textStyle:L.badgeText}):null]}),x=J?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{top:c.interpolate({inputRange:[0,1],outputRange:[0,-14]})},children:b}):b,f=g?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{numberOfLines:1,maxFontSizeMultiplier:w??E.settings.maxFontSizeMultiplier??1.2,style:[L.label,Q?L.labelInline:null,{color:i,opacity:Q?c:h,fontWeight:t?E.weight.semibold:E.weight.normal},j],children:e.label}):null,v=(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>(e=>{H&&z(y),e.key!==n&&!1!==o&&(0,_index2.triggerHaptic)(o);const t=fe.current[e.key];t&&popIcon(t),r(e.key)})(e),accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:`${e.label}${p}`,accessibilityHint:I.switchesTo(e.label),hitSlop:{top:6,bottom:6,left:6,right:6},...(0,_hitSlop.hitSlopMarker)({top:6,bottom:6,left:6,right:6}),style:({pressed:e})=>[L.tab,Y?L.tabTile:null,e?{opacity:.85}:null],testID:S?`${S}-tab-${e.key}`:void 0,children:Q?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[L.expandPill,{height:M,paddingHorizontal:t&&m?E.space.md:Math.max(0,(M-(V+4))/2)}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[L.expandFill,{borderRadius:activeBgRadius(M,M/2),..._corners.smoothCorners,backgroundColor:t?Ce["primary-soft"]:"transparent"},t?N:null]}),x,f]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[x,f]})},e.key);return Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{flex:c.interpolate({inputRange:[0,1],outputRange:[1,m?1.5:1]})},children:v},e.key):v}),st?[...ut.slice(0,se),st,...ut.slice(se)]:ut),"underline"===l&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[L.underline,"top"===d?L.underlineTop:L.underlineBottom,"top"===d?{top:-qe-Z}:{bottom:-qe},{width:ge,height:3,backgroundColor:Ce.primary,transform:[{translateX:Le}]},N]}):null]});var ut;return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,testID:S,accessibilityRole:"tablist",style:[L.outer,{paddingHorizontal:Fe,paddingTop:Math.max(He,ot),paddingBottom:Xe},R],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[K?L.floatingBar:L.dockedBar,$?L.barInline:null,tt,{backgroundColor:De,borderColor:at,borderRadius:Ye,..._corners.smoothCorners},K?{borderWidth:it,paddingHorizontal:Ue,paddingVertical:qe}:{borderTopWidth:it,borderBottomWidth:it,borderLeftWidth:it,borderRightWidth:it,paddingHorizontal:Je,paddingTop:qe,paddingBottom:$e}],children:[dt,ct]})})});BottomNavigation.displayName="BottomNavigation";const buildStyles=e=>_reactNative.StyleSheet.create({outer:{backgroundColor:"transparent"},dockedBar:{paddingHorizontal:e.space.xs},floatingBar:{paddingVertical:e.space.sm,paddingHorizontal:e.space.sm},tabRow:{flexDirection:"row",alignItems:"stretch",position:"relative"},tabRowInline:{flex:1},barInline:{flexDirection:"row",alignItems:"center"},accessoryStacked:{marginBottom:e.space.xs},accessoryInline:{flexShrink:0,marginRight:e.space.xs},tab:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center",paddingVertical:e.space.xs,gap:e.space.xs},tabTile:{paddingVertical:e.space.sm,gap:e.space.xxs},centerCell:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center"},centerPressable:{alignItems:"center",maxWidth:"100%",gap:e.space.xs},centerCircle:{alignItems:"center",justifyContent:"center"},iconWrap:{alignItems:"center",justifyContent:"center",position:"relative"},label:{fontSize:e.text.xs.size,lineHeight:e.text.xs.size*e.leading.heading,textAlign:"center",includeFontPadding:!1},labelInline:{fontSize:e.text.sm.size,lineHeight:e.text.sm.size*e.leading.heading,flexShrink:1,includeFontPadding:!1},expandPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:e.space.xs},expandFill:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"},pill:{position:"absolute",left:0},bubble:{position:"absolute",left:0,borderWidth:3},underline:{position:"absolute",left:0,height:3},underlineBottom:{borderTopLeftRadius:e.radius.none,borderTopRightRadius:e.radius.none,..._corners.smoothCorners},underlineTop:{borderBottomLeftRadius:e.radius.none,borderBottomRightRadius:e.radius.none,..._corners.smoothCorners},badgePillPosition:{position:"absolute",top:-4,right:-8},badgePill:{minWidth:18,height:18,paddingHorizontal:e.space.xs,paddingVertical:e.space.xxs,borderWidth:1.5},badgeDotPosition:{position:"absolute",top:-2,right:-2},badgeDot:{width:10,height:10,borderRadius:e.radius.pill,borderWidth:1.5},badgeText:{lineHeight:13}});var _default=exports.default=BottomNavigation;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_BUTTON_LABELS=exports.Button=void 0,exports.buttonLabelInk=buttonLabelInk,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_ariaState=require("../../utils/ariaState.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_BUTTON_LABELS=exports.DEFAULT_BUTTON_LABELS=Object.freeze({loading:"Loading"}),Button=exports.Button=(0,_react.forwardRef)((e,t)=>{const{label:r,variant:o,tone:s="primary",size:i,loading:n=!1,disabled:l=!1,fullWidth:a=!1,leftIcon:c,rightIcon:d,iconVariant:u,leftIconBadge:b=!1,haptic:g,rounded:_=!1,gradient:p,style:h,containerStyle:x,textStyle:m,pressAnimation:f,onPress:v,accessibilityLabel:y,accessibilityHint:S,accessibilityState:I,testID:j,onLayout:C,labels:L,...k}=e;(0,_warnInvalidValue.warnInvalidValue)("Button","variant",e.variant,["solid","soft","outline","ghost","link","glass"]),(0,_warnInvalidValue.warnInvalidValue)("Button","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Button","size",e.size,["xs","sm","md","lg","xl"]);const T=(0,_index.useTheme)(),w=T.settings.components.button,R=o??w?.defaultVariant??"solid",F=i??w?.defaultSize??"md",N=(0,_react.useMemo)(()=>({...DEFAULT_BUTTON_LABELS,...L}),[L]),q=!l&&!n,O={...I,disabled:!q,busy:n},V="link"===R,A=f??w?.defaultPressAnimation??(!V&&"scale"),B=(0,_usePressAnimation.usePressAnimation)({preset:A||"scale",enabled:!1!==A&&q}),P=(0,_useFlickGuard.useFlickGuard)(),z=(0,_react.useMemo)(()=>buildStyles(T),[T]),E=(0,_react.useMemo)(()=>(0,_index.resolveButtonSize)(T,F),[T,F]),W=(0,_react.useMemo)(()=>toneFor(T,s),[T,s]),D=(0,_react.useMemo)(()=>variantFor(T,R,W,l),[T,R,W,l]),U=(0,_react.useMemo)(()=>!p||l||"solid"!==R?null:"string"==typeof p?T.settings.gradients[p]??null:p,[p,l,R,T.settings.gradients]),H=_reactNative.StyleSheet.flatten(h)?.borderRadius,M=V?0:"number"==typeof H?H:_?T.radius.pill:E.radius,G=(0,_SquircleFill.useSquircle)(!U&&"link"!==R,M,C),K=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[X,Y]=(0,_react.useState)(0),[J,Q]=(0,_react.useState)(null),Z=V?e=>Y(e.nativeEvent.layout.width):void 0,$=y??r,ee="outline"===R||"ghost"===R,te=!ee&&!V,re={color:D.textColor,size:E.icon,disabled:l},oe=b&&!V&&Boolean(c),se=T.space.xs,ie=E["min-height"]-2*se-2*D.borderWidth,ne={color:D.badgeInk,size:E["badge-icon"],disabled:l},le=n?(0,_jsxRuntime.jsx)(_index2.Spinner,{variant:"circular",size:"sm",color:oe?D.badgeInk:D.textColor,accessibilityLabel:N.loading}):c?(0,_slotIcon.renderSlotIcon)(c,oe?ne:re,u):null,ae=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:z.contentRow,children:[oe?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[z.iconLeft,z.iconBadge,{width:ie,height:ie,borderRadius:ie/2,backgroundColor:D.badgeFill}],children:le}):le?(0,_jsxRuntime.jsx)(_reactNative.View,{style:z.iconLeft,children:le}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:Z,children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"label",weight:"semibold",numberOfLines:1,style:[z.label,{color:D.textColor,fontSize:E.text,lineHeight:Math.round(E.text*T.leading.body)},m],children:r}),V?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[z.linkUnderline,{backgroundColor:D.textColor,transform:[{translateX:K.interpolate({inputRange:[0,1],outputRange:[-X/2,0]})},{scaleX:K.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}),d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:z.iconRight,children:(0,_slotIcon.renderSlotIcon)(d,re,u)}):null]}),ce=V?null===J?LINK_HIT_SLOP:Math.max(LINK_HIT_SLOP,touchSlopFor(J)):touchSlopFor(E["min-height"]),de={top:ce,bottom:ce,left:V?LINK_HIT_SLOP:0,right:V?LINK_HIT_SLOP:0};return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[B.style,a?z.fullWidth:null,x],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:e=>{if(!q||P.isFlick(e))return;B.press();const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t),v?.(e)},onPressIn:e=>{P.onPressIn(e),B.pressIn(),V&&q&&(K.stopAnimation(),K.setValue(0),_reactNative.Animated.timing(K,{toValue:1,duration:T.motion.duration.slower,easing:_reactNative.Easing.bezier(...T.motion.ease.decelerate),useNativeDriver:!0}).start())},onPressOut:()=>{B.pressOut()},disabled:!q,hitSlop:de,...(0,_hitSlop.hitSlopMarker)(de),accessibilityRole:"button",accessibilityLabel:$,accessibilityHint:S,accessibilityState:O,...(0,_ariaState.ariaFromState)(O),testID:j,onLayout:e=>{G.onLayout(e),V&&Q(e.nativeEvent.layout.height)},style:({pressed:e})=>[z.base,{paddingHorizontal:V?0:E["padding-x"],paddingVertical:V?0:oe?se:E["padding-y"],paddingLeft:oe?se:void 0,minHeight:V?void 0:E["min-height"],borderRadius:M,..._corners.smoothCorners,backgroundColor:U||G.active?"transparent":D.backgroundColor,borderWidth:D.borderWidth,borderColor:G.active?"transparent":D.borderColor,opacity:n?.55:1,overflow:G.active||V?"visible":"hidden"},e&&ee&&!G.active?{backgroundColor:T.colors["surface-pressed"]}:null,a?z.fullWidth:null,h],...k,"aria-disabled":!q,"aria-busy":n,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[G.active&&G.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:G.size.width,height:G.size.height,radius:M,fill:e&&ee?T.colors["surface-pressed"]:D.backgroundColor,stroke:D.borderColor,strokeWidth:D.borderWidth}):null,U?(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:U,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:M,..._corners.smoothCorners}]}):null,e&&te?G.active&&G.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:G.size.width,height:G.size.height,radius:M,fill:D.pressedTint,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[z.pressedOverlay,{borderRadius:M,backgroundColor:D.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,ae]})})})});Button.displayName="Button";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"])};default: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},l=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"],...l};case"outline":return{backgroundColor:"transparent",borderColor:o?e.colors.border:r.outline,borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...l};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...l};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:o?e.colors["text-disabled"]:e.colors.link,pressedTint:e.colors["surface-pressed"],...l};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:1},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.DEFAULT_BUTTON_LABELS=exports.Button=void 0,exports.buttonLabelInk=buttonLabelInk,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_ariaState=require("../../utils/ariaState.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_BUTTON_LABELS=exports.DEFAULT_BUTTON_LABELS=Object.freeze({loading:"Loading"}),Button=exports.Button=(0,_react.forwardRef)((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,containerStyle:x,textStyle:m,pressAnimation:f,onPress:v,accessibilityLabel:y,accessibilityHint:S,accessibilityState:j,testID:I,onLayout:C,labels:L,...k}=e;(0,_warnInvalidValue.warnInvalidValue)("Button","variant",e.variant,["solid","soft","outline","ghost","link","glass"]),(0,_warnInvalidValue.warnInvalidValue)("Button","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("Button","size",e.size,["xs","sm","md","lg","xl"]);const w=(0,_index.useTheme)(),T=w.settings.components.button,F=o??T?.defaultVariant??"solid",R=i??T?.defaultSize??"md",N=(0,_react.useMemo)(()=>({...DEFAULT_BUTTON_LABELS,...L}),[L]),A=!a&&!n,V={...j,disabled:!A,busy:n},q="link"===F,O=f??T?.defaultPressAnimation??(!q&&"scale"),B=(0,_usePressAnimation.usePressAnimation)({preset:O||"scale",enabled:!1!==O&&A}),E=(0,_useFlickGuard.useFlickGuard)(),P=(0,_react.useMemo)(()=>buildStyles(w),[w]),z=(0,_react.useMemo)(()=>(0,_index.resolveButtonSize)(w,R),[w,R]),W=(0,_react.useMemo)(()=>toneFor(w,s),[w,s]),D=(0,_react.useMemo)(()=>variantFor(w,F,W,a),[w,F,W,a]),H=(0,_react.useMemo)(()=>!p||a||"solid"!==F?null:"string"==typeof p?w.settings.gradients[p]??null:p,[p,a,F,w.settings.gradients]),U=_reactNative.StyleSheet.flatten(h)?.borderRadius,M=q?0:"number"==typeof U?U:_?w.radius.pill:z.radius,G=(0,_SquircleFill.useSquircle)(!H&&"link"!==F,M,C),K=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[X,Y]=(0,_react.useState)(0),[J,Q]=(0,_react.useState)(null),Z=q?e=>Y(e.nativeEvent.layout.width):void 0,$=y??r,ee="outline"===F||"ghost"===F,te=!ee&&!q,re={color:D.textColor,size:z.icon,disabled:a},oe=b&&!q&&Boolean(c),se=w.space.xs,ie=z["min-height"]-2*se-2*D.borderWidth,ne={color:D.badgeInk,size:z["badge-icon"],disabled:a},ae=n?(0,_jsxRuntime.jsx)(_index2.Spinner,{variant:"circular",size:"sm",color:oe?D.badgeInk:D.textColor,accessibilityLabel:N.loading}):c?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(c,oe?ne:re,u)}):null,le=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:P.contentRow,children:[oe?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[P.iconLeft,P.iconBadge,{width:ie,height:ie,borderRadius:ie/2,backgroundColor:D.badgeFill}],children:ae}):ae?(0,_jsxRuntime.jsx)(_reactNative.View,{style:P.iconLeft,children:ae}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:Z,children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"label",weight:"semibold",numberOfLines:1,style:[P.label,{color:D.textColor,fontSize:z.text,lineHeight:Math.round(z.text*w.leading.body)},m],children:r}),q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[P.linkUnderline,{backgroundColor:D.textColor,transform:[{translateX:K.interpolate({inputRange:[0,1],outputRange:[-X/2,0]})},{scaleX:K.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}),d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:P.iconRight,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(d,re,u)}):null]}),ce=q?null===J?LINK_HIT_SLOP:Math.max(LINK_HIT_SLOP,touchSlopFor(J)):touchSlopFor(z["min-height"]),de={top:ce,bottom:ce,left:q?LINK_HIT_SLOP:0,right:q?LINK_HIT_SLOP:0};return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[B.style,l?P.fullWidth:null,x],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:e=>{if(!A||E.isFlick(e))return;B.press();const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t),v?.(e)},onPressIn:e=>{E.onPressIn(e),B.pressIn(),q&&A&&(K.stopAnimation(),K.setValue(0),_reactNative.Animated.timing(K,{toValue:1,duration:w.motion.duration.slower,easing:_reactNative.Easing.bezier(...w.motion.ease.decelerate),useNativeDriver:!0}).start())},onPressOut:()=>{B.pressOut()},disabled:!A,hitSlop:de,...(0,_hitSlop.hitSlopMarker)(de),accessibilityRole:"button",accessibilityLabel:$,accessibilityHint:S,accessibilityState:V,...(0,_ariaState.ariaFromState)(V),testID:I,onLayout:e=>{G.onLayout(e),q&&Q(e.nativeEvent.layout.height)},style:({pressed:e})=>[P.base,{paddingHorizontal:q?0:z["padding-x"],paddingVertical:q?0:oe?se:z["padding-y"],paddingLeft:oe?se:void 0,minHeight:q?void 0:z["min-height"],borderRadius:M,..._corners.smoothCorners,backgroundColor:H||G.active?"transparent":D.backgroundColor,borderWidth:D.borderWidth,borderColor:G.active?"transparent":D.borderColor,opacity:n?.55:1,overflow:G.active||q?"visible":"hidden"},e&&ee&&!G.active?{backgroundColor:w.colors["surface-pressed"]}:null,l?P.fullWidth:null,h],...k,"aria-disabled":!A,"aria-busy":n,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[G.active&&G.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:G.size.width,height:G.size.height,radius:M,fill:e&&ee?w.colors["surface-pressed"]:D.backgroundColor,stroke:D.borderColor,strokeWidth:D.borderWidth}):null,H?(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:H,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:M,..._corners.smoothCorners}]}):null,e&&te?G.active&&G.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:G.size.width,height:G.size.height,radius:M,fill:D.pressedTint,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[P.pressedOverlay,{borderRadius:M,backgroundColor:D.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,le]})})})});Button.displayName="Button";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"])};default: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:1},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.DEFAULT_CARD_LABELS=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("../../theme/index.js"),_corners=require("../../utils/corners.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"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_index2=require("../Skeleton/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,a,s=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(a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((i=s&&Object.getOwnPropertyDescriptor(e,a))&&(i.get||i.set)?s(r,a,i):r[a]=e[a]);return r}const BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],DEFAULT_CARD_LABELS=exports.DEFAULT_CARD_LABELS=Object.freeze({remove:"Remove",show:"Show",hide:"Hide",loading:"Loading"}),paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},Card=exports.Card=_react.default.memo((0,_react.forwardRef)((e,t)=>{const{children:i,variant:a,elevation:s="card",radius:r,padding:n,interactive:l=!1,pressAnimation:o="scale",bg:d,header:c,title:u,titleFont:h,lead:m,action:_,headerActions:x,collapsible:p=!1,collapsed:b,defaultCollapsed:g=!1,onCollapsedChange:j,collapsedSummary:y,onRemove:v,separatorHeight:R=_reactNative.StyleSheet.hairlineWidth,footer:f,imageSource:S,imageHeight:w=160,imageAspectRatio:C,imageOverlay:A,loading:q=!1,gradient:F,onPress:I,haptic:N,contextMenu:L,accessibilityLabel:V,accessibilityHint:k,accessibilityRole:T,style:B,containerStyle:P,headerStyle:D,bodyStyle:M,footerStyle:z,testID:H,labels:E,onLayout:O,...W}=e;(0,_warnInvalidValue.warnInvalidValue)("Card","variant",e.variant,["elevated","outline","filled","flat"]),(0,_warnInvalidValue.warnInvalidValue)("Card","radius",e.radius,["sm","md","lg","xl","pill"]),(0,_warnInvalidValue.warnInvalidValue)("Card","padding",e.padding,["none","sm","md","lg","xl"]),(0,_warnInvalidValue.warnInvalidValue)("Card","titleFont",e.titleFont,["sans","serif"]),(0,_warnInvalidValue.warnInvalidValue)("Card","pressAnimation",e.pressAnimation,["scale","bounce","fade","sink","pulse","dim","false"]);const U=(0,_index.useTheme)(),G=U.settings.components.card,K=a??G?.defaultVariant??"elevated",$=r??G?.defaultRadius??"lg",J=n??G?.defaultPadding??"md",Q=h??G?.defaultTitleFont??"sans",X=(0,_react.useMemo)(()=>({...DEFAULT_CARD_LABELS,...E}),[E]),Y=l||"function"==typeof I,Z=(0,_useContextMenu.useContextMenu)(L,{haptic:N||!1,testID:H,accessibilityActions:W.accessibilityActions,onAccessibilityAction:W.onAccessibilityAction}),ee=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(t,Z.hostRef),[t,Z.hostRef]),te=Y||Z.enabled,{style:ie,pressIn:ae,pressOut:se}=(0,_usePressAnimation.usePressAnimation)({preset:o||"scale",enabled:te&&!1!==o}),re=stylesFor(U),ne=Boolean(S),le=U.space[paddingMap[J]],oe=(0,_react.useMemo)(()=>F?"string"==typeof F?U.settings.gradients[F]??null:F:null,[F,U.settings.gradients]),de="flat"===K,ce=de?U.radius.none:U.radius[$],ue=resolveBackground(U,d),[he,me]=(0,_useControllableState.useControllableState)({value:b,defaultValue:g,onChange:j}),xe=p&&he,pe=hasBuiltInHeaderContent(e),be=Boolean(c)||pe,ge=(0,_SquircleFill.useSquircle)(!ne&&!oe&&!de,ce,O),je=_reactNative.StyleSheet.flatten([P,B])??{},ye=je.backgroundColor,ve=je.borderColor,Re=ye??ue??("filled"===K?U.colors["bg-subtle"]:U.colors.surface),fe="outline"===K?U.size.border:0,Se=ve??U.colors.border,we="none"===s?void 0:U.shadow[s],Ce="elevated"===K&&(0,_shadows.supportsBoxShadow)()&&we?(0,_shadows.toBoxShadow)(we):void 0,Ae=ge.active&&"elevated"===K&&!Ce,qe=ge.active&&!Ae?{backgroundColor:"transparent",borderColor:"transparent"}:null,Fe=(0,_react.useMemo)(()=>{const e={borderRadius:Ae&&ge.size?(0,_squircle.squircleHostRadius)(ge.size.width,ge.size.height,ce):ce,..._corners.smoothCorners,padding:ne||ge.active?U.space.none:le,overflow:ge.active?"visible":"hidden"};switch(K){case"flat":return{...e,backgroundColor:ue??U.colors.surface,borderBottomWidth:R,borderBottomColor:U.colors.border};case"outline":return{...e,backgroundColor:ge.active?"transparent":ue??U.colors.surface,borderWidth:U.size.border,borderColor:ge.active?"transparent":U.colors.border};case"filled":return{...e,backgroundColor:ge.active?"transparent":ue??U.colors["bg-subtle"]};default:return{...e,backgroundColor:ue??U.colors.surface,...Ce?{boxShadow:Ce}:we}}},[U,K,we,ce,ne,le,ge.active,ge.size,Ce,Ae,ue,R]),Ie=(0,_react.useMemo)(()=>({..."number"==typeof C?{width:"100%",aspectRatio:C}:{width:"100%",height:w},borderTopLeftRadius:ce,borderTopRightRadius:ce,borderBottomLeftRadius:U.radius.none,borderBottomRightRadius:U.radius.none,..._corners.smoothCorners}),[U,ce,C,w]),Ne=u??"",Le=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:re.titleColumn,children:[u?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"title",accessibilityRole:"header",style:titleFaceFor(U,Q),children:u}):null,m?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",style:re.lead,children:m}):null,xe&&y?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",style:re.lead,children:y}):null]}),isCardTextAction(_)?(0,_jsxRuntime.jsx)(CardTextActionButton,{action:_,haptic:N}):_?(0,_jsxRuntime.jsx)(_reactNative.View,{style:re.actionNode,children:_}):null,x,p?(0,_jsxRuntime.jsx)(CardIconAction,{icon:xe?"chevron-down":"chevron-up",label:`${xe?X.show:X.hide} ${Ne}`.trim(),expanded:!xe,onPress:()=>me(!xe),haptic:N}):null,v?(0,_jsxRuntime.jsx)(CardIconAction,{icon:"trash",label:X.remove,onPress:v,color:U.colors["danger-text"],haptic:N}):null]}),Ve=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[re.header,!c&&re.headerRow,xe&&re.headerFolded,D],children:c??Le}):null,xe?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[be||f?re.body:null,M],children:i}),f&&!xe?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[re.footer,z],children:f}):null]}),ke=ne?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:re.imageWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:S,resizeMode:"cover",style:Ie,accessibilityLabel:"",accessible:!1}),A?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:re.imageOverlay,children:A}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{padding:le},children:Ve})]}):Ve,Te=oe?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:oe,style:_reactNative.StyleSheet.absoluteFill}),ke]}):ge.active&&ge.size?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ge.size.width,height:ge.size.height,radius:ce,fill:Re,stroke:fe?Se:void 0,strokeWidth:fe}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[re.squircleClip,{padding:le,borderRadius:ge.size?(0,_squircle.squircleHostRadius)(ge.size.width,ge.size.height,ce):ce}],children:ke})]}):ke;let Be;if(te){const handlePress=e=>{Y&&(N&&(0,_hapticUtils.triggerHaptic)(N),I?.(e))};Be=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:ie,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:ee,onPress:handlePress,onPressIn:ae,onPressOut:se,accessibilityRole:T??(Y?"button":void 0),accessibilityLabel:V,accessibilityHint:k,testID:H,onLayout:ge.onLayout,style:[Fe,P,B,qe],...W,...Z.hostProps,children:Te})})}else Be=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessibilityLabel:V,accessibilityHint:k,accessibilityRole:T,testID:H,onLayout:ge.onLayout,style:[Fe,P,B,qe],...W,children:Te});return q?(0,_jsxRuntime.jsx)(CardSkeleton,{...e}):Z.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Be,Z.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:[Fe,P,B,qe,re.preview],children:Te}))]}):Be}));Card.displayName="Card";const CardSkeleton=({variant:e,elevation:t,radius:i,padding:a,bg:s,header:r,footer:n,imageSource:l,imageHeight:o=160,imageAspectRatio:d,containerStyle:c,headerStyle:u,bodyStyle:h,footerStyle:m,style:_,labels:x,...p})=>{const b=(0,_index.useTheme)(),g=b.settings.components.card,j=e??g?.defaultVariant??"elevated",y=i??g?.defaultRadius??"lg",v=a??g?.defaultPadding??"md",R={...DEFAULT_CARD_LABELS,...x},f=paddingMap[v],S=b.space[f],w="flat"===j?b.radius.none:b.radius[y],C=void 0!==r||hasBuiltInHeaderContent(p),A=resolveBackground(b,s)??b.colors.surface,q="outline"===j?1:0,F="outline"===j?b.colors.border:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{backgroundColor:A,borderRadius:w,..._corners.smoothCorners,borderWidth:q,borderColor:F,overflow:"hidden"},c,_],accessibilityRole:"progressbar",accessibilityLabel:R.loading,accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==l?(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:"100%",height:d?void 0:o,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,C?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingBottom:b.space.sm},u],children:(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"60%",height:18})}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S},h],children:(0,_jsxRuntime.jsx)(_index2.SkeletonText,{lines:3,fontSize:b.text.base.size,lastLineWidth:"55%"})}),void 0!==n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingTop:b.space.sm,flexDirection:"row"},m],children:(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton",Card.Skeleton=CardSkeleton;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:a,color:s,haptic:r})=>{const n=(0,_index.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===a?void 0:{expanded:a},"aria-expanded":a,onPress:()=>{r&&(0,_hapticUtils.triggerHaptic)(r),i()},style:iconActionStyle,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,size:20,color:s??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)(_index3.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,_index.fontFor)(e,"semibold","display"):{fontFamily:void 0,...(0,_index.fontFor)(e,"semibold")},resolveBackground=(e,t)=>{if(null!=t)return BACKGROUND_TOKENS.includes(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:{flexGrow:1,overflow:"hidden",..._corners.smoothCorners},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.DEFAULT_CARD_LABELS=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("../../theme/index.js"),_corners=require("../../utils/corners.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"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_index2=require("../Skeleton/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index3=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 BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],DEFAULT_CARD_LABELS=exports.DEFAULT_CARD_LABELS=Object.freeze({remove:"Remove",show:"Show",hide:"Hide",loading:"Loading"}),paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},Card=exports.Card=_react.default.memo((0,_react.forwardRef)((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:h,lead:m,action:_,headerActions:x,collapsible:p=!1,collapsed:b,defaultCollapsed:g=!1,onCollapsedChange:j,collapsedSummary:y,onRemove:v,separatorHeight:R=_reactNative.StyleSheet.hairlineWidth,footer:f,imageSource:S,imageHeight:w=160,imageAspectRatio:C,imageOverlay:A,loading:q=!1,gradient:F,onPress:N,haptic:I,contextMenu:V,accessibilityLabel:L,accessibilityHint:k,accessibilityRole:T,style:B,containerStyle:P,headerStyle:D,bodyStyle:H,footerStyle:M,testID:z,labels:E,onLayout:O,...W}=e;(0,_warnInvalidValue.warnInvalidValue)("Card","variant",e.variant,["elevated","outline","filled","flat"]),(0,_warnInvalidValue.warnInvalidValue)("Card","radius",e.radius,["sm","md","lg","xl","pill"]),(0,_warnInvalidValue.warnInvalidValue)("Card","padding",e.padding,["none","sm","md","lg","xl"]),(0,_warnInvalidValue.warnInvalidValue)("Card","titleFont",e.titleFont,["sans","serif"]),(0,_warnInvalidValue.warnInvalidValue)("Card","pressAnimation",e.pressAnimation,["scale","bounce","fade","sink","pulse","dim","false"]);const U=(0,_index.useTheme)(),G=U.settings.components.card,K=s??G?.defaultVariant??"elevated",$=r??G?.defaultRadius??"lg",J=n??G?.defaultPadding??"md",Q=h??G?.defaultTitleFont??"sans",X=(0,_react.useMemo)(()=>({...DEFAULT_CARD_LABELS,...E}),[E]),Y=l||"function"==typeof N,Z=(0,_useContextMenu.useContextMenu)(V,{haptic:I||!1,testID:z,accessibilityActions:W.accessibilityActions,onAccessibilityAction:W.onAccessibilityAction}),ee=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(t,Z.hostRef),[t,Z.hostRef]),te=Y||Z.enabled,{style:ie,pressIn:se,pressOut:ae}=(0,_usePressAnimation.usePressAnimation)({preset:o||"scale",enabled:te&&!1!==o}),re=stylesFor(U),ne=Boolean(S),le=U.space[paddingMap[J]],oe=(0,_react.useMemo)(()=>F?"string"==typeof F?U.settings.gradients[F]??null:F:null,[F,U.settings.gradients]),de="flat"===K,ce=de?U.radius.none:U.radius[$],ue=resolveBackground(U,d),[he,me]=(0,_useControllableState.useControllableState)({value:b,defaultValue:g,onChange:j}),xe=p&&he,pe=hasBuiltInHeaderContent(e),be=Boolean(c)||pe,ge=(0,_SquircleFill.useSquircle)(!ne&&!oe&&!de,ce,O),je=_reactNative.StyleSheet.flatten([P,B])??{},ye=je.backgroundColor,ve=je.borderColor,Re=ye??ue??("filled"===K?U.colors["bg-subtle"]:U.colors.surface),fe="outline"===K?U.size.border:0,Se=ve??U.colors.border,we="none"===a?void 0:U.shadow[a],Ce="elevated"===K&&(0,_shadows.supportsBoxShadow)()&&we?(0,_shadows.toBoxShadow)(we):void 0,Ae=ge.active&&"elevated"===K&&!Ce,qe=ge.active&&!Ae?{backgroundColor:"transparent",borderColor:"transparent"}:null,Fe=(0,_react.useMemo)(()=>{const e={borderRadius:Ae&&ge.size?(0,_squircle.squircleHostRadius)(ge.size.width,ge.size.height,ce):ce,..._corners.smoothCorners,padding:ne||ge.active?U.space.none:le,overflow:ge.active?"visible":"hidden"};switch(K){case"flat":return{...e,backgroundColor:ue??U.colors.surface,borderBottomWidth:R,borderBottomColor:U.colors.border};case"outline":return{...e,backgroundColor:ge.active?"transparent":ue??U.colors.surface,borderWidth:U.size.border,borderColor:ge.active?"transparent":U.colors.border};case"filled":return{...e,backgroundColor:ge.active?"transparent":ue??U.colors["bg-subtle"]};default:return{...e,backgroundColor:ue??U.colors.surface,...Ce?{boxShadow:Ce}:we}}},[U,K,we,ce,ne,le,ge.active,ge.size,Ce,Ae,ue,R]),Ne=(0,_react.useMemo)(()=>({..."number"==typeof C?{width:"100%",aspectRatio:C}:{width:"100%",height:w},borderTopLeftRadius:ce,borderTopRightRadius:ce,borderBottomLeftRadius:U.radius.none,borderBottomRightRadius:U.radius.none,..._corners.smoothCorners}),[U,ce,C,w]),Ie=u??"",Ve=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:re.titleColumn,children:[u?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"title",accessibilityRole:"header",style:titleFaceFor(U,Q),children:u}):null,m?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",style:re.lead,children:m}):null,xe&&y?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",style:re.lead,children:y}):null]}),isCardTextAction(_)?(0,_jsxRuntime.jsx)(CardTextActionButton,{action:_,haptic:I}):_?(0,_jsxRuntime.jsx)(_reactNative.View,{style:re.actionNode,children:_}):null,x,p?(0,_jsxRuntime.jsx)(CardIconAction,{icon:xe?"chevron-down":"chevron-up",label:`${xe?X.show:X.hide} ${Ie}`.trim(),expanded:!xe,onPress:()=>me(!xe),haptic:I}):null,v?(0,_jsxRuntime.jsx)(CardIconAction,{icon:"trash",label:X.remove,onPress:v,color:U.colors["danger-text"],haptic:I}):null]}),Le=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[re.header,!c&&re.headerRow,xe&&re.headerFolded,D],children:c??Ve}):null,xe?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[be||f?re.body:null,H],children:i}),f&&!xe?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[re.footer,M],children:f}):null]}),ke=ne?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:re.imageWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:S,resizeMode:"cover",style:Ne,accessibilityLabel:"",accessible:!1}),A?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:re.imageOverlay,children:A}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{padding:le},children:Le})]}):Le,Te=oe?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:oe,style:_reactNative.StyleSheet.absoluteFill}),ke]}):ge.active&&ge.size?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ge.size.width,height:ge.size.height,radius:ce,fill:Re,stroke:fe?Se:void 0,strokeWidth:fe}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[re.squircleClip,{padding:le,borderRadius:ge.size?(0,_squircle.squircleHostRadius)(ge.size.width,ge.size.height,ce):ce}],children:ke})]}):ke;let Be;if(te){const handlePress=e=>{Y&&(I&&(0,_hapticUtils.triggerHaptic)(I),N?.(e))};Be=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:ie,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:ee,onPress:handlePress,onPressIn:se,onPressOut:ae,accessibilityRole:T??(Y?"button":void 0),accessibilityLabel:L,accessibilityHint:k,testID:z,onLayout:ge.onLayout,style:[Fe,P,B,qe],...W,...Z.hostProps,children:Te})})}else Be=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessibilityLabel:L,accessibilityHint:k,accessibilityRole:T,testID:z,onLayout:ge.onLayout,style:[Fe,P,B,qe],...W,children:Te});return q?(0,_jsxRuntime.jsx)(CardSkeleton,{...e}):Z.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Be,Z.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:[Fe,P,B,qe,re.preview],children:Te}))]}):Be}));Card.displayName="Card";const CardSkeleton=({variant:e,elevation:t,radius:i,padding:s,bg:a,header:r,footer:n,imageSource:l,imageHeight:o=160,imageAspectRatio:d,containerStyle:c,headerStyle:u,bodyStyle:h,footerStyle:m,style:_,labels:x,...p})=>{const b=(0,_index.useTheme)(),g=b.settings.components.card,j=e??g?.defaultVariant??"elevated",y=i??g?.defaultRadius??"lg",v=s??g?.defaultPadding??"md",R={...DEFAULT_CARD_LABELS,...x},f=paddingMap[v],S=b.space[f],w="flat"===j?b.radius.none:b.radius[y],C=void 0!==r||hasBuiltInHeaderContent(p),A=resolveBackground(b,a)??b.colors.surface,q="outline"===j?1:0,F="outline"===j?b.colors.border:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{backgroundColor:A,borderRadius:w,..._corners.smoothCorners,borderWidth:q,borderColor:F,overflow:"hidden"},c,_],accessibilityRole:"progressbar",accessibilityLabel:R.loading,accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==l?(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:"100%",height:d?void 0:o,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,C?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingBottom:b.space.sm},u],children:(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"60%",height:18})}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S},h],children:(0,_jsxRuntime.jsx)(_index2.SkeletonText,{lines:3,fontSize:b.text.base.size,lastLineWidth:"55%"})}),void 0!==n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingTop:b.space.sm,flexDirection:"row"},m],children:(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton",Card.Skeleton=CardSkeleton;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,_index.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)(_index3.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,_index.fontFor)(e,"semibold","display"):{fontFamily:void 0,...(0,_index.fontFor)(e,"semibold")},resolveBackground=(e,t)=>{if(null!=t)return BACKGROUND_TOKENS.includes(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:{flexGrow:1,overflow:"hidden",..._corners.smoothCorners},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.DEFAULT_CHIP_LABELS=exports.Chip=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Skeleton/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_CHIP_LABELS=exports.DEFAULT_CHIP_LABELS=Object.freeze({remove:e=>`Remove ${e}`}),toneFor=(e,r)=>{switch(r){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,Chip=exports.Chip=(0,_react.forwardRef)((e,r)=>{const{label:t,count:s,selected:i=!1,selectionMode:o="single",onPress:l,onRemove:n,leftIcon:a,iconVariant:c,variant:d="soft",tone:u="neutral",size:p="md",disabled:m=!1,loading:h=!1,accessibilityLabel:x,haptic:b,style:y,textStyle:_,containerStyle:g,countStyle:f,closeButtonStyle:S,closeIconStyle:v,labels:I,removeTestID:C,testID:j}=e;(0,_warnInvalidValue.warnInvalidValue)("Chip","variant",e.variant,["solid","soft","outline"]),(0,_warnInvalidValue.warnInvalidValue)("Chip","tone",e.tone,["primary","neutral","success","warning","danger","info"]),(0,_warnInvalidValue.warnInvalidValue)("Chip","size",e.size,["sm","md"]),(0,_warnInvalidValue.warnInvalidValue)("Chip","selectionMode",e.selectionMode,["single","multiple","radio"]);const k=(0,_index.useTheme)(),w=(0,_react.useMemo)(()=>({...DEFAULT_CHIP_LABELS,...I}),[I]),L=!!l&&!m,R="radio"===o,B=!!l&&(!m||R),z=hasChipCount(s),{style:O,pressIn:P,pressOut:A}=(0,_usePressAnimation.usePressAnimation)({enabled:L}),V=(0,_react.useMemo)(()=>toneFor(k,u),[k,u]),M=(0,_react.useMemo)(()=>(0,_index.resolveChipSize)(k,p),[k,p]),T=Math.max(0,Math.ceil((44-M["min-height"])/2)),q=R?{top:T,bottom:T}:void 0,D="solid"===d,E="soft"===d,F=(()=>{if(E){const e=i?V.selectedOn:V.on,r=i?.24:.14;return(0,_color.tintOf)(e,r,i?V.selectedBg:V.base)}return i?D?V.selectedBg:"transparent":D?V.base:"transparent"})(),H=E?"transparent":i?V.selectedBorder:D?"transparent":V.border,N=m?k.colors["text-disabled"]:i?E?k.colors["text-body"]:V.selectedInk:V.ink,U=D||E?0:k.size.border,handlePress=()=>{if(!L)return;const e=(0,_hapticUtils.resolveHaptic)(b,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),l?.()},$=x??(z?`${t}, ${s}`:t),Y=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:M.gap},children:(0,_slotIcon.renderSlotIcon)(a,{color:N,size:M.icon,disabled:m},c)}):null,(0,_jsxRuntime.jsx)(_index3.Text,{variant:"label",weight:"medium",numberOfLines:1,style:[styles.label,{color:N,fontSize:M.text,lineHeight:Math.round(M.text*k.leading.body)},_],children:t??" "}),z?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",numberOfLines:1,style:[styles.count,{color:N,fontSize:Math.min(k.text.xs.size,M.text),marginLeft:k.space.xs},f],children:s}):null,n?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{m||(!1!==b&&(0,_hapticUtils.triggerHaptic)("impactLight"),n?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:w.remove(t),accessibilityState:{disabled:m},"aria-disabled":m,testID:C,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),style:({pressed:e})=>[styles.close,{width:M["close-size"],height:M["close-size"],borderRadius:M["close-size"]/2,..._corners.smoothCorners,marginLeft:M.gap,backgroundColor:e?k.colors["surface-pressed"]:k.colors["surface-hover"]},S],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"label",weight:"bold",maxFontSizeMultiplier:1,style:[{color:N,fontSize:M["close-text"],lineHeight:M["close-text"]+2},v],children:"×"})}):null]}),W={paddingHorizontal:M["padding-x"],paddingVertical:M["padding-y"],minHeight:M["min-height"],borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden",backgroundColor:F,borderWidth:U,borderColor:H,opacity:m?.55:1};let G;return G=B?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[O,{alignSelf:"flex-start",borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:r,onPress:handlePress,onPressIn:P,onPressOut:A,disabled:!L,accessibilityRole:R?"radio":"multiple"===o?"checkbox":"button",accessibilityLabel:$,accessibilityState:R||"multiple"===o?{checked:i,disabled:m}:{selected:i,disabled:m},"aria-checked":R||"multiple"===o?i:void 0,"aria-selected":R||"multiple"===o?void 0:i,"aria-disabled":m,hitSlop:q,...q?(0,_hitSlop.hitSlopMarker)(q):{},android_ripple:{color:k.colors["surface-pressed"],borderless:!1},testID:j,style:({pressed:e})=>[styles.base,W,e&&"outline"===d?{backgroundColor:k.colors["surface-pressed"]}:null,g,y],children:Y})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:r,style:[styles.base,W,g,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:$,accessibilityState:{selected:i,disabled:m},"aria-selected":i,"aria-disabled":m,testID:j,children:Y}),h?(0,_jsxRuntime.jsx)(ChipSkeleton,{...e}):G});Chip.displayName="Chip";const ChipSkeleton=({label:e,count:r,size:t="md",leftIcon:s,onRemove:i,style:o,containerStyle:l})=>{const n=(0,_index.useTheme)(),a=(0,_index.resolveChipSize)(n,t),c=Math.max(40,Math.min(120,7*(e??"").length)),d=a["min-height"],u=d/2,p=c+2*a["padding-x"]+(hasChipCount(r)?a.gap/2+7*String(r).length:0)+(void 0!==s?a.gap+14:0)+(void 0!==i?a.gap+a["close-size"]:0);return(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:p,height:d,radius:u,style:[{alignSelf:"flex-start"},l,o]})};ChipSkeleton.displayName="ChipSkeleton",Chip.Skeleton=ChipSkeleton;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.DEFAULT_CHIP_LABELS=exports.Chip=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Skeleton/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_CHIP_LABELS=exports.DEFAULT_CHIP_LABELS=Object.freeze({remove:e=>`Remove ${e}`}),toneFor=(e,r)=>{switch(r){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,Chip=exports.Chip=(0,_react.forwardRef)((e,r)=>{const{label:t,count:s,selected:i=!1,selectionMode:o="single",onPress:l,onRemove:n,leftIcon:a,iconVariant:c,variant:d="soft",tone:u="neutral",size:p="md",disabled:m=!1,loading:h=!1,accessibilityLabel:x,haptic:b,style:y,textStyle:_,containerStyle:g,countStyle:f,closeButtonStyle:S,closeIconStyle:v,labels:I,removeTestID:C,testID:j}=e;(0,_warnInvalidValue.warnInvalidValue)("Chip","variant",e.variant,["solid","soft","outline"]),(0,_warnInvalidValue.warnInvalidValue)("Chip","tone",e.tone,["primary","neutral","success","warning","danger","info"]),(0,_warnInvalidValue.warnInvalidValue)("Chip","size",e.size,["sm","md"]),(0,_warnInvalidValue.warnInvalidValue)("Chip","selectionMode",e.selectionMode,["single","multiple","radio"]);const k=(0,_index.useTheme)(),w=(0,_react.useMemo)(()=>({...DEFAULT_CHIP_LABELS,...I}),[I]),L=!!l&&!m,R="radio"===o,B=!!l&&(!m||R),z=hasChipCount(s),{style:A,pressIn:O,pressOut:P}=(0,_usePressAnimation.usePressAnimation)({enabled:L}),V=(0,_react.useMemo)(()=>toneFor(k,u),[k,u]),M=(0,_react.useMemo)(()=>(0,_index.resolveChipSize)(k,p),[k,p]),T=Math.max(0,Math.ceil((44-M["min-height"])/2)),q=R?{top:T,bottom:T}:void 0,D="solid"===d,E="soft"===d,F=(()=>{if(E){const e=i?V.selectedOn:V.on,r=i?.24:.14;return(0,_color.tintOf)(e,r,i?V.selectedBg:V.base)}return i?D?V.selectedBg:"transparent":D?V.base:"transparent"})(),H=E?"transparent":i?V.selectedBorder:D?"transparent":V.border,N=m?k.colors["text-disabled"]:i?E?k.colors["text-body"]:V.selectedInk:V.ink,U=D||E?0:k.size.border,handlePress=()=>{if(!L)return;const e=(0,_hapticUtils.resolveHaptic)(b,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),l?.()},$=x??(z?`${t}, ${s}`:t),Y=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:M.gap},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(a,{color:N,size:M.icon,disabled:m},c)}):null,(0,_jsxRuntime.jsx)(_index3.Text,{variant:"label",weight:"medium",numberOfLines:1,style:[styles.label,{color:N,fontSize:M.text,lineHeight:Math.round(M.text*k.leading.body)},_],children:t??" "}),z?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",numberOfLines:1,style:[styles.count,{color:N,fontSize:Math.min(k.text.xs.size,M.text),marginLeft:k.space.xs},f],children:s}):null,n?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{m||(!1!==b&&(0,_hapticUtils.triggerHaptic)("impactLight"),n?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:w.remove(t),accessibilityState:{disabled:m},"aria-disabled":m,testID:C,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),style:({pressed:e})=>[styles.close,{width:M["close-size"],height:M["close-size"],borderRadius:M["close-size"]/2,..._corners.smoothCorners,marginLeft:M.gap,backgroundColor:e?k.colors["surface-pressed"]:k.colors["surface-hover"]},S],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"label",weight:"bold",maxFontSizeMultiplier:1,style:[{color:N,fontSize:M["close-text"],lineHeight:M["close-text"]+2},v],children:"×"})}):null]}),W={paddingHorizontal:M["padding-x"],paddingVertical:M["padding-y"],minHeight:M["min-height"],borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden",backgroundColor:F,borderWidth:U,borderColor:H,opacity:m?.55:1};let G;return G=B?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[A,{alignSelf:"flex-start",borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:r,onPress:handlePress,onPressIn:O,onPressOut:P,disabled:!L,accessibilityRole:R?"radio":"multiple"===o?"checkbox":"button",accessibilityLabel:$,accessibilityState:R||"multiple"===o?{checked:i,disabled:m}:{selected:i,disabled:m},"aria-checked":R||"multiple"===o?i:void 0,"aria-selected":R||"multiple"===o?void 0:i,"aria-disabled":m,hitSlop:q,...q?(0,_hitSlop.hitSlopMarker)(q):{},android_ripple:{color:k.colors["surface-pressed"],borderless:!1},testID:j,style:({pressed:e})=>[styles.base,W,e&&"outline"===d?{backgroundColor:k.colors["surface-pressed"]}:null,g,y],children:Y})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:r,style:[styles.base,W,g,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:$,accessibilityState:{selected:i,disabled:m},"aria-selected":i,"aria-disabled":m,testID:j,children:Y}),h?(0,_jsxRuntime.jsx)(ChipSkeleton,{...e}):G});Chip.displayName="Chip";const ChipSkeleton=({label:e,count:r,size:t="md",leftIcon:s,onRemove:i,style:o,containerStyle:l})=>{const n=(0,_index.useTheme)(),a=(0,_index.resolveChipSize)(n,t),c=Math.max(40,Math.min(120,7*(e??"").length)),d=a["min-height"],u=d/2,p=c+2*a["padding-x"]+(hasChipCount(r)?a.gap/2+7*String(r).length:0)+(void 0!==s?a.gap+14:0)+(void 0!==i?a.gap+a["close-size"]:0);return(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:p,height:d,radius:u,style:[{alignSelf:"flex-start"},l,o]})};ChipSkeleton.displayName="ChipSkeleton",Chip.Skeleton=ChipSkeleton;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.default=exports.ChoiceGroup=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"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_RadioDot=require("../Radio/RadioDot.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeTokensOf=e=>({sm:{paddingHorizontal:e.space.sm,chipPaddingHorizontal:e.space.md,paddingVertical:e.space.xs,fontSize:e.text.sm.size,minHeight:32,iconSize:14},md:{paddingHorizontal:e.space.md,chipPaddingHorizontal:e.space.lg,paddingVertical:e.space.sm,fontSize:e.text.base.size,minHeight:40,iconSize:16},lg:{paddingHorizontal:e.space.lg,chipPaddingHorizontal:e.space.xl,paddingVertical:e.space.md,fontSize:e.text.lg.size,minHeight:48,iconSize:18}}),ChoiceGroup=exports.ChoiceGroup=(0,_react.forwardRef)((e,i)=>{const{options:t,getOptionLabel:r,getOptionValue:o,isOptionDisabled:a,getOptionDescription:n,getOptionIcon:l,getOptionColor:s,renderOption:c,variant:d="card",indicatorPosition:u="trailing",direction:p="row",gap:x,wrap:h=!1,fullWidth:g,disabled:_=!1,size:m="md",labelLines:b,descriptionLines:v=2,haptic:j,accessibilityLabel:f,style:y,optionStyle:z,description:w,helperText:C,error:R,testID:V}=e,S=(0,_index2.useTheme)(),H=(0,_react.useMemo)(()=>buildStyles(S),[S]),I=(0,_react.useMemo)(()=>sizeTokensOf(S)[m],[S,m]);(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","variant",e.variant,["card","chip"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","direction",e.direction,["row","column"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","indicatorPosition",e.indicatorPosition,["leading","trailing"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","selectionMode",e.selectionMode,["single","multiple"]);const T=(0,_react.useCallback)(e=>r?r(e):e.label??"",[r]),k=(0,_react.useCallback)(e=>o?o(e):e.value,[o]),D=(0,_react.useCallback)(e=>a?a(e):!0===e.disabled,[a]),O=(0,_react.useCallback)(e=>n?n(e):e.description,[n]),G=(0,_react.useCallback)(e=>l?l(e):e.icon,[l]),q=(0,_react.useCallback)(e=>s?s(e):e.color,[s]),L="multiple"===e.selectionMode,{min:M,max:P}=e,[N,W]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(L?[]:void 0),onChange:e.onChange}),B=Array.isArray(N)?N:[],F=(0,_react.useCallback)(e=>{const i=k(e);if(L){const e=B.includes(i);if(e&&null!=M&&B.length<=M)return;if(!e&&null!=P&&B.length>=P)return;const t=(0,_index3.resolveHaptic)(j,"selection");return t&&(0,_index3.triggerHaptic)(t),void W(e?B.filter(e=>e!==i):[...B,i])}const t=(0,_index3.resolveHaptic)(j,"selection");t&&(0,_index3.triggerHaptic)(t),W(i)},[j,L,M,P,B,W,k]),A=g??("card"===d&&"row"===p&&!h),$=h||A&&"row"===p,E=S.radius.md,surfaceFor=(e,i,t)=>i?{borderColor:S.colors.border,backgroundColor:S.colors["surface-disabled"]}:{borderColor:e?t:S.colors.border,backgroundColor:e?(0,_color.tintOf)(t,.12,S.colors["surface-selected"]):S.colors.bg},renderIcon=(e,i,t,r)=>{const o=G(e);if(null==o)return null;const a="string"==typeof o&&i?{name:o,variant:"bold"}:o;return(0,_slotIcon.renderSlotIcon)(a,{color:t,size:I.iconSize,disabled:r})},renderChip=e=>{const{option:i,selected:t,disabled:r,color:o}=e,a=r?S.colors["text-disabled"]:t?o:S.colors["text-body"],n=renderIcon(i,t,a,r);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[H.chip,{minHeight:I.minHeight,paddingHorizontal:I.chipPaddingHorizontal,paddingVertical:I.paddingVertical,borderRadius:S.radius.pill,..._corners.smoothCorners,borderWidth:S.size.border,...surfaceFor(t,r,o),columnGap:S.space.xs}],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{children:n}):null,(0,_jsxRuntime.jsx)(_index4.Text,{weight:"medium",numberOfLines:b,ellipsizeMode:"tail",style:[H.cardLabel,{color:a,fontSize:I.fontSize,lineHeight:Math.round(I.fontSize*S.leading.body)}],children:T(i)})]})},renderDefaultCard=e=>{const{option:i,selected:t,disabled:r,color:o}=e,a=q(i),n=r?S.colors["text-disabled"]:a??S.colors["text-body"],l=O(i),s=renderIcon(i,t,n,r),c=(0,_jsxRuntime.jsx)(_RadioDot.RadioDot,{selected:t,color:o,disabled:r,size:m});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[H.card,{minHeight:I.minHeight,paddingHorizontal:I.paddingHorizontal,paddingVertical:I.paddingVertical,borderRadius:E,..._corners.smoothCorners,borderWidth:S.size.border,...surfaceFor(t,r,o),columnGap:S.space.sm}],children:["leading"===u?c:null,s?(0,_jsxRuntime.jsx)(_reactNative.View,{children:s}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.cardTextWrap,children:[(0,_jsxRuntime.jsx)(_index4.Text,{weight:"medium",numberOfLines:b,ellipsizeMode:"tail",style:[H.cardLabel,{color:n,fontSize:I.fontSize,lineHeight:Math.round(I.fontSize*S.leading.body)}],children:T(i)}),l?(0,_jsxRuntime.jsx)(_index4.Text,{numberOfLines:v,ellipsizeMode:"tail",style:[H.cardDescription,{color:t?S.colors["text-muted"]:S.colors["text-subtle"],fontSize:S.text.xs.size,lineHeight:Math.round(S.text.xs.size*S.leading.body)}],children:l}):null]}),"trailing"===u?c:null]})},J="string"==typeof R&&""!==R?R:void 0,K=!0===R||void 0!==J?null:C,Q=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:i,accessibilityRole:L?void 0:"radiogroup",accessibilityLabel:f,accessibilityState:{disabled:_},"aria-disabled":_,testID:V,style:[{flexDirection:p,gap:x??S.space.sm,flexWrap:$?"wrap":"nowrap"},y],children:t.map((e,i)=>{const t=k(e),r=L?B.includes(t):N===t,o=L&&null!=P&&!r&&B.length>=P,a=_||o||D(e),n=q(e)??S.colors.primary,l=c||"card"!==d?void 0:O(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:e.testID,onPress:()=>{a||F(e)},disabled:a,accessibilityRole:L?"checkbox":"radio",accessibilityLabel:l?`${T(e)}, ${l}`:T(e),accessibilityState:{checked:r,disabled:a},"aria-checked":r,"aria-disabled":a,style:[A?H.stretchOption:null,{opacity:a&&c?.55:1},z],children:({pressed:t})=>{const o={option:e,index:i,selected:r,pressed:t&&!a,disabled:a,color:n};return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:c?c(o):"chip"===d?renderChip(o):renderDefaultCard(o)})}},String(t))})});return(0,_ChoiceText.hasChoiceDetail)({description:w,error:J,helperText:K??void 0})?(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[w?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",style:{marginBottom:S.space.xs},children:w}):null,Q,void 0!==J?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",style:{marginTop:S.space.xs},children:J}):K?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"tertiary",style:{marginTop:S.space.xs},children:K}):null]}):Q});ChoiceGroup.displayName="ChoiceGroup";const buildStyles=e=>_reactNative.StyleSheet.create({stretchOption:{flexGrow:1,flexShrink:0,flexBasis:"auto"},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flexGrow:1,flexShrink:1,flexBasis:"auto"},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:e.space.xxs}});var _default=exports.default=ChoiceGroup;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ChoiceGroup=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"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_RadioDot=require("../Radio/RadioDot.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeTokensOf=e=>({sm:{paddingHorizontal:e.space.sm,chipPaddingHorizontal:e.space.md,paddingVertical:e.space.xs,fontSize:e.text.sm.size,minHeight:32,iconSize:14},md:{paddingHorizontal:e.space.md,chipPaddingHorizontal:e.space.lg,paddingVertical:e.space.sm,fontSize:e.text.base.size,minHeight:40,iconSize:16},lg:{paddingHorizontal:e.space.lg,chipPaddingHorizontal:e.space.xl,paddingVertical:e.space.md,fontSize:e.text.lg.size,minHeight:48,iconSize:18}}),ChoiceGroup=exports.ChoiceGroup=(0,_react.forwardRef)((e,i)=>{const{options:t,getOptionLabel:r,getOptionValue:o,isOptionDisabled:n,getOptionDescription:a,getOptionIcon:l,getOptionColor:s,renderOption:d,variant:c="card",indicatorPosition:u="trailing",direction:p="row",gap:x,wrap:h=!1,fullWidth:m,disabled:g=!1,size:b="md",labelLines:_,descriptionLines:v=2,haptic:j,accessibilityLabel:f,style:y,optionStyle:z,description:w,helperText:C,error:R,testID:V}=e,S=(0,_index2.useTheme)(),H=(0,_react.useMemo)(()=>buildStyles(S),[S]),I=(0,_react.useMemo)(()=>sizeTokensOf(S)[b],[S,b]);(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","variant",e.variant,["card","chip"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","direction",e.direction,["row","column"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","indicatorPosition",e.indicatorPosition,["leading","trailing"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","selectionMode",e.selectionMode,["single","multiple"]);const T=(0,_react.useCallback)(e=>r?r(e):e.label??"",[r]),k=(0,_react.useCallback)(e=>o?o(e):e.value,[o]),D=(0,_react.useCallback)(e=>n?n(e):!0===e.disabled,[n]),O=(0,_react.useCallback)(e=>a?a(e):e.description,[a]),G=(0,_react.useCallback)(e=>l?l(e):e.icon,[l]),q=(0,_react.useCallback)(e=>s?s(e):e.color,[s]),L="multiple"===e.selectionMode,{min:M,max:P}=e,[N,F]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(L?[]:void 0),onChange:e.onChange}),W=Array.isArray(N)?N:[],A=(0,_react.useCallback)(e=>{const i=k(e);if(L){const e=W.includes(i);if(e&&null!=M&&W.length<=M)return;if(!e&&null!=P&&W.length>=P)return;const t=(0,_index3.resolveHaptic)(j,"selection");return t&&(0,_index3.triggerHaptic)(t),void F(e?W.filter(e=>e!==i):[...W,i])}const t=(0,_index3.resolveHaptic)(j,"selection");t&&(0,_index3.triggerHaptic)(t),F(i)},[j,L,M,P,W,F,k]),B=m??("card"===c&&"row"===p&&!h),E=h||B&&"row"===p,$=S.radius.md,surfaceFor=(e,i,t)=>i?{borderColor:S.colors.border,backgroundColor:S.colors["surface-disabled"]}:{borderColor:e?t:S.colors.border,backgroundColor:e?(0,_color.tintOf)(t,.12,S.colors["surface-selected"]):S.colors.bg},renderIcon=(e,i,t,r)=>{const o=G(e);if(null==o)return null;const n="string"==typeof o&&i?{name:o,variant:"bold"}:o;return(0,_slotIcon.renderSlotIcon)(n,{color:t,size:I.iconSize,disabled:r})},renderChip=e=>{const{option:i,selected:t,disabled:r,color:o}=e,n=r?S.colors["text-disabled"]:t?o:S.colors["text-body"],a=renderIcon(i,t,n,r);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[H.chip,{minHeight:I.minHeight,paddingHorizontal:I.chipPaddingHorizontal,paddingVertical:I.paddingVertical,borderRadius:S.radius.pill,..._corners.smoothCorners,borderWidth:S.size.border,...surfaceFor(t,r,o),columnGap:S.space.xs}],children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:a}):null,(0,_jsxRuntime.jsx)(_index4.Text,{weight:"medium",numberOfLines:_,ellipsizeMode:"tail",style:[H.cardLabel,{color:n,fontSize:I.fontSize,lineHeight:Math.round(I.fontSize*S.leading.body)}],children:T(i)})]})},renderDefaultCard=e=>{const{option:i,selected:t,disabled:r,color:o}=e,n=q(i),a=r?S.colors["text-disabled"]:n??S.colors["text-body"],l=O(i),s=renderIcon(i,t,a,r),d=(0,_jsxRuntime.jsx)(_RadioDot.RadioDot,{selected:t,color:o,disabled:r,size:b});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[H.card,{minHeight:I.minHeight,paddingHorizontal:I.paddingHorizontal,paddingVertical:I.paddingVertical,borderRadius:$,..._corners.smoothCorners,borderWidth:S.size.border,...surfaceFor(t,r,o),columnGap:S.space.sm}],children:["leading"===u?d:null,s?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:s}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.cardTextWrap,children:[(0,_jsxRuntime.jsx)(_index4.Text,{weight:"medium",numberOfLines:_,ellipsizeMode:"tail",style:[H.cardLabel,{color:a,fontSize:I.fontSize,lineHeight:Math.round(I.fontSize*S.leading.body)}],children:T(i)}),l?(0,_jsxRuntime.jsx)(_index4.Text,{numberOfLines:v,ellipsizeMode:"tail",style:[H.cardDescription,{color:t?S.colors["text-muted"]:S.colors["text-subtle"],fontSize:S.text.xs.size,lineHeight:Math.round(S.text.xs.size*S.leading.body)}],children:l}):null]}),"trailing"===u?d:null]})},J="string"==typeof R&&""!==R?R:void 0,K=!0===R||void 0!==J?null:C,Q=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:i,accessibilityRole:L?void 0:"radiogroup",accessibilityLabel:f,accessibilityState:{disabled:g},"aria-disabled":g,testID:V,style:[{flexDirection:p,gap:x??S.space.sm,flexWrap:E?"wrap":"nowrap"},y],children:t.map((e,i)=>{const t=k(e),r=L?W.includes(t):N===t,o=L&&null!=P&&!r&&W.length>=P,n=g||o||D(e),a=q(e)??S.colors.primary,l=d||"card"!==c?void 0:O(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:e.testID,onPress:()=>{n||A(e)},disabled:n,accessibilityRole:L?"checkbox":"radio",accessibilityLabel:l?`${T(e)}, ${l}`:T(e),accessibilityState:{checked:r,disabled:n},"aria-checked":r,"aria-disabled":n,style:[B?H.stretchOption:null,{opacity:n&&d?.55:1},z],children:({pressed:t})=>{const o={option:e,index:i,selected:r,pressed:t&&!n,disabled:n,color:a};return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:d?d(o):"chip"===c?renderChip(o):renderDefaultCard(o)})}},String(t))})});return(0,_ChoiceText.hasChoiceDetail)({description:w,error:J,helperText:K??void 0})?(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[w?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",style:{marginBottom:S.space.xs},children:w}):null,Q,void 0!==J?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",style:{marginTop:S.space.xs},children:J}):K?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"tertiary",style:{marginTop:S.space.xs},children:K}):null]}):Q});ChoiceGroup.displayName="ChoiceGroup";const buildStyles=e=>_reactNative.StyleSheet.create({stretchOption:{flexGrow:1,flexShrink:0,flexBasis:"auto"},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flexGrow:1,flexShrink:1,flexBasis:"auto"},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:e.space.xxs}});var _default=exports.default=ChoiceGroup;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.dayLabel=exports.DateSeparator=exports.DEFAULT_DATE_SEPARATOR_LABELS=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_DATE_SEPARATOR_LABELS=exports.DEFAULT_DATE_SEPARATOR_LABELS=Object.freeze({today:"Today",yesterday:"Yesterday"}),DAY_MS=864e5,dayLabel=(e,t={})=>{const r=(0,_mobileCore.formatDate)(e,{empty:""});if(!r)return"";const a={...DEFAULT_DATE_SEPARATOR_LABELS,...t.labels},o=t.now??new Date;return r===(0,_mobileCore.formatDate)(o)?a.today:r===(0,_mobileCore.formatDate)(new Date(o.getTime()-DAY_MS))?a.yesterday:r};exports.dayLabel=dayLabel;const DateSeparator=({date:e,label:t,emphasis:r=!1,labels:a,now:o,style:i,testID:s})=>{const l=(0,_index.useTheme)(),d=(0,_react.useMemo)(()=>buildStyles(l),[l]),c=t??(void 0===e?"":dayLabel(e,{now:o,labels:a})),n=r?l.colors.primary:l.colors["border-subtle"];return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[d.row,i],testID:s,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[d.rule,{backgroundColor:n}]}),(0,_jsxRuntime.jsx)(_index2.Text,{variant:"caption",weight:r?"semibold":"medium",color:r?void 0:"secondary",style:r?{color:l.colors["primary-text"]}:void 0,accessibilityRole:"header",children:c}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[d.rule,{backgroundColor:n}]})]})};exports.DateSeparator=DateSeparator;const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:e.space.sm,paddingVertical:e.space.sm},rule:{flex:1,height:_reactNative.StyleSheet.hairlineWidth}});var _default=exports.default=DateSeparator;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.dayLabel=exports.DateSeparator=exports.DEFAULT_DATE_SEPARATOR_LABELS=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_DATE_SEPARATOR_LABELS=exports.DEFAULT_DATE_SEPARATOR_LABELS=Object.freeze({today:"Today",yesterday:"Yesterday"}),DAY_MS=864e5,dayLabel=(e,t={})=>{const r=(0,_mobileCore.formatDate)(e,{empty:""});if(!r)return"";const a={...DEFAULT_DATE_SEPARATOR_LABELS,...t.labels},o=t.now??new Date;return r===(0,_mobileCore.formatDate)(o)?a.today:r===(0,_mobileCore.formatDate)(new Date(o.getTime()-DAY_MS))?a.yesterday:r};exports.dayLabel=dayLabel;const DateSeparator=({date:e,label:t,emphasis:r=!1,labels:a,now:o,style:i,testID:s})=>{const l=(0,_index.useTheme)(),d=(0,_react.useMemo)(()=>buildStyles(l),[l]),n=t??(void 0===e?"":dayLabel(e,{now:o,labels:a})),c=r?l.colors.primary:l.colors["border-subtle"];return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[d.row,i],testID:s,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[d.rule,{backgroundColor:c}]}),(0,_jsxRuntime.jsx)(_index2.Text,{variant:"caption",weight:r?"semibold":"medium",color:r?void 0:"secondary",style:r?{color:l.colors["primary-text"]}:void 0,children:n}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[d.rule,{backgroundColor:c}]})]})};exports.DateSeparator=DateSeparator;const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:e.space.sm,paddingVertical:e.space.sm},rule:{flex:1,height:_reactNative.StyleSheet.hairlineWidth}});var _default=exports.default=DateSeparator;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OverlayActions=exports.OVERLAY_TONES=exports.ACTIONS_LAYOUTS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_jsxRuntime=require("react/jsx-runtime");const OVERLAY_TONES=exports.OVERLAY_TONES=["primary","success","warning","danger","info","neutral"],ACTIONS_LAYOUTS=exports.ACTIONS_LAYOUTS=["auto","row","stacked"],OverlayActions=({actions:e,layout:r,testID:o,stackedLabels:t,rowStyle:n,buttonStyle:a,textStyle:l})=>{const s=(0,_index.useTheme)(),i=(0,_react.useMemo)(()=>buildStyles(s),[s]),c=s.components.dialog["action-button-min-height"],d=(0,_index.resolveButtonSize)(s,"md").icon,u=s.text.base.size*s.leading.body,b=e.map(e=>e.label).join("\n"),x=(0,_react.useState)(null),[y,_]=t??x,g="stacked"===r||"row"!==r&&(null!==y&&y===b),m=(0,_react.useRef)(null),p=(0,_react.useCallback)(e=>{e.nativeEvent.layout.height>1.5*u&&_(b)},[u,b,_]),C=(0,_react.useCallback)(e=>{const r=e.nativeEvent.layout.width,o=m.current;m.current=r,null!==o&&Math.abs(o-r)>.5&&_(null)},[_]),h=new Map;return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:o,style:[i.actionsRow,g?i.actionsRowStacked:null,n],onLayout:C,children:e.map((r,o)=>{const t=(h.get(r.label)??0)+1;h.set(r.label,t),(0,_warnInvalidValue.warnInvalidValue)("OverlayActions","actions[].tone",r.tone,OVERLAY_TONES);const n=r.tone??"primary",u=Boolean(r.disabled),b=actionStyleFor(s,n,u),x=o===e.length-1;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r.onPress,disabled:r.loading||u,accessibilityRole:"button",accessibilityLabel:r.label,accessibilityState:{busy:r.loading,disabled:Boolean(r.loading)||u},"aria-busy":r.loading,"aria-disabled":Boolean(r.loading)||u,style:({pressed:e})=>[i.actionButton,{flex:g?0:1,minHeight:c,backgroundColor:b.backgroundColor,borderColor:b.borderColor,borderWidth:b.borderWidth,borderRadius:s.radius.md,..._corners.smoothCorners,paddingVertical:s.space.sm,paddingHorizontal:s.space.md,marginRight:x||g?0:s.space.sm,opacity:r.loading?.7:e&&!u?.85:1},a],children:r.loading?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:b.textColor}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:i.labelRow,children:[r.icon?(0,_jsxRuntime.jsx)(_reactNative.View,{style:i.labelIcon,children:(0,_slotIcon.renderSlotIcon)(r.icon,{color:b.textColor,size:d,disabled:u},"linear")}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:p,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{color:b.textColor,fontSize:s.text.base.size,...(0,_index.fontFor)(s,"semibold"),textAlign:"center"},l],children:r.label})})]})},`${r.label}-${t}`)})})};exports.OverlayActions=OverlayActions,OverlayActions.displayName="OverlayActions";const actionStyleFor=(e,r,o)=>{if(o)return{backgroundColor:"neutral"===r?"transparent":e.colors["surface-disabled"],borderColor:"neutral"===r?e.colors.border:"transparent",borderWidth:"neutral"===r?1:0,textColor:e.colors["text-disabled"]};switch(r){case"primary":return{backgroundColor:e.colors.primary,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-primary"]};case"info":return{backgroundColor:e.colors.info,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-info"]};case"success":return{backgroundColor:e.colors.success,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-success"]};case"warning":return{backgroundColor:e.colors.warning,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-warning"]};case"danger":return{backgroundColor:e.colors.danger,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-danger"]};default:return{backgroundColor:"transparent",borderColor:e.colors.border,borderWidth:1,textColor:e.colors["text-body"]}}},buildStyles=e=>_reactNative.StyleSheet.create({actionsRow:{flexDirection:"row",justifyContent:"flex-end",alignItems:"stretch"},actionsRowStacked:{flexDirection:"column",rowGap:e.space.sm},actionButton:{alignItems:"center",justifyContent:"center"},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},labelIcon:{marginRight:e.space.xs}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OverlayActions=exports.OVERLAY_TONES=exports.ACTIONS_LAYOUTS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_jsxRuntime=require("react/jsx-runtime");const OVERLAY_TONES=exports.OVERLAY_TONES=["primary","success","warning","danger","info","neutral"],ACTIONS_LAYOUTS=exports.ACTIONS_LAYOUTS=["auto","row","stacked"],OverlayActions=({actions:e,layout:r,testID:o,stackedLabels:t,rowStyle:n,buttonStyle:a,textStyle:l})=>{const s=(0,_index.useTheme)(),i=(0,_react.useMemo)(()=>buildStyles(s),[s]),c=s.components.dialog["action-button-min-height"],d=(0,_index.resolveButtonSize)(s,"md").icon,u=s.text.base.size*s.leading.body,b=e.map(e=>e.label).join("\n"),x=(0,_react.useState)(null),[y,_]=t??x,g="stacked"===r||"row"!==r&&(null!==y&&y===b),m=(0,_react.useRef)(null),p=(0,_react.useCallback)(e=>{e.nativeEvent.layout.height>1.5*u&&_(b)},[u,b,_]),C=(0,_react.useCallback)(e=>{const r=e.nativeEvent.layout.width,o=m.current;m.current=r,null!==o&&Math.abs(o-r)>.5&&_(null)},[_]),h=new Map;return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:o,style:[i.actionsRow,g?i.actionsRowStacked:null,n],onLayout:C,children:e.map((r,o)=>{const t=(h.get(r.label)??0)+1;h.set(r.label,t),(0,_warnInvalidValue.warnInvalidValue)("OverlayActions","actions[].tone",r.tone,OVERLAY_TONES);const n=r.tone??"primary",u=Boolean(r.disabled),b=actionStyleFor(s,n,u),x=o===e.length-1;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r.onPress,disabled:r.loading||u,accessibilityRole:"button",accessibilityLabel:r.label,accessibilityState:{busy:r.loading,disabled:Boolean(r.loading)||u},"aria-busy":r.loading,"aria-disabled":Boolean(r.loading)||u,style:({pressed:e})=>[i.actionButton,{flex:g?0:1,minHeight:c,backgroundColor:b.backgroundColor,borderColor:b.borderColor,borderWidth:b.borderWidth,borderRadius:s.radius.md,..._corners.smoothCorners,paddingVertical:s.space.sm,paddingHorizontal:s.space.md,marginRight:x||g?0:s.space.sm,opacity:r.loading?.7:e&&!u?.85:1},a],children:r.loading?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:b.textColor}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:i.labelRow,children:[r.icon?(0,_jsxRuntime.jsx)(_reactNative.View,{style:i.labelIcon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(r.icon,{color:b.textColor,size:d,disabled:u},"linear")}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:p,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{color:b.textColor,fontSize:s.text.base.size,...(0,_index.fontFor)(s,"semibold"),textAlign:"center"},l],children:r.label})})]})},`${r.label}-${t}`)})})};exports.OverlayActions=OverlayActions,OverlayActions.displayName="OverlayActions";const actionStyleFor=(e,r,o)=>{if(o)return{backgroundColor:"neutral"===r?"transparent":e.colors["surface-disabled"],borderColor:"neutral"===r?e.colors.border:"transparent",borderWidth:"neutral"===r?1:0,textColor:e.colors["text-disabled"]};switch(r){case"primary":return{backgroundColor:e.colors.primary,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-primary"]};case"info":return{backgroundColor:e.colors.info,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-info"]};case"success":return{backgroundColor:e.colors.success,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-success"]};case"warning":return{backgroundColor:e.colors.warning,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-warning"]};case"danger":return{backgroundColor:e.colors.danger,borderColor:"transparent",borderWidth:0,textColor:e.colors["on-danger"]};default:return{backgroundColor:"transparent",borderColor:e.colors.border,borderWidth:1,textColor:e.colors["text-body"]}}},buildStyles=e=>_reactNative.StyleSheet.create({actionsRow:{flexDirection:"row",justifyContent:"flex-end",alignItems:"stretch"},actionsRowStacked:{flexDirection:"column",rowGap:e.space.sm},actionButton:{alignItems:"center",justifyContent:"center"},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},labelIcon:{marginRight:e.space.xs}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.IconButton=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_ariaState=require("../../utils/ariaState.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const GLASS_RIM_WIDTH=1,HIT_SLOP=6,SOFT_FILL_OPACITY=.14,SIZE_MAP={sm:{diameter:32,icon:16},md:{diameter:40,icon:20},lg:{diameter:48,icon:24}},toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"]};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"]};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"]};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"]};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"]};default:return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors.primary}}},IconButton=exports.IconButton=(0,_react.forwardRef)((e,r)=>{const{icon:o,iconVariant:s,onPress:t,accessibilityLabel:n,accessibilityHint:i,accessibilityState:a,tone:l="primary",variant:c="solid",size:d="md",shape:u="circle",active:b=!1,disabled:_=!1,loading:I=!1,haptic:m,style:g,testID:p}=e;(0,_warnInvalidValue.warnInvalidValue)("IconButton","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","variant",e.variant,["solid","soft","outline","ghost","glass"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","shape",e.shape,["circle","rounded"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","iconVariant",e.iconVariant,["linear","bold","broken","bulk","outline","twotone"]);const x=(0,_index.useTheme)(),f=SIZE_MAP[d],y=_||I,{style:v,pressIn:w,pressOut:h}=(0,_usePressAnimation.usePressAnimation)({scaleTo:.92,enabled:!y}),{base:S,outline:j,on:V,fg:P}=toneFor(x,l),q=b?"solid":c,B=b||!0===a?.selected,A={...a,disabled:y,selected:B};let R="transparent",O="transparent",z=0,C=y?x.colors["text-disabled"]:P;"solid"===q?(R=y?x.colors["surface-disabled"]:S,C=y?x.colors["text-disabled"]:V):"soft"===q?R=y?x.colors["surface-disabled"]:(0,_color.tintOf)(S,.14,x.colors["bg-subtle"]):"outline"===q?(O=y?x.colors.border:j,z=x.size.border):"glass"===q&&(R=x.colors["glass-fill"],O=x.colors["glass-border"],z=1,C=y?x.colors["text-disabled"]:x.colors["on-glass"]);const H={color:C,size:f.icon,disabled:y},L="circle"===u?f.diameter/2:x.radius.md;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:r,onPress:e=>{if(y)return;const r=(0,_index2.resolveHaptic)(m,"selection");r&&(0,_index2.triggerHaptic)(r),t?.(e)},onPressIn:w,onPressOut:h,disabled:y,accessibilityRole:"button",accessibilityLabel:n,accessibilityHint:i,accessibilityState:A,...(0,_ariaState.ariaFromState)(A),"aria-disabled":y,"aria-selected":B,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),testID:p,style:({pressed:e})=>[styles.base,{width:f.diameter,height:f.diameter,borderRadius:L,..._corners.smoothCorners,backgroundColor:R,borderColor:O,borderWidth:z,opacity:e&&"solid"!==q?.7:1},g],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.content,v],children:I?(0,_jsxRuntime.jsx)(_index3.Spinner,{size:"sm",color:C}):(0,_slotIcon.renderSlotIcon)(o,H,s)})})});IconButton.displayName="IconButton";const styles=_reactNative.StyleSheet.create({base:{alignItems:"center",justifyContent:"center"},content:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=IconButton;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.IconButton=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_ariaState=require("../../utils/ariaState.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const GLASS_RIM_WIDTH=1,HIT_SLOP=6,SOFT_FILL_OPACITY=.14,SIZE_MAP={sm:{diameter:32,icon:16},md:{diameter:40,icon:20},lg:{diameter:48,icon:24}},toneFor=(e,s)=>{switch(s){case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"]};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"]};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"]};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"]};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"]};default:return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors.primary}}},IconButton=exports.IconButton=(0,_react.forwardRef)((e,s)=>{const{icon:o,iconVariant:r,onPress:t,accessibilityLabel:n,accessibilityHint:i,accessibilityState:a,tone:l="primary",variant:c="solid",size:d="md",shape:u="circle",active:b=!1,disabled:_=!1,loading:I=!1,haptic:m,style:g,testID:p}=e;(0,_warnInvalidValue.warnInvalidValue)("IconButton","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","variant",e.variant,["solid","soft","outline","ghost","glass"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","shape",e.shape,["circle","rounded"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","iconVariant",e.iconVariant,["linear","bold","broken","bulk","outline","twotone"]);const x=(0,_index.useTheme)(),f=SIZE_MAP[d],y=_||I,{style:v,pressIn:h,pressOut:w}=(0,_usePressAnimation.usePressAnimation)({scaleTo:.92,enabled:!y}),{base:S,outline:j,on:V,fg:P}=toneFor(x,l),q=b?"solid":c,A=b||!0===a?.selected,B={...a,disabled:y,selected:A};let R="transparent",H="transparent",O=0,z=y?x.colors["text-disabled"]:P;"solid"===q?(R=y?x.colors["surface-disabled"]:S,z=y?x.colors["text-disabled"]:V):"soft"===q?R=y?x.colors["surface-disabled"]:(0,_color.tintOf)(S,.14,x.colors["bg-subtle"]):"outline"===q?(H=y?x.colors.border:j,O=x.size.border):"glass"===q&&(R=x.colors["glass-fill"],H=x.colors["glass-border"],O=1,z=y?x.colors["text-disabled"]:x.colors["on-glass"]);const C={color:z,size:f.icon,disabled:y},F="circle"===u?f.diameter/2:x.radius.md;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:s,onPress:e=>{if(y)return;const s=(0,_index2.resolveHaptic)(m,"selection");s&&(0,_index2.triggerHaptic)(s),t?.(e)},onPressIn:h,onPressOut:w,disabled:y,accessibilityRole:"button",accessibilityLabel:n,accessibilityHint:i,accessibilityState:B,...(0,_ariaState.ariaFromState)(B),"aria-disabled":y,"aria-selected":A,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),testID:p,style:({pressed:e})=>[styles.base,{width:f.diameter,height:f.diameter,borderRadius:F,..._corners.smoothCorners,backgroundColor:R,borderColor:H,borderWidth:O,opacity:e&&"solid"!==q?.7:1},g],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.content,v],accessibilityElementsHidden:!I,importantForAccessibility:I?"auto":"no-hide-descendants","aria-hidden":!I,children:I?(0,_jsxRuntime.jsx)(_index3.Spinner,{size:"sm",color:z}):(0,_slotIcon.renderSlotIcon)(o,C,r)})})});IconButton.displayName="IconButton";const styles=_reactNative.StyleSheet.create({base:{alignItems:"center",justifyContent:"center"},content:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=IconButton;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=exports.DEFAULT_INPUT_LABELS=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"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Button/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_LABELS=exports.DEFAULT_INPUT_LABELS={showPassword:"Show password",hidePassword:"Hide password"},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:l,onChangeText:s,error:r,helperText:o,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:x=!1,multiline:p=!1,leftIcon:_,rightIcon:f,unit:m,unitStyle:g,prefix:v,prefixStyle:h,readOnly:y=!1,action:j,actionStyle:b,size:I="md",variant:w,labelMode:S,required:R=!1,maxLength:N,showCounter:T=!0,textAlign:F,format:V,parse:A,style:L,containerStyle:B,inputStyle:P,labelStyle:k,messageStyle:z,radius:q,onFocus:D,onBlur:C,accessibilityLabel:E,labels:H,testID:M,editable:O,...U}=e;(0,_warnInvalidValue.warnInvalidValue)("Input","variant",w,["outline","filled","underline"]),(0,_warnInvalidValue.warnInvalidValue)("Input","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Input","labelMode",S,["float","top"]),(0,_warnInvalidValue.warnInvalidValue)("Input","type",e.type,["input","password","textarea"]);const G=(0,_react.useMemo)(()=>({...DEFAULT_INPUT_LABELS,...H}),[H]),W=(0,_index2.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(W),[W]),X=(0,_index2.resolveFieldSize)(W,I),J=W.components.input[I]["multiline-min-height"],K=Math.round(X.text*W.leading.body),Q=w??W.settings.components.input?.defaultVariant??W.settings.components.field?.defaultVariant??"outline",Y=S??W.settings.components.input?.defaultLabelMode??"top",[Z,ee]=(0,_react.useState)(!1),[te,ie]=(0,_react.useState)(!1),ne="password"===d||u||c,ae="password"===d||u,le="textarea"===d||p,se=le?Math.round(.1*X.text):0,re="string"==typeof l&&l.length>0,oe=(0,_FieldBase.hasFieldText)(r),de=!0===r||oe,ce=(0,_FieldBase.hasFieldText)(o),ue=oe||!de&&ce,xe=(0,_FieldBase.hasFieldText)(i),pe=(0,_FieldBase.hasFieldText)(v),fe=!x&&!1!==O,me=Z||re||pe,ge=(0,_react.useRef)(null),ve=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(ge,t),[t]),he=(0,_react.useCallback)(()=>{fe&&ge.current?.focus()},[fe]),ye=xe&&"float"===Y,je=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,be=(0,_react.useRef)((0,_index2.createAnimatedValue)(ue?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(be,{toValue:ue?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.ease["in-out"]),useNativeDriver:!0});return e.start(),()=>e.stop()},[ue,be,W.motion.duration.fast,W.motion.ease["in-out"]]);const Ie=(0,_index.useReducedMotion)(),we=W.settings.components.input?.shakeOnError??!1,Se=(0,_react.useRef)(de);(0,_react.useEffect)(()=>{if(!we)return void(Se.current=de);let e;return de&&!Se.current&&(Ie||((0,_index2.setNativeValue)(je,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:0,duration:100,useNativeDriver:!0})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),Se.current=de,()=>e?.stop()},[de,je,we,Ie]);const Re=(0,_react.useCallback)(e=>{ee(!0),D?.(e)},[D]),Ne=(0,_react.useCallback)(e=>{ee(!1),C?.(e)},[C]),Te=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ie(e=>!e)},[]),Fe=W.colors["field-caret"],Ve=W.settings.components.input?.tintLabelOnFocus??!1,Ae=Z&&Ve?W.colors["field-border-focus"]:W.colors["field-label"],Le=je.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Be=Boolean(f)||Boolean(m)||ae,Pe="underline"===Q,ke=_?X.icon+W.space.md+1+W.space.md:0,ze=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ye,floated:me,required:R,variant:Q,sizeTokens:X,leadingOffset:ke,trailingOffset:Be?X.icon+W.space.sm:0,textAlign:F,paddingLeft:Pe?W.space.none:X["padding-x"],lineHeight:le?K:void 0,restNudge:se,floatTrim:le?2:0,color:Ae,style:k}),qe=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:x}),De=qe.color,Ce=qe.placeholderColor,Ee=R&&!xe&&!re&&"string"==typeof a&&a.length>0,He=de?r:o,Me=T&&"number"==typeof N&&"string"==typeof l?`${l.length} / ${N}`:null,Oe=de?W.colors["field-message"]:W.colors["text-muted"],Ue=(0,_textInk.useTextInk)(z,X["message-text"],Oe),Ge=E??(0,_FieldBase.fieldTextAsString)(i)??a,We=x?W.colors["field-icon-disabled"]:Z?W.colors["field-icon-focus"]:W.colors["field-icon"],$e={focused:Z,disabled:x,error:de,color:We,size:X.icon},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ae){const e=(te?W.settings.icons.eyeOff:W.settings.icons.eye)??(te?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Te,disabled:!fe,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:te?G.hidePassword:G.showPassword,children:e({size:X.icon,color:We})})}const e=m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.unit,{fontSize:X.text,color:Ce},g],children:m}):null,t=f?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(f)}):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.trailingRow,children:[e,t]}):e??t})(),Je=_?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(_)}):null,Ke=_reactNative.StyleSheet.flatten(h),Qe=Ke?.fontSize??X.text,Ye=Ke?.color??Ce,Ze=(0,_react.useMemo)(()=>({fontSize:Qe,color:Ye}),[Qe,Ye]),et=pe?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,marginRight:W.space.xs,lineHeight:le?K:void 0,paddingTop:le?se:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{marginRight:W.space.xs,minHeight:le?K:void 0,justifyContent:"center",paddingTop:le?se:void 0}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,lineHeight:le?K:void 0},h],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ze,children:v})})}):null,tt=j?(0,_jsxRuntime.jsx)(_index4.Button,{variant:j.variant??"outline",tone:j.tone??"primary",size:I,label:j.label,leftIcon:j.icon,loading:j.loading,disabled:x||j.disabled,onPress:j.onPress,pressAnimation:!1,testID:j.testID,style:[$.action,{minHeight:X["min-height"],alignSelf:le?"flex-start":"stretch"},b]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.container,{transform:[{translateX:Le}]},L],children:[xe&&!ye?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:I,required:R,help:n,color:Ae,style:k,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.fieldRow,{columnGap:W.space.sm,alignItems:le?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:I,variant:Q,focused:Z,disabled:x,error:de,filled:re,minHeight:le?J:void 0,radius:q,leading:Je,leadingDivider:null!=_,paddingLeft:Pe?W.space.none:void 0,trailing:Xe,slotAlign:le?"top":"center",slotLineHeight:le?K:void 0,topNotch:ze.topNotch,onPress:he,pressFeedback:!1,style:B,children:[et,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ve,style:[$.input,{color:De,fontSize:X.text,...qe.weightStyle,paddingLeft:Pe?W.space.none:void 0,minHeight:le?J-2*X["padding-y"]:void 0,lineHeight:le?K:void 0,paddingTop:le?se:void 0,textAlignVertical:le?"top":"center"},P],textAlign:F,placeholder:ye&&!me||Ee?void 0:a,placeholderTextColor:Ce,value:V&&null!=l?V(l):l,onChangeText:e=>{s&&s(A?A(e):e)},onFocus:Re,onBlur:Ne,editable:fe,readOnly:y,secureTextEntry:ne&&!te,multiline:le,autoCapitalize:ne?"none":void 0,autoCorrect:!ne&&void 0,maxLength:N,selectionColor:Fe,accessibilityLabel:Ge,accessibilityState:{disabled:x},"aria-disabled":x,testID:M,...U}),Ee?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:Ce,fontSize:X.text,weightStyle:qe.weightStyle,align:le?"top":"center",paddingTop:le?se:void 0,textAlign:F}):null]})]}),ze.node]}),tt]}),ue||Me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.footerRow,{marginTop:X["message-gap"]}],children:[ue?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.messageRow,{columnGap:W.space.xs,opacity:be}],accessibilityLiveRegion:de?"polite":"none",children:[de?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:X["message-text"],color:Oe}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.messageText,{color:Oe,fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")},z],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ue,children:He})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:$.footerSpacer}),Me?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.counterText,{color:W.colors["text-subtle"],fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")}],children:Me}):null]}):null]})});Input.displayName="Input";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},fieldRow:{flexDirection:"row"},fieldWrapper:{position:"relative",overflow:"visible",flex:1},action:{flexShrink:0},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"},unit:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center",columnGap:e.space.sm},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},footerSpacer:{flex:1},messageRow:{flex:1,flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1},counterText:{flexShrink:0,includeFontPadding:!1}});var _default=exports.default=Input;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=exports.DEFAULT_INPUT_LABELS=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"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Button/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_LABELS=exports.DEFAULT_INPUT_LABELS={showPassword:"Show password",hidePassword:"Hide password"},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:l,onChangeText:s,error:r,helperText:o,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:x=!1,multiline:p=!1,leftIcon:_,rightIcon:f,unit:g,unitStyle:m,prefix:v,prefixStyle:h,readOnly:y=!1,action:j,actionStyle:I,size:b="md",variant:w,labelMode:S,required:R=!1,maxLength:N,showCounter:T=!0,textAlign:F,format:V,parse:A,style:L,containerStyle:B,inputStyle:P,labelStyle:k,messageStyle:z,radius:q,onFocus:D,onBlur:C,accessibilityLabel:E,labels:H,testID:M,editable:O,...U}=e;(0,_warnInvalidValue.warnInvalidValue)("Input","variant",w,["outline","filled","underline"]),(0,_warnInvalidValue.warnInvalidValue)("Input","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Input","labelMode",S,["float","top"]),(0,_warnInvalidValue.warnInvalidValue)("Input","type",e.type,["input","password","textarea"]);const G=(0,_react.useMemo)(()=>({...DEFAULT_INPUT_LABELS,...H}),[H]),W=(0,_index2.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(W),[W]),X=(0,_index2.resolveFieldSize)(W,b),J=W.components.input[b]["multiline-min-height"],K=Math.round(X.text*W.leading.body),Q=w??W.settings.components.input?.defaultVariant??W.settings.components.field?.defaultVariant??"outline",Y=S??W.settings.components.input?.defaultLabelMode??"top",[Z,ee]=(0,_react.useState)(!1),[te,ie]=(0,_react.useState)(!1),ne="password"===d||u||c,ae="password"===d||u,le="textarea"===d||p,se=le?Math.round(.1*X.text):0,re="string"==typeof l&&l.length>0,oe=(0,_FieldBase.hasFieldText)(r),de=!0===r||oe,ce=(0,_FieldBase.hasFieldText)(o),ue=oe||!de&&ce,xe=(0,_FieldBase.hasFieldText)(i),pe=(0,_FieldBase.hasFieldText)(v),fe=!x&&!1!==O,ge=Z||re||pe,me=(0,_react.useRef)(null),ve=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(me,t),[t]),he=(0,_react.useCallback)(()=>{fe&&me.current?.focus()},[fe]),ye=xe&&"float"===Y,je=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,Ie=(0,_react.useRef)((0,_index2.createAnimatedValue)(ue?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(Ie,{toValue:ue?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.ease["in-out"]),useNativeDriver:!0});return e.start(),()=>e.stop()},[ue,Ie,W.motion.duration.fast,W.motion.ease["in-out"]]);const be=(0,_index.useReducedMotion)(),we=W.settings.components.input?.shakeOnError??!1,Se=(0,_react.useRef)(de);(0,_react.useEffect)(()=>{if(!we)return void(Se.current=de);let e;return de&&!Se.current&&(be||((0,_index2.setNativeValue)(je,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:0,duration:100,useNativeDriver:!0})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),Se.current=de,()=>e?.stop()},[de,je,we,be]);const Re=(0,_react.useCallback)(e=>{ee(!0),D?.(e)},[D]),Ne=(0,_react.useCallback)(e=>{ee(!1),C?.(e)},[C]),Te=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ie(e=>!e)},[]),Fe=W.colors["field-caret"],Ve=W.settings.components.input?.tintLabelOnFocus??!1,Ae=Z&&Ve?W.colors["field-border-focus"]:W.colors["field-label"],Le=je.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Be=Boolean(f)||Boolean(g)||ae,Pe="underline"===Q,ke=_?X.icon+W.space.md+1+W.space.md:0,ze=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ye,floated:ge,required:R,variant:Q,sizeTokens:X,leadingOffset:ke,trailingOffset:Be?X.icon+W.space.sm:0,textAlign:F,paddingLeft:Pe?W.space.none:X["padding-x"],lineHeight:le?K:void 0,restNudge:se,floatTrim:le?2:0,color:Ae,style:k}),qe=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:x}),De=qe.color,Ce=qe.placeholderColor,Ee=R&&!xe&&!re&&"string"==typeof a&&a.length>0,He=de?r:o,Me=T&&"number"==typeof N&&"string"==typeof l?`${l.length} / ${N}`:null,Oe=de?W.colors["field-message"]:W.colors["text-muted"],Ue=(0,_textInk.useTextInk)(z,X["message-text"],Oe),Ge=E??(0,_FieldBase.fieldTextAsString)(i)??a,We=x?W.colors["field-icon-disabled"]:Z?W.colors["field-icon-focus"]:W.colors["field-icon"],$e={focused:Z,disabled:x,error:de,color:We,size:X.icon},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ae){const e=(te?W.settings.icons.eyeOff:W.settings.icons.eye)??(te?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Te,disabled:!fe,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:te?G.hidePassword:G.showPassword,children:e({size:X.icon,color:We})})}const e=g?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.unit,{fontSize:X.text,color:Ce},m],children:g}):null,t=f?(0,_slotIcon.slotIconView)(f,renderSlot(f)):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.trailingRow,children:[e,t]}):e??t})(),Je=_?(0,_slotIcon.slotIconView)(_,renderSlot(_)):null,Ke=_reactNative.StyleSheet.flatten(h),Qe=Ke?.fontSize??X.text,Ye=Ke?.color??Ce,Ze=(0,_react.useMemo)(()=>({fontSize:Qe,color:Ye}),[Qe,Ye]),et=pe?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,marginRight:W.space.xs,lineHeight:le?K:void 0,paddingTop:le?se:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{marginRight:W.space.xs,minHeight:le?K:void 0,justifyContent:"center",paddingTop:le?se:void 0}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,lineHeight:le?K:void 0},h],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ze,children:v})})}):null,tt=j?(0,_jsxRuntime.jsx)(_index4.Button,{variant:j.variant??"outline",tone:j.tone??"primary",size:b,label:j.label,leftIcon:j.icon,loading:j.loading,disabled:x||j.disabled,onPress:j.onPress,pressAnimation:!1,testID:j.testID,style:[$.action,{minHeight:X["min-height"],alignSelf:le?"flex-start":"stretch"},I]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.container,{transform:[{translateX:Le}]},L],children:[xe&&!ye?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:b,required:R,help:n,color:Ae,style:k,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.fieldRow,{columnGap:W.space.sm,alignItems:le?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:b,variant:Q,focused:Z,disabled:x,error:de,filled:re,minHeight:le?J:void 0,radius:q,leading:Je,leadingDivider:null!=_,paddingLeft:Pe?W.space.none:void 0,trailing:Xe,slotAlign:le?"top":"center",slotLineHeight:le?K:void 0,topNotch:ze.topNotch,onPress:he,pressFeedback:!1,style:B,children:[et,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ve,style:[$.input,{color:De,fontSize:X.text,...qe.weightStyle,paddingLeft:Pe?W.space.none:void 0,minHeight:le?J-2*X["padding-y"]:void 0,lineHeight:le?K:void 0,paddingTop:le?se:void 0,textAlignVertical:le?"top":"center"},P],textAlign:F,placeholder:ye&&!ge||Ee?void 0:a,placeholderTextColor:Ce,value:V&&null!=l?V(l):l,onChangeText:e=>{s&&s(A?A(e):e)},onFocus:Re,onBlur:Ne,editable:fe,readOnly:y,secureTextEntry:ne&&!te,multiline:le,autoCapitalize:ne?"none":void 0,autoCorrect:!ne&&void 0,maxLength:N,selectionColor:Fe,accessibilityLabel:Ge,accessibilityState:{disabled:x},"aria-disabled":x,testID:M,...U}),Ee?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:Ce,fontSize:X.text,weightStyle:qe.weightStyle,align:le?"top":"center",paddingTop:le?se:void 0,textAlign:F}):null]})]}),ze.node]}),tt]}),ue||Me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.footerRow,{marginTop:X["message-gap"]}],children:[ue?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.messageRow,{columnGap:W.space.xs,opacity:Ie}],accessibilityLiveRegion:de?"polite":"none",children:[de?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:X["message-text"],color:Oe}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.messageText,{color:Oe,fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")},z],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ue,children:He})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:$.footerSpacer}),Me?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.counterText,{color:W.colors["text-subtle"],fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")}],children:Me}):null]}):null]})});Input.displayName="Input";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},fieldRow:{flexDirection:"row"},fieldWrapper:{position:"relative",overflow:"visible",flex:1},action:{flexShrink:0},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"},unit:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center",columnGap:e.space.sm},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},footerSpacer:{flex:1},messageRow:{flex:1,flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1},counterText:{flexShrink:0,includeFontPadding:!1}});var _default=exports.default=Input;