@webority/mobile-ui 0.150.0 → 0.152.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-kit/kit.js +10 -10
- package/dist/canvas-kit/manifest.json +139 -17
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/commonjs/components/AsyncBlock/AsyncBlock.js +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +1 -1
- package/lib/commonjs/components/Banner/Banner.js +1 -1
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Calendar/calendarStyles.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/components/FilePicker/FilePicker.js +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/commonjs/components/NonModalBottomSheet/NonModalBottomSheet.js +1 -0
- package/lib/commonjs/components/NonModalBottomSheet/index.js +1 -0
- package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/commonjs/components/OptionSheet/optionAccessors.js +1 -1
- package/lib/commonjs/components/Repeater/Repeater.js +1 -1
- package/lib/commonjs/components/Toast/Toast.js +1 -1
- package/lib/commonjs/components/WheelPicker/Wheel.js +1 -1
- package/lib/commonjs/components/WheelPicker/WheelPicker.js +1 -1
- package/lib/commonjs/components/index.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/theme/tokens.generated.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/AsyncBlock/AsyncBlock.js +1 -1
- package/lib/module/components/Avatar/Avatar.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Calendar/calendarStyles.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +1 -1
- package/lib/module/components/FilePicker/FilePicker.js +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/module/components/NonModalBottomSheet/NonModalBottomSheet.js +1 -0
- package/lib/module/components/NonModalBottomSheet/index.js +1 -0
- package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/module/components/OptionSheet/optionAccessors.js +1 -1
- package/lib/module/components/Repeater/Repeater.js +1 -1
- package/lib/module/components/Toast/Toast.js +1 -1
- package/lib/module/components/WheelPicker/Wheel.js +1 -1
- package/lib/module/components/WheelPicker/WheelPicker.js +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/theme/tokens.generated.js +1 -1
- package/lib/typescript/commonjs/components/AsyncBlock/AsyncBlock.d.ts +2 -2
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +5 -3
- package/lib/typescript/commonjs/components/Button/Button.d.ts +7 -2
- package/lib/typescript/commonjs/components/NonModalBottomSheet/NonModalBottomSheet.d.ts +52 -0
- package/lib/typescript/commonjs/components/NonModalBottomSheet/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +6 -1
- package/lib/typescript/commonjs/components/OptionSheet/optionAccessors.d.ts +1 -0
- package/lib/typescript/commonjs/components/WheelPicker/Wheel.d.ts +4 -0
- package/lib/typescript/commonjs/components/WheelPicker/WheelPicker.d.ts +2 -0
- package/lib/typescript/commonjs/components/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/module/components/AsyncBlock/AsyncBlock.d.ts +2 -2
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +5 -3
- package/lib/typescript/module/components/Button/Button.d.ts +7 -2
- package/lib/typescript/module/components/NonModalBottomSheet/NonModalBottomSheet.d.ts +52 -0
- package/lib/typescript/module/components/NonModalBottomSheet/index.d.ts +3 -0
- package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +6 -1
- package/lib/typescript/module/components/OptionSheet/optionAccessors.d.ts +1 -0
- package/lib/typescript/module/components/WheelPicker/Wheel.d.ts +4 -0
- package/lib/typescript/module/components/WheelPicker/WheelPicker.d.ts +2 -0
- package/lib/typescript/module/components/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts +1 -1
- 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.
|
|
5
|
+
"version": "0.152.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 13,
|
|
8
8
|
"platform": "Phone",
|
|
@@ -1121,7 +1121,7 @@
|
|
|
1121
1121
|
],
|
|
1122
1122
|
"a11y": [
|
|
1123
1123
|
"The error and empty states are plain text, so screen readers read their title and description.",
|
|
1124
|
-
"The state decides what is drawn: loading, error, empty or data, one at a time."
|
|
1124
|
+
"The state decides what is drawn: loading, error, empty or data, one at a time. Idle, a skipped query, draws nothing."
|
|
1125
1125
|
]
|
|
1126
1126
|
}
|
|
1127
1127
|
},
|
|
@@ -1651,10 +1651,11 @@
|
|
|
1651
1651
|
"offline",
|
|
1652
1652
|
"online",
|
|
1653
1653
|
"pending",
|
|
1654
|
+
"rejected",
|
|
1654
1655
|
"verified"
|
|
1655
1656
|
],
|
|
1656
1657
|
"required": false,
|
|
1657
|
-
"description": "A presence dot, or a verified or
|
|
1658
|
+
"description": "A presence dot, or a verified, pending or rejected ring; leave out to show nothing."
|
|
1658
1659
|
},
|
|
1659
1660
|
{
|
|
1660
1661
|
"name": "statusPosition",
|
|
@@ -1762,7 +1763,7 @@
|
|
|
1762
1763
|
}
|
|
1763
1764
|
],
|
|
1764
1765
|
"a11y": [
|
|
1765
|
-
"The spoken label is the name followed by avatar, with verified or
|
|
1766
|
+
"The spoken label is the name followed by avatar, with verified, pending verification or rejected added for the ring states.",
|
|
1766
1767
|
"A pressable avatar is announced as a button and keeps a touch area of at least 44 points."
|
|
1767
1768
|
]
|
|
1768
1769
|
}
|
|
@@ -10350,6 +10351,107 @@
|
|
|
10350
10351
|
"takesAction": [],
|
|
10351
10352
|
"source": "@webority/mobile-ui"
|
|
10352
10353
|
},
|
|
10354
|
+
{
|
|
10355
|
+
"name": "NonModalBottomSheet",
|
|
10356
|
+
"marker": null,
|
|
10357
|
+
"acceptsChildren": true,
|
|
10358
|
+
"props": [
|
|
10359
|
+
{
|
|
10360
|
+
"name": "accessibilityLabel",
|
|
10361
|
+
"type": "string",
|
|
10362
|
+
"required": false,
|
|
10363
|
+
"description": "Names the sheet for a screen reader."
|
|
10364
|
+
},
|
|
10365
|
+
{
|
|
10366
|
+
"name": "enablePanDownToClose",
|
|
10367
|
+
"type": "boolean",
|
|
10368
|
+
"required": false,
|
|
10369
|
+
"description": "Lets a downward drag on the handle past the threshold close the sheet.",
|
|
10370
|
+
"default": true
|
|
10371
|
+
},
|
|
10372
|
+
{
|
|
10373
|
+
"name": "footer",
|
|
10374
|
+
"type": "node",
|
|
10375
|
+
"required": false,
|
|
10376
|
+
"description": "A fixed region at the bottom of the sheet, such as a row of buttons."
|
|
10377
|
+
},
|
|
10378
|
+
{
|
|
10379
|
+
"name": "header",
|
|
10380
|
+
"type": "node",
|
|
10381
|
+
"required": false,
|
|
10382
|
+
"description": "A fixed region between the handle and the content. It does not scroll."
|
|
10383
|
+
},
|
|
10384
|
+
{
|
|
10385
|
+
"name": "labels",
|
|
10386
|
+
"type": "object",
|
|
10387
|
+
"fields": [
|
|
10388
|
+
{
|
|
10389
|
+
"name": "dragHandle",
|
|
10390
|
+
"type": "string",
|
|
10391
|
+
"required": false,
|
|
10392
|
+
"description": "Names the drag handle for a screen reader."
|
|
10393
|
+
}
|
|
10394
|
+
],
|
|
10395
|
+
"required": false,
|
|
10396
|
+
"description": "Spoken labels for the sheet's own controls."
|
|
10397
|
+
},
|
|
10398
|
+
{
|
|
10399
|
+
"name": "open",
|
|
10400
|
+
"type": "boolean",
|
|
10401
|
+
"required": true,
|
|
10402
|
+
"description": "Whether the sheet is open. A drag close calls onClose; the parent sets this to false."
|
|
10403
|
+
},
|
|
10404
|
+
{
|
|
10405
|
+
"name": "scrollable",
|
|
10406
|
+
"type": "boolean",
|
|
10407
|
+
"required": false,
|
|
10408
|
+
"description": "Wraps the content in a vertical scroll view between the header and the footer.",
|
|
10409
|
+
"default": false
|
|
10410
|
+
},
|
|
10411
|
+
{
|
|
10412
|
+
"name": "snapIndex",
|
|
10413
|
+
"type": "number",
|
|
10414
|
+
"required": false,
|
|
10415
|
+
"description": "The snap point the sheet rests at, counted from 0 for the smallest."
|
|
10416
|
+
},
|
|
10417
|
+
{
|
|
10418
|
+
"name": "snapPoints",
|
|
10419
|
+
"type": "array",
|
|
10420
|
+
"required": true,
|
|
10421
|
+
"description": "The heights the sheet rests at: a height in dp, or a percentage such as 50%. Sorted ascending."
|
|
10422
|
+
},
|
|
10423
|
+
{
|
|
10424
|
+
"name": "title",
|
|
10425
|
+
"type": "string",
|
|
10426
|
+
"required": false,
|
|
10427
|
+
"description": "A heading drawn above the header, read as a heading by a screen reader."
|
|
10428
|
+
}
|
|
10429
|
+
],
|
|
10430
|
+
"itemsTakeAction": [],
|
|
10431
|
+
"takesAction": [],
|
|
10432
|
+
"source": "@webority/mobile-ui",
|
|
10433
|
+
"usage": {
|
|
10434
|
+
"when": [
|
|
10435
|
+
"A map or live view must stay usable while a short list or detail is open beside it."
|
|
10436
|
+
],
|
|
10437
|
+
"whenNot": [
|
|
10438
|
+
{
|
|
10439
|
+
"text": "The person must answer a question before going on.",
|
|
10440
|
+
"instead": "Dialog"
|
|
10441
|
+
},
|
|
10442
|
+
{
|
|
10443
|
+
"text": "The content is a full screen of its own.",
|
|
10444
|
+
"instead": "a new screen"
|
|
10445
|
+
}
|
|
10446
|
+
],
|
|
10447
|
+
"do": [],
|
|
10448
|
+
"dont": [],
|
|
10449
|
+
"a11y": [
|
|
10450
|
+
"The drag handle is an adjustable: swipe up or down to change the height, and the screen behind stays reachable.",
|
|
10451
|
+
"The sheet has no scrim, so it does not block the screen behind it or Back."
|
|
10452
|
+
]
|
|
10453
|
+
}
|
|
10454
|
+
},
|
|
10353
10455
|
{
|
|
10354
10456
|
"name": "NumberInput",
|
|
10355
10457
|
"marker": null,
|
|
@@ -10965,7 +11067,7 @@
|
|
|
10965
11067
|
"name": "options",
|
|
10966
11068
|
"type": "array",
|
|
10967
11069
|
"required": true,
|
|
10968
|
-
"description": "The options to list, each with a label, a value and optionally a description, an icon and a disabled flag."
|
|
11070
|
+
"description": "The options to list, each with a label, a value and optionally a description, an icon and a disabled flag. A row may carry an `onPress` action: it runs on tap, the sheet closes and `onChange` does not fire for that row."
|
|
10969
11071
|
},
|
|
10970
11072
|
{
|
|
10971
11073
|
"name": "searchSelectionColor",
|
|
@@ -20023,6 +20125,20 @@
|
|
|
20023
20125
|
"required": false,
|
|
20024
20126
|
"description": "Label for the minutes column.",
|
|
20025
20127
|
"default": "Minutes"
|
|
20128
|
+
},
|
|
20129
|
+
{
|
|
20130
|
+
"name": "typeAction",
|
|
20131
|
+
"type": "string",
|
|
20132
|
+
"required": false,
|
|
20133
|
+
"description": "Name of the screen reader action that opens the typed entry.",
|
|
20134
|
+
"default": "Type a value"
|
|
20135
|
+
},
|
|
20136
|
+
{
|
|
20137
|
+
"name": "typeEditor",
|
|
20138
|
+
"type": "string",
|
|
20139
|
+
"required": false,
|
|
20140
|
+
"description": "Spoken when the typed entry opens.",
|
|
20141
|
+
"default": "Type a number"
|
|
20026
20142
|
}
|
|
20027
20143
|
],
|
|
20028
20144
|
"required": false,
|
|
@@ -20143,7 +20259,8 @@
|
|
|
20143
20259
|
}
|
|
20144
20260
|
],
|
|
20145
20261
|
"a11y": [
|
|
20146
|
-
"The value is spoken in words, such as 2 hours; keep labels in the person's language."
|
|
20262
|
+
"The value is spoken in words, such as 2 hours; keep labels in the person's language.",
|
|
20263
|
+
"A screen reader offers a Type a value action on each wheel; it opens a number field and focus returns to the wheel when it closes."
|
|
20147
20264
|
]
|
|
20148
20265
|
}
|
|
20149
20266
|
},
|
|
@@ -20675,7 +20792,7 @@
|
|
|
20675
20792
|
"tokenValues": {
|
|
20676
20793
|
"color": {
|
|
20677
20794
|
"avatar-1": {
|
|
20678
|
-
"light": "#
|
|
20795
|
+
"light": "#4f46e5",
|
|
20679
20796
|
"dark": "#8b8bee"
|
|
20680
20797
|
},
|
|
20681
20798
|
"avatar-2": {
|
|
@@ -20807,7 +20924,7 @@
|
|
|
20807
20924
|
"dark": "#71717a"
|
|
20808
20925
|
},
|
|
20809
20926
|
"focus-ring": {
|
|
20810
|
-
"light": "#
|
|
20927
|
+
"light": "#4f46e5",
|
|
20811
20928
|
"dark": "#7c7ce8"
|
|
20812
20929
|
},
|
|
20813
20930
|
"glass-badge": {
|
|
@@ -20835,7 +20952,7 @@
|
|
|
20835
20952
|
"dark": "#60a5fa"
|
|
20836
20953
|
},
|
|
20837
20954
|
"link": {
|
|
20838
|
-
"light": "#
|
|
20955
|
+
"light": "#4f46e5",
|
|
20839
20956
|
"dark": "#9292ee"
|
|
20840
20957
|
},
|
|
20841
20958
|
"neutral": {
|
|
@@ -20903,31 +21020,31 @@
|
|
|
20903
21020
|
"dark": "#04b440"
|
|
20904
21021
|
},
|
|
20905
21022
|
"primary": {
|
|
20906
|
-
"light": "#
|
|
21023
|
+
"light": "#4f46e5",
|
|
20907
21024
|
"dark": "#7c7ce8"
|
|
20908
21025
|
},
|
|
20909
21026
|
"primary-hover": {
|
|
20910
|
-
"light": "#
|
|
21027
|
+
"light": "#4338ca",
|
|
20911
21028
|
"dark": "#9292ee"
|
|
20912
21029
|
},
|
|
20913
21030
|
"primary-pressed": {
|
|
20914
|
-
"light": "#
|
|
21031
|
+
"light": "#3730a3",
|
|
20915
21032
|
"dark": "#a8a8f2"
|
|
20916
21033
|
},
|
|
20917
21034
|
"primary-soft": {
|
|
20918
|
-
"light": "#
|
|
21035
|
+
"light": "#e0e7ff",
|
|
20919
21036
|
"dark": "#1f1f3d"
|
|
20920
21037
|
},
|
|
20921
21038
|
"primary-text": {
|
|
20922
|
-
"light": "#
|
|
21039
|
+
"light": "#4f46e5",
|
|
20923
21040
|
"dark": "#8989ea"
|
|
20924
21041
|
},
|
|
20925
21042
|
"primary-wash": {
|
|
20926
|
-
"light": "#
|
|
21043
|
+
"light": "#4f46e514",
|
|
20927
21044
|
"dark": "#7c7ce814"
|
|
20928
21045
|
},
|
|
20929
21046
|
"primary-wash-strong": {
|
|
20930
|
-
"light": "#
|
|
21047
|
+
"light": "#4f46e533",
|
|
20931
21048
|
"dark": "#7c7ce833"
|
|
20932
21049
|
},
|
|
20933
21050
|
"scrim": {
|
|
@@ -20987,7 +21104,7 @@
|
|
|
20987
21104
|
"dark": "#ffffff14"
|
|
20988
21105
|
},
|
|
20989
21106
|
"surface-selected": {
|
|
20990
|
-
"light": "#
|
|
21107
|
+
"light": "#4f46e51a",
|
|
20991
21108
|
"dark": "#7c7ce82e"
|
|
20992
21109
|
},
|
|
20993
21110
|
"switch-thumb": {
|
|
@@ -22868,6 +22985,11 @@
|
|
|
22868
22985
|
"version": "0.139.0",
|
|
22869
22986
|
"components": [],
|
|
22870
22987
|
"values": {}
|
|
22988
|
+
},
|
|
22989
|
+
{
|
|
22990
|
+
"version": "0.152.0",
|
|
22991
|
+
"components": [],
|
|
22992
|
+
"values": {}
|
|
22871
22993
|
}
|
|
22872
22994
|
]
|
|
22873
22995
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-phone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.152.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.
|
|
9
|
+
"version": "0.152.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "076fae2f4c73ee4f6af79f7a0677a070b2bc32b67bf5ac5e5aec0462d32869ce",
|
|
14
|
+
"bytes": 668121
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "5018aa2ac6f3ecb94813b171d22524c8ddda0f9ba8d7c944ee4588be5df3565c",
|
|
18
|
+
"bytes": 5660745
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_APP_BAR_LABELS=exports.AppBar=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_index2=require("../Menu/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4,DEFAULT_APP_BAR_LABELS=exports.DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"}),variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1};case"large":return{height:56,titleSize:e.text["2xl"].size,titleWeight:"bold",subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1}}},ActionButton=(0,_react.forwardRef)(({action:e,side:t,badgeStyle:i,haptic:n,flush:a,onPress:s},r)=>{const l=(0,_index.useTheme)(),{style:o,pressIn:c,pressOut:d}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),u=(0,_react.useMemo)(()=>buildActionStyles(l),[l]),p=e.badge,h=void 0!==p&&0!==p,x=void 0!==e.label;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:o,children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:r,onPress:t=>{const i=(0,_hapticUtils.resolveHaptic)(n,"selection");i&&(0,_hapticUtils.triggerHaptic)(i),"onPress"in e&&e.onPress(),s?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:l.colors["surface-pressed"],borderless:!x},style:({pressed:e})=>[x?u.textButton:u.actionButton,a?null:"left"===t?u.actionLeft:u.actionRight,e&&!x?u.actionPressed:null,e&&x?u.textPressed:null],children:[x?(0,_jsxRuntime.jsx)(_Text.Text,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.iconWrap,children:e.icon}),h?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[u.badge,i],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_Text.Text,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(p)})}):null,e.dot?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,AppBar=exports.AppBar=(0,_react.forwardRef)((e,t)=>{const{title:i,subtitle:n,titleAlignment:a="left",leftAction:s,rightActions:r,leading:l,trailing:o,onBack:c,gutter:d,titleVariant:u,titleOffset:p,height:h,divider:x,elevated:g=!1,variant:m="default",transparent:_=!1,scrollY:b,style:f,containerStyle:j,titleStyle:y,subtitleStyle:v,badgeStyle:A,haptic:R,labels:S,testID:w}=e;(0,_assertValidValue.assertValidValue)("AppBar","variant",e.variant,["default","large","compact"]),(0,_assertValidValue.assertValidValue)("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const B=(0,_react.useMemo)(()=>({...DEFAULT_APP_BAR_LABELS,...S}),[S]),L=(0,_index.useTheme)(),N=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),T=(0,_react.useMemo)(()=>variantSize(L,m),[L,m]),I=(0,_react.useMemo)(()=>buildStyles(L),[L]),V="large"===m,P=V&&void 0!==b,[C,z]=(0,_react.useState)(40),O=(0,_react.useCallback)(e=>z(e.nativeEvent.layout.height),[]),E=s??(c?{icon:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"arrow-left",size:24,color:L.colors["text-body"]}),onPress:c,accessibilityLabel:B.back}:void 0),D=o?void 0:r?.[r.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?L.space.sm:Math.max((44-(e.glyphSize??24))/2,0),W=void 0===d?null:{paddingLeft:Math.max(d-opticalInset(E),0),paddingRight:Math.max(d-opticalInset(D),0)},k=void 0!==p,F=Boolean(E)||Boolean(l),q=!k&&"left"===a&&Boolean(E),H=k||q||!F&&"left"===a,M="default"!==m||F?T.titleSize:L.text.xl.size,U=x??!1,$=_reactNative.StyleSheet.hairlineWidth,G=(0,_react.useMemo)(()=>{if(!b)return null;const e=b;return{rootHeight:e.interpolate({inputRange:[0,60],outputRange:[N.top+T.height+C,N.top+T.height],extrapolate:"clamp"}),titleRowOpacity:e.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),compactTitleOpacity:e.interpolate({inputRange:[30,60],outputRange:[0,1],extrapolate:"clamp"}),borderOpacity:e.interpolate({inputRange:[0,60],outputRange:[0,1],extrapolate:"clamp"})}},[b,N.top,T.height,C]),Z=i?u?(0,_jsxRuntime.jsx)(_Text.Text,{variant:u,align:"center"===a?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[I.titleVariant,y],children:i}):(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityRole:"header",style:[I.title,{fontSize:M,fontWeight:L.weight[T.titleWeight],textAlign:"center"===a?"center":"left"},n?I.stackedText:null,y],numberOfLines:1,children:i}):null,Y=P&&G&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[I.title,{fontSize:L.text.lg.size,fontWeight:L.weight.semibold,textAlign:"center"===a?"center":"left",opacity:G.compactTitleOpacity}],numberOfLines:1,children:i}):null,J=n?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{style:[I.subtitle,{textAlign:"center"===a?"center":"left"},v],numberOfLines:T.subtitleLines,children:n}):null,K=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[I.titleColumn,"center"===a?I.titleColumnCenter:null],children:[Z,J]}),Q=P?_reactNative.Animated.View:_reactNative.View,X=P&&G?{height:G.rootHeight,overflow:"hidden"}:V&&void 0===h?null:{height:(h??T.height)+N.top};return(0,_jsxRuntime.jsxs)(Q,{ref:t,testID:w,style:[I.root,{paddingTop:N.top,backgroundColor:_?"transparent":L.colors.surface},X,!P&&U?{borderBottomWidth:$,borderBottomColor:L.colors.border}:null,g&&!_?L.shadow.card:null,j,f],children:[P&&G&&U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[I.animatedBorder,{backgroundColor:L.colors.border,opacity:G.borderOpacity}]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:V&&w?`${w}-bar-row`:void 0,style:[I.row,V?{height:T.height}:{flex:1},W],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:w?`${w}-leading-slot`:void 0,style:[I.sideSlot,H?I.sideSlotCompact:null],children:[E?(0,_jsxRuntime.jsx)(ActionButton,{action:E,side:"left",haptic:R,flush:k||q}):null,null!=l&&!1!==l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.slotNode,children:l}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[I.center,"center"===a?I.centerAligned:I.centerLeft,k?{paddingLeft:F?p:L.space.none,paddingRight:L.space.none}:H?{paddingLeft:L.space.none}:null],children:V?Y:K}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[I.sideSlot,I.sideSlotRight,k?I.sideSlotCompact:null],children:[r?.map((e,t)=>(0,_jsxRuntime.jsx)(_react.Fragment,{children:"menu"in e?(0,_jsxRuntime.jsx)(_index2.Menu,{items:e.menu,title:e.menuTitle,haptic:R,trigger:(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:A,haptic:R,flush:k})}):(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:A,haptic:R,flush:k})},`appbar-right-${t}`)),null!=o&&!1!==o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.slotNode,children:o}):null]})]}),V?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{testID:w?`${w}-title-row`:void 0,onLayout:P?O:void 0,pointerEvents:"none",style:[{paddingHorizontal:d??L.space.md,paddingBottom:L.space.sm},P&&G?{opacity:G.titleRowOpacity}:null],children:K}):null]})});AppBar.displayName="AppBar";const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.xs},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},slotNode:{flexDirection:"row",alignItems:"center"},center:{flex:1,minWidth:0,paddingHorizontal:e.space.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column",maxWidth:"100%"},titleColumnCenter:{alignItems:"center"},title:{color:e.colors["text-body"]},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},stackedText:{includeFontPadding:!1},subtitle:{includeFontPadding:!1,color:e.colors["text-subtle"],fontSize:e.text.sm.size,fontWeight:e.weight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:_reactNative.StyleSheet.hairlineWidth}}),buildActionStyles=e=>_reactNative.StyleSheet.create({actionButton:{width:44,height:44,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:e.space.xs},actionRight:{marginLeft:e.space.xs},actionPressed:{backgroundColor:e.colors["surface-pressed"]},textButton:{minWidth:44,minHeight:44,paddingHorizontal:e.space.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},dot:{position:"absolute",top:10,right:10,width:8,height:8,borderRadius:e.radius.pill,backgroundColor:e.colors.danger},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:4,right:4,minWidth:16,height:16,paddingHorizontal:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors.danger,alignItems:"center",justifyContent:"center"},badgeText:{color:e.colors["on-danger"],fontSize:e.text.xs.size,fontWeight:e.weight.semibold,lineHeight:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_APP_BAR_LABELS=exports.AppBar=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_index2=require("../Menu/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4,DEFAULT_APP_BAR_LABELS=exports.DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"}),variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1};case"large":return{height:56,titleSize:e.text["2xl"].size,titleWeight:"bold",subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1}}},ActionButton=(0,_react.forwardRef)(({action:e,side:t,badgeStyle:i,haptic:n,flush:a,onPress:s},r)=>{const l=(0,_index.useTheme)(),{style:o,pressIn:c,pressOut:d}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),u=(0,_react.useMemo)(()=>buildActionStyles(l),[l]),p=e.badge,h=void 0!==p&&0!==p,x=void 0!==e.label;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:o,children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:r,onPress:t=>{const i=(0,_hapticUtils.resolveHaptic)(n,"selection");i&&(0,_hapticUtils.triggerHaptic)(i),"onPress"in e&&e.onPress(),s?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:l.colors["surface-pressed"],borderless:!x},style:({pressed:e})=>[x?u.textButton:u.actionButton,a?null:"left"===t?u.actionLeft:u.actionRight,e&&!x?u.actionPressed:null,e&&x?u.textPressed:null],children:[x?(0,_jsxRuntime.jsx)(_Text.Text,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.iconWrap,children:e.icon}),h?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[u.badge,i],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_Text.Text,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(p)})}):null,e.dot?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,AppBar=exports.AppBar=(0,_react.forwardRef)((e,t)=>{const{title:i,subtitle:n,titleAlignment:a="left",leftAction:s,rightActions:r,leading:l,trailing:o,onBack:c,gutter:d,titleVariant:u,titleOffset:p,height:h,divider:x,elevated:g=!1,variant:m="default",transparent:_=!1,scrollY:b,style:f,containerStyle:j,titleStyle:y,subtitleStyle:v,badgeStyle:A,haptic:R,labels:S,testID:w}=e;(0,_assertValidValue.assertValidValue)("AppBar","variant",e.variant,["default","large","compact"]),(0,_assertValidValue.assertValidValue)("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const B=(0,_react.useMemo)(()=>({...DEFAULT_APP_BAR_LABELS,...S}),[S]),L=(0,_index.useTheme)(),N=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),T=(0,_react.useMemo)(()=>variantSize(L,m),[L,m]),I=(0,_react.useMemo)(()=>buildStyles(L),[L]),V="large"===m,P=V&&void 0!==b,[C,z]=(0,_react.useState)(40),O=(0,_react.useCallback)(e=>z(e.nativeEvent.layout.height),[]),E=s??(c?{icon:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"arrow-left",size:24,color:L.colors["text-body"]}),onPress:c,accessibilityLabel:B.back}:void 0),D=o?void 0:r?.[r.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?L.space.sm:Math.max((44-(e.glyphSize??24))/2,0),W=void 0===d?null:{paddingLeft:Math.max(d-opticalInset(E),0),paddingRight:Math.max(d-opticalInset(D),0)},k=void 0!==p,F=Boolean(E)||Boolean(l),q=!k&&"left"===a&&Boolean(E),H=k||q||!F&&"left"===a,M="default"!==m||F?T.titleSize:L.text.xl.size,U=x??!1,$=_reactNative.StyleSheet.hairlineWidth,G=(0,_react.useMemo)(()=>{if(!b)return null;const e=b;return{rootHeight:e.interpolate({inputRange:[0,60],outputRange:[N.top+T.height+C,N.top+T.height],extrapolate:"clamp"}),titleRowOpacity:e.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),compactTitleOpacity:e.interpolate({inputRange:[30,60],outputRange:[0,1],extrapolate:"clamp"}),borderOpacity:e.interpolate({inputRange:[0,60],outputRange:[0,1],extrapolate:"clamp"})}},[b,N.top,T.height,C]),Z=i?u?(0,_jsxRuntime.jsx)(_Text.Text,{variant:u,align:"center"===a?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[I.titleVariant,y],children:i}):(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityRole:"header",style:[I.title,{fontSize:M,fontWeight:L.weight[T.titleWeight],textAlign:"center"===a?"center":"left"},n?I.stackedText:null,y],numberOfLines:1,children:i}):null,Y=P&&G&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[I.title,{fontSize:L.text.lg.size,fontWeight:L.weight.semibold,textAlign:"center"===a?"center":"left",opacity:G.compactTitleOpacity}],numberOfLines:1,children:i}):null,J=n?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{style:[I.subtitle,{textAlign:"center"===a?"center":"left"},v],numberOfLines:T.subtitleLines,children:n}):null,K=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[I.titleColumn,"center"===a?I.titleColumnCenter:null],children:[Z,J]}),Q=P?_reactNative.Animated.View:_reactNative.View,X=P&&G?{height:G.rootHeight,overflow:"hidden"}:V&&void 0===h?null:{height:(h??T.height)+N.top};return(0,_jsxRuntime.jsxs)(Q,{ref:t,testID:w,style:[I.root,{paddingTop:N.top,backgroundColor:_?"transparent":L.colors.surface},X,!P&&U?{borderBottomWidth:$,borderBottomColor:L.colors.border}:null,g&&!_?L.shadow.card:null,j,f],children:[P&&G&&U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[I.animatedBorder,{backgroundColor:L.colors.border,opacity:G.borderOpacity}]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:V&&w?`${w}-bar-row`:void 0,style:[I.row,V?{height:T.height}:{flex:1},W],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:w?`${w}-leading-slot`:void 0,style:[I.sideSlot,H?I.sideSlotCompact:null],children:[E?(0,_jsxRuntime.jsx)(ActionButton,{action:E,side:"left",haptic:R,flush:k||q}):null,null!=l&&!1!==l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.slotNode,children:l}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[I.center,"center"===a?I.centerAligned:I.centerLeft,k?{paddingLeft:F?p:L.space.none,paddingRight:L.space.none}:H?{paddingLeft:L.space.none}:null],children:V?Y:K}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[I.sideSlot,I.sideSlotRight,k?I.sideSlotCompact:null],children:[r?.map((e,t)=>(0,_jsxRuntime.jsx)(_react.Fragment,{children:"menu"in e?(0,_jsxRuntime.jsx)(_index2.Menu,{items:e.menu,title:e.menuTitle,haptic:R,trigger:(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:A,haptic:R,flush:k})}):(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:A,haptic:R,flush:k})},`appbar-right-${t}`)),null!=o&&!1!==o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.slotNode,children:o}):null]})]}),V?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{testID:w?`${w}-title-row`:void 0,onLayout:P?O:void 0,pointerEvents:"none",style:[{paddingHorizontal:d??L.space.md,paddingBottom:L.space.sm},P&&G?{opacity:G.titleRowOpacity}:null],children:K}):null]})});AppBar.displayName="AppBar";const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.xs},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},slotNode:{flexDirection:"row",alignItems:"center"},center:{flex:1,minWidth:0,paddingHorizontal:e.space.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column",maxWidth:"100%"},titleColumnCenter:{alignItems:"center"},title:{color:e.colors["text-body"]},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},stackedText:{includeFontPadding:!1},subtitle:{includeFontPadding:!1,color:e.colors["text-subtle"],fontSize:e.text.sm.size,fontWeight:e.weight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:_reactNative.StyleSheet.hairlineWidth}}),buildActionStyles=e=>_reactNative.StyleSheet.create({actionButton:{width:44,height:44,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:e.space.xs},actionRight:{marginLeft:e.space.xs},actionPressed:{backgroundColor:e.colors["surface-pressed"]},textButton:{minWidth:44,minHeight:44,paddingHorizontal:e.space.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},dot:{position:"absolute",top:10,right:10,width:8,height:8,borderRadius:e.radius.pill,backgroundColor:e.colors.danger},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:4,right:4,minWidth:16,height:16,paddingHorizontal:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors.danger,alignItems:"center",justifyContent:"center"},badgeText:{color:e.colors["on-danger"],fontSize:e.text.xs.size,fontWeight:e.weight.semibold,lineHeight:Math.round(e.text.xs.size*e.leading.heading)}});var _default=exports.default=AppBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AsyncBlock=AsyncBlock,exports.default=exports.DEFAULT_ASYNC_BLOCK_LABELS=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_index2=require("../AppIcon/index.js"),_index3=require("../EmptyState/index.js"),_index4=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_ASYNC_BLOCK_LABELS=exports.DEFAULT_ASYNC_BLOCK_LABELS=Object.freeze({emptyTitle:"Nothing here yet",errorTitle:"That didn't load",offlineTitle:"You're offline",retry:"Try again"});function AsyncBlock({state:e,children:t,empty:r,errorVariant:i,skeleton:s,errorTitle:n,offlineTitle:a,labels:l,style:o,testID:c}){const u=(0,_index.useTheme)(),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AsyncBlock=AsyncBlock,exports.default=exports.DEFAULT_ASYNC_BLOCK_LABELS=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_index2=require("../AppIcon/index.js"),_index3=require("../EmptyState/index.js"),_index4=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_ASYNC_BLOCK_LABELS=exports.DEFAULT_ASYNC_BLOCK_LABELS=Object.freeze({emptyTitle:"Nothing here yet",errorTitle:"That didn't load",offlineTitle:"You're offline",retry:"Try again"});function AsyncBlock({state:e,children:t,empty:r,errorVariant:i,skeleton:s,errorTitle:n,offlineTitle:a,labels:l,style:o,testID:c}){const u=(0,_index.useTheme)(),d=(0,_react.useMemo)(()=>({...DEFAULT_ASYNC_BLOCK_LABELS,...l}),[l]);switch((0,_assertValidValue.assertValidValue)("AsyncBlock","errorVariant",i,["default","offline"]),(0,_assertValidValue.assertValidValue)("AsyncBlock","status",e.status,["idle","loading","error","empty","data"]),e.status){case"idle":return null;case"loading":return(0,_jsxRuntime.jsx)(_reactNative.View,{style:o,testID:c,children:s??(0,_jsxRuntime.jsx)(_reactNative.View,{style:{paddingVertical:u.space["2xl"],alignItems:"center"},children:(0,_jsxRuntime.jsx)(_index4.Spinner,{})})});case"error":{const t="offline"===(i??(e.error.code===_mobileCore.OFFLINE_CODE?"offline":"default"));return(0,_jsxRuntime.jsx)(_reactNative.View,{style:o,testID:c,children:(0,_jsxRuntime.jsx)(_index3.EmptyState,{icon:t?(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"cloud-cross",size:"xl",color:u.colors["text-subtle"],testID:"async-block-offline-icon"}):void 0,title:t?a??d.offlineTitle:n??d.errorTitle,description:e.error.message,action:{label:d.retry,onPress:e.retry}})})}case"empty":return(0,_jsxRuntime.jsx)(_reactNative.View,{style:o,testID:c,children:(0,_jsxRuntime.jsx)(_index3.EmptyState,{...r??{title:d.emptyTitle}})});case"data":return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:t(e.data)})}}var _default=exports.default=AsyncBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.avatarToneColors=exports.DEFAULT_AVATAR_LABELS=exports.AvatarGroup=exports.Avatar=exports.AVATAR_COLORS=void 0;var _expoImage=require("expo-image"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index2=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_AuthedImage=require("../AuthedImage/AuthedImage.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const SOFT_FILL_OPACITY=.14,MIN_TOUCH_TARGET=44,PRESSED_OPACITY=.7,INITIALS_MAX_FONT_SCALE=1.2,AVATAR_COLORS=exports.AVATAR_COLORS=["avatar-1","avatar-2","avatar-3","avatar-4","avatar-5","avatar-6","avatar-7","avatar-8"],avatarToneColors=(e,t)=>{const soft=(e,t)=>(0,_color.tintOf)(e,.14,t);switch(t){case"primary":return{background:soft(e.colors.primary,e.colors["primary-soft"]),color:e.colors["primary-text"]};case"success":return{background:soft(e.colors.success,e.colors["bg-subtle"]),color:e.colors["success-text"]};case"warning":return{background:soft(e.colors.warning,e.colors["bg-subtle"]),color:e.colors["warning-text"]};case"danger":return{background:soft(e.colors.danger,e.colors["bg-subtle"]),color:e.colors["danger-text"]};case"info":return{background:soft(e.colors.info,e.colors["bg-subtle"]),color:e.colors["info-text"]};case"neutral":return{background:e.colors["bg-muted"],color:e.colors["text-body"]}}};exports.avatarToneColors=avatarToneColors;const DEFAULT_AVATAR_LABELS=exports.DEFAULT_AVATAR_LABELS=Object.freeze({avatar:"Avatar",avatarOf:e=>`${e}'s avatar`,verified:"verified",pendingVerification:"pending verification",groupOf:e=>`Group of ${e} ${1===e?"person":"people"}`,moreCount:e=>`${e} more`,moreAvatars:"More avatars"}),sizeMap={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=e=>sizeMap[e],resolveRadius=(e,t,r,o)=>{switch(t){case"circle":return r/2;case"rounded":return o?e.radius[o]:Math.max(e.radius.sm,Math.round(.22*r));case"square":return 0}},initialsFromName=e=>{if(!e)return"";const t=e.trim().split(/\s+/u).filter(Boolean),[r,o]=t;return void 0===r?"":void 0===o?r.charAt(0).toUpperCase():(r.charAt(0)+o.charAt(0)).toUpperCase()},hashColor=(e,t)=>{let r=0;for(let t=0;t<e.length;t+=1)r=(r<<5)-r+e.charCodeAt(t),r|=0;const o=t[Math.abs(r)%t.length];if(void 0===o)throw new Error("The avatar colour palette is empty.");return o},RING_WIDTH=1.5,keyOfSource=e=>"object"==typeof e&&null!==e&&"uri"in e&&"string"==typeof e.uri?e.uri:e,uriOfSource=e=>"object"==typeof e&&null!==e&&"uri"in e&&"string"==typeof e.uri?e.uri:void 0,isImageSourceList=e=>Array.isArray(e),toExpoSource=e=>({...void 0!==e.uri?{uri:e.uri}:{},...void 0!==e.headers?{headers:e.headers}:{},...void 0!==e.width?{width:e.width}:{},...void 0!==e.height?{height:e.height}:{}}),toExpoSources=e=>"number"==typeof e?e:isImageSourceList(e)?e.map(toExpoSource):toExpoSource(e),isRingStatus=e=>"verified"===e||"pending"===e,statusColor=(e,t)=>{switch(t){case"online":case"verified":return e.colors.success;case"busy":return e.colors.danger;case"away":case"pending":return e.colors.warning;case"offline":return e.colors["text-subtle"]}},AvatarRoot=(0,_react.forwardRef)((e,t)=>{const{source:r,ImageComponent:o,imageClient:s,name:a,size:i="md",shape:n="circle",dimension:l,radius:c,border:u=!1,contentFit:d="cover",placeholderIcon:h,status:m=null,statusPosition:p="bottomRight",tone:g,backgroundColor:v,color:_,fontSize:b,loading:x=!1,accessibilityLabel:A,onPress:y,onLongPress:f,haptic:R,hitSlop:V,style:S,textStyle:j,testID:C,labels:I}=e;(0,_assertValidValue.assertValidValue)("Avatar","size",e.size,Object.keys(sizeMap)),(0,_assertValidValue.assertValidValue)("Avatar","shape",e.shape,["circle","square","rounded"]),(0,_assertValidValue.assertValidValue)("Avatar","radius",e.radius,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Avatar","contentFit",e.contentFit,["cover","contain"]),(0,_assertValidValue.assertValidValue)("Avatar","status",e.status,["online","offline","busy","away","verified","pending"]),(0,_assertValidValue.assertValidValue)("Avatar","statusPosition",e.statusPosition,["topRight","bottomRight"]),(0,_assertValidValue.assertValidValue)("Avatar","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const T=(0,_react.useMemo)(()=>I?{...DEFAULT_AVATAR_LABELS,...I}:DEFAULT_AVATAR_LABELS,[I]),L=(0,_index.useTheme)(),[w,M]=(0,_react.useState)(null),E=(0,_react.useMemo)(()=>l??resolveSize(i),[l,i]),O=(0,_react.useMemo)(()=>resolveRadius(L,n,E,c),[L,n,E,c]),k=u?L.size.border:0,N=L.colors.border,z=L.colors.surface,F=(0,_react.useMemo)(()=>initialsFromName(a),[a]),D=(0,_react.useMemo)(()=>g?avatarToneColors(L,g):null,[L,g]),q=(0,_react.useMemo)(()=>v||(D?.background??L.colors[hashColor(a??"",AVATAR_COLORS)]),[v,D,a,L]),G=_??D?.color??L.colors["on-primary"],U=r?keyOfSource(r):null,P=(0,_react.useMemo)(()=>void 0!==r?toExpoSources(r):void 0,[r]),$=null!==U&&U!==w,B=!$&&""===F&&null!=h,W=_??D?.color??L.colors["text-subtle"],H=b??Math.max(L.text.xs.size,Math.round(.4*E)),Y=Math.max(8,Math.round(.25*E)),X=isRingStatus(m),J=E-2*(X?3:k),K=X?resolveRadius(L,n,J,c):Math.max(0,O-k),Q=B?(0,_slotIcon.renderSlotIcon)(h,{color:W,size:Math.round(.45*J),disabled:!1}):null,Z=X?statusColor(L,m):"transparent",ee=Math.max(12,Math.round(.32*E)),te=Math.max(10,ee-4),re=v??D?.background??L.colors["bg-muted"],oe=$?"contain"===d?"transparent":L.colors["bg-muted"]:B?re:q,se=C??"avatar",ae=a?T.avatarOf(a):T.avatar,ie="verified"===m?`, ${T.verified}`:"pending"===m?`, ${T.pendingVerification}`:"",ne=A??`${ae}${ie}`,le="function"==typeof y||"function"==typeof f,ce=A??`${a||ae}${ie}`,ue=Math.max(0,Math.ceil((44-E)/2)),de=V??ue,he=[styles.root,{width:E,height:E,borderRadius:O,..._corners.smoothCorners,borderWidth:X?0:k,borderColor:N,backgroundColor:X?"transparent":oe},S],me=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[X?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.ring,{borderRadius:O,..._corners.smoothCorners,borderWidth:1.5,borderColor:Z}],accessible:!1,pointerEvents:"none",testID:`${se}-ring`}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.picture,{width:J,height:J,borderRadius:K,..._corners.smoothCorners,borderWidth:X?k:0,borderColor:N,backgroundColor:X?oe:"transparent"}],children:$?(()=>{const e={width:J,height:J,borderRadius:K,..._corners.smoothCorners};if(!r)return null;const onError=()=>M(U),t=uriOfSource(r);return o?(0,_jsxRuntime.jsx)(o,{source:r,onError:onError,style:e,contentFit:d,resizeMode:d,accessibilityIgnoresInvertColors:!0}):s&&void 0!==t?(0,_jsxRuntime.jsx)(_AuthedImage.AuthedImage,{uri:t,client:s,onError:onError,style:e,contentFit:d,placeholder:null,fallback:null,accessibilityIgnoresInvertColors:!0}):(0,_jsxRuntime.jsx)(_expoImage.Image,{...void 0!==P?{source:P}:{},onError:onError,style:e,contentFit:d,accessibilityIgnoresInvertColors:!0})})():Q||(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",numberOfLines:1,maxFontSizeMultiplier:1.2,style:[styles.initials,{color:G,fontSize:H,lineHeight:Math.round(H*L.leading.body)},j],children:F??" "})}),"verified"===m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.status,"topRight"===p?styles.badgeTopRight:styles.badgeBottomRight,{width:ee,height:ee,borderRadius:ee/2,..._corners.smoothCorners,backgroundColor:z}],accessible:!1,pointerEvents:"none",testID:`${se}-badge`,children:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"verify",variant:"bold",size:te,color:Z})}):null,m&&!X?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.status,"topRight"===p?styles.statusTopRight:styles.statusBottomRight,{width:Y,height:Y,borderRadius:Y/2,..._corners.smoothCorners,backgroundColor:statusColor(L,m),borderWidth:2,borderColor:z}],accessible:!1,pointerEvents:"none"}):null]}),pe=le?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:y?e=>{const t=(0,_hapticUtils.resolveHaptic)(R,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),y?.(e)}:void 0,onLongPress:f?e=>{const t=(0,_hapticUtils.resolveHaptic)(R,"longPress");t&&(0,_hapticUtils.triggerHaptic)(t),f?.(e)}:void 0,hitSlop:de,...(0,_hitSlop.hitSlopMarker)(de),accessibilityRole:"button",accessibilityLabel:ce,testID:C,style:({pressed:e})=>[he,e?styles.pressed:null],children:me}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,style:he,accessible:!0,accessibilityRole:"image",accessibilityLabel:ne,testID:C,children:me});return x?(0,_jsxRuntime.jsx)(AvatarSkeleton,{...e}):pe}),AvatarSkeleton=({size:e="md",shape:t="circle",dimension:r,style:o})=>{const s=r??resolveSize(e),a="circle"===t?"circle":"rounded"===t?"rounded":"rect";return(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:a,width:s,height:s,style:o})};AvatarSkeleton.displayName="AvatarSkeleton";const Avatar=exports.Avatar=Object.assign(AvatarRoot,{Skeleton:AvatarSkeleton});Avatar.displayName="Avatar";const styles=_reactNative.StyleSheet.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},pressed:{opacity:.7},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),SPACING_OFFSET={tight:"lg",normal:"md",loose:"sm"},STAGGER_MS=50,ENTRANCE_DURATION_MS=220,AvatarGroupItem=({delay:e,marginLeft:t,borderColor:r,borderWidth:o,children:s})=>{const a=(0,_index.useTheme)(),i=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current;return(0,_react.useEffect)(()=>{const t=_reactNative.Animated.timing(i,{toValue:1,duration:220,delay:e,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:_nativeDriver.nativeDriver});return t.start(),()=>t.stop()},[e,i]),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[groupStyles.item,{marginLeft:t,borderRadius:a.radius.pill,borderColor:r,borderWidth:o,opacity:i}],children:s})},AvatarGroup=e=>{const{children:t,max:r=4,size:o="md",spacing:s="normal",overflowVariant:a="count",accessibilityLabel:i,style:n,testID:l,labels:c}=e;(0,_assertValidValue.assertValidValue)("AvatarGroup","spacing",e.spacing,["tight","normal","loose"]),(0,_assertValidValue.assertValidValue)("AvatarGroup","overflowVariant",e.overflowVariant,["count","plus"]),(0,_assertValidValue.assertValidValue)("AvatarGroup","size",e.size,Object.keys(sizeMap));const u=(0,_react.useMemo)(()=>c?{...DEFAULT_AVATAR_LABELS,...c}:DEFAULT_AVATAR_LABELS,[c]),d=(0,_index.useTheme)(),h=(0,_react.useMemo)(()=>_react.Children.toArray(t).filter(e=>(0,_react.isValidElement)(e)),[t]),m=h.length,p=h.slice(0,r),g=Math.max(0,m-r),v=g>0,_=-d.space[SPACING_OFFSET[s]],b=d.colors.surface,x=i??u.groupOf(m),A=(0,_react.useMemo)(()=>resolveSize(o),[o]),y=Math.max(d.text.xs.size,Math.round(.34*A));return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[groupStyles.row,n],accessible:!0,accessibilityLabel:x,accessibilityRole:"summary",testID:l,children:[p.map((e,t)=>{const r=e.key??`avatar-${t}`,s=(0,_react.cloneElement)(e,{size:o,labels:e.props.labels??c});return(0,_jsxRuntime.jsx)(AvatarGroupItem,{delay:50*t,marginLeft:0===t?0:_,borderColor:b,borderWidth:1.5,children:s},r)}),v?(0,_jsxRuntime.jsx)(AvatarGroupItem,{delay:50*p.length,marginLeft:0===p.length?0:_,borderColor:b,borderWidth:1.5,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[groupStyles.overflow,{width:A,height:A,borderRadius:A/2,..._corners.smoothCorners,backgroundColor:d.colors["surface-disabled"]}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===a?u.moreCount(g):u.moreAvatars,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",color:"secondary",numberOfLines:1,maxFontSizeMultiplier:1.2,style:{fontSize:y,lineHeight:Math.round(y*d.leading.body)},children:"count"===a?`+${g}`:"+"})})},"avatar-overflow"):null]})};exports.AvatarGroup=AvatarGroup;const groupStyles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},item:{..._corners.smoothCorners},overflow:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Avatar;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.avatarToneColors=exports.DEFAULT_AVATAR_LABELS=exports.AvatarGroup=exports.Avatar=exports.AVATAR_COLORS=void 0;var _expoImage=require("expo-image"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index2=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_AuthedImage=require("../AuthedImage/AuthedImage.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const SOFT_FILL_OPACITY=.14,MIN_TOUCH_TARGET=44,PRESSED_OPACITY=.7,INITIALS_MAX_FONT_SCALE=1.2,AVATAR_COLORS=exports.AVATAR_COLORS=["avatar-1","avatar-2","avatar-3","avatar-4","avatar-5","avatar-6","avatar-7","avatar-8"],avatarToneColors=(e,t)=>{const soft=(e,t)=>(0,_color.tintOf)(e,.14,t);switch(t){case"primary":return{background:soft(e.colors.primary,e.colors["primary-soft"]),color:e.colors["primary-text"]};case"success":return{background:soft(e.colors.success,e.colors["bg-subtle"]),color:e.colors["success-text"]};case"warning":return{background:soft(e.colors.warning,e.colors["bg-subtle"]),color:e.colors["warning-text"]};case"danger":return{background:soft(e.colors.danger,e.colors["bg-subtle"]),color:e.colors["danger-text"]};case"info":return{background:soft(e.colors.info,e.colors["bg-subtle"]),color:e.colors["info-text"]};case"neutral":return{background:e.colors["bg-muted"],color:e.colors["text-body"]}}};exports.avatarToneColors=avatarToneColors;const DEFAULT_AVATAR_LABELS=exports.DEFAULT_AVATAR_LABELS=Object.freeze({avatar:"Avatar",avatarOf:e=>`${e}'s avatar`,verified:"verified",pendingVerification:"pending verification",rejected:"rejected",groupOf:e=>`Group of ${e} ${1===e?"person":"people"}`,moreCount:e=>`${e} more`,moreAvatars:"More avatars"}),sizeMap={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=e=>sizeMap[e],resolveRadius=(e,t,r,o)=>{switch(t){case"circle":return r/2;case"rounded":return o?e.radius[o]:Math.max(e.radius.sm,Math.round(.22*r));case"square":return 0}},initialsFromName=e=>{if(!e)return"";const t=e.trim().split(/\s+/u).filter(Boolean),[r,o]=t;return void 0===r?"":void 0===o?r.charAt(0).toUpperCase():(r.charAt(0)+o.charAt(0)).toUpperCase()},hashColor=(e,t)=>{let r=0;for(let t=0;t<e.length;t+=1)r=(r<<5)-r+e.charCodeAt(t),r|=0;const o=t[Math.abs(r)%t.length];if(void 0===o)throw new Error("The avatar colour palette is empty.");return o},RING_WIDTH=1.5,keyOfSource=e=>"object"==typeof e&&null!==e&&"uri"in e&&"string"==typeof e.uri?e.uri:e,uriOfSource=e=>"object"==typeof e&&null!==e&&"uri"in e&&"string"==typeof e.uri?e.uri:void 0,isImageSourceList=e=>Array.isArray(e),toExpoSource=e=>({...void 0!==e.uri?{uri:e.uri}:{},...void 0!==e.headers?{headers:e.headers}:{},...void 0!==e.width?{width:e.width}:{},...void 0!==e.height?{height:e.height}:{}}),toExpoSources=e=>"number"==typeof e?e:isImageSourceList(e)?e.map(toExpoSource):toExpoSource(e),isRingStatus=e=>"verified"===e||"pending"===e||"rejected"===e,statusColor=(e,t)=>{switch(t){case"online":case"verified":return e.colors.success;case"busy":case"rejected":return e.colors.danger;case"away":case"pending":return e.colors.warning;case"offline":return e.colors["text-subtle"]}},AvatarRoot=(0,_react.forwardRef)((e,t)=>{const{source:r,ImageComponent:o,imageClient:s,name:a,size:i="md",shape:n="circle",dimension:l,radius:c,border:u=!1,contentFit:d="cover",placeholderIcon:h,status:m=null,statusPosition:p="bottomRight",tone:g,backgroundColor:v,color:_,fontSize:b,loading:x=!1,accessibilityLabel:A,onPress:y,onLongPress:f,haptic:R,hitSlop:j,style:V,textStyle:S,testID:C,labels:I}=e;(0,_assertValidValue.assertValidValue)("Avatar","size",e.size,Object.keys(sizeMap)),(0,_assertValidValue.assertValidValue)("Avatar","shape",e.shape,["circle","square","rounded"]),(0,_assertValidValue.assertValidValue)("Avatar","radius",e.radius,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Avatar","contentFit",e.contentFit,["cover","contain"]),(0,_assertValidValue.assertValidValue)("Avatar","status",e.status,["online","offline","busy","away","verified","pending","rejected"]),(0,_assertValidValue.assertValidValue)("Avatar","statusPosition",e.statusPosition,["topRight","bottomRight"]),(0,_assertValidValue.assertValidValue)("Avatar","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const T=(0,_react.useMemo)(()=>I?{...DEFAULT_AVATAR_LABELS,...I}:DEFAULT_AVATAR_LABELS,[I]),L=(0,_index.useTheme)(),[w,M]=(0,_react.useState)(null),E=(0,_react.useMemo)(()=>l??resolveSize(i),[l,i]),O=(0,_react.useMemo)(()=>resolveRadius(L,n,E,c),[L,n,E,c]),k=u?L.size.border:0,N=L.colors.border,z=L.colors.surface,F=(0,_react.useMemo)(()=>initialsFromName(a),[a]),D=(0,_react.useMemo)(()=>g?avatarToneColors(L,g):null,[L,g]),q=(0,_react.useMemo)(()=>v||(D?.background??L.colors[hashColor(a??"",AVATAR_COLORS)]),[v,D,a,L]),G=_??D?.color??L.colors["on-primary"],U=r?keyOfSource(r):null,P=(0,_react.useMemo)(()=>void 0!==r?toExpoSources(r):void 0,[r]),$=null!==U&&U!==w,B=!$&&""===F&&null!=h,W=_??D?.color??L.colors["text-subtle"],H=b??Math.max(L.text.xs.size,Math.round(.4*E)),Y=Math.max(8,Math.round(.25*E)),X=isRingStatus(m),J=E-2*(X?3:k),K=X?resolveRadius(L,n,J,c):Math.max(0,O-k),Q=B?(0,_slotIcon.renderSlotIcon)(h,{color:W,size:Math.round(.45*J),disabled:!1}):null,Z=X?statusColor(L,m):"transparent",ee=Math.max(12,Math.round(.32*E)),te=Math.max(10,ee-4),re=v??D?.background??L.colors["bg-muted"],oe=$?"contain"===d?"transparent":L.colors["bg-muted"]:B?re:q,se=C??"avatar",ae=a?T.avatarOf(a):T.avatar,ie="verified"===m?`, ${T.verified}`:"pending"===m?`, ${T.pendingVerification}`:"rejected"===m?`, ${T.rejected}`:"",ne=A??`${ae}${ie}`,le="function"==typeof y||"function"==typeof f,ce=A??`${a||ae}${ie}`,ue=Math.max(0,Math.ceil((44-E)/2)),de=j??ue,he=[styles.root,{width:E,height:E,borderRadius:O,..._corners.smoothCorners,borderWidth:X?0:k,borderColor:N,backgroundColor:X?"transparent":oe},V],me=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[X?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.ring,{borderRadius:O,..._corners.smoothCorners,borderWidth:1.5,borderColor:Z}],accessible:!1,pointerEvents:"none",testID:`${se}-ring`}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.picture,{width:J,height:J,borderRadius:K,..._corners.smoothCorners,borderWidth:X?k:0,borderColor:N,backgroundColor:X?oe:"transparent"}],children:$?(()=>{const e={width:J,height:J,borderRadius:K,..._corners.smoothCorners};if(!r)return null;const onError=()=>M(U),t=uriOfSource(r);return o?(0,_jsxRuntime.jsx)(o,{source:r,onError:onError,style:e,contentFit:d,resizeMode:d,accessibilityIgnoresInvertColors:!0}):s&&void 0!==t?(0,_jsxRuntime.jsx)(_AuthedImage.AuthedImage,{uri:t,client:s,onError:onError,style:e,contentFit:d,placeholder:null,fallback:null,accessibilityIgnoresInvertColors:!0}):(0,_jsxRuntime.jsx)(_expoImage.Image,{...void 0!==P?{source:P}:{},onError:onError,style:e,contentFit:d,accessibilityIgnoresInvertColors:!0})})():Q||(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",numberOfLines:1,maxFontSizeMultiplier:1.2,style:[styles.initials,{color:G,fontSize:H,lineHeight:Math.round(H*L.leading.body)},S],children:F??" "})}),"verified"===m||"rejected"===m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.status,"topRight"===p?styles.badgeTopRight:styles.badgeBottomRight,{width:ee,height:ee,borderRadius:ee/2,..._corners.smoothCorners,backgroundColor:z}],accessible:!1,pointerEvents:"none",testID:`${se}-badge`,children:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"verified"===m?"verify":"close-circle",variant:"bold",size:te,color:Z})}):null,m&&!X?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.status,"topRight"===p?styles.statusTopRight:styles.statusBottomRight,{width:Y,height:Y,borderRadius:Y/2,..._corners.smoothCorners,backgroundColor:statusColor(L,m),borderWidth:2,borderColor:z}],accessible:!1,pointerEvents:"none"}):null]}),pe=le?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:y?e=>{const t=(0,_hapticUtils.resolveHaptic)(R,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),y?.(e)}:void 0,onLongPress:f?e=>{const t=(0,_hapticUtils.resolveHaptic)(R,"longPress");t&&(0,_hapticUtils.triggerHaptic)(t),f?.(e)}:void 0,hitSlop:de,...(0,_hitSlop.hitSlopMarker)(de),accessibilityRole:"button",accessibilityLabel:ce,testID:C,style:({pressed:e})=>[he,e?styles.pressed:null],children:me}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,style:he,accessible:!0,accessibilityRole:"image",accessibilityLabel:ne,testID:C,children:me});return x?(0,_jsxRuntime.jsx)(AvatarSkeleton,{...e}):pe}),AvatarSkeleton=({size:e="md",shape:t="circle",dimension:r,style:o})=>{const s=r??resolveSize(e),a="circle"===t?"circle":"rounded"===t?"rounded":"rect";return(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:a,width:s,height:s,style:o})};AvatarSkeleton.displayName="AvatarSkeleton";const Avatar=exports.Avatar=Object.assign(AvatarRoot,{Skeleton:AvatarSkeleton});Avatar.displayName="Avatar";const styles=_reactNative.StyleSheet.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},pressed:{opacity:.7},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),SPACING_OFFSET={tight:"lg",normal:"md",loose:"sm"},STAGGER_MS=50,ENTRANCE_DURATION_MS=220,AvatarGroupItem=({delay:e,marginLeft:t,borderColor:r,borderWidth:o,children:s})=>{const a=(0,_index.useTheme)(),i=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current;return(0,_react.useEffect)(()=>{const t=_reactNative.Animated.timing(i,{toValue:1,duration:220,delay:e,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:_nativeDriver.nativeDriver});return t.start(),()=>t.stop()},[e,i]),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[groupStyles.item,{marginLeft:t,borderRadius:a.radius.pill,borderColor:r,borderWidth:o,opacity:i}],children:s})},AvatarGroup=e=>{const{children:t,max:r=4,size:o="md",spacing:s="normal",overflowVariant:a="count",accessibilityLabel:i,style:n,testID:l,labels:c}=e;(0,_assertValidValue.assertValidValue)("AvatarGroup","spacing",e.spacing,["tight","normal","loose"]),(0,_assertValidValue.assertValidValue)("AvatarGroup","overflowVariant",e.overflowVariant,["count","plus"]),(0,_assertValidValue.assertValidValue)("AvatarGroup","size",e.size,Object.keys(sizeMap));const u=(0,_react.useMemo)(()=>c?{...DEFAULT_AVATAR_LABELS,...c}:DEFAULT_AVATAR_LABELS,[c]),d=(0,_index.useTheme)(),h=(0,_react.useMemo)(()=>_react.Children.toArray(t).filter(e=>(0,_react.isValidElement)(e)),[t]),m=h.length,p=h.slice(0,r),g=Math.max(0,m-r),v=g>0,_=-d.space[SPACING_OFFSET[s]],b=d.colors.surface,x=i??u.groupOf(m),A=(0,_react.useMemo)(()=>resolveSize(o),[o]),y=Math.max(d.text.xs.size,Math.round(.34*A));return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[groupStyles.row,n],accessible:!0,accessibilityLabel:x,accessibilityRole:"summary",testID:l,children:[p.map((e,t)=>{const r=e.key??`avatar-${t}`,s=(0,_react.cloneElement)(e,{size:o,labels:e.props.labels??c});return(0,_jsxRuntime.jsx)(AvatarGroupItem,{delay:50*t,marginLeft:0===t?0:_,borderColor:b,borderWidth:1.5,children:s},r)}),v?(0,_jsxRuntime.jsx)(AvatarGroupItem,{delay:50*p.length,marginLeft:0===p.length?0:_,borderColor:b,borderWidth:1.5,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[groupStyles.overflow,{width:A,height:A,borderRadius:A/2,..._corners.smoothCorners,backgroundColor:d.colors["surface-disabled"]}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===a?u.moreCount(g):u.moreAvatars,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",color:"secondary",numberOfLines:1,maxFontSizeMultiplier:1.2,style:{fontSize:y,lineHeight:Math.round(y*d.leading.body)},children:"count"===a?`+${g}`:"+"})})},"avatar-overflow"):null]})};exports.AvatarGroup=AvatarGroup;const groupStyles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},item:{..._corners.smoothCorners},overflow:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Avatar;
|
|
@@ -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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_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"}),BannerRoot=(0,_react.forwardRef)((e,t)=>{const{title:r,message:i,tone:s="neutral",variant:n="bar",icon:a,actions:o,dismissible:l=!1,onClose:c,haptic:d,open:u=!0,animateMount:
|
|
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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_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"}),BannerRoot=(0,_react.forwardRef)((e,t)=>{const{title:r,message:i,tone:s="neutral",variant:n="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:j,actionButtonStyle:f,testID:R}=e;(0,_assertValidValue.assertValidValue)("Banner","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("Banner","variant",e.variant,["bar","wash","tint"]),(0,_assertValidValue.assertValidValue)("Banner","accessibilityRole",e.accessibilityRole,["alert","summary","none"]);const w=(0,_index.useTheme)(),V=(0,_usePresenceMotion.usePresenceMotion)(),B=(0,_react.useMemo)(()=>buildStyles(w),[w]),S=(0,_react.useMemo)(()=>tintFor(w,s),[w,s]),N=(0,_react.useMemo)(()=>({...DEFAULT_BANNER_LABELS,...g}),[g]),[C,k]=V.range(-20,0),D=(0,_react.useRef)((0,_index.createAnimatedValue)(x&&u?C:0)).current,A=(0,_react.useRef)((0,_index.createAnimatedValue)(x&&u?0:u?1:0)).current,[L,I]=(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?(I(!0),e=_reactNative.Animated.parallel([_reactNative.Animated.timing(D,{toValue:k,duration:w.motion.duration.default,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(A,{toValue:1,duration:V.duration("default"),useNativeDriver:_nativeDriver.nativeDriver})]),e.start()):L&&(e=_reactNative.Animated.parallel([_reactNative.Animated.timing(D,{toValue:C,duration:w.motion.duration.fast,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(A,{toValue:0,duration:V.duration("fast"),useNativeDriver:_nativeDriver.nativeDriver})]),e.start(()=>{I(!1)})),()=>e?.stop()},[u]),!L)return null;const T=r??" ",q="string"==typeof i?i??" ":"",M="wash"===n,z="bar"!==n,H="alert"===p?"danger"===s?"assertive":"polite":"none",P=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:t,accessibilityRole:p,accessibilityLiveRegion:H,accessibilityLabel:_,testID:R,style:[B.container,{backgroundColor:z?S.soft:w.colors["bg-subtle"],borderRadius:M?w.radius.sm:w.radius.md,..._corners.smoothCorners,padding:w.space.md,opacity:A,transform:[{translateY:D}]},y,h],children:[!M&&w.components.banner["tint-bar-width"]>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[B.tintBar,{backgroundColor:S.bar},v]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[B.row,void 0===r&&B.rowCentred],children:[!1===a?null:a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:B.iconWrap,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(a,{color:S.ink,size:w.text.xl.size,disabled:!1})}):(0,_jsxRuntime.jsx)(_index2.IconBadge,{dimension:ICON_CIRCLE_SIZE,color:S.bar,icon:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"bold",accessible:!1,style:[B.iconGlyph,{color:S.ink}],children:S.glyph}),style:[B.iconCircle,b]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:B.textBlock,children:[r||m?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"semibold",numberOfLines:2,style:M?{color:S.ink}:void 0,children:T}):null,"string"==typeof i||m?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",style:{marginTop:r?w.space.xxs:0},children:q||" "}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:r?w.space.xxs:0},children:i})]}),l?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:N.dismiss,onPress:()=>{const e=(0,_hapticUtils.resolveHaptic)(d,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),c?.()},hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),style:({pressed:e})=>[B.closeBtn,{backgroundColor:e?w.colors["surface-pressed"]:"transparent"},j],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",weight:"bold",color:"secondary",accessible:!1,style:{lineHeight:Math.round(w.text.lg.size*w.leading.heading)},children:"×"})}):null]}),o&&o.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:B.actionsRow,children:o.map((e,t)=>{(0,_assertValidValue.assertValidValue)("Banner","action.tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("Banner","action.variant",e.variant,["solid","outline","ghost"]),(0,_assertValidValue.assertValidValue)("Banner","action.size",e.size,["sm","md"]);const r=e.tone??"primary",i=e.variant??"ghost",s="primary"===r?S.glyphColor:"neutral"===r?w.colors["text-muted"]:w.colors[r],n="primary"===r?S.ink:"neutral"===r?w.colors["text-muted"]:w.colors[`${r}-text`],a="primary"===r?S.on:"neutral"===r?w.colors["on-neutral-strong"]:w.colors[`on-${r}`],o="solid"===i;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})=>[B.actionBtn,"md"===e.size&&B.actionBtnMd,"outline"===i&&{borderWidth:1,borderColor:n},{backgroundColor:o?s:t?w.colors["surface-pressed"]:"transparent",opacity:o&&t?.85:1},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:o?a:n},children:e.label})},`${e.label}-${t}`)})}):null]});return m?(0,_jsxRuntime.jsx)(BannerSkeleton,{...e}):P}),BannerSkeleton=({title:e,actions:t,icon:r,containerStyle:i,style:s})=>{const n=(0,_index.useTheme)(),a=!1!==r;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:n.colors.surface,borderRadius:n.radius.md,..._corners.smoothCorners,padding:n.space.md,borderWidth:1,borderColor:n.colors.border},i,s],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:n.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:n.space.xs}}):null,(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:2,fontSize:n.text.sm.size,lastLineWidth:"70%"}),t&&t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:n.space.sm},children:t.map((e,t)=>(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:n.space.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton";const Banner=exports.Banner=Object.assign(BannerRoot,{Skeleton:BannerSkeleton});Banner.displayName="Banner";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:Math.round(e.text.base.size*e.leading.heading)},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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_shadows=require("../../utils/shadows.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:v="idle",accessory:y,style:R,indicatorStyle:N,labelStyle:j,labelMaxFontScale:A,labels:S,testID:w}=e;(0,_assertValidValue.assertValidValue)("BottomNavigation","variant",e.variant,["pill","underline","floating","bubble","expand","solid","tile"]),(0,_assertValidValue.assertValidValue)("BottomNavigation","indicatorPosition",e.indicatorPosition,["top","bottom"]);const E=(0,_react.useMemo)(()=>S?{...DEFAULT_BOTTOM_NAVIGATION_LABELS,...S}:DEFAULT_BOTTOM_NAVIGATION_LABELS,[S]),I=(0,_index.useTheme)(),T=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),V=(0,_react.useMemo)(()=>buildStyles(I),[I]),L=h??18,D=L+4+8,M=I.space.lg,B=I.space.lg,C=I.radius.xl,k=(0,_useReducedMotion.useReducedMotion)(),O=(0,_useScreenReaderEnabled.useScreenReaderEnabled)(f),[P,z]=_react.default.useState(null);(0,_react.useEffect)(()=>{null!==P&&P!==v&&z(null)},[P,v]);const F=f&&!O&&"down"===v&&null===P,[H,W]=_react.default.useState(F);(0,_react.useEffect)(()=>{H!==F&&(k||"web"===_reactNative.Platform.OS||_reactNative.LayoutAnimation.configureNext(_reactNative.LayoutAnimation.Presets.easeInEaseOut),W(F))},[H,F,k]);const q="function"==typeof y?y({minimized:H}):y,U=null!=q&&!1!==q,$=H&&U,[X,G]=_react.default.useState(0),Z=U&&!$?X+I.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)({}),ve=(0,_react.useRef)({});i.forEach(e=>{fe.current[e.key]||(fe.current[e.key]=new _reactNative.Animated.Value(1)),ve.current[e.key]||(ve.current[e.key]=(0,_index.createAnimatedValue)(e.key===n?1:0))});const ye=ge>0?Y?Math.min(ge-4,96):Math.min(ge-M,64):0,Re=ge>0?(ge-ye)/2:0,Ne=ge>0?(ge-48)/2:0,hasLabel=e=>s&&!H&&!1!==e.showLabel&&e.label.trim().length>0,je=i[ie],Ae=je&&!hasLabel(je)&&re>0?re/2:I.space.xs+(L+4)/2,Se=Ae-14-24,we=Math.max(0,re-4),Ee=Y?2:Ae-D/2,Ie=(0,_react.useRef)(ie);(0,_react.useEffect)(()=>{if(Ie.current===ie)return;Ie.current=ie;const e=_reactNative.Animated.spring(xe,{toValue:ie,tension:120,friction:14,useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[ie,xe]);const Te=Math.max(1,i.length-1),Ve=(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]),Le=i.map(e=>e.key).join(" "),De=J||Q;(0,_react.useEffect)(()=>{const e=Le.split(" ").flatMap(e=>{const t=e===n?1:0,i=ve.current[e];return i?De?[_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,Le,De]);const popIcon=e=>{_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:1.15,duration:120,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.spring(e,{toValue:1,tension:200,friction:8,useNativeDriver:_nativeDriver.nativeDriver})]).start()},Me=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current,{colors:Be}=I,Ce=ee?Be.primary:Be.surface,ke=ee?Be["on-primary"]:Be.primary,Oe=ee?Be["on-primary"]:Y?Be["text-body"]:Be["text-subtle"],Pe=ee?Be["on-primary"]:Be["primary-soft"],ze=ee?Be.primary:J?Be["on-primary"]:ke,Fe=_??B,He=m??(K?B:0),We=He>0,qe=b??I.space.sm,Ue=g??(K?I.space.sm:I.space.xs),$e=We?qe:Math.max(qe,T.bottom),Xe=We?Math.max(He,T.bottom>0?T.bottom+I.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:I.radius.pill:c??(Y?I.radius.pill:K?C:I.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:I.shadow[Qe],tt=void 0===et?null:(0,_shadows.supportsBoxShadow)()?{boxShadow:(0,_shadows.toBoxShadow)(et)}:et,it=x?_reactNative.StyleSheet.hairlineWidth:0,at=ee?Be.primary:Be.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:[V.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(Me),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})=>[V.centerPressable,{top:-nt},e?{opacity:.85}:null],testID:a.testID??(w?`${w}-center`:void 0),children:[a.content?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Me}]},children:a.content}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.centerCircle,{width:ue,height:ue,borderRadius:I.radius.pill,..._corners.smoothCorners,backgroundColor:a.color??Be.primary}],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Me}]},children:(0,_index3.renderSlotIcon)(a.icon??"add",{color:a.iconColor??Be["on-primary"],size:a.iconSize??24,disabled:!1})})}),(lt=a,s&&!H&<.label.trim().length>0?(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",numberOfLines:1,maxFontSizeMultiplier:A??I.settings.maxFontSizeMultiplier??1.2,style:[V.label,{color:Oe,opacity:ee?.7:1},j],children:a.label}):null)]})},CENTER_KEY):null;var lt;const dt=U?(0,_jsxRuntime.jsx)(_reactNative.View,{style:$?V.accessoryInline:V.accessoryStacked,onLayout:e=>G(e.nativeEvent.layout.height),testID:w?`${w}-accessory`:void 0,children:q}):null,ct=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$?[V.tabRow,V.tabRowInline]:V.tabRow,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;ne(t),oe(i)},children:[te&&ye>0&&(!Y||we>0)?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[V.pill,{width:ye,height:Y?we:D,left:Re,top:Ee,backgroundColor:Pe,borderRadius:Y?activeBgRadius(we,we/2):activeBgRadius(D,I.radius.pill),..._corners.smoothCorners,transform:[{translateX:Ve}]},N]}):null,J&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[V.bubble,I.shadow.elevated,{width:48,height:48,borderRadius:I.radius.pill,..._corners.smoothCorners,left:Ne,top:Se,backgroundColor:Be.primary,borderColor:Be.surface,transform:[{translateX:Ve}]},N]}):null,(ut=i.map(e=>{const t=e.key===n,i=t?ke:Oe,a=t?ze:Oe,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=ve.current[e.key];if(void 0===d||void 0===c)throw new Error(`BottomNavigation has no animation values for tab "${e.key}".`);const u=badgeVariantOf(e.badge??null),p=badgeAccessibilitySuffix(e.badge??null,E),h=ee&&!t?.7:1,_=J&&t||ee?Be.primary:Be.surface,m=hasLabel(e),g=m&&(!Q||t),b=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[V.iconWrap,{width:L+4,height:L+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:L,focused:t,disabled:!1})}),u?(0,_jsxRuntime.jsx)(_index4.Badge,{variant:u,value:"standard"!==u||"number"!=typeof e.badge&&"string"!=typeof e.badge?void 0:e.badge,tone:"danger",accessible:!1,style:"dot"===u?V.badgeDotPosition:V.badgePillPosition,badgeStyle:["dot"===u?V.badgeDot:V.badgePill,{borderColor:_}],textStyle:V.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:A??I.settings.maxFontSizeMultiplier??1.2,style:[V.label,Q?V.labelInline:null,{color:i,opacity:Q?c:h,fontWeight:t?I.weight.semibold:I.weight.normal},j],children:e.label}):null,y=(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>(e=>{H&&z(v),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:E.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})=>[V.tab,Y?V.tabTile:null,e?{opacity:.85}:null],testID:w?`${w}-tab-${e.key}`:void 0,children:Q?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.expandPill,{height:D,paddingHorizontal:t&&m?I.space.md:Math.max(0,(D-(L+4))/2)}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[V.expandFill,{borderRadius:activeBgRadius(D,D/2),..._corners.smoothCorners,backgroundColor:t?Be["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:y},e.key):y}),st?[...ut.slice(0,se),st,...ut.slice(se)]:ut),"underline"===l&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[V.underline,"top"===d?V.underlineTop:V.underlineBottom,"top"===d?{top:-qe-Z}:{bottom:-qe},{width:ge,height:3,backgroundColor:Be.primary,transform:[{translateX:Ve}]},N]}):null]});var ut;return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,testID:w,accessibilityRole:"tablist",style:[V.outer,{paddingHorizontal:Fe,paddingTop:Math.max(He,ot),paddingBottom:Xe},R],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[K?V.floatingBar:V.dockedBar,$?V.barInline:null,tt,{backgroundColor:Ce,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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_shadows=require("../../utils/shadows.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:v="idle",accessory:y,style:R,indicatorStyle:N,labelStyle:j,labelMaxFontScale:A,labels:S,testID:w}=e;(0,_assertValidValue.assertValidValue)("BottomNavigation","variant",e.variant,["pill","underline","floating","bubble","expand","solid","tile"]),(0,_assertValidValue.assertValidValue)("BottomNavigation","indicatorPosition",e.indicatorPosition,["top","bottom"]);const E=(0,_react.useMemo)(()=>S?{...DEFAULT_BOTTOM_NAVIGATION_LABELS,...S}:DEFAULT_BOTTOM_NAVIGATION_LABELS,[S]),I=(0,_index.useTheme)(),T=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),V=(0,_react.useMemo)(()=>buildStyles(I),[I]),L=h??18,D=L+4+8,M=I.space.lg,B=I.space.lg,C=I.radius.xl,k=(0,_useReducedMotion.useReducedMotion)(),O=(0,_useScreenReaderEnabled.useScreenReaderEnabled)(f),[P,z]=_react.default.useState(null);(0,_react.useEffect)(()=>{null!==P&&P!==v&&z(null)},[P,v]);const F=f&&!O&&"down"===v&&null===P,[H,W]=_react.default.useState(F);(0,_react.useEffect)(()=>{H!==F&&(k||"web"===_reactNative.Platform.OS||_reactNative.LayoutAnimation.configureNext(_reactNative.LayoutAnimation.Presets.easeInEaseOut),W(F))},[H,F,k]);const q="function"==typeof y?y({minimized:H}):y,U=null!=q&&!1!==q,$=H&&U,[X,G]=_react.default.useState(0),Z=U&&!$?X+I.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)({}),ve=(0,_react.useRef)({});i.forEach(e=>{fe.current[e.key]||(fe.current[e.key]=new _reactNative.Animated.Value(1)),ve.current[e.key]||(ve.current[e.key]=(0,_index.createAnimatedValue)(e.key===n?1:0))});const ye=ge>0?Y?Math.min(ge-4,96):Math.min(ge-M,64):0,Re=ge>0?(ge-ye)/2:0,Ne=ge>0?(ge-48)/2:0,hasLabel=e=>s&&!H&&!1!==e.showLabel&&e.label.trim().length>0,je=i[ie],Ae=je&&!hasLabel(je)&&re>0?re/2:I.space.xs+(L+4)/2,Se=Ae-14-24,we=Math.max(0,re-4),Ee=Y?2:Ae-D/2,Ie=(0,_react.useRef)(ie);(0,_react.useEffect)(()=>{if(Ie.current===ie)return;Ie.current=ie;const e=_reactNative.Animated.spring(xe,{toValue:ie,tension:120,friction:14,useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[ie,xe]);const Te=Math.max(1,i.length-1),Ve=(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]),Le=i.map(e=>e.key).join(" "),De=J||Q;(0,_react.useEffect)(()=>{const e=Le.split(" ").flatMap(e=>{const t=e===n?1:0,i=ve.current[e];return i?De?[_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,Le,De]);const popIcon=e=>{_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:1.15,duration:120,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.spring(e,{toValue:1,tension:200,friction:8,useNativeDriver:_nativeDriver.nativeDriver})]).start()},Me=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current,{colors:Be}=I,Ce=ee?Be.primary:Be.surface,ke=ee?Be["on-primary"]:Be.primary,Oe=ee?Be["on-primary"]:Y?Be["text-body"]:Be["text-subtle"],Pe=ee?Be["on-primary"]:Be["primary-soft"],ze=ee?Be.primary:J?Be["on-primary"]:ke,Fe=_??B,He=m??(K?B:0),We=He>0,qe=b??I.space.sm,Ue=g??(K?I.space.sm:I.space.xs),$e=We?qe:Math.max(qe,T.bottom),Xe=We?Math.max(He,T.bottom>0?T.bottom+I.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:I.radius.pill:c??(Y?I.radius.pill:K?C:I.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:I.shadow[Qe],tt=void 0===et?null:(0,_shadows.supportsBoxShadow)()?{boxShadow:(0,_shadows.toBoxShadow)(et)}:et,it=x?_reactNative.StyleSheet.hairlineWidth:0,at=ee?Be.primary:Be.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:[V.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(Me),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})=>[V.centerPressable,{top:-nt},e?{opacity:.85}:null],testID:a.testID??(w?`${w}-center`:void 0),children:[a.content?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Me}]},children:a.content}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.centerCircle,{width:ue,height:ue,borderRadius:I.radius.pill,..._corners.smoothCorners,backgroundColor:a.color??Be.primary}],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{transform:[{scale:Me}]},children:(0,_index3.renderSlotIcon)(a.icon??"add",{color:a.iconColor??Be["on-primary"],size:a.iconSize??24,disabled:!1})})}),(lt=a,s&&!H&<.label.trim().length>0?(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",numberOfLines:1,maxFontSizeMultiplier:A??I.settings.maxFontSizeMultiplier??1.2,style:[V.label,{color:Oe,opacity:ee?.7:1},j],children:a.label}):null)]})},CENTER_KEY):null;var lt;const dt=U?(0,_jsxRuntime.jsx)(_reactNative.View,{style:$?V.accessoryInline:V.accessoryStacked,onLayout:e=>G(e.nativeEvent.layout.height),testID:w?`${w}-accessory`:void 0,children:q}):null,ct=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$?[V.tabRow,V.tabRowInline]:V.tabRow,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;ne(t),oe(i)},children:[te&&ye>0&&(!Y||we>0)?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[V.pill,{width:ye,height:Y?we:D,left:Re,top:Ee,backgroundColor:Pe,borderRadius:Y?activeBgRadius(we,we/2):activeBgRadius(D,I.radius.pill),..._corners.smoothCorners,transform:[{translateX:Ve}]},N]}):null,J&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[V.bubble,I.shadow.elevated,{width:48,height:48,borderRadius:I.radius.pill,..._corners.smoothCorners,left:Ne,top:Se,backgroundColor:Be.primary,borderColor:Be.surface,transform:[{translateX:Ve}]},N]}):null,(ut=i.map(e=>{const t=e.key===n,i=t?ke:Oe,a=t?ze:Oe,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=ve.current[e.key];if(void 0===d||void 0===c)throw new Error(`BottomNavigation has no animation values for tab "${e.key}".`);const u=badgeVariantOf(e.badge??null),p=badgeAccessibilitySuffix(e.badge??null,E),h=ee&&!t?.7:1,_=J&&t||ee?Be.primary:Be.surface,m=hasLabel(e),g=m&&(!Q||t),b=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[V.iconWrap,{width:L+4,height:L+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:L,focused:t,disabled:!1})}),u?(0,_jsxRuntime.jsx)(_index4.Badge,{variant:u,value:"standard"!==u||"number"!=typeof e.badge&&"string"!=typeof e.badge?void 0:e.badge,tone:"danger",accessible:!1,style:"dot"===u?V.badgeDotPosition:V.badgePillPosition,badgeStyle:["dot"===u?V.badgeDot:V.badgePill,{borderColor:_}],textStyle:V.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:A??I.settings.maxFontSizeMultiplier??1.2,style:[V.label,Q?V.labelInline:null,{color:i,opacity:Q?c:h,fontWeight:t?I.weight.semibold:I.weight.normal},j],children:e.label}):null,y=(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>(e=>{H&&z(v),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:E.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})=>[V.tab,Y?V.tabTile:null,e?{opacity:.85}:null],testID:w?`${w}-tab-${e.key}`:void 0,children:Q?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.expandPill,{height:D,paddingHorizontal:t&&m?I.space.md:Math.max(0,(D-(L+4))/2)}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[V.expandFill,{borderRadius:activeBgRadius(D,D/2),..._corners.smoothCorners,backgroundColor:t?Be["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:y},e.key):y}),st?[...ut.slice(0,se),st,...ut.slice(se)]:ut),"underline"===l&&ge>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[V.underline,"top"===d?V.underlineTop:V.underlineBottom,"top"===d?{top:-qe-Z}:{bottom:-qe},{width:ge,height:3,backgroundColor:Be.primary,transform:[{translateX:Ve}]},N]}):null]});var ut;return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,testID:w,accessibilityRole:"tablist",style:[V.outer,{paddingHorizontal:Fe,paddingTop:Math.max(He,ot),paddingBottom:Xe},R],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[K?V.floatingBar:V.dockedBar,$?V.barInline:null,tt,{backgroundColor:Ce,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:Math.round(e.text.xs.size*e.leading.heading)}});var _default=exports.default=BottomNavigation;
|