foldkit 0.61.0 → 0.62.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.
@@ -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
  }>;
@@ -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,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAOxE;;0DAE0D;AAC1D,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAahB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,wDAAwD;AACxD,eAAO,MAAM,UAAU;;;;;;EAAmD,CAAA;AAC1E;kDACkD;AAClD,eAAO,MAAM,gBAAgB;;;EAG3B,CAAA;AACF,sEAAsE;AACtE,eAAO,MAAM,0BAA0B,+EAAkC,CAAA;AACzE,kEAAkE;AAClE,eAAO,MAAM,sBAAsB,2EAA8B,CAAA;AACjE,gEAAgE;AAChE,eAAO,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,CAAA;CAC1C,CAAC,CAAA;AAEF,0DAA0D;AAC1D,MAAM,MAAM,UAAU,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC/C,KAAK,EAAE,KAAK,CAAA;IACZ,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,aAAa,CAAA;IACpD,MAAM,EAAE,CAAC,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
  };
@@ -0,0 +1,226 @@
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
+ /** Configuration for rendering a date picker with `view`. */
185
+ export type ViewConfig<ParentMessage> = Readonly<{
186
+ model: Model;
187
+ toParentMessage: (message: Message) => ParentMessage;
188
+ /** Optional controlled-mode callback invoked when the user commits a date.
189
+ * When provided, the view dispatches this directly (parent owns the event).
190
+ * When omitted, DatePicker manages its own selection state. In controlled
191
+ * mode, use `DatePicker.selectDate(model, date)` to write the selection
192
+ * back into the date picker's internal state. */
193
+ onSelectedDate?: (date: CalendarDate) => ParentMessage;
194
+ anchor: AnchorConfig;
195
+ /** Renders the trigger button's content (typically the formatted selected
196
+ * date or a placeholder). Receives the current selection. */
197
+ triggerContent: (maybeDate: Option.Option<CalendarDate>) => Html;
198
+ /** Renders the calendar grid layout inside the popover panel. Mirrors
199
+ * `Calendar.ViewConfig['toView']` — the consumer lays out the attribute
200
+ * groups exactly as they would for an inline calendar. */
201
+ toCalendarView: (attributes: UiCalendar.CalendarAttributes<ParentMessage>) => Html;
202
+ isDisabled?: boolean;
203
+ /** Name for the hidden form input. When provided, a hidden `<input>` is
204
+ * rendered alongside the trigger so native form submission captures the
205
+ * selected date as an ISO string (`YYYY-MM-DD`). */
206
+ name?: string;
207
+ className?: string;
208
+ attributes?: ReadonlyArray<Attribute<ParentMessage>>;
209
+ triggerClassName?: string;
210
+ triggerAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
211
+ panelClassName?: string;
212
+ panelAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
213
+ backdropClassName?: string;
214
+ backdropAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
215
+ }>;
216
+ /** Renders an accessible date picker: a trigger button that opens a popover
217
+ * containing an accessible calendar grid. The date picker assembles the
218
+ * embedded Calendar and Popover components into one flat API — consumers
219
+ * provide the trigger face and the calendar grid layout, DatePicker handles
220
+ * focus choreography, open/close state, and form submission. */
221
+ export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
222
+ /** Creates a memoized date picker view. Static config is captured in a closure;
223
+ * only `model` and `toParentMessage` are compared per render via `createLazy`. */
224
+ export declare const lazy: <ParentMessage>(staticConfig: Omit<ViewConfig<ParentMessage>, "model" | "toParentMessage">) => ((model: Model, toParentMessage: ViewConfig<ParentMessage>["toParentMessage"]) => Html);
225
+ export {};
226
+ //# 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,CAAA;AAClD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AAKzC;;mDAEmD;AACnD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,wDAAwD;AAC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pB;iEAC6D;IAC7D,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI,CAAA;IAChE;;8DAE0D;IAC1D,cAAc,EAAE,CACd,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,aAAa,CAAC,KACrD,IAAI,CAAA;IACT,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;wDAEoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,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,231 @@
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
+ const toModelAndCommands = (result) => {
168
+ const [nextModel, commands] = result;
169
+ return [nextModel, commands];
170
+ };
171
+ // VIEW
172
+ const encodeIsoDate = S.encodeSync(Calendar.CalendarDateFromIsoString);
173
+ /** Renders an accessible date picker: a trigger button that opens a popover
174
+ * containing an accessible calendar grid. The date picker assembles the
175
+ * embedded Calendar and Popover components into one flat API — consumers
176
+ * provide the trigger face and the calendar grid layout, DatePicker handles
177
+ * focus choreography, open/close state, and form submission. */
178
+ export const view = (config) => {
179
+ const { Class, Name, Type, Value, div, input } = html();
180
+ const { model, toParentMessage, onSelectedDate, anchor, triggerContent, toCalendarView, isDisabled, name, className, attributes = [], triggerClassName, triggerAttributes = [], panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], } = config;
181
+ const dispatchSelectedDate = (date) => onSelectedDate !== undefined
182
+ ? onSelectedDate(date)
183
+ : toParentMessage(SelectedDate({ date }));
184
+ const calendarVNode = UiCalendar.view({
185
+ model: model.calendar,
186
+ toParentMessage: message => toParentMessage(GotCalendarMessage({ message })),
187
+ onSelectedDate: dispatchSelectedDate,
188
+ toView: toCalendarView,
189
+ });
190
+ const popoverVNode = Popover.view({
191
+ model: model.popover,
192
+ toParentMessage: message => toParentMessage(GotPopoverMessage({ message })),
193
+ onOpened: () => toParentMessage(Opened()),
194
+ onClosed: () => toParentMessage(Closed()),
195
+ anchor,
196
+ buttonContent: triggerContent(model.maybeSelectedDate),
197
+ panelContent: calendarVNode,
198
+ focusSelector: `#${model.calendar.id}-grid`,
199
+ ...(isDisabled !== undefined && { isDisabled }),
200
+ ...(triggerClassName !== undefined && {
201
+ buttonClassName: triggerClassName,
202
+ }),
203
+ buttonAttributes: triggerAttributes,
204
+ ...(panelClassName !== undefined && { panelClassName }),
205
+ panelAttributes,
206
+ ...(backdropClassName !== undefined && { backdropClassName }),
207
+ backdropAttributes,
208
+ });
209
+ const hiddenInputValue = Option.match(model.maybeSelectedDate, {
210
+ onNone: () => '',
211
+ onSome: encodeIsoDate,
212
+ });
213
+ const maybeHiddenInput = name !== undefined
214
+ ? [input([Type('hidden'), Name(name), Value(hiddenInputValue)])]
215
+ : [];
216
+ const wrapperAttributes = [
217
+ ...(className !== undefined ? [Class(className)] : []),
218
+ ...attributes,
219
+ ];
220
+ return div(wrapperAttributes, [popoverVNode, ...maybeHiddenInput]);
221
+ };
222
+ /** Creates a memoized date picker view. Static config is captured in a closure;
223
+ * only `model` and `toParentMessage` are compared per render via `createLazy`. */
224
+ export const lazy = (staticConfig) => {
225
+ const lazyView = createLazy();
226
+ return (model, toParentMessage) => lazyView((currentModel, currentToMessage) => view({
227
+ ...staticConfig,
228
+ model: currentModel,
229
+ toParentMessage: currentToMessage,
230
+ }), [model, toParentMessage]);
231
+ };
@@ -0,0 +1,3 @@
1
+ export { init, update, view, lazy, open, close, selectDate, clear, 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,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, Model, Message, OutMessage, GotCalendarMessage, GotPopoverMessage, SelectedDate, Cleared, Opened, Closed, ChangedViewMonth, } from './index';
@@ -1,5 +1,6 @@
1
1
  export * as Button from './button/public';
2
2
  export * as Calendar from './calendar/public';
3
+ export * as DatePicker from './datePicker/public';
3
4
  export * as Checkbox from './checkbox/public';
4
5
  export * as Combobox from './combobox/public';
5
6
  export * as Dialog from './dialog/public';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA"}
package/dist/ui/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * as Button from './button/public';
2
2
  export * as Calendar from './calendar/public';
3
+ export * as DatePicker from './datePicker/public';
3
4
  export * as Checkbox from './checkbox/public';
4
5
  export * as Combobox from './combobox/public';
5
6
  export * as Dialog from './dialog/public';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAe1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAIpD,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,oCAAmC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAQ7D,iIAAiI;AACjI,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;EAehB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,mJAAmJ;AACnJ,eAAO,MAAM,MAAM;;EAEjB,CAAA;AACF,kEAAkE;AAClE,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,2EAA2E;AAC3E,eAAO,MAAM,WAAW,gEAAmB,CAAA;AAC3C,mGAAmG;AACnG,eAAO,MAAM,aAAa;;;EAGxB,CAAA;AACF,kDAAkD;AAClD,eAAO,MAAM,eAAe,oEAAuB,CAAA;AACnD,gEAAgE;AAChE,eAAO,MAAM,YAAY;;EAAyC,CAAA;AAClE,kHAAkH;AAClH,eAAO,MAAM,kBAAkB;;EAE7B,CAAA;AACF,qEAAqE;AACrE,eAAO,MAAM,QAAQ;;;EAGnB,CAAA;AACF,4EAA4E;AAC5E,eAAO,MAAM,aAAa;;EAA4C,CAAA;AACtE,gHAAgH;AAChH,eAAO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AgBR,CAAA"}
@@ -198,12 +198,8 @@ export const update = (model, message) => {
198
198
  itemsSelector(model.id),
199
199
  ]).pipe(Effect.as(CompletedSetupInert()))));
200
200
  const maybeRestoreInert = OptionExt.when(model.isModal, RestoreInert(Task.restoreInert(model.id).pipe(Effect.as(CompletedTeardownInert()))));
201
- const focusItems = FocusItems(Task.focus(itemsSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusItems())));
202
201
  const focusButton = FocusButton(Task.focus(buttonSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusButton())));
203
- const openCommands = [
204
- focusItems,
205
- ...Array.getSomes([maybeLockScroll, maybeInertOthers]),
206
- ];
202
+ const openCommands = Array.getSomes([maybeLockScroll, maybeInertOthers]);
207
203
  const closeWithFocusCommands = [
208
204
  focusButton,
209
205
  ...Array.getSomes([maybeUnlockScroll, maybeRestoreInert]),
@@ -8,6 +8,7 @@ export declare const Model: S.Struct<{
8
8
  isOpen: typeof S.Boolean;
9
9
  isAnimated: typeof S.Boolean;
10
10
  isModal: typeof S.Boolean;
11
+ contentFocus: typeof S.Boolean;
11
12
  transition: S.Struct<{
12
13
  id: typeof S.String;
13
14
  isShowing: typeof S.Boolean;
@@ -70,11 +71,12 @@ export type PressedPointerOnButton = typeof PressedPointerOnButton.Type;
70
71
  export type IgnoredMouseClick = typeof IgnoredMouseClick.Type;
71
72
  export type SuppressedSpaceScroll = typeof SuppressedSpaceScroll.Type;
72
73
  export type Message = typeof Message.Type;
73
- /** Configuration for creating a popover model with `init`. `isAnimated` enables CSS transition coordination (default `false`). `isModal` locks page scroll and inerts other elements when open (default `false`). */
74
+ /** Configuration for creating a popover model with `init`. `isAnimated` enables CSS transition coordination (default `false`). `isModal` locks page scroll and inerts other elements when open (default `false`). `contentFocus` hands focus ownership to the consumer — the panel is not focusable and does not close on blur, so the consumer must focus a descendant on open and close the popover on its own blur rules (default `false`). */
74
75
  export type InitConfig = Readonly<{
75
76
  id: string;
76
77
  isAnimated?: boolean;
77
78
  isModal?: boolean;
79
+ contentFocus?: boolean;
78
80
  }>;
79
81
  /** Creates an initial popover model from a config. Defaults to closed. */
80
82
  export declare const init: (config: InitConfig) => Model;
@@ -140,6 +142,7 @@ export type ViewConfig<Message> = Readonly<{
140
142
  backdropClassName?: string;
141
143
  backdropAttributes?: ReadonlyArray<Attribute<Message>>;
142
144
  isDisabled?: boolean;
145
+ focusSelector?: string;
143
146
  className?: string;
144
147
  attributes?: ReadonlyArray<Attribute<Message>>;
145
148
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAiB7C,sGAAsG;AACtG,eAAO,MAAM,KAAK;;;;;;;;;;;EAOhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,2EAA2E;AAC3E,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,kGAAkG;AAClG,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,iGAAiG;AACjG,eAAO,MAAM,WAAW,gEAAmB,CAAA;AAC3C,qHAAqH;AACrH,eAAO,MAAM,sBAAsB;;;EAGjC,CAAA;AACF,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,wEAA2B,CAAA;AAC3D,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,yEAA4B,CAAA;AAC7D,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,wEAA2B,CAAA;AAC3D,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,0EAA6B,CAAA;AAC/D,oDAAoD;AACpD,eAA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OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,yKAAyK;AACzK,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA8M3D,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,CAAC,EACnB,OAAO,GAAG,iBAAiB,GAAG,UAAU,GAAG,UAAU,CACtD,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
@@ -18,6 +18,7 @@ export const Model = S.Struct({
18
18
  isOpen: S.Boolean,
19
19
  isAnimated: S.Boolean,
20
20
  isModal: S.Boolean,
21
+ contentFocus: S.Boolean,
21
22
  transition: TransitionModel,
22
23
  maybeLastButtonPointerType: S.OptionFromSelf(S.String),
23
24
  });
@@ -63,6 +64,7 @@ export const init = (config) => ({
63
64
  isOpen: false,
64
65
  isAnimated: config.isAnimated ?? false,
65
66
  isModal: config.isModal ?? false,
67
+ contentFocus: config.contentFocus ?? false,
66
68
  transition: transitionInit({ id: `${config.id}-panel` }),
67
69
  maybeLastButtonPointerType: Option.none(),
68
70
  });
@@ -118,12 +120,8 @@ export const update = (model, message) => {
118
120
  panelSelector(model.id),
119
121
  ]).pipe(Effect.as(CompletedSetupInert()))));
120
122
  const maybeRestoreInert = OptionExt.when(model.isModal, RestoreInert(Task.restoreInert(model.id).pipe(Effect.as(CompletedTeardownInert()))));
121
- const focusPanel = FocusPanel(Task.focus(panelSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusPanel())));
122
123
  const focusButton = FocusButton(Task.focus(buttonSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusButton())));
123
- const openCommands = [
124
- focusPanel,
125
- ...Array.getSomes([maybeLockScroll, maybeInertOthers]),
126
- ];
124
+ const openCommands = Array.getSomes([maybeLockScroll, maybeInertOthers]);
127
125
  const closeWithFocusCommands = [
128
126
  focusButton,
129
127
  ...Array.getSomes([maybeUnlockScroll, maybeRestoreInert]),
@@ -200,7 +198,7 @@ export const close = (model) => update(model, Closed());
200
198
  /** Renders a headless popover with a trigger button and a floating panel. Uses the disclosure ARIA pattern (aria-expanded + aria-controls) with no role on the panel. */
201
199
  export const view = (config) => {
202
200
  const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick, OnDestroy, OnInsert, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnPointerDown, Style, Tabindex, Type, keyed, } = html();
203
- const { model: { id, isOpen, transition: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, className, attributes = [], } = config;
201
+ const { model: { id, isOpen, contentFocus, transition: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, focusSelector, className, attributes = [], } = config;
204
202
  const dispatchOpened = () => onOpened ? onOpened() : toParentMessage(Opened());
205
203
  const dispatchClosed = () => onClosed ? onClosed() : toParentMessage(Closed());
206
204
  const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
@@ -220,7 +218,7 @@ export const view = (config) => {
220
218
  DataAttribute('leave', ''),
221
219
  DataAttribute('transition', ''),
222
220
  ]), M.orElse(() => []));
223
- const handleButtonKeyDown = (key) => M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => Option.some(isOpen ? dispatchClosed() : dispatchOpened())), M.orElse(() => Option.none()));
221
+ const handleButtonKeyDown = (key) => M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => Option.some(isOpen ? dispatchClosed() : dispatchOpened())), M.when('Escape', () => OptionExt.when(isOpen, dispatchClosed())), M.orElse(() => Option.none()));
224
222
  const handleButtonPointerDown = (pointerType, button) => Option.some(toParentMessage(PressedPointerOnButton({
225
223
  pointerType,
226
224
  button,
@@ -266,6 +264,7 @@ export const view = (config) => {
266
264
  anchor,
267
265
  interceptTab: false,
268
266
  focusAfterPosition: true,
267
+ ...(focusSelector !== undefined && { focusSelector }),
269
268
  });
270
269
  const anchorAttributes = [
271
270
  Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
@@ -274,14 +273,14 @@ export const view = (config) => {
274
273
  ];
275
274
  const resolvedPanelAttributes = [
276
275
  Id(`${id}-panel`),
277
- Tabindex(0),
276
+ ...(contentFocus ? [] : [Tabindex(0)]),
278
277
  ...anchorAttributes,
279
278
  ...transitionAttributes,
280
279
  ...(isLeaving
281
280
  ? []
282
281
  : [
283
282
  OnKeyDownPreventDefault(handlePanelKeyDown),
284
- OnBlur(toParentMessage(ClosedByTab())),
283
+ ...(contentFocus ? [] : [OnBlur(toParentMessage(ClosedByTab()))]),
285
284
  ]),
286
285
  ...(panelClassName ? [Class(panelClassName)] : []),
287
286
  ...panelAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "A frontend framework for TypeScript, built on Effect, using The Elm Architecture",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",