panelui-native 0.36.0 → 0.40.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 +13 -1
- package/lib/module/components/combobox/index.js +718 -0
- package/lib/module/components/combobox/index.js.map +1 -0
- package/lib/module/components/form/use-field.js +18 -0
- package/lib/module/components/form/use-field.js.map +1 -1
- package/lib/module/components/form/use-form.js +91 -8
- package/lib/module/components/form/use-form.js.map +1 -1
- package/lib/module/components/heatmap-chart/index.js +113 -6
- package/lib/module/components/heatmap-chart/index.js.map +1 -1
- package/lib/module/components/input/index.js +10 -3
- package/lib/module/components/input/index.js.map +1 -1
- package/lib/module/components/pagination/index.js +519 -0
- package/lib/module/components/pagination/index.js.map +1 -0
- package/lib/module/components/ring-chart/index.js +183 -45
- package/lib/module/components/ring-chart/index.js.map +1 -1
- package/lib/module/components/select/index.js +116 -15
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/steps/index.js +8 -6
- package/lib/module/components/steps/index.js.map +1 -1
- package/lib/module/components/table/index.js +100 -26
- package/lib/module/components/table/index.js.map +1 -1
- package/lib/module/components/timeline/index.js +8 -7
- package/lib/module/components/timeline/index.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/use-theme.js +1 -1
- package/lib/typescript/src/components/combobox/index.d.ts +164 -0
- package/lib/typescript/src/components/combobox/index.d.ts.map +1 -0
- package/lib/typescript/src/components/form/use-field.d.ts.map +1 -1
- package/lib/typescript/src/components/form/use-form.d.ts.map +1 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts +51 -3
- package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input/index.d.ts +18 -4
- package/lib/typescript/src/components/input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/pagination/index.d.ts +285 -0
- package/lib/typescript/src/components/pagination/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ring-chart/index.d.ts +75 -8
- package/lib/typescript/src/components/ring-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/select/index.d.ts +32 -0
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/steps/index.d.ts +8 -6
- package/lib/typescript/src/components/steps/index.d.ts.map +1 -1
- package/lib/typescript/src/components/table/index.d.ts +59 -17
- package/lib/typescript/src/components/table/index.d.ts.map +1 -1
- package/lib/typescript/src/components/timeline/index.d.ts +8 -7
- package/lib/typescript/src/components/timeline/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/use-theme.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/combobox/index.tsx +927 -0
- package/src/components/form/use-field.ts +23 -0
- package/src/components/form/use-form.ts +106 -16
- package/src/components/heatmap-chart/index.tsx +147 -5
- package/src/components/input/index.tsx +21 -7
- package/src/components/pagination/index.tsx +591 -0
- package/src/components/ring-chart/index.tsx +269 -47
- package/src/components/select/index.tsx +114 -15
- package/src/components/steps/index.tsx +8 -6
- package/src/components/table/index.tsx +146 -30
- package/src/components/timeline/index.tsx +8 -7
- package/src/index.ts +25 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combobox — a text field that filters a list of options as you type.
|
|
3
|
+
*
|
|
4
|
+
* The difference from Select is where the typing happens, and it is not a
|
|
5
|
+
* detail: a Select is a button that opens a list, and its optional filter lives
|
|
6
|
+
* *inside* the list once it is open. A Combobox is the field itself. You are
|
|
7
|
+
* already typing when the options appear, which is what you want when the value
|
|
8
|
+
* is something you know the name of — a city, a repository, a tag — rather than
|
|
9
|
+
* something you expect to recognise by scrolling.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Combobox value={framework} onValueChange={setFramework}>
|
|
13
|
+
* <Combobox.Item value="expo" label="Expo" />
|
|
14
|
+
* <Combobox.Item value="next" label="Next.js" />
|
|
15
|
+
* </Combobox>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* ## Two presentations, and why there is no sheet
|
|
19
|
+
*
|
|
20
|
+
* `overlay` (default) floats the list above the page through a portal, anchored
|
|
21
|
+
* under the field and flipped above it when the keyboard leaves no room below.
|
|
22
|
+
* `inline` expands the list in normal layout flow instead, which is right in a
|
|
23
|
+
* form where nothing should be covered.
|
|
24
|
+
*
|
|
25
|
+
* There is deliberately no sheet presentation. A sheet takes the bottom of the
|
|
26
|
+
* screen, which is exactly where the keyboard is, and the field you are typing
|
|
27
|
+
* into would end up behind one or the other. Select can offer a sheet because
|
|
28
|
+
* its trigger stops mattering once the list is open; a Combobox's never does.
|
|
29
|
+
*
|
|
30
|
+
* ## Filtering is yours to turn off
|
|
31
|
+
*
|
|
32
|
+
* Filtering happens here by default, matching case-insensitively on any part of
|
|
33
|
+
* an option's label. That is the whole feature for a list you already have in
|
|
34
|
+
* hand. When the options come from a server that is doing the matching itself,
|
|
35
|
+
* pass `filter={false}` and render whatever came back — the field stops second-
|
|
36
|
+
* guessing results it cannot see the query behind.
|
|
37
|
+
*
|
|
38
|
+
* ## Values it does not know about
|
|
39
|
+
*
|
|
40
|
+
* `allowCustomValue` lets the typed text become the value when it matches no
|
|
41
|
+
* option, which is how a tag field works: the list is a set of suggestions
|
|
42
|
+
* rather than the set of legal answers.
|
|
43
|
+
*/
|
|
44
|
+
import { type ReactNode } from 'react';
|
|
45
|
+
import { type ViewProps } from 'react-native';
|
|
46
|
+
export type ComboboxPresentation = 'overlay' | 'inline';
|
|
47
|
+
/** Which selection shape a `mode` produces. */
|
|
48
|
+
export type ComboboxMode = 'single' | 'multiple';
|
|
49
|
+
export interface ComboboxSelection {
|
|
50
|
+
single: string | undefined;
|
|
51
|
+
multiple: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface ComboboxItemProps {
|
|
54
|
+
value: string;
|
|
55
|
+
label: string;
|
|
56
|
+
/**
|
|
57
|
+
* Shows the option but refuses it. Kept in the list rather than dropped from
|
|
58
|
+
* it, because an option that vanishes reads as one that never existed.
|
|
59
|
+
*/
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
/** Anything to draw before the label — an avatar, a flag, a status dot. */
|
|
62
|
+
start?: ReactNode;
|
|
63
|
+
/** A second line under the label, for what the label alone cannot say. */
|
|
64
|
+
description?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Declarative option. Rendered inside whichever surface is presenting. */
|
|
67
|
+
declare function ComboboxItem({ value, label, disabled, start, description, }: ComboboxItemProps): import("react").JSX.Element;
|
|
68
|
+
declare namespace ComboboxItem {
|
|
69
|
+
var displayName: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ComboboxGroupProps {
|
|
72
|
+
/**
|
|
73
|
+
* Heading over the run of options. Announced as a header, so a screen reader
|
|
74
|
+
* reaching the group is told what it is before walking into it.
|
|
75
|
+
*/
|
|
76
|
+
label?: string;
|
|
77
|
+
/** Extra classes for the group wrapper. */
|
|
78
|
+
className?: string;
|
|
79
|
+
/** Extra classes for the heading. */
|
|
80
|
+
labelClassName?: string;
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A titled run of options.
|
|
85
|
+
*
|
|
86
|
+
* Presentational only: a grouped Combobox reports the same values a flat one
|
|
87
|
+
* would, and `Combobox.Item` needs to know nothing about being inside one.
|
|
88
|
+
*/
|
|
89
|
+
declare function ComboboxGroup({ label, className, labelClassName, children, }: ComboboxGroupProps): import("react").JSX.Element;
|
|
90
|
+
declare namespace ComboboxGroup {
|
|
91
|
+
var displayName: string;
|
|
92
|
+
}
|
|
93
|
+
export interface ComboboxProps<Mode extends ComboboxMode = 'single'> extends Omit<ViewProps, 'children' | 'onLayout'> {
|
|
94
|
+
className?: string;
|
|
95
|
+
/**
|
|
96
|
+
* One value or several. `multiple` draws the chosen options as removable
|
|
97
|
+
* chips in front of the input and keeps the list open between picks.
|
|
98
|
+
*/
|
|
99
|
+
mode?: Mode;
|
|
100
|
+
/** Controlled selection. Its shape follows `mode`. */
|
|
101
|
+
value?: ComboboxSelection[Mode];
|
|
102
|
+
/** Starting selection when uncontrolled. */
|
|
103
|
+
defaultValue?: ComboboxSelection[Mode];
|
|
104
|
+
onValueChange?: (value: ComboboxSelection[Mode]) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Controlled query — the text actually in the field. Pair it with
|
|
107
|
+
* `onInputValueChange` when the options are fetched for it.
|
|
108
|
+
*/
|
|
109
|
+
inputValue?: string;
|
|
110
|
+
/** Starting query when uncontrolled. */
|
|
111
|
+
defaultInputValue?: string;
|
|
112
|
+
onInputValueChange?: (value: string) => void;
|
|
113
|
+
placeholder?: string;
|
|
114
|
+
disabled?: boolean;
|
|
115
|
+
/** Where the options appear. */
|
|
116
|
+
presentation?: ComboboxPresentation;
|
|
117
|
+
/**
|
|
118
|
+
* Narrow the options to the query here. `true` matches case-insensitively on
|
|
119
|
+
* any part of an option's label; pass a function to match on something else —
|
|
120
|
+
* a description, an alias list, an initialism.
|
|
121
|
+
*
|
|
122
|
+
* Pass `false` when a server is doing the matching: the options you render
|
|
123
|
+
* are then shown exactly as given, since a second filter over results the
|
|
124
|
+
* field cannot see the query behind would only remove correct answers.
|
|
125
|
+
*/
|
|
126
|
+
filter?: boolean | ((option: ComboboxItemProps, query: string) => boolean);
|
|
127
|
+
/**
|
|
128
|
+
* Let the typed text become the value when it matches no option, committed on
|
|
129
|
+
* submit. Turns the list into a set of suggestions rather than the set of
|
|
130
|
+
* legal answers — which is what a tag field is.
|
|
131
|
+
*/
|
|
132
|
+
allowCustomValue?: boolean;
|
|
133
|
+
/** Show a spinner in place of the list. For options still being fetched. */
|
|
134
|
+
loading?: boolean;
|
|
135
|
+
/** Shown in place of the list when nothing matches. */
|
|
136
|
+
emptyMessage?: string;
|
|
137
|
+
/** Shown in place of the list while `loading`. */
|
|
138
|
+
loadingMessage?: string;
|
|
139
|
+
/** Offer a ✕ that clears the query and the selection. */
|
|
140
|
+
clearable?: boolean;
|
|
141
|
+
/** Open the list as soon as the field takes focus, before anything is typed. */
|
|
142
|
+
openOnFocus?: boolean;
|
|
143
|
+
/** Called when the list opens or closes. */
|
|
144
|
+
onOpenChange?: (open: boolean) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Width of the floating list. `field` matches the field, `content` sizes to
|
|
147
|
+
* the longest option, or pass a pixel value. `overlay` only.
|
|
148
|
+
*/
|
|
149
|
+
contentWidth?: 'field' | 'content' | number;
|
|
150
|
+
/** Gap between the field and the floating list. `overlay` only. */
|
|
151
|
+
offset?: number;
|
|
152
|
+
/** Extra classes for the list surface. */
|
|
153
|
+
listClassName?: string;
|
|
154
|
+
/** Accessible name for the field. */
|
|
155
|
+
accessibilityLabel?: string;
|
|
156
|
+
children: ReactNode;
|
|
157
|
+
}
|
|
158
|
+
declare function ComboboxRoot<Mode extends ComboboxMode = 'single'>({ className, mode, value, defaultValue, onValueChange, inputValue, defaultInputValue, onInputValueChange, placeholder, disabled, presentation, filter, allowCustomValue, loading, emptyMessage, loadingMessage, clearable, openOnFocus, onOpenChange, contentWidth, offset, listClassName, accessibilityLabel, children, ...props }: ComboboxProps<Mode>): import("react").JSX.Element;
|
|
159
|
+
export declare const Combobox: typeof ComboboxRoot & {
|
|
160
|
+
Item: typeof ComboboxItem;
|
|
161
|
+
Group: typeof ComboboxGroup;
|
|
162
|
+
};
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/combobox/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAYL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAsEtB,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,QAA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MAAM,CAAC,EACvE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,CAAC,EACP,EAAE,QAAQ,EAAE,UAAmB,EAAE,GAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAM,GAC5D,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"use-field.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/use-field.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAY,CAAC;AAErD,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC;IACT,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC;IAC/E,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAChC;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EACvE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,CAAC,EACP,EAAE,QAAQ,EAAE,UAAmB,EAAE,GAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAM,GAC5D,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAuD5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/use-form.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/use-form.ts"],"names":[],"mappings":"AAmCA,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9D,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAEhE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CACxE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EACX,MAAM,EAAE,CAAC,KACN,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,aAAa,EAAE,CAAC,CAAC;IACjB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD,MAAM,EAAE,CAAC,CAAC;IACV,MAAM,EAAE,WAAW,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Q,GACT,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA0KhC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* ```tsx
|
|
13
13
|
* <HeatmapChart data={weeks}>
|
|
14
|
+
* <HeatmapChart.Header title="Contributions" value="1,204" legend />
|
|
14
15
|
* <HeatmapChart.YAxis />
|
|
15
16
|
* <HeatmapChart.XAxis />
|
|
16
17
|
* <HeatmapChart.Cells />
|
|
@@ -41,7 +42,7 @@ import { View, type ViewProps } from 'react-native';
|
|
|
41
42
|
* composition stays a flat list of children instead of four nested slots the
|
|
42
43
|
* caller has to remember the order of.
|
|
43
44
|
*/
|
|
44
|
-
type Slot = 'cells' | 'x-axis' | 'y-axis' | 'rules' | 'tooltip' | 'legend';
|
|
45
|
+
type Slot = 'cells' | 'x-axis' | 'y-axis' | 'rules' | 'tooltip' | 'legend' | 'header';
|
|
45
46
|
export type HeatmapLayout = 'fluid' | 'fill';
|
|
46
47
|
/** One bin inside a column — usually a single day. */
|
|
47
48
|
export interface HeatmapBin {
|
|
@@ -193,15 +194,22 @@ export interface HeatmapXAxisProps {
|
|
|
193
194
|
* derived. Return an empty string to leave the column unlabelled.
|
|
194
195
|
*/
|
|
195
196
|
formatLabel?: (date: Date, column: number) => string;
|
|
197
|
+
/**
|
|
198
|
+
* Column labels, left to right. Overrides the month names — for a grid whose
|
|
199
|
+
* columns are not weeks, where there is no month to change and so nothing to
|
|
200
|
+
* emit a label on.
|
|
201
|
+
*/
|
|
202
|
+
labels?: string[];
|
|
196
203
|
}
|
|
197
204
|
/**
|
|
198
205
|
* Month labels above the grid.
|
|
199
206
|
*
|
|
200
207
|
* A label is emitted where the month changes rather than at a fixed interval,
|
|
201
208
|
* because months are not the same length — spacing them evenly puts "Mar" over
|
|
202
|
-
* a week in February.
|
|
209
|
+
* a week in February. A grid whose columns are not weeks has no such signal, so
|
|
210
|
+
* it passes `labels` and gets one over every column.
|
|
203
211
|
*/
|
|
204
|
-
declare function HeatmapXAxis({ className, formatLabel }: HeatmapXAxisProps): import("react").JSX.Element;
|
|
212
|
+
declare function HeatmapXAxis({ className, formatLabel, labels: given }: HeatmapXAxisProps): import("react").JSX.Element;
|
|
205
213
|
declare namespace HeatmapXAxis {
|
|
206
214
|
var slot: Slot;
|
|
207
215
|
}
|
|
@@ -267,7 +275,47 @@ declare function HeatmapLegend({ className, lessLabel, moreLabel, swatchSize, }:
|
|
|
267
275
|
declare namespace HeatmapLegend {
|
|
268
276
|
var slot: Slot;
|
|
269
277
|
}
|
|
278
|
+
export interface HeatmapHeaderProps extends ViewProps {
|
|
279
|
+
className?: string;
|
|
280
|
+
/** Small line above the value — what the grid is of. */
|
|
281
|
+
title?: string;
|
|
282
|
+
/** The readout. The largest thing on the card, and the first thing read. */
|
|
283
|
+
value?: string;
|
|
284
|
+
/** One muted line under the value — a period, a total, the held cell. */
|
|
285
|
+
caption?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Draw the ramp along the trailing edge, `Less ▢▢▢▢▢ More`. The key for a
|
|
288
|
+
* grid that scrolls sideways, where `HeatmapChart.Legend` under the cells
|
|
289
|
+
* would scroll away with them.
|
|
290
|
+
*/
|
|
291
|
+
legend?: boolean;
|
|
292
|
+
/** Text at the low end of the ramp, when `legend` is set. */
|
|
293
|
+
lessLabel?: string;
|
|
294
|
+
/** Text at the high end. */
|
|
295
|
+
moreLabel?: string;
|
|
296
|
+
/** Trailing slot — a control, a badge, a range picker. Wins over `legend`. */
|
|
297
|
+
children?: ReactNode;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The strip above the grid: what the chart is of, what it currently reads, and
|
|
301
|
+
* what the shading means.
|
|
302
|
+
*
|
|
303
|
+
* It belongs to the chart rather than to the card around it because it is about
|
|
304
|
+
* the *grid* — the number changes as a finger moves across the cells, and the
|
|
305
|
+
* ramp is the scale the chart itself derived. The card's header is a caption on
|
|
306
|
+
* the tray the chart sits in; this is the chart introducing itself.
|
|
307
|
+
*
|
|
308
|
+
* The value is not derived here. Take it from `onActiveCellChange` and pass the
|
|
309
|
+
* formatted string down, so one header can show a total when nothing is held
|
|
310
|
+
* and a day's own count when something is.
|
|
311
|
+
*/
|
|
312
|
+
declare function HeatmapHeader({ className, title, value, caption, legend, lessLabel, moreLabel, children, ...props }: HeatmapHeaderProps): import("react").JSX.Element;
|
|
313
|
+
declare namespace HeatmapHeader {
|
|
314
|
+
var displayName: string;
|
|
315
|
+
var slot: Slot;
|
|
316
|
+
}
|
|
270
317
|
export declare const HeatmapChart: import("react").ForwardRefExoticComponent<HeatmapChartProps & import("react").RefAttributes<View>> & {
|
|
318
|
+
Header: typeof HeatmapHeader;
|
|
271
319
|
Cells: typeof HeatmapCells;
|
|
272
320
|
Separator: typeof HeatmapSeparator;
|
|
273
321
|
XAxis: typeof HeatmapXAxis;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/heatmap-chart/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/heatmap-chart/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAUL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,IAAI,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAiFxF;;;;GAIG;AACH,KAAK,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,KAAK,EAAE,MAAM,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,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAc,EACd,SAAkB,EAClB,SAAkB,EAClB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,+BA2DpB;kBArEQ,aAAa;;;;AAyEtB,eAAO,MAAM,YAAY;;;;;;;;CAQvB,CAAC"}
|
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
* field, so anything centred on the component as a whole drifts upward the
|
|
28
28
|
* moment a label is added.
|
|
29
29
|
*
|
|
30
|
+
* Both are pressable. A button dropped in there — a clear ✕, a show-password
|
|
31
|
+
* eye — gets its own touches, while the padding around it stays transparent so
|
|
32
|
+
* a tap that misses still lands on the field and puts the caret in it. An icon
|
|
33
|
+
* that is only decoration should say so with `interactiveContent={false}`,
|
|
34
|
+
* which gives the whole field back to the caret and takes the icon out of the
|
|
35
|
+
* accessibility tree.
|
|
36
|
+
*
|
|
30
37
|
* `InputGroup` is still the right answer for a decorator that is not part of
|
|
31
38
|
* the field — a button attached to its end, a select bolted to its start, an
|
|
32
39
|
* addon with its own background. It measures the same way; it just spans a
|
|
@@ -203,11 +210,18 @@ export interface InputProps extends TextInputProps, Omit<InputVariantProps, 'dis
|
|
|
203
210
|
/** Content inside the field, after the text — an icon, a unit, a count. */
|
|
204
211
|
endContent?: ReactNode;
|
|
205
212
|
/**
|
|
206
|
-
*
|
|
213
|
+
* Whether touches reach the content.
|
|
214
|
+
*
|
|
215
|
+
* On by default, so a button placed in the field — a clear ✕, a
|
|
216
|
+
* show-password eye, a unit picker — is pressable without anything else
|
|
217
|
+
* being passed. Only the content itself takes those touches: the padding
|
|
218
|
+
* around it is transparent, so a tap that misses the button still lands on
|
|
219
|
+
* the field and puts the caret in it.
|
|
207
220
|
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* content
|
|
221
|
+
* Turn it off for pure decoration, where the icon should not be a target at
|
|
222
|
+
* all and every pixel of the field should focus it. That also drops the
|
|
223
|
+
* content from the accessibility tree, which is right for an icon that only
|
|
224
|
+
* restates the label.
|
|
211
225
|
*/
|
|
212
226
|
interactiveContent?: boolean;
|
|
213
227
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,EACL,SAAS,EAGT,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAoC,CAAC;AAShF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAwEjB,CAAC;AAEH,KAAK,iBAAiB,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5D,MAAM,WAAW,UACf,SAAQ,cAAc,EACpB,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID,eAAO,MAAM,KAAK,kGA2NjB,CAAC"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination — moving through a result set one page at a time.
|
|
3
|
+
*
|
|
4
|
+
* The component owns the arithmetic and nothing else. Give it how many pages
|
|
5
|
+
* there are and which one you are on, and it works out which numbers to show,
|
|
6
|
+
* where the gaps fall, and which controls are dead at the ends; it never fetches
|
|
7
|
+
* and never slices, because the data is yours.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Pagination count={12} page={page} onPageChange={setPage} />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Three presentations, because a phone is not a desktop:
|
|
14
|
+
*
|
|
15
|
+
* - `numbers` — the full run, with the middle folded into ellipses. Fits about
|
|
16
|
+
* seven targets across a phone, which is what `siblings` and `boundaries`
|
|
17
|
+
* are tuned for.
|
|
18
|
+
* - `compact` — the two arrows with `3 / 12` between them. Digits and a slash,
|
|
19
|
+
* so there is no sentence to translate.
|
|
20
|
+
* - `simple` — labelled Previous and Next, for a flow you walk rather than
|
|
21
|
+
* jump around in: a wizard, an article, a set of onboarding cards.
|
|
22
|
+
*
|
|
23
|
+
* Every target is at least 44pt in both axes, and the small size keeps that
|
|
24
|
+
* reach with `hitSlop` rather than by growing — the row gets denser, the
|
|
25
|
+
* fingers do not get smaller.
|
|
26
|
+
*
|
|
27
|
+
* An ellipsis is a button, not punctuation. A dead 44pt target in the middle of
|
|
28
|
+
* a row of live ones is a thing people tap and then think is broken, so tapping
|
|
29
|
+
* one jumps `pageJump` pages that way.
|
|
30
|
+
*
|
|
31
|
+
* Given children, the root becomes a row with them on the leading edge and the
|
|
32
|
+
* controls on the trailing one — which is where `Pagination.Status` goes:
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <Pagination count={12} page={page} onPageChange={setPage} variant="compact">
|
|
36
|
+
* <Pagination.Status page={page} pageSize={20} total={240} />
|
|
37
|
+
* </Pagination>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
import { type ReactNode } from 'react';
|
|
41
|
+
import { View, type ViewProps } from 'react-native';
|
|
42
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
43
|
+
import { type AnimatedPressableProps } from '../../primitives/animated-pressable.js';
|
|
44
|
+
import { type TextProps } from '../../primitives/text.js';
|
|
45
|
+
export type PaginationVariant = 'numbers' | 'compact' | 'simple';
|
|
46
|
+
export type PaginationSize = 'sm' | 'default';
|
|
47
|
+
declare const paginationVariants: import("tailwind-variants").TVReturnType<{
|
|
48
|
+
size: {
|
|
49
|
+
default: {
|
|
50
|
+
list: string;
|
|
51
|
+
item: string;
|
|
52
|
+
itemLabel: string;
|
|
53
|
+
ellipsis: string;
|
|
54
|
+
status: string;
|
|
55
|
+
summary: string;
|
|
56
|
+
};
|
|
57
|
+
sm: {
|
|
58
|
+
list: string;
|
|
59
|
+
item: string;
|
|
60
|
+
itemLabel: string;
|
|
61
|
+
ellipsis: string;
|
|
62
|
+
status: string;
|
|
63
|
+
summary: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** Whether the item is the page you are on. */
|
|
67
|
+
current: {
|
|
68
|
+
true: {
|
|
69
|
+
item: string;
|
|
70
|
+
itemLabel: string;
|
|
71
|
+
};
|
|
72
|
+
false: {
|
|
73
|
+
itemLabel: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
disabled: {
|
|
77
|
+
true: {
|
|
78
|
+
item: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}, {
|
|
82
|
+
root: string;
|
|
83
|
+
list: string;
|
|
84
|
+
item: string;
|
|
85
|
+
itemLabel: string;
|
|
86
|
+
ellipsis: string;
|
|
87
|
+
status: string;
|
|
88
|
+
summary: string;
|
|
89
|
+
}, undefined, {
|
|
90
|
+
size: {
|
|
91
|
+
default: {
|
|
92
|
+
list: string;
|
|
93
|
+
item: string;
|
|
94
|
+
itemLabel: string;
|
|
95
|
+
ellipsis: string;
|
|
96
|
+
status: string;
|
|
97
|
+
summary: string;
|
|
98
|
+
};
|
|
99
|
+
sm: {
|
|
100
|
+
list: string;
|
|
101
|
+
item: string;
|
|
102
|
+
itemLabel: string;
|
|
103
|
+
ellipsis: string;
|
|
104
|
+
status: string;
|
|
105
|
+
summary: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
/** Whether the item is the page you are on. */
|
|
109
|
+
current: {
|
|
110
|
+
true: {
|
|
111
|
+
item: string;
|
|
112
|
+
itemLabel: string;
|
|
113
|
+
};
|
|
114
|
+
false: {
|
|
115
|
+
itemLabel: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
disabled: {
|
|
119
|
+
true: {
|
|
120
|
+
item: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
root: string;
|
|
125
|
+
list: string;
|
|
126
|
+
item: string;
|
|
127
|
+
itemLabel: string;
|
|
128
|
+
ellipsis: string;
|
|
129
|
+
status: string;
|
|
130
|
+
summary: string;
|
|
131
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
132
|
+
size: {
|
|
133
|
+
default: {
|
|
134
|
+
list: string;
|
|
135
|
+
item: string;
|
|
136
|
+
itemLabel: string;
|
|
137
|
+
ellipsis: string;
|
|
138
|
+
status: string;
|
|
139
|
+
summary: string;
|
|
140
|
+
};
|
|
141
|
+
sm: {
|
|
142
|
+
list: string;
|
|
143
|
+
item: string;
|
|
144
|
+
itemLabel: string;
|
|
145
|
+
ellipsis: string;
|
|
146
|
+
status: string;
|
|
147
|
+
summary: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
/** Whether the item is the page you are on. */
|
|
151
|
+
current: {
|
|
152
|
+
true: {
|
|
153
|
+
item: string;
|
|
154
|
+
itemLabel: string;
|
|
155
|
+
};
|
|
156
|
+
false: {
|
|
157
|
+
itemLabel: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
disabled: {
|
|
161
|
+
true: {
|
|
162
|
+
item: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
}, {
|
|
166
|
+
root: string;
|
|
167
|
+
list: string;
|
|
168
|
+
item: string;
|
|
169
|
+
itemLabel: string;
|
|
170
|
+
ellipsis: string;
|
|
171
|
+
status: string;
|
|
172
|
+
summary: string;
|
|
173
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
174
|
+
export type PaginationItemValue = number | 'start-ellipsis' | 'end-ellipsis';
|
|
175
|
+
/**
|
|
176
|
+
* Which numbers to draw, and where the gaps go.
|
|
177
|
+
*
|
|
178
|
+
* The run is a fixed width rather than a sliding window: the same number of
|
|
179
|
+
* targets whichever page you are on, so the row does not reflow under the
|
|
180
|
+
* finger as you step through it and the arrow you were aiming at stays put.
|
|
181
|
+
* `boundaries` pins the ends, `siblings` pads the middle, and a gap of exactly
|
|
182
|
+
* one page is drawn as that page instead of an ellipsis — a `…` that hides a
|
|
183
|
+
* single number is longer than the number.
|
|
184
|
+
*
|
|
185
|
+
* Exported because a caller sometimes needs the same run for a control of their
|
|
186
|
+
* own, and two implementations of this would drift.
|
|
187
|
+
*/
|
|
188
|
+
export declare function paginationRange({ count, page, siblings, boundaries, }: {
|
|
189
|
+
count: number;
|
|
190
|
+
page: number;
|
|
191
|
+
siblings?: number;
|
|
192
|
+
boundaries?: number;
|
|
193
|
+
}): PaginationItemValue[];
|
|
194
|
+
export interface PaginationProps extends Omit<ViewProps, 'children'>, VariantProps<typeof paginationVariants> {
|
|
195
|
+
className?: string;
|
|
196
|
+
/**
|
|
197
|
+
* How many pages there are. Pages are numbered from 1, so this is also the
|
|
198
|
+
* last page's number.
|
|
199
|
+
*/
|
|
200
|
+
count: number;
|
|
201
|
+
/** The page being shown. Pass it to control the component. */
|
|
202
|
+
page?: number;
|
|
203
|
+
/** The page to start on when the component keeps its own. Defaults to 1. */
|
|
204
|
+
defaultPage?: number;
|
|
205
|
+
/** Called with the page that was asked for, already clamped to `count`. */
|
|
206
|
+
onPageChange?: (page: number) => void;
|
|
207
|
+
/** Which presentation to draw. */
|
|
208
|
+
variant?: PaginationVariant;
|
|
209
|
+
size?: PaginationSize;
|
|
210
|
+
/**
|
|
211
|
+
* How many pages to keep either side of the current one. Raise it on a
|
|
212
|
+
* tablet, where there is room for a longer run.
|
|
213
|
+
*/
|
|
214
|
+
siblings?: number;
|
|
215
|
+
/** How many pages to keep pinned at each end of the run. */
|
|
216
|
+
boundaries?: number;
|
|
217
|
+
/**
|
|
218
|
+
* Show the previous and next arrows. Turning them off leaves the numbers
|
|
219
|
+
* alone, so only do it where something else moves the page — a swipe, a
|
|
220
|
+
* scroller reaching its end.
|
|
221
|
+
*/
|
|
222
|
+
controls?: boolean;
|
|
223
|
+
/** How far tapping an ellipsis jumps. */
|
|
224
|
+
pageJump?: number;
|
|
225
|
+
/** Greys out and deafens the whole row — for a page that is still loading. */
|
|
226
|
+
disabled?: boolean;
|
|
227
|
+
/** Labels the row for a screen reader. Defaults to "Pagination". */
|
|
228
|
+
accessibilityLabel?: string;
|
|
229
|
+
/** Leading content — a `Pagination.Status`, a page-size control of your own. */
|
|
230
|
+
children?: ReactNode;
|
|
231
|
+
}
|
|
232
|
+
export interface PaginationItemProps extends Omit<AnimatedPressableProps, 'children' | 'disabled'> {
|
|
233
|
+
className?: string;
|
|
234
|
+
/** The page this target goes to. */
|
|
235
|
+
page: number;
|
|
236
|
+
/** Styles the number. */
|
|
237
|
+
labelClassName?: string;
|
|
238
|
+
children?: ReactNode;
|
|
239
|
+
}
|
|
240
|
+
export interface PaginationPreviousProps extends Omit<AnimatedPressableProps, 'children'> {
|
|
241
|
+
className?: string;
|
|
242
|
+
/** Write the word beside the arrow, rather than leaving it as a glyph. */
|
|
243
|
+
label?: boolean;
|
|
244
|
+
}
|
|
245
|
+
export interface PaginationNextProps extends Omit<AnimatedPressableProps, 'children'> {
|
|
246
|
+
className?: string;
|
|
247
|
+
/** Write the word beside the arrow, rather than leaving it as a glyph. */
|
|
248
|
+
label?: boolean;
|
|
249
|
+
}
|
|
250
|
+
export interface PaginationEllipsisProps extends Omit<AnimatedPressableProps, 'children'> {
|
|
251
|
+
className?: string;
|
|
252
|
+
/** Which way the gap runs: `-1` towards page 1, `1` towards the last page. */
|
|
253
|
+
direction?: -1 | 1;
|
|
254
|
+
/** How many pages a tap covers. */
|
|
255
|
+
jump?: number;
|
|
256
|
+
}
|
|
257
|
+
export interface PaginationSummaryProps extends TextProps {
|
|
258
|
+
className?: string;
|
|
259
|
+
}
|
|
260
|
+
export interface PaginationStatusProps extends TextProps {
|
|
261
|
+
className?: string;
|
|
262
|
+
/** Which page the span is counted from. Read from the root when left out. */
|
|
263
|
+
page?: number;
|
|
264
|
+
/** How many rows a page holds. Required for the span to be worked out. */
|
|
265
|
+
pageSize?: number;
|
|
266
|
+
/** How many rows there are altogether. */
|
|
267
|
+
total?: number;
|
|
268
|
+
children?: ReactNode;
|
|
269
|
+
}
|
|
270
|
+
export declare const Pagination: import("react").ForwardRefExoticComponent<PaginationProps & import("react").RefAttributes<View>> & {
|
|
271
|
+
Item: import("react").ForwardRefExoticComponent<PaginationItemProps & import("react").RefAttributes<View>>;
|
|
272
|
+
Previous: {
|
|
273
|
+
({ ...props }: PaginationPreviousProps): import("react").JSX.Element;
|
|
274
|
+
displayName: string;
|
|
275
|
+
};
|
|
276
|
+
Next: {
|
|
277
|
+
({ ...props }: PaginationNextProps): import("react").JSX.Element;
|
|
278
|
+
displayName: string;
|
|
279
|
+
};
|
|
280
|
+
Ellipsis: import("react").ForwardRefExoticComponent<PaginationEllipsisProps & import("react").RefAttributes<View>>;
|
|
281
|
+
Summary: import("react").ForwardRefExoticComponent<PaginationSummaryProps & import("react").RefAttributes<import("react-native").Text>>;
|
|
282
|
+
Status: import("react").ForwardRefExoticComponent<PaginationStatusProps & import("react").RefAttributes<import("react-native").Text>>;
|
|
283
|
+
};
|
|
284
|
+
export {};
|
|
285
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/pagination/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,E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