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.
Files changed (64) hide show
  1. package/dist/ui/anchor.d.ts +2 -1
  2. package/dist/ui/anchor.d.ts.map +1 -1
  3. package/dist/ui/anchor.js +24 -3
  4. package/dist/ui/calendar/index.d.ts +20 -3
  5. package/dist/ui/calendar/index.d.ts.map +1 -1
  6. package/dist/ui/calendar/index.js +22 -4
  7. package/dist/ui/calendar/public.d.ts +1 -1
  8. package/dist/ui/calendar/public.d.ts.map +1 -1
  9. package/dist/ui/calendar/public.js +1 -1
  10. package/dist/ui/combobox/multi.d.ts +17 -11
  11. package/dist/ui/combobox/multi.d.ts.map +1 -1
  12. package/dist/ui/combobox/multi.js +8 -2
  13. package/dist/ui/combobox/multiPublic.d.ts +1 -1
  14. package/dist/ui/combobox/multiPublic.d.ts.map +1 -1
  15. package/dist/ui/combobox/multiPublic.js +1 -1
  16. package/dist/ui/combobox/public.d.ts +1 -1
  17. package/dist/ui/combobox/public.d.ts.map +1 -1
  18. package/dist/ui/combobox/public.js +1 -1
  19. package/dist/ui/combobox/single.d.ts +8 -2
  20. package/dist/ui/combobox/single.d.ts.map +1 -1
  21. package/dist/ui/combobox/single.js +7 -1
  22. package/dist/ui/datePicker/index.d.ts +246 -0
  23. package/dist/ui/datePicker/index.d.ts.map +1 -0
  24. package/dist/ui/datePicker/index.js +259 -0
  25. package/dist/ui/datePicker/public.d.ts +3 -0
  26. package/dist/ui/datePicker/public.d.ts.map +1 -0
  27. package/dist/ui/datePicker/public.js +1 -0
  28. package/dist/ui/dialog/index.d.ts +3 -0
  29. package/dist/ui/dialog/index.d.ts.map +1 -1
  30. package/dist/ui/dialog/index.js +3 -0
  31. package/dist/ui/dialog/public.d.ts +1 -1
  32. package/dist/ui/dialog/public.d.ts.map +1 -1
  33. package/dist/ui/dialog/public.js +1 -1
  34. package/dist/ui/disclosure/index.d.ts +3 -0
  35. package/dist/ui/disclosure/index.d.ts.map +1 -1
  36. package/dist/ui/disclosure/index.js +3 -0
  37. package/dist/ui/disclosure/public.d.ts +1 -1
  38. package/dist/ui/disclosure/public.d.ts.map +1 -1
  39. package/dist/ui/disclosure/public.js +1 -1
  40. package/dist/ui/index.d.ts +1 -0
  41. package/dist/ui/index.d.ts.map +1 -1
  42. package/dist/ui/index.js +1 -0
  43. package/dist/ui/listbox/multi.d.ts +8 -2
  44. package/dist/ui/listbox/multi.d.ts.map +1 -1
  45. package/dist/ui/listbox/multi.js +7 -1
  46. package/dist/ui/listbox/multiPublic.d.ts +1 -1
  47. package/dist/ui/listbox/multiPublic.d.ts.map +1 -1
  48. package/dist/ui/listbox/multiPublic.js +1 -1
  49. package/dist/ui/listbox/public.d.ts +1 -1
  50. package/dist/ui/listbox/public.d.ts.map +1 -1
  51. package/dist/ui/listbox/public.js +1 -1
  52. package/dist/ui/listbox/single.d.ts +8 -2
  53. package/dist/ui/listbox/single.d.ts.map +1 -1
  54. package/dist/ui/listbox/single.js +7 -1
  55. package/dist/ui/menu/index.d.ts +6 -0
  56. package/dist/ui/menu/index.d.ts.map +1 -1
  57. package/dist/ui/menu/index.js +7 -5
  58. package/dist/ui/menu/public.d.ts +1 -1
  59. package/dist/ui/menu/public.d.ts.map +1 -1
  60. package/dist/ui/menu/public.js +1 -1
  61. package/dist/ui/popover/index.d.ts +4 -1
  62. package/dist/ui/popover/index.d.ts.map +1 -1
  63. package/dist/ui/popover/index.js +8 -9
  64. package/package.json +1 -1
@@ -7,12 +7,13 @@ export type AnchorConfig = Readonly<{
7
7
  padding?: number;
8
8
  portal?: boolean;
9
9
  }>;
10
- /** Returns insert/destroy hook callbacks that position a floating element relative to its button using Floating UI. When `interceptTab` is true (default), Tab key in portal mode refocuses the button — set to false for components like Popover where Tab should navigate naturally within the panel. When `focusAfterPosition` is true, the element is focused after the first position computation clears visibility — necessary because `visibility: hidden` elements cannot receive focus synchronously. */
10
+ /** Returns insert/destroy hook callbacks that position a floating element relative to its button using Floating UI. When `interceptTab` is true (default), Tab key in portal mode refocuses the button — set to false for components like Popover where Tab should navigate naturally within the panel. When `focusAfterPosition` is true, the element is focused after the first position computation clears visibility — deferred via requestAnimationFrame so the element is painted before focus fires. `focusSelector` optionally targets a descendant (e.g. a calendar grid inside a popover panel) instead of the panel itself. */
11
11
  export declare const anchorHooks: (config: {
12
12
  buttonId: string;
13
13
  anchor: AnchorConfig;
14
14
  interceptTab?: boolean;
15
15
  focusAfterPosition?: boolean;
16
+ focusSelector?: string;
16
17
  }) => Readonly<{
17
18
  onInsert: (items: Element) => void;
18
19
  onDestroy: (items: Element) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/ui/anchor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAmBF,kfAAkf;AAClf,eAAO,MAAM,WAAW,GAAI,QAAQ;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,KAAG,QAAQ,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACpC,CA+EC,CAAA"}
1
+ {"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/ui/anchor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAmBF,0mBAA0mB;AAC1mB,eAAO,MAAM,WAAW,GAAI,QAAQ;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,KAAG,QAAQ,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACpC,CAoGC,CAAA"}
package/dist/ui/anchor.js CHANGED
@@ -10,7 +10,7 @@ const getOrCreatePortalRoot = () => {
10
10
  return document.body.appendChild(root);
11
11
  };
12
12
  const anchorCleanups = new WeakMap();
13
- /** Returns insert/destroy hook callbacks that position a floating element relative to its button using Floating UI. When `interceptTab` is true (default), Tab key in portal mode refocuses the button — set to false for components like Popover where Tab should navigate naturally within the panel. When `focusAfterPosition` is true, the element is focused after the first position computation clears visibility — necessary because `visibility: hidden` elements cannot receive focus synchronously. */
13
+ /** Returns insert/destroy hook callbacks that position a floating element relative to its button using Floating UI. When `interceptTab` is true (default), Tab key in portal mode refocuses the button — set to false for components like Popover where Tab should navigate naturally within the panel. When `focusAfterPosition` is true, the element is focused after the first position computation clears visibility — deferred via requestAnimationFrame so the element is painted before focus fires. `focusSelector` optionally targets a descendant (e.g. a calendar grid inside a popover panel) instead of the panel itself. */
14
14
  export const anchorHooks = (config) => ({
15
15
  onInsert: (items) => {
16
16
  const button = document.getElementById(config.buttonId);
@@ -52,11 +52,28 @@ export const anchorHooks = (config) => ({
52
52
  isFirstUpdate = false;
53
53
  items.style.visibility = '';
54
54
  if (config.focusAfterPosition ?? false) {
55
- items.focus();
55
+ requestAnimationFrame(() => {
56
+ const target = config.focusSelector
57
+ ? document.querySelector(config.focusSelector)
58
+ : items;
59
+ if (target instanceof HTMLElement) {
60
+ target.focus();
61
+ }
62
+ });
56
63
  }
57
64
  }
58
65
  });
59
66
  });
67
+ const portalCleanup = isPortal
68
+ ? () => {
69
+ try {
70
+ items.remove();
71
+ }
72
+ catch {
73
+ // Element was already removed by a blur-triggered re-render.
74
+ }
75
+ }
76
+ : undefined;
60
77
  if (isPortal && shouldInterceptTab) {
61
78
  const handleTabKey = (event) => {
62
79
  if (event instanceof KeyboardEvent && event.key === 'Tab') {
@@ -67,10 +84,14 @@ export const anchorHooks = (config) => ({
67
84
  anchorCleanups.set(items, () => {
68
85
  floatingCleanup();
69
86
  items.removeEventListener('keydown', handleTabKey);
87
+ portalCleanup?.();
70
88
  });
71
89
  }
72
90
  else {
73
- anchorCleanups.set(items, floatingCleanup);
91
+ anchorCleanups.set(items, () => {
92
+ floatingCleanup();
93
+ portalCleanup?.();
94
+ });
74
95
  }
75
96
  },
76
97
  onDestroy: (items) => {
@@ -136,10 +136,10 @@ export type OutMessage = typeof OutMessage.Type;
136
136
  export type InitConfig = Readonly<{
137
137
  id: string;
138
138
  today: CalendarDate;
139
- maybeInitialSelectedDate?: Option.Option<CalendarDate>;
139
+ initialSelectedDate?: CalendarDate;
140
140
  locale?: Calendar.LocaleConfig;
141
- maybeMinDate?: Option.Option<CalendarDate>;
142
- maybeMaxDate?: Option.Option<CalendarDate>;
141
+ minDate?: CalendarDate;
142
+ maxDate?: CalendarDate;
143
143
  disabledDaysOfWeek?: ReadonlyArray<Calendar.DayOfWeek>;
144
144
  disabledDates?: ReadonlyArray<CalendarDate>;
145
145
  }>;
@@ -166,6 +166,23 @@ export declare const focusGrid: (modelId: string) => Command.Command<Message>;
166
166
  *
167
167
  * Equivalent to dispatching `ClickedDay({ date })` through `update`. */
168
168
  export declare const selectDate: (model: Model, date: CalendarDate) => UpdateReturn;
169
+ /** Sets the minimum selectable date. Pass `Option.none()` to remove the
170
+ * minimum. Use this when the minimum derives from other Model state (e.g. a
171
+ * start date field whose current selection constrains an end date picker).
172
+ *
173
+ * Does NOT reconcile the current selection — if a previously-selected date
174
+ * is now below the new minimum, it remains selected. Callers should clear or
175
+ * reassign the selection explicitly if their domain requires it. */
176
+ export declare const setMinDate: (model: Model, maybeMinDate: Option.Option<CalendarDate>) => Model;
177
+ /** Sets the maximum selectable date. Pass `Option.none()` to remove the
178
+ * maximum. Does NOT reconcile the current selection. */
179
+ export declare const setMaxDate: (model: Model, maybeMaxDate: Option.Option<CalendarDate>) => Model;
180
+ /** Sets the list of individually-disabled dates. Pass an empty array to
181
+ * clear. Does NOT reconcile the current selection. */
182
+ export declare const setDisabledDates: (model: Model, disabledDates: ReadonlyArray<CalendarDate>) => Model;
183
+ /** Sets the days of the week that are disabled (e.g. weekends). Pass an
184
+ * empty array to clear. Does NOT reconcile the current selection. */
185
+ export declare const setDisabledDaysOfWeek: (model: Model, disabledDaysOfWeek: ReadonlyArray<Calendar.DayOfWeek>) => Model;
169
186
  /** Processes a calendar message and returns the next model, commands, and
170
187
  * optional OutMessage. */
171
188
  export declare const update: (model: Model, message: Message) => UpdateReturn;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,EAAE,MAAM,IAAI,CAAC,EAAQ,MAAM,QAAQ,CAAA;AAE7E,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAA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C,UAAU,EAAE,kBAAkB,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;IAC/D;;;;;0DAKsD;IACtD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,aAAa,CAAA;IACtD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAC,CAAA;AAeF;;iDAEiD;AACjD,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IAiPF,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"}
@@ -76,18 +76,19 @@ export const OutMessage = ChangedViewMonth;
76
76
  /** Creates an initial calendar model. The view month defaults to the month
77
77
  * of the initial selected date, or today if no date is pre-selected. */
78
78
  export const init = (config) => {
79
- const initialFocus = Option.getOrElse(config.maybeInitialSelectedDate ?? Option.none(), () => config.today);
79
+ const maybeInitialSelectedDate = Option.fromNullable(config.initialSelectedDate);
80
+ const initialFocus = Option.getOrElse(maybeInitialSelectedDate, () => config.today);
80
81
  return {
81
82
  id: config.id,
82
83
  today: config.today,
83
84
  viewYear: initialFocus.year,
84
85
  viewMonth: initialFocus.month,
85
86
  maybeFocusedDate: Option.some(initialFocus),
86
- maybeSelectedDate: config.maybeInitialSelectedDate ?? Option.none(),
87
+ maybeSelectedDate: maybeInitialSelectedDate,
87
88
  isGridFocused: false,
88
89
  locale: config.locale ?? Calendar.defaultEnglishLocale,
89
- maybeMinDate: config.maybeMinDate ?? Option.none(),
90
- maybeMaxDate: config.maybeMaxDate ?? Option.none(),
90
+ maybeMinDate: Option.fromNullable(config.minDate),
91
+ maybeMaxDate: Option.fromNullable(config.maxDate),
91
92
  disabledDaysOfWeek: config.disabledDaysOfWeek ?? [],
92
93
  disabledDates: config.disabledDates ?? [],
93
94
  };
@@ -108,6 +109,23 @@ export const focusGrid = (modelId) => FocusGrid(Task.focus(gridSelector(modelId)
108
109
  *
109
110
  * Equivalent to dispatching `ClickedDay({ date })` through `update`. */
110
111
  export const selectDate = (model, date) => update(model, ClickedDay({ date }));
112
+ /** Sets the minimum selectable date. Pass `Option.none()` to remove the
113
+ * minimum. Use this when the minimum derives from other Model state (e.g. a
114
+ * start date field whose current selection constrains an end date picker).
115
+ *
116
+ * Does NOT reconcile the current selection — if a previously-selected date
117
+ * is now below the new minimum, it remains selected. Callers should clear or
118
+ * reassign the selection explicitly if their domain requires it. */
119
+ export const setMinDate = (model, maybeMinDate) => evo(model, { maybeMinDate: () => maybeMinDate });
120
+ /** Sets the maximum selectable date. Pass `Option.none()` to remove the
121
+ * maximum. Does NOT reconcile the current selection. */
122
+ export const setMaxDate = (model, maybeMaxDate) => evo(model, { maybeMaxDate: () => maybeMaxDate });
123
+ /** Sets the list of individually-disabled dates. Pass an empty array to
124
+ * clear. Does NOT reconcile the current selection. */
125
+ export const setDisabledDates = (model, disabledDates) => evo(model, { disabledDates: () => disabledDates });
126
+ /** Sets the days of the week that are disabled (e.g. weekends). Pass an
127
+ * empty array to clear. Does NOT reconcile the current selection. */
128
+ export const setDisabledDaysOfWeek = (model, disabledDaysOfWeek) => evo(model, { disabledDaysOfWeek: () => disabledDaysOfWeek });
111
129
  const DAY_SKIP_CAP = 31;
112
130
  const MONTH_SKIP_CAP = 12;
113
131
  const isDateDisabled = (model, date) => {
@@ -1,3 +1,3 @@
1
- export { init, update, view, lazy, focusGrid, selectDate, Model, Message, OutMessage, ChangedViewMonth, ClickedDay, PressedKeyOnGrid, ClickedPreviousMonthButton, ClickedNextMonthButton, SelectedMonthFromDropdown, SelectedYearFromDropdown, FocusedGrid, BlurredGrid, RefreshedToday, CompletedFocusGrid, FocusGrid, } from './index';
1
+ export { init, update, view, lazy, focusGrid, selectDate, setMinDate, setMaxDate, setDisabledDates, setDisabledDaysOfWeek, Model, Message, OutMessage, ChangedViewMonth, ClickedDay, PressedKeyOnGrid, ClickedPreviousMonthButton, ClickedNextMonthButton, SelectedMonthFromDropdown, SelectedYearFromDropdown, FocusedGrid, BlurredGrid, RefreshedToday, CompletedFocusGrid, FocusGrid, } from './index';
2
2
  export type { InitConfig, ViewConfig, CalendarAttributes, DayCell, ColumnHeader, Week, } from './index';
3
3
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/calendar/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,SAAS,CAAA;AAEhB,YAAY,EACV,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,IAAI,GACL,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/calendar/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,SAAS,CAAA;AAEhB,YAAY,EACV,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,IAAI,GACL,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- export { init, update, view, lazy, focusGrid, selectDate, Model, Message, OutMessage, ChangedViewMonth, ClickedDay, PressedKeyOnGrid, ClickedPreviousMonthButton, ClickedNextMonthButton, SelectedMonthFromDropdown, SelectedYearFromDropdown, FocusedGrid, BlurredGrid, RefreshedToday, CompletedFocusGrid, FocusGrid, } from './index';
1
+ export { init, update, view, lazy, focusGrid, selectDate, setMinDate, setMaxDate, setDisabledDates, setDisabledDaysOfWeek, Model, Message, OutMessage, ChangedViewMonth, ClickedDay, PressedKeyOnGrid, ClickedPreviousMonthButton, ClickedNextMonthButton, SelectedMonthFromDropdown, SelectedYearFromDropdown, FocusedGrid, BlurredGrid, RefreshedToday, CompletedFocusGrid, FocusGrid, } from './index';
@@ -1,7 +1,7 @@
1
- import { Schema as S } from 'effect';
1
+ import { Option, Schema as S } from 'effect';
2
2
  import type * as Command from '../../command';
3
3
  import { type Html } from '../../html';
4
- import { type BaseInitConfig, type BaseViewConfig, type Message, SelectedItem } from './shared';
4
+ import { type BaseInitConfig, type BaseViewConfig, Closed, type Message, Opened, SelectedItem } from './shared';
5
5
  /** Schema for the multi-select combobox component's state, tracking open/closed status, active item, input value, and selected items. */
6
6
  export declare const Model: S.extend<S.Struct<{
7
7
  id: typeof S.String;
@@ -44,9 +44,9 @@ export declare const update: (model: {
44
44
  readonly isShowing: boolean;
45
45
  readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
46
46
  };
47
- readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
47
+ readonly maybeActiveItemIndex: Option.Option<number>;
48
48
  readonly activationTrigger: "Pointer" | "Keyboard";
49
- readonly maybeLastPointerPosition: import("effect/Option").Option<{
49
+ readonly maybeLastPointerPosition: Option.Option<{
50
50
  readonly screenX: number;
51
51
  readonly screenY: number;
52
52
  }>;
@@ -66,9 +66,9 @@ export declare const update: (model: {
66
66
  readonly isShowing: boolean;
67
67
  readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
68
68
  };
69
- readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
69
+ readonly maybeActiveItemIndex: Option.Option<number>;
70
70
  readonly activationTrigger: "Pointer" | "Keyboard";
71
- readonly maybeLastPointerPosition: import("effect/Option").Option<{
71
+ readonly maybeLastPointerPosition: Option.Option<{
72
72
  readonly screenX: number;
73
73
  readonly screenY: number;
74
74
  }>;
@@ -100,12 +100,12 @@ export declare const update: (model: {
100
100
  readonly _tag: "CompletedClickItem";
101
101
  } | {
102
102
  readonly _tag: "Opened";
103
- readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
103
+ readonly maybeActiveItemIndex: Option.Option<number>;
104
104
  } | {
105
105
  readonly _tag: "ActivatedItem";
106
106
  readonly activationTrigger: "Pointer" | "Keyboard";
107
107
  readonly index: number;
108
- readonly maybeImmediateSelection: import("effect/Option").Option<{
108
+ readonly maybeImmediateSelection: Option.Option<{
109
109
  readonly item: string;
110
110
  readonly displayText: string;
111
111
  }>;
@@ -141,6 +141,12 @@ export declare const update: (model: {
141
141
  readonly _tag: "PressedToggleButton";
142
142
  }, never, never>;
143
143
  }>[]];
144
+ /** Programmatically opens the combobox, updating the model and returning
145
+ * focus and modal commands. Use this in domain-event handlers to open the combobox. */
146
+ export declare const open: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
147
+ /** Programmatically closes the combobox, updating the model and returning
148
+ * focus and modal commands. Use this in domain-event handlers to close the combobox. */
149
+ export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
144
150
  /** Programmatically toggles an item in the multi-select combobox. Use this in domain-event handlers when the combobox uses `onSelectedItem`. */
145
151
  export declare const selectItem: (model: Model, item: string) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
146
152
  /** Configuration for rendering a multi-select combobox with `view`. */
@@ -157,9 +163,9 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
157
163
  readonly isShowing: boolean;
158
164
  readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
159
165
  };
160
- readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
166
+ readonly maybeActiveItemIndex: Option.Option<number>;
161
167
  readonly activationTrigger: "Pointer" | "Keyboard";
162
- readonly maybeLastPointerPosition: import("effect/Option").Option<{
168
+ readonly maybeLastPointerPosition: Option.Option<{
163
169
  readonly screenX: number;
164
170
  readonly screenY: number;
165
171
  }>;
@@ -170,7 +176,7 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
170
176
  } & {
171
177
  readonly selectedItems: readonly string[];
172
178
  };
173
- toParentMessage: (message: import("./shared").Opened | import("./shared").Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton) => Message;
179
+ toParentMessage: (message: Opened | Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton) => Message;
174
180
  onSelectedItem?: (value: string) => Message;
175
181
  items: readonly Item[];
176
182
  itemToConfig: (item: Item, context: Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE3C,OAAO,KAAK,KAAK,OAA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AK,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CACK,CAAA;AAEhE;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,gJAAgJ;AAChJ,eAAO,MAAM,UAAU,GACrB,OAAO,KAAK,EACZ,MAAM,MAAM,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CACD,CAAA;AAI1D,uEAAuE;AACvE,MAAM,MAAM,UAAU,CAAC,OAAO,EAAE,IAAI,SAAS,MAAM,IAAI,cAAc,CACnE,OAAO,EACP,IAAI,EACJ,KAAK,CACN,CAAA;AAED,yIAAyI;AACzI,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAIf,CAAA;AAEF;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,IAAI,SAAS,MAAM,EAC/C,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EACzB,OAAO,GAAG,iBAAiB,GAAG,gBAAgB,CAC/C,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,KACrE,IAAI,CAoBR,CAAA"}
@@ -1,7 +1,7 @@
1
- import { Array, Schema as S } from 'effect';
1
+ import { Array, Option, Schema as S } from 'effect';
2
2
  import { createLazy } from '../../html';
3
3
  import { evo } from '../../struct';
4
- import { BaseModel, SelectedItem, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared';
4
+ import { BaseModel, Closed, Opened, SelectedItem, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared';
5
5
  // MODEL
6
6
  /** Schema for the multi-select combobox component's state, tracking open/closed status, active item, input value, and selected items. */
7
7
  export const Model = BaseModel.pipe(S.extend(S.Struct({ selectedItems: S.Array(S.String) })));
@@ -36,6 +36,12 @@ export const update = makeUpdate({
36
36
  selectedItems: () => toggleItem(model.selectedItems, item),
37
37
  }),
38
38
  });
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. */
41
+ export const open = (model) => update(model, Opened({ maybeActiveItemIndex: Option.none() }));
42
+ /** Programmatically closes the combobox, updating the model and returning
43
+ * focus and modal commands. Use this in domain-event handlers to close the combobox. */
44
+ export const close = (model) => update(model, Closed());
39
45
  /** Programmatically toggles an item in the multi-select combobox. Use this in domain-event handlers when the combobox uses `onSelectedItem`. */
40
46
  export const selectItem = (model, item) => update(model, SelectedItem({ item, displayText: item }));
41
47
  /** Renders a headless multi-select combobox with keyboard navigation, selection tracking, and aria-activedescendant focus management. */
@@ -1,3 +1,3 @@
1
- export { init, update, selectItem, view, lazy, Model } from './multi';
1
+ export { init, update, open, close, selectItem, view, lazy, Model, } from './multi';
2
2
  export type { InitConfig, ViewConfig } from './multi';
3
3
  //# sourceMappingURL=multiPublic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"multiPublic.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/multiPublic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACrE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"multiPublic.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/multiPublic.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,MAAM,SAAS,CAAA;AAChB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- export { init, update, selectItem, view, lazy, Model } from './multi';
1
+ export { init, update, open, close, selectItem, view, lazy, Model, } from './multi';
@@ -1,4 +1,4 @@
1
- export { init, update, selectItem, view, lazy, Model } from './single';
1
+ export { init, update, open, close, selectItem, view, lazy, Model, } from './single';
2
2
  export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, GotTransitionMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrTransitionEnd, } from './shared';
3
3
  export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, UpdatedInputValue, PressedToggleButton, ItemConfig, GroupHeading, } from './shared';
4
4
  export type { InitConfig, ViewConfig } from './single';
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEtE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,6BAA6B,GAC9B,MAAM,UAAU,CAAA;AAEjB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,6BAA6B,GAC9B,MAAM,UAAU,CAAA;AAEjB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA"}
@@ -1,3 +1,3 @@
1
- export { init, update, selectItem, view, lazy, Model } from './single';
1
+ export { init, update, open, close, selectItem, view, lazy, Model, } from './single';
2
2
  export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, GotTransitionMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrTransitionEnd, } from './shared';
3
3
  export * as Multi from './multiPublic';
@@ -1,7 +1,7 @@
1
1
  import { Option, Schema as S } from 'effect';
2
2
  import type * as Command from '../../command';
3
3
  import { type Html } from '../../html';
4
- import { type BaseInitConfig, type BaseViewConfig, type Message, SelectedItem } from './shared';
4
+ import { type BaseInitConfig, type BaseViewConfig, Closed, type Message, Opened, SelectedItem } from './shared';
5
5
  /** Schema for the single-select combobox component's state, tracking open/closed status, active item, input value, selected item, and display text. */
6
6
  export declare const Model: S.extend<S.Struct<{
7
7
  id: typeof S.String;
@@ -145,6 +145,12 @@ export declare const update: (model: {
145
145
  readonly _tag: "PressedToggleButton";
146
146
  }, never, never>;
147
147
  }>[]];
148
+ /** Programmatically opens the combobox, updating the model and returning
149
+ * focus and modal commands. Use this in domain-event handlers to open the combobox. */
150
+ export declare const open: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
151
+ /** Programmatically closes the combobox, updating the model and returning
152
+ * focus and modal commands. Use this in domain-event handlers to close the combobox. */
153
+ export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
148
154
  /** Programmatically selects an item in the single-select combobox, closing the combobox and returning
149
155
  * focus commands. Use this in domain-event handlers when the combobox uses `onSelectedItem`. */
150
156
  export declare const selectItem: (model: Model, item: string, displayText: string) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
@@ -176,7 +182,7 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
176
182
  readonly maybeSelectedItem: Option.Option<string>;
177
183
  readonly maybeSelectedDisplayText: Option.Option<string>;
178
184
  };
179
- toParentMessage: (message: import("./shared").Opened | import("./shared").Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton) => Message;
185
+ toParentMessage: (message: Opened | Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton) => Message;
180
186
  onSelectedItem?: (value: string) => Message;
181
187
  items: readonly Item[];
182
188
  itemToConfig: (item: Item, context: Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAQ,MAAM,QAAQ,CAAA;AAEzD,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAA;AAElD,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,YAAY,EAKb,MAAM,UAAU,CAAA;AAIjB,uJAAuJ;AACvJ,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;GAOjB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,8RAA8R;AAC9R,MAAM,MAAM,UAAU,GAAG,cAAc,GACrC,QAAQ,CAAC;IACP,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAC,CAAA;AAEJ,4IAA4I;AAC5I,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAMxC,CAAA;AAIF,uIAAuI;AACvI,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiDjB,CAAA;AA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;;;;;;;;;;;;;;;WAOf,CAAA;AAEF;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,IAAI,SAAS,MAAM,EAC/C,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EACzB,OAAO,GAAG,iBAAiB,GAAG,gBAAgB,CAC/C,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,KACrE,IAAI,CAoBR,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { Array, Option, Schema as S, pipe } from 'effect';
2
2
  import { createLazy } from '../../html';
3
3
  import { evo } from '../../struct';
4
- import { BaseModel, SelectedItem, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared';
4
+ import { BaseModel, Closed, Opened, SelectedItem, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared';
5
5
  // MODEL
6
6
  /** Schema for the single-select combobox component's state, tracking open/closed status, active item, input value, selected item, and display text. */
7
7
  export const Model = BaseModel.pipe(S.extend(S.Struct({
@@ -52,6 +52,12 @@ export const update = makeUpdate({
52
52
  maybeSelectedDisplayText: () => Option.some(displayText),
53
53
  }),
54
54
  });
55
+ /** Programmatically opens the combobox, updating the model and returning
56
+ * focus and modal commands. Use this in domain-event handlers to open the combobox. */
57
+ export const open = (model) => update(model, Opened({ maybeActiveItemIndex: Option.none() }));
58
+ /** Programmatically closes the combobox, updating the model and returning
59
+ * focus and modal commands. Use this in domain-event handlers to close the combobox. */
60
+ export const close = (model) => update(model, Closed());
55
61
  /** Programmatically selects an item in the single-select combobox, closing the combobox and returning
56
62
  * focus commands. Use this in domain-event handlers when the combobox uses `onSelectedItem`. */
57
63
  export const selectItem = (model, item, displayText) => update(model, SelectedItem({ item, displayText }));