@kanso-labs/react-native-kanso-ui 0.8.0 → 0.10.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/README.md +4 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/badge/index.js +9 -70
- package/dist/badge/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +45 -23
- package/dist/button/index.js.map +1 -1
- package/dist/button/palettes.d.ts +2 -0
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1331 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +48 -0
- package/dist/components/badge/index.js +122 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/{badge → components/badge}/styles.js +10 -6
- package/dist/components/badge/styles.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +66 -0
- package/dist/components/breadcrumbs/index.js +285 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +7 -1
- package/dist/components/checkbox/index.js +183 -138
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +92 -0
- package/dist/components/checkbox-group/index.js +306 -0
- package/dist/components/checkbox-group/index.js.map +1 -0
- package/dist/components/code/index.d.ts +25 -0
- package/dist/components/code/index.js +87 -0
- package/dist/components/code/index.js.map +1 -0
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/container/index.d.ts +47 -0
- package/dist/components/container/index.js +85 -0
- package/dist/components/container/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +80 -0
- package/dist/components/fab/index.js +246 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +120 -0
- package/dist/components/fab-menu/index.js +640 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +57 -0
- package/dist/components/feed/index.js +167 -0
- package/dist/components/feed/index.js.map +1 -0
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/keycap/index.d.ts +27 -0
- package/dist/components/keycap/index.js +136 -0
- package/dist/components/keycap/index.js.map +1 -0
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/menu/index.js +1 -1
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +78 -0
- package/dist/components/search-view/index.js +570 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +3 -2
- package/dist/components/separator/index.js +29 -26
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/supporting-pane/index.d.ts +44 -0
- package/dist/components/supporting-pane/index.js +109 -0
- package/dist/components/supporting-pane/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +49 -21
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +145 -0
- package/dist/components/text-area/index.js +231 -0
- package/dist/components/text-area/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/toolbar/index.d.ts +53 -0
- package/dist/components/toolbar/index.js +185 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +101 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/control/group.js +23 -0
- package/dist/control/group.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/fab/index.d.ts +19 -0
- package/dist/fab/index.js +147 -0
- package/dist/fab/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +350 -153
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +27 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +6 -4
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +92 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +20 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1394 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +51 -6
- package/dist/index.js +47 -4
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +96 -68
- package/dist/modal/index.js.map +1 -1
- package/dist/navigation/index.js +8 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +16 -2
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/separator/index.js +7 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/dist/typography/size.js +14 -0
- package/dist/typography/size.js.map +1 -0
- package/package.json +11 -2
- package/dist/badge/styles.js.map +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useTheme } from "../../theme/scope.js";
|
|
2
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
|
+
import { useWindowSizeClass } from "../../hooks/useWindowSizeClass.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { StyleSheet, View } from "react-native";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/supporting-pane/index.tsx
|
|
8
|
+
const SUPPORTING_PANE = 360;
|
|
9
|
+
const BESIDE = /* @__PURE__ */ new Set([
|
|
10
|
+
"expanded",
|
|
11
|
+
"extraLarge",
|
|
12
|
+
"large"
|
|
13
|
+
]);
|
|
14
|
+
const styles = StyleSheet.create({
|
|
15
|
+
leading: { flexDirection: "row-reverse" },
|
|
16
|
+
main: {
|
|
17
|
+
flex: 1,
|
|
18
|
+
minWidth: 0
|
|
19
|
+
},
|
|
20
|
+
supporting: { width: SUPPORTING_PANE },
|
|
21
|
+
trailing: { flexDirection: "row" }
|
|
22
|
+
});
|
|
23
|
+
const stylesOf = themedStyles(({ spacing }) => StyleSheet.create({ root: { gap: spacing.xl } }));
|
|
24
|
+
/**
|
|
25
|
+
* Material Design's supporting pane layout: a main pane and a companion that
|
|
26
|
+
* reflows underneath it when there is no room beside it.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <SupportingPane main={<Article />} supporting={<Related />} />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Layout only: neither pane paints a surface or a border of its own, so what
|
|
33
|
+
* goes in them is composed at the call site out of Cards, lists or plain
|
|
34
|
+
* content. The main pane comes first in the tree in both shapes, so a screen
|
|
35
|
+
* reader reaches it before the content that supports it.
|
|
36
|
+
*
|
|
37
|
+
* `style`, `ref` and `testID` land on the outer `View`, and a `style` there
|
|
38
|
+
* applies over the layout's own.
|
|
39
|
+
*/
|
|
40
|
+
function SupportingPane(t0) {
|
|
41
|
+
const $ = c(18);
|
|
42
|
+
let main;
|
|
43
|
+
let props;
|
|
44
|
+
let style;
|
|
45
|
+
let supporting;
|
|
46
|
+
let t1;
|
|
47
|
+
if ($[0] !== t0) {
|
|
48
|
+
({main, placement: t1, style, supporting, ...props} = t0);
|
|
49
|
+
$[0] = t0;
|
|
50
|
+
$[1] = main;
|
|
51
|
+
$[2] = props;
|
|
52
|
+
$[3] = style;
|
|
53
|
+
$[4] = supporting;
|
|
54
|
+
$[5] = t1;
|
|
55
|
+
} else {
|
|
56
|
+
main = $[1];
|
|
57
|
+
props = $[2];
|
|
58
|
+
style = $[3];
|
|
59
|
+
supporting = $[4];
|
|
60
|
+
t1 = $[5];
|
|
61
|
+
}
|
|
62
|
+
const placement = t1 === void 0 ? "trailing" : t1;
|
|
63
|
+
const own = stylesOf(useTheme());
|
|
64
|
+
const beside = BESIDE.has(useWindowSizeClass());
|
|
65
|
+
const row = placement === "leading" ? styles.leading : styles.trailing;
|
|
66
|
+
const T0 = View;
|
|
67
|
+
const t2 = composeStyles(own.root, beside ? row : null, style);
|
|
68
|
+
const t3 = beside ? styles.main : null;
|
|
69
|
+
let t4;
|
|
70
|
+
if ($[6] !== main || $[7] !== t3) {
|
|
71
|
+
t4 = /* @__PURE__ */ jsx(View, {
|
|
72
|
+
style: t3,
|
|
73
|
+
children: main
|
|
74
|
+
});
|
|
75
|
+
$[6] = main;
|
|
76
|
+
$[7] = t3;
|
|
77
|
+
$[8] = t4;
|
|
78
|
+
} else t4 = $[8];
|
|
79
|
+
const t5 = beside ? styles.supporting : null;
|
|
80
|
+
let t6;
|
|
81
|
+
if ($[9] !== supporting || $[10] !== t5) {
|
|
82
|
+
t6 = /* @__PURE__ */ jsx(View, {
|
|
83
|
+
style: t5,
|
|
84
|
+
children: supporting
|
|
85
|
+
});
|
|
86
|
+
$[9] = supporting;
|
|
87
|
+
$[10] = t5;
|
|
88
|
+
$[11] = t6;
|
|
89
|
+
} else t6 = $[11];
|
|
90
|
+
let t7;
|
|
91
|
+
if ($[12] !== T0 || $[13] !== props || $[14] !== t2 || $[15] !== t4 || $[16] !== t6) {
|
|
92
|
+
t7 = /* @__PURE__ */ jsxs(T0, {
|
|
93
|
+
...props,
|
|
94
|
+
style: t2,
|
|
95
|
+
children: [t4, t6]
|
|
96
|
+
});
|
|
97
|
+
$[12] = T0;
|
|
98
|
+
$[13] = props;
|
|
99
|
+
$[14] = t2;
|
|
100
|
+
$[15] = t4;
|
|
101
|
+
$[16] = t6;
|
|
102
|
+
$[17] = t7;
|
|
103
|
+
} else t7 = $[17];
|
|
104
|
+
return t7;
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { SupportingPane };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","ViewProps","ViewStyle","StyleSheet","View","WindowSizeClass","useWindowSizeClass","useTheme","composeStyles","themedStyles","SUPPORTING_PANE","BESIDE","ReadonlySet","Set","styles","create","leading","flexDirection","main","flex","minWidth","supporting","width","trailing","stylesOf","spacing","root","gap","xl","SupportingPaneProps","Omit","placement","ref","SupportingPane","t0","$","_c","props","style","t1","undefined","own","beside","has","row","T0","t2","t3","t4","t5","t6","t7","_c"],"sources":["../../../src/components/supporting-pane/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { ViewProps, ViewStyle } from 'react-native'\n\nimport { StyleSheet, View } from 'react-native'\n\nimport type { WindowSizeClass } from '../../hooks/useWindowSizeClass'\n\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's SupportingPane, Material Design's supporting pane canonical\n// layout. The supporting pane holds content that only means anything next to\n// the main pane, such as comments, related items or a tool panel, which is\n// what separates it from list-detail, where the second pane stands on its own.\n//\n// The page gives the layout two shapes. Below the expanded window size the\n// supporting pane is stacked under the main one, which is Material Design's\n// reflow strategy; the page's other compact option, a bottom sheet, is\n// Sheet's job at the call site. From expanded up, 840dp, the supporting pane\n// stands beside the main one at a fixed 360dp and the main pane takes the\n// rest. Native has no media queries, so the shape follows\n// `useWindowSizeClass()`, as ListDetail's does.\n//\n// **Which side the supporting pane takes is a choice of the side-by-side\n// shape alone.** The page puts it below the focus pane in medium windows and\n// under, and \"on the leading or trailing side of the focus pane\" from\n// expanded up, so `placement` moves the pane beside the main one and leaves\n// the stacked shape alone.\n//\n// **The main pane is first in the tree in both shapes, and a leading pane is\n// drawn before it by reversing the row.** That is web's departure too, for\n// web's reason: the page asks that the reading order match the arrangement\n// on screen, and no one order of the panes satisfies both of its rules. A\n// supporting pane written first would read before the main one when the\n// layout stacks, which is the one arrangement the page rules out, so the\n// break lands side by side instead, where a screen reader reaches the main\n// pane before the leading one drawn at its start.\n//\n// Both panes stay mounted in the same places in the tree in both shapes, so\n// a rotation or an unfolding keeps what either holds. A row runs from the\n// start edge, so under a right-to-left layout leading is the right-hand side,\n// with nothing here turning it over.\n\n// Material Design's width for the supporting pane, beside the main one.\nconst SUPPORTING_PANE = 360\n\n// The window sizes with room for both panes side by side.\nconst BESIDE: ReadonlySet<WindowSizeClass> = new Set([\n 'expanded',\n 'extraLarge',\n 'large',\n])\n\nconst styles = StyleSheet.create({\n leading: {\n flexDirection: 'row-reverse',\n },\n // The main pane beside the supporting one: whatever the fixed pane leaves,\n // which a long unbroken line inside cannot widen past its share.\n main: {\n flex: 1,\n minWidth: 0,\n },\n supporting: {\n width: SUPPORTING_PANE,\n },\n trailing: {\n flexDirection: 'row',\n },\n})\n\n// The 24dp between the panes, web's `spacing.xl`, in either shape.\nconst stylesOf = themedStyles(({ spacing }) =>\n StyleSheet.create({\n root: {\n gap: spacing.xl,\n },\n }),\n)\n\ntype SupportingPaneProps = Omit<ViewProps, 'children'> & {\n /**\n * The primary content. Takes whatever width the supporting pane leaves from\n * the expanded window size up.\n */\n readonly main?: ReactNode\n /**\n * Which side of the main pane the supporting one takes from the expanded\n * window size up. Below it the layout stacks either way, with the\n * supporting pane under the main one.\n * @default 'trailing'\n */\n readonly placement?: 'leading' | 'trailing'\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Content that only means something beside `main`. Sits below it in a\n * compact or medium window, and beside it at a fixed 360dp from the\n * expanded window size up.\n */\n readonly supporting?: ReactNode\n}\n\n/**\n * Material Design's supporting pane layout: a main pane and a companion that\n * reflows underneath it when there is no room beside it.\n *\n * ```tsx\n * <SupportingPane main={<Article />} supporting={<Related />} />\n * ```\n *\n * Layout only: neither pane paints a surface or a border of its own, so what\n * goes in them is composed at the call site out of Cards, lists or plain\n * content. The main pane comes first in the tree in both shapes, so a screen\n * reader reaches it before the content that supports it.\n *\n * `style`, `ref` and `testID` land on the outer `View`, and a `style` there\n * applies over the layout's own.\n */\nfunction SupportingPane({\n main,\n placement = 'trailing',\n style,\n supporting,\n ...props\n}: SupportingPaneProps) {\n const own = stylesOf(useTheme())\n const beside = BESIDE.has(useWindowSizeClass())\n const row = placement === 'leading' ? styles.leading : styles.trailing\n\n return (\n <View\n {...props}\n style={composeStyles<ViewStyle>(own.root, beside ? row : null, style)}\n >\n <View style={beside ? styles.main : null}>{main}</View>\n <View style={beside ? styles.supporting : null}>{supporting}</View>\n </View>\n )\n}\n\nexport type { SupportingPaneProps }\n\nexport { SupportingPane }\n"],"mappings":";;;;;;;AA6CA,MAAMY,kBAAkB;AAGxB,MAAMC,yBAAuC,IAAIE,IAAI;CACnD;CACA;CACA;AAAO,CACR;AAED,MAAMC,SAASX,WAAWY,OAAO;CAC/BC,SAAS,EACPC,eAAe,cACjB;CAGAC,MAAM;EACJC,MAAM;EACNC,UAAU;CACZ;CACAC,YAAY,EACVC,OAAOZ,gBACT;CACAa,UAAU,EACRN,eAAe,MACjB;AACF,CAAC;AAGD,MAAMO,WAAWf,cAAc,EAAEgB,cAC/BtB,WAAWY,OAAO,EAChBW,MAAM,EACJC,KAAKF,QAAQG,GACf,EACF,CAAC,CACH;;;;;;;;;;;;;;;;;AAwCA,SAAAK,eAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAlB;CAAA,IAAAmB;CAAA,IAAAC;CAAA,IAAAjB;CAAA,IAAAkB;CAAA,IAAAJ,EAAA,OAAAD,IAAA;EAAwB,CAAA,CAAAhB,MAAAa,WAAAQ,IAAAD,OAAAjB,YAAA,GAAAgB,SAAAH;EAMFC,EAAA,KAAAD;EAAAC,EAAA,KAAAjB;EAAAiB,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAd;EAAAc,EAAA,KAAAI;CAAA,OAAA;EAAArB,OAAAiB,EAAA;EAAAE,QAAAF,EAAA;EAAAG,QAAAH,EAAA;EAAAd,aAAAc,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAJpB,MAAAJ,YAAAQ,OAAAC,KAAAA,IAAA,aAAAD;CAKA,MAAAE,MAAYjB,SAASjB,SAAS,CAAC;CAC/B,MAAAmC,SAAe/B,OAAMgC,IAAKrC,mBAAmB,CAAC;CAC9C,MAAAsC,MAAYb,cAAc,YAAYjB,OAAME,UAAWF,OAAMS;CAG1D,MAAAsB,KAAAzC;CAEQ,MAAA0C,KAAAtC,cAAyBiC,IAAGf,MAAOgB,SAAAE,MAAA,MAAqBN,KAAK;CAEvD,MAAAS,KAAAL,SAAS5B,OAAMI,OAAf;CAA2B,IAAA8B;CAAA,IAAAb,EAAA,OAAAjB,QAAAiB,EAAA,OAAAY,IAAA;EAAxCC,KAAA,oBAAC,MAAD;GAAa,OAAAD;GAA8B7B,UAAAA;EAAtC,CAAA;EAAkDiB,EAAA,KAAAjB;EAAAiB,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAC1C,MAAAc,KAAAP,SAAS5B,OAAMO,aAAf;CAAiC,IAAA6B;CAAA,IAAAf,EAAA,OAAAd,cAAAc,EAAA,QAAAc,IAAA;EAA9CC,KAAA,oBAAC,MAAD;GAAa,OAAAD;GAAoC5B,UAAAA;EAA5C,CAAA;EAA8Dc,EAAA,KAAAd;EAAAc,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,QAAAU,MAAAV,EAAA,QAAAE,SAAAF,EAAA,QAAAW,MAAAX,EAAA,QAAAa,MAAAb,EAAA,QAAAe,IAAA;EALrEC,KAAA,qBAAC,IAAD;GAAK,GACCd;GACG,OAAAS;GAFT,UAAA,CAIEE,IACAE,EALG;;EAMEf,EAAA,MAAAU;EAAAV,EAAA,MAAAE;EAAAF,EAAA,MAAAW;EAAAX,EAAA,MAAAa;EAAAb,EAAA,MAAAe;EAAAf,EAAA,MAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,OANPgB;AAMO"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { PressableProps, StyleProp, View, ViewStyle } from "react-native";
|
|
2
|
+
import { ComponentRef, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
import { Key, Orientation } from "react-stately";
|
|
4
|
+
//#region src/components/tabs/index.d.ts
|
|
5
|
+
/** How the bar shares its room among the tabs. */
|
|
6
|
+
type TabsLayout = 'fixed' | 'scrollable';
|
|
7
|
+
type TabsListProps<T extends object = object> = {
|
|
8
|
+
/** Names the bar, for a screen reader. */
|
|
9
|
+
readonly 'aria-label'?: string;
|
|
10
|
+
/** Names the bar after the element with this id. */
|
|
11
|
+
readonly 'aria-labelledby'?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The tabs, as `Tabs.Tab` elements each given an `id`, or with `items` a
|
|
14
|
+
* function from an item to its tab.
|
|
15
|
+
*/
|
|
16
|
+
readonly children?: ((item: T) => ReactElement) | ReactNode;
|
|
17
|
+
/** The items to draw a tab for, through the function `children` is. */
|
|
18
|
+
readonly items?: Iterable<T>;
|
|
19
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
20
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
21
|
+
readonly testID?: string;
|
|
22
|
+
};
|
|
23
|
+
type TabsPanelProps = {
|
|
24
|
+
readonly children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* The key of the tab the panel belongs to, which is drawn while that tab
|
|
27
|
+
* is selected. A panel given none is drawn under whichever tab is.
|
|
28
|
+
*/
|
|
29
|
+
readonly id?: Key;
|
|
30
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
31
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
32
|
+
readonly testID?: string;
|
|
33
|
+
};
|
|
34
|
+
type TabsPanelsProps = {
|
|
35
|
+
/** The `Tabs.Panel` elements, whose box moves between their heights. */
|
|
36
|
+
readonly children?: ReactNode;
|
|
37
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
38
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
39
|
+
readonly testID?: string;
|
|
40
|
+
};
|
|
41
|
+
type TabsProps = {
|
|
42
|
+
/** The bar, as a `Tabs.List`, and the `Tabs.Panel` elements it switches. */
|
|
43
|
+
readonly children?: ReactNode;
|
|
44
|
+
/** The tab selected at first, when the bar keeps its own selection. */
|
|
45
|
+
readonly defaultSelectedKey?: Key;
|
|
46
|
+
/** The keys of the tabs that take no press, and draw disabled. */
|
|
47
|
+
readonly disabledKeys?: Iterable<Key>;
|
|
48
|
+
/**
|
|
49
|
+
* Disables every tab.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
readonly isDisabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* How the bar shares its room: `fixed` divides it into equal sections, and
|
|
55
|
+
* `scrollable` gives each tab its label's width in a bar that scrolls,
|
|
56
|
+
* which is the page's choice for more tabs than the room has sections for.
|
|
57
|
+
* @default 'fixed'
|
|
58
|
+
*/
|
|
59
|
+
readonly layout?: TabsLayout;
|
|
60
|
+
/** Called with the key of the tab that has just been selected. */
|
|
61
|
+
readonly onSelectionChange?: (key: Key) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the bar runs across, above its panels, or down, beside them.
|
|
64
|
+
* @default 'horizontal'
|
|
65
|
+
*/
|
|
66
|
+
readonly orientation?: Orientation;
|
|
67
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
68
|
+
/** The key of the selected tab, when the call site holds it. */
|
|
69
|
+
readonly selectedKey?: Key | null;
|
|
70
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
71
|
+
readonly testID?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Which of the page's two tab bars this is: `primary` for the main one,
|
|
74
|
+
* `secondary` for a strip under a primary one.
|
|
75
|
+
* @default 'primary'
|
|
76
|
+
*/
|
|
77
|
+
readonly variant?: TabsVariant;
|
|
78
|
+
};
|
|
79
|
+
type TabsTabProps = Omit<PressableProps, 'children' | 'disabled' | 'id' | 'role' | 'style'> & {
|
|
80
|
+
/**
|
|
81
|
+
* A badge on the tab: `true` for the badges page's small dot, a number for
|
|
82
|
+
* the large badge holding it. It sits on a primary tab's icon, and after
|
|
83
|
+
* the label anywhere else. The badge is hidden from a screen reader, so say
|
|
84
|
+
* what it says in the tab's `aria-label` too: "Second item, 3 new".
|
|
85
|
+
*/
|
|
86
|
+
readonly badge?: boolean | number;
|
|
87
|
+
/** The tab's label. */
|
|
88
|
+
readonly children?: ReactNode;
|
|
89
|
+
/** Where the tab goes when pressed, through the app's router. */
|
|
90
|
+
readonly href?: string;
|
|
91
|
+
/**
|
|
92
|
+
* An icon with the label, at the page's 24dp: over it on a primary tab,
|
|
93
|
+
* whose bar grows to 64dp, and before it on a secondary one. The slot hands
|
|
94
|
+
* it its colour and size through `useIconStyle()`.
|
|
95
|
+
*/
|
|
96
|
+
readonly icon?: ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* The tab's key, which selection reports and its `Tabs.Panel` shares.
|
|
99
|
+
* Without one, a tab drawn from `items` takes its item's `id` or `key`.
|
|
100
|
+
*/
|
|
101
|
+
readonly id?: Key;
|
|
102
|
+
/**
|
|
103
|
+
* Draws the tab disabled, and it takes no press, as a key in the bar's
|
|
104
|
+
* `disabledKeys` does.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
readonly isDisabled?: boolean;
|
|
108
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
109
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
110
|
+
/**
|
|
111
|
+
* The tab's text, for a label that is not a plain string. Read off
|
|
112
|
+
* `children` when it is one.
|
|
113
|
+
*/
|
|
114
|
+
readonly textValue?: string;
|
|
115
|
+
};
|
|
116
|
+
/** The tabs page's two styles of tab bar. */
|
|
117
|
+
type TabsVariant = 'primary' | 'secondary';
|
|
118
|
+
/**
|
|
119
|
+
* A tab bar and the panels it switches between. Pass `selectedKey` with
|
|
120
|
+
* `onSelectionChange` to hold the selection, or `defaultSelectedKey` to let
|
|
121
|
+
* the bar keep its own. Each `Tabs.Tab` names the `Tabs.Panel` it shows
|
|
122
|
+
* through a shared `id`, and a bar may stand alone without panels.
|
|
123
|
+
*
|
|
124
|
+
* ```tsx
|
|
125
|
+
* <Tabs defaultSelectedKey="first">
|
|
126
|
+
* <Tabs.List aria-label="Sections">
|
|
127
|
+
* <Tabs.Tab id="first">First item</Tabs.Tab>
|
|
128
|
+
* <Tabs.Tab id="second">Second item</Tabs.Tab>
|
|
129
|
+
* </Tabs.List>
|
|
130
|
+
* <Tabs.Panel id="first">
|
|
131
|
+
* <Text>Supporting line</Text>
|
|
132
|
+
* </Tabs.Panel>
|
|
133
|
+
* <Tabs.Panel id="second">
|
|
134
|
+
* <Text>Supporting line</Text>
|
|
135
|
+
* </Tabs.Panel>
|
|
136
|
+
* </Tabs>
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* Write the `Tabs.List` among the children of `Tabs`, inside any view or
|
|
140
|
+
* fragment, rather than in a component of the call site's own: the bar is
|
|
141
|
+
* found there, and its tabs are what the selection is built from.
|
|
142
|
+
*
|
|
143
|
+
* `style`, `ref` and `testID` land on the root view, the one a layout
|
|
144
|
+
* positions.
|
|
145
|
+
*/
|
|
146
|
+
declare function Tabs({ children, defaultSelectedKey, disabledKeys, isDisabled, layout, onSelectionChange, orientation, ref, selectedKey, style, testID, variant }: TabsProps): import("react").JSX.Element;
|
|
147
|
+
declare namespace Tabs {
|
|
148
|
+
var List: typeof TabsList;
|
|
149
|
+
var Panel: typeof TabsPanel;
|
|
150
|
+
var Panels: typeof TabsPanels;
|
|
151
|
+
var Tab: typeof TabsTab;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The bar: every tab, drawn from the entries its `Tabs.Tab` children gave
|
|
155
|
+
* the root, with the divider and the indicator. Name it with `aria-label` or
|
|
156
|
+
* `aria-labelledby`.
|
|
157
|
+
*
|
|
158
|
+
* `style`, `ref` and `testID` land on the bar's own view.
|
|
159
|
+
*/
|
|
160
|
+
declare function TabsList<T extends object = object>({ 'aria-label': ariaLabel, 'aria-labelledby': labelledBy, ref, style, testID }: TabsListProps<T>): import("react").JSX.Element;
|
|
161
|
+
/**
|
|
162
|
+
* One tab of a `Tabs.List`, which draws it: the root builds its selection
|
|
163
|
+
* from these, so one renders nothing on its own. Give every tab an `id`,
|
|
164
|
+
* which is the key selection reports and its `Tabs.Panel` shares.
|
|
165
|
+
*/
|
|
166
|
+
declare function TabsTab(_props: TabsTabProps): null;
|
|
167
|
+
declare namespace TabsTab {
|
|
168
|
+
var getCollectionNode: (props: TabsTabProps) => Generator<{
|
|
169
|
+
'aria-label': string | undefined;
|
|
170
|
+
hasChildNodes: boolean;
|
|
171
|
+
key: Key | undefined;
|
|
172
|
+
props: TabsTabProps;
|
|
173
|
+
rendered: ReactNode;
|
|
174
|
+
textValue: string;
|
|
175
|
+
type: string;
|
|
176
|
+
}, void, unknown>;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The content of one tab, drawn while its tab is selected. Its `id` is the
|
|
180
|
+
* tab's.
|
|
181
|
+
*
|
|
182
|
+
* `style`, `ref` and `testID` land on the panel's own view.
|
|
183
|
+
*/
|
|
184
|
+
declare function TabsPanel({ children, id, ref, style, testID }: TabsPanelProps): import("react").JSX.Element | null;
|
|
185
|
+
/**
|
|
186
|
+
* An optional box around the panels, which moves its height as one panel
|
|
187
|
+
* gives way to the next, over medium1 on the emphasized curve and at once
|
|
188
|
+
* under reduced motion. Without it the panels still work; the box around
|
|
189
|
+
* them simply jumps from one height to the other.
|
|
190
|
+
*
|
|
191
|
+
* `style`, `ref` and `testID` land on the box.
|
|
192
|
+
*/
|
|
193
|
+
declare function TabsPanels({ children, ref, style, testID }: TabsPanelsProps): import("react").JSX.Element;
|
|
194
|
+
//#endregion
|
|
195
|
+
export { Tabs, type TabsLayout, TabsList, type TabsListProps, TabsPanel, type TabsPanelProps, TabsPanels, type TabsPanelsProps, type TabsProps, TabsTab, type TabsTabProps, type TabsVariant };
|
|
196
|
+
//# sourceMappingURL=index.d.ts.map
|