@plexui/react-native 0.2.4 → 0.2.6
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/es/components/Badge/Badge.js +10 -0
- package/dist/es/components/DatePicker/Calendar.js +112 -0
- package/dist/es/components/DatePicker/DatePicker.js +335 -0
- package/dist/es/components/DatePicker/TimeDial.js +123 -0
- package/dist/es/components/DatePicker/Wheel.js +164 -0
- package/dist/es/components/DatePicker/dates.js +147 -0
- package/dist/es/components/Dialog/Dialog.js +21 -0
- package/dist/es/components/Icon/material.js +16 -0
- package/dist/es/components/PageControl/PageControl.js +49 -22
- package/dist/es/components/ScrollEdge/ScrollEdge.js +27 -0
- package/dist/es/components/TabBar/TabBar.js +16 -13
- package/dist/es/index.js +2 -0
- package/dist/es/internal/BarBackdrop.js +54 -0
- package/dist/types/components/Badge/Badge.d.ts +1 -1
- package/dist/types/components/DatePicker/Calendar.d.ts +29 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/types/components/DatePicker/TimeDial.d.ts +20 -0
- package/dist/types/components/DatePicker/Wheel.d.ts +40 -0
- package/dist/types/components/DatePicker/dates.d.ts +45 -0
- package/dist/types/components/Dialog/Dialog.d.ts +18 -0
- package/dist/types/components/Icon/material.d.ts +6 -0
- package/dist/types/components/PageControl/PageControl.d.ts +12 -1
- package/dist/types/components/ScrollEdge/ScrollEdge.d.ts +19 -0
- package/dist/types/components/TabBar/TabBar.d.ts +14 -4
- package/dist/types/index.d.ts +3 -1
- package/dist/types/internal/BarBackdrop.d.ts +9 -0
- package/package.json +1 -1
- package/src/components/Badge/Badge.tsx +9 -1
- package/src/components/DatePicker/Calendar.tsx +227 -0
- package/src/components/DatePicker/DatePicker.tsx +608 -0
- package/src/components/DatePicker/TimeDial.tsx +201 -0
- package/src/components/DatePicker/Wheel.tsx +247 -0
- package/src/components/DatePicker/dates.ts +161 -0
- package/src/components/Dialog/Dialog.tsx +46 -0
- package/src/components/Icon/material.ts +18 -0
- package/src/components/PageControl/PageControl.tsx +71 -24
- package/src/components/ScrollEdge/ScrollEdge.tsx +48 -0
- package/src/components/TabBar/TabBar.tsx +33 -15
- package/src/index.ts +3 -0
- package/src/internal/BarBackdrop.tsx +73 -0
|
@@ -3,7 +3,7 @@ import { createContext, useCallback, useContext, useEffect, useRef, useState } f
|
|
|
3
3
|
import { Animated, Easing, Pressable, StyleSheet, View, } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import Search from "../../icons/plex/Search";
|
|
6
|
-
import { BarBackdrop, SoftBottomEdge, ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, glassBarBlur, useAndroidGlass } from "../../internal/BarBackdrop";
|
|
6
|
+
import { BarBackdrop, SoftBottomEdge, TabBarFade, ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, glassBarBlur, useAndroidGlass } from "../../internal/BarBackdrop";
|
|
7
7
|
import { childrenOfType, textOf } from "../../internal/children";
|
|
8
8
|
import { physicalPadding } from "../../internal/direction";
|
|
9
9
|
import { Glass } from "../../internal/Glass";
|
|
@@ -40,7 +40,7 @@ function press(context, { value, disabled, onPress }, collapsed) {
|
|
|
40
40
|
onPress?.();
|
|
41
41
|
context.select(value);
|
|
42
42
|
}
|
|
43
|
-
function IOSTab({ value, label, icon, badge, disabled = false, onPress, testID, context, kind = "tab", hideLabel = false }) {
|
|
43
|
+
function IOSTab({ value, label, icon, badge, badgeColor, disabled = false, onPress, testID, context, kind = "tab", hideLabel = false }) {
|
|
44
44
|
const theme = useTheme();
|
|
45
45
|
const selected = context.value === value;
|
|
46
46
|
const circle = kind === "circle";
|
|
@@ -69,16 +69,17 @@ function IOSTab({ value, label, icon, badge, disabled = false, onPress, testID,
|
|
|
69
69
|
// A minimized tab takes the touches of its whole 48pt circle, not only its 40pt face
|
|
70
70
|
hitSlop: collapsed ? capsulePadding : undefined,
|
|
71
71
|
// A tab bar's labels keep their size, as UIKit's: a large text size shows the tab in the large content viewer
|
|
72
|
-
accessibilityShowsLargeContentViewer: true, accessibilityLargeContentTitle: textOf(label) || undefined, style: [styles.iosItem, size, circle ? null : { flexShrink: 1, minWidth: 0 }], children: [selected && !collapsed ? _jsx(View, { pointerEvents: "none", style: [styles.pill, pill, { backgroundColor: theme.color("--tab-bar-item-background-selected") }] }) : null, _jsx(View, { style: [styles.iosIcon, { height: theme.length("--tab-bar-icon-box", 28) }], children: _jsx(IconDefaultsProvider, { size: theme.length("--tab-bar-icon-size", 28), color: color, children: icon }) }), showLabel ? (_jsx(Text, { numberOfLines: 1, allowFontScaling: false, weight: "semibold", color: color, style: { fontSize: theme.length("--tab-bar-label-font-size", 10), lineHeight: theme.length("--tab-bar-label-line-height", 12), maxWidth: "100%" }, children: label })) : null, hasBadge(badge) && !circle ? (_jsx(View, { pointerEvents: "none", style: [styles.iosBadge, iosBadgeStyle(theme), { top: badgeTop, marginLeft: badgeStart }], children: badge === true ? null : (_jsx(Text, { color: theme.color("--tab-bar-badge-color"), style: iosBadgeText(theme), numberOfLines: 1, allowFontScaling: false, children: badge })) })) : null] }));
|
|
72
|
+
accessibilityShowsLargeContentViewer: true, accessibilityLargeContentTitle: textOf(label) || undefined, style: [styles.iosItem, size, circle ? null : { flexShrink: 1, minWidth: 0 }], children: [selected && !collapsed ? _jsx(View, { pointerEvents: "none", style: [styles.pill, pill, { backgroundColor: theme.color("--tab-bar-item-background-selected") }] }) : null, _jsx(View, { style: [styles.iosIcon, { height: theme.length("--tab-bar-icon-box", 28) }], children: _jsx(IconDefaultsProvider, { size: theme.length("--tab-bar-icon-size", 28), color: color, children: icon }) }), showLabel ? (_jsx(Text, { numberOfLines: 1, allowFontScaling: false, weight: "semibold", color: color, style: { fontSize: theme.length("--tab-bar-label-font-size", 10), lineHeight: theme.length("--tab-bar-label-line-height", 12), maxWidth: "100%" }, children: label })) : null, hasBadge(badge) && !circle ? (_jsx(View, { pointerEvents: "none", style: [styles.iosBadge, iosBadgeStyle(theme, badgeColor ?? context.badgeColor), { top: badgeTop, marginLeft: badgeStart }], children: badge === true ? null : (_jsx(Text, { color: (badgeColor ?? context.badgeColor) === "accent" ? theme.color("--color-text-accent-solid", "#FFFFFF") : theme.color("--tab-bar-badge-color"), style: iosBadgeText(theme), numberOfLines: 1, allowFontScaling: false, children: badge })) })) : null] }));
|
|
73
73
|
}
|
|
74
|
-
const iosBadgeStyle = (theme) => {
|
|
74
|
+
const iosBadgeStyle = (theme, color) => {
|
|
75
75
|
const size = theme.length("--tab-bar-badge-size", 18);
|
|
76
76
|
return {
|
|
77
77
|
minWidth: size,
|
|
78
78
|
height: size,
|
|
79
79
|
paddingHorizontal: theme.length("--tab-bar-badge-padding-inline", 5),
|
|
80
80
|
borderRadius: size / 2,
|
|
81
|
-
|
|
81
|
+
// iOS's own red, or the accent
|
|
82
|
+
backgroundColor: color === "accent" ? theme.color("--color-background-accent-solid") : theme.color("--tab-bar-badge-background"),
|
|
82
83
|
};
|
|
83
84
|
};
|
|
84
85
|
const iosBadgeText = (theme) => ({
|
|
@@ -99,7 +100,7 @@ const COUNT_SLIDE = 3;
|
|
|
99
100
|
* behind it). `true` draws a dot of the accent there. It scales in and out about that point (the center of a dot or a
|
|
100
101
|
* one-digit count), staying drawn as it shrinks away.
|
|
101
102
|
*/
|
|
102
|
-
function AndroidBadge({ badge, ring }) {
|
|
103
|
+
function AndroidBadge({ badge, ring, color }) {
|
|
103
104
|
const theme = useTheme();
|
|
104
105
|
const m = theme.material;
|
|
105
106
|
const reduced = theme.reducedMotion;
|
|
@@ -134,7 +135,7 @@ function AndroidBadge({ badge, ring }) {
|
|
|
134
135
|
return null;
|
|
135
136
|
const shown = visible ? badge : last;
|
|
136
137
|
const dot = shown === true;
|
|
137
|
-
return (_jsx(Animated.View, { pointerEvents: "none", style: [styles.androidBadgeFrame, { transform: [{ scale }] }], children: _jsx(Animated.View, { style: [dot ? styles.androidDot : styles.androidBadge, { backgroundColor: m.primary, borderColor: ring }], children: dot ? null : _jsx(BadgeCount, { value: shown, color: m.onPrimary, reduced: reduced }) }) }));
|
|
138
|
+
return (_jsx(Animated.View, { pointerEvents: "none", style: [styles.androidBadgeFrame, { transform: [{ scale }] }], children: _jsx(Animated.View, { style: [dot ? styles.androidDot : styles.androidBadge, { backgroundColor: color === "danger" ? m.error : m.primary, borderColor: ring }], children: dot ? null : _jsx(BadgeCount, { value: shown, color: color === "danger" ? m.onError : m.onPrimary, reduced: reduced }) }) }));
|
|
138
139
|
}
|
|
139
140
|
/**
|
|
140
141
|
* The text of an Android badge. When a count changes, the characters it shares with the last one (from either end)
|
|
@@ -209,7 +210,7 @@ function AndroidTabIcon({ icon, shown, selected, from, to }) {
|
|
|
209
210
|
* darker text, both blending there with the tab's own pill of the accent at 9%, which fades in and grows from 0.6
|
|
210
211
|
* over 320ms, decelerating. No ripple on a press, as the Android tab bar draws none.
|
|
211
212
|
*/
|
|
212
|
-
function AndroidTab({ value, label, icon, badge, disabled = false, onPress, testID, context, width, fontSize, }) {
|
|
213
|
+
function AndroidTab({ value, label, icon, badge, badgeColor, disabled = false, onPress, testID, context, width, fontSize, }) {
|
|
213
214
|
const theme = useTheme();
|
|
214
215
|
const m = theme.material;
|
|
215
216
|
const selected = context.value === value;
|
|
@@ -233,7 +234,7 @@ function AndroidTab({ value, label, icon, badge, disabled = false, onPress, test
|
|
|
233
234
|
opacity: shown.interpolate({ inputRange: [0, 1], outputRange: [0, 1], easing: DECELERATE }),
|
|
234
235
|
transform: [{ scale: shown.interpolate({ inputRange: [0, 1], outputRange: [0.6, 1] }) }],
|
|
235
236
|
},
|
|
236
|
-
] }), _jsx(AndroidTabIcon, { icon: icon, shown: shown, selected: selected, from: iconFrom, to: iconTo }), _jsx(Animated.Text, { numberOfLines: 1, style: [textStyle(theme, { weight: selected ? "bold" : "medium" }), { fontSize, lineHeight: 16, letterSpacing: theme.tracking(fontSize), maxWidth: "100%", color: text }], children: label }), _jsx(AndroidBadge, { badge: badge, ring: shown.interpolate({ inputRange: [0, 1], outputRange: [card, mix(m.primary, card, 0.09)], easing: DECELERATE }) })] }));
|
|
237
|
+
] }), _jsx(AndroidTabIcon, { icon: icon, shown: shown, selected: selected, from: iconFrom, to: iconTo }), _jsx(Animated.Text, { numberOfLines: 1, style: [textStyle(theme, { weight: selected ? "bold" : "medium" }), { fontSize, lineHeight: 16, letterSpacing: theme.tracking(fontSize), maxWidth: "100%", color: text }], children: label }), _jsx(AndroidBadge, { badge: badge, color: badgeColor ?? context.badgeColor, ring: shown.interpolate({ inputRange: [0, 1], outputRange: [card, mix(m.primary, card, 0.09)], easing: DECELERATE }) })] }));
|
|
237
238
|
}
|
|
238
239
|
/**
|
|
239
240
|
* The search or prominent tab of the bar, a 56dp circle of its own beside the capsule (ours: the Android bar has
|
|
@@ -296,7 +297,7 @@ function AndroidBar({ context, tabs, circle, accent, accessory, background, scro
|
|
|
296
297
|
// Android's fade under its tabs, from the bar's top (8 above the capsule): the
|
|
297
298
|
// screen's color fading in over 60dp in four even steps, then at 81% down to the edge; the other backgrounds show
|
|
298
299
|
// once content is under the bar
|
|
299
|
-
const backdrop = background === "soft" ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : background === "hard" ? (_jsx(BarBackdrop, { fill: canvas, line: scrolled ? m.outlineVariant : undefined, edge: "top" })) : background === "glass" && scrolled ? (_jsx(BarBackdrop, { fill: veil, blur: glassBarBlur(theme), line: m.outlineVariant, edge: "top" })) : null;
|
|
300
|
+
const backdrop = background === "soft" || background === "fade" ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : background === "hard" ? (_jsx(BarBackdrop, { fill: canvas, line: scrolled ? m.outlineVariant : undefined, edge: "top" })) : background === "glass" && scrolled ? (_jsx(BarBackdrop, { fill: veil, blur: glassBarBlur(theme), line: m.outlineVariant, edge: "top" })) : null;
|
|
300
301
|
return (_jsxs(View, { ...rest,
|
|
301
302
|
// Around the capsule the content shows and takes touches
|
|
302
303
|
pointerEvents: "box-none", onLayout: (event) => setWidth(event.nativeEvent.layout.width), style: [
|
|
@@ -316,7 +317,7 @@ const items = (children) => childrenOfType(children, TabBarItem);
|
|
|
316
317
|
* beside it.
|
|
317
318
|
* Props follow @plexui/ui.
|
|
318
319
|
*/
|
|
319
|
-
function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, prominent, minimized: minimizedProp, defaultMinimized = false, onMinimizedChange, background = "soft", scrolled = false, canvasColor, accessory, safeArea = true, "aria-label": ariaLabel = "Tabs", children, style, ...rest }) {
|
|
320
|
+
function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, prominent, minimized: minimizedProp, defaultMinimized = false, onMinimizedChange, background = "soft", scrolled = false, canvasColor, accessory, safeArea = true, badgeColor, "aria-label": ariaLabel = "Tabs", children, style, ...rest }) {
|
|
320
321
|
const theme = useTheme();
|
|
321
322
|
const insets = useSafeAreaInsets();
|
|
322
323
|
const tabs = items(children);
|
|
@@ -344,7 +345,7 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
|
|
|
344
345
|
const visible = shown.length ? shown : capsuleTabs.slice(0, 1);
|
|
345
346
|
const reachable = [...visible, ...(circle ? [circle] : [])];
|
|
346
347
|
const keys = useTabKeys(reachable, value, select);
|
|
347
|
-
const context = { value, minimized, select, expand, keys };
|
|
348
|
+
const context = { value, badgeColor, minimized, select, expand, keys };
|
|
348
349
|
if (theme.isAndroid) {
|
|
349
350
|
return (_jsx(TabBarContext.Provider, { value: context, children: _jsx(AndroidBar, { context: context, tabs: capsuleTabs, circle: circle, accent: !!prominentTab, accessory: accessory, background: background, scrolled: scrolled, canvasColor: canvasColor, safeArea: safeArea, ariaLabel: ariaLabel, rest: rest, style: style }) }));
|
|
350
351
|
}
|
|
@@ -360,7 +361,9 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
|
|
|
360
361
|
const minimizedGap = theme.length("--tab-bar-minimized-accessory-gap", 13.33);
|
|
361
362
|
const canvas = canvasColor ?? theme.colors.background;
|
|
362
363
|
const veil = withAlpha(canvas, parseFloat(String(theme.token("--page-bar-veil-opacity") ?? "55")) / 100);
|
|
363
|
-
const backdrop = background === "hard" ? (_jsx(BarBackdrop, { fill: canvas, line: scrolled ? theme.color("--page-bar-hard-line") : undefined, edge: "top" })) : background === "glass" && scrolled ? (_jsx(BarBackdrop, { fill: veil, blur: glassBarBlur(theme), line: theme.color("--page-bar-line"), edge: "top" })) :
|
|
364
|
+
const backdrop = background === "hard" ? (_jsx(BarBackdrop, { fill: canvas, line: scrolled ? theme.color("--page-bar-hard-line") : undefined, edge: "top" })) : background === "glass" && scrolled ? (_jsx(BarBackdrop, { fill: veil, blur: glassBarBlur(theme), line: theme.color("--page-bar-line"), edge: "top" })) : background === "fade" ? (
|
|
365
|
+
// The screen's color coming in from the capsule's top (or the accessory's) down
|
|
366
|
+
_jsx(TabBarFade, { fill: canvas, top: padTop })) : null;
|
|
364
367
|
// The accessory keeps one place in the tree, so its state lives through a minimize: above the capsule, or between
|
|
365
368
|
// the two circles as tall as they are. The bar keeps its height either way, as TabBar.module.css
|
|
366
369
|
const sideLeft = gutter + (safeArea ? insets.left : 0);
|
package/dist/es/index.js
CHANGED
|
@@ -26,6 +26,8 @@ export { OTPInput } from "./components/OTPInput/OTPInput";
|
|
|
26
26
|
export { Select } from "./components/Select/Select";
|
|
27
27
|
export { Menu } from "./components/Menu/Menu";
|
|
28
28
|
export { ContextMenu } from "./components/ContextMenu/ContextMenu";
|
|
29
|
+
export { ScrollEdge } from "./components/ScrollEdge/ScrollEdge";
|
|
30
|
+
export { DatePicker } from "./components/DatePicker/DatePicker";
|
|
29
31
|
export { ActionSheet } from "./components/ActionSheet/ActionSheet";
|
|
30
32
|
export { BottomSheet } from "./components/BottomSheet/BottomSheet";
|
|
31
33
|
export { Dialog } from "./components/Dialog/Dialog";
|
|
@@ -177,3 +177,57 @@ export function SoftTopEdge({ fill, blur }) {
|
|
|
177
177
|
const stops = fadeStops(210 / 255, 48).map(([alpha, from]) => `${withAlpha(fill, alpha)} ${from}px`);
|
|
178
178
|
return (_jsxs(View, { pointerEvents: "none", style: StyleSheet.absoluteFill, children: [_jsx(View, { style: { flex: 1, backgroundColor: withAlpha(fill, 210 / 255) } }), _jsx(View, { style: { height: 48, backgroundImage: `linear-gradient(to bottom, ${stops.join(", ")})` } })] }));
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* iOS 27.2's soft scroll edge under a bottom bar (styles' --page-bar-soft-bottom-*, measured on a scrolled list,
|
|
182
|
+
* owner 13.11): from 34pt above the bar's items down to the screen's edge, a veil of the canvas color (8% 9 into the
|
|
183
|
+
* layer, 15% from 25 to 37, 23% at 45, 31% at 57, 46% from 77 down) over a 10pt blur that takes hold from 12 to 40
|
|
184
|
+
* into it. Over the canvas alone it draws nothing to see, so it stays drawn. Native draws the veil without the blur.
|
|
185
|
+
*/
|
|
186
|
+
const BOTTOM_REACH = 34;
|
|
187
|
+
const BOTTOM_VEIL = [
|
|
188
|
+
[0, 0],
|
|
189
|
+
[0.08, 9],
|
|
190
|
+
[0.15, 25],
|
|
191
|
+
[0.15, 37],
|
|
192
|
+
[0.23, 45],
|
|
193
|
+
[0.31, 57],
|
|
194
|
+
[0.46, 77],
|
|
195
|
+
];
|
|
196
|
+
export function SoftBottomVeil({ fill, top, bottom }) {
|
|
197
|
+
// `top`: under a bottom bar whose items start there; `bottom`: turned over, under the status bar `bottom` tall
|
|
198
|
+
const up = bottom != null;
|
|
199
|
+
const place = up
|
|
200
|
+
? { position: "absolute", top: 0, left: 0, right: 0, height: bottom + BOTTOM_REACH, overflow: "hidden", justifyContent: "flex-end" }
|
|
201
|
+
: { position: "absolute", top: (top ?? 0) - BOTTOM_REACH, left: 0, right: 0, bottom: 0 };
|
|
202
|
+
const way = up ? "to top" : "to bottom";
|
|
203
|
+
if (Platform.OS === "web") {
|
|
204
|
+
const veil = `linear-gradient(${way}, ${BOTTOM_VEIL.map(([alpha, at]) => `${black(alpha)} ${at}px`).join(", ")})`;
|
|
205
|
+
const blurMask = `linear-gradient(${way}, transparent 12px, #000 40px)`;
|
|
206
|
+
return (_jsxs(View, { pointerEvents: "none", style: place, children: [_jsx(View, { style: [StyleSheet.absoluteFill, { backdropFilter: "blur(10px)", WebkitBackdropFilter: "blur(10px)", maskImage: blurMask, WebkitMaskImage: blurMask }] }), _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: fill, maskImage: veil, WebkitMaskImage: veil }] })] }));
|
|
207
|
+
}
|
|
208
|
+
const last = BOTTOM_VEIL[BOTTOM_VEIL.length - 1];
|
|
209
|
+
const gradient = `linear-gradient(${way}, ${BOTTOM_VEIL.map(([alpha, at]) => `${withAlpha(fill, alpha)} ${at}px`).join(", ")})`;
|
|
210
|
+
const ramp = _jsx(View, { style: { height: last[1], backgroundImage: gradient } });
|
|
211
|
+
const rest = _jsx(View, { style: { flex: 1, backgroundColor: withAlpha(fill, last[0]) } });
|
|
212
|
+
return (_jsxs(View, { pointerEvents: "none", style: place, children: [up ? rest : ramp, up ? ramp : rest] }));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The fade under a tab bar's capsule, as apps that mute the content under their tab bar draw it (measured on one at
|
|
216
|
+
* 3x): nothing above the capsule, so the rows over it stay clear; from the capsule's top the screen's color comes in
|
|
217
|
+
* over 60pt (6% 5 in, 25% 21 in, 37% 32 in, 56% 42 in, 69% 51 in, 85% from 60 in) and holds to the screen's edge,
|
|
218
|
+
* with no blur: the text under it stays sharp, only faint.
|
|
219
|
+
*/
|
|
220
|
+
const TAB_FADE = [
|
|
221
|
+
[0, 0],
|
|
222
|
+
[0.06, 5],
|
|
223
|
+
[0.25, 21],
|
|
224
|
+
[0.37, 32],
|
|
225
|
+
[0.56, 42],
|
|
226
|
+
[0.69, 51],
|
|
227
|
+
[0.85, 60],
|
|
228
|
+
];
|
|
229
|
+
export function TabBarFade({ fill, top }) {
|
|
230
|
+
const last = TAB_FADE[TAB_FADE.length - 1];
|
|
231
|
+
const gradient = `linear-gradient(to bottom, ${TAB_FADE.map(([alpha, at]) => `${withAlpha(fill, alpha)} ${at}px`).join(", ")})`;
|
|
232
|
+
return (_jsxs(View, { pointerEvents: "none", style: { position: "absolute", top, left: 0, right: 0, bottom: 0 }, children: [_jsx(View, { style: { height: last[1], backgroundImage: gradient } }), _jsx(View, { style: { flex: 1, backgroundColor: withAlpha(fill, last[0]) } })] }));
|
|
233
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
3
|
import type { Theme } from "../../theme/types";
|
|
4
|
-
export type BadgeColor = "secondary" | "success" | "danger" | "warning" | "info" | "discovery" | "caution";
|
|
4
|
+
export type BadgeColor = "secondary" | "accent" | "success" | "danger" | "warning" | "info" | "discovery" | "caution";
|
|
5
5
|
export type BadgeVariant = "solid" | "soft" | "outline" | "counter";
|
|
6
6
|
export type BadgeSize = "sm" | "md" | "lg" | "xl";
|
|
7
7
|
export type BadgeProps = {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type CalendarProps = {
|
|
2
|
+
/** The chosen day. */
|
|
3
|
+
value: Date | null;
|
|
4
|
+
/** Called with the day a person taps (its time is midnight). */
|
|
5
|
+
onSelect: (day: Date) => void;
|
|
6
|
+
min?: Date;
|
|
7
|
+
max?: Date;
|
|
8
|
+
locale?: string;
|
|
9
|
+
weekStartsOn: number;
|
|
10
|
+
/** The calendar's width: seven columns across it (44 at the least on iOS). */
|
|
11
|
+
width: number;
|
|
12
|
+
/** Takes no presses (an inline calendar of a disabled picker). */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Labels of the month arrows, read by a screen reader. */
|
|
15
|
+
previousLabel?: string;
|
|
16
|
+
nextLabel?: string;
|
|
17
|
+
testID?: string;
|
|
18
|
+
};
|
|
19
|
+
/** iOS: the corner's inset around the grid of a compact picker's calendar (the web's `--calendar-inner-padding`). */
|
|
20
|
+
export declare const IOS_CALENDAR_INSET = 10;
|
|
21
|
+
/**
|
|
22
|
+
* The month grid of DatePicker. On iOS the phone calendar of @plexui/ui (Calendar.module.css under 768px): the month's
|
|
23
|
+
* title Semibold 17 at the row's text inset, the two arrows as 44 targets at the end, the weekdays Semibold 13 in
|
|
24
|
+
* capitals in the tertiary label, the days Regular 17 in 44 cells side by side and row on row, the chosen day white on
|
|
25
|
+
* a 44 circle of the text's color, today a 4 dot under its digits, days out of range at 40%. On Android Material 3's
|
|
26
|
+
* date picker: the month at the start in Medium 14 with the arrows at the end, the weekdays' letters, the days in 40dp
|
|
27
|
+
* circles, the chosen one filled with the primary color and today ringed in it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Calendar({ value, onSelect, min, max, locale, weekStartsOn, width, disabled: off, previousLabel, nextLabel, testID }: CalendarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
export type DatePickerMode = "date" | "time" | "datetime";
|
|
3
|
+
export type DatePickerDisplay = "compact" | "inline" | "wheels";
|
|
4
|
+
export type DatePickerProps = {
|
|
5
|
+
/** The date and time chosen, `null` for none yet. */
|
|
6
|
+
value: Date | null;
|
|
7
|
+
/** Called with the new date (its time kept when only the day changes, its day when only the time does). */
|
|
8
|
+
onChange: (value: Date) => void;
|
|
9
|
+
/** What is chosen: a day, a time, or both. @default "date" */
|
|
10
|
+
mode?: DatePickerMode;
|
|
11
|
+
/**
|
|
12
|
+
* How it is drawn. `compact`: the value in a capsule on iOS that opens the calendar (or the time's wheels) in a
|
|
13
|
+
* popover, Android's field or row value that opens Material's date (or time) dialog. `inline`: the month's calendar
|
|
14
|
+
* in place. `wheels`: the wheels of iOS, Android's spinners. @default "compact"
|
|
15
|
+
*/
|
|
16
|
+
display?: DatePickerDisplay;
|
|
17
|
+
/** The earliest date that can be chosen. */
|
|
18
|
+
min?: Date;
|
|
19
|
+
/** The latest date that can be chosen. */
|
|
20
|
+
max?: Date;
|
|
21
|
+
/** The locale of the names and the formats. @default the device's */
|
|
22
|
+
locale?: string;
|
|
23
|
+
/** The first day of the week, 0 Sunday to 6 Saturday. @default the locale's */
|
|
24
|
+
weekStartsOn?: number;
|
|
25
|
+
/** A 12-hour clock with AM and PM. @default the locale's */
|
|
26
|
+
hour12?: boolean;
|
|
27
|
+
/** Shown while there is no value. @default "Select date" / "Select time" */
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** The picker's name for a screen reader (a row's label). */
|
|
31
|
+
"aria-label"?: string;
|
|
32
|
+
/** Android: the header of the date dialog. @default "Select date" */
|
|
33
|
+
dateTitle?: string;
|
|
34
|
+
/** Android: the header of the time dialog. @default "Select time" */
|
|
35
|
+
timeTitle?: string;
|
|
36
|
+
/** @default "Cancel" */
|
|
37
|
+
cancelLabel?: string;
|
|
38
|
+
/** @default "OK" */
|
|
39
|
+
okLabel?: string;
|
|
40
|
+
/** The label of the time row under an inline calendar (`mode="datetime"`). @default "Time" */
|
|
41
|
+
timeLabel?: string;
|
|
42
|
+
testID?: string;
|
|
43
|
+
style?: StyleProp<ViewStyle>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A date and time picker. On iOS UIDatePicker of iOS 27.2: `compact`, the date and the time in two capsules 8 apart
|
|
47
|
+
* (34 tall, 12 in, the secondary soft fill, the text in the accent while open) that open the month's calendar and the
|
|
48
|
+
* time's wheels in the glass popover, at most 32 from the screen's edge; `inline`, the calendar in place (a Time row
|
|
49
|
+
* under it for both); `wheels`, the wheels. On Android Material 3's pickers: the value as a row's value in the accent
|
|
50
|
+
* (or an outlined field with its icon) that opens the date picker dialog (the headline date over the month) or the
|
|
51
|
+
* time picker dial, both applied with OK; `inline` the calendar in place, `wheels` Android's spinners. The value is a
|
|
52
|
+
* plain `Date`; `min` and `max` bound it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function DatePicker({ value, onChange, mode, display, min, max, locale, weekStartsOn, hour12, placeholder, disabled, "aria-label": ariaLabel, dateTitle, timeTitle, cancelLabel, okLabel, timeLabel, testID, style, }: DatePickerProps): import("react").JSX.Element;
|
|
55
|
+
export declare namespace DatePicker {
|
|
56
|
+
var displayName: string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TimeDialProps = {
|
|
2
|
+
hours: number;
|
|
3
|
+
minutes: number;
|
|
4
|
+
onChange: (hours: number, minutes: number) => void;
|
|
5
|
+
hour12: boolean;
|
|
6
|
+
locale?: string;
|
|
7
|
+
/** The header over the time ("Select time"). */
|
|
8
|
+
title: string;
|
|
9
|
+
hoursLabel?: string;
|
|
10
|
+
minutesLabel?: string;
|
|
11
|
+
testID?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Android's time picker dial (Material 3 TimePicker): "Select time" in Medium 12, the hour and the minute in Regular
|
|
15
|
+
* 57 boxes 96 by 80 (the one being set in the primary container, the other in the highest surface container), AM and
|
|
16
|
+
* PM stacked beside them on a 12-hour clock, and the 256dp dial: a 48dp knob in the primary color on a line from the
|
|
17
|
+
* middle, the numbers 101dp out (a 24-hour clock adds 00 and 13–23 69dp out). A tap or a drag on the dial sets the
|
|
18
|
+
* hour, then it turns to the minutes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function TimeDial({ hours, minutes, onChange, hour12, locale, title, hoursLabel, minutesLabel, testID }: TimeDialProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type WheelItem = {
|
|
2
|
+
label: string;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type WheelColumn = {
|
|
6
|
+
key: string;
|
|
7
|
+
items: WheelItem[];
|
|
8
|
+
/** The item at the band. */
|
|
9
|
+
index: number;
|
|
10
|
+
onChange: (index: number) => void;
|
|
11
|
+
/** The column's width. */
|
|
12
|
+
width: number;
|
|
13
|
+
/** The column's name, read by a screen reader ("Hours"). */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Where its labels stand in the column. @default "center" */
|
|
16
|
+
align?: "start" | "center" | "end";
|
|
17
|
+
/** The labels' inset from the column's side they stand at. @default 4 */
|
|
18
|
+
inset?: number;
|
|
19
|
+
};
|
|
20
|
+
export type WheelsProps = {
|
|
21
|
+
columns: WheelColumn[];
|
|
22
|
+
/** The wheels' height. @default 202 on iOS (a compact time picker's popover), 144 on Android */
|
|
23
|
+
height?: number;
|
|
24
|
+
/** iOS: the band's inset from the wheels' sides. @default 20 */
|
|
25
|
+
bandInset?: number;
|
|
26
|
+
/** Takes no turns, presses or keys. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
testID?: string;
|
|
29
|
+
};
|
|
30
|
+
/** iOS: a row of UIDatePicker's wheels, 32 apart (the band of iOS 27.2, 32 tall). Android: a NumberPicker's 48dp rows. */
|
|
31
|
+
export declare const IOS_WHEEL_ROW = 32;
|
|
32
|
+
export declare const ANDROID_WHEEL_ROW = 48;
|
|
33
|
+
/**
|
|
34
|
+
* The wheels of a time (or date) picker. On iOS UIDatePicker's `.wheels` as iOS 27.2 draws them in a compact time
|
|
35
|
+
* picker's popover: rows 32 apart in Regular 22, a 32 band of the ink at 7% across the columns 20 in from the sides,
|
|
36
|
+
* the rows on the band in the ink and the others in its 35% gray, turning away like a cylinder's. On Android the
|
|
37
|
+
* spinner mode of its DatePicker and TimePicker: three 48dp rows, the middle one between two lines in the ink, the
|
|
38
|
+
* others faded. A wheel stops on a row; a tap on a row turns it there; VoiceOver and TalkBack turn it one row at a time.
|
|
39
|
+
*/
|
|
40
|
+
export declare function Wheels({ columns, height: heightProp, bandInset, disabled, testID }: WheelsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Date helpers of DatePicker: plain `Date`s in the device's time zone, days compared by their calendar date. */
|
|
2
|
+
export declare function sameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
|
|
3
|
+
export declare function startOfDay(date: Date): Date;
|
|
4
|
+
/** The first day of the month `offset` months from `date`'s. */
|
|
5
|
+
export declare function monthOf(date: Date, offset?: number): Date;
|
|
6
|
+
/** A day lies outside `min`…`max` (compared by calendar day). */
|
|
7
|
+
export declare function dayOutside(day: Date, min?: Date, max?: Date): boolean;
|
|
8
|
+
/** A moment lies outside `min`…`max` (compared to the minute). */
|
|
9
|
+
export declare function timeOutside(date: Date, min?: Date, max?: Date): boolean;
|
|
10
|
+
/** The date kept inside `min`…`max`. */
|
|
11
|
+
export declare function clampDate(date: Date, min?: Date, max?: Date): Date;
|
|
12
|
+
/** The weeks of a month, each of seven days; days of the months around it are `null`. */
|
|
13
|
+
export declare function monthWeeks(month: Date, weekStartsOn: number): (Date | null)[][];
|
|
14
|
+
/** `value` on `day`: its time kept, the start of the day when there is no value yet. */
|
|
15
|
+
export declare function withDay(value: Date | null, day: Date): Date;
|
|
16
|
+
/** `value` at `hours`:`minutes`, today when there is no value yet. */
|
|
17
|
+
export declare function withTime(value: Date | null, hours: number, minutes: number): Date;
|
|
18
|
+
/** The day a week starts on in the locale (0 Sunday … 6 Saturday), from `Intl.Locale`'s week info; Monday without it. */
|
|
19
|
+
export declare function localeWeekStart(locale?: string): number;
|
|
20
|
+
/** The locale reads time on a 12-hour clock. */
|
|
21
|
+
export declare function localeHour12(locale?: string): boolean;
|
|
22
|
+
/** The date as a compact picker shows it: "13 Nov 2026" (iOS) or "Nov 13, 2026", by the locale. */
|
|
23
|
+
export declare function formatDate(date: Date, locale?: string): string;
|
|
24
|
+
/** The time: "09:00", or "9:00 AM" on a 12-hour clock. */
|
|
25
|
+
export declare function formatTime(date: Date, locale: string | undefined, hour12: boolean): string;
|
|
26
|
+
/** The month's title: "November 2026". */
|
|
27
|
+
export declare function formatMonth(month: Date, locale?: string): string;
|
|
28
|
+
/** Android's dialog headline: "Tue, Nov 24". */
|
|
29
|
+
export declare function formatHeadline(date: Date, locale?: string): string;
|
|
30
|
+
/** A day on a date-and-time wheel: "Wed Nov 25". */
|
|
31
|
+
export declare function formatWheelDay(date: Date, locale?: string): string;
|
|
32
|
+
/** A day read out in full: "Tuesday, 24 November 2026". */
|
|
33
|
+
export declare function formatFullDay(date: Date, locale?: string): string;
|
|
34
|
+
/** The weekdays' labels from `weekStartsOn`: "MON" (`short`, iOS) or "M" (`narrow`, Android). */
|
|
35
|
+
export declare function weekdayLabels(locale: string | undefined, weekStartsOn: number, width: "short" | "narrow"): {
|
|
36
|
+
label: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}[];
|
|
39
|
+
/** The month names of the locale, January first. */
|
|
40
|
+
export declare function monthNames(locale?: string): string[];
|
|
41
|
+
/** The order of day, month and year in the locale's dates, for the date wheels. */
|
|
42
|
+
export declare function dateOrder(locale?: string): ("day" | "month" | "year")[];
|
|
43
|
+
/** The locale's day period labels: ["AM", "PM"]. */
|
|
44
|
+
export declare function periodLabels(locale?: string): [string, string];
|
|
45
|
+
export declare const pad2: (value: number) => string;
|
|
@@ -57,5 +57,23 @@ export type ChoiceDialogProps = {
|
|
|
57
57
|
* Select's picker on Android; not part of the public API.
|
|
58
58
|
*/
|
|
59
59
|
export declare function ChoiceDialog({ open, onClose, title, cancelLabel, okLabel, onOk, children, listProps, testID }: ChoiceDialogProps): import("react").JSX.Element;
|
|
60
|
+
export type PickerDialogProps = {
|
|
61
|
+
open: boolean;
|
|
62
|
+
onClose: () => void;
|
|
63
|
+
/** Applies the choice and closes the dialog. */
|
|
64
|
+
onOk: () => void;
|
|
65
|
+
cancelLabel: string;
|
|
66
|
+
okLabel: string;
|
|
67
|
+
/** The dialog's name for a screen reader. */
|
|
68
|
+
label?: string;
|
|
69
|
+
/** The picker, across the dialog's whole width (its own header in it). */
|
|
70
|
+
children: ReactNode;
|
|
71
|
+
testID?: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Android's picker dialog: the dialog's panel holding a picker of its own (Material 3's date picker or time picker
|
|
75
|
+
* dial), Cancel and OK at the end. DatePicker's dialog on Android; not part of the public API.
|
|
76
|
+
*/
|
|
77
|
+
export declare function PickerDialog({ open, onClose, onOk, cancelLabel, okLabel, label, children, testID }: PickerDialogProps): import("react").JSX.Element;
|
|
60
78
|
/** The background of an Android dialog: white, a dark gray in dark mode. */
|
|
61
79
|
export declare const androidDialogBackground: (theme: Theme) => string;
|
|
@@ -23,3 +23,9 @@ export declare const MaterialCheckSymbol: import("./createIcon").IconComponent;
|
|
|
23
23
|
* `abc_ic_ab_back_material` that Settings' toolbar shows); it is mirrored right to left.
|
|
24
24
|
*/
|
|
25
25
|
export declare const MaterialArrowBack: import("./createIcon").IconComponent;
|
|
26
|
+
/** Material Symbols' chevron_left and chevron_right (24, the outlined weight 400): a month's arrows in the date picker. */
|
|
27
|
+
export declare const MaterialChevronLeft: import("./createIcon").IconComponent;
|
|
28
|
+
export declare const MaterialChevronRight: import("./createIcon").IconComponent;
|
|
29
|
+
/** Material Symbols' calendar_today and schedule (24, outlined weight 400): the trailing icons of a date and a time field. */
|
|
30
|
+
export declare const MaterialCalendarToday: import("./createIcon").IconComponent;
|
|
31
|
+
export declare const MaterialSchedule: import("./createIcon").IconComponent;
|
|
@@ -29,6 +29,17 @@ export type PageControlProps = {
|
|
|
29
29
|
* current white, the rest white at 40%), the capsule a white veil. @default "default"
|
|
30
30
|
*/
|
|
31
31
|
tone?: "default" | "onColor";
|
|
32
|
+
/**
|
|
33
|
+
* The way the pages run: `horizontal`, a row (mirrored in a right-to-left layout), or `vertical`, a column from top
|
|
34
|
+
* to bottom, as UIPageControl's `direction = .topToBottom` (never mirrored). @default "horizontal"
|
|
35
|
+
*/
|
|
36
|
+
direction?: "horizontal" | "vertical";
|
|
37
|
+
/**
|
|
38
|
+
* `md`, the platform's own dots (iOS 8pt 8 apart, Android 5dp 6 apart); `sm`, smaller dots for a control over a
|
|
39
|
+
* photo in a card: 5 apart 4 on iOS (the pill 14 long), 4dp 4 apart on Android, the capsule 16 thick. iOS has one size;
|
|
40
|
+
* `sm` is the kit's, as an app sets smaller indicator images. @default "md"
|
|
41
|
+
*/
|
|
42
|
+
size?: "sm" | "md";
|
|
32
43
|
/** @default (index, count) => `Page ${index + 1} of ${count}` */
|
|
33
44
|
valueText?: (index: number, count: number) => string;
|
|
34
45
|
/** @default "Pages" */
|
|
@@ -51,4 +62,4 @@ export declare const pageControlDots: (count: number, current: number) => PageCo
|
|
|
51
62
|
* page and back as it moves), in a 48dp target, with no capsule at all. For a screen reader it is adjustable: swipe
|
|
52
63
|
* up or down for the next or previous page.
|
|
53
64
|
*/
|
|
54
|
-
export declare function PageControl({ count, value: valueProp, defaultValue, onChange, background, indicator, tone, valueText, "aria-label": ariaLabel, testID, style, }: PageControlProps): import("react").JSX.Element;
|
|
65
|
+
export declare function PageControl({ count, value: valueProp, defaultValue, onChange, background, indicator, tone, direction, size, valueText, "aria-label": ariaLabel, testID, style, }: PageControlProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
export type ScrollEdgeProps = {
|
|
3
|
+
/** The screen edge it stands at: under the status bar (`top`) or at the bottom of the screen. @default "top" */
|
|
4
|
+
edge?: "top" | "bottom";
|
|
5
|
+
/** Content is under the edge. The top edge shows only then; the bottom one stays, as iOS draws it. */
|
|
6
|
+
scrolled?: boolean;
|
|
7
|
+
/** The color of the screen it fades into (a grouped screen's canvas). @default the theme's background */
|
|
8
|
+
canvasColor?: string;
|
|
9
|
+
testID?: string;
|
|
10
|
+
style?: StyleProp<ViewStyle>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The soft scroll edge of a screen with no bar at that edge: content that scrolls up under the clock and the status
|
|
14
|
+
* icons, or down to the screen's bottom, is muted there. On iOS it is iOS 27.2's soft edge of a bottom bar (as
|
|
15
|
+
* TabBar's `fade`), turned over at the top: from the safe area's edge 34pt further in, a 10pt blur under a veil of
|
|
16
|
+
* the screen's color that grows to 46% at the screen's edge. On Android the top edge is the soft edge of its top bar
|
|
17
|
+
* over the status bar alone, the bottom one draws nothing. Lay it over the screen, after the scroll view.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ScrollEdge({ edge, scrolled, canvasColor, testID, style }: ScrollEdgeProps): import("react").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import { type NativeScrollEvent, type NativeSyntheticEvent, type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
3
|
-
export type TabBarBackground = "soft" | "glass" | "hard" | "none";
|
|
3
|
+
export type TabBarBackground = "soft" | "fade" | "glass" | "hard" | "none";
|
|
4
4
|
export type TabBarSearch = {
|
|
5
5
|
/** The value of the search tab. */
|
|
6
6
|
value: string;
|
|
@@ -37,8 +37,10 @@ export type TabBarProps = Omit<ViewProps, "children"> & {
|
|
|
37
37
|
onMinimizedChange?: (minimized: boolean) => void;
|
|
38
38
|
/**
|
|
39
39
|
* How the bar meets content under it: `soft` and `none` let content run under the capsule (on Android `soft` fades
|
|
40
|
-
* the screen's color in under it, as the Android bar does),
|
|
41
|
-
*
|
|
40
|
+
* the screen's color in under it, as the Android bar does), as native iOS 26 tab bars do; `fade` mutes it, as many
|
|
41
|
+
* apps do on iOS: the rows over the capsule stay clear, and from its top the screen's color comes in over 60pt to
|
|
42
|
+
* 85%, held to the screen's edge, with no blur (on Android as `soft`); `hard` an opaque bar, `glass` a translucent
|
|
43
|
+
* blurred one. The lines and the glass show once `scrolled` says content is under it; the fade stays drawn.
|
|
42
44
|
* @default "soft"
|
|
43
45
|
*/
|
|
44
46
|
background?: TabBarBackground;
|
|
@@ -51,6 +53,11 @@ export type TabBarProps = Omit<ViewProps, "children"> & {
|
|
|
51
53
|
canvasColor?: string;
|
|
52
54
|
/** Content in a glass capsule above the tabs (iOS 26 bottom accessory); minimized, between the two circles. */
|
|
53
55
|
accessory?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* The badges' color: `danger`, the red of iOS's badges, or `accent`, the accent with its on color, as Android's
|
|
58
|
+
* badges are; a tab's own `badgeColor` wins. @default the platform's own: "danger" on iOS, "accent" on Android
|
|
59
|
+
*/
|
|
60
|
+
badgeColor?: TabBarBadgeColor;
|
|
54
61
|
/** Pads the bar for the home indicator. @default true */
|
|
55
62
|
safeArea?: boolean;
|
|
56
63
|
/** Accessible name of the navigation. @default "Tabs" */
|
|
@@ -71,12 +78,15 @@ export type TabBarItemProps = {
|
|
|
71
78
|
* count of 0 shows none, as on iOS. `true` draws a small dot on Android and an empty capsule on iOS.
|
|
72
79
|
*/
|
|
73
80
|
badge?: ReactNode;
|
|
81
|
+
/** The badge's color, over the bar's `badgeColor`. */
|
|
82
|
+
badgeColor?: TabBarBadgeColor;
|
|
74
83
|
/** When `true`, the tab cannot be selected. */
|
|
75
84
|
disabled?: boolean;
|
|
76
85
|
/** Called when the tab is pressed, before it is selected. */
|
|
77
86
|
onPress?: () => void;
|
|
78
87
|
testID?: string;
|
|
79
88
|
};
|
|
89
|
+
export type TabBarBadgeColor = "danger" | "accent";
|
|
80
90
|
/** One destination of the bar. */
|
|
81
91
|
declare function TabBarItem(props: TabBarItemProps): ReactElement | null;
|
|
82
92
|
declare namespace TabBarItem {
|
|
@@ -90,7 +100,7 @@ declare namespace TabBarItem {
|
|
|
90
100
|
* beside it.
|
|
91
101
|
* Props follow @plexui/ui.
|
|
92
102
|
*/
|
|
93
|
-
declare function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, prominent, minimized: minimizedProp, defaultMinimized, onMinimizedChange, background, scrolled, canvasColor, accessory, safeArea, "aria-label": ariaLabel, children, style, ...rest }: TabBarProps): import("react").JSX.Element;
|
|
103
|
+
declare function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, prominent, minimized: minimizedProp, defaultMinimized, onMinimizedChange, background, scrolled, canvasColor, accessory, safeArea, badgeColor, "aria-label": ariaLabel, children, style, ...rest }: TabBarProps): import("react").JSX.Element;
|
|
94
104
|
declare namespace TabBarRoot {
|
|
95
105
|
var displayName: string;
|
|
96
106
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { Glass, type GlassProps } from "./internal/Glass";
|
|
|
10
10
|
export { BarItemContext, type BarItemStyle } from "./components/Button/Button";
|
|
11
11
|
export { NavigationButton, type NavigationAction, type NavigationButtonProps } from "./components/NavigationButton/NavigationButton";
|
|
12
12
|
export { Toolbar, type ToolbarBackground, type ToolbarContentProps, type ToolbarPlacement, type ToolbarProps, type ToolbarTitleAlign, type ToolbarTitleProps, type ToolbarTitleStyle, } from "./components/Toolbar/Toolbar";
|
|
13
|
-
export { TabBar, useTabBarMinimize, type TabBarBackground, type TabBarItemProps, type TabBarProminent, type TabBarProps, type TabBarSearch, } from "./components/TabBar/TabBar";
|
|
13
|
+
export { TabBar, useTabBarMinimize, type TabBarBackground, type TabBarBadgeColor, type TabBarItemProps, type TabBarProminent, type TabBarProps, type TabBarSearch, } from "./components/TabBar/TabBar";
|
|
14
14
|
export { SegmentedControl, type SegmentedControlBadgeProp, type SegmentedControlOptionProps, type SegmentedControlProps, } from "./components/SegmentedControl/SegmentedControl";
|
|
15
15
|
export { Switch, type SwitchProps } from "./components/Switch/Switch";
|
|
16
16
|
export { Checkbox, type CheckboxProps } from "./components/Checkbox/Checkbox";
|
|
@@ -25,6 +25,8 @@ export { OTPInput, type OTPInputProps } from "./components/OTPInput/OTPInput";
|
|
|
25
25
|
export { Select, type SelectOption, type SelectProps } from "./components/Select/Select";
|
|
26
26
|
export { Menu, type MenuContentProps, type MenuItemProps, type MenuProps } from "./components/Menu/Menu";
|
|
27
27
|
export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from "./components/ContextMenu/ContextMenu";
|
|
28
|
+
export { ScrollEdge, type ScrollEdgeProps } from "./components/ScrollEdge/ScrollEdge";
|
|
29
|
+
export { DatePicker, type DatePickerDisplay, type DatePickerMode, type DatePickerProps } from "./components/DatePicker/DatePicker";
|
|
28
30
|
export { ActionSheet, type ActionSheetAction, type ActionSheetProps } from "./components/ActionSheet/ActionSheet";
|
|
29
31
|
export { BottomSheet, type BottomSheetFooterProps, type BottomSheetProps } from "./components/BottomSheet/BottomSheet";
|
|
30
32
|
export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog/Dialog";
|
|
@@ -54,3 +54,12 @@ export declare function SoftTopEdge({ fill, blur }: {
|
|
|
54
54
|
fill: string;
|
|
55
55
|
blur: number;
|
|
56
56
|
}): import("react").JSX.Element;
|
|
57
|
+
export declare function SoftBottomVeil({ fill, top, bottom }: {
|
|
58
|
+
fill: string;
|
|
59
|
+
top?: number;
|
|
60
|
+
bottom?: number;
|
|
61
|
+
}): import("react").JSX.Element;
|
|
62
|
+
export declare function TabBarFade({ fill, top }: {
|
|
63
|
+
fill: string;
|
|
64
|
+
top: number;
|
|
65
|
+
}): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import type { Theme } from "../../theme/types"
|
|
|
8
8
|
import { IconDefaultsProvider } from "../Icon/createIcon"
|
|
9
9
|
import { Text, TextColorProvider, type TextProps } from "../Text/Text"
|
|
10
10
|
|
|
11
|
-
export type BadgeColor = "secondary" | "success" | "danger" | "warning" | "info" | "discovery" | "caution"
|
|
11
|
+
export type BadgeColor = "secondary" | "accent" | "success" | "danger" | "warning" | "info" | "discovery" | "caution"
|
|
12
12
|
export type BadgeVariant = "solid" | "soft" | "outline" | "counter"
|
|
13
13
|
export type BadgeSize = "sm" | "md" | "lg" | "xl"
|
|
14
14
|
|
|
@@ -49,6 +49,14 @@ export function counterBadgeColors(theme: Theme, color: BadgeColor) {
|
|
|
49
49
|
|
|
50
50
|
export function badgeColors(theme: Theme, variant: BadgeVariant, color: BadgeColor) {
|
|
51
51
|
if (variant === "counter") return counterBadgeColors(theme, color)
|
|
52
|
+
// The accent has a solid and a soft step and one text color (styles' accent tokens): soft on the soft fill, the
|
|
53
|
+
// outline's text and line in that text color
|
|
54
|
+
if (color === "accent") {
|
|
55
|
+
const text = theme.color("--color-text-accent")
|
|
56
|
+
if (variant === "solid") return { background: theme.color("--color-background-accent-solid"), text: theme.color("--color-text-accent-solid", "#FFFFFF"), border: undefined }
|
|
57
|
+
if (variant === "outline") return { background: "transparent", text, border: text }
|
|
58
|
+
return { background: theme.color("--color-background-accent-soft"), text, border: undefined }
|
|
59
|
+
}
|
|
52
60
|
if (variant === "outline") return { background: "transparent", text: theme.color(`--color-text-${color}-outline`), border: theme.color(`--color-border-${color}-outline`) }
|
|
53
61
|
if (variant === "solid") return { background: theme.color(`--color-background-${color}-solid`), text: theme.color(`--color-text-${color}-solid`), border: undefined }
|
|
54
62
|
return { background: theme.color(`--color-background-${color}-soft-alpha`), text: theme.color(`--color-text-${color}-soft`), border: undefined }
|