@kanso-labs/react-native-kanso-ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +44 -22
- package/dist/button/index.js.map +1 -1
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1358 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox-group/index.d.ts +3 -4
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +4 -1
- package/dist/components/chip/index.js +229 -161
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/dialog/index.d.ts +5 -5
- package/dist/components/dialog/index.js +5 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +1 -1
- package/dist/components/fab/index.js +91 -76
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/menu/index.d.ts +3 -3
- package/dist/components/menu/index.js +3 -3
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +79 -0
- package/dist/components/search-view/index.js +571 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/sheet/index.d.ts +16 -7
- package/dist/components/sheet/index.js +157 -152
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/table/index.d.ts +391 -0
- package/dist/components/table/index.js +1708 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/token-field/index.d.ts +105 -0
- package/dist/components/token-field/index.js +574 -0
- package/dist/components/token-field/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +102 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +359 -154
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +18 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +5 -2
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +128 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +36 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1734 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +37 -3
- package/dist/index.js +36 -3
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +92 -77
- package/dist/modal/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +13 -1
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/package.json +11 -2
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { messagesFor } from "../../i18n/index.js";
|
|
2
|
+
import { useLocaleOf } from "../../i18n/provider.js";
|
|
3
|
+
import { Calendar } from "../calendar/index.js";
|
|
4
|
+
import { PickerPopup, PickerTrigger } from "../../picker/index.js";
|
|
5
|
+
import { SegmentedField } from "../../segments/field.js";
|
|
6
|
+
import { c } from "react/compiler-runtime";
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { createCalendar } from "@internationalized/date";
|
|
10
|
+
import { useDateFieldState } from "react-stately/useDateFieldState";
|
|
11
|
+
import { useDatePickerState } from "react-stately/useDatePickerState";
|
|
12
|
+
//#region src/components/date-picker/index.tsx
|
|
13
|
+
/**
|
|
14
|
+
* A date typed into a field, or picked from a calendar behind a button. The
|
|
15
|
+
* value is an `@internationalized/date` value, as on web: pass `value` with
|
|
16
|
+
* `onChange` to control it, or `defaultValue` to let it keep its own.
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { CalendarDate } from '@internationalized/date'
|
|
20
|
+
*
|
|
21
|
+
* <DatePicker defaultValue={new CalendarDate(2026, 9, 15)} label="Label" />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* The segments are DateField's and the calendar is Calendar, so
|
|
25
|
+
* `granularity`, `minValue`, `maxValue` and `isDateUnavailable` behave as
|
|
26
|
+
* they do there. From the medium window size up the calendar is docked to
|
|
27
|
+
* the field; below it, it opens centred over a scrim, which is the page's
|
|
28
|
+
* modal picker.
|
|
29
|
+
*
|
|
30
|
+
* `style`, `ref` and `testID` land on the picker as a whole.
|
|
31
|
+
*/
|
|
32
|
+
function DatePicker(t0) {
|
|
33
|
+
const $ = c(97);
|
|
34
|
+
let defaultOpen;
|
|
35
|
+
let defaultValue;
|
|
36
|
+
let firstDayOfWeek;
|
|
37
|
+
let isDateUnavailable;
|
|
38
|
+
let isOpen;
|
|
39
|
+
let label;
|
|
40
|
+
let locale;
|
|
41
|
+
let maxValue;
|
|
42
|
+
let minValue;
|
|
43
|
+
let onChange;
|
|
44
|
+
let onOpenChange;
|
|
45
|
+
let placeholderValue;
|
|
46
|
+
let props;
|
|
47
|
+
let shouldCloseOnSelect;
|
|
48
|
+
let t1;
|
|
49
|
+
let t2;
|
|
50
|
+
let t3;
|
|
51
|
+
let t4;
|
|
52
|
+
let triggerLabel;
|
|
53
|
+
let validate;
|
|
54
|
+
let value;
|
|
55
|
+
let visibleDuration;
|
|
56
|
+
if ($[0] !== t0) {
|
|
57
|
+
({defaultOpen, defaultValue, firstDayOfWeek, isDateUnavailable, isDisabled: t1, isOpen, isReadOnly: t2, isRequired: t3, label, locale, maxValue, minValue, onChange, onOpenChange, placeholderValue, shouldCloseOnSelect, showMonthYearMenus: t4, triggerLabel, validate, value, visibleDuration, ...props} = t0);
|
|
58
|
+
$[0] = t0;
|
|
59
|
+
$[1] = defaultOpen;
|
|
60
|
+
$[2] = defaultValue;
|
|
61
|
+
$[3] = firstDayOfWeek;
|
|
62
|
+
$[4] = isDateUnavailable;
|
|
63
|
+
$[5] = isOpen;
|
|
64
|
+
$[6] = label;
|
|
65
|
+
$[7] = locale;
|
|
66
|
+
$[8] = maxValue;
|
|
67
|
+
$[9] = minValue;
|
|
68
|
+
$[10] = onChange;
|
|
69
|
+
$[11] = onOpenChange;
|
|
70
|
+
$[12] = placeholderValue;
|
|
71
|
+
$[13] = props;
|
|
72
|
+
$[14] = shouldCloseOnSelect;
|
|
73
|
+
$[15] = t1;
|
|
74
|
+
$[16] = t2;
|
|
75
|
+
$[17] = t3;
|
|
76
|
+
$[18] = t4;
|
|
77
|
+
$[19] = triggerLabel;
|
|
78
|
+
$[20] = validate;
|
|
79
|
+
$[21] = value;
|
|
80
|
+
$[22] = visibleDuration;
|
|
81
|
+
} else {
|
|
82
|
+
defaultOpen = $[1];
|
|
83
|
+
defaultValue = $[2];
|
|
84
|
+
firstDayOfWeek = $[3];
|
|
85
|
+
isDateUnavailable = $[4];
|
|
86
|
+
isOpen = $[5];
|
|
87
|
+
label = $[6];
|
|
88
|
+
locale = $[7];
|
|
89
|
+
maxValue = $[8];
|
|
90
|
+
minValue = $[9];
|
|
91
|
+
onChange = $[10];
|
|
92
|
+
onOpenChange = $[11];
|
|
93
|
+
placeholderValue = $[12];
|
|
94
|
+
props = $[13];
|
|
95
|
+
shouldCloseOnSelect = $[14];
|
|
96
|
+
t1 = $[15];
|
|
97
|
+
t2 = $[16];
|
|
98
|
+
t3 = $[17];
|
|
99
|
+
t4 = $[18];
|
|
100
|
+
triggerLabel = $[19];
|
|
101
|
+
validate = $[20];
|
|
102
|
+
value = $[21];
|
|
103
|
+
visibleDuration = $[22];
|
|
104
|
+
}
|
|
105
|
+
const isDisabled = t1 === void 0 ? false : t1;
|
|
106
|
+
const isReadOnly = t2 === void 0 ? false : t2;
|
|
107
|
+
const isRequired = t3 === void 0 ? false : t3;
|
|
108
|
+
const showMonthYearMenus = t4 === void 0 ? false : t4;
|
|
109
|
+
const writtenIn = useLocaleOf(locale);
|
|
110
|
+
const box = useRef(null);
|
|
111
|
+
const [trigger, setTrigger] = useState(null);
|
|
112
|
+
let t5;
|
|
113
|
+
if ($[23] !== defaultOpen || $[24] !== defaultValue || $[25] !== isDateUnavailable || $[26] !== isDisabled || $[27] !== isOpen || $[28] !== isReadOnly || $[29] !== isRequired || $[30] !== maxValue || $[31] !== minValue || $[32] !== onChange || $[33] !== onOpenChange || $[34] !== placeholderValue || $[35] !== props.granularity || $[36] !== shouldCloseOnSelect || $[37] !== validate || $[38] !== value) {
|
|
114
|
+
t5 = {
|
|
115
|
+
defaultOpen,
|
|
116
|
+
defaultValue,
|
|
117
|
+
granularity: props.granularity,
|
|
118
|
+
isDateUnavailable,
|
|
119
|
+
isDisabled,
|
|
120
|
+
isOpen,
|
|
121
|
+
isReadOnly,
|
|
122
|
+
isRequired,
|
|
123
|
+
maxValue,
|
|
124
|
+
minValue,
|
|
125
|
+
onChange,
|
|
126
|
+
onOpenChange,
|
|
127
|
+
placeholderValue,
|
|
128
|
+
shouldCloseOnSelect,
|
|
129
|
+
validate,
|
|
130
|
+
value
|
|
131
|
+
};
|
|
132
|
+
$[23] = defaultOpen;
|
|
133
|
+
$[24] = defaultValue;
|
|
134
|
+
$[25] = isDateUnavailable;
|
|
135
|
+
$[26] = isDisabled;
|
|
136
|
+
$[27] = isOpen;
|
|
137
|
+
$[28] = isReadOnly;
|
|
138
|
+
$[29] = isRequired;
|
|
139
|
+
$[30] = maxValue;
|
|
140
|
+
$[31] = minValue;
|
|
141
|
+
$[32] = onChange;
|
|
142
|
+
$[33] = onOpenChange;
|
|
143
|
+
$[34] = placeholderValue;
|
|
144
|
+
$[35] = props.granularity;
|
|
145
|
+
$[36] = shouldCloseOnSelect;
|
|
146
|
+
$[37] = validate;
|
|
147
|
+
$[38] = value;
|
|
148
|
+
$[39] = t5;
|
|
149
|
+
} else t5 = $[39];
|
|
150
|
+
const state = useDatePickerState(t5);
|
|
151
|
+
const { close, open, setDateValue, setValue } = state;
|
|
152
|
+
const t6 = validate;
|
|
153
|
+
let t7;
|
|
154
|
+
if ($[40] !== isDateUnavailable || $[41] !== isDisabled || $[42] !== isReadOnly || $[43] !== isRequired || $[44] !== maxValue || $[45] !== minValue || $[46] !== placeholderValue || $[47] !== props || $[48] !== setValue || $[49] !== state.value || $[50] !== t6 || $[51] !== writtenIn) {
|
|
155
|
+
t7 = {
|
|
156
|
+
...props,
|
|
157
|
+
createCalendar,
|
|
158
|
+
isDateUnavailable,
|
|
159
|
+
isDisabled,
|
|
160
|
+
isReadOnly,
|
|
161
|
+
isRequired,
|
|
162
|
+
locale: writtenIn,
|
|
163
|
+
maxValue,
|
|
164
|
+
minValue,
|
|
165
|
+
onChange: setValue,
|
|
166
|
+
placeholderValue,
|
|
167
|
+
validate: t6,
|
|
168
|
+
value: state.value
|
|
169
|
+
};
|
|
170
|
+
$[40] = isDateUnavailable;
|
|
171
|
+
$[41] = isDisabled;
|
|
172
|
+
$[42] = isReadOnly;
|
|
173
|
+
$[43] = isRequired;
|
|
174
|
+
$[44] = maxValue;
|
|
175
|
+
$[45] = minValue;
|
|
176
|
+
$[46] = placeholderValue;
|
|
177
|
+
$[47] = props;
|
|
178
|
+
$[48] = setValue;
|
|
179
|
+
$[49] = state.value;
|
|
180
|
+
$[50] = t6;
|
|
181
|
+
$[51] = writtenIn;
|
|
182
|
+
$[52] = t7;
|
|
183
|
+
} else t7 = $[52];
|
|
184
|
+
const field = useDateFieldState(t7);
|
|
185
|
+
let t8;
|
|
186
|
+
if ($[53] !== triggerLabel || $[54] !== writtenIn) {
|
|
187
|
+
t8 = triggerLabel ?? messagesFor(writtenIn).segments.calendar;
|
|
188
|
+
$[53] = triggerLabel;
|
|
189
|
+
$[54] = writtenIn;
|
|
190
|
+
$[55] = t8;
|
|
191
|
+
} else t8 = $[55];
|
|
192
|
+
const name = `${t8} ${label}`;
|
|
193
|
+
const t9 = field.realtimeValidation.validationErrors;
|
|
194
|
+
const t10 = field.value === null;
|
|
195
|
+
let t11;
|
|
196
|
+
if ($[56] !== state.value) {
|
|
197
|
+
t11 = state.value?.toString() ?? "";
|
|
198
|
+
$[56] = state.value;
|
|
199
|
+
$[57] = t11;
|
|
200
|
+
} else t11 = $[57];
|
|
201
|
+
const t12 = isDisabled || isReadOnly;
|
|
202
|
+
let t13;
|
|
203
|
+
if ($[58] !== name || $[59] !== open || $[60] !== state.isOpen || $[61] !== t12) {
|
|
204
|
+
t13 = triggerOf({
|
|
205
|
+
isDisabled: t12,
|
|
206
|
+
isOpen: state.isOpen,
|
|
207
|
+
label: name,
|
|
208
|
+
onPress: open,
|
|
209
|
+
ref: setTrigger
|
|
210
|
+
});
|
|
211
|
+
$[58] = name;
|
|
212
|
+
$[59] = open;
|
|
213
|
+
$[60] = state.isOpen;
|
|
214
|
+
$[61] = t12;
|
|
215
|
+
$[62] = t13;
|
|
216
|
+
} else t13 = $[62];
|
|
217
|
+
let t14;
|
|
218
|
+
if ($[63] !== field || $[64] !== isDisabled || $[65] !== isReadOnly || $[66] !== isRequired || $[67] !== label || $[68] !== props || $[69] !== t10 || $[70] !== t11 || $[71] !== t13 || $[72] !== writtenIn) {
|
|
219
|
+
t14 = /* @__PURE__ */ jsx(SegmentedField, {
|
|
220
|
+
...props,
|
|
221
|
+
box,
|
|
222
|
+
errors: t9,
|
|
223
|
+
isDisabled,
|
|
224
|
+
isEmpty: t10,
|
|
225
|
+
isReadOnly,
|
|
226
|
+
isRequired,
|
|
227
|
+
label,
|
|
228
|
+
locale: writtenIn,
|
|
229
|
+
state: field,
|
|
230
|
+
submitted: t11,
|
|
231
|
+
trailingIcon: t13
|
|
232
|
+
});
|
|
233
|
+
$[63] = field;
|
|
234
|
+
$[64] = isDisabled;
|
|
235
|
+
$[65] = isReadOnly;
|
|
236
|
+
$[66] = isRequired;
|
|
237
|
+
$[67] = label;
|
|
238
|
+
$[68] = props;
|
|
239
|
+
$[69] = t10;
|
|
240
|
+
$[70] = t11;
|
|
241
|
+
$[71] = t13;
|
|
242
|
+
$[72] = writtenIn;
|
|
243
|
+
$[73] = t14;
|
|
244
|
+
} else t14 = $[73];
|
|
245
|
+
const t15 = state.dateValue === null ? placeholderValue : void 0;
|
|
246
|
+
let t16;
|
|
247
|
+
if ($[74] !== firstDayOfWeek || $[75] !== isDateUnavailable || $[76] !== isDisabled || $[77] !== isReadOnly || $[78] !== label || $[79] !== maxValue || $[80] !== minValue || $[81] !== setDateValue || $[82] !== showMonthYearMenus || $[83] !== state.dateValue || $[84] !== t15 || $[85] !== visibleDuration || $[86] !== writtenIn) {
|
|
248
|
+
t16 = /* @__PURE__ */ jsx(Calendar, {
|
|
249
|
+
"aria-label": label,
|
|
250
|
+
defaultFocusedValue: t15,
|
|
251
|
+
firstDayOfWeek,
|
|
252
|
+
isDateUnavailable,
|
|
253
|
+
isDisabled,
|
|
254
|
+
isReadOnly,
|
|
255
|
+
locale: writtenIn,
|
|
256
|
+
maxValue,
|
|
257
|
+
minValue,
|
|
258
|
+
onChange: setDateValue,
|
|
259
|
+
showMonthYearMenus,
|
|
260
|
+
value: state.dateValue,
|
|
261
|
+
visibleDuration
|
|
262
|
+
});
|
|
263
|
+
$[74] = firstDayOfWeek;
|
|
264
|
+
$[75] = isDateUnavailable;
|
|
265
|
+
$[76] = isDisabled;
|
|
266
|
+
$[77] = isReadOnly;
|
|
267
|
+
$[78] = label;
|
|
268
|
+
$[79] = maxValue;
|
|
269
|
+
$[80] = minValue;
|
|
270
|
+
$[81] = setDateValue;
|
|
271
|
+
$[82] = showMonthYearMenus;
|
|
272
|
+
$[83] = state.dateValue;
|
|
273
|
+
$[84] = t15;
|
|
274
|
+
$[85] = visibleDuration;
|
|
275
|
+
$[86] = writtenIn;
|
|
276
|
+
$[87] = t16;
|
|
277
|
+
} else t16 = $[87];
|
|
278
|
+
let t17;
|
|
279
|
+
if ($[88] !== close || $[89] !== name || $[90] !== state.isOpen || $[91] !== t16 || $[92] !== trigger) {
|
|
280
|
+
t17 = /* @__PURE__ */ jsx(PickerPopup, {
|
|
281
|
+
anchor: box,
|
|
282
|
+
close,
|
|
283
|
+
isOpen: state.isOpen,
|
|
284
|
+
label: name,
|
|
285
|
+
trigger,
|
|
286
|
+
children: t16
|
|
287
|
+
});
|
|
288
|
+
$[88] = close;
|
|
289
|
+
$[89] = name;
|
|
290
|
+
$[90] = state.isOpen;
|
|
291
|
+
$[91] = t16;
|
|
292
|
+
$[92] = trigger;
|
|
293
|
+
$[93] = t17;
|
|
294
|
+
} else t17 = $[93];
|
|
295
|
+
let t18;
|
|
296
|
+
if ($[94] !== t14 || $[95] !== t17) {
|
|
297
|
+
t18 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t14, t17] });
|
|
298
|
+
$[94] = t14;
|
|
299
|
+
$[95] = t17;
|
|
300
|
+
$[96] = t18;
|
|
301
|
+
} else t18 = $[96];
|
|
302
|
+
return t18;
|
|
303
|
+
}
|
|
304
|
+
function triggerOf(props) {
|
|
305
|
+
return /* @__PURE__ */ jsx(PickerTrigger, { ...props });
|
|
306
|
+
}
|
|
307
|
+
//#endregion
|
|
308
|
+
export { DatePicker };
|
|
309
|
+
|
|
310
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["DateDuration","ComponentRef","ReactNode","Ref","HostInstance","StyleProp","View","ViewStyle","DateValue","DatePickerStateOptions","StatelyDatePickerProps","createCalendar","useRef","useState","useDateFieldState","useDatePickerState","FieldVariant","messagesFor","useLocaleOf","PickerPopup","PickerTrigger","SegmentedField","Calendar","DatePickerProps","Pick","T","description","error","floatingLabel","isDisabled","isReadOnly","isRequired","label","leadingIcon","locale","name","onBlur","onFocus","ref","showMonthYearMenus","style","testID","triggerLabel","variant","visibleDuration","DatePicker","t0","$","_c","defaultOpen","defaultValue","firstDayOfWeek","isDateUnavailable","isOpen","maxValue","minValue","onChange","onOpenChange","placeholderValue","props","shouldCloseOnSelect","t1","t2","t3","t4","validate","value","undefined","writtenIn","box","trigger","setTrigger","t5","granularity","state","close","open","setDateValue","setValue","t6","t7","field","t8","segments","calendar","t9","realtimeValidation","validationErrors","t10","t11","toString","t12","t13","triggerOf","onPress","t14","t15","dateValue","t16","t17","t18","Parameters","_c"],"sources":["../../../src/components/date-picker/index.tsx"],"sourcesContent":["import type { DateDuration } from '@internationalized/date'\nimport type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { HostInstance, StyleProp, View, ViewStyle } from 'react-native'\nimport type {\n DateValue,\n DatePickerStateOptions as StatelyDatePickerProps,\n} from 'react-stately/useDatePickerState'\n\nimport { createCalendar } from '@internationalized/date'\nimport { useRef, useState } from 'react'\nimport { useDateFieldState } from 'react-stately/useDateFieldState'\nimport { useDatePickerState } from 'react-stately/useDatePickerState'\n\nimport type { FieldVariant } from '../../field'\n\nimport { messagesFor } from '../../i18n'\nimport { useLocaleOf } from '../../i18n/provider'\nimport { PickerPopup, PickerTrigger } from '../../picker'\nimport { SegmentedField } from '../../segments/field'\nimport { Calendar } from '../calendar'\n\n// kanso-ui's DatePicker, the date pickers page's picker: the date field a\n// date is typed into, with a calendar behind a button for picking it\n// instead. Both halves already exist, the segments DateField's, from\n// src/segments, and the calendar Calendar, so what this adds is the button\n// between them and the surface the calendar opens on, both in src/picker,\n// which DateRangePicker draws as well.\n//\n// The state is React Stately's `useDatePickerState`, which web's React Aria\n// picker is built on: the field and the calendar both read and write its\n// value, as React Aria wires them, so a date typed into the segments shows\n// in the calendar and a date picked in the calendar fills the segments.\n//\n// Four things are this component's own, as on web.\n//\n// **The picker is one field, not a field beside a button.** The button sits\n// in the box's trailing slot, so the box draws once around the segments and\n// the button, and a reader moves through the segments and reaches the\n// button at the end of them. It is named for opening the calendar and then\n// by the field's label, \"Calendar Label\" in English, React Aria's words.\n//\n// **It is docked from the medium window size up and modal below it**, the\n// pairing the page draws: in a compact window the calendar opens as a\n// dialog, centred over a scrim, and from 600dp up it hangs under the field.\n// The two are src/picker's, which says why.\n//\n// **Picking a date closes the calendar**, unless `shouldCloseOnSelect` says\n// otherwise. A screen reader goes to the date held as the calendar opens,\n// or to the one it opens on, and back to the button once it has gone, as\n// web's focus does. A `granularity` with a time keeps the time the segments already\n// hold, and fills a time not yet typed from `placeholderValue`.\n//\n// **The locale is the `I18nProvider`'s**, as web reads it from React Aria's,\n// unless the `locale` prop names another, and the device's under neither.\n\ntype DatePickerProps<T extends DateValue = DateValue> = Pick<\n StatelyDatePickerProps<T>,\n | 'defaultOpen'\n | 'defaultValue'\n | 'firstDayOfWeek'\n | 'granularity'\n | 'hideTimeZone'\n | 'hourCycle'\n | 'isDateUnavailable'\n | 'isOpen'\n | 'maxValue'\n | 'minValue'\n | 'onChange'\n | 'onOpenChange'\n | 'placeholderValue'\n | 'shouldCloseOnSelect'\n | 'shouldForceLeadingZeros'\n | 'validate'\n | 'value'\n> & {\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the error colours, and the\n * invalid state a screen reader reads all follow from it. The line under\n * the field arrives with the message, so the field grows when this does,\n * unless it is inside a `Form`, which keeps the line drawn. It wins over\n * what `validate`, the bounds and the form say.\n */\n readonly error?: string\n /**\n * Whether the label floats into the box's top, as the text fields page\n * draws a field holding a value. The segments always show, their\n * placeholders while empty, so it floats from the start. `false` keeps it\n * small at the top.\n * @default true\n */\n readonly floatingLabel?: boolean\n /**\n * Draws the picker disabled: the field takes no input and the calendar\n * does not open.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the value and takes focus, but takes no input, and the calendar\n * does not open.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Marks the label with an asterisk, as the text fields page marks a field\n * that must be filled.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the field is for, and the name a screen reader reads for it, after\n * each segment's own. It names the calendar too, and the button opening\n * it after that button's own name.\n */\n readonly label: string\n /**\n * An icon at the start of the box, before the label and the segments: the\n * page's 24dp leading icon, in the muted role. The slot hands it that\n * colour and size through `useIconStyle()`.\n */\n readonly leadingIcon?: ReactNode\n /**\n * The BCP 47 locale the date is written and typed in, and the calendar\n * drawn in: the order of the segments, their placeholders, the month and\n * weekday names, the digits and the calendar system. Defaults to the\n * `I18nProvider`'s, or the device's outside one.\n */\n readonly locale?: string\n /**\n * The name the value is submitted under by the `Form` around the picker,\n * and the key its `validationErrors` reach it by. The form submits the\n * date written out as ISO 8601, such as `2026-09-15`, and `''` for an\n * empty picker.\n */\n readonly name?: string\n /** Called as focus leaves the field, once it has filled what it can. */\n readonly onBlur?: () => void\n /** Called as focus arrives in the field, at whichever segment. */\n readonly onFocus?: () => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Whether the calendar's header draws the month and the year as menu\n * buttons, each opening a list of them in the grid's place, as the docked\n * date picker's header does: see `Calendar`.\n * @default false\n */\n readonly showMonthYearMenus?: boolean\n /** Positions and sizes the picker as a whole. */\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n /**\n * What the button that opens the calendar is called, for a screen reader,\n * before the field's label. Left out, it is \"Calendar\" in the locale's\n * words, React Aria's.\n */\n readonly triggerLabel?: string\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n readonly variant?: FieldVariant\n /**\n * How much of the calendar shows at once: `{ months: 2 }` draws two\n * months, side by side from the expanded window size up and one under the\n * other below it: see `Calendar`.\n * @default { months: 1 }\n */\n readonly visibleDuration?: DateDuration\n}\n\n/**\n * A date typed into a field, or picked from a calendar behind a button. The\n * value is an `@internationalized/date` value, as on web: pass `value` with\n * `onChange` to control it, or `defaultValue` to let it keep its own.\n *\n * ```tsx\n * import { CalendarDate } from '@internationalized/date'\n *\n * <DatePicker defaultValue={new CalendarDate(2026, 9, 15)} label=\"Label\" />\n * ```\n *\n * The segments are DateField's and the calendar is Calendar, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` behave as\n * they do there. From the medium window size up the calendar is docked to\n * the field; below it, it opens centred over a scrim, which is the page's\n * modal picker.\n *\n * `style`, `ref` and `testID` land on the picker as a whole.\n */\nfunction DatePicker<T extends DateValue = DateValue>({\n defaultOpen,\n defaultValue,\n firstDayOfWeek,\n isDateUnavailable,\n isDisabled = false,\n isOpen,\n isReadOnly = false,\n isRequired = false,\n label,\n locale,\n maxValue,\n minValue,\n onChange,\n onOpenChange,\n placeholderValue,\n shouldCloseOnSelect,\n showMonthYearMenus = false,\n triggerLabel,\n validate,\n value,\n visibleDuration,\n ...props\n}: DatePickerProps<T>) {\n const writtenIn = useLocaleOf(locale)\n const box = useRef<HostInstance>(null)\n const [trigger, setTrigger] = useState<HostInstance | null>(null)\n const state = useDatePickerState<T>({\n defaultOpen,\n defaultValue,\n granularity: props.granularity,\n isDateUnavailable,\n isDisabled,\n isOpen,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onChange,\n onOpenChange,\n placeholderValue,\n shouldCloseOnSelect,\n validate,\n value,\n })\n // oxlint-disable-next-line typescript/unbound-method -- React Stately's setters are callbacks, and read no `this`\n const { close, open, setDateValue, setValue } = state\n const field = useDateFieldState({\n ...props,\n createCalendar,\n isDateUnavailable,\n isDisabled,\n isReadOnly,\n isRequired,\n locale: writtenIn,\n maxValue,\n minValue,\n onChange: setValue,\n placeholderValue,\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the picker's `validate` takes the value its own type maps to, which is the field's too\n validate: validate as StatelyDatePickerProps<DateValue>['validate'],\n value: state.value,\n })\n const name = `${triggerLabel ?? messagesFor(writtenIn).segments.calendar} ${label}`\n\n return (\n <>\n <SegmentedField\n {...props}\n box={box}\n errors={field.realtimeValidation.validationErrors}\n isDisabled={isDisabled}\n isEmpty={field.value === null}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n label={label}\n locale={writtenIn}\n state={field}\n submitted={state.value?.toString() ?? ''}\n trailingIcon={triggerOf({\n isDisabled: isDisabled || isReadOnly,\n isOpen: state.isOpen,\n label: name,\n onPress: open,\n ref: setTrigger,\n })}\n />\n <PickerPopup\n anchor={box}\n close={close}\n isOpen={state.isOpen}\n label={name}\n trigger={trigger}\n >\n <Calendar\n aria-label={label}\n defaultFocusedValue={\n state.dateValue === null ? placeholderValue : undefined\n }\n firstDayOfWeek={firstDayOfWeek}\n isDateUnavailable={isDateUnavailable}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n locale={writtenIn}\n maxValue={maxValue}\n minValue={minValue}\n onChange={setDateValue}\n showMonthYearMenus={showMonthYearMenus}\n value={state.dateValue}\n visibleDuration={visibleDuration}\n />\n </PickerPopup>\n </>\n )\n}\n\n// The button for the box's trailing slot. A call rather than JSX written at\n// the prop, which is what react-perf's jsx-no-jsx-as-prop is after.\nfunction triggerOf(props: Parameters<typeof PickerTrigger>[0]) {\n return <PickerTrigger {...props} />\n}\n\nexport type { DatePickerProps }\n\nexport { DatePicker }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmMA,SAAA6C,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAArB;CAAA,IAAAE;CAAA,IAAAoB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IA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AAAnD,EAAA,QAAAuB,SAAA;EAvBJ6B,MAAA,oBAAC,aAAD;GACU9B,QAAAA;GACDM;GACC,QAAAD,MAAKrB;GACNlB,OAAAA;GACEmC;GAET4B,UAAAA;EAPU,CAAA;EAwBEnD,EAAA,MAAA4B;EAAA5B,EAAA,MAAAZ;EAAAY,EAAA,MAAA2B,MAAArB;EAAAN,EAAA,MAAAmD;EAAAnD,EAAA,MAAAuB;EAAAvB,EAAA,MAAAoD;CAAA,OAAAA,MAAApD,EAAA;CAAA,IAAAqD;CAAA,IAAArD,EAAA,QAAAgD,OAAAhD,EAAA,QAAAoD,KAAA;EA7ChBC,MAAA,qBAAA,YAAA,EAAA,UAAA,CACEL,KAoBAI,GAwBc,EAAA,CAAA;EACbpD,EAAA,MAAAgD;EAAAhD,EAAA,MAAAoD;EAAApD,EAAA,MAAAqD;CAAA,OAAAA,MAAArD,EAAA;CAAA,OA9CHqD;AA8CG;AAMP,SAASP,UAAUlC,OAA4C;CAC7D,OAAO,oBAAC,eAAD,EAAe,GAAIA,MAAM,CAAA;AAClC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { FieldVariant } from "../../field/index.js";
|
|
2
|
+
import { StyleProp, View, ViewStyle } from "react-native";
|
|
3
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
4
|
+
import { DateDuration } from "@internationalized/date";
|
|
5
|
+
import { DateRangePickerStateOptions, DateValue } from "react-stately/useDateRangePickerState";
|
|
6
|
+
//#region src/components/date-range-picker/index.d.ts
|
|
7
|
+
type DateRangePickerProps<T extends DateValue = DateValue> = Pick<DateRangePickerStateOptions<T>, 'allowsNonContiguousRanges' | 'defaultOpen' | 'defaultValue' | 'endName' | 'firstDayOfWeek' | 'granularity' | 'hideTimeZone' | 'hourCycle' | 'isDateUnavailable' | 'isOpen' | 'maxValue' | 'minValue' | 'onChange' | 'onOpenChange' | 'placeholderValue' | 'shouldCloseOnSelect' | 'shouldForceLeadingZeros' | 'startName' | 'validate' | 'value'> & {
|
|
8
|
+
/**
|
|
9
|
+
* A hint shown under the field. Replaced by `error` when there is one, so
|
|
10
|
+
* the two never stack.
|
|
11
|
+
*/
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The problem with the current range, in words. Its presence is what puts
|
|
15
|
+
* the field in its error state: the message, the error colours, and the
|
|
16
|
+
* invalid state a screen reader reads all follow from it. The line under
|
|
17
|
+
* the field arrives with the message, so the field grows when this does,
|
|
18
|
+
* unless it is inside a `Form`, which keeps the line drawn. It wins over
|
|
19
|
+
* what `validate`, the bounds and the form say.
|
|
20
|
+
*/
|
|
21
|
+
readonly error?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the label floats into the box's top, as the text fields page
|
|
24
|
+
* draws a field holding a value. The segments always show, their
|
|
25
|
+
* placeholders while empty, so it floats from the start. `false` keeps it
|
|
26
|
+
* small at the top.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
readonly floatingLabel?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Draws the picker disabled: neither date takes input and the calendar
|
|
32
|
+
* does not open.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
readonly isDisabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Shows the range and takes focus, but takes no input, and the calendar
|
|
38
|
+
* does not open.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
readonly isReadOnly?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Marks the label with an asterisk, as the text fields page marks a field
|
|
44
|
+
* that must be filled. Inside a `Form` that validates natively, both dates
|
|
45
|
+
* must be.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
readonly isRequired?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* What the field is for, and the name a screen reader reads for it, after
|
|
51
|
+
* each segment's own and its date's. It names the calendar too, and the
|
|
52
|
+
* button opening it after that button's own name.
|
|
53
|
+
*/
|
|
54
|
+
readonly label: string;
|
|
55
|
+
/**
|
|
56
|
+
* An icon at the start of the box, before the label and the segments: the
|
|
57
|
+
* page's 24dp leading icon, in the muted role. The slot hands it that
|
|
58
|
+
* colour and size through `useIconStyle()`.
|
|
59
|
+
*/
|
|
60
|
+
readonly leadingIcon?: ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* The BCP 47 locale the dates are written and typed in, and the calendar
|
|
63
|
+
* drawn in: the order of the segments, their placeholders, the month and
|
|
64
|
+
* weekday names, the digits and the calendar system. Defaults to the
|
|
65
|
+
* `I18nProvider`'s, or the device's outside one.
|
|
66
|
+
*/
|
|
67
|
+
readonly locale?: string;
|
|
68
|
+
/** Called as focus leaves the field, once it has filled what it can. */
|
|
69
|
+
readonly onBlur?: () => void;
|
|
70
|
+
/** Called as focus arrives in the field, at whichever segment. */
|
|
71
|
+
readonly onFocus?: () => void;
|
|
72
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
73
|
+
/**
|
|
74
|
+
* What is drawn between the two dates. Decoration: a screen reader hears
|
|
75
|
+
* which date each segment is part of instead.
|
|
76
|
+
* @default '–'
|
|
77
|
+
*/
|
|
78
|
+
readonly separator?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the calendar's header draws the month and the year as menu
|
|
81
|
+
* buttons, each opening a list of them in the grid's place, as the docked
|
|
82
|
+
* date picker's header does: see `RangeCalendar`.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
readonly showMonthYearMenus?: boolean;
|
|
86
|
+
/** Positions and sizes the picker as a whole. */
|
|
87
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
88
|
+
readonly testID?: string;
|
|
89
|
+
/**
|
|
90
|
+
* What the button that opens the calendar is called, for a screen reader,
|
|
91
|
+
* before the field's label. Left out, it is "Calendar" in the locale's
|
|
92
|
+
* words, React Aria's.
|
|
93
|
+
*/
|
|
94
|
+
readonly triggerLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The filled box, or the outlined one, as the text fields page draws them.
|
|
97
|
+
* @default 'filled'
|
|
98
|
+
*/
|
|
99
|
+
readonly variant?: FieldVariant;
|
|
100
|
+
/**
|
|
101
|
+
* How much of the calendar shows at once: `{ months: 2 }` draws two
|
|
102
|
+
* months, side by side from the expanded window size up and one under the
|
|
103
|
+
* other below it, which is what a range is usually picked from: see
|
|
104
|
+
* `RangeCalendar`.
|
|
105
|
+
* @default { months: 1 }
|
|
106
|
+
*/
|
|
107
|
+
readonly visibleDuration?: DateDuration;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* A date range typed into a field, or picked from a calendar behind a
|
|
111
|
+
* button. The value is a `{ start, end }` pair of `@internationalized/date`
|
|
112
|
+
* values, as on web: pass `value` with `onChange` to control it, or
|
|
113
|
+
* `defaultValue` to let it keep its own. `onChange` is called once both
|
|
114
|
+
* dates are filled.
|
|
115
|
+
*
|
|
116
|
+
* ```tsx
|
|
117
|
+
* import { CalendarDate } from '@internationalized/date'
|
|
118
|
+
*
|
|
119
|
+
* <DateRangePicker
|
|
120
|
+
* defaultValue={{
|
|
121
|
+
* end: new CalendarDate(2026, 9, 20),
|
|
122
|
+
* start: new CalendarDate(2026, 9, 15),
|
|
123
|
+
* }}
|
|
124
|
+
* label="Label"
|
|
125
|
+
* />
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* The segments are DateField's and the calendar is RangeCalendar, so
|
|
129
|
+
* `granularity`, `minValue`, `maxValue` and `isDateUnavailable` behave as
|
|
130
|
+
* they do there. From the medium window size up the calendar is docked to
|
|
131
|
+
* the field; below it, it opens centred over a scrim, the same swap
|
|
132
|
+
* DatePicker makes.
|
|
133
|
+
*
|
|
134
|
+
* `style`, `ref` and `testID` land on the picker as a whole.
|
|
135
|
+
*/
|
|
136
|
+
declare function DateRangePicker<T extends DateValue = DateValue>({ allowsNonContiguousRanges, defaultOpen, defaultValue, endName, firstDayOfWeek, granularity, hideTimeZone, hourCycle, isDateUnavailable, isDisabled, isOpen, isReadOnly, isRequired, label, locale, maxValue, minValue, onChange, onOpenChange, placeholderValue, separator, shouldCloseOnSelect, shouldForceLeadingZeros, showMonthYearMenus, startName, triggerLabel, validate, value, visibleDuration, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
|
|
137
|
+
//#endregion
|
|
138
|
+
export { DateRangePicker, type DateRangePickerProps };
|
|
139
|
+
//# sourceMappingURL=index.d.ts.map
|