@fluixi-ui/date-picker 0.3.0-alpha.12 → 0.3.0-alpha.14
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/date-picker.d.ts +9 -0
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +122 -194
- package/dist/date-range-picker.d.ts +9 -0
- package/dist/date-range-picker.d.ts.map +1 -1
- package/dist/date-range-picker.js +126 -208
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +6 -5
package/dist/date-picker.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FxProp } from '@fluixi-ui/fx';
|
|
1
2
|
import { type Accessor } from '@fluixi/reactive/signal';
|
|
2
3
|
import { type Placement } from '@fluixi-ui/primitives';
|
|
3
4
|
import type { DateValue, Granularity } from '@fluixi-ui/date-core';
|
|
@@ -56,19 +57,27 @@ export interface DatePickerProps {
|
|
|
56
57
|
*/
|
|
57
58
|
export declare function DatePicker(props: DatePickerProps): ComponentChild;
|
|
58
59
|
export interface DatePickerLabelProps extends HTMLAttributes<HTMLElement> {
|
|
60
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
61
|
+
fx?: FxProp;
|
|
59
62
|
}
|
|
60
63
|
/** Field label; linked to the segmented input. */
|
|
61
64
|
export declare function DatePickerLabel(props: DatePickerLabelProps): ComponentChild;
|
|
62
65
|
export interface DatePickerFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
66
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
67
|
+
fx?: FxProp;
|
|
63
68
|
}
|
|
64
69
|
/** The bordered control: the segmented date field plus the calendar trigger. */
|
|
65
70
|
export declare function DatePickerField(props: DatePickerFieldProps): ComponentChild;
|
|
66
71
|
export interface DatePickerTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
72
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
73
|
+
fx?: FxProp;
|
|
67
74
|
}
|
|
68
75
|
/** Toggles the calendar popover. */
|
|
69
76
|
export declare function DatePickerTrigger(props: DatePickerTriggerProps): ComponentChild;
|
|
70
77
|
export interface DatePickerContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
71
78
|
children?: ComponentChild;
|
|
79
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
80
|
+
fx?: FxProp;
|
|
72
81
|
}
|
|
73
82
|
/**
|
|
74
83
|
* The floating calendar panel. Renders a default calendar bound to the shared
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../src/date-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../src/date-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,KAAK,QAAQ,EAAkD,MAAM,yBAAyB,CAAC;AAUxG,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnF,UAAU,sBAAsB;IAC9B,KAAK,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;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/E;AAmED,gEAAgE;AAChE,wBAAgB,kBAAkB,IAAI,cAAc,CAuBnD"}
|
package/dist/date-picker.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { createSignal, createMemo, createEffect, createRenderEffect } from "@fluixi/reactive/signal";
|
|
2
1
|
import { delegateEvents, createComponent, splitProps, createNativeElement, spread, mergeProps, insert, handleRef } from "@fluixi/dom";
|
|
2
|
+
import { createSignal, createMemo, createEffect, createRenderEffect } from "@fluixi/reactive/signal";
|
|
3
|
+
import { fxProps } from "@fluixi-ui/fx";
|
|
3
4
|
import { useRef, Show } from "@fluixi/core";
|
|
4
5
|
import { createSafeContext, createControllableSignal, createControllableBooleanSignal, createId, composeId, composeEventHandlers } from "@fluixi-ui/kit";
|
|
5
6
|
import { Portal, createFloatingPosition, createDismissableLayer, createFocusScope } from "@fluixi-ui/primitives";
|
|
6
7
|
import { DateField, DateInput } from "@fluixi-ui/date-field";
|
|
7
8
|
import { Calendar, CalendarHeader, CalendarPrevButton, CalendarHeading, CalendarNextButton, CalendarGrid } from "@fluixi-ui/calendar";
|
|
8
|
-
delegateEvents(["change", "
|
|
9
|
+
delegateEvents(["change", "keydown", "click"]);
|
|
9
10
|
const [DatePickerProvider, useDatePickerContext] = createSafeContext("DatePicker");
|
|
10
11
|
function DatePicker(props) {
|
|
11
12
|
const [value, setValue] = createControllableSignal({
|
|
@@ -25,10 +26,7 @@ function DatePicker(props) {
|
|
|
25
26
|
setValue,
|
|
26
27
|
isOpen,
|
|
27
28
|
setOpen: (o) => setOpen(o),
|
|
28
|
-
ids: {
|
|
29
|
-
label: composeId(baseId, "label"),
|
|
30
|
-
content: composeId(baseId, "content")
|
|
31
|
-
},
|
|
29
|
+
ids: { label: composeId(baseId, "label"), content: composeId(baseId, "content") },
|
|
32
30
|
triggerRef,
|
|
33
31
|
setTriggerRef,
|
|
34
32
|
placement: props.placement ?? "bottom-start",
|
|
@@ -43,160 +41,119 @@ function DatePicker(props) {
|
|
|
43
41
|
isDateUnavailable: props.isDateUnavailable,
|
|
44
42
|
name: props.name
|
|
45
43
|
};
|
|
46
|
-
return createMemo(() => createComponent(DatePickerProvider, {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return props.children;
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
44
|
+
return createMemo(() => createComponent(DatePickerProvider, { get value() {
|
|
45
|
+
return ctx;
|
|
46
|
+
}, get children() {
|
|
47
|
+
return props.children;
|
|
48
|
+
} }));
|
|
54
49
|
}
|
|
55
50
|
function DatePickerLabel(props) {
|
|
56
51
|
const ctx = useDatePickerContext();
|
|
57
|
-
const [local, others] = splitProps(props, ["children"]);
|
|
52
|
+
const [local, others] = splitProps(props, ["children", "fx", "style"]);
|
|
58
53
|
return (() => {
|
|
59
54
|
const _el$ = createNativeElement("span");
|
|
60
|
-
spread({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"data-date-picker-label": ""
|
|
65
|
-
})
|
|
66
|
-
});
|
|
55
|
+
spread({ element: _el$, props: mergeProps(fxProps(
|
|
56
|
+
() => local.fx,
|
|
57
|
+
() => local.style
|
|
58
|
+
), others, { id: () => ctx.ids.label, "data-date-picker-label": "" }) });
|
|
67
59
|
insert(_el$, local.children);
|
|
68
60
|
return _el$;
|
|
69
61
|
})();
|
|
70
62
|
}
|
|
71
63
|
function DatePickerField(props) {
|
|
72
64
|
const ctx = useDatePickerContext();
|
|
73
|
-
const [local, others] = splitProps(props, ["ref", "children"]);
|
|
65
|
+
const [local, others] = splitProps(props, ["ref", "children", "fx", "style"]);
|
|
74
66
|
const setRef = (node) => {
|
|
75
67
|
ctx.setTriggerRef(node);
|
|
76
68
|
handleRef(local.ref, node);
|
|
77
69
|
};
|
|
78
|
-
return createMemo(() => createComponent(DateField, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
element: _el$,
|
|
117
|
-
props: mergeProps(others, {
|
|
118
|
-
ref: setRef,
|
|
119
|
-
"data-date-picker-control": ""
|
|
120
|
-
})
|
|
121
|
-
});
|
|
122
|
-
insert(_el$, createMemo(() => createComponent(DateInput, {
|
|
123
|
-
get "aria-labelledby"() {
|
|
124
|
-
return ctx.ids.label;
|
|
125
|
-
},
|
|
126
|
-
get "data-date-picker-input"() {
|
|
127
|
-
return "";
|
|
128
|
-
}
|
|
129
|
-
})), null);
|
|
130
|
-
insert(_el$, local.children ?? createMemo(() => createComponent(DatePickerTrigger, {})));
|
|
131
|
-
return _el$;
|
|
132
|
-
})();
|
|
133
|
-
}
|
|
134
|
-
}));
|
|
70
|
+
return createMemo(() => createComponent(DateField, { get value() {
|
|
71
|
+
return ctx.value;
|
|
72
|
+
}, get onChange() {
|
|
73
|
+
return ctx.setValue;
|
|
74
|
+
}, get locale() {
|
|
75
|
+
return ctx.locale;
|
|
76
|
+
}, get granularity() {
|
|
77
|
+
return ctx.granularity;
|
|
78
|
+
}, get hourCycle() {
|
|
79
|
+
return ctx.hourCycle;
|
|
80
|
+
}, get minValue() {
|
|
81
|
+
return ctx.minValue;
|
|
82
|
+
}, get maxValue() {
|
|
83
|
+
return ctx.maxValue;
|
|
84
|
+
}, get isDisabled() {
|
|
85
|
+
return ctx.isDisabled;
|
|
86
|
+
}, get isReadOnly() {
|
|
87
|
+
return ctx.isReadOnly;
|
|
88
|
+
}, get name() {
|
|
89
|
+
return ctx.name;
|
|
90
|
+
}, get "data-date-picker"() {
|
|
91
|
+
return "";
|
|
92
|
+
}, get children() {
|
|
93
|
+
return (() => {
|
|
94
|
+
const _el$ = createNativeElement("div");
|
|
95
|
+
spread({ element: _el$, props: mergeProps(fxProps(
|
|
96
|
+
() => local.fx,
|
|
97
|
+
() => local.style
|
|
98
|
+
), others, { ref: setRef, "data-date-picker-control": "" }) });
|
|
99
|
+
insert(_el$, createMemo(() => createComponent(DateInput, { get "aria-labelledby"() {
|
|
100
|
+
return ctx.ids.label;
|
|
101
|
+
}, get "data-date-picker-input"() {
|
|
102
|
+
return "";
|
|
103
|
+
} })), null);
|
|
104
|
+
insert(_el$, local.children ?? createMemo(() => createComponent(DatePickerTrigger, {})));
|
|
105
|
+
return _el$;
|
|
106
|
+
})();
|
|
107
|
+
} }));
|
|
135
108
|
}
|
|
136
109
|
function DatePickerTrigger(props) {
|
|
137
110
|
const ctx = useDatePickerContext();
|
|
138
|
-
const [local, others] = splitProps(props, ["onClick", "children"]);
|
|
111
|
+
const [local, others] = splitProps(props, ["onClick", "children", "fx", "style"]);
|
|
139
112
|
return (() => {
|
|
140
113
|
const _el$ = createNativeElement("button");
|
|
141
|
-
spread({
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
onClick: composeEventHandlers([local.onClick, () => {
|
|
152
|
-
if (ctx.isDisabled() || ctx.isReadOnly()) return;
|
|
153
|
-
ctx.setOpen(!ctx.isOpen());
|
|
154
|
-
}])
|
|
155
|
-
})
|
|
156
|
-
});
|
|
114
|
+
spread({ element: _el$, props: mergeProps(fxProps(
|
|
115
|
+
() => local.fx,
|
|
116
|
+
() => local.style
|
|
117
|
+
), others, { type: "button", "aria-haspopup": "dialog", "aria-expanded": (() => ctx.isOpen() ? "true" : "false"), "aria-controls": () => ctx.ids.content, "aria-label": "Open calendar", disabled: (() => ctx.isDisabled()), "data-date-picker-trigger": "", onClick: composeEventHandlers([
|
|
118
|
+
local.onClick,
|
|
119
|
+
() => {
|
|
120
|
+
if (ctx.isDisabled() || ctx.isReadOnly()) return;
|
|
121
|
+
ctx.setOpen(!ctx.isOpen());
|
|
122
|
+
}
|
|
123
|
+
]) }) });
|
|
157
124
|
insert(_el$, local.children ?? "📅");
|
|
158
125
|
return _el$;
|
|
159
126
|
})();
|
|
160
127
|
}
|
|
161
128
|
function DatePickerContent(props) {
|
|
162
129
|
const ctx = useDatePickerContext();
|
|
163
|
-
const [local, others] = splitProps(props, ["ref", "children", "style"]);
|
|
130
|
+
const [local, others] = splitProps(props, ["ref", "children", "style", "fx", "style"]);
|
|
164
131
|
const [element, setElement] = createSignal(void 0);
|
|
165
132
|
const portalRef = useRef(null);
|
|
166
133
|
createEffect(() => {
|
|
167
134
|
if (!ctx.isOpen() && portalRef.current) portalRef.current.remove();
|
|
168
135
|
});
|
|
169
|
-
return createMemo(() => createComponent(Show, {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return local.style;
|
|
191
|
-
},
|
|
192
|
-
get children() {
|
|
193
|
-
return local.children ?? createMemo(() => createComponent(DatePickerCalendar, {}));
|
|
194
|
-
}
|
|
195
|
-
})));
|
|
196
|
-
}
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
}));
|
|
136
|
+
return createMemo(() => createComponent(Show, { get when() {
|
|
137
|
+
return ctx.isOpen();
|
|
138
|
+
}, get children() {
|
|
139
|
+
return createMemo(() => createComponent(Portal, { get ref() {
|
|
140
|
+
return portalRef;
|
|
141
|
+
}, get children() {
|
|
142
|
+
return createMemo(() => createComponent(FloatingPanel, mergeProps(others, { get setElement() {
|
|
143
|
+
return setElement;
|
|
144
|
+
}, get element() {
|
|
145
|
+
return element;
|
|
146
|
+
}, get forwardRef() {
|
|
147
|
+
return local.ref;
|
|
148
|
+
}, get fx() {
|
|
149
|
+
return local.fx;
|
|
150
|
+
}, get style() {
|
|
151
|
+
return local.style;
|
|
152
|
+
}, get children() {
|
|
153
|
+
return local.children ?? createMemo(() => createComponent(DatePickerCalendar, {}));
|
|
154
|
+
} })));
|
|
155
|
+
} }));
|
|
156
|
+
} }));
|
|
200
157
|
}
|
|
201
158
|
function FloatingPanel(props) {
|
|
202
159
|
const ctx = useDatePickerContext();
|
|
@@ -211,11 +168,7 @@ function FloatingPanel(props) {
|
|
|
211
168
|
},
|
|
212
169
|
onDismiss: () => ctx.setOpen(false)
|
|
213
170
|
});
|
|
214
|
-
createFocusScope(props.element, {
|
|
215
|
-
trap: false,
|
|
216
|
-
autoFocus: true,
|
|
217
|
-
restoreFocus: true
|
|
218
|
-
});
|
|
171
|
+
createFocusScope(props.element, { trap: false, autoFocus: true, restoreFocus: true });
|
|
219
172
|
createRenderEffect(() => {
|
|
220
173
|
const el = props.element();
|
|
221
174
|
if (!el) return;
|
|
@@ -229,73 +182,48 @@ function FloatingPanel(props) {
|
|
|
229
182
|
};
|
|
230
183
|
return (() => {
|
|
231
184
|
const _el$ = createNativeElement("div");
|
|
232
|
-
spread({
|
|
233
|
-
|
|
234
|
-
props
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
"data-date-picker-
|
|
240
|
-
"data-placement": () => position.placement(),
|
|
241
|
-
style: () => props.style,
|
|
242
|
-
tabindex: -1,
|
|
243
|
-
onKeyDown: (e) => {
|
|
244
|
-
if (e.key === "Escape") {
|
|
245
|
-
e.stopPropagation();
|
|
246
|
-
ctx.setOpen(false);
|
|
247
|
-
ctx.triggerRef()?.querySelector("[data-date-picker-trigger]")?.focus();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
185
|
+
spread({ element: _el$, props: mergeProps(fxProps(
|
|
186
|
+
() => props.fx,
|
|
187
|
+
() => props.style
|
|
188
|
+
), { ref: setRef, role: "dialog", id: () => ctx.ids.content, "aria-label": "Calendar", "data-date-picker-content": "", "data-placement": (() => position.placement()), tabindex: -1, onKeyDown: ((e) => {
|
|
189
|
+
if (e.key === "Escape") {
|
|
190
|
+
e.stopPropagation();
|
|
191
|
+
ctx.setOpen(false);
|
|
192
|
+
ctx.triggerRef()?.querySelector("[data-date-picker-trigger]")?.focus();
|
|
250
193
|
}
|
|
251
|
-
});
|
|
194
|
+
}) }) });
|
|
252
195
|
insert(_el$, props.children);
|
|
253
196
|
return _el$;
|
|
254
197
|
})();
|
|
255
198
|
}
|
|
256
199
|
function DatePickerCalendar() {
|
|
257
200
|
const ctx = useDatePickerContext();
|
|
258
|
-
return createMemo(() => createComponent(Calendar, {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
return [createMemo(() => createComponent(CalendarHeader, {
|
|
285
|
-
get children() {
|
|
286
|
-
return [createMemo(() => createComponent(CalendarPrevButton, {
|
|
287
|
-
get children() {
|
|
288
|
-
return "‹";
|
|
289
|
-
}
|
|
290
|
-
})), createMemo(() => createComponent(CalendarHeading, {})), createMemo(() => createComponent(CalendarNextButton, {
|
|
291
|
-
get children() {
|
|
292
|
-
return "›";
|
|
293
|
-
}
|
|
294
|
-
}))];
|
|
295
|
-
}
|
|
296
|
-
})), createMemo(() => createComponent(CalendarGrid, {}))];
|
|
297
|
-
}
|
|
298
|
-
}));
|
|
201
|
+
return createMemo(() => createComponent(Calendar, { get value() {
|
|
202
|
+
return ctx.value;
|
|
203
|
+
}, get onChange() {
|
|
204
|
+
return ((v) => {
|
|
205
|
+
ctx.setValue(v);
|
|
206
|
+
ctx.setOpen(false);
|
|
207
|
+
});
|
|
208
|
+
}, get locale() {
|
|
209
|
+
return ctx.locale;
|
|
210
|
+
}, get minValue() {
|
|
211
|
+
return ctx.minValue;
|
|
212
|
+
}, get maxValue() {
|
|
213
|
+
return ctx.maxValue;
|
|
214
|
+
}, get isDateUnavailable() {
|
|
215
|
+
return ctx.isDateUnavailable;
|
|
216
|
+
}, get "data-date-picker-calendar"() {
|
|
217
|
+
return "";
|
|
218
|
+
}, get children() {
|
|
219
|
+
return [createMemo(() => createComponent(CalendarHeader, { get children() {
|
|
220
|
+
return [createMemo(() => createComponent(CalendarPrevButton, { get children() {
|
|
221
|
+
return "‹";
|
|
222
|
+
} })), createMemo(() => createComponent(CalendarHeading, {})), createMemo(() => createComponent(CalendarNextButton, { get children() {
|
|
223
|
+
return "›";
|
|
224
|
+
} }))];
|
|
225
|
+
} })), createMemo(() => createComponent(CalendarGrid, {}))];
|
|
226
|
+
} }));
|
|
299
227
|
}
|
|
300
228
|
export {
|
|
301
229
|
DatePicker,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FxProp } from '@fluixi-ui/fx';
|
|
1
2
|
import { type Accessor } from '@fluixi/reactive/signal';
|
|
2
3
|
import { type Placement } from '@fluixi-ui/primitives';
|
|
3
4
|
import type { DateRange, DateValue, Granularity } from '@fluixi-ui/date-core';
|
|
@@ -57,19 +58,27 @@ export interface DateRangePickerProps {
|
|
|
57
58
|
*/
|
|
58
59
|
export declare function DateRangePicker(props: DateRangePickerProps): ComponentChild;
|
|
59
60
|
export interface DateRangePickerLabelProps extends HTMLAttributes<HTMLElement> {
|
|
61
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
62
|
+
fx?: FxProp;
|
|
60
63
|
}
|
|
61
64
|
/** Field label; linked to the range field group. */
|
|
62
65
|
export declare function DateRangePickerLabel(props: DateRangePickerLabelProps): ComponentChild;
|
|
63
66
|
export interface DateRangePickerFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
67
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
68
|
+
fx?: FxProp;
|
|
64
69
|
}
|
|
65
70
|
/** The bordered control: start field — end field, plus the calendar trigger. */
|
|
66
71
|
export declare function DateRangePickerField(props: DateRangePickerFieldProps): ComponentChild;
|
|
67
72
|
export interface DateRangePickerTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
73
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
74
|
+
fx?: FxProp;
|
|
68
75
|
}
|
|
69
76
|
/** Toggles the range-calendar popover. */
|
|
70
77
|
export declare function DateRangePickerTrigger(props: DateRangePickerTriggerProps): ComponentChild;
|
|
71
78
|
export interface DateRangePickerContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
72
79
|
children?: ComponentChild;
|
|
80
|
+
/** Token-aware style object. See `@fluixi-ui/fx`. */
|
|
81
|
+
fx?: FxProp;
|
|
73
82
|
}
|
|
74
83
|
/** The floating range-calendar panel; selecting a full range closes it. */
|
|
75
84
|
export declare function DateRangePickerContent(props: DateRangePickerContentProps): ComponentChild;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-picker.d.ts","sourceRoot":"","sources":["../src/date-range-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-range-picker.d.ts","sourceRoot":"","sources":["../src/date-range-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,KAAK,QAAQ,EAA2D,MAAM,yBAAyB,CAAC;AAUjH,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,u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