@foldkit/ui 0.150.0 → 0.151.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.
Files changed (78) hide show
  1. package/dist/animation/update.d.ts +10 -9
  2. package/dist/animation/update.d.ts.map +1 -1
  3. package/dist/animation/update.js +27 -35
  4. package/dist/calendar/index.d.ts +100 -11
  5. package/dist/calendar/index.d.ts.map +1 -1
  6. package/dist/calendar/index.js +66 -80
  7. package/dist/checkbox/index.d.ts +3 -4
  8. package/dist/checkbox/index.d.ts.map +1 -1
  9. package/dist/checkbox/index.js +3 -4
  10. package/dist/combobox/multi.d.ts +40 -51
  11. package/dist/combobox/multi.d.ts.map +1 -1
  12. package/dist/combobox/multi.js +19 -16
  13. package/dist/combobox/shared.d.ts +20 -20
  14. package/dist/combobox/shared.d.ts.map +1 -1
  15. package/dist/combobox/shared.js +134 -128
  16. package/dist/combobox/single.d.ts +38 -51
  17. package/dist/combobox/single.d.ts.map +1 -1
  18. package/dist/combobox/single.js +21 -17
  19. package/dist/datePicker/index.d.ts +182 -15
  20. package/dist/datePicker/index.d.ts.map +1 -1
  21. package/dist/datePicker/index.js +37 -54
  22. package/dist/dialog/index.d.ts +45 -7
  23. package/dist/dialog/index.d.ts.map +1 -1
  24. package/dist/dialog/index.js +54 -49
  25. package/dist/disclosure/index.d.ts +3 -4
  26. package/dist/disclosure/index.d.ts.map +1 -1
  27. package/dist/disclosure/index.js +3 -4
  28. package/dist/dragAndDrop/index.d.ts +96 -7
  29. package/dist/dragAndDrop/index.d.ts.map +1 -1
  30. package/dist/dragAndDrop/index.js +49 -61
  31. package/dist/fileDrop/index.d.ts +26 -11
  32. package/dist/fileDrop/index.d.ts.map +1 -1
  33. package/dist/fileDrop/index.js +16 -23
  34. package/dist/listbox/multi.d.ts +39 -52
  35. package/dist/listbox/multi.d.ts.map +1 -1
  36. package/dist/listbox/multi.js +9 -7
  37. package/dist/listbox/shared.d.ts +14 -22
  38. package/dist/listbox/shared.d.ts.map +1 -1
  39. package/dist/listbox/shared.js +113 -114
  40. package/dist/listbox/single.d.ts +40 -55
  41. package/dist/listbox/single.d.ts.map +1 -1
  42. package/dist/listbox/single.js +8 -7
  43. package/dist/menu/index.d.ts +131 -37
  44. package/dist/menu/index.d.ts.map +1 -1
  45. package/dist/menu/index.js +111 -120
  46. package/dist/popover/index.d.ts +71 -10
  47. package/dist/popover/index.d.ts.map +1 -1
  48. package/dist/popover/index.js +80 -73
  49. package/dist/radioGroup/index.d.ts +31 -19
  50. package/dist/radioGroup/index.d.ts.map +1 -1
  51. package/dist/radioGroup/index.js +18 -18
  52. package/dist/slider/index.d.ts +44 -13
  53. package/dist/slider/index.d.ts.map +1 -1
  54. package/dist/slider/index.js +33 -38
  55. package/dist/switch/index.d.ts +3 -4
  56. package/dist/switch/index.d.ts.map +1 -1
  57. package/dist/switch/index.js +3 -4
  58. package/dist/tabs/index.d.ts +31 -17
  59. package/dist/tabs/index.d.ts.map +1 -1
  60. package/dist/tabs/index.js +17 -17
  61. package/dist/test/apps/disabledButton.d.ts +17 -17
  62. package/dist/test/apps/disabledButton.d.ts.map +1 -1
  63. package/dist/test/apps/disabledButton.js +6 -4
  64. package/dist/toast/index.d.ts +96 -100
  65. package/dist/toast/index.d.ts.map +1 -1
  66. package/dist/toast/update.d.ts +97 -100
  67. package/dist/toast/update.d.ts.map +1 -1
  68. package/dist/toast/update.js +60 -58
  69. package/dist/tooltip/index.d.ts +2 -1
  70. package/dist/tooltip/index.d.ts.map +1 -1
  71. package/dist/tooltip/index.js +1 -1
  72. package/dist/tooltip/tooltip.d.ts +5 -10
  73. package/dist/tooltip/tooltip.d.ts.map +1 -1
  74. package/dist/tooltip/tooltip.js +45 -48
  75. package/dist/virtualList/index.d.ts +30 -29
  76. package/dist/virtualList/index.d.ts.map +1 -1
  77. package/dist/virtualList/index.js +21 -21
  78. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { Option, Schema as S } from 'effect';
2
- import type * as Command from 'foldkit/command';
2
+ import { type Update } from 'foldkit';
3
3
  import { type View as SubmodelView } from 'foldkit/submodel';
4
4
  import { type BaseInitConfig, type BaseViewInputsCommon, Message, OutMessage } from './shared.js';
5
5
  /** Schema for the single-select combobox's private interaction state (open/closed status, active item, activation trigger, typed input value). The selection is owned by the parent and passed in via `ViewInputs.maybeSelectedValue`. */
@@ -29,7 +29,10 @@ export type Model = typeof Model.Type;
29
29
  export type InitConfig = BaseInitConfig;
30
30
  /** Creates an initial single-select combobox model from a config. Defaults to closed with no active item and an empty input. */
31
31
  export declare const init: (config: InitConfig) => Model;
32
- /** Processes a combobox message and returns the next model, commands, and optional OutMessage. Closes the combobox on selection (single-select behavior); emits `Selected({ value })` for the parent to store, and `ClearedSelection` when a nullable combobox closes with an empty input. */
32
+ /** Processes a Combobox Message and returns the next Model, optional Commands,
33
+ * and an optional OutMessage. Selection closes the Combobox and emits
34
+ * `Selected({ value })` for the parent to store. A nullable Combobox also
35
+ * emits `ClearedSelection` when it closes with an empty input. */
33
36
  export declare const update: (model: {
34
37
  readonly id: string;
35
38
  readonly isOpen: boolean;
@@ -50,31 +53,29 @@ export declare const update: (model: {
50
53
  readonly screenX: number;
51
54
  readonly screenY: number;
52
55
  }>;
53
- }, message: Message) => readonly [{
54
- readonly id: string;
55
- readonly isOpen: boolean;
56
- readonly isAnimated: boolean;
57
- readonly isModal: boolean;
58
- readonly nullable: boolean;
59
- readonly immediate: boolean;
60
- readonly selectInputOnFocus: boolean;
61
- readonly animation: {
56
+ }, message: Message) => Readonly<{
57
+ model: {
62
58
  readonly id: string;
63
- readonly isShowing: boolean;
64
- readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
59
+ readonly isOpen: boolean;
60
+ readonly isAnimated: boolean;
61
+ readonly isModal: boolean;
62
+ readonly nullable: boolean;
63
+ readonly immediate: boolean;
64
+ readonly selectInputOnFocus: boolean;
65
+ readonly animation: {
66
+ readonly id: string;
67
+ readonly isShowing: boolean;
68
+ readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
69
+ };
70
+ readonly maybeActiveItemIndex: Option.Option<number>;
71
+ readonly activationTrigger: "Pointer" | "Keyboard";
72
+ readonly inputValue: string;
73
+ readonly maybeLastPointerPosition: Option.Option<{
74
+ readonly screenX: number;
75
+ readonly screenY: number;
76
+ }>;
65
77
  };
66
- readonly maybeActiveItemIndex: Option.Option<number>;
67
- readonly activationTrigger: "Pointer" | "Keyboard";
68
- readonly inputValue: string;
69
- readonly maybeLastPointerPosition: Option.Option<{
70
- readonly screenX: number;
71
- readonly screenY: number;
72
- }>;
73
- }, readonly Readonly<{
74
- name: string;
75
- args?: Record<string, unknown>;
76
- key?: string;
77
- effect: import("effect/Effect").Effect<{
78
+ commands?: Update.Commands<{
78
79
  readonly _tag: "CompletedLockScroll";
79
80
  } | {
80
81
  readonly _tag: "CompletedUnlockScroll";
@@ -149,14 +150,15 @@ export declare const update: (model: {
149
150
  readonly _tag: "CompletedAttachComboboxSelectOnFocus";
150
151
  } | {
151
152
  readonly _tag: "CompletedPortalComboboxBackdrop";
152
- }, never, never>;
153
- }>[], Option.Option<OutMessage<string>>];
153
+ }, never>;
154
+ outMessage?: OutMessage<string>;
155
+ }>;
154
156
  type UpdateReturn = ReturnType<typeof update>;
155
- /** Programmatically opens the combobox, updating the model and returning
156
- * focus and modal commands. Use this in domain-event handlers to open the combobox. */
157
+ /** Programmatically opens the Combobox, updating the Model and returning
158
+ * focus and modal Commands. Use this in domain-event handlers. */
157
159
  export declare const open: (model: Model) => UpdateReturn;
158
- /** Programmatically closes the combobox, updating the model and returning
159
- * focus and modal commands. `restingInputValue` is the text the input
160
+ /** Programmatically closes the Combobox, updating the Model and returning
161
+ * focus and modal Commands. `restingInputValue` is the text the input
160
162
  * returns to (the parent-owned selection's display text, or empty). Use
161
163
  * this in domain-event handlers to close the combobox. */
162
164
  export declare const close: (model: Model, restingInputValue: string) => UpdateReturn;
@@ -175,6 +177,7 @@ export type ViewInputs<Item extends string> = BaseViewInputsCommon<Item> & Reado
175
177
  * submitted under `formName`. */
176
178
  maybeSelectedValue: Option.Option<Item>;
177
179
  }>;
180
+ type BundleUpdateReturn<Item extends string> = Update.ReturnWithOutMessage<Model, Message, OutMessage<Item>>;
178
181
  /** The `view`, `update`, and programmatic helpers that `Combobox.create`
179
182
  * returns, bound to one `Item` type. Name it to annotate a value that
180
183
  * holds a created bundle, such as a field on a config object or a
@@ -182,26 +185,10 @@ export type ViewInputs<Item extends string> = BaseViewInputsCommon<Item> & Reado
182
185
  * itself. */
183
186
  export type Bundle<Item extends string = string> = Readonly<{
184
187
  view: SubmodelView<Model, Message, ViewInputs<Item>>;
185
- update: (model: Model, message: Message) => readonly [
186
- Model,
187
- ReadonlyArray<Command.Command<Message>>,
188
- Option.Option<OutMessage<Item>>
189
- ];
190
- selectItem: (model: Model, item: Item, displayText: string) => readonly [
191
- Model,
192
- ReadonlyArray<Command.Command<Message>>,
193
- Option.Option<OutMessage<Item>>
194
- ];
195
- open: (model: Model) => readonly [
196
- Model,
197
- ReadonlyArray<Command.Command<Message>>,
198
- Option.Option<OutMessage<Item>>
199
- ];
200
- close: (model: Model, restingInputValue: string) => readonly [
201
- Model,
202
- ReadonlyArray<Command.Command<Message>>,
203
- Option.Option<OutMessage<Item>>
204
- ];
188
+ update: (model: Model, message: Message) => BundleUpdateReturn<Item>;
189
+ selectItem: (model: Model, item: Item, displayText: string) => BundleUpdateReturn<Item>;
190
+ open: (model: Model) => BundleUpdateReturn<Item>;
191
+ close: (model: Model, restingInputValue: string) => BundleUpdateReturn<Item>;
205
192
  }>;
206
193
  /** Pairs the single-select combobox's `view` and `update` (and programmatic
207
194
  * helpers) behind a single Item-typed entry point. See `Listbox.create`
@@ -1 +1 @@
1
- {"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,C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M,MAAM,UAAU,CAAC,IAAI,SAAS,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,GACtE,QAAQ,CAAC;IACP;;;sCAGkC;IAClC,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CACxC,CAAC,CAAA;AAIJ,KAAK,kBAAkB,CAAC,IAAI,SAAS,MAAM,IAAI,MAAM,CAAC,oBAAoB,CACxE,KAAK,EACL,OAAO,EACP,UAAU,CAAC,IAAI,CAAC,CACjB,CAAA;AAED;;;;cAIc;AACd,MAAM,MAAM,MAAM,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC1D,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IACpD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACpE,UAAU,EAAE,CACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,KAChB,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAC7B,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAChD,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;CAC7E,CAAC,CAAA;AAEF;;;;;wDAKwD;AACxD,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,IAAI,CAuClE,CAAA"}
@@ -11,36 +11,40 @@ export const Model = S.Struct({
11
11
  /** Creates an initial single-select combobox model from a config. Defaults to closed with no active item and an empty input. */
12
12
  export const init = (config) => __foldkitBrandViewResult((baseInit(config)), "@foldkit/ui/combobox/single.js#init");
13
13
  // UPDATE
14
- /** Processes a combobox message and returns the next model, commands, and optional OutMessage. Closes the combobox on selection (single-select behavior); emits `Selected({ value })` for the parent to store, and `ClearedSelection` when a nullable combobox closes with an empty input. */
14
+ /** Processes a Combobox Message and returns the next Model, optional Commands,
15
+ * and an optional OutMessage. Selection closes the Combobox and emits
16
+ * `Selected({ value })` for the parent to store. A nullable Combobox also
17
+ * emits `ClearedSelection` when it closes with an empty input. */
15
18
  export const update = makeUpdate({
16
19
  handleClose: (model, restingInputValue, isClearable) => {
17
20
  if (isClearable && model.nullable && model.inputValue === '') {
18
- return __foldkitBrandViewResult(([
19
- evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/single.js#inputValue") }),
20
- Option.some(OutMessage.ClearedSelection()),
21
- ]), "@foldkit/ui/combobox/single.js#handleClose");
21
+ return __foldkitBrandViewResult(({
22
+ model: evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/single.js#inputValue") }),
23
+ outMessage: OutMessage.ClearedSelection(),
24
+ }), "@foldkit/ui/combobox/single.js#handleClose");
22
25
  }
23
- return __foldkitBrandViewResult(([
24
- evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((restingInputValue), "@foldkit/ui/combobox/single.js#inputValue~2") }),
25
- Option.none(),
26
- ]), "@foldkit/ui/combobox/single.js#handleClose");
26
+ return __foldkitBrandViewResult(({
27
+ model: evo(closedBaseModel(model), {
28
+ inputValue: () => __foldkitBrandViewResult((restingInputValue), "@foldkit/ui/combobox/single.js#inputValue~2"),
29
+ }),
30
+ }), "@foldkit/ui/combobox/single.js#handleClose");
27
31
  },
28
32
  handleSelectedItem: (model, item, displayText, wasSelected, context) => {
29
33
  const nullableDeselect = model.nullable && wasSelected;
30
34
  return __foldkitBrandViewResult((context.closeWithFocus(evo(closedBaseModel(model), {
31
35
  inputValue: () => (__foldkitBrandViewResult((nullableDeselect ? '' : displayText), "@foldkit/ui/combobox/single.js#inputValue~3")),
32
- }), Option.some(OutMessage.Selected({ value: item })))), "@foldkit/ui/combobox/single.js#handleSelectedItem");
36
+ }), OutMessage.Selected({ value: item }))), "@foldkit/ui/combobox/single.js#handleSelectedItem");
33
37
  },
34
- handleImmediateActivation: (model, item) => __foldkitBrandViewResult(([
38
+ handleImmediateActivation: (model, item) => (__foldkitBrandViewResult(({
35
39
  model,
36
- Option.some(OutMessage.Selected({ value: item })),
37
- ]), "@foldkit/ui/combobox/single.js#handleImmediateActivation"),
40
+ outMessage: OutMessage.Selected({ value: item }),
41
+ }), "@foldkit/ui/combobox/single.js#handleImmediateActivation")),
38
42
  });
39
- /** Programmatically opens the combobox, updating the model and returning
40
- * focus and modal commands. Use this in domain-event handlers to open the combobox. */
43
+ /** Programmatically opens the Combobox, updating the Model and returning
44
+ * focus and modal Commands. Use this in domain-event handlers. */
41
45
  export const open = (model) => __foldkitBrandViewResult((update(model, Message.Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/combobox/single.js#open");
42
- /** Programmatically closes the combobox, updating the model and returning
43
- * focus and modal commands. `restingInputValue` is the text the input
46
+ /** Programmatically closes the Combobox, updating the Model and returning
47
+ * focus and modal Commands. `restingInputValue` is the text the input
44
48
  * returns to (the parent-owned selection's display text, or empty). Use
45
49
  * this in domain-event handlers to close the combobox. */
46
50
  export const close = (model, restingInputValue) => __foldkitBrandViewResult((update(model, Message.Closed({ restingInputValue, isClearable: true }))), "@foldkit/ui/combobox/single.js#close");
@@ -1,9 +1,9 @@
1
1
  import { Option, Schema as S } from 'effect';
2
2
  import * as Calendar from 'foldkit/calendar';
3
3
  import type { CalendarDate } from 'foldkit/calendar';
4
- import * as Command from 'foldkit/command';
5
4
  import type { ChildAttribute, Html } from 'foldkit/html';
6
5
  import { type Reflect } from 'foldkit/submodel';
6
+ import * as Update from 'foldkit/update';
7
7
  import type { AnchorConfig } from '../anchor/index.js';
8
8
  import * as UiCalendar from '../calendar/index.js';
9
9
  /** Schema for the date picker component's private interaction state. The
@@ -186,16 +186,183 @@ export type InitConfig = Readonly<{
186
186
  * opened in `contentFocus` mode so focus lands on the calendar grid instead of
187
187
  * the panel. */
188
188
  export declare const init: (config: InitConfig) => Model;
189
- type UpdateReturn = readonly [
190
- Model,
191
- ReadonlyArray<Command.Command<Message>>,
192
- Option.Option<OutMessage>
193
- ];
194
- /** Processes a date picker message and returns the next model, commands, and
195
- * optional OutMessage. */
196
- export declare const update: (model: Model, message: Message) => UpdateReturn;
197
- /** Programmatically opens the date picker, updating the model and returning
198
- * focus and popover commands. Use this in domain-event handlers. */
189
+ type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
190
+ /** Processes a DatePicker Message and returns the next Model, optional
191
+ * Commands, and an optional OutMessage. */
192
+ export declare const update: (model: Model, message: Message) => Readonly<{
193
+ model: {
194
+ readonly id: string;
195
+ readonly calendar: {
196
+ readonly id: string;
197
+ readonly today: {
198
+ readonly year: number;
199
+ readonly month: number;
200
+ readonly day: number;
201
+ };
202
+ readonly viewYear: number;
203
+ readonly viewMonth: number;
204
+ readonly viewMode: "Days" | "Months" | "Years";
205
+ readonly maybeFocusedDate: Option.Option<{
206
+ readonly year: number;
207
+ readonly month: number;
208
+ readonly day: number;
209
+ }>;
210
+ readonly isGridFocused: boolean;
211
+ readonly locale: {
212
+ readonly firstDayOfWeek: "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday";
213
+ readonly monthNames: readonly [string, string, string, string, string, string, string, string, string, string, string, string];
214
+ readonly shortMonthNames: readonly [string, string, string, string, string, string, string, string, string, string, string, string];
215
+ readonly dayNames: readonly [string, string, string, string, string, string, string];
216
+ readonly shortDayNames: readonly [string, string, string, string, string, string, string];
217
+ };
218
+ readonly maybeMinDate: Option.Option<{
219
+ readonly year: number;
220
+ readonly month: number;
221
+ readonly day: number;
222
+ }>;
223
+ readonly maybeMaxDate: Option.Option<{
224
+ readonly year: number;
225
+ readonly month: number;
226
+ readonly day: number;
227
+ }>;
228
+ readonly disabledDaysOfWeek: readonly ("Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday")[];
229
+ readonly disabledDates: readonly {
230
+ readonly year: number;
231
+ readonly month: number;
232
+ readonly day: number;
233
+ }[];
234
+ };
235
+ readonly popover: {
236
+ readonly id: string;
237
+ readonly isOpen: boolean;
238
+ readonly isAnimated: boolean;
239
+ readonly isModal: boolean;
240
+ readonly contentFocus: boolean;
241
+ readonly animation: {
242
+ readonly id: string;
243
+ readonly isShowing: boolean;
244
+ readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
245
+ };
246
+ readonly maybeLastButtonPointerType: Option.Option<string>;
247
+ };
248
+ };
249
+ commands?: Update.Commands<{
250
+ readonly _tag: "Opened";
251
+ } | {
252
+ readonly _tag: "Closed";
253
+ } | {
254
+ readonly _tag: "GotCalendarMessage";
255
+ readonly message: {
256
+ readonly _tag: "ClickedDay";
257
+ readonly date: {
258
+ readonly year: number;
259
+ readonly month: number;
260
+ readonly day: number;
261
+ };
262
+ } | {
263
+ readonly _tag: "PressedKeyOnGrid";
264
+ readonly key: string;
265
+ readonly isShift: boolean;
266
+ } | {
267
+ readonly _tag: "ClickedPreviousMonthButton";
268
+ } | {
269
+ readonly _tag: "ClickedNextMonthButton";
270
+ } | {
271
+ readonly _tag: "ClickedHeading";
272
+ } | {
273
+ readonly _tag: "SelectedMonth";
274
+ readonly month: number;
275
+ } | {
276
+ readonly _tag: "SelectedYear";
277
+ readonly year: number;
278
+ } | {
279
+ readonly _tag: "PagedYears";
280
+ readonly direction: 1 | -1;
281
+ } | {
282
+ readonly _tag: "FocusedGrid";
283
+ } | {
284
+ readonly _tag: "BlurredGrid";
285
+ } | {
286
+ readonly _tag: "RefreshedToday";
287
+ readonly today: {
288
+ readonly year: number;
289
+ readonly month: number;
290
+ readonly day: number;
291
+ };
292
+ } | {
293
+ readonly _tag: "CompletedFocusGrid";
294
+ };
295
+ } | {
296
+ readonly _tag: "GotPopoverMessage";
297
+ readonly message: {
298
+ readonly _tag: "RequestedOpen";
299
+ } | {
300
+ readonly _tag: "RequestedClose";
301
+ } | {
302
+ readonly _tag: "BlurredPanel";
303
+ } | {
304
+ readonly _tag: "PressedPointerOnButton";
305
+ readonly pointerType: string;
306
+ readonly button: number;
307
+ } | {
308
+ readonly _tag: "IgnoredMouseClick";
309
+ } | {
310
+ readonly _tag: "SuppressedSpaceScroll";
311
+ } | {
312
+ readonly _tag: "CompletedFocusPanel";
313
+ } | {
314
+ readonly _tag: "CompletedFocusButton";
315
+ } | {
316
+ readonly _tag: "CompletedLockScroll";
317
+ } | {
318
+ readonly _tag: "CompletedUnlockScroll";
319
+ } | {
320
+ readonly _tag: "CompletedInertOthers";
321
+ } | {
322
+ readonly _tag: "CompletedRestoreInert";
323
+ } | {
324
+ readonly _tag: "CompletedAnchorPopover";
325
+ } | {
326
+ readonly _tag: "CompletedPortalPopoverBackdrop";
327
+ } | {
328
+ readonly _tag: "GotAnimationMessage";
329
+ readonly message: {
330
+ readonly _tag: "Showed";
331
+ } | {
332
+ readonly _tag: "Hid";
333
+ } | {
334
+ readonly _tag: "CompletedWaitForPaint";
335
+ } | {
336
+ readonly _tag: "EndedAnimation";
337
+ };
338
+ };
339
+ } | {
340
+ readonly _tag: "RequestedSelectDate";
341
+ readonly date: {
342
+ readonly year: number;
343
+ readonly month: number;
344
+ readonly day: number;
345
+ };
346
+ } | {
347
+ readonly _tag: "Cleared";
348
+ }, never>;
349
+ outMessage?: {
350
+ readonly _tag: "ChangedViewMonth";
351
+ readonly year: number;
352
+ readonly month: number;
353
+ } | {
354
+ readonly _tag: "SelectedDate";
355
+ readonly date: {
356
+ readonly year: number;
357
+ readonly month: number;
358
+ readonly day: number;
359
+ };
360
+ } | {
361
+ readonly _tag: "ClearedDate";
362
+ };
363
+ }>;
364
+ /** Programmatically opens the DatePicker, updating the Model and returning
365
+ * focus and Popover Commands. Use this in domain-event handlers. */
199
366
  export declare const open: (model: Model) => UpdateReturn;
200
367
  /** Programmatically closes the date picker. Use this in domain-event handlers. */
201
368
  export declare const close: (model: Model) => UpdateReturn;
@@ -207,7 +374,7 @@ export declare const clear: (model: Model) => UpdateReturn;
207
374
  * the selection (which the parent owns). Use it to navigate the picker onto a
208
375
  * known date, for example after the parent sets its value externally (a URL
209
376
  * parameter, a saved draft) so opening the picker shows that month. Returns
210
- * the model directly because it produces no commands and no OutMessage. */
377
+ * the Model directly because it produces no Commands and no OutMessage. */
211
378
  export declare const focusDate: Reflect<Model, CalendarDate>;
212
379
  /** Reflects the minimum selectable date onto the embedded calendar. Pass
213
380
  * `Option.none()` to remove the minimum. Use this when the minimum derives
@@ -239,9 +406,9 @@ export declare const triggerId: (id: string) => string;
239
406
  /** Per-render view inputs passed to `view` via `h.submodel`'s `viewInputs` field.
240
407
  *
241
408
  * The DatePicker emits a `SelectedDate({ date })` OutMessage when the
242
- * user commits a date. Consumers pattern-match this in their
243
- * `GotDatePickerMessage` handler (third tuple element of
244
- * `DatePicker.update`'s return) to lift the date into domain state. */
409
+ * user commits a date. Handle it in the `foldOutMessage` of the
410
+ * DatePicker's `Update.foldChild` config to lift the date into domain
411
+ * state. */
245
412
  export type ViewInputs = Readonly<{
246
413
  anchor: AnchorConfig;
247
414
  /** The selected date, read straight from the parent Model. The trigger
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAa,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC7E,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGxD,OAAO,EAAE,KAAK,OAAO,EAAc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CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI;IAChE;;6BAEyB;oBACT,CAAC,UAAU,EAAE,UAAU,CAAC,kBAAkB,KAAK,IAAI;iBACtD,OAAO;IACpB;;wDAEoD;WAC7C,MAAM;gBACD,MAAM;iBACL,aAAa,CAAC,cAAc,CAAC;uBACvB,MAAM;wBACL,aAAa,CAAC,cAAc,CAAC;gBACrC,MAAM;qBACD,MAAM;qBACN,MAAM;sBACL,aAAa,CAAC,cAAc,CAAC;wBAC3B,MAAM;yBACL,aAAa,CAAC,cAAc,CAAC;GAoHnD,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import { Function, Match as M, Option, Predicate, Schema as S } from 'effect';
3
3
  import * as Calendar from 'foldkit/calendar';
4
- import * as Command from 'foldkit/command';
5
4
  import { defineMessageUnion } from 'foldkit/message';
6
5
  import { evo } from 'foldkit/struct';
7
6
  import { defineView } from 'foldkit/submodel';
@@ -70,12 +69,9 @@ export const init = (config) => (__foldkitBrandViewResult(({
70
69
  ...(config.isAnimated !== undefined && { isAnimated: config.isAnimated }),
71
70
  }),
72
71
  }), "@foldkit/ui/datePicker/index.js#init"));
73
- const mapCalendarCommands = (commands) => __foldkitBrandViewResult((Command.mapMessages(commands, message => __foldkitBrandViewResult((Message.GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#anonymous"))), "@foldkit/ui/datePicker/index.js#mapCalendarCommands");
74
- const mapPopoverCommands = (commands) => __foldkitBrandViewResult((Command.mapMessages(commands, message => __foldkitBrandViewResult((Message.GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#anonymous~2"))), "@foldkit/ui/datePicker/index.js#mapPopoverCommands");
75
- const dropCalendarToDays = model => __foldkitBrandViewResult(([
76
- evo(model, { calendar: () => __foldkitBrandViewResult((UiCalendar.dropToDays(model.calendar)), "@foldkit/ui/datePicker/index.js#calendar") }),
77
- [],
78
- ]), "@foldkit/ui/datePicker/index.js#dropCalendarToDays");
72
+ const dropCalendarToDays = model => (__foldkitBrandViewResult(({
73
+ model: evo(model, { calendar: UiCalendar.dropToDays }),
74
+ }), "@foldkit/ui/datePicker/index.js#dropCalendarToDays"));
79
75
  const readPopover = (model) => __foldkitBrandViewResult((Option.some(model.popover)), "@foldkit/ui/datePicker/index.js#readPopover");
80
76
  const writePopover = (model, nextPopover) => __foldkitBrandViewResult((evo(model, { popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover") })), "@foldkit/ui/datePicker/index.js#writePopover");
81
77
  const toGotPopoverMessage = (message) => __foldkitBrandViewResult((Message.GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#toGotPopoverMessage");
@@ -88,7 +84,6 @@ const foldPopover = Update.foldChild({
88
84
  read: readPopover,
89
85
  write: writePopover,
90
86
  toParentMessage: toGotPopoverMessage,
91
- toParentOutMessage: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/datePicker/index.js#toParentOutMessage"),
92
87
  foldOutMessage: foldPopoverOutMessage,
93
88
  });
94
89
  const foldPopoverOpen = Update.foldChildStep({
@@ -106,53 +101,41 @@ const foldPopoverClose = Update.foldChildStep({
106
101
  foldOutMessage: foldPopoverOutMessage,
107
102
  });
108
103
  const foldCalendarOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
109
- ChangedViewMonth: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/datePicker/index.js#anonymous~3")), "@foldkit/ui/datePicker/index.js#ChangedViewMonth"),
104
+ ChangedViewMonth: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/datePicker/index.js#anonymous"))), "@foldkit/ui/datePicker/index.js#ChangedViewMonth"),
110
105
  SelectedDate: () => __foldkitBrandViewResult((foldPopoverClose), "@foldkit/ui/datePicker/index.js#SelectedDate"),
111
106
  }));
112
107
  const toDatePickerOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
113
- ChangedViewMonth: ({ year, month }) => __foldkitBrandViewResult((Option.some(OutMessage.ChangedViewMonth({ year, month }))), "@foldkit/ui/datePicker/index.js#ChangedViewMonth~2"),
114
- SelectedDate: ({ date }) => __foldkitBrandViewResult((Option.some(OutMessage.SelectedDate({ date }))), "@foldkit/ui/datePicker/index.js#SelectedDate~2"),
108
+ ChangedViewMonth: ({ year, month }) => __foldkitBrandViewResult((OutMessage.ChangedViewMonth({ year, month })), "@foldkit/ui/datePicker/index.js#ChangedViewMonth~2"),
109
+ SelectedDate: ({ date }) => __foldkitBrandViewResult((OutMessage.SelectedDate({ date })), "@foldkit/ui/datePicker/index.js#SelectedDate~2"),
115
110
  }));
116
111
  const foldCalendar = Update.foldChild({
117
112
  update: UiCalendar.update,
118
113
  read: (model) => __foldkitBrandViewResult((Option.some(model.calendar)), "@foldkit/ui/datePicker/index.js#read"),
119
- write: (model, nextCalendar) => __foldkitBrandViewResult((evo(model, { calendar: () => __foldkitBrandViewResult((nextCalendar), "@foldkit/ui/datePicker/index.js#calendar~2") })), "@foldkit/ui/datePicker/index.js#write"),
114
+ write: (model, nextCalendar) => __foldkitBrandViewResult((evo(model, { calendar: () => __foldkitBrandViewResult((nextCalendar), "@foldkit/ui/datePicker/index.js#calendar") })), "@foldkit/ui/datePicker/index.js#write"),
120
115
  toParentMessage: message => __foldkitBrandViewResult((Message.GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage"),
121
116
  toParentOutMessage: toDatePickerOutMessage,
122
117
  foldOutMessage: foldCalendarOutMessage,
123
118
  });
124
- /** Processes a date picker message and returns the next model, commands, and
125
- * optional OutMessage. */
119
+ const foldCalendarSelectDate = Update.foldChild({
120
+ update: UiCalendar.selectDate,
121
+ read: (model) => __foldkitBrandViewResult((Option.some(model.calendar)), "@foldkit/ui/datePicker/index.js#read~2"),
122
+ write: (model, nextCalendar) => __foldkitBrandViewResult((evo(model, { calendar: () => __foldkitBrandViewResult((nextCalendar), "@foldkit/ui/datePicker/index.js#calendar~2") })), "@foldkit/ui/datePicker/index.js#write~2"),
123
+ toParentMessage: message => __foldkitBrandViewResult((Message.GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage~2"),
124
+ toParentOutMessage: toDatePickerOutMessage,
125
+ foldOutMessage: foldCalendarOutMessage,
126
+ });
127
+ /** Processes a DatePicker Message and returns the next Model, optional
128
+ * Commands, and an optional OutMessage. */
126
129
  export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
127
130
  GotCalendarMessage: ({ message: calendarMessage }) => __foldkitBrandViewResult((foldCalendar(model, calendarMessage)), "@foldkit/ui/datePicker/index.js#GotCalendarMessage"),
128
131
  GotPopoverMessage: ({ message: popoverMessage }) => __foldkitBrandViewResult((foldPopover(model, popoverMessage)), "@foldkit/ui/datePicker/index.js#GotPopoverMessage"),
129
- Opened: () => __foldkitBrandViewResult(([
130
- ...Update.combine(model, [foldPopoverOpen, dropCalendarToDays]),
131
- Option.none(),
132
- ]), "@foldkit/ui/datePicker/index.js#Opened~2"),
133
- Closed: () => __foldkitBrandViewResult(([
134
- ...Update.combine(model, [foldPopoverClose, dropCalendarToDays]),
135
- Option.none(),
136
- ]), "@foldkit/ui/datePicker/index.js#Closed~2"),
137
- RequestedSelectDate: ({ date }) => {
138
- const [nextCalendar, calendarCommands] = UiCalendar.selectDate(model.calendar, date);
139
- const [nextPopover, popoverCommands] = Popover.close(model.popover);
140
- return __foldkitBrandViewResult(([
141
- evo(model, {
142
- calendar: () => __foldkitBrandViewResult((nextCalendar), "@foldkit/ui/datePicker/index.js#calendar~3"),
143
- popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover~2"),
144
- }),
145
- [
146
- ...mapCalendarCommands(calendarCommands),
147
- ...mapPopoverCommands(popoverCommands),
148
- ],
149
- Option.some(OutMessage.SelectedDate({ date })),
150
- ]), "@foldkit/ui/datePicker/index.js#RequestedSelectDate");
151
- },
152
- Cleared: () => __foldkitBrandViewResult(([model, [], Option.some(OutMessage.ClearedDate())]), "@foldkit/ui/datePicker/index.js#Cleared"),
132
+ Opened: () => __foldkitBrandViewResult((Update.combine(model, [foldPopoverOpen, dropCalendarToDays])), "@foldkit/ui/datePicker/index.js#Opened~2"),
133
+ Closed: () => __foldkitBrandViewResult((Update.combine(model, [foldPopoverClose, dropCalendarToDays])), "@foldkit/ui/datePicker/index.js#Closed~2"),
134
+ RequestedSelectDate: ({ date }) => __foldkitBrandViewResult((foldCalendarSelectDate(model, date)), "@foldkit/ui/datePicker/index.js#RequestedSelectDate"),
135
+ Cleared: () => (__foldkitBrandViewResult(({ model, outMessage: OutMessage.ClearedDate() }), "@foldkit/ui/datePicker/index.js#Cleared")),
153
136
  })), "@foldkit/ui/datePicker/index.js#update");
154
- /** Programmatically opens the date picker, updating the model and returning
155
- * focus and popover commands. Use this in domain-event handlers. */
137
+ /** Programmatically opens the DatePicker, updating the Model and returning
138
+ * focus and Popover Commands. Use this in domain-event handlers. */
156
139
  export const open = (model) => __foldkitBrandViewResult((update(model, Message.Opened())), "@foldkit/ui/datePicker/index.js#open");
157
140
  /** Programmatically closes the date picker. Use this in domain-event handlers. */
158
141
  export const close = (model) => __foldkitBrandViewResult((update(model, Message.Closed())), "@foldkit/ui/datePicker/index.js#close");
@@ -164,10 +147,10 @@ export const clear = (model) => __foldkitBrandViewResult((update(model, Message.
164
147
  * the selection (which the parent owns). Use it to navigate the picker onto a
165
148
  * known date, for example after the parent sets its value externally (a URL
166
149
  * parameter, a saved draft) so opening the picker shows that month. Returns
167
- * the model directly because it produces no commands and no OutMessage. */
150
+ * the Model directly because it produces no Commands and no OutMessage. */
168
151
  export const focusDate = Function.dual(2, (model, date) => __foldkitBrandViewResult((evo(model, {
169
- calendar: () => __foldkitBrandViewResult((UiCalendar.focusDate(model.calendar, date)), "@foldkit/ui/datePicker/index.js#calendar~4"),
170
- })), "@foldkit/ui/datePicker/index.js#anonymous~4"));
152
+ calendar: () => __foldkitBrandViewResult((UiCalendar.focusDate(model.calendar, date)), "@foldkit/ui/datePicker/index.js#calendar~3"),
153
+ })), "@foldkit/ui/datePicker/index.js#anonymous~2"));
171
154
  /** Reflects the minimum selectable date onto the embedded calendar. Pass
172
155
  * `Option.none()` to remove the minimum. Use this when the minimum derives
173
156
  * from other Model state (e.g. a start date field whose current selection
@@ -177,26 +160,26 @@ export const focusDate = Function.dual(2, (model, date) => __foldkitBrandViewRes
177
160
  * is now below the new minimum, it remains selected. Callers should `clear`
178
161
  * or reassign the selection explicitly if their domain requires it. */
179
162
  export const reflectMinDate = Function.dual(2, (model, maybeMinDate) => __foldkitBrandViewResult((evo(model, {
180
- calendar: () => __foldkitBrandViewResult((UiCalendar.reflectMinDate(model.calendar, maybeMinDate)), "@foldkit/ui/datePicker/index.js#calendar~5"),
181
- })), "@foldkit/ui/datePicker/index.js#anonymous~5"));
163
+ calendar: () => __foldkitBrandViewResult((UiCalendar.reflectMinDate(model.calendar, maybeMinDate)), "@foldkit/ui/datePicker/index.js#calendar~4"),
164
+ })), "@foldkit/ui/datePicker/index.js#anonymous~3"));
182
165
  /** Reflects the maximum selectable date onto the embedded calendar. Pass
183
166
  * `Option.none()` to remove the maximum. Does NOT reconcile the current
184
167
  * selection. */
185
168
  export const reflectMaxDate = Function.dual(2, (model, maybeMaxDate) => __foldkitBrandViewResult((evo(model, {
186
- calendar: () => __foldkitBrandViewResult((UiCalendar.reflectMaxDate(model.calendar, maybeMaxDate)), "@foldkit/ui/datePicker/index.js#calendar~6"),
187
- })), "@foldkit/ui/datePicker/index.js#anonymous~6"));
169
+ calendar: () => __foldkitBrandViewResult((UiCalendar.reflectMaxDate(model.calendar, maybeMaxDate)), "@foldkit/ui/datePicker/index.js#calendar~5"),
170
+ })), "@foldkit/ui/datePicker/index.js#anonymous~4"));
188
171
  /** Reflects the list of individually-disabled dates onto the embedded
189
172
  * calendar. Pass an empty array to clear. Does NOT reconcile the current
190
173
  * selection. */
191
174
  export const reflectDisabledDates = Function.dual(2, (model, disabledDates) => __foldkitBrandViewResult((evo(model, {
192
- calendar: () => __foldkitBrandViewResult((UiCalendar.reflectDisabledDates(model.calendar, disabledDates)), "@foldkit/ui/datePicker/index.js#calendar~7"),
193
- })), "@foldkit/ui/datePicker/index.js#anonymous~7"));
175
+ calendar: () => __foldkitBrandViewResult((UiCalendar.reflectDisabledDates(model.calendar, disabledDates)), "@foldkit/ui/datePicker/index.js#calendar~6"),
176
+ })), "@foldkit/ui/datePicker/index.js#anonymous~5"));
194
177
  /** Reflects the days of the week that are disabled onto the embedded calendar
195
178
  * (e.g. weekends). Pass an empty array to clear. Does NOT reconcile the
196
179
  * current selection. */
197
180
  export const reflectDisabledDaysOfWeek = Function.dual(2, (model, disabledDaysOfWeek) => __foldkitBrandViewResult((evo(model, {
198
- calendar: () => __foldkitBrandViewResult((UiCalendar.reflectDisabledDaysOfWeek(model.calendar, disabledDaysOfWeek)), "@foldkit/ui/datePicker/index.js#calendar~8"),
199
- })), "@foldkit/ui/datePicker/index.js#anonymous~8"));
181
+ calendar: () => __foldkitBrandViewResult((UiCalendar.reflectDisabledDaysOfWeek(model.calendar, disabledDaysOfWeek)), "@foldkit/ui/datePicker/index.js#calendar~7"),
182
+ })), "@foldkit/ui/datePicker/index.js#anonymous~6"));
200
183
  // SELECTORS
201
184
  /** Returns the bare DOM id of the date picker trigger button, derived from
202
185
  * the date picker's base id. The trigger is the embedded Popover's button,
@@ -230,7 +213,7 @@ export const view = defineView((model, viewInputs, h) => {
230
213
  model: model.calendar,
231
214
  view: UiCalendar.view,
232
215
  viewInputs: { maybeSelectedDate, toView: toCalendarView },
233
- toParentMessage: message => __foldkitBrandViewResult((Message.GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage~2"),
216
+ toParentMessage: message => __foldkitBrandViewResult((Message.GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage~3"),
234
217
  });
235
218
  const popoverVNode = h.submodel({
236
219
  slotId: model.popover.id,
@@ -269,7 +252,7 @@ export const view = defineView((model, viewInputs, h) => {
269
252
  : []),
270
253
  ])), "@foldkit/ui/datePicker/index.js#toView"),
271
254
  },
272
- toParentMessage: message => __foldkitBrandViewResult((Message.GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage~3"),
255
+ toParentMessage: message => __foldkitBrandViewResult((Message.GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage~4"),
273
256
  });
274
257
  const hiddenInputValue = Option.match(maybeSelectedDate, {
275
258
  onNone: () => __foldkitBrandViewResult((''), "@foldkit/ui/datePicker/index.js#onNone"),
@@ -282,5 +265,5 @@ export const view = defineView((model, viewInputs, h) => {
282
265
  ...(className !== undefined ? [h.Class(className)] : []),
283
266
  ...attributes,
284
267
  ];
285
- return __foldkitBrandViewResult((h.div(wrapperAttributes, [popoverVNode, ...maybeHiddenInput])), "@foldkit/ui/datePicker/index.js#anonymous~9");
268
+ return __foldkitBrandViewResult((h.div(wrapperAttributes, [popoverVNode, ...maybeHiddenInput])), "@foldkit/ui/datePicker/index.js#anonymous~7");
286
269
  });