@kanso-labs/react-native-kanso-ui 0.3.1 → 0.5.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/autocomplete/index.js +39 -0
- package/dist/autocomplete/index.js.map +1 -0
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.js +35 -2
- package/dist/button/index.js.map +1 -1
- package/dist/button/pending.js +1 -1
- package/dist/button/slots.d.ts +2 -0
- package/dist/button/slots.js.map +1 -1
- package/dist/chip/index.js +1 -1
- package/dist/components/autocomplete/index.d.ts +49 -0
- package/dist/components/autocomplete/index.js +87 -0
- package/dist/components/autocomplete/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +196 -150
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.js +106 -193
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip-group/index.d.ts +1 -1
- package/dist/components/chip-group/index.js +1 -1
- package/dist/components/copy-field/index.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/currency/index.d.ts +1 -1
- package/dist/components/currency/index.js +1 -1
- package/dist/components/dialog/index.d.ts +3 -2
- package/dist/components/dialog/index.js +105 -242
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +2 -2
- package/dist/components/icon-button/index.js +205 -159
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/link/index.d.ts +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.d.ts +216 -0
- package/dist/components/list/index.js +1118 -0
- package/dist/components/list/index.js.map +1 -0
- package/dist/components/list-item/index.d.ts +63 -0
- package/dist/components/list-item/index.js +275 -0
- package/dist/components/list-item/index.js.map +1 -0
- package/dist/components/menu/index.d.ts +309 -0
- package/dist/components/menu/index.js +1283 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/meter/index.d.ts +1 -1
- package/dist/components/meter/index.js +1 -1
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/index.js +2 -2
- package/dist/components/popover/index.d.ts +140 -0
- package/dist/components/popover/index.js +704 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/product-icon/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.js +1 -1
- package/dist/components/radio-group/index.d.ts +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/search-field/index.d.ts +12 -4
- package/dist/components/search-field/index.js +64 -58
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +1 -1
- package/dist/components/segmented-button/index.js +1 -1
- package/dist/components/separator/index.d.ts +1 -1
- package/dist/components/separator/index.js +1 -1
- package/dist/components/sheet/index.d.ts +137 -0
- package/dist/components/sheet/index.js +1091 -0
- package/dist/components/sheet/index.js.map +1 -0
- package/dist/components/snackbar/index.d.ts +1 -1
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/text-field/index.d.ts +1 -1
- package/dist/components/text-field/index.js +1 -1
- package/dist/control/checkbox-box.js +137 -0
- package/dist/control/checkbox-box.js.map +1 -0
- package/dist/control/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/glyphs/index.js +21 -2
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +16 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +374 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +8 -2
- package/dist/indicator/index.d.ts +1 -1
- package/dist/indicator/index.js +2 -2
- package/dist/mark/index.d.ts +1 -1
- package/dist/mark/index.js +1 -1
- package/dist/modal/index.d.ts +16 -0
- package/dist/modal/index.js +277 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/overlay/anchored.d.ts +2 -0
- package/dist/overlay/anchored.js +182 -0
- package/dist/overlay/anchored.js.map +1 -0
- package/dist/overlay/host.d.ts +2 -0
- package/dist/overlay/host.js +1 -1
- package/dist/overlay/index.d.ts +4 -0
- package/dist/overlay/panel.js +215 -0
- package/dist/overlay/panel.js.map +1 -0
- package/dist/overlay/placement.d.ts +8 -0
- package/dist/overlay/placement.js +87 -0
- package/dist/overlay/placement.js.map +1 -0
- package/dist/press/index.js +1 -1
- package/dist/ref/index.js +15 -0
- package/dist/ref/index.js.map +1 -0
- package/dist/router/index.js +1 -1
- package/dist/row/index.js +158 -0
- package/dist/row/index.js.map +1 -0
- package/dist/row/styles.js +51 -0
- package/dist/row/styles.js.map +1 -0
- package/dist/theme/scope.js +1 -1
- package/dist/theme-scope.d.ts +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/typography/fonts.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { FlatList, HostInstance, PressableProps, ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { Key, Selection, SelectionMode } from "react-stately";
|
|
4
|
+
//#region src/components/list/index.d.ts
|
|
5
|
+
type ListLoadMoreProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Draws the ring in a row of its own while more items are being fetched.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
readonly isLoading?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* What a screen reader calls the ring, and hears as it appears. Left out,
|
|
13
|
+
* it is the word for it in the device's language, "Loading more" in
|
|
14
|
+
* English.
|
|
15
|
+
*/
|
|
16
|
+
readonly label?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Called when the end of the list comes within `scrollOffset` of its
|
|
19
|
+
* visible end, while nothing is loading. Called once for each length the
|
|
20
|
+
* list reaches, so a load that adds nothing does not start another.
|
|
21
|
+
*/
|
|
22
|
+
readonly onLoadMore?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* How far past the visible end of the list the next items are asked for,
|
|
25
|
+
* as a share of the list's visible height.
|
|
26
|
+
* @default 1
|
|
27
|
+
*/
|
|
28
|
+
readonly scrollOffset?: number;
|
|
29
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
30
|
+
readonly testID?: string;
|
|
31
|
+
};
|
|
32
|
+
type ListProps<T extends object = object> = Omit<ScrollViewProps, 'children' | 'role' | 'stickyHeaderIndices' | 'style'> & {
|
|
33
|
+
/**
|
|
34
|
+
* The rows, each a `List.Item`, `List.Section` or `List.LoadMore`. With
|
|
35
|
+
* `items`, a function from an item to its part, called for each item in
|
|
36
|
+
* turn.
|
|
37
|
+
*/
|
|
38
|
+
readonly children?: ((item: T) => ReactElement) | ReactNode;
|
|
39
|
+
/** The keys selected at first, when the list keeps its own selection. */
|
|
40
|
+
readonly defaultSelectedKeys?: 'all' | Iterable<Key>;
|
|
41
|
+
/** The keys of the rows drawn disabled, which take no presses. */
|
|
42
|
+
readonly disabledKeys?: Iterable<Key>;
|
|
43
|
+
/**
|
|
44
|
+
* Keeps the last selected row selected, so a press on it changes nothing.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
readonly disallowEmptySelection?: boolean;
|
|
48
|
+
/** The entries `children` draws a part for, when it is a function. */
|
|
49
|
+
readonly items?: Iterable<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Called with a row's key when a press runs its action. A row's own
|
|
52
|
+
* `onAction` takes its place for that row.
|
|
53
|
+
*/
|
|
54
|
+
readonly onAction?: (key: Key) => void;
|
|
55
|
+
/** Called with the selected keys whenever a press changes them. */
|
|
56
|
+
readonly onSelectionChange?: (keys: Selection) => void;
|
|
57
|
+
readonly ref?: Ref<FlatList>;
|
|
58
|
+
/**
|
|
59
|
+
* What the list shows when it has no rows and nothing is loading. Left
|
|
60
|
+
* out, it is a muted row saying "No results" in the device's language, so
|
|
61
|
+
* the list keeps a row's height.
|
|
62
|
+
*/
|
|
63
|
+
readonly renderEmptyState?: () => ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* The selected keys, for a call site holding the selection itself with
|
|
66
|
+
* `onSelectionChange`.
|
|
67
|
+
*/
|
|
68
|
+
readonly selectedKeys?: 'all' | Iterable<Key>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether rows can be selected: one at a time, several, or none. A list
|
|
71
|
+
* that selects draws a checkbox on every row.
|
|
72
|
+
* @default 'none'
|
|
73
|
+
*/
|
|
74
|
+
readonly selectionMode?: SelectionMode;
|
|
75
|
+
/**
|
|
76
|
+
* What selecting a row is called, for a screen reader: the accessibility
|
|
77
|
+
* action each selectable row offers, which is what its checkbox does. The
|
|
78
|
+
* row's own text is what names the row. Left out, it is the word for it in
|
|
79
|
+
* the device's language, "Select" in English.
|
|
80
|
+
*/
|
|
81
|
+
readonly selectLabel?: string;
|
|
82
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
83
|
+
};
|
|
84
|
+
type ListRowProps = Omit<PressableProps, 'children' | 'disabled' | 'id' | 'role' | 'style'> & {
|
|
85
|
+
/** The row's headline, the one thing it is mostly about. */
|
|
86
|
+
readonly children?: ReactNode;
|
|
87
|
+
/** The key the row is selected and reported by. Give one to every row. */
|
|
88
|
+
readonly id?: Key;
|
|
89
|
+
/**
|
|
90
|
+
* Draws the row disabled, and takes no presses on it, as a key in the
|
|
91
|
+
* list's `disabledKeys` does.
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
readonly isDisabled?: boolean;
|
|
95
|
+
/** Content before the headline: an avatar, an icon. */
|
|
96
|
+
readonly leading?: ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* Called when a press runs the row's action, in place of the list's
|
|
99
|
+
* `onAction` for this row.
|
|
100
|
+
*/
|
|
101
|
+
readonly onAction?: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* A line above the headline, in label small and the muted role. Given
|
|
104
|
+
* beside `supporting`, it makes the row the three-line item.
|
|
105
|
+
*/
|
|
106
|
+
readonly overline?: ReactNode;
|
|
107
|
+
readonly ref?: Ref<HostInstance>;
|
|
108
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
109
|
+
/** A second line under the headline, in body medium and the muted role. */
|
|
110
|
+
readonly supporting?: ReactNode;
|
|
111
|
+
/**
|
|
112
|
+
* The row's text, read off `children` when they are a plain string, so a
|
|
113
|
+
* row whose headline is an element passes it.
|
|
114
|
+
*/
|
|
115
|
+
readonly textValue?: string;
|
|
116
|
+
/** Content after the headline, such as an amount or a control. */
|
|
117
|
+
readonly trailing?: ReactNode;
|
|
118
|
+
};
|
|
119
|
+
type ListSectionProps = {
|
|
120
|
+
/** The rows in the section. */
|
|
121
|
+
readonly children?: ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* The section's heading, which stays at the top of the list while the
|
|
124
|
+
* section's rows scroll under it. A section without one is its rows alone.
|
|
125
|
+
*/
|
|
126
|
+
readonly header?: ReactNode;
|
|
127
|
+
readonly id?: Key;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* A list of rows, one or more of which can be selected. Selection is React
|
|
131
|
+
* Stately's, as web's is React Aria's: set `selectionMode` to `single` or
|
|
132
|
+
* `multiple`, and pass `selectedKeys` with `onSelectionChange` to control
|
|
133
|
+
* it or `defaultSelectedKeys` to let it keep its own. A list whose rows do
|
|
134
|
+
* something takes `onAction`, or an `onAction` on each row.
|
|
135
|
+
*
|
|
136
|
+
* ```tsx
|
|
137
|
+
* <List aria-label="Label" selectionMode="multiple">
|
|
138
|
+
* <List.Item id="first" supporting="Supporting line">First item</List.Item>
|
|
139
|
+
* </List>
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* ListItem is the row on its own; this is the collection that draws the
|
|
143
|
+
* same row and adds selection, sections and a row that loads more. Composed
|
|
144
|
+
* from parts, `List.Item`, `List.Section` and `List.LoadMore`, which the
|
|
145
|
+
* list draws from their props, so none of them renders anything on its
|
|
146
|
+
* own. Name the list with `aria-label`. It scrolls by itself, so it wants a
|
|
147
|
+
* height to fill: a short list on a page that scrolls takes
|
|
148
|
+
* `scrollEnabled={false}` and is laid out at its full length. `style` and
|
|
149
|
+
* `ref` land on the `FlatList`.
|
|
150
|
+
*
|
|
151
|
+
* Inside an `Autocomplete`, the list shows the rows the search keeps and
|
|
152
|
+
* says how many there are to a screen reader, and a tap on a row reaches it
|
|
153
|
+
* while the keyboard is up.
|
|
154
|
+
*/
|
|
155
|
+
declare function List<T extends object = object>({ children, contentContainerStyle, defaultSelectedKeys, disabledKeys, disallowEmptySelection, items, keyboardShouldPersistTaps, onAction, onSelectionChange, ref, renderEmptyState, selectedKeys, selectionMode, selectLabel, style, ...props }: ListProps<T>): import("react").JSX.Element;
|
|
156
|
+
declare namespace List {
|
|
157
|
+
var Item: typeof ListRow;
|
|
158
|
+
var LoadMore: typeof ListLoadMore;
|
|
159
|
+
var Section: typeof ListSection;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The row shown while more items are being fetched. `onLoadMore` is called
|
|
163
|
+
* as the reader nears the end of the list, and the ring is drawn only while
|
|
164
|
+
* `isLoading`, in a live region, so a screen reader hears it arrive. It
|
|
165
|
+
* goes last, after the rows it loads more of.
|
|
166
|
+
*/
|
|
167
|
+
declare function ListLoadMore(_props: ListLoadMoreProps): null;
|
|
168
|
+
declare namespace ListLoadMore {
|
|
169
|
+
var getCollectionNode: (props: ListLoadMoreProps) => Generator<{
|
|
170
|
+
hasChildNodes: boolean;
|
|
171
|
+
props: ListLoadMoreProps;
|
|
172
|
+
rendered: null;
|
|
173
|
+
type: string;
|
|
174
|
+
}, void, unknown>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* One row. Its slots are ListItem's: `leading`, the headline as children,
|
|
178
|
+
* `overline` above it, `supporting` under it, and `trailing`. Give every
|
|
179
|
+
* row an `id`, which is the key selection is reported by. A list that
|
|
180
|
+
* selects draws a checkbox before whatever `leading` holds.
|
|
181
|
+
*
|
|
182
|
+
* The list draws it from its entry in the collection, so it renders nothing
|
|
183
|
+
* on its own. `style`, `ref` and `testID` land on the row.
|
|
184
|
+
*/
|
|
185
|
+
declare function ListRow(_props: ListRowProps): null;
|
|
186
|
+
declare namespace ListRow {
|
|
187
|
+
var getCollectionNode: (props: ListRowProps) => Generator<{
|
|
188
|
+
'aria-label': string | undefined;
|
|
189
|
+
hasChildNodes: boolean;
|
|
190
|
+
key: Key | undefined;
|
|
191
|
+
props: ListRowProps;
|
|
192
|
+
rendered: ReactNode;
|
|
193
|
+
textValue: string;
|
|
194
|
+
type: string;
|
|
195
|
+
}, void, unknown>;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* A group of rows under a heading, which stays at the top of the list while
|
|
199
|
+
* the group's rows scroll under it.
|
|
200
|
+
*/
|
|
201
|
+
declare function ListSection(_props: ListSectionProps): null;
|
|
202
|
+
declare namespace ListSection {
|
|
203
|
+
var getCollectionNode: (props: ListSectionProps) => Generator<{
|
|
204
|
+
childNodes(): Generator<{
|
|
205
|
+
element: ReactNode;
|
|
206
|
+
}, void, unknown>;
|
|
207
|
+
hasChildNodes: boolean;
|
|
208
|
+
key: Key | undefined;
|
|
209
|
+
props: ListSectionProps;
|
|
210
|
+
rendered: ReactNode;
|
|
211
|
+
type: string;
|
|
212
|
+
}, void, unknown>;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
export { List, ListLoadMore, type ListLoadMoreProps, type ListProps, ListRow, type ListRowProps, ListSection, type ListSectionProps };
|
|
216
|
+
//# sourceMappingURL=index.d.ts.map
|