foldkit 0.61.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/anchor.d.ts +2 -1
- package/dist/ui/anchor.d.ts.map +1 -1
- package/dist/ui/anchor.js +24 -3
- package/dist/ui/calendar/index.d.ts +20 -3
- package/dist/ui/calendar/index.d.ts.map +1 -1
- package/dist/ui/calendar/index.js +22 -4
- package/dist/ui/calendar/public.d.ts +1 -1
- package/dist/ui/calendar/public.d.ts.map +1 -1
- package/dist/ui/calendar/public.js +1 -1
- package/dist/ui/combobox/multi.d.ts +17 -11
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/multi.js +8 -2
- package/dist/ui/combobox/multiPublic.d.ts +1 -1
- package/dist/ui/combobox/multiPublic.d.ts.map +1 -1
- package/dist/ui/combobox/multiPublic.js +1 -1
- package/dist/ui/combobox/public.d.ts +1 -1
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/public.js +1 -1
- package/dist/ui/combobox/single.d.ts +8 -2
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/combobox/single.js +7 -1
- package/dist/ui/datePicker/index.d.ts +246 -0
- package/dist/ui/datePicker/index.d.ts.map +1 -0
- package/dist/ui/datePicker/index.js +259 -0
- package/dist/ui/datePicker/public.d.ts +3 -0
- package/dist/ui/datePicker/public.d.ts.map +1 -0
- package/dist/ui/datePicker/public.js +1 -0
- package/dist/ui/dialog/index.d.ts +3 -0
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +3 -0
- package/dist/ui/dialog/public.d.ts +1 -1
- package/dist/ui/dialog/public.d.ts.map +1 -1
- package/dist/ui/dialog/public.js +1 -1
- package/dist/ui/disclosure/index.d.ts +3 -0
- package/dist/ui/disclosure/index.d.ts.map +1 -1
- package/dist/ui/disclosure/index.js +3 -0
- package/dist/ui/disclosure/public.d.ts +1 -1
- package/dist/ui/disclosure/public.d.ts.map +1 -1
- package/dist/ui/disclosure/public.js +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/ui/listbox/multi.d.ts +8 -2
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/multi.js +7 -1
- package/dist/ui/listbox/multiPublic.d.ts +1 -1
- package/dist/ui/listbox/multiPublic.d.ts.map +1 -1
- package/dist/ui/listbox/multiPublic.js +1 -1
- package/dist/ui/listbox/public.d.ts +1 -1
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/public.js +1 -1
- package/dist/ui/listbox/single.d.ts +8 -2
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/listbox/single.js +7 -1
- package/dist/ui/menu/index.d.ts +6 -0
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +7 -5
- package/dist/ui/menu/public.d.ts +1 -1
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/menu/public.js +1 -1
- package/dist/ui/popover/index.d.ts +4 -1
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +8 -9
- package/package.json +1 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { Option, Schema as S } from 'effect';
|
|
2
|
+
import * as Calendar from '../../calendar';
|
|
3
|
+
import type { CalendarDate } from '../../calendar';
|
|
4
|
+
import * as Command from '../../command';
|
|
5
|
+
import { type Attribute, type Html } from '../../html';
|
|
6
|
+
import type { AnchorConfig } from '../anchor';
|
|
7
|
+
import * as UiCalendar from '../calendar';
|
|
8
|
+
/** Schema for the date picker component's state. Holds the selected date,
|
|
9
|
+
* the embedded Calendar submodel (the visible grid), and the embedded Popover
|
|
10
|
+
* submodel (the open/close + transition layer). */
|
|
11
|
+
export declare const Model: S.Struct<{
|
|
12
|
+
id: typeof S.String;
|
|
13
|
+
maybeSelectedDate: S.OptionFromSelf<S.filter<S.Struct<{
|
|
14
|
+
year: typeof S.Int;
|
|
15
|
+
month: S.filter<typeof S.Int>;
|
|
16
|
+
day: S.filter<typeof S.Int>;
|
|
17
|
+
}>>>;
|
|
18
|
+
calendar: S.Struct<{
|
|
19
|
+
id: typeof S.String;
|
|
20
|
+
today: S.filter<S.Struct<{
|
|
21
|
+
year: typeof S.Int;
|
|
22
|
+
month: S.filter<typeof S.Int>;
|
|
23
|
+
day: S.filter<typeof S.Int>;
|
|
24
|
+
}>>;
|
|
25
|
+
viewYear: typeof S.Int;
|
|
26
|
+
viewMonth: S.filter<typeof S.Int>;
|
|
27
|
+
maybeFocusedDate: S.OptionFromSelf<S.filter<S.Struct<{
|
|
28
|
+
year: typeof S.Int;
|
|
29
|
+
month: S.filter<typeof S.Int>;
|
|
30
|
+
day: S.filter<typeof S.Int>;
|
|
31
|
+
}>>>;
|
|
32
|
+
maybeSelectedDate: S.OptionFromSelf<S.filter<S.Struct<{
|
|
33
|
+
year: typeof S.Int;
|
|
34
|
+
month: S.filter<typeof S.Int>;
|
|
35
|
+
day: S.filter<typeof S.Int>;
|
|
36
|
+
}>>>;
|
|
37
|
+
isGridFocused: typeof S.Boolean;
|
|
38
|
+
locale: S.Struct<{
|
|
39
|
+
firstDayOfWeek: S.Literal<["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]>;
|
|
40
|
+
monthNames: S.Tuple<[typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String]>;
|
|
41
|
+
shortMonthNames: S.Tuple<[typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String]>;
|
|
42
|
+
dayNames: S.Tuple<[typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String]>;
|
|
43
|
+
shortDayNames: S.Tuple<[typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String, typeof S.String]>;
|
|
44
|
+
}>;
|
|
45
|
+
maybeMinDate: S.OptionFromSelf<S.filter<S.Struct<{
|
|
46
|
+
year: typeof S.Int;
|
|
47
|
+
month: S.filter<typeof S.Int>;
|
|
48
|
+
day: S.filter<typeof S.Int>;
|
|
49
|
+
}>>>;
|
|
50
|
+
maybeMaxDate: S.OptionFromSelf<S.filter<S.Struct<{
|
|
51
|
+
year: typeof S.Int;
|
|
52
|
+
month: S.filter<typeof S.Int>;
|
|
53
|
+
day: S.filter<typeof S.Int>;
|
|
54
|
+
}>>>;
|
|
55
|
+
disabledDaysOfWeek: S.Array$<S.Literal<["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]>>;
|
|
56
|
+
disabledDates: S.Array$<S.filter<S.Struct<{
|
|
57
|
+
year: typeof S.Int;
|
|
58
|
+
month: S.filter<typeof S.Int>;
|
|
59
|
+
day: S.filter<typeof S.Int>;
|
|
60
|
+
}>>>;
|
|
61
|
+
}>;
|
|
62
|
+
popover: S.Struct<{
|
|
63
|
+
id: typeof S.String;
|
|
64
|
+
isOpen: typeof S.Boolean;
|
|
65
|
+
isAnimated: typeof S.Boolean;
|
|
66
|
+
isModal: typeof S.Boolean;
|
|
67
|
+
contentFocus: typeof S.Boolean;
|
|
68
|
+
transition: S.Struct<{
|
|
69
|
+
id: typeof S.String;
|
|
70
|
+
isShowing: typeof S.Boolean;
|
|
71
|
+
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
72
|
+
}>;
|
|
73
|
+
maybeLastButtonPointerType: S.OptionFromSelf<typeof S.String>;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
export type Model = typeof Model.Type;
|
|
77
|
+
/** Wraps a Calendar submodel message for delegation. */
|
|
78
|
+
export declare const GotCalendarMessage: import("../../schema").CallableTaggedStruct<"GotCalendarMessage", {
|
|
79
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"ClickedDay", {
|
|
80
|
+
date: S.filter<S.Struct<{
|
|
81
|
+
year: typeof S.Int;
|
|
82
|
+
month: S.filter<typeof S.Int>;
|
|
83
|
+
day: S.filter<typeof S.Int>;
|
|
84
|
+
}>>;
|
|
85
|
+
}>, import("../../schema").CallableTaggedStruct<"PressedKeyOnGrid", {
|
|
86
|
+
key: typeof S.String;
|
|
87
|
+
isShift: typeof S.Boolean;
|
|
88
|
+
}>, import("../../schema").CallableTaggedStruct<"ClickedPreviousMonthButton", {}>, import("../../schema").CallableTaggedStruct<"ClickedNextMonthButton", {}>, import("../../schema").CallableTaggedStruct<"SelectedMonthFromDropdown", {
|
|
89
|
+
month: typeof S.Int;
|
|
90
|
+
}>, import("../../schema").CallableTaggedStruct<"SelectedYearFromDropdown", {
|
|
91
|
+
year: typeof S.Int;
|
|
92
|
+
}>, import("../../schema").CallableTaggedStruct<"FocusedGrid", {}>, import("../../schema").CallableTaggedStruct<"BlurredGrid", {}>, import("../../schema").CallableTaggedStruct<"RefreshedToday", {
|
|
93
|
+
today: S.filter<S.Struct<{
|
|
94
|
+
year: typeof S.Int;
|
|
95
|
+
month: S.filter<typeof S.Int>;
|
|
96
|
+
day: S.filter<typeof S.Int>;
|
|
97
|
+
}>>;
|
|
98
|
+
}>, import("../../schema").CallableTaggedStruct<"CompletedFocusGrid", {}>]>;
|
|
99
|
+
}>;
|
|
100
|
+
/** Wraps a Popover submodel message for delegation. */
|
|
101
|
+
export declare const GotPopoverMessage: import("../../schema").CallableTaggedStruct<"GotPopoverMessage", {
|
|
102
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Opened", {}>, import("../../schema").CallableTaggedStruct<"Closed", {}>, import("../../schema").CallableTaggedStruct<"ClosedByTab", {}>, import("../../schema").CallableTaggedStruct<"PressedPointerOnButton", {
|
|
103
|
+
pointerType: typeof S.String;
|
|
104
|
+
button: typeof S.Number;
|
|
105
|
+
}>, import("../../schema").CallableTaggedStruct<"CompletedFocusPanel", {}>, import("../../schema").CallableTaggedStruct<"CompletedFocusButton", {}>, import("../../schema").CallableTaggedStruct<"CompletedLockScroll", {}>, import("../../schema").CallableTaggedStruct<"CompletedUnlockScroll", {}>, import("../../schema").CallableTaggedStruct<"CompletedSetupInert", {}>, import("../../schema").CallableTaggedStruct<"CompletedTeardownInert", {}>, import("../../schema").CallableTaggedStruct<"IgnoredMouseClick", {}>, import("../../schema").CallableTaggedStruct<"SuppressedSpaceScroll", {}>, import("../../schema").CallableTaggedStruct<"GotTransitionMessage", {
|
|
106
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedTransition", {}>]>;
|
|
107
|
+
}>]>;
|
|
108
|
+
}>;
|
|
109
|
+
/** Sent when the user commits a date via click or keyboard. Updates the
|
|
110
|
+
* selected date, syncs the calendar, and closes the popover. */
|
|
111
|
+
export declare const SelectedDate: import("../../schema").CallableTaggedStruct<"SelectedDate", {
|
|
112
|
+
date: S.filter<S.Struct<{
|
|
113
|
+
year: typeof S.Int;
|
|
114
|
+
month: S.filter<typeof S.Int>;
|
|
115
|
+
day: S.filter<typeof S.Int>;
|
|
116
|
+
}>>;
|
|
117
|
+
}>;
|
|
118
|
+
/** Sent when the user clears the selected date. Does not close the popover. */
|
|
119
|
+
export declare const Cleared: import("../../schema").CallableTaggedStruct<"Cleared", {}>;
|
|
120
|
+
/** Sent when the popover should open. Triggers focus-grid on the embedded
|
|
121
|
+
* Calendar so keyboard focus lands inside the grid instead of the panel. */
|
|
122
|
+
export declare const Opened: import("../../schema").CallableTaggedStruct<"Opened", {}>;
|
|
123
|
+
/** Sent when the popover should close. Delegates to Popover which returns
|
|
124
|
+
* focus to the trigger button. */
|
|
125
|
+
export declare const Closed: import("../../schema").CallableTaggedStruct<"Closed", {}>;
|
|
126
|
+
/** Union of all messages the date picker component can produce. */
|
|
127
|
+
export declare const Message: S.Union<[
|
|
128
|
+
typeof GotCalendarMessage,
|
|
129
|
+
typeof GotPopoverMessage,
|
|
130
|
+
typeof SelectedDate,
|
|
131
|
+
typeof Cleared,
|
|
132
|
+
typeof Opened,
|
|
133
|
+
typeof Closed
|
|
134
|
+
]>;
|
|
135
|
+
export type Message = typeof Message.Type;
|
|
136
|
+
/** Emitted when the visible month changes (propagated from the embedded
|
|
137
|
+
* Calendar). Useful for month-scoped data loading. */
|
|
138
|
+
export declare const ChangedViewMonth: import("../../schema").CallableTaggedStruct<"ChangedViewMonth", {
|
|
139
|
+
year: typeof S.Int;
|
|
140
|
+
month: typeof S.Int;
|
|
141
|
+
}>;
|
|
142
|
+
/** The date picker's OutMessage. Matches Calendar — only `ChangedViewMonth`.
|
|
143
|
+
* Date selection goes through the `onSelectedDate` ViewConfig callback, not
|
|
144
|
+
* OutMessage. */
|
|
145
|
+
export declare const OutMessage: import("../../schema").CallableTaggedStruct<"ChangedViewMonth", {
|
|
146
|
+
year: typeof S.Int;
|
|
147
|
+
month: typeof S.Int;
|
|
148
|
+
}>;
|
|
149
|
+
export type OutMessage = typeof OutMessage.Type;
|
|
150
|
+
/** Configuration for creating a date picker model with `init`. */
|
|
151
|
+
export type InitConfig = Readonly<{
|
|
152
|
+
id: string;
|
|
153
|
+
today: CalendarDate;
|
|
154
|
+
initialSelectedDate?: CalendarDate;
|
|
155
|
+
isAnimated?: boolean;
|
|
156
|
+
locale?: Calendar.LocaleConfig;
|
|
157
|
+
minDate?: CalendarDate;
|
|
158
|
+
maxDate?: CalendarDate;
|
|
159
|
+
disabledDaysOfWeek?: ReadonlyArray<Calendar.DayOfWeek>;
|
|
160
|
+
disabledDates?: ReadonlyArray<CalendarDate>;
|
|
161
|
+
}>;
|
|
162
|
+
/** Creates an initial date picker model from a config. The calendar and
|
|
163
|
+
* popover submodels are created with derived ids so their DOM elements stay
|
|
164
|
+
* addressable. The popover is opened in `contentFocus` mode so focus lands on
|
|
165
|
+
* the calendar grid instead of the panel. */
|
|
166
|
+
export declare const init: (config: InitConfig) => Model;
|
|
167
|
+
type UpdateReturn = readonly [
|
|
168
|
+
Model,
|
|
169
|
+
ReadonlyArray<Command.Command<Message>>,
|
|
170
|
+
Option.Option<OutMessage>
|
|
171
|
+
];
|
|
172
|
+
/** Processes a date picker message and returns the next model, commands, and
|
|
173
|
+
* optional OutMessage. */
|
|
174
|
+
export declare const update: (model: Model, message: Message) => UpdateReturn;
|
|
175
|
+
/** Programmatically opens the date picker, updating the model and returning
|
|
176
|
+
* focus and popover commands. Use this in domain-event handlers. */
|
|
177
|
+
export declare const open: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
178
|
+
/** Programmatically closes the date picker. Use this in domain-event handlers. */
|
|
179
|
+
export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
180
|
+
/** Programmatically selects a date, committing it and closing the popover. */
|
|
181
|
+
export declare const selectDate: (model: Model, date: CalendarDate) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
182
|
+
/** Programmatically clears the selected date. */
|
|
183
|
+
export declare const clear: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
184
|
+
/** Sets the minimum selectable date on the embedded calendar. Pass
|
|
185
|
+
* `Option.none()` to remove the minimum. Use this when the minimum derives
|
|
186
|
+
* from other Model state (e.g. a start date field whose current selection
|
|
187
|
+
* constrains an end date picker).
|
|
188
|
+
*
|
|
189
|
+
* Does NOT reconcile the current selection — if a previously-selected date
|
|
190
|
+
* is now below the new minimum, it remains selected. Callers should `clear`
|
|
191
|
+
* or reassign the selection explicitly if their domain requires it. */
|
|
192
|
+
export declare const setMinDate: (model: Model, maybeMinDate: Option.Option<CalendarDate>) => Model;
|
|
193
|
+
/** Sets the maximum selectable date on the embedded calendar. Pass
|
|
194
|
+
* `Option.none()` to remove the maximum. Does NOT reconcile the current
|
|
195
|
+
* selection. */
|
|
196
|
+
export declare const setMaxDate: (model: Model, maybeMaxDate: Option.Option<CalendarDate>) => Model;
|
|
197
|
+
/** Sets the list of individually-disabled dates on the embedded calendar.
|
|
198
|
+
* Pass an empty array to clear. Does NOT reconcile the current selection. */
|
|
199
|
+
export declare const setDisabledDates: (model: Model, disabledDates: ReadonlyArray<CalendarDate>) => Model;
|
|
200
|
+
/** Sets the days of the week that are disabled on the embedded calendar
|
|
201
|
+
* (e.g. weekends). Pass an empty array to clear. Does NOT reconcile the
|
|
202
|
+
* current selection. */
|
|
203
|
+
export declare const setDisabledDaysOfWeek: (model: Model, disabledDaysOfWeek: ReadonlyArray<Calendar.DayOfWeek>) => Model;
|
|
204
|
+
/** Configuration for rendering a date picker with `view`. */
|
|
205
|
+
export type ViewConfig<ParentMessage> = Readonly<{
|
|
206
|
+
model: Model;
|
|
207
|
+
toParentMessage: (message: Message) => ParentMessage;
|
|
208
|
+
/** Optional controlled-mode callback invoked when the user commits a date.
|
|
209
|
+
* When provided, the view dispatches this directly (parent owns the event).
|
|
210
|
+
* When omitted, DatePicker manages its own selection state. In controlled
|
|
211
|
+
* mode, use `DatePicker.selectDate(model, date)` to write the selection
|
|
212
|
+
* back into the date picker's internal state. */
|
|
213
|
+
onSelectedDate?: (date: CalendarDate) => ParentMessage;
|
|
214
|
+
anchor: AnchorConfig;
|
|
215
|
+
/** Renders the trigger button's content (typically the formatted selected
|
|
216
|
+
* date or a placeholder). Receives the current selection. */
|
|
217
|
+
triggerContent: (maybeDate: Option.Option<CalendarDate>) => Html;
|
|
218
|
+
/** Renders the calendar grid layout inside the popover panel. Mirrors
|
|
219
|
+
* `Calendar.ViewConfig['toView']` — the consumer lays out the attribute
|
|
220
|
+
* groups exactly as they would for an inline calendar. */
|
|
221
|
+
toCalendarView: (attributes: UiCalendar.CalendarAttributes<ParentMessage>) => Html;
|
|
222
|
+
isDisabled?: boolean;
|
|
223
|
+
/** Name for the hidden form input. When provided, a hidden `<input>` is
|
|
224
|
+
* rendered alongside the trigger so native form submission captures the
|
|
225
|
+
* selected date as an ISO string (`YYYY-MM-DD`). */
|
|
226
|
+
name?: string;
|
|
227
|
+
className?: string;
|
|
228
|
+
attributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
229
|
+
triggerClassName?: string;
|
|
230
|
+
triggerAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
231
|
+
panelClassName?: string;
|
|
232
|
+
panelAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
233
|
+
backdropClassName?: string;
|
|
234
|
+
backdropAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
235
|
+
}>;
|
|
236
|
+
/** Renders an accessible date picker: a trigger button that opens a popover
|
|
237
|
+
* containing an accessible calendar grid. The date picker assembles the
|
|
238
|
+
* embedded Calendar and Popover components into one flat API — consumers
|
|
239
|
+
* provide the trigger face and the calendar grid layout, DatePicker handles
|
|
240
|
+
* focus choreography, open/close state, and form submission. */
|
|
241
|
+
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
242
|
+
/** Creates a memoized date picker view. Static config is captured in a closure;
|
|
243
|
+
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
244
|
+
export declare const lazy: <ParentMessage>(staticConfig: Omit<ViewConfig<ParentMessage>, "model" | "toParentMessage">) => ((model: Model, toParentMessage: ViewConfig<ParentMessage>["toParentMessage"]) => Html);
|
|
245
|
+
export {};
|
|
246
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/datePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,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,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IACpD,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IACzD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;CAC7D,CAAC,CAAA;AAEF;;;;gEAIgE;AAChE,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IAuEF,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,cAAc,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,KACzE,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAC,KAC1D,IAAI,CAgBR,CAAA"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Effect, Match as M, Option, Schema as S } from 'effect';
|
|
2
|
+
import * as Calendar from '../../calendar';
|
|
3
|
+
import * as Command from '../../command';
|
|
4
|
+
import { createLazy, html } from '../../html';
|
|
5
|
+
import { m } from '../../message';
|
|
6
|
+
import { evo } from '../../struct';
|
|
7
|
+
import * as UiCalendar from '../calendar';
|
|
8
|
+
import * as Popover from '../popover';
|
|
9
|
+
// MODEL
|
|
10
|
+
/** Schema for the date picker component's state. Holds the selected date,
|
|
11
|
+
* the embedded Calendar submodel (the visible grid), and the embedded Popover
|
|
12
|
+
* submodel (the open/close + transition layer). */
|
|
13
|
+
export const Model = S.Struct({
|
|
14
|
+
id: S.String,
|
|
15
|
+
maybeSelectedDate: S.OptionFromSelf(Calendar.CalendarDate),
|
|
16
|
+
calendar: UiCalendar.Model,
|
|
17
|
+
popover: Popover.Model,
|
|
18
|
+
});
|
|
19
|
+
// MESSAGE
|
|
20
|
+
/** Wraps a Calendar submodel message for delegation. */
|
|
21
|
+
export const GotCalendarMessage = m('GotCalendarMessage', {
|
|
22
|
+
message: UiCalendar.Message,
|
|
23
|
+
});
|
|
24
|
+
/** Wraps a Popover submodel message for delegation. */
|
|
25
|
+
export const GotPopoverMessage = m('GotPopoverMessage', {
|
|
26
|
+
message: Popover.Message,
|
|
27
|
+
});
|
|
28
|
+
/** Sent when the user commits a date via click or keyboard. Updates the
|
|
29
|
+
* selected date, syncs the calendar, and closes the popover. */
|
|
30
|
+
export const SelectedDate = m('SelectedDate', { date: Calendar.CalendarDate });
|
|
31
|
+
/** Sent when the user clears the selected date. Does not close the popover. */
|
|
32
|
+
export const Cleared = m('Cleared');
|
|
33
|
+
/** Sent when the popover should open. Triggers focus-grid on the embedded
|
|
34
|
+
* Calendar so keyboard focus lands inside the grid instead of the panel. */
|
|
35
|
+
export const Opened = m('Opened');
|
|
36
|
+
/** Sent when the popover should close. Delegates to Popover which returns
|
|
37
|
+
* focus to the trigger button. */
|
|
38
|
+
export const Closed = m('Closed');
|
|
39
|
+
/** Union of all messages the date picker component can produce. */
|
|
40
|
+
export const Message = S.Union(GotCalendarMessage, GotPopoverMessage, SelectedDate, Cleared, Opened, Closed);
|
|
41
|
+
// OUT MESSAGE
|
|
42
|
+
/** Emitted when the visible month changes (propagated from the embedded
|
|
43
|
+
* Calendar). Useful for month-scoped data loading. */
|
|
44
|
+
export const ChangedViewMonth = m('ChangedViewMonth', {
|
|
45
|
+
year: S.Int,
|
|
46
|
+
month: S.Int,
|
|
47
|
+
});
|
|
48
|
+
/** The date picker's OutMessage. Matches Calendar — only `ChangedViewMonth`.
|
|
49
|
+
* Date selection goes through the `onSelectedDate` ViewConfig callback, not
|
|
50
|
+
* OutMessage. */
|
|
51
|
+
export const OutMessage = ChangedViewMonth;
|
|
52
|
+
/** Creates an initial date picker model from a config. The calendar and
|
|
53
|
+
* popover submodels are created with derived ids so their DOM elements stay
|
|
54
|
+
* addressable. The popover is opened in `contentFocus` mode so focus lands on
|
|
55
|
+
* the calendar grid instead of the panel. */
|
|
56
|
+
export const init = (config) => ({
|
|
57
|
+
id: config.id,
|
|
58
|
+
maybeSelectedDate: Option.fromNullable(config.initialSelectedDate),
|
|
59
|
+
calendar: UiCalendar.init({
|
|
60
|
+
id: `${config.id}-calendar`,
|
|
61
|
+
today: config.today,
|
|
62
|
+
...(config.initialSelectedDate !== undefined && {
|
|
63
|
+
initialSelectedDate: config.initialSelectedDate,
|
|
64
|
+
}),
|
|
65
|
+
...(config.locale !== undefined && { locale: config.locale }),
|
|
66
|
+
...(config.minDate !== undefined && { minDate: config.minDate }),
|
|
67
|
+
...(config.maxDate !== undefined && { maxDate: config.maxDate }),
|
|
68
|
+
...(config.disabledDaysOfWeek !== undefined && {
|
|
69
|
+
disabledDaysOfWeek: config.disabledDaysOfWeek,
|
|
70
|
+
}),
|
|
71
|
+
...(config.disabledDates !== undefined && {
|
|
72
|
+
disabledDates: config.disabledDates,
|
|
73
|
+
}),
|
|
74
|
+
}),
|
|
75
|
+
popover: Popover.init({
|
|
76
|
+
id: `${config.id}-popover`,
|
|
77
|
+
contentFocus: true,
|
|
78
|
+
...(config.isAnimated !== undefined && { isAnimated: config.isAnimated }),
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
const withUpdateReturn = M.withReturnType();
|
|
82
|
+
const mapCalendarCommands = (commands) => commands.map(Command.mapEffect(Effect.map(message => GotCalendarMessage({ message }))));
|
|
83
|
+
const mapPopoverCommands = (commands) => commands.map(Command.mapEffect(Effect.map(message => GotPopoverMessage({ message }))));
|
|
84
|
+
const mapCalendarOutMessage = (maybeOutMessage) => Option.map(maybeOutMessage, M.type().pipe(M.tagsExhaustive({
|
|
85
|
+
ChangedViewMonth: ({ year, month }) => ChangedViewMonth({ year, month }),
|
|
86
|
+
})));
|
|
87
|
+
const delegateToCalendar = (model, calendarMessage) => {
|
|
88
|
+
const [nextCalendar, calendarCommands, maybeCalendarOutMessage] = UiCalendar.update(model.calendar, calendarMessage);
|
|
89
|
+
return [
|
|
90
|
+
evo(model, { calendar: () => nextCalendar }),
|
|
91
|
+
mapCalendarCommands(calendarCommands),
|
|
92
|
+
mapCalendarOutMessage(maybeCalendarOutMessage),
|
|
93
|
+
];
|
|
94
|
+
};
|
|
95
|
+
const delegateToPopover = (model, popoverMessage) => {
|
|
96
|
+
const [nextPopover, popoverCommands] = Popover.update(model.popover, popoverMessage);
|
|
97
|
+
return [
|
|
98
|
+
evo(model, { popover: () => nextPopover }),
|
|
99
|
+
mapPopoverCommands(popoverCommands),
|
|
100
|
+
Option.none(),
|
|
101
|
+
];
|
|
102
|
+
};
|
|
103
|
+
/** Processes a date picker message and returns the next model, commands, and
|
|
104
|
+
* optional OutMessage. */
|
|
105
|
+
export const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
106
|
+
GotCalendarMessage: ({ message: calendarMessage }) => delegateToCalendar(model, calendarMessage),
|
|
107
|
+
GotPopoverMessage: ({ message: popoverMessage }) => delegateToPopover(model, popoverMessage),
|
|
108
|
+
Opened: () => {
|
|
109
|
+
const [nextPopover, popoverCommands] = Popover.open(model.popover);
|
|
110
|
+
return [
|
|
111
|
+
evo(model, { popover: () => nextPopover }),
|
|
112
|
+
mapPopoverCommands(popoverCommands),
|
|
113
|
+
Option.none(),
|
|
114
|
+
];
|
|
115
|
+
},
|
|
116
|
+
Closed: () => {
|
|
117
|
+
const [nextPopover, popoverCommands] = Popover.close(model.popover);
|
|
118
|
+
return [
|
|
119
|
+
evo(model, { popover: () => nextPopover }),
|
|
120
|
+
mapPopoverCommands(popoverCommands),
|
|
121
|
+
Option.none(),
|
|
122
|
+
];
|
|
123
|
+
},
|
|
124
|
+
SelectedDate: ({ date }) => {
|
|
125
|
+
const [nextCalendar, calendarCommands] = UiCalendar.selectDate(model.calendar, date);
|
|
126
|
+
const [nextPopover, popoverCommands] = Popover.close(model.popover);
|
|
127
|
+
return [
|
|
128
|
+
evo(model, {
|
|
129
|
+
maybeSelectedDate: () => Option.some(date),
|
|
130
|
+
calendar: () => nextCalendar,
|
|
131
|
+
popover: () => nextPopover,
|
|
132
|
+
}),
|
|
133
|
+
[
|
|
134
|
+
...mapCalendarCommands(calendarCommands),
|
|
135
|
+
...mapPopoverCommands(popoverCommands),
|
|
136
|
+
],
|
|
137
|
+
Option.none(),
|
|
138
|
+
];
|
|
139
|
+
},
|
|
140
|
+
Cleared: () => [
|
|
141
|
+
evo(model, { maybeSelectedDate: () => Option.none() }),
|
|
142
|
+
[],
|
|
143
|
+
Option.none(),
|
|
144
|
+
],
|
|
145
|
+
}));
|
|
146
|
+
/** Programmatically opens the date picker, updating the model and returning
|
|
147
|
+
* focus and popover commands. Use this in domain-event handlers. */
|
|
148
|
+
export const open = (model) => {
|
|
149
|
+
const [nextModel, commands] = toModelAndCommands(update(model, Opened()));
|
|
150
|
+
return [nextModel, commands];
|
|
151
|
+
};
|
|
152
|
+
/** Programmatically closes the date picker. Use this in domain-event handlers. */
|
|
153
|
+
export const close = (model) => {
|
|
154
|
+
const [nextModel, commands] = toModelAndCommands(update(model, Closed()));
|
|
155
|
+
return [nextModel, commands];
|
|
156
|
+
};
|
|
157
|
+
/** Programmatically selects a date, committing it and closing the popover. */
|
|
158
|
+
export const selectDate = (model, date) => {
|
|
159
|
+
const [nextModel, commands] = toModelAndCommands(update(model, SelectedDate({ date })));
|
|
160
|
+
return [nextModel, commands];
|
|
161
|
+
};
|
|
162
|
+
/** Programmatically clears the selected date. */
|
|
163
|
+
export const clear = (model) => {
|
|
164
|
+
const [nextModel, commands] = toModelAndCommands(update(model, Cleared()));
|
|
165
|
+
return [nextModel, commands];
|
|
166
|
+
};
|
|
167
|
+
/** Sets the minimum selectable date on the embedded calendar. Pass
|
|
168
|
+
* `Option.none()` to remove the minimum. Use this when the minimum derives
|
|
169
|
+
* from other Model state (e.g. a start date field whose current selection
|
|
170
|
+
* constrains an end date picker).
|
|
171
|
+
*
|
|
172
|
+
* Does NOT reconcile the current selection — if a previously-selected date
|
|
173
|
+
* is now below the new minimum, it remains selected. Callers should `clear`
|
|
174
|
+
* or reassign the selection explicitly if their domain requires it. */
|
|
175
|
+
export const setMinDate = (model, maybeMinDate) => evo(model, {
|
|
176
|
+
calendar: () => UiCalendar.setMinDate(model.calendar, maybeMinDate),
|
|
177
|
+
});
|
|
178
|
+
/** Sets the maximum selectable date on the embedded calendar. Pass
|
|
179
|
+
* `Option.none()` to remove the maximum. Does NOT reconcile the current
|
|
180
|
+
* selection. */
|
|
181
|
+
export const setMaxDate = (model, maybeMaxDate) => evo(model, {
|
|
182
|
+
calendar: () => UiCalendar.setMaxDate(model.calendar, maybeMaxDate),
|
|
183
|
+
});
|
|
184
|
+
/** Sets the list of individually-disabled dates on the embedded calendar.
|
|
185
|
+
* Pass an empty array to clear. Does NOT reconcile the current selection. */
|
|
186
|
+
export const setDisabledDates = (model, disabledDates) => evo(model, {
|
|
187
|
+
calendar: () => UiCalendar.setDisabledDates(model.calendar, disabledDates),
|
|
188
|
+
});
|
|
189
|
+
/** Sets the days of the week that are disabled on the embedded calendar
|
|
190
|
+
* (e.g. weekends). Pass an empty array to clear. Does NOT reconcile the
|
|
191
|
+
* current selection. */
|
|
192
|
+
export const setDisabledDaysOfWeek = (model, disabledDaysOfWeek) => evo(model, {
|
|
193
|
+
calendar: () => UiCalendar.setDisabledDaysOfWeek(model.calendar, disabledDaysOfWeek),
|
|
194
|
+
});
|
|
195
|
+
const toModelAndCommands = (result) => {
|
|
196
|
+
const [nextModel, commands] = result;
|
|
197
|
+
return [nextModel, commands];
|
|
198
|
+
};
|
|
199
|
+
// VIEW
|
|
200
|
+
const encodeIsoDate = S.encodeSync(Calendar.CalendarDateFromIsoString);
|
|
201
|
+
/** Renders an accessible date picker: a trigger button that opens a popover
|
|
202
|
+
* containing an accessible calendar grid. The date picker assembles the
|
|
203
|
+
* embedded Calendar and Popover components into one flat API — consumers
|
|
204
|
+
* provide the trigger face and the calendar grid layout, DatePicker handles
|
|
205
|
+
* focus choreography, open/close state, and form submission. */
|
|
206
|
+
export const view = (config) => {
|
|
207
|
+
const { Class, Name, Type, Value, div, input } = html();
|
|
208
|
+
const { model, toParentMessage, onSelectedDate, anchor, triggerContent, toCalendarView, isDisabled, name, className, attributes = [], triggerClassName, triggerAttributes = [], panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], } = config;
|
|
209
|
+
const dispatchSelectedDate = (date) => onSelectedDate !== undefined
|
|
210
|
+
? onSelectedDate(date)
|
|
211
|
+
: toParentMessage(SelectedDate({ date }));
|
|
212
|
+
const calendarVNode = UiCalendar.view({
|
|
213
|
+
model: model.calendar,
|
|
214
|
+
toParentMessage: message => toParentMessage(GotCalendarMessage({ message })),
|
|
215
|
+
onSelectedDate: dispatchSelectedDate,
|
|
216
|
+
toView: toCalendarView,
|
|
217
|
+
});
|
|
218
|
+
const popoverVNode = Popover.view({
|
|
219
|
+
model: model.popover,
|
|
220
|
+
toParentMessage: message => toParentMessage(GotPopoverMessage({ message })),
|
|
221
|
+
onOpened: () => toParentMessage(Opened()),
|
|
222
|
+
onClosed: () => toParentMessage(Closed()),
|
|
223
|
+
anchor,
|
|
224
|
+
buttonContent: triggerContent(model.maybeSelectedDate),
|
|
225
|
+
panelContent: calendarVNode,
|
|
226
|
+
focusSelector: `#${model.calendar.id}-grid`,
|
|
227
|
+
...(isDisabled !== undefined && { isDisabled }),
|
|
228
|
+
...(triggerClassName !== undefined && {
|
|
229
|
+
buttonClassName: triggerClassName,
|
|
230
|
+
}),
|
|
231
|
+
buttonAttributes: triggerAttributes,
|
|
232
|
+
...(panelClassName !== undefined && { panelClassName }),
|
|
233
|
+
panelAttributes,
|
|
234
|
+
...(backdropClassName !== undefined && { backdropClassName }),
|
|
235
|
+
backdropAttributes,
|
|
236
|
+
});
|
|
237
|
+
const hiddenInputValue = Option.match(model.maybeSelectedDate, {
|
|
238
|
+
onNone: () => '',
|
|
239
|
+
onSome: encodeIsoDate,
|
|
240
|
+
});
|
|
241
|
+
const maybeHiddenInput = name !== undefined
|
|
242
|
+
? [input([Type('hidden'), Name(name), Value(hiddenInputValue)])]
|
|
243
|
+
: [];
|
|
244
|
+
const wrapperAttributes = [
|
|
245
|
+
...(className !== undefined ? [Class(className)] : []),
|
|
246
|
+
...attributes,
|
|
247
|
+
];
|
|
248
|
+
return div(wrapperAttributes, [popoverVNode, ...maybeHiddenInput]);
|
|
249
|
+
};
|
|
250
|
+
/** Creates a memoized date picker view. Static config is captured in a closure;
|
|
251
|
+
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
252
|
+
export const lazy = (staticConfig) => {
|
|
253
|
+
const lazyView = createLazy();
|
|
254
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToMessage) => view({
|
|
255
|
+
...staticConfig,
|
|
256
|
+
model: currentModel,
|
|
257
|
+
toParentMessage: currentToMessage,
|
|
258
|
+
}), [model, toParentMessage]);
|
|
259
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { init, update, view, lazy, open, close, selectDate, clear, setMinDate, setMaxDate, setDisabledDates, setDisabledDaysOfWeek, Model, Message, OutMessage, GotCalendarMessage, GotPopoverMessage, SelectedDate, Cleared, Opened, Closed, ChangedViewMonth, } from './index';
|
|
2
|
+
export type { InitConfig, ViewConfig } from './index';
|
|
3
|
+
//# sourceMappingURL=public.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/datePicker/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,UAAU,EACV,KAAK,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,gBAAgB,GACjB,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { init, update, view, lazy, open, close, selectDate, clear, setMinDate, setMaxDate, setDisabledDates, setDisabledDaysOfWeek, Model, Message, OutMessage, GotCalendarMessage, GotPopoverMessage, SelectedDate, Cleared, Opened, Closed, ChangedViewMonth, } from './index';
|
|
@@ -76,6 +76,9 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
76
76
|
className?: string;
|
|
77
77
|
attributes?: ReadonlyArray<Attribute<Message>>;
|
|
78
78
|
}>;
|
|
79
|
+
/** Programmatically opens the dialog, updating the model and returning
|
|
80
|
+
* show commands. Use this in domain-event handlers to open the dialog. */
|
|
81
|
+
export declare const open: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
79
82
|
/** Programmatically closes the dialog, updating the model and returning
|
|
80
83
|
* close commands. Use this in domain-event handlers when the dialog uses `onClosed`. */
|
|
81
84
|
export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAsBxE,oIAAoI;AACpI,eAAO,MAAM,KAAK;;;;;;;;;;EAMhB,CAA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AAO,CAAA;IACxB,YAAY,EAAE,IAAI,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;2EAC2E;AAC3E,eAAO,MAAM,IAAI,GACf,OAAO,KAAK,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAClC,CAAA;AAEzB;yFACyF;AACzF,eAAO,MAAM,KAAK,GAChB,OAAO,KAAK,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAClC,CAAA;AAEzB,sGAAsG;AACtG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA8G3D,CAAA;AAED;;;;oDAIoD;AACpD,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,CAAC,EACnB,OAAO,GAAG,iBAAiB,GAAG,UAAU,GAAG,cAAc,CAC1D,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,EACvD,YAAY,EAAE,IAAI,KACf,IAAI,CAkBR,CAAA"}
|
package/dist/ui/dialog/index.js
CHANGED
|
@@ -110,6 +110,9 @@ export const update = (model, message) => M.value(message).pipe(withUpdateReturn
|
|
|
110
110
|
export const titleId = (model) => `${model.id}-title`;
|
|
111
111
|
/** Returns the ID used for `aria-describedby` on the dialog. Apply this to your description element. */
|
|
112
112
|
export const descriptionId = (model) => `${model.id}-description`;
|
|
113
|
+
/** Programmatically opens the dialog, updating the model and returning
|
|
114
|
+
* show commands. Use this in domain-event handlers to open the dialog. */
|
|
115
|
+
export const open = (model) => update(model, Opened());
|
|
113
116
|
/** Programmatically closes the dialog, updating the model and returning
|
|
114
117
|
* close commands. Use this in domain-event handlers when the dialog uses `onClosed`. */
|
|
115
118
|
export const close = (model) => update(model, Closed());
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, update, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage, ShowDialog, CloseDialog, } from './index';
|
|
1
|
+
export { init, update, open, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage, ShowDialog, CloseDialog, } from './index';
|
|
2
2
|
export type { InitConfig, ViewConfig } from './index';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/ui/dialog/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage, ShowDialog, CloseDialog, } from './index';
|
|
1
|
+
export { init, update, open, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage, ShowDialog, CloseDialog, } from './index';
|
|
@@ -57,6 +57,9 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
57
57
|
/** Programmatically toggles the disclosure, updating the model and returning
|
|
58
58
|
* focus commands. Use this in domain-event handlers when the disclosure uses `onToggled`. */
|
|
59
59
|
export declare const toggle: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
60
|
+
/** Programmatically closes the disclosure, updating the model and returning
|
|
61
|
+
* focus commands. Use this in domain-event handlers to close the disclosure. */
|
|
62
|
+
export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
60
63
|
/** Renders a headless disclosure component with accessible ARIA attributes and keyboard support. */
|
|
61
64
|
export declare const view: <Message>(config: ViewConfig<Message>) => Html;
|
|
62
65
|
/** Creates a memoized disclosure view. Static config is captured in a closure;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/disclosure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,KA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C,OAAO,CAAC,OAAO,CAAC,CAAC,CAClC,CAAA;AAEzB,oGAAoG;AACpG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAoG3D,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,CAAC,EACnB,OAAO,GAAG,iBAAiB,GAAG,WAAW,CAC1C,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
|
|
@@ -48,6 +48,9 @@ export const update = (model, message) => M.value(message).pipe(M.withReturnType
|
|
|
48
48
|
/** Programmatically toggles the disclosure, updating the model and returning
|
|
49
49
|
* focus commands. Use this in domain-event handlers when the disclosure uses `onToggled`. */
|
|
50
50
|
export const toggle = (model) => update(model, Toggled());
|
|
51
|
+
/** Programmatically closes the disclosure, updating the model and returning
|
|
52
|
+
* focus commands. Use this in domain-event handlers to close the disclosure. */
|
|
53
|
+
export const close = (model) => update(model, Closed());
|
|
51
54
|
/** Renders a headless disclosure component with accessible ARIA attributes and keyboard support. */
|
|
52
55
|
export const view = (config) => {
|
|
53
56
|
const { div, empty, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDownPreventDefault, Tabindex, Type, keyed, } = html();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, update, toggle, view, lazy, Model, Message, Toggled, Closed, CompletedFocusButton, FocusButton, } from './index';
|
|
1
|
+
export { init, update, toggle, close, view, lazy, Model, Message, Toggled, Closed, CompletedFocusButton, FocusButton, } from './index';
|
|
2
2
|
export type { InitConfig, ViewConfig } from './index';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/disclosure/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/disclosure/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, toggle, view, lazy, Model, Message, Toggled, Closed, CompletedFocusButton, FocusButton, } from './index';
|
|
1
|
+
export { init, update, toggle, close, view, lazy, Model, Message, Toggled, Closed, CompletedFocusButton, FocusButton, } from './index';
|