react-native-terra-ui 0.11.15 → 0.11.17
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/CHANGELOG.md +20 -0
- package/lib/module/components/button/Button.js +10 -0
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/chip/Chip.js +48 -5
- package/lib/module/components/chip/Chip.js.map +1 -1
- package/lib/module/components/chip/utils.js +16 -1
- package/lib/module/components/chip/utils.js.map +1 -1
- package/lib/module/components/header/parts/HeaderGradientOverlay.js +1 -1
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
- package/lib/module/components/header/parts/HeaderSurface.js +1 -1
- package/lib/module/components/header/parts/HeaderSurface.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-window.js +60 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-window.js.map +1 -0
- package/lib/module/components/page-indicator/utils.js +60 -0
- package/lib/module/components/page-indicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js +13 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js +29 -7
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
- package/lib/typescript/src/components/button/Button.d.ts +1 -1
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/types.d.ts +1 -1
- package/lib/typescript/src/components/chip/types.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/utils.d.ts +1 -0
- package/lib/typescript/src/components/chip/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts +1 -1
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-window.d.ts +34 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-window.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/utils.d.ts +41 -0
- package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +11 -1
- package/src/components/chip/Chip.tsx +58 -6
- package/src/components/chip/types.ts +5 -0
- package/src/components/chip/utils.ts +16 -1
- package/src/components/header/parts/HeaderGradientOverlay.tsx +1 -1
- package/src/components/header/parts/HeaderSurface.tsx +1 -1
- package/src/components/page-indicator/hooks/use-page-indicator-window.ts +84 -0
- package/src/components/page-indicator/utils.ts +70 -0
- package/src/components/page-indicator/variants/DotIndicator/index.tsx +12 -1
- package/src/components/page-indicator/variants/PillIndicator/index.tsx +32 -2
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
5
6
|
import { usePageIndicatorCore } from "../../hooks/use-page-indicator-core.js";
|
|
7
|
+
import { usePageIndicatorWindow } from "../../hooks/use-page-indicator-window.js";
|
|
6
8
|
import { PageIndicatorRoot } from "../../PageIndicatorRoot.js";
|
|
7
|
-
import { computePageIndicatorWindowTranslate, DEFAULT_PAGE_INDICATOR_MAX_VISIBLE, PAGE_INDICATOR_SINGLE_PAGE_DURATION, pageIndicatorAxisTranslateStyle, pageIndicatorTrackMainSize, pageIndicatorViewportMainSize } from "../../utils.js";
|
|
9
|
+
import { computePageIndicatorWindowTranslate, DEFAULT_PAGE_INDICATOR_MAX_VISIBLE, PAGE_INDICATOR_SINGLE_PAGE_DURATION, pageIndicatorAxisTranslateStyle, pageIndicatorSpacerStyle, pageIndicatorTrackMainSize, pageIndicatorViewportMainSize } from "../../utils.js";
|
|
8
10
|
import { PillIndicatorDot } from "./PillIndicatorDot.js";
|
|
9
11
|
import { PILL_INDICATOR_GEOMETRY, pillIndicatorJumpDisplayProgress } from "./utils.js";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
13
|
export function PillIndicator({
|
|
12
14
|
count,
|
|
13
15
|
current = 0,
|
|
@@ -35,9 +37,25 @@ export function PillIndicator({
|
|
|
35
37
|
const viewportMainSize = pageIndicatorViewportMainSize(count, slot, dotSize, maxVisible, activeWidth);
|
|
36
38
|
const fullTrackMainSize = pageIndicatorTrackMainSize(count, slot, dotSize, activeWidth);
|
|
37
39
|
const overflows = count > maxVisible;
|
|
40
|
+
const {
|
|
41
|
+
start,
|
|
42
|
+
end
|
|
43
|
+
} = usePageIndicatorWindow(count, current, progress, slot, dotSize, maxVisible, activeWidth);
|
|
38
44
|
const indices = useMemo(() => Array.from({
|
|
39
|
-
length:
|
|
40
|
-
}, (_,
|
|
45
|
+
length: end - start + 1
|
|
46
|
+
}, (_, offset) => start + offset), [start, end]);
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
The track is still `count` slots wide and still scrolls the same way, so the
|
|
50
|
+
dots that are not mounted have to leave their room behind. Each unmounted
|
|
51
|
+
dot occupies exactly one slot — it is inactive, and only the active dot is
|
|
52
|
+
ever wider than `dotSize` — so the space before the window is `start` slots
|
|
53
|
+
and the space after it is whatever is left.
|
|
54
|
+
Less one gap apiece, because the row's own `gap` supplies the space between
|
|
55
|
+
a spacer and the first dot beside it.
|
|
56
|
+
*/
|
|
57
|
+
const leadMainSize = start * slot - gap;
|
|
58
|
+
const tailMainSize = (count - 1 - end) * slot - gap;
|
|
41
59
|
const trackStyle = useAnimatedStyle(() => {
|
|
42
60
|
const displayProgress = pillIndicatorJumpDisplayProgress(progress.value, pillJump.active.value, pillJump.from.value, pillJump.to.value, pillJump.t.value);
|
|
43
61
|
const translate = computePageIndicatorWindowTranslate(count, displayProgress, slot, dotSize, maxVisible, activeWidth);
|
|
@@ -48,7 +66,7 @@ export function PillIndicator({
|
|
|
48
66
|
vertical: vertical,
|
|
49
67
|
viewportMainSize: viewportMainSize,
|
|
50
68
|
overflows: overflows,
|
|
51
|
-
children: /*#__PURE__*/
|
|
69
|
+
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
52
70
|
style: [{
|
|
53
71
|
flexDirection: vertical ? "column" : "row",
|
|
54
72
|
alignItems: "center",
|
|
@@ -59,7 +77,9 @@ export function PillIndicator({
|
|
|
59
77
|
width: fullTrackMainSize
|
|
60
78
|
} : undefined)
|
|
61
79
|
}, overflows ? trackStyle : null],
|
|
62
|
-
children:
|
|
80
|
+
children: [leadMainSize > 0 && /*#__PURE__*/_jsx(View, {
|
|
81
|
+
style: pageIndicatorSpacerStyle(vertical, leadMainSize)
|
|
82
|
+
}), indices.map(index => /*#__PURE__*/_jsx(PillIndicatorDot, {
|
|
63
83
|
activeColor: colors.activeColor,
|
|
64
84
|
inactiveColor: colors.inactiveColor,
|
|
65
85
|
count: count,
|
|
@@ -69,7 +89,9 @@ export function PillIndicator({
|
|
|
69
89
|
vertical: vertical,
|
|
70
90
|
overflows: overflows,
|
|
71
91
|
maxVisible: maxVisible
|
|
72
|
-
}, index))
|
|
92
|
+
}, index)), tailMainSize > 0 && /*#__PURE__*/_jsx(View, {
|
|
93
|
+
style: pageIndicatorSpacerStyle(vertical, tailMainSize)
|
|
94
|
+
})]
|
|
73
95
|
})
|
|
74
96
|
});
|
|
75
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","Animated","useAnimatedStyle","usePageIndicatorCore","PageIndicatorRoot","computePageIndicatorWindowTranslate","DEFAULT_PAGE_INDICATOR_MAX_VISIBLE","PAGE_INDICATOR_SINGLE_PAGE_DURATION","pageIndicatorAxisTranslateStyle","pageIndicatorTrackMainSize","pageIndicatorViewportMainSize","PillIndicatorDot","PILL_INDICATOR_GEOMETRY","pillIndicatorJumpDisplayProgress","jsx","_jsx","PillIndicator","count","current","duration","activeColor","inactiveColor","vertical","maxVisible","style","colors","pillJump","progress","dotSize","gap","slot","activeWidth","viewportMainSize","fullTrackMainSize","overflows","indices","Array","from","length","_","
|
|
1
|
+
{"version":3,"names":["useMemo","Animated","useAnimatedStyle","usePageIndicatorCore","usePageIndicatorWindow","PageIndicatorRoot","computePageIndicatorWindowTranslate","DEFAULT_PAGE_INDICATOR_MAX_VISIBLE","PAGE_INDICATOR_SINGLE_PAGE_DURATION","pageIndicatorAxisTranslateStyle","pageIndicatorSpacerStyle","pageIndicatorTrackMainSize","pageIndicatorViewportMainSize","PillIndicatorDot","PILL_INDICATOR_GEOMETRY","pillIndicatorJumpDisplayProgress","jsx","_jsx","jsxs","_jsxs","PillIndicator","count","current","duration","activeColor","inactiveColor","vertical","maxVisible","style","colors","pillJump","progress","dotSize","gap","slot","activeWidth","viewportMainSize","fullTrackMainSize","overflows","start","end","indices","Array","from","length","_","offset","leadMainSize","tailMainSize","trackStyle","displayProgress","value","active","to","t","translate","children","View","flexDirection","alignItems","height","width","undefined","map","index"],"sourceRoot":"../../../../../../src","sources":["components/page-indicator/variants/PillIndicator/index.tsx"],"mappings":";;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAI/B,OAAOC,QAAQ,IAAIC,gBAAgB,QAAQ,yBAAyB;AAGpE,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SACEC,mCAAmC,EACnCC,kCAAkC,EAClCC,mCAAmC,EACnCC,+BAA+B,EAC/BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,6BAA6B;AAE/B,SAASC,gBAAgB;AACzB,SAASC,uBAAuB,EAAEC,gCAAgC;AAAkB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAA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AO,CAACsB,GAAG,CAAEC,KAAK,iBACjB/C,IAAA,CAACJ,gBAAgB;QAEfW,WAAW,EAAEK,MAAM,CAACL,WAAY;QAChCC,aAAa,EAAEI,MAAM,CAACJ,aAAc;QACpCJ,KAAK,EAAEA,KAAM;QACb2C,KAAK,EAAEA,KAAM;QACblC,QAAQ,EAAEA,QAAS;QACnBC,QAAQ,EAAEA,QAAS;QACnBL,QAAQ,EAAEA,QAAS;QACnBY,SAAS,EAAEA,SAAU;QACrBX,UAAU,EAAEA;MAAW,GATlBqC,KAUN,CACF,CAAC,EACDhB,YAAY,GAAG,CAAC,iBAAI/B,IAAA,CAACwC,IAAI;QAAC7B,KAAK,EAAElB,wBAAwB,CAACgB,QAAQ,EAAEsB,YAAY;MAAE,CAAE,CAAC;IAAA,CACzE;EAAC,CACC,CAAC;AAExB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { PressableProps } from "react-native";
|
|
3
3
|
import type { ColorToken, TerraIconName } from "../../theme/types";
|
|
4
|
-
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
4
|
+
export type ButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "ghost" | "danger";
|
|
5
5
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
6
6
|
export type ButtonRadius = "none" | "sm" | "md" | "lg" | "xl" | "full";
|
|
7
7
|
export type ButtonAnimation = "scale" | "opacity" | "none";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC3G,OAAO,KAAK,EAAa,cAAc,EAA8B,MAAM,cAAc,CAAC;AAK1F,OAAO,KAAK,EAAE,UAAU,EAAmB,aAAa,EAA2B,MAAM,cAAc,CAAC;AAQxG,MAAM,MAAM,a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S,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../../src/components/chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC3G,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,KAAK,EAAE,UAAU,EAAmB,aAAa,EAAE,MAAM,cAAc,CAAC;AAI/E,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAGhE,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAuID,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAChE,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,QAAQ,GAAI,8DAA8D,aAAa,gCAa5F,CAAC;AAgBF,QAAA,MAAM,QAAQ,uLAmDZ,CAAC;AAEH,KAAK,aAAa,GAAG,OAAO,QAAQ,GAAG;IACrC,IAAI,EAAE,OAAO,QAAQ,CAAC;CACvB,CAAC;AAiBF,eAAO,MAAM,IAAI,EAA8B,aAAa,CAAC"}
|
|
@@ -4,5 +4,5 @@ export type ChipVariant = "solid" | "soft" | "outline" | "ghost";
|
|
|
4
4
|
* Semantic color scheme, or a raw CSS color literal (`#fff`, `rgb(...)`, `hsl(...)`).
|
|
5
5
|
* Has no effect when `variant="ghost"` — ghost always renders `text.primary`.
|
|
6
6
|
*/
|
|
7
|
-
export type ChipColor = "primary" | "secondary" | "success" | "warning" | "danger" | (string & {});
|
|
7
|
+
export type ChipColor = "primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | (string & {});
|
|
8
8
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/chip/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/chip/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,GAKX,UAAU,GACV,SAAS,GACT,SAAS,GACT,QAAQ,GAER,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -10,4 +10,5 @@ export interface CustomChipColors {
|
|
|
10
10
|
fg: string;
|
|
11
11
|
}
|
|
12
12
|
export declare function getCustomColorColors(literal: string, variant: "solid" | "soft" | "outline"): CustomChipColors;
|
|
13
|
+
export declare function flattenOverCanvas(translucent: string, canvas: string): string;
|
|
13
14
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/chip/utils.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ;AAID,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GACpC,gBAAgB,CAqBlB"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/chip/utils.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ;AAID,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GACpC,gBAAgB,CAqBlB;AAUD,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAK7E"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* thins slightly toward the boundary rather than cutting content off square —
|
|
4
4
|
* but never far enough to read as see-through.
|
|
5
5
|
*/
|
|
6
|
-
export declare const HEADER_FADE_END_OPACITY = 0.
|
|
6
|
+
export declare const HEADER_FADE_END_OPACITY = 0.9;
|
|
7
7
|
export interface HeaderGradientOverlayProps {
|
|
8
8
|
/** Fill color, ramped from opaque to {@link HEADER_FADE_END_OPACITY}. */
|
|
9
9
|
color: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderGradientOverlay.d.ts","sourceRoot":"","sources":["../../../../../../src/components/header/parts/HeaderGradientOverlay.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"HeaderGradientOverlay.d.ts","sourceRoot":"","sources":["../../../../../../src/components/header/parts/HeaderGradientOverlay.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,MAAM,WAAW,0BAA0B;IACzC,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,YAAgB,EAChB,UAAoC,GACrC,EAAE,0BAA0B,+BAc5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type SharedValue } from "react-native-reanimated";
|
|
2
|
+
export interface PageIndicatorWindow {
|
|
3
|
+
/** First dot index to mount, inclusive. */
|
|
4
|
+
start: number;
|
|
5
|
+
/** Last dot index to mount, inclusive. */
|
|
6
|
+
end: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The slice of dots a variant should mount, kept in step with the active page.
|
|
10
|
+
*
|
|
11
|
+
* Both variants clip to a window of `maxVisible` slots and scroll a track
|
|
12
|
+
* behind it, so all but a handful of dots are drawn outside the viewport. This
|
|
13
|
+
* is what lets them skip building those: the range covers the visible window
|
|
14
|
+
* plus a generous overscan, and moves only when the active page leaves it.
|
|
15
|
+
*
|
|
16
|
+
* **Driven by `progress`, not by `current`.** `current` may be a shared value
|
|
17
|
+
* for scroll-linked motion, in which case React never re-renders on a page
|
|
18
|
+
* change and a range derived from props would sit still while the track slid
|
|
19
|
+
* out from under it. `progress` is the one place both spellings of `current`
|
|
20
|
+
* have already been resolved into a single number.
|
|
21
|
+
*
|
|
22
|
+
* The reaction only reaches JS when the page moves *outside* the mounted range
|
|
23
|
+
* — not on every frame, and not on every page. A one-page step normally costs
|
|
24
|
+
* no render at all, because the neighbour was already mounted; a long jump
|
|
25
|
+
* costs one render per window it crosses rather than one per page.
|
|
26
|
+
*
|
|
27
|
+
* Known limit: during a jump of many pages the track slides faster than the
|
|
28
|
+
* range is re-rendered, so dots in the middle of that flight may not be mounted
|
|
29
|
+
* as they pass. They are identical inactive dots moving too fast to read, and
|
|
30
|
+
* the alternative — mounting every page between the two — is the cost this
|
|
31
|
+
* exists to avoid.
|
|
32
|
+
*/
|
|
33
|
+
export declare function usePageIndicatorWindow(count: number, current: number | SharedValue<number> | undefined, progress: SharedValue<number>, slot: number, dotSize: number, maxVisible: number, activeMainSize?: number): PageIndicatorWindow;
|
|
34
|
+
//# sourceMappingURL=use-page-indicator-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-page-indicator-window.d.ts","sourceRoot":"","sources":["../../../../../../src/components/page-indicator/hooks/use-page-indicator-window.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,WAAW,EAAuC,MAAM,yBAAyB,CAAC;AAIzG,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,EACjD,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,SAAU,GACvB,mBAAmB,CAqCrB"}
|
|
@@ -27,10 +27,51 @@ export declare function pageIndicatorAxisTranslateStyle(vertical: boolean, trans
|
|
|
27
27
|
};
|
|
28
28
|
/** Clips an overflowing track to the visible viewport along the main axis. */
|
|
29
29
|
export declare function pageIndicatorViewportClipStyle(vertical: boolean, viewportMainSize: number, crossSize?: number): ViewStyle;
|
|
30
|
+
/**
|
|
31
|
+
* Holds the room of dots a variant chose not to mount.
|
|
32
|
+
*
|
|
33
|
+
* The track keeps its full width and keeps scrolling by the same amount, so
|
|
34
|
+
* skipped dots still have to occupy their slots — otherwise the mounted ones
|
|
35
|
+
* slide up the track and the window shows the wrong pages.
|
|
36
|
+
*/
|
|
37
|
+
export declare function pageIndicatorSpacerStyle(vertical: boolean, mainSize: number): ViewStyle;
|
|
30
38
|
/** Scale for a slot inside the window given the active slot. */
|
|
31
39
|
export declare function pageIndicatorWindowSlotScale(positionInWindow: number, activeSlot: number, maxVisible: number): number;
|
|
32
40
|
export declare function pageIndicatorTrackMainSize(count: number, slot: number, dotSize: number, activeMainSize?: number): number;
|
|
33
41
|
export declare function pageIndicatorViewportMainSize(count: number, slot: number, dotSize: number, maxVisible: number, activeMainSize?: number): number;
|
|
34
42
|
export declare function computePageIndicatorWindowTranslate(count: number, progress: number, slot: number, dotSize: number, maxVisible: number, activeMainSize?: number): number;
|
|
35
43
|
export declare function pageIndicatorWindowScale(index: number, displayProgress: number, count: number, slot: number, dotSize: number, maxVisible: number, activeMainSize?: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Dots kept mounted beyond each edge of the visible window.
|
|
46
|
+
*
|
|
47
|
+
* One full window's worth. The window itself is `maxVisible` slots wide, so
|
|
48
|
+
* this leaves a whole screenful of slack on either side — enough that ordinary
|
|
49
|
+
* navigation (a swipe, a few pages at a time) never outruns the mounted range
|
|
50
|
+
* between the page change and React re-rendering with a new one.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PAGE_INDICATOR_WINDOW_OVERSCAN = 5;
|
|
53
|
+
/**
|
|
54
|
+
* Which dot indices are worth mounting, inclusive, for an active page of
|
|
55
|
+
* `anchor`.
|
|
56
|
+
*
|
|
57
|
+
* An indicator draws `maxVisible` slots and clips the rest, and every dot more
|
|
58
|
+
* than one page from the active one is drawn identically — same size, same
|
|
59
|
+
* scale, same opacity, same colour. Mounting one view per page therefore costs
|
|
60
|
+
* an animated style per page to render something nobody can see: at 500 pages
|
|
61
|
+
* that is 500 worklets for five visible dots, and it lands on every page
|
|
62
|
+
* change. Bounding what is mounted is what stops the indicator's cost scaling
|
|
63
|
+
* with the length of the thing it indicates.
|
|
64
|
+
*
|
|
65
|
+
* Derived from `computePageIndicatorWindowTranslate`, the same function that
|
|
66
|
+
* positions the track, so the mounted range and the visible window cannot
|
|
67
|
+
* disagree about where the window is — including at the ends, where the
|
|
68
|
+
* translate clamps and the window stops following the active page.
|
|
69
|
+
*
|
|
70
|
+
* Below the overflow threshold every dot is visible, so the range is the whole
|
|
71
|
+
* track and nothing changes.
|
|
72
|
+
*/
|
|
73
|
+
export declare function pageIndicatorMountedRange(count: number, anchor: number, slot: number, dotSize: number, maxVisible: number, activeMainSize?: number, overscan?: number): {
|
|
74
|
+
start: number;
|
|
75
|
+
end: number;
|
|
76
|
+
};
|
|
36
77
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/page-indicator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,uDAAuD;AACvD,eAAO,MAAM,mCAAmC,MAAM,CAAC;AAEvD,0EAA0E;AAC1E,eAAO,MAAM,uCAAuC,MAAM,CAAC;AAE3D,wDAAwD;AACxD,eAAO,MAAM,sCAAsC,MAAM,CAAC;AAE1D,0EAA0E;AAC1E,eAAO,MAAM,kCAAkC,IAAI,CAAC;AAMpD,+CAA+C;AAC/C,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;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AM,GACjB,MAAM,CA2BR;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,cAAc,SAAU,GACvB,MAAM,CAER;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,SAAU,GACvB,MAAM,CAGR;AAED,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,SAAU,GACvB,MAAM,CAUR;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,SAAU,GACvB,MAAM,CAiBR;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,SAAU,EACxB,QAAQ,SAAiC,GACxC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAmBhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/page-indicator/variants/DotIndicator/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/page-indicator/variants/DotIndicator/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiB/C,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,iCAAiC;IACjC,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,gCAAgC;IAChC,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAW,EACX,QAA8C,EAC9C,WAAW,EACX,aAAa,EACb,YAAY,EACZ,OAAe,EACf,QAAgB,EAChB,UAA+C,EAC/C,KAAK,GACN,EAAE,iBAAiB,+BA2EnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
2
|
import type { SharedValue } from "react-native-reanimated";
|
|
3
3
|
import type { ColorToken } from "../../../../theme/types";
|
|
4
4
|
export interface PillIndicatorProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/page-indicator/variants/PillIndicator/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/page-indicator/variants/PillIndicator/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB/C,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,iCAAiC;IACjC,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAW,EACX,QAA8C,EAC9C,WAAW,EACX,aAAa,EACb,QAAgB,EAChB,UAA+C,EAC/C,KAAK,GACN,EAAE,kBAAkB,+BAqGpB"}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import { PressableScale } from "../pressable";
|
|
|
12
12
|
import { Spinner } from "../spinner";
|
|
13
13
|
import { Text } from "../text";
|
|
14
14
|
|
|
15
|
-
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
15
|
+
export type ButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "ghost" | "danger";
|
|
16
16
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
17
17
|
export type ButtonRadius = "none" | "sm" | "md" | "lg" | "xl" | "full";
|
|
18
18
|
export type ButtonAnimation = "scale" | "opacity" | "none";
|
|
@@ -92,6 +92,16 @@ function getColors(variant: ButtonVariant, theme: TerraTheme): ButtonColors {
|
|
|
92
92
|
borderWidth: 0,
|
|
93
93
|
fg: get("neutral.solid.fg"),
|
|
94
94
|
};
|
|
95
|
+
// The tonal step between the solid `secondary` and the borderless `outline`
|
|
96
|
+
// — accent-hued like `primary`, but at soft weight so it reads as the
|
|
97
|
+
// quieter of two coloured actions sitting side by side.
|
|
98
|
+
case "tertiary":
|
|
99
|
+
return {
|
|
100
|
+
bg: get("accent.soft.bg"),
|
|
101
|
+
border: get("accent.soft.bg"),
|
|
102
|
+
borderWidth: 0,
|
|
103
|
+
fg: get("accent.soft.fg"),
|
|
104
|
+
};
|
|
95
105
|
case "outline":
|
|
96
106
|
return {
|
|
97
107
|
bg: "transparent",
|
|
@@ -8,7 +8,7 @@ import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
|
8
8
|
import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from "#utils/typography";
|
|
9
9
|
import { Icon } from "../icon";
|
|
10
10
|
import type { ChipColor, ChipSize, ChipVariant } from "./types";
|
|
11
|
-
import { type CustomChipColors, getCustomColorColors } from "./utils";
|
|
11
|
+
import { type CustomChipColors, flattenOverCanvas, getCustomColorColors } from "./utils";
|
|
12
12
|
|
|
13
13
|
export interface ChipProps extends ViewProps {
|
|
14
14
|
size?: ChipSize;
|
|
@@ -48,7 +48,9 @@ const ChipContext = createContext<ChipContextValue>({
|
|
|
48
48
|
// The chip's own paint (background + border) is a style, so named schemes
|
|
49
49
|
// (primary/secondary/success/warning/danger) are resolved declaratively via
|
|
50
50
|
// unistyles `compoundVariants` on `styles.base` — one entry per (color, variant)
|
|
51
|
-
// pair, straight from the spec's token table.
|
|
51
|
+
// pair, straight from the spec's token table. `tertiary` is the exception: it
|
|
52
|
+
// has no row of its own tokens, only a fixed reuse of `accent.soft.*` — see
|
|
53
|
+
// its `compoundVariants` rows below.
|
|
52
54
|
//
|
|
53
55
|
// The foreground is *not* a style on this View — it is inherited by the label
|
|
54
56
|
// and icon. It therefore lives here as a token table and is passed down
|
|
@@ -59,9 +61,9 @@ const ChipContext = createContext<ChipContextValue>({
|
|
|
59
61
|
// can't be a compound variant condition — see `getCustomColorColors` in
|
|
60
62
|
// `utils.ts` for how it's derived instead.
|
|
61
63
|
|
|
62
|
-
const SCHEME_NAMES = new Set(["primary", "secondary", "success", "warning", "danger"]);
|
|
64
|
+
const SCHEME_NAMES = new Set(["primary", "secondary", "tertiary", "success", "warning", "danger"]);
|
|
63
65
|
|
|
64
|
-
type ChipScheme = "primary" | "secondary" | "success" | "warning" | "danger";
|
|
66
|
+
type ChipScheme = "primary" | "secondary" | "tertiary" | "success" | "warning" | "danger";
|
|
65
67
|
type ChipPaintedVariant = Exclude<ChipVariant, "ghost">;
|
|
66
68
|
|
|
67
69
|
// `ghost` is `outline` with its border taken away, so it has no colors of its
|
|
@@ -78,6 +80,14 @@ const FG_TOKEN: Record<ChipScheme, Record<ChipPaintedVariant, ColorToken>> = {
|
|
|
78
80
|
soft: "accent.soft.fg",
|
|
79
81
|
outline: "accent.text",
|
|
80
82
|
},
|
|
83
|
+
// Fixed to the soft accent foreground at every variant — `tertiary` always
|
|
84
|
+
// renders as the one look `Button`'s `tertiary` variant has, never a ring
|
|
85
|
+
// or an opaque fill of its own.
|
|
86
|
+
tertiary: {
|
|
87
|
+
solid: "accent.soft.fg",
|
|
88
|
+
soft: "accent.soft.fg",
|
|
89
|
+
outline: "accent.soft.fg",
|
|
90
|
+
},
|
|
81
91
|
secondary: {
|
|
82
92
|
solid: "neutral.solid.fg",
|
|
83
93
|
soft: "neutral.soft.fg",
|
|
@@ -189,7 +199,7 @@ const ChipRoot = forwardRef<ComponentRef<typeof View>, ChipProps>(function Chip(
|
|
|
189
199
|
ref
|
|
190
200
|
) {
|
|
191
201
|
const { theme } = useUnistyles();
|
|
192
|
-
// Compound variants only match the
|
|
202
|
+
// Compound variants only match the named schemes above — an arbitrary
|
|
193
203
|
// literal never matches one, so it's cast to satisfy `useVariants`'s
|
|
194
204
|
// literal-union type while still comparing against the real value below.
|
|
195
205
|
styles.useVariants({ color: color as ChipScheme, variant, size });
|
|
@@ -211,13 +221,26 @@ const ChipRoot = forwardRef<ComponentRef<typeof View>, ChipProps>(function Chip(
|
|
|
211
221
|
borderWidth: customColors.borderWidth,
|
|
212
222
|
}
|
|
213
223
|
: null;
|
|
224
|
+
// `secondary`/`soft`'s token is a translucent tint (see `flattenOverCanvas`)
|
|
225
|
+
// — computed here, not as a compound variant, since both inputs are
|
|
226
|
+
// resolved theme values rather than a bounded set of options.
|
|
227
|
+
const secondarySoftPaint =
|
|
228
|
+
color === "secondary" && variant === "soft"
|
|
229
|
+
? {
|
|
230
|
+
backgroundColor: flattenOverCanvas(theme.color["neutral.soft.bg"], theme.color["surface.canvas"]),
|
|
231
|
+
}
|
|
232
|
+
: null;
|
|
214
233
|
// Last of the paint layers, so an explicit fill beats both the variant's own
|
|
215
234
|
// and the one derived from a custom color literal.
|
|
216
235
|
const backgroundPaint = background ? { backgroundColor: resolveThemeColor(background, theme) } : null;
|
|
217
236
|
|
|
218
237
|
return (
|
|
219
238
|
<ChipContext.Provider value={{ color: fg, size }}>
|
|
220
|
-
<View
|
|
239
|
+
<View
|
|
240
|
+
ref={ref}
|
|
241
|
+
style={[styles.base, secondarySoftPaint, customPaint, backgroundPaint, style]}
|
|
242
|
+
{...rest}
|
|
243
|
+
>
|
|
221
244
|
{renderChildren(children)}
|
|
222
245
|
</View>
|
|
223
246
|
</ChipContext.Provider>
|
|
@@ -321,6 +344,7 @@ const styles = StyleSheet.create((theme) => {
|
|
|
321
344
|
color: {
|
|
322
345
|
primary: {},
|
|
323
346
|
secondary: {},
|
|
347
|
+
tertiary: {},
|
|
324
348
|
success: {},
|
|
325
349
|
warning: {},
|
|
326
350
|
danger: {},
|
|
@@ -365,6 +389,34 @@ const styles = StyleSheet.create((theme) => {
|
|
|
365
389
|
borderWidth: 1,
|
|
366
390
|
},
|
|
367
391
|
},
|
|
392
|
+
// `tertiary` ignores `variant` entirely — solid, soft, and outline
|
|
393
|
+
// all paint the same borderless accent-soft fill, matching `Button`'s
|
|
394
|
+
// single-look `tertiary`. (`ghost` needs no row: the top-level
|
|
395
|
+
// `ghost` style variant already clears paint for every color.)
|
|
396
|
+
{
|
|
397
|
+
color: "tertiary",
|
|
398
|
+
variant: "solid",
|
|
399
|
+
styles: {
|
|
400
|
+
backgroundColor: c["accent.soft.bg"],
|
|
401
|
+
borderWidth: 0,
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
color: "tertiary",
|
|
406
|
+
variant: "soft",
|
|
407
|
+
styles: {
|
|
408
|
+
backgroundColor: c["accent.soft.bg"],
|
|
409
|
+
borderWidth: 0,
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
color: "tertiary",
|
|
414
|
+
variant: "outline",
|
|
415
|
+
styles: {
|
|
416
|
+
backgroundColor: c["accent.soft.bg"],
|
|
417
|
+
borderWidth: 0,
|
|
418
|
+
},
|
|
419
|
+
},
|
|
368
420
|
{
|
|
369
421
|
color: "secondary",
|
|
370
422
|
variant: "solid",
|
|
@@ -8,6 +8,11 @@ export type ChipVariant = "solid" | "soft" | "outline" | "ghost";
|
|
|
8
8
|
export type ChipColor =
|
|
9
9
|
| "primary"
|
|
10
10
|
| "secondary"
|
|
11
|
+
// Always renders as a soft accent tint, whatever `variant` is passed — the
|
|
12
|
+
// same fixed look `Button`'s `tertiary` variant has, and derived from the
|
|
13
|
+
// same tokens (`accent.soft.bg`/`accent.soft.fg`) rather than a hue of its
|
|
14
|
+
// own. See `Chip.tsx`'s `FG_TOKEN`/`compoundVariants` for where.
|
|
15
|
+
| "tertiary"
|
|
11
16
|
| "success"
|
|
12
17
|
| "warning"
|
|
13
18
|
| "danger"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readableOn, withAlpha } from "#utils/color-utils";
|
|
1
|
+
import { compositeOver, parseColor, readableOn, rgbToHex, withAlpha } from "#utils/color-utils";
|
|
2
2
|
|
|
3
3
|
// A custom color literal (hex/rgb/hsl) can't be a unistyles compound variant
|
|
4
4
|
// condition (it's not a bounded set of options), so it's derived here
|
|
@@ -44,3 +44,18 @@ export function getCustomColorColors(
|
|
|
44
44
|
fg: readableOn(literal),
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
// `secondary`'s soft fill (`neutral.soft.bg`) is a translucent tint — see
|
|
49
|
+
// `theme/tokens/light.ts` — so wherever the chip sits shows through it. That
|
|
50
|
+
// reads fine on the canvas the token was picked against, but drifts on any
|
|
51
|
+
// other backdrop (a raised card, an image). Flattening it once here, against
|
|
52
|
+
// the canvas, keeps the chip the same shade everywhere: not a computed
|
|
53
|
+
// unistyles compound variant, since both inputs are resolved theme values
|
|
54
|
+
// rather than a bounded set of options — the same reason a custom color
|
|
55
|
+
// literal is derived here instead of there.
|
|
56
|
+
export function flattenOverCanvas(translucent: string, canvas: string): string {
|
|
57
|
+
const front = parseColor(translucent);
|
|
58
|
+
const back = parseColor(canvas);
|
|
59
|
+
if (!front || !back) return translucent;
|
|
60
|
+
return rgbToHex(compositeOver(front, back, front.a));
|
|
61
|
+
}
|
|
@@ -7,7 +7,7 @@ import Svg, { Defs, Rect, Stop, LinearGradient as SvgLinearGradient } from "reac
|
|
|
7
7
|
* thins slightly toward the boundary rather than cutting content off square —
|
|
8
8
|
* but never far enough to read as see-through.
|
|
9
9
|
*/
|
|
10
|
-
export const HEADER_FADE_END_OPACITY = 0.
|
|
10
|
+
export const HEADER_FADE_END_OPACITY = 0.9;
|
|
11
11
|
|
|
12
12
|
export interface HeaderGradientOverlayProps {
|
|
13
13
|
/** Fill color, ramped from opaque to {@link HEADER_FADE_END_OPACITY}. */
|
|
@@ -26,7 +26,7 @@ export function HeaderSurface({ color, animatedStyle, accessory }: HeaderSurface
|
|
|
26
26
|
<HeaderGradientOverlay
|
|
27
27
|
color={color}
|
|
28
28
|
startOpacity={accessory ? HEADER_FADE_END_OPACITY : 1}
|
|
29
|
-
endOpacity={accessory ? 0.
|
|
29
|
+
endOpacity={accessory ? 0.85 : HEADER_FADE_END_OPACITY}
|
|
30
30
|
/>
|
|
31
31
|
</Animated.View>
|
|
32
32
|
);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { runOnJS, type SharedValue, useAnimatedReaction, useSharedValue } from "react-native-reanimated";
|
|
4
|
+
|
|
5
|
+
import { isPageIndicatorSharedValue, pageIndicatorMountedRange } from "../utils";
|
|
6
|
+
|
|
7
|
+
export interface PageIndicatorWindow {
|
|
8
|
+
/** First dot index to mount, inclusive. */
|
|
9
|
+
start: number;
|
|
10
|
+
/** Last dot index to mount, inclusive. */
|
|
11
|
+
end: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The slice of dots a variant should mount, kept in step with the active page.
|
|
16
|
+
*
|
|
17
|
+
* Both variants clip to a window of `maxVisible` slots and scroll a track
|
|
18
|
+
* behind it, so all but a handful of dots are drawn outside the viewport. This
|
|
19
|
+
* is what lets them skip building those: the range covers the visible window
|
|
20
|
+
* plus a generous overscan, and moves only when the active page leaves it.
|
|
21
|
+
*
|
|
22
|
+
* **Driven by `progress`, not by `current`.** `current` may be a shared value
|
|
23
|
+
* for scroll-linked motion, in which case React never re-renders on a page
|
|
24
|
+
* change and a range derived from props would sit still while the track slid
|
|
25
|
+
* out from under it. `progress` is the one place both spellings of `current`
|
|
26
|
+
* have already been resolved into a single number.
|
|
27
|
+
*
|
|
28
|
+
* The reaction only reaches JS when the page moves *outside* the mounted range
|
|
29
|
+
* — not on every frame, and not on every page. A one-page step normally costs
|
|
30
|
+
* no render at all, because the neighbour was already mounted; a long jump
|
|
31
|
+
* costs one render per window it crosses rather than one per page.
|
|
32
|
+
*
|
|
33
|
+
* Known limit: during a jump of many pages the track slides faster than the
|
|
34
|
+
* range is re-rendered, so dots in the middle of that flight may not be mounted
|
|
35
|
+
* as they pass. They are identical inactive dots moving too fast to read, and
|
|
36
|
+
* the alternative — mounting every page between the two — is the cost this
|
|
37
|
+
* exists to avoid.
|
|
38
|
+
*/
|
|
39
|
+
export function usePageIndicatorWindow(
|
|
40
|
+
count: number,
|
|
41
|
+
current: number | SharedValue<number> | undefined,
|
|
42
|
+
progress: SharedValue<number>,
|
|
43
|
+
slot: number,
|
|
44
|
+
dotSize: number,
|
|
45
|
+
maxVisible: number,
|
|
46
|
+
activeMainSize = dotSize
|
|
47
|
+
): PageIndicatorWindow {
|
|
48
|
+
const virtualized = count > maxVisible;
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
Seeded from `current` so an indicator mounted straight onto a late page
|
|
52
|
+
draws that page's dots on its first frame rather than the first page's.
|
|
53
|
+
Zero for a shared value, which cannot be read during render — the reaction
|
|
54
|
+
below corrects it on the first frame that matters.
|
|
55
|
+
*/
|
|
56
|
+
const [anchor, setAnchor] = useState(() =>
|
|
57
|
+
current === undefined || isPageIndicatorSharedValue(current) ? 0 : Math.round(current)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const window = useMemo(
|
|
61
|
+
() => pageIndicatorMountedRange(count, anchor, slot, dotSize, maxVisible, activeMainSize),
|
|
62
|
+
[count, anchor, slot, dotSize, maxVisible, activeMainSize]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
The live range, on the UI thread, so the reaction can decide for itself
|
|
67
|
+
whether a page change matters. Reading React state from a worklet is not an
|
|
68
|
+
option, and crossing to JS to ask would defeat the point of asking.
|
|
69
|
+
*/
|
|
70
|
+
const mounted = useSharedValue(window);
|
|
71
|
+
mounted.value = window;
|
|
72
|
+
|
|
73
|
+
useAnimatedReaction(
|
|
74
|
+
() => Math.round(progress.value),
|
|
75
|
+
(page) => {
|
|
76
|
+
if (!virtualized) return;
|
|
77
|
+
const { start, end } = mounted.value;
|
|
78
|
+
if (page < start || page > end) runOnJS(setAnchor)(page);
|
|
79
|
+
},
|
|
80
|
+
[virtualized]
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return window;
|
|
84
|
+
}
|