@kanso-labs/react-native-kanso-ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge/index.js +9 -70
- package/dist/badge/index.js.map +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/palettes.d.ts +2 -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/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 +93 -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/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/fab/index.d.ts +80 -0
- package/dist/components/fab/index.js +231 -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/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/menu/index.js +1 -1
- 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/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/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/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/control/group.js +23 -0
- package/dist/control/group.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/index.js +84 -43
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +18 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/form/index.d.ts +1 -2
- package/dist/form/index.js +1 -1
- package/dist/form/index.js.map +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.js +15 -3
- package/dist/modal/index.js +59 -46
- 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/overlay/placement.js +3 -1
- package/dist/overlay/placement.js.map +1 -1
- package/dist/separator/index.js +7 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/typography/size.js +14 -0
- package/dist/typography/size.js.map +1 -0
- package/package.json +1 -1
- package/dist/badge/styles.js.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useTheme } from "../../theme/scope.js";
|
|
2
2
|
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
|
+
import { SeparatorOrientationContext } from "../../separator/index.js";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { StyleSheet, View } from "react-native";
|
|
6
|
+
import { use } from "react";
|
|
5
7
|
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
//#region src/components/separator/index.tsx
|
|
7
9
|
const styles = StyleSheet.create({
|
|
@@ -58,50 +60,51 @@ const VERTICAL = { "aria-orientation": "vertical" };
|
|
|
58
60
|
*/
|
|
59
61
|
function Separator(t0) {
|
|
60
62
|
const $ = c(14);
|
|
63
|
+
let own;
|
|
61
64
|
let props;
|
|
62
65
|
let style;
|
|
63
66
|
let t1;
|
|
64
|
-
let t2;
|
|
65
67
|
if ($[0] !== t0) {
|
|
66
|
-
({inset: t1, orientation:
|
|
68
|
+
({inset: t1, orientation: own, style, ...props} = t0);
|
|
67
69
|
$[0] = t0;
|
|
68
|
-
$[1] =
|
|
69
|
-
$[2] =
|
|
70
|
-
$[3] =
|
|
71
|
-
$[4] =
|
|
70
|
+
$[1] = own;
|
|
71
|
+
$[2] = props;
|
|
72
|
+
$[3] = style;
|
|
73
|
+
$[4] = t1;
|
|
72
74
|
} else {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
own = $[1];
|
|
76
|
+
props = $[2];
|
|
77
|
+
style = $[3];
|
|
78
|
+
t1 = $[4];
|
|
77
79
|
}
|
|
78
80
|
const inset = t1 === void 0 ? "none" : t1;
|
|
79
|
-
const orientation = t2 === void 0 ? "horizontal" : t2;
|
|
80
81
|
const theme = useTheme();
|
|
81
|
-
const
|
|
82
|
-
|
|
82
|
+
const provided = use(SeparatorOrientationContext);
|
|
83
|
+
const orientation = own ?? provided ?? "horizontal";
|
|
84
|
+
const t2 = orientation === "vertical" ? VERTICAL : void 0;
|
|
85
|
+
let t3;
|
|
83
86
|
if ($[5] !== inset || $[6] !== orientation || $[7] !== style || $[8] !== theme) {
|
|
84
|
-
|
|
87
|
+
t3 = composeStyles(styles[orientation], fillOf(theme).rule, insetsOf(theme)[orientation][inset], style);
|
|
85
88
|
$[5] = inset;
|
|
86
89
|
$[6] = orientation;
|
|
87
90
|
$[7] = style;
|
|
88
91
|
$[8] = theme;
|
|
89
|
-
$[9] =
|
|
90
|
-
} else
|
|
91
|
-
let
|
|
92
|
-
if ($[10] !== props || $[11] !==
|
|
93
|
-
|
|
92
|
+
$[9] = t3;
|
|
93
|
+
} else t3 = $[9];
|
|
94
|
+
let t4;
|
|
95
|
+
if ($[10] !== props || $[11] !== t2 || $[12] !== t3) {
|
|
96
|
+
t4 = /* @__PURE__ */ jsx(View, {
|
|
94
97
|
role: "separator",
|
|
95
|
-
...
|
|
98
|
+
...t2,
|
|
96
99
|
...props,
|
|
97
|
-
style:
|
|
100
|
+
style: t3
|
|
98
101
|
});
|
|
99
102
|
$[10] = props;
|
|
100
|
-
$[11] =
|
|
101
|
-
$[12] =
|
|
102
|
-
$[13] =
|
|
103
|
-
} else
|
|
104
|
-
return
|
|
103
|
+
$[11] = t2;
|
|
104
|
+
$[12] = t3;
|
|
105
|
+
$[13] = t4;
|
|
106
|
+
} else t4 = $[13];
|
|
107
|
+
return t4;
|
|
105
108
|
}
|
|
106
109
|
//#endregion
|
|
107
110
|
export { Separator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","Ref","ViewProps","ViewStyle","StyleSheet","View","useTheme","composeStyles","themedStyles","styles","create","horizontal","alignSelf","flexShrink","height","vertical","width","fillOf","colors","rule","backgroundColor","outlineVariant","insetsOf","spacing","both","marginEnd","lg","marginStart","none","start","marginBottom","marginTop","VERTICAL","SeparatorInset","SeparatorProps","inset","orientation","ref","Separator","t0","$","_c","props","style","t1","
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","Ref","ViewProps","ViewStyle","use","StyleSheet","View","SeparatorOrientationContext","useTheme","composeStyles","themedStyles","styles","create","horizontal","alignSelf","flexShrink","height","vertical","width","fillOf","colors","rule","backgroundColor","outlineVariant","insetsOf","spacing","both","marginEnd","lg","marginStart","none","start","marginBottom","marginTop","VERTICAL","SeparatorInset","SeparatorProps","inset","orientation","ref","Separator","t0","$","_c","own","props","style","t1","undefined","theme","provided","t2","t3","t4","_c"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["import type { ComponentRef, Ref } from 'react'\nimport type { ViewProps, ViewStyle } from 'react-native'\n\nimport { use } from 'react'\nimport { StyleSheet, View } from 'react-native'\n\nimport { SeparatorOrientationContext } from '../../separator'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own, as on web: the design system treats the two\n// as one decision.\n//\n// Drawn as a filled 1dp view rather than as a border, so the rule is the view\n// itself, which flex `gap` and anything measuring it can see.\n//\n// A rule has no length of its own. `alignSelf: 'stretch'` takes it from the\n// parent's cross axis: a horizontal rule spans a column, which is what a\n// `View` is by default, and a vertical one spans a row. A rule between two\n// rows should match whatever they turn out to be rather than being told a\n// length at the call site, and in a parent running the same way as the rule\n// it has none, which is the documented cost.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The page\n// names them \"inset\" and \"middle-inset\"; the prop says `start` and `both`, as\n// on web, since the two words say which ends move. The inset is a margin on\n// the axis the rule runs along, which shortens a stretched rule rather than\n// pushing it out of its parent. A horizontal rule's is `marginStart`, which\n// React Native puts on the right under right-to-left.\nconst styles = StyleSheet.create({\n horizontal: {\n alignSelf: 'stretch',\n flexShrink: 0,\n height: 1,\n },\n vertical: {\n alignSelf: 'stretch',\n flexShrink: 0,\n width: 1,\n },\n})\n\nconst fillOf = themedStyles(({ colors }) =>\n StyleSheet.create({\n rule: { backgroundColor: colors.outlineVariant },\n }),\n)\n\n// The page's 16dp, on the axis the rule runs along.\nconst insetsOf = themedStyles(({ spacing }) => ({\n horizontal: StyleSheet.create({\n both: { marginEnd: spacing.lg, marginStart: spacing.lg },\n none: {},\n start: { marginStart: spacing.lg },\n }),\n vertical: StyleSheet.create({\n both: { marginBottom: spacing.lg, marginTop: spacing.lg },\n none: {},\n start: { marginTop: spacing.lg },\n }),\n}))\n\n// React Native Web writes `aria-orientation` onto the element, which React\n// Native's types do not name. A horizontal rule needs none, since that is the\n// separator role's own default.\nconst VERTICAL: { readonly 'aria-orientation': 'vertical' } = {\n 'aria-orientation': 'vertical',\n}\n\ntype SeparatorInset = 'both' | 'none' | 'start'\n\ntype SeparatorProps = ViewProps & {\n /**\n * How far the rule is held off the ends it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both` holds\n * it off each end, which is its middle-inset one. The inset follows the\n * writing direction rather than a fixed side.\n * @default 'none'\n */\n readonly inset?: SeparatorInset\n /**\n * Which way the rule runs. A rule takes its length from its parent: a\n * horizontal one spans a column, and a vertical one a row. Inside a\n * `Toolbar` it runs across the bar unless this says otherwise.\n * @default 'horizontal'\n */\n readonly orientation?: 'horizontal' | 'vertical'\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\n/**\n * A 1dp rule between items, in the outline-variant colour, carrying the\n * separator role.\n *\n * ```tsx\n * <Stack gap=\"none\">\n * <Text>First item</Text>\n * <Separator inset=\"start\" />\n * <Text>Second item</Text>\n * </Stack>\n * ```\n *\n * `inset` holds the rule off the ends it runs between, `start` off the\n * leading one and `both` off each, which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * Web draws the rule again as a border under forced colours, which neither\n * iOS nor Android has. `style`, `ref` and `testID` land on the `View`, and a\n * `style` there applies over the rule's own.\n */\nfunction Separator({\n inset = 'none',\n orientation: own,\n style,\n ...props\n}: SeparatorProps) {\n const theme = useTheme()\n const provided = use(SeparatorOrientationContext)\n const orientation = own ?? provided ?? 'horizontal'\n\n return (\n <View\n role=\"separator\"\n {...(orientation === 'vertical' ? VERTICAL : undefined)}\n {...props}\n style={composeStyles<ViewStyle>(\n styles[orientation],\n fillOf(theme).rule,\n insetsOf(theme)[orientation][inset],\n style,\n )}\n />\n )\n}\n\nexport type { SeparatorInset, SeparatorProps }\n\nexport { Separator }\n"],"mappings":";;;;;;;;AA+BA,MAAMW,SAASN,WAAWO,OAAO;CAC/BC,YAAY;EACVC,WAAW;EACXC,YAAY;EACZC,QAAQ;CACV;CACAC,UAAU;EACRH,WAAW;EAC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,IAAAI;CAAA,IAAAV,EAAA,OAAAL,SAAAK,EAAA,OAAAJ,eAAAI,EAAA,OAAAI,SAAAJ,EAAA,OAAAO,OAAA;EAE/CG,KAAA3C,cACLE,OAAO2B,cACPnB,OAAO8B,KAAK,CAAC,CAAA5B,MACbG,SAASyB,KAAK,CAAC,CAACX,YAAY,CAACD,QAC7BS,KACF;EAACJ,EAAA,KAAAL;EAAAK,EAAA,KAAAJ;EAAAI,EAAA,KAAAI;EAAAJ,EAAA,KAAAO;EAAAP,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAG,SAAAH,EAAA,QAAAS,MAAAT,EAAA,QAAAU,IAAA;EATHC,KAAA,oBAAC,MAAD;GACO,MAAA;GAAW,GACXF;GAAiD,GAClDN;GACG,OAAAO;EAKN,CAAA;EACDV,EAAA,MAAAG;EAAAH,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OAVFW;AAUE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { View, ViewProps } from "react-native";
|
|
2
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
3
|
+
//#region src/components/supporting-pane/index.d.ts
|
|
4
|
+
type SupportingPaneProps = Omit<ViewProps, 'children'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The primary content. Takes whatever width the supporting pane leaves from
|
|
7
|
+
* the expanded window size up.
|
|
8
|
+
*/
|
|
9
|
+
readonly main?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Which side of the main pane the supporting one takes from the expanded
|
|
12
|
+
* window size up. Below it the layout stacks either way, with the
|
|
13
|
+
* supporting pane under the main one.
|
|
14
|
+
* @default 'trailing'
|
|
15
|
+
*/
|
|
16
|
+
readonly placement?: 'leading' | 'trailing';
|
|
17
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
18
|
+
/**
|
|
19
|
+
* Content that only means something beside `main`. Sits below it in a
|
|
20
|
+
* compact or medium window, and beside it at a fixed 360dp from the
|
|
21
|
+
* expanded window size up.
|
|
22
|
+
*/
|
|
23
|
+
readonly supporting?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Material Design's supporting pane layout: a main pane and a companion that
|
|
27
|
+
* reflows underneath it when there is no room beside it.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <SupportingPane main={<Article />} supporting={<Related />} />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Layout only: neither pane paints a surface or a border of its own, so what
|
|
34
|
+
* goes in them is composed at the call site out of Cards, lists or plain
|
|
35
|
+
* content. The main pane comes first in the tree in both shapes, so a screen
|
|
36
|
+
* reader reaches it before the content that supports it.
|
|
37
|
+
*
|
|
38
|
+
* `style`, `ref` and `testID` land on the outer `View`, and a `style` there
|
|
39
|
+
* applies over the layout's own.
|
|
40
|
+
*/
|
|
41
|
+
declare function SupportingPane({ main, placement, style, supporting, ...props }: SupportingPaneProps): import("react").JSX.Element;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { SupportingPane, type SupportingPaneProps };
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;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A,MAAAa;EAAAb,EAAA,MAAAe;EAAAf,EAAA,MAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,OANPgB;AAMO"}
|
|
@@ -38,7 +38,7 @@ type TextProps$1 = TextProps & {
|
|
|
38
38
|
* rather than an element. `style`, `ref` and `testID` land on React Native's
|
|
39
39
|
* own Text.
|
|
40
40
|
*/
|
|
41
|
-
declare function Text$1({ style, tone, variant, ...props }: TextProps$1): import("react").JSX.Element;
|
|
41
|
+
declare function Text$1({ children, style, tone, variant, ...props }: TextProps$1): import("react").JSX.Element;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { Text$1 as Text, type TextProps$1 as TextProps };
|
|
44
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useTheme } from "../../theme/scope.js";
|
|
2
2
|
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
3
|
import { useTypeRole } from "../../typography/roles.js";
|
|
4
|
+
import { TextSizeContext } from "../../typography/size.js";
|
|
5
|
+
import { sentenceLabel } from "../keycap/index.js";
|
|
4
6
|
import { c } from "react/compiler-runtime";
|
|
5
7
|
import { StyleSheet, Text } from "react-native";
|
|
6
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -36,41 +38,67 @@ const stylesOf = themedStyles(({ colors }) => StyleSheet.create({
|
|
|
36
38
|
* own Text.
|
|
37
39
|
*/
|
|
38
40
|
function Text$1(t0) {
|
|
39
|
-
const $ = c(
|
|
41
|
+
const $ = c(18);
|
|
42
|
+
let children;
|
|
40
43
|
let props;
|
|
41
44
|
let style;
|
|
42
45
|
let t1;
|
|
43
46
|
let t2;
|
|
44
47
|
if ($[0] !== t0) {
|
|
45
|
-
({style, tone: t1, variant: t2, ...props} = t0);
|
|
48
|
+
({children, style, tone: t1, variant: t2, ...props} = t0);
|
|
46
49
|
$[0] = t0;
|
|
47
|
-
$[1] =
|
|
48
|
-
$[2] =
|
|
49
|
-
$[3] =
|
|
50
|
-
$[4] =
|
|
50
|
+
$[1] = children;
|
|
51
|
+
$[2] = props;
|
|
52
|
+
$[3] = style;
|
|
53
|
+
$[4] = t1;
|
|
54
|
+
$[5] = t2;
|
|
51
55
|
} else {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
children = $[1];
|
|
57
|
+
props = $[2];
|
|
58
|
+
style = $[3];
|
|
59
|
+
t1 = $[4];
|
|
60
|
+
t2 = $[5];
|
|
56
61
|
}
|
|
57
62
|
const tone = t1 === void 0 ? "neutral" : t1;
|
|
58
63
|
const role = useTypeRole(t2 === void 0 ? "bodyMedium" : t2);
|
|
59
64
|
const tones = stylesOf(useTheme());
|
|
60
|
-
const
|
|
61
|
-
const
|
|
65
|
+
const composed = composeStyles(role, tones[tone], style);
|
|
66
|
+
const size = StyleSheet.flatten(composed)?.fontSize;
|
|
67
|
+
const plain = typeof children === "string" || typeof children === "number";
|
|
68
|
+
let t3;
|
|
69
|
+
if ($[6] !== children || $[7] !== props) {
|
|
70
|
+
t3 = props.accessibilityLabel ?? (props["aria-label"] === void 0 ? sentenceLabel(children) : void 0);
|
|
71
|
+
$[6] = children;
|
|
72
|
+
$[7] = props;
|
|
73
|
+
$[8] = t3;
|
|
74
|
+
} else t3 = $[8];
|
|
75
|
+
const label = t3;
|
|
62
76
|
let t4;
|
|
63
|
-
if ($[
|
|
64
|
-
t4 = /* @__PURE__ */ jsx(
|
|
77
|
+
if ($[9] !== children || $[10] !== plain || $[11] !== size) {
|
|
78
|
+
t4 = plain ? children : /* @__PURE__ */ jsx(TextSizeContext, {
|
|
79
|
+
value: size,
|
|
80
|
+
children
|
|
81
|
+
});
|
|
82
|
+
$[9] = children;
|
|
83
|
+
$[10] = plain;
|
|
84
|
+
$[11] = size;
|
|
85
|
+
$[12] = t4;
|
|
86
|
+
} else t4 = $[12];
|
|
87
|
+
let t5;
|
|
88
|
+
if ($[13] !== composed || $[14] !== label || $[15] !== props || $[16] !== t4) {
|
|
89
|
+
t5 = /* @__PURE__ */ jsx(Text, {
|
|
65
90
|
...props,
|
|
66
|
-
|
|
91
|
+
accessibilityLabel: label,
|
|
92
|
+
style: composed,
|
|
93
|
+
children: t4
|
|
67
94
|
});
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
$[13] = composed;
|
|
96
|
+
$[14] = label;
|
|
97
|
+
$[15] = props;
|
|
98
|
+
$[16] = t4;
|
|
99
|
+
$[17] = t5;
|
|
100
|
+
} else t5 = $[17];
|
|
101
|
+
return t5;
|
|
74
102
|
}
|
|
75
103
|
//#endregion
|
|
76
104
|
export { Text$1 as Text };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","Ref","TextProps","NativeTextProps","Text","NativeText","StyleSheet","TypeRole","useTheme","composeStyles","themedStyles","useTypeRole","stylesOf","colors","create","error","color","inherit","muted","onSurfaceVariant","negative","neutral","onSurface","positive","primary","ref","tone","variant","t0","$","_c","props","style","t1","t2","undefined","role","tones","
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","Ref","TextProps","NativeTextProps","TextStyle","Text","NativeText","StyleSheet","TypeRole","useTheme","composeStyles","themedStyles","useTypeRole","TextSizeContext","sentenceLabel","stylesOf","colors","create","error","color","inherit","muted","onSurfaceVariant","negative","neutral","onSurface","positive","primary","ref","tone","variant","t0","$","_c","children","props","style","t1","t2","undefined","role","tones","composed","size","flatten","fontSize","plain","t3","accessibilityLabel","label","t4","t5","Text","_c","NativeText"],"sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import type { ComponentRef, Ref } from 'react'\nimport type { TextProps as NativeTextProps, TextStyle } from 'react-native'\n\nimport { Text as NativeText, StyleSheet } from 'react-native'\n\nimport type { TypeRole } from '../../typography/roles'\n\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\nimport { TextSizeContext } from '../../typography/size'\nimport { sentenceLabel } from '../keycap'\n\n// Tone is a separate axis from variant so the two compose freely: any of the\n// fifteen roles in any of these colours, the same set web's Text takes.\n// `inherit` sets no colour, so a Text inside another takes the outer one's.\nconst stylesOf = themedStyles(({ colors }) =>\n StyleSheet.create({\n error: { color: colors.error },\n inherit: {},\n muted: { color: colors.onSurfaceVariant },\n negative: { color: colors.negative },\n neutral: { color: colors.onSurface },\n positive: { color: colors.positive },\n primary: { color: colors.primary },\n }),\n)\n\ntype TextProps = NativeTextProps & {\n readonly ref?: Ref<ComponentRef<typeof NativeText>>\n /**\n * The colour role to draw in. `neutral` is the on-surface role, as it is on\n * web; `inherit` takes the colour of the Text around it instead of setting\n * one.\n * @default 'neutral'\n */\n readonly tone?:\n | 'error'\n | 'inherit'\n | 'muted'\n | 'negative'\n | 'neutral'\n | 'positive'\n | 'primary'\n /**\n * Which role of the type scale to draw in.\n * @default 'bodyMedium'\n */\n readonly variant?: TypeRole\n}\n\n/**\n * A run of text in one role of Material Design's type scale and one colour\n * role, with web's props and values.\n *\n * ```tsx\n * <Text accessibilityRole=\"header\" variant=\"titleLarge\">\n * Headline\n * </Text>\n * ```\n *\n * Each role reads its family, size, line height, weight and tracking from the\n * theme, so an override of the plain or brand family reaches every role drawn\n * in it. The family is the token's first when the app has registered it with\n * expo-font, and the system font otherwise. The OS text size scales every\n * role, as `allowFontScaling` leaves it.\n *\n * Web's `render` and `block` have no counterpart: a native Text is a block\n * unless it sits inside another, and a heading is an `accessibilityRole`\n * rather than an element. `style`, `ref` and `testID` land on React Native's\n * own Text.\n */\nfunction Text({\n children,\n style,\n tone = 'neutral',\n variant = 'bodyMedium',\n ...props\n}: TextProps) {\n const role = useTypeRole(variant)\n const tones = stylesOf(useTheme())\n const composed = composeStyles<TextStyle>(role, tones[tone], style)\n // The size the text ends up at, the call site's over the role's, which a\n // Code or a Keycap inside it sets a share of. Plain text holds neither, so\n // it goes in as it is, and a host Text's children stay the string a call\n // site wrote.\n const size = StyleSheet.flatten(composed)?.fontSize\n const plain = typeof children === 'string' || typeof children === 'number'\n // A Keycap is an inline View, whose name a native screen reader leaves out\n // of the sentence, so a Text holding one says the sentence itself unless\n // the call site has labelled it.\n const label =\n props.accessibilityLabel ??\n (props['aria-label'] === undefined ? sentenceLabel(children) : undefined)\n\n return (\n <NativeText {...props} accessibilityLabel={label} style={composed}>\n {plain ? (\n children\n ) : (\n <TextSizeContext value={size}>{children}</TextSizeContext>\n )}\n </NativeText>\n )\n}\n\nexport type { TextProps }\n\nexport { Text }\n"],"mappings":";;;;;;;;;AAgBA,MAAMe,WAAWJ,cAAc,EAAEK,aAC/BT,WAAWU,OAAO;CAChBC,OAAO,EAAEC,OAAOH,OAAOE,MAAM;CAC7BE,SAAS,CAAC;CACVC,OAAO,EAAEF,OAAOH,OAAOM,iBAAiB;CACxCC,UAAU,EAAEJ,OAAOH,OAAOO,SAAS;CACnCC,SAAS,EAAEL,OAAOH,OAAOS,UAAU;CACnCC,UAAU,EAAEP,OAAOH,OAAOU,SAAS;CACnCC,SAAS,EAAER,OAAOH,OAAOW,QAAQ;AACnC,CAAC,CACH;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAAtB,OAAA0B,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAc,CAAA,CAAAG,UAAAE,OAAAP,MAAAQ,IAAAP,SAAAQ,IAAA,GAAAH,SAAAJ;EAMFC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAJ,WAAAF,EAAA;EAAAG,QAAAH,EAAA;EAAAI,QAAAJ,EAAA;EAAAK,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CA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mB;AAMa"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { ValidationResult } from "../../form/index.js";
|
|
2
|
+
import { FieldVariant } from "../../field/index.js";
|
|
3
|
+
import { StyleProp, TextInput, TextInputProps, View, ViewStyle } from "react-native";
|
|
4
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
5
|
+
//#region src/components/text-area/index.d.ts
|
|
6
|
+
type TextAreaProps = Omit<TextInputProps, 'accessibilityHint' | 'accessibilityLabel' | 'aria-disabled' | 'aria-label' | 'children' | 'cursorColor' | 'defaultValue' | 'editable' | 'multiline' | 'numberOfLines' | 'onChange' | 'onChangeText' | 'placeholder' | 'placeholderTextColor' | 'readOnly' | 'rows' | 'selectionColor' | 'style' | 'underlineColorAndroid' | 'value'> & {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the field grows with the text it holds, from `rows` up. `false`
|
|
9
|
+
* keeps it at `rows` and scrolls the text inside.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
readonly autosize?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Counts the characters the field holds at the end of the supporting line,
|
|
15
|
+
* against `maxLength` where there is one, as the text fields page's
|
|
16
|
+
* character counter does. The count is written in the digits of the
|
|
17
|
+
* `I18nProvider`'s locale, or the device's outside one.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
readonly characterCount?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* How the limit is said to a screen reader, where there is a `maxLength`.
|
|
23
|
+
* Read with the field rather than as the value changes, so it names the
|
|
24
|
+
* limit and not what is left of it; the visible count is hidden from
|
|
25
|
+
* screen readers, which is what this replaces. Left out, it is the
|
|
26
|
+
* library's sentence in the `I18nProvider`'s locale, or the device's
|
|
27
|
+
* outside one, in the plural form the limit takes there: "Up to 20
|
|
28
|
+
* characters" in English, singular for a limit of one.
|
|
29
|
+
*/
|
|
30
|
+
readonly characterLimitLabel?: string;
|
|
31
|
+
/** The value the field opens with, when it keeps its own. */
|
|
32
|
+
readonly defaultValue?: string;
|
|
33
|
+
/**
|
|
34
|
+
* A hint shown under the field. Replaced by `error` when there is one, so
|
|
35
|
+
* the two never stack.
|
|
36
|
+
*/
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The problem with the current value, in words. Its presence is what puts
|
|
40
|
+
* the field in its error state: the message, the error colours, and the
|
|
41
|
+
* invalid state a screen reader reads all follow from it. The line under
|
|
42
|
+
* the field arrives with the message, so the field grows when this does,
|
|
43
|
+
* unless it is inside a `Form`, which keeps the line drawn. It wins over
|
|
44
|
+
* what `validate` and the form say, and holds a `native` form back.
|
|
45
|
+
*/
|
|
46
|
+
readonly error?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the label sits in the empty box and floats to the top once the
|
|
49
|
+
* field is focused or holds a value, as the text fields page draws it.
|
|
50
|
+
* `false` keeps it small at the top in every state.
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
readonly floatingLabel?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* A ref to the field's own `TextInput`, which is what a call site moves
|
|
56
|
+
* focus to, after a server's error, say. `ref` is the field as a whole.
|
|
57
|
+
*/
|
|
58
|
+
readonly inputRef?: Ref<ComponentRef<typeof TextInput>>;
|
|
59
|
+
/**
|
|
60
|
+
* Draws the field disabled: it takes no focus and no input.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
readonly isDisabled?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Shows the value and takes focus, but takes no input.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
readonly isReadOnly?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Marks the label with an asterisk, as the text fields page marks a field
|
|
71
|
+
* that must be filled.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
readonly isRequired?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* What the field is for, and the name a screen reader reads for it.
|
|
77
|
+
* Required, since a text area with no label is a box nobody can name.
|
|
78
|
+
*/
|
|
79
|
+
readonly label: string;
|
|
80
|
+
/**
|
|
81
|
+
* An icon at the start of the box, before the label and the text: the
|
|
82
|
+
* page's 24dp leading icon, in the muted role. The slot hands it that
|
|
83
|
+
* colour and size through `useIconStyle()`.
|
|
84
|
+
*/
|
|
85
|
+
readonly leadingIcon?: ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* The name the value is submitted under by the `Form` around the field,
|
|
88
|
+
* and the key its `validationErrors` reach the field by.
|
|
89
|
+
*/
|
|
90
|
+
readonly name?: string;
|
|
91
|
+
/** Called with the new value as it is edited. */
|
|
92
|
+
readonly onChange?: (value: string) => void;
|
|
93
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
94
|
+
/**
|
|
95
|
+
* How many lines of text the field shows: the least it shows while it
|
|
96
|
+
* grows, or all it shows when it does not.
|
|
97
|
+
* @default 3
|
|
98
|
+
*/
|
|
99
|
+
readonly rows?: number;
|
|
100
|
+
/** Positions and sizes the field as a whole. */
|
|
101
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
102
|
+
/**
|
|
103
|
+
* An icon at the end of the box, after the text: the page's 24dp trailing
|
|
104
|
+
* icon, in the muted role and the error role while the field has an
|
|
105
|
+
* error. The slot hands it that colour and size through `useIconStyle()`.
|
|
106
|
+
*/
|
|
107
|
+
readonly trailingIcon?: ReactNode;
|
|
108
|
+
/**
|
|
109
|
+
* Checks the value, and returns its problem in words, or several, where
|
|
110
|
+
* there is one, and `true`, `null` or `undefined` where there is none.
|
|
111
|
+
* Under the default `aria` validation the error shows as the value
|
|
112
|
+
* changes; inside a `native` form it shows once a submission is tried, or
|
|
113
|
+
* once the field loses focus after an edit, and holds the form back.
|
|
114
|
+
*/
|
|
115
|
+
readonly validate?: (value: string) => ValidationResult;
|
|
116
|
+
/** The value, when the call site keeps it. */
|
|
117
|
+
readonly value?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The filled box, or the outlined one: no fill, an outline that thickens
|
|
120
|
+
* and takes the primary role while focused, and the label cutting it once
|
|
121
|
+
* it floats, the text fields page's two fields.
|
|
122
|
+
* @default 'filled'
|
|
123
|
+
*/
|
|
124
|
+
readonly variant?: FieldVariant;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A labelled multi-line input, the text fields page's filled or outlined
|
|
128
|
+
* field holding several lines. Pass `value` with `onChange` to control it, or
|
|
129
|
+
* `defaultValue` to let it keep its own; `onChange` is handed the string.
|
|
130
|
+
*
|
|
131
|
+
* It shows `rows` lines at the least and grows with what it holds, or holds
|
|
132
|
+
* at `rows` and scrolls with `autosize={false}`. The page's configurations
|
|
133
|
+
* are props: `leadingIcon` and `trailingIcon` at the box's ends, and
|
|
134
|
+
* `characterCount` opposite the supporting text, counting against
|
|
135
|
+
* `maxLength`. React Native's own `TextInput` props reach the control;
|
|
136
|
+
* `style` and `ref` are the field as a whole, and `inputRef` the control.
|
|
137
|
+
*
|
|
138
|
+
* ```tsx
|
|
139
|
+
* <TextArea label="Label" description="Supporting line" />
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
declare function TextArea({ autosize, characterCount, characterLimitLabel, defaultValue, description, error, floatingLabel, inputRef, isDisabled, isReadOnly, isRequired, label, leadingIcon, name, onBlur, onChange, onFocus, ref, rows, style, trailingIcon, validate, value, variant, ...props }: TextAreaProps): import("react").JSX.Element;
|
|
143
|
+
//#endregion
|
|
144
|
+
export { TextArea, type TextAreaProps };
|
|
145
|
+
//# sourceMappingURL=index.d.ts.map
|