react-native-terra-ui 0.11.16 → 0.12.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/CHANGELOG.md +27 -0
- package/lib/module/components/accordion/Accordion.js +109 -0
- package/lib/module/components/accordion/Accordion.js.map +1 -0
- package/lib/module/components/accordion/context.js +34 -0
- package/lib/module/components/accordion/context.js.map +1 -0
- package/lib/module/components/accordion/hooks/use-accordion-core.js +46 -0
- package/lib/module/components/accordion/hooks/use-accordion-core.js.map +1 -0
- package/lib/module/components/accordion/index.js +5 -0
- package/lib/module/components/accordion/index.js.map +1 -0
- package/lib/module/components/accordion/parts/AccordionContent.js +98 -0
- package/lib/module/components/accordion/parts/AccordionContent.js.map +1 -0
- package/lib/module/components/accordion/parts/AccordionIndicator.js +60 -0
- package/lib/module/components/accordion/parts/AccordionIndicator.js.map +1 -0
- package/lib/module/components/accordion/parts/AccordionItem.js +53 -0
- package/lib/module/components/accordion/parts/AccordionItem.js.map +1 -0
- package/lib/module/components/accordion/parts/AccordionTrigger.js +85 -0
- package/lib/module/components/accordion/parts/AccordionTrigger.js.map +1 -0
- package/lib/module/components/accordion/types.js +4 -0
- package/lib/module/components/accordion/types.js.map +1 -0
- package/lib/module/components/accordion/utils.js +15 -0
- package/lib/module/components/accordion/utils.js.map +1 -0
- package/lib/module/components/badge/Badge.js +219 -64
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/WithBadge.js +94 -0
- package/lib/module/components/badge/WithBadge.js.map +1 -0
- package/lib/module/components/badge/index.js +1 -0
- package/lib/module/components/badge/index.js.map +1 -1
- package/lib/module/components/badge/utils.js +3 -3
- package/lib/module/components/header/parts/HeaderBar.js +34 -7
- package/lib/module/components/header/parts/HeaderBar.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.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/accordion/Accordion.d.ts +33 -0
- package/lib/typescript/src/components/accordion/Accordion.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/context.d.ts +25 -0
- package/lib/typescript/src/components/accordion/context.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/hooks/use-accordion-core.d.ts +11 -0
- package/lib/typescript/src/components/accordion/hooks/use-accordion-core.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/index.d.ts +8 -0
- package/lib/typescript/src/components/accordion/index.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/parts/AccordionContent.d.ts +8 -0
- package/lib/typescript/src/components/accordion/parts/AccordionContent.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/parts/AccordionIndicator.d.ts +16 -0
- package/lib/typescript/src/components/accordion/parts/AccordionIndicator.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/parts/AccordionItem.d.ts +16 -0
- package/lib/typescript/src/components/accordion/parts/AccordionItem.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/parts/AccordionTrigger.d.ts +11 -0
- package/lib/typescript/src/components/accordion/parts/AccordionTrigger.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/types.d.ts +65 -0
- package/lib/typescript/src/components/accordion/types.d.ts.map +1 -0
- package/lib/typescript/src/components/accordion/utils.d.ts +8 -0
- package/lib/typescript/src/components/accordion/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/badge/Badge.d.ts +13 -9
- package/lib/typescript/src/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/src/components/badge/WithBadge.d.ts +18 -0
- package/lib/typescript/src/components/badge/WithBadge.d.ts.map +1 -0
- package/lib/typescript/src/components/badge/index.d.ts +2 -1
- package/lib/typescript/src/components/badge/index.d.ts.map +1 -1
- package/lib/typescript/src/components/badge/types.d.ts +35 -12
- package/lib/typescript/src/components/badge/types.d.ts.map +1 -1
- package/lib/typescript/src/components/badge/utils.d.ts +3 -3
- package/lib/typescript/src/components/badge/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/header/parts/HeaderBar.d.ts.map +1 -1
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.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/accordion/Accordion.tsx +116 -0
- package/src/components/accordion/context.ts +45 -0
- package/src/components/accordion/hooks/use-accordion-core.ts +51 -0
- package/src/components/accordion/index.ts +14 -0
- package/src/components/accordion/parts/AccordionContent.tsx +96 -0
- package/src/components/accordion/parts/AccordionIndicator.tsx +67 -0
- package/src/components/accordion/parts/AccordionItem.tsx +55 -0
- package/src/components/accordion/parts/AccordionTrigger.tsx +88 -0
- package/src/components/accordion/types.ts +71 -0
- package/src/components/accordion/utils.ts +12 -0
- package/src/components/badge/Badge.tsx +177 -59
- package/src/components/badge/WithBadge.tsx +79 -0
- package/src/components/badge/index.ts +2 -1
- package/src/components/badge/types.ts +36 -12
- package/src/components/badge/utils.ts +3 -3
- package/src/components/header/parts/HeaderBar.tsx +41 -8
- package/src/components/index.ts +1 -0
- 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
- package/lib/module/components/badge/parts/BadgeIndicator.js +0 -212
- package/lib/module/components/badge/parts/BadgeIndicator.js.map +0 -1
- package/lib/typescript/src/components/badge/parts/BadgeIndicator.d.ts +0 -19
- package/lib/typescript/src/components/badge/parts/BadgeIndicator.d.ts.map +0 -1
- package/src/components/badge/parts/BadgeIndicator.tsx +0 -178
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { runOnJS, useAnimatedReaction, useSharedValue } from "react-native-reanimated";
|
|
5
|
+
import { isPageIndicatorSharedValue, pageIndicatorMountedRange } from "../utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* The slice of dots a variant should mount, kept in step with the active page.
|
|
8
|
+
*
|
|
9
|
+
* Both variants clip to a window of `maxVisible` slots and scroll a track
|
|
10
|
+
* behind it, so all but a handful of dots are drawn outside the viewport. This
|
|
11
|
+
* is what lets them skip building those: the range covers the visible window
|
|
12
|
+
* plus a generous overscan, and moves only when the active page leaves it.
|
|
13
|
+
*
|
|
14
|
+
* **Driven by `progress`, not by `current`.** `current` may be a shared value
|
|
15
|
+
* for scroll-linked motion, in which case React never re-renders on a page
|
|
16
|
+
* change and a range derived from props would sit still while the track slid
|
|
17
|
+
* out from under it. `progress` is the one place both spellings of `current`
|
|
18
|
+
* have already been resolved into a single number.
|
|
19
|
+
*
|
|
20
|
+
* The reaction only reaches JS when the page moves *outside* the mounted range
|
|
21
|
+
* — not on every frame, and not on every page. A one-page step normally costs
|
|
22
|
+
* no render at all, because the neighbour was already mounted; a long jump
|
|
23
|
+
* costs one render per window it crosses rather than one per page.
|
|
24
|
+
*
|
|
25
|
+
* Known limit: during a jump of many pages the track slides faster than the
|
|
26
|
+
* range is re-rendered, so dots in the middle of that flight may not be mounted
|
|
27
|
+
* as they pass. They are identical inactive dots moving too fast to read, and
|
|
28
|
+
* the alternative — mounting every page between the two — is the cost this
|
|
29
|
+
* exists to avoid.
|
|
30
|
+
*/
|
|
31
|
+
export function usePageIndicatorWindow(count, current, progress, slot, dotSize, maxVisible, activeMainSize = dotSize) {
|
|
32
|
+
const virtualized = count > maxVisible;
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
Seeded from `current` so an indicator mounted straight onto a late page
|
|
36
|
+
draws that page's dots on its first frame rather than the first page's.
|
|
37
|
+
Zero for a shared value, which cannot be read during render — the reaction
|
|
38
|
+
below corrects it on the first frame that matters.
|
|
39
|
+
*/
|
|
40
|
+
const [anchor, setAnchor] = useState(() => current === undefined || isPageIndicatorSharedValue(current) ? 0 : Math.round(current));
|
|
41
|
+
const window = useMemo(() => pageIndicatorMountedRange(count, anchor, slot, dotSize, maxVisible, activeMainSize), [count, anchor, slot, dotSize, maxVisible, activeMainSize]);
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
The live range, on the UI thread, so the reaction can decide for itself
|
|
45
|
+
whether a page change matters. Reading React state from a worklet is not an
|
|
46
|
+
option, and crossing to JS to ask would defeat the point of asking.
|
|
47
|
+
*/
|
|
48
|
+
const mounted = useSharedValue(window);
|
|
49
|
+
mounted.value = window;
|
|
50
|
+
useAnimatedReaction(() => Math.round(progress.value), page => {
|
|
51
|
+
if (!virtualized) return;
|
|
52
|
+
const {
|
|
53
|
+
start,
|
|
54
|
+
end
|
|
55
|
+
} = mounted.value;
|
|
56
|
+
if (page < start || page > end) runOnJS(setAnchor)(page);
|
|
57
|
+
}, [virtualized]);
|
|
58
|
+
return window;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=use-page-indicator-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","useState","runOnJS","useAnimatedReaction","useSharedValue","isPageIndicatorSharedValue","pageIndicatorMountedRange","usePageIndicatorWindow","count","current","progress","slot","dotSize","maxVisible","activeMainSize","virtualized","anchor","setAnchor","undefined","Math","round","window","mounted","value","page","start","end"],"sourceRoot":"../../../../../src","sources":["components/page-indicator/hooks/use-page-indicator-window.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEzC,SAASC,OAAO,EAAoBC,mBAAmB,EAAEC,cAAc,QAAQ,yBAAyB;AAExG,SAASC,0BAA0B,EAAEC,yBAAyB;AAS9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,KAAa,EACbC,OAAiD,EACjDC,QAA6B,EAC7BC,IAAY,EACZC,OAAe,EACfC,UAAkB,EAClBC,cAAc,GAAGF,OAAO,EACH;EACrB,MAAMG,WAAW,GAAGP,KAAK,GAAGK,UAAU;;EAEtC;AACF;AACA;AACA;AACA;AACA;EACE,MAAM,CAACG,MAAM,EAAEC,SAAS,CAAC,GAAGhB,QAAQ,CAAC,MACnCQ,OAAO,KAAKS,SAAS,IAAIb,0BAA0B,CAACI,OAAO,CAAC,GAAG,CAAC,GAAGU,IAAI,CAACC,KAAK,CAACX,OAAO,CACvF,CAAC;EAED,MAAMY,MAAM,GAAGrB,OAAO,CACpB,MAAMM,yBAAyB,CAACE,KAAK,EAAEQ,MAAM,EAAEL,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAEC,cAAc,CAAC,EACzF,CAACN,KAAK,EAAEQ,MAAM,EAAEL,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAEC,cAAc,CAC3D,CAAC;;EAED;AACF;AACA;AACA;AACA;EACE,MAAMQ,OAAO,GAAGlB,cAAc,CAACiB,MAAM,CAAC;EACtCC,OAAO,CAACC,KAAK,GAAGF,MAAM;EAEtBlB,mBAAmB,CACjB,MAAMgB,IAAI,CAACC,KAAK,CAACV,QAAQ,CAACa,KAAK,CAAC,EAC/BC,IAAI,IAAK;IACR,IAAI,CAACT,WAAW,EAAE;IAClB,MAAM;MAAEU,KAAK;MAAEC;IAAI,CAAC,GAAGJ,OAAO,CAACC,KAAK;IACpC,IAAIC,IAAI,GAAGC,KAAK,IAAID,IAAI,GAAGE,GAAG,EAAExB,OAAO,CAACe,SAAS,CAAC,CAACO,IAAI,CAAC;EAC1D,CAAC,EACD,CAACT,WAAW,CACd,CAAC;EAED,OAAOM,MAAM;AACf","ignoreList":[]}
|
|
@@ -66,6 +66,21 @@ export function pageIndicatorViewportClipStyle(vertical, viewportMainSize, cross
|
|
|
66
66
|
overflow: "hidden"
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Holds the room of dots a variant chose not to mount.
|
|
72
|
+
*
|
|
73
|
+
* The track keeps its full width and keeps scrolling by the same amount, so
|
|
74
|
+
* skipped dots still have to occupy their slots — otherwise the mounted ones
|
|
75
|
+
* slide up the track and the window shows the wrong pages.
|
|
76
|
+
*/
|
|
77
|
+
export function pageIndicatorSpacerStyle(vertical, mainSize) {
|
|
78
|
+
return vertical ? {
|
|
79
|
+
height: mainSize
|
|
80
|
+
} : {
|
|
81
|
+
width: mainSize
|
|
82
|
+
};
|
|
83
|
+
}
|
|
69
84
|
function scaleCurveValue(curve, distance, tailScale) {
|
|
70
85
|
"worklet";
|
|
71
86
|
|
|
@@ -124,4 +139,49 @@ export function pageIndicatorWindowScale(index, displayProgress, count, slot, do
|
|
|
124
139
|
const positionInWindow = Math.min(Math.max(Math.round(index - visibleStart), 0), maxVisible - 1);
|
|
125
140
|
return pageIndicatorWindowSlotScale(positionInWindow, activeSlot, maxVisible);
|
|
126
141
|
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Dots kept mounted beyond each edge of the visible window.
|
|
145
|
+
*
|
|
146
|
+
* One full window's worth. The window itself is `maxVisible` slots wide, so
|
|
147
|
+
* this leaves a whole screenful of slack on either side — enough that ordinary
|
|
148
|
+
* navigation (a swipe, a few pages at a time) never outruns the mounted range
|
|
149
|
+
* between the page change and React re-rendering with a new one.
|
|
150
|
+
*/
|
|
151
|
+
export const PAGE_INDICATOR_WINDOW_OVERSCAN = 5;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Which dot indices are worth mounting, inclusive, for an active page of
|
|
155
|
+
* `anchor`.
|
|
156
|
+
*
|
|
157
|
+
* An indicator draws `maxVisible` slots and clips the rest, and every dot more
|
|
158
|
+
* than one page from the active one is drawn identically — same size, same
|
|
159
|
+
* scale, same opacity, same colour. Mounting one view per page therefore costs
|
|
160
|
+
* an animated style per page to render something nobody can see: at 500 pages
|
|
161
|
+
* that is 500 worklets for five visible dots, and it lands on every page
|
|
162
|
+
* change. Bounding what is mounted is what stops the indicator's cost scaling
|
|
163
|
+
* with the length of the thing it indicates.
|
|
164
|
+
*
|
|
165
|
+
* Derived from `computePageIndicatorWindowTranslate`, the same function that
|
|
166
|
+
* positions the track, so the mounted range and the visible window cannot
|
|
167
|
+
* disagree about where the window is — including at the ends, where the
|
|
168
|
+
* translate clamps and the window stops following the active page.
|
|
169
|
+
*
|
|
170
|
+
* Below the overflow threshold every dot is visible, so the range is the whole
|
|
171
|
+
* track and nothing changes.
|
|
172
|
+
*/
|
|
173
|
+
export function pageIndicatorMountedRange(count, anchor, slot, dotSize, maxVisible, activeMainSize = dotSize, overscan = PAGE_INDICATOR_WINDOW_OVERSCAN) {
|
|
174
|
+
const last = Math.max(0, count - 1);
|
|
175
|
+
if (count <= maxVisible) return {
|
|
176
|
+
start: 0,
|
|
177
|
+
end: last
|
|
178
|
+
};
|
|
179
|
+
const translate = computePageIndicatorWindowTranslate(count, anchor, slot, dotSize, maxVisible, activeMainSize);
|
|
180
|
+
// The same expression `pageIndicatorWindowScale` reads the window from.
|
|
181
|
+
const visibleStart = -translate / slot;
|
|
182
|
+
return {
|
|
183
|
+
start: Math.max(0, Math.floor(visibleStart) - overscan),
|
|
184
|
+
end: Math.min(last, Math.ceil(visibleStart) + maxVisible - 1 + overscan)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
127
187
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PAGE_INDICATOR_SINGLE_PAGE_DURATION","PAGE_INDICATOR_MULTI_PAGE_DURATION_STEP","PAGE_INDICATOR_MULTI_PAGE_DURATION_MAX","DEFAULT_PAGE_INDICATOR_MAX_VISIBLE","EDGE_OUTWARD_SCALE","CENTERED_SCALE","WINDOW_TAIL_SCALE","pageIndicatorPageJumpDistance","from","to","Math","abs","pageIndicatorPageJumpDuration","distance","min","isPageIndicatorSharedValue","value","pageIndicatorAxisTranslateStyle","vertical","translate","transform","translateY","translateX","pageIndicatorViewportClipStyle","viewportMainSize","crossSize","height","undefined","width","overflow","scaleCurveValue","curve","tailScale","length","pageIndicatorWindowSlotScale","positionInWindow","activeSlot","maxVisible","dist","centerSlot","floor","pageIndicatorTrackMainSize","count","slot","dotSize","activeMainSize","max","pageIndicatorViewportMainSize","visible","computePageIndicatorWindowTranslate","progress","trackMainSize","activeCenter","offset","pageIndicatorWindowScale","index","displayProgress","visibleStart","round"],"sourceRoot":"../../../../src","sources":["components/page-indicator/utils.ts"],"mappings":";;AAIA;AACA,OAAO,MAAMA,mCAAmC,GAAG,GAAG;;AAEtD;AACA,OAAO,MAAMC,uCAAuC,GAAG,GAAG;;AAE1D;AACA,OAAO,MAAMC,sCAAsC,GAAG,GAAG;;AAEzD;AACA,OAAO,MAAMC,kCAAkC,GAAG,CAAC;AAEnD,MAAMC,kBAAkB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAU;AAC5D,MAAMC,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAU;AACnD,MAAMC,iBAAiB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AAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACzDI,QAAQ,EAAE;EACZ,CAAC;AACH;AAEA,SAASC,eAAeA,CAACC,KAAwB,
|
|
1
|
+
{"version":3,"names":["PAGE_INDICATOR_SINGLE_PAGE_DURATION","PAGE_INDICATOR_MULTI_PAGE_DURATION_STEP","PAGE_INDICATOR_MULTI_PAGE_DURATION_MAX","DEFAULT_PAGE_INDICATOR_MAX_VISIBLE","EDGE_OUTWARD_SCALE","CENTERED_SCALE","WINDOW_TAIL_SCALE","pageIndicatorPageJumpDistance","from","to","Math","abs","pageIndicatorPageJumpDuration","distance","min","isPageIndicatorSharedValue","value","pageIndicatorAxisTranslateStyle","vertical","translate","transform","translateY","translateX","pageIndicatorViewportClipStyle","viewportMainSize","crossSize","height","undefined","width","overflow","pageIndicatorSpacerStyle","mainSize","scaleCurveValue","curve","tailScale","length","pageIndicatorWindowSlotScale","positionInWindow","activeSlot","maxVisible","dist","centerSlot","floor","pageIndicatorTrackMainSize","count","slot","dotSize","activeMainSize","max","pageIndicatorViewportMainSize","visible","computePageIndicatorWindowTranslate","progress","trackMainSize","activeCenter","offset","pageIndicatorWindowScale","index","displayProgress","visibleStart","round","PAGE_INDICATOR_WINDOW_OVERSCAN","pageIndicatorMountedRange","anchor","overscan","last","start","end","ceil"],"sourceRoot":"../../../../src","sources":["components/page-indicator/utils.ts"],"mappings":";;AAIA;AACA,OAAO,MAAMA,mCAAmC,GAAG,GAAG;;AAEtD;AACA,OAAO,MAAMC,uCAAuC,GAAG,GAAG;;AAE1D;AACA,OAAO,MAAMC,sCAAsC,GAAG,GAAG;;AAEzD;AACA,OAAO,MAAMC,kCAAkC,GAAG,CAAC;AAEnD,MAAMC,kBAAkB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAU;AAC5D,MAAMC,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAU;AACnD,MAAMC,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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACvClB,KAAa,EACbmB,MAAc,EACdlB,IAAY,EACZC,OAAe,EACfP,UAAkB,EAClBQ,cAAc,GAAGD,OAAO,EACxBkB,QAAQ,GAAGH,8BAA8B,EACT;EAChC,MAAMI,IAAI,GAAGvD,IAAI,CAACsC,GAAG,CAAC,CAAC,EAAEJ,KAAK,GAAG,CAAC,CAAC;EACnC,IAAIA,KAAK,IAAIL,UAAU,EAAE,OAAO;IAAE2B,KAAK,EAAE,CAAC;IAAEC,GAAG,EAAEF;EAAK,CAAC;EAEvD,MAAM9C,SAAS,GAAGgC,mCAAmC,CACnDP,KAAK,EACLmB,MAAM,EACNlB,IAAI,EACJC,OAAO,EACPP,UAAU,EACVQ,cACF,CAAC;EACD;EACA,MAAMY,YAAY,GAAG,CAACxC,SAAS,GAAG0B,IAAI;EAEtC,OAAO;IACLqB,KAAK,EAAExD,IAAI,CAACsC,GAAG,CAAC,CAAC,EAAEtC,IAAI,CAACgC,KAAK,CAACiB,YAAY,CAAC,GAAGK,QAAQ,CAAC;IACvDG,GAAG,EAAEzD,IAAI,CAACI,GAAG,CAACmD,IAAI,EAAEvD,IAAI,CAAC0D,IAAI,CAACT,YAAY,CAAC,GAAGpB,UAAU,GAAG,CAAC,GAAGyB,QAAQ;EACzE,CAAC;AACH","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
5
5
|
import { usePageIndicatorCore } from "../../hooks/use-page-indicator-core.js";
|
|
6
|
+
import { usePageIndicatorWindow } from "../../hooks/use-page-indicator-window.js";
|
|
6
7
|
import { PageIndicatorRoot } from "../../PageIndicatorRoot.js";
|
|
7
8
|
import { computePageIndicatorWindowTranslate, DEFAULT_PAGE_INDICATOR_MAX_VISIBLE, PAGE_INDICATOR_SINGLE_PAGE_DURATION, pageIndicatorAxisTranslateStyle, pageIndicatorTrackMainSize, pageIndicatorViewportMainSize } from "../../utils.js";
|
|
8
9
|
import { InactiveDot } from "./InactiveDot.js";
|
|
@@ -39,9 +40,19 @@ export function DotIndicator({
|
|
|
39
40
|
const viewportMainSize = pageIndicatorViewportMainSize(count, slot, dotSize, maxVisible);
|
|
40
41
|
const fullTrackMainSize = pageIndicatorTrackMainSize(count, slot, dotSize);
|
|
41
42
|
const overflows = count > maxVisible;
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
No spacers here, unlike the pill variant: an `InactiveDot` is absolutely
|
|
46
|
+
positioned from its own index, so a dot that is not mounted leaves a gap
|
|
47
|
+
exactly where it would have been and the rest do not move.
|
|
48
|
+
*/
|
|
49
|
+
const {
|
|
50
|
+
start,
|
|
51
|
+
end
|
|
52
|
+
} = usePageIndicatorWindow(count, current, progress, slot, dotSize, maxVisible);
|
|
42
53
|
const indices = useMemo(() => Array.from({
|
|
43
|
-
length:
|
|
44
|
-
}, (_,
|
|
54
|
+
length: end - start + 1
|
|
55
|
+
}, (_, offset) => start + offset), [start, end]);
|
|
45
56
|
const trackStyle = useAnimatedStyle(() => {
|
|
46
57
|
const translate = computePageIndicatorWindowTranslate(count, progress.value, slot, dotSize, maxVisible);
|
|
47
58
|
return pageIndicatorAxisTranslateStyle(vertical, translate);
|
|
@@ -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","InactiveDot","LoadingOrbit","TravelingPill","DOT_INDICATOR_GEOMETRY","jsx","_jsx","jsxs","_jsxs","DotIndicator","count","current","duration","activeColor","inactiveColor","loadingColor","loading","vertical","maxVisible","style","colors","progress","dotSize","slot","crossSize","inactiveOpacity","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","pageIndicatorTrackMainSize","pageIndicatorViewportMainSize","InactiveDot","LoadingOrbit","TravelingPill","DOT_INDICATOR_GEOMETRY","jsx","_jsx","jsxs","_jsxs","DotIndicator","count","current","duration","activeColor","inactiveColor","loadingColor","loading","vertical","maxVisible","style","colors","progress","dotSize","slot","crossSize","inactiveOpacity","viewportMainSize","fullTrackMainSize","overflows","start","end","indices","Array","from","length","_","offset","trackStyle","translate","value","children","View","width","height","map","index","color","opacity"],"sourceRoot":"../../../../../../src","sources":["components/page-indicator/variants/DotIndicator/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,0BAA0B,EAC1BC,6BAA6B;AAE/B,SAASC,WAAW;AACpB,SAASC,YAAY;AACrB,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAAkB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA8BjD,OAAO,SAASC,YAAYA,CAAC;EAC3BC,KAAK;EACLC,OAAO,GAAG,CAAC;EACXC,QAAQ,GAAGf,mCAAmC;EAC9CgB,WAAW;EACXC,aAAa;EACbC,YAAY;EACZC,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAG,KAAK;EAChBC,UAAU,GAAGtB,kCAAkC;EAC/CuB;AACiB,CA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AS,EAAEA,SAAU;IACrBT,KAAK,EAAEA,KAAM;IACbF,QAAQ,EAAEA,QAAS;IACnBS,gBAAgB,EAAEA,gBAAiB;IAAAc,QAAA,eAEnChC,KAAA,CAAClB,QAAQ,CAACmD,IAAI;MACZtB,KAAK,EAAE,CACLF,QAAQ,GACJ;QAAEyB,KAAK,EAAElB,SAAS;QAAEmB,MAAM,EAAEhB;MAAkB,CAAC,GAC/C;QAAEe,KAAK,EAAEf,iBAAiB;QAAEgB,MAAM,EAAEnB;MAAU,CAAC,EACnDI,SAAS,GAAGS,UAAU,GAAG,IAAI,CAC7B;MAAAG,QAAA,GAEDT,OAAO,CAACa,GAAG,CAAEC,KAAK,iBACjBvC,IAAA,CAACL,WAAW;QAEV6C,KAAK,EAAE1B,MAAM,CAACN,aAAc;QAC5BJ,KAAK,EAAEA,KAAM;QACbmC,KAAK,EAAEA,KAAM;QACb3B,UAAU,EAAEA,UAAW;QACvB6B,OAAO,EAAEtB,eAAgB;QACzBG,SAAS,EAAEA,SAAU;QACrBP,QAAQ,EAAEA,QAAS;QACnBJ,QAAQ,EAAEA;MAAS,GARd4B,KASN,CACF,CAAC,eACFvC,IAAA,CAACH,aAAa;QACZU,WAAW,EAAEO,MAAM,CAACP,WAAY;QAChCH,KAAK,EAAEA,KAAM;QACbW,QAAQ,EAAEA,QAAS;QACnBJ,QAAQ,EAAEA;MAAS,CACpB,CAAC,eACFX,IAAA,CAACJ,YAAY;QACX4C,KAAK,EAAE1B,MAAM,CAACL,YAAa;QAC3BL,KAAK,EAAEA,KAAM;QACbM,OAAO,EAAEA,OAAQ;QACjBK,QAAQ,EAAEA,QAAS;QACnBJ,QAAQ,EAAEA;MAAS,CACpB,CAAC;IAAA,CACW;EAAC,CACC,CAAC;AAExB","ignoreList":[]}
|
|
@@ -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,KAAA;AA0BpF,OAAO,SAASC,aAAaA,CAAC;EAC5BC,KAAK;EACLC,OAAO,GAAG,CAAC;EACXC,QAAQ,GAAGf,mCAAmC;EAC9CgB,WAAW;EACXC,aAAa;EACbC,QAAQ,GAAG,KAAK;EAChBC,UAAU,GAAGpB,kCAAkC;EAC/CqB;AACkB,CAAC,EAAE;EACrB,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAG5B,oBAAoB,CAACkB,KAAK,EAAEC,OAAO,EAAE,MAAM,EAAEC,QAAQ,EAAE;IAC5FC,WAAW;IACXC;EACF,CAAC,CAAC;EAEF,MAAM;IAAEO,OAAO;IAAEC,GAAG;IAAEC,IAAI;IAAEC;EAAY,CAAC,GAAGrB,uBAAuB;EACnE,MAAMsB,gBAAgB,GAAGxB,6BAA6B,CAACS,KAAK,EAAEa,IAAI,EAAEF,OAAO,EAAEL,UAAU,EAAEQ,WAAW,CAAC;EACrG,MAAME,iBAAiB,GAAG1B,0BAA0B,CAACU,KAAK,EAAEa,IAAI,EAAEF,OAAO,EAAEG,WAAW,CAAC;EACvF,MAAMG,SAAS,GAAGjB,KAAK,GAAGM,UAAU;EAEpC,MAAM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CAAClB,QAAQ,CAACwD,IAAI;MACZ7B,KAAK,EAAE,CACL;QACE8B,aAAa,EAAEhC,QAAQ,GAAG,QAAQ,GAAG,KAAK;QAC1CiC,UAAU,EAAE,QAAQ;QACpB1B,GAAG;QACH,IAAIK,SAAS,GACTZ,QAAQ,GACN;UAAEkC,MAAM,EAAEvB;QAAkB,CAAC,GAC7B;UAAEwB,KAAK,EAAExB;QAAkB,CAAC,GAC9ByB,SAAS;MACf,CAAC,EACDxB,SAAS,GAAGW,UAAU,GAAG,IAAI,CAC7B;MAAAO,QAAA,GAEDT,YAAY,GAAG,CAAC,iBAAI9B,IAAA,CAACwC,IAAI;QAAC7B,KAAK,EAAElB,wBAAwB,CAACgB,QAAQ,EAAEqB,YAAY;MAAE,CAAE,CAAC,EACrFN,OAAO,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":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AccordionContent } from "./parts/AccordionContent.js";
|
|
2
|
+
import { AccordionIndicator } from "./parts/AccordionIndicator.js";
|
|
3
|
+
import { AccordionItem } from "./parts/AccordionItem.js";
|
|
4
|
+
import { AccordionTrigger } from "./parts/AccordionTrigger.js";
|
|
5
|
+
import type { AccordionProps } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* A vertical stack of headers that each open a panel of content.
|
|
8
|
+
*
|
|
9
|
+
* `'single'` mode (the default) keeps one item open at a time; `'multiple'`
|
|
10
|
+
* lets any number be open. Uncontrolled through `defaultValue`, or controlled
|
|
11
|
+
* through `value` + `onValueChange`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Accordion defaultValue="shipping">
|
|
15
|
+
* <Accordion.Item value="shipping">
|
|
16
|
+
* <Accordion.Trigger>
|
|
17
|
+
* How long does shipping take?
|
|
18
|
+
* <Accordion.Indicator />
|
|
19
|
+
* </Accordion.Trigger>
|
|
20
|
+
* <Accordion.Content>3–5 business days.</Accordion.Content>
|
|
21
|
+
* </Accordion.Item>
|
|
22
|
+
* </Accordion>
|
|
23
|
+
*/
|
|
24
|
+
declare const AccordionRoot: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
25
|
+
type AccordionComponent = typeof AccordionRoot & {
|
|
26
|
+
Item: typeof AccordionItem;
|
|
27
|
+
Trigger: typeof AccordionTrigger;
|
|
28
|
+
Indicator: typeof AccordionIndicator;
|
|
29
|
+
Content: typeof AccordionContent;
|
|
30
|
+
};
|
|
31
|
+
export declare const Accordion: AccordionComponent;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../../src/components/accordion/Accordion.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAS,CAAC;AAiB9C;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,aAAa,4LA2BjB,CAAC;AAEH,KAAK,kBAAkB,GAAG,OAAO,aAAa,GAAG;IAC/C,IAAI,EAAE,OAAO,aAAa,CAAC;IAC3B,OAAO,EAAE,OAAO,gBAAgB,CAAC;IACjC,SAAS,EAAE,OAAO,kBAAkB,CAAC;IACrC,OAAO,EAAE,OAAO,gBAAgB,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAoB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AccordionItemContextValue } from "./types.js";
|
|
2
|
+
export interface AccordionContextValue {
|
|
3
|
+
/** Open item values. Always an array, whatever the selection mode. */
|
|
4
|
+
expanded: readonly string[];
|
|
5
|
+
toggle: (value: string) => void;
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const AccordionContext: import("react").Context<AccordionContextValue | null>;
|
|
9
|
+
export declare const AccordionItemContext: import("react").Context<AccordionItemContextValue | null>;
|
|
10
|
+
export declare function useAccordionContext(): AccordionContextValue;
|
|
11
|
+
/**
|
|
12
|
+
* Reads the enclosing `Accordion.Item`: whether it is open or disabled, and a
|
|
13
|
+
* `toggle` that follows the accordion's selection rules. Use it to build a
|
|
14
|
+
* custom trigger or indicator.
|
|
15
|
+
*
|
|
16
|
+
* @throws When called outside an `Accordion.Item`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* function PlusMinus() {
|
|
20
|
+
* const { isExpanded } = useAccordionItem();
|
|
21
|
+
* return <Icon name={isExpanded ? 'minus' : 'add'} />;
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export declare function useAccordionItem(): AccordionItemContextValue;
|
|
25
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/components/accordion/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAS,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,gBAAgB,uDAAoD,CAAC;AAElF,eAAO,MAAM,oBAAoB,2DAAwD,CAAC;AAE1F,wBAAgB,mBAAmB,IAAI,qBAAqB,CAM3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,yBAAyB,CAQ5D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AccordionProps } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Owns which items are open. Both modes are stored as an array so the rest of
|
|
4
|
+
* the accordion never branches on `selectionMode`; the mode only decides what a
|
|
5
|
+
* toggle does and what shape `onValueChange` receives.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useAccordionCore(props: AccordionProps): {
|
|
8
|
+
expanded: string[];
|
|
9
|
+
toggle: (itemValue: string) => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=use-accordion-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-accordion-core.d.ts","sourceRoot":"","sources":["../../../../../../src/components/accordion/hooks/use-accordion-core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAU,CAAC;AAO/C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc;;wBAWtC,MAAM;EAyBrB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Accordion } from "./Accordion.js";
|
|
2
|
+
export { useAccordionItem } from "./context.js";
|
|
3
|
+
export type { AccordionContentProps } from "./parts/AccordionContent.js";
|
|
4
|
+
export type { AccordionIndicatorProps } from "./parts/AccordionIndicator.js";
|
|
5
|
+
export type { AccordionItemProps } from "./parts/AccordionItem.js";
|
|
6
|
+
export type { AccordionTriggerProps } from "./parts/AccordionTrigger.js";
|
|
7
|
+
export type { AccordionItemState, AccordionMultipleProps, AccordionProps, AccordionSelectionMode, AccordionSingleProps, AccordionVariant, } from "./types.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAW,CAAC;AAC7C,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA0B,CAAC;AACtE,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA4B,CAAC;AAC1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAAuB,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA0B,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,YAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ViewProps } from "react-native";
|
|
3
|
+
export interface AccordionContentProps extends ViewProps {
|
|
4
|
+
/** The panel body. Strings and numbers are wrapped in body text. */
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const AccordionContent: import("react").ForwardRefExoticComponent<AccordionContentProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
8
|
+
//# sourceMappingURL=AccordionContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/accordion/parts/AccordionContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AACrG,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU5E,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,oEAAoE;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsBD,eAAO,MAAM,gBAAgB,mMA+C5B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
|
+
import type { ColorToken } from "../../../theme/types";
|
|
4
|
+
export interface AccordionIndicatorProps extends Omit<ViewProps, "children"> {
|
|
5
|
+
/** Chevron color. Ignored with custom `children`. Defaults to `'text.secondary'`. */
|
|
6
|
+
color?: ColorToken;
|
|
7
|
+
/** Chevron size in dp. Ignored with custom `children`. Defaults to `20`. */
|
|
8
|
+
size?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Replaces the chevron. Custom content does not rotate — read `isExpanded`
|
|
11
|
+
* from the item's render function or `useAccordionItem()` to swap it instead.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const AccordionIndicator: import("react").ForwardRefExoticComponent<AccordionIndicatorProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
16
|
+
//# sourceMappingURL=AccordionIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionIndicator.d.ts","sourceRoot":"","sources":["../../../../../../src/components/accordion/parts/AccordionIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAKpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK/C,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC1E,qFAAqF;IACrF,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,qMA+B9B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ViewProps } from "react-native";
|
|
3
|
+
import type { AccordionItemState } from "../types.js";
|
|
4
|
+
export interface AccordionItemProps extends Omit<ViewProps, "children"> {
|
|
5
|
+
/** Identifies the item in the accordion's `value`. Unique within one accordion. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Disables this item only. Defaults to `false`. */
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The item's trigger and content, or a function that receives the item's
|
|
11
|
+
* `{ isExpanded, isDisabled }` and returns them.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode | ((state: AccordionItemState) => ReactNode);
|
|
14
|
+
}
|
|
15
|
+
export declare const AccordionItem: import("react").ForwardRefExoticComponent<AccordionItemProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
16
|
+
//# sourceMappingURL=AccordionItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/accordion/parts/AccordionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAKpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAU,CAAC;AAEnD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACrE,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,aAAa,gMAyBxB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type PressableProps } from "react-native";
|
|
3
|
+
export interface AccordionTriggerProps extends Omit<PressableProps, "children" | "disabled"> {
|
|
4
|
+
/**
|
|
5
|
+
* The header row. Strings and numbers become the item's title; put an
|
|
6
|
+
* `Accordion.Indicator` last to show the open state.
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const AccordionTrigger: import("react").ForwardRefExoticComponent<AccordionTriggerProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
11
|
+
//# sourceMappingURL=AccordionTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/components/accordion/parts/AccordionTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAO1F,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,CAAC;IAC1F;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsBD,eAAO,MAAM,gBAAgB,mMA4B5B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
|
+
export type AccordionSelectionMode = "single" | "multiple";
|
|
4
|
+
export type AccordionVariant = "plain" | "surface";
|
|
5
|
+
interface AccordionBaseProps extends Omit<ViewProps, "children"> {
|
|
6
|
+
/**
|
|
7
|
+
* Visual treatment. `'plain'` draws the items straight onto whatever sits
|
|
8
|
+
* behind the accordion; `'surface'` puts them in a filled, rounded container.
|
|
9
|
+
* Defaults to `'plain'`.
|
|
10
|
+
*/
|
|
11
|
+
variant?: AccordionVariant;
|
|
12
|
+
/** Draws a hairline rule between items. Defaults to `true`. */
|
|
13
|
+
divided?: boolean;
|
|
14
|
+
/** Disables every item. Defaults to `false`. */
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
/** `Accordion.Item` elements. */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export interface AccordionSingleProps extends AccordionBaseProps {
|
|
20
|
+
/**
|
|
21
|
+
* `'single'` keeps at most one item open; opening another closes the current
|
|
22
|
+
* one. Defaults to `'single'`.
|
|
23
|
+
*/
|
|
24
|
+
selectionMode?: "single";
|
|
25
|
+
/**
|
|
26
|
+
* The open item, controlled. `null` means none is open — `undefined` leaves
|
|
27
|
+
* the accordion uncontrolled.
|
|
28
|
+
*/
|
|
29
|
+
value?: string | null;
|
|
30
|
+
/** The item open on first render, uncontrolled. Defaults to `undefined`. */
|
|
31
|
+
defaultValue?: string;
|
|
32
|
+
/** Called with the newly open item, or `null` when the open item closes. */
|
|
33
|
+
onValueChange?: (value: string | null) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Lets the open item close by pressing its trigger again. `false` keeps one
|
|
36
|
+
* item open at all times once any has been opened. Defaults to `true`.
|
|
37
|
+
*/
|
|
38
|
+
isCollapsible?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface AccordionMultipleProps extends AccordionBaseProps {
|
|
41
|
+
/** `'multiple'` lets any number of items be open at once. */
|
|
42
|
+
selectionMode: "multiple";
|
|
43
|
+
/** The open items, controlled. */
|
|
44
|
+
value?: string[];
|
|
45
|
+
/** The items open on first render, uncontrolled. Defaults to `[]`. */
|
|
46
|
+
defaultValue?: string[];
|
|
47
|
+
/** Called with every open item after one is toggled. */
|
|
48
|
+
onValueChange?: (value: string[]) => void;
|
|
49
|
+
/** Multiple mode can always close an item. */
|
|
50
|
+
isCollapsible?: never;
|
|
51
|
+
}
|
|
52
|
+
export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
53
|
+
export interface AccordionItemState {
|
|
54
|
+
/** Whether the item's content is open. */
|
|
55
|
+
isExpanded: boolean;
|
|
56
|
+
/** Whether the item, or the whole accordion, is disabled. */
|
|
57
|
+
isDisabled: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface AccordionItemContextValue extends AccordionItemState {
|
|
60
|
+
value: string;
|
|
61
|
+
/** Opens or closes this item, following the accordion's selection rules. */
|
|
62
|
+
toggle: () => void;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/accordion/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnD,UAAU,kBAAmB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,+DAA+D;IAC/D,OAAO,CA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
3
|
+
* Shared by the content's height and the indicator's rotation so the chevron
|
|
4
|
+
* finishes turning as the panel finishes opening. Honours the system
|
|
5
|
+
* reduce-motion setting, which makes both jump straight to their end state.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ACCORDION_TIMING: WithTimingConfig;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/accordion/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEtF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAI9B,CAAC"}
|