foldkit 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/devtools/overlay-styles.d.ts +1 -1
- package/dist/devtools/overlay-styles.d.ts.map +1 -1
- package/dist/devtools/overlay-styles.js +5 -1
- package/dist/devtools/overlay.d.ts.map +1 -1
- package/dist/devtools/overlay.js +52 -19
- package/dist/html/index.d.ts +3 -3
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/lazy.d.ts +7 -5
- package/dist/html/lazy.d.ts.map +1 -1
- package/dist/html/lazy.js +12 -8
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +2 -4
- package/dist/test/apps/disabledButton.d.ts +11 -3
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/ui/combobox/multi.d.ts +31 -10
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/public.d.ts +1 -2
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/public.js +1 -2
- package/dist/ui/combobox/shared.d.ts +33 -33
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +89 -112
- package/dist/ui/combobox/single.d.ts +31 -10
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/combobox/single.js +1 -5
- package/dist/ui/dialog/index.d.ts +10 -15
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +68 -73
- package/dist/ui/dialog/public.d.ts +1 -1
- package/dist/ui/dialog/public.d.ts.map +1 -1
- package/dist/ui/dialog/public.js +1 -1
- package/dist/ui/listbox/multi.d.ts +30 -9
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/public.d.ts +1 -2
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/public.js +1 -2
- package/dist/ui/listbox/shared.d.ts +35 -36
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +106 -104
- package/dist/ui/listbox/single.d.ts +30 -9
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/listbox/single.js +9 -12
- package/dist/ui/menu/index.d.ts +22 -26
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +103 -91
- package/dist/ui/menu/public.d.ts +1 -2
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/menu/public.js +1 -2
- package/dist/ui/popover/index.d.ts +21 -22
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +92 -75
- package/dist/ui/popover/public.d.ts +1 -2
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/popover/public.js +1 -2
- package/dist/ui/transition/index.d.ts +8 -58
- package/dist/ui/transition/index.d.ts.map +1 -1
- package/dist/ui/transition/index.js +21 -111
- package/dist/ui/transition/public.d.ts +1 -1
- package/dist/ui/transition/public.d.ts.map +1 -1
- package/dist/ui/transition/public.js +1 -1
- package/dist/ui/transition/schema.d.ts +43 -0
- package/dist/ui/transition/schema.d.ts.map +1 -0
- package/dist/ui/transition/schema.js +35 -0
- package/dist/ui/transition/update.d.ts +22 -0
- package/dist/ui/transition/update.d.ts.map +1 -0
- package/dist/ui/transition/update.js +68 -0
- package/package.json +1 -1
- package/dist/ui/transition.d.ts +0 -5
- package/dist/ui/transition.d.ts.map +0 -1
- package/dist/ui/transition.js +0 -3
|
@@ -10,7 +10,11 @@ export declare const Model: S.extend<S.Struct<{
|
|
|
10
10
|
nullable: typeof S.Boolean;
|
|
11
11
|
immediate: typeof S.Boolean;
|
|
12
12
|
selectInputOnFocus: typeof S.Boolean;
|
|
13
|
-
|
|
13
|
+
transition: S.Struct<{
|
|
14
|
+
id: typeof S.String;
|
|
15
|
+
isShowing: typeof S.Boolean;
|
|
16
|
+
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
17
|
+
}>;
|
|
14
18
|
maybeActiveItemIndex: S.OptionFromSelf<typeof S.Number>;
|
|
15
19
|
activationTrigger: S.Literal<["Pointer", "Keyboard"]>;
|
|
16
20
|
inputValue: typeof S.String;
|
|
@@ -34,7 +38,11 @@ export declare const update: (model: {
|
|
|
34
38
|
readonly isOpen: boolean;
|
|
35
39
|
readonly isAnimated: boolean;
|
|
36
40
|
readonly isModal: boolean;
|
|
37
|
-
readonly
|
|
41
|
+
readonly transition: {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly isShowing: boolean;
|
|
44
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
45
|
+
};
|
|
38
46
|
readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
|
|
39
47
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
40
48
|
readonly maybeLastPointerPosition: import("effect/Option").Option<{
|
|
@@ -52,7 +60,11 @@ export declare const update: (model: {
|
|
|
52
60
|
readonly isOpen: boolean;
|
|
53
61
|
readonly isAnimated: boolean;
|
|
54
62
|
readonly isModal: boolean;
|
|
55
|
-
readonly
|
|
63
|
+
readonly transition: {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly isShowing: boolean;
|
|
66
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
67
|
+
};
|
|
56
68
|
readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
|
|
57
69
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
58
70
|
readonly maybeLastPointerPosition: import("effect/Option").Option<{
|
|
@@ -85,10 +97,6 @@ export declare const update: (model: {
|
|
|
85
97
|
readonly _tag: "CompletedScrollIntoView";
|
|
86
98
|
} | {
|
|
87
99
|
readonly _tag: "CompletedClickItem";
|
|
88
|
-
} | {
|
|
89
|
-
readonly _tag: "AdvancedTransitionFrame";
|
|
90
|
-
} | {
|
|
91
|
-
readonly _tag: "EndedTransition";
|
|
92
100
|
} | {
|
|
93
101
|
readonly _tag: "Opened";
|
|
94
102
|
readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
|
|
@@ -115,7 +123,16 @@ export declare const update: (model: {
|
|
|
115
123
|
} | {
|
|
116
124
|
readonly _tag: "CompletedFocusInput";
|
|
117
125
|
} | {
|
|
118
|
-
readonly _tag: "
|
|
126
|
+
readonly _tag: "GotTransitionMessage";
|
|
127
|
+
readonly message: {
|
|
128
|
+
readonly _tag: "Showed";
|
|
129
|
+
} | {
|
|
130
|
+
readonly _tag: "Hidden";
|
|
131
|
+
} | {
|
|
132
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
133
|
+
} | {
|
|
134
|
+
readonly _tag: "EndedTransition";
|
|
135
|
+
};
|
|
119
136
|
} | {
|
|
120
137
|
readonly _tag: "UpdatedInputValue";
|
|
121
138
|
readonly value: string;
|
|
@@ -132,7 +149,11 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
132
149
|
readonly isOpen: boolean;
|
|
133
150
|
readonly isAnimated: boolean;
|
|
134
151
|
readonly isModal: boolean;
|
|
135
|
-
readonly
|
|
152
|
+
readonly transition: {
|
|
153
|
+
readonly id: string;
|
|
154
|
+
readonly isShowing: boolean;
|
|
155
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
156
|
+
};
|
|
136
157
|
readonly maybeActiveItemIndex: import("effect/Option").Option<number>;
|
|
137
158
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
138
159
|
readonly maybeLastPointerPosition: import("effect/Option").Option<{
|
|
@@ -146,7 +167,7 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
146
167
|
} & {
|
|
147
168
|
readonly selectedItems: readonly string[];
|
|
148
169
|
};
|
|
149
|
-
toParentMessage: (message: import("./shared").Opened | import("./shared").Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | import("./shared").SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton
|
|
170
|
+
toParentMessage: (message: import("./shared").Opened | import("./shared").Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | import("./shared").SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton) => Message;
|
|
150
171
|
onSelectedItem?: (value: string) => Message;
|
|
151
172
|
items: readonly Item[];
|
|
152
173
|
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,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAA;AAElD,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EAKpB,MAAM,UAAU,CAAA;AAIjB,yIAAyI;AACzI,eAAO,MAAM,KAAK
|
|
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,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAA;AAElD,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EAKpB,MAAM,UAAU,CAAA;AAIjB,yIAAyI;AACzI,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;GAEjB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,8RAA8R;AAC9R,MAAM,MAAM,UAAU,GAAG,cAAc,GACrC,QAAQ,CAAC;IACP,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACtC,CAAC,CAAA;AAEJ,2IAA2I;AAC3I,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAGxC,CAAA;AAcF,yJAAyJ;AACzJ,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwBjB,CAAA;AAIF,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,6 +1,5 @@
|
|
|
1
1
|
export { init, update, view, lazy, Model } from './single';
|
|
2
|
-
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem,
|
|
3
|
-
export { TransitionState } from '../transition';
|
|
2
|
+
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, GotTransitionMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrTransitionEnd, } from './shared';
|
|
4
3
|
export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, UpdatedInputValue, PressedToggleButton, ItemConfig, GroupHeading, } from './shared';
|
|
5
4
|
export type { InitConfig, ViewConfig } from './single';
|
|
6
5
|
export type { AnchorConfig } from '../anchor';
|
|
@@ -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,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,EACL,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAE1D,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,4 +1,3 @@
|
|
|
1
1
|
export { init, update, view, lazy, Model } from './single';
|
|
2
|
-
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem,
|
|
3
|
-
export { TransitionState } from '../transition';
|
|
2
|
+
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, GotTransitionMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrTransitionEnd, } from './shared';
|
|
4
3
|
export * as Multi from './multiPublic';
|
|
@@ -16,7 +16,11 @@ export declare const BaseModel: S.Struct<{
|
|
|
16
16
|
nullable: typeof S.Boolean;
|
|
17
17
|
immediate: typeof S.Boolean;
|
|
18
18
|
selectInputOnFocus: typeof S.Boolean;
|
|
19
|
-
|
|
19
|
+
transition: S.Struct<{
|
|
20
|
+
id: typeof S.String;
|
|
21
|
+
isShowing: typeof S.Boolean;
|
|
22
|
+
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
23
|
+
}>;
|
|
20
24
|
maybeActiveItemIndex: S.OptionFromSelf<typeof S.Number>;
|
|
21
25
|
activationTrigger: S.Literal<["Pointer", "Keyboard"]>;
|
|
22
26
|
inputValue: typeof S.String;
|
|
@@ -85,12 +89,10 @@ export declare const CompletedFocusInput: import("../../schema").CallableTaggedS
|
|
|
85
89
|
export declare const CompletedScrollIntoView: import("../../schema").CallableTaggedStruct<"CompletedScrollIntoView", {}>;
|
|
86
90
|
/** Sent when the programmatic item click command completes. */
|
|
87
91
|
export declare const CompletedClickItem: import("../../schema").CallableTaggedStruct<"CompletedClickItem", {}>;
|
|
88
|
-
/**
|
|
89
|
-
export declare const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/** Sent internally when the input wrapper moves in the viewport during a leave transition, cancelling the animation. */
|
|
93
|
-
export declare const DetectedInputMovement: import("../../schema").CallableTaggedStruct<"DetectedInputMovement", {}>;
|
|
92
|
+
/** Wraps a Transition submodel message for delegation. */
|
|
93
|
+
export declare const GotTransitionMessage: import("../../schema").CallableTaggedStruct<"GotTransitionMessage", {
|
|
94
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hidden", {}>, import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedTransition", {}>]>;
|
|
95
|
+
}>;
|
|
94
96
|
/** Sent when the user types in the input. */
|
|
95
97
|
export declare const UpdatedInputValue: import("../../schema").CallableTaggedStruct<"UpdatedInputValue", {
|
|
96
98
|
value: typeof S.String;
|
|
@@ -114,9 +116,7 @@ export declare const Message: S.Union<[
|
|
|
114
116
|
typeof CompletedFocusInput,
|
|
115
117
|
typeof CompletedScrollIntoView,
|
|
116
118
|
typeof CompletedClickItem,
|
|
117
|
-
typeof
|
|
118
|
-
typeof EndedTransition,
|
|
119
|
-
typeof DetectedInputMovement,
|
|
119
|
+
typeof GotTransitionMessage,
|
|
120
120
|
typeof UpdatedInputValue,
|
|
121
121
|
typeof PressedToggleButton
|
|
122
122
|
]>;
|
|
@@ -135,9 +135,6 @@ export type CompletedTeardownInert = typeof CompletedTeardownInert.Type;
|
|
|
135
135
|
export type CompletedFocusInput = typeof CompletedFocusInput.Type;
|
|
136
136
|
export type CompletedScrollIntoView = typeof CompletedScrollIntoView.Type;
|
|
137
137
|
export type CompletedClickItem = typeof CompletedClickItem.Type;
|
|
138
|
-
export type AdvancedTransitionFrame = typeof AdvancedTransitionFrame.Type;
|
|
139
|
-
export type EndedTransition = typeof EndedTransition.Type;
|
|
140
|
-
export type DetectedInputMovement = typeof DetectedInputMovement.Type;
|
|
141
138
|
export type UpdatedInputValue = typeof UpdatedInputValue.Type;
|
|
142
139
|
export type PressedToggleButton = typeof PressedToggleButton.Type;
|
|
143
140
|
export type Message = typeof Message.Type;
|
|
@@ -151,15 +148,9 @@ export declare const closedBaseModel: <Model extends BaseModel>(model: Model) =>
|
|
|
151
148
|
/** Context passed to the `handleSelectedItem` handler with commands for focus management and modal cleanup. */
|
|
152
149
|
export type SelectedItemContext = Readonly<{
|
|
153
150
|
focusInput: Command.Command<Message>;
|
|
154
|
-
maybeNextFrame: Option.Option<Command.Command<Message>>;
|
|
155
151
|
maybeUnlockScroll: Option.Option<Command.Command<Message>>;
|
|
156
152
|
maybeRestoreInert: Option.Option<Command.Command<Message>>;
|
|
157
153
|
}>;
|
|
158
|
-
/** Creates a combobox update function from variant-specific handlers. Shared logic (open, close, activate, transition) is handled internally; only close, selection, and immediate-activation behavior varies by variant. */
|
|
159
|
-
/** Advances the combobox's enter/leave transition by waiting a double-rAF. */
|
|
160
|
-
export declare const RequestFrame: Command.CommandDefinition<"RequestFrame", {
|
|
161
|
-
readonly _tag: "AdvancedTransitionFrame";
|
|
162
|
-
}>;
|
|
163
154
|
/** Prevents page scrolling while the combobox popup is open in modal mode. */
|
|
164
155
|
export declare const LockScroll: Command.CommandDefinition<"LockScroll", {
|
|
165
156
|
readonly _tag: "CompletedLockScroll";
|
|
@@ -188,16 +179,20 @@ export declare const ScrollIntoView: Command.CommandDefinition<"ScrollIntoView",
|
|
|
188
179
|
export declare const ClickItem: Command.CommandDefinition<"ClickItem", {
|
|
189
180
|
readonly _tag: "CompletedClickItem";
|
|
190
181
|
}>;
|
|
191
|
-
/**
|
|
192
|
-
export declare const WaitForTransitions: Command.CommandDefinition<"WaitForTransitions", {
|
|
193
|
-
readonly _tag: "EndedTransition";
|
|
194
|
-
}>;
|
|
195
|
-
/** Detects whether the combobox input moved or the leave transition ended — whichever comes first. */
|
|
182
|
+
/** Detects whether the combobox input wrapper moved or the leave transition ended — whichever comes first. Both outcomes signal the Transition submodel that leave is complete. */
|
|
196
183
|
export declare const DetectMovementOrTransitionEnd: Command.CommandDefinition<"DetectMovementOrTransitionEnd", {
|
|
197
|
-
readonly _tag: "
|
|
198
|
-
|
|
199
|
-
|
|
184
|
+
readonly _tag: "GotTransitionMessage";
|
|
185
|
+
readonly message: {
|
|
186
|
+
readonly _tag: "Showed";
|
|
187
|
+
} | {
|
|
188
|
+
readonly _tag: "Hidden";
|
|
189
|
+
} | {
|
|
190
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
191
|
+
} | {
|
|
192
|
+
readonly _tag: "EndedTransition";
|
|
193
|
+
};
|
|
200
194
|
}>;
|
|
195
|
+
/** Creates a combobox update function from variant-specific handlers. Shared logic (open, close, activate, transition) is handled internally; only close, selection, and immediate-activation behavior varies by variant. */
|
|
201
196
|
export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
202
197
|
handleClose: (model: Model) => Model;
|
|
203
198
|
handleSelectedItem: (model: Model, item: string, displayText: string, context: SelectedItemContext) => [Model, ReadonlyArray<Command.Command<Message>>];
|
|
@@ -222,10 +217,6 @@ export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
|
222
217
|
readonly _tag: "CompletedScrollIntoView";
|
|
223
218
|
} | {
|
|
224
219
|
readonly _tag: "CompletedClickItem";
|
|
225
|
-
} | {
|
|
226
|
-
readonly _tag: "AdvancedTransitionFrame";
|
|
227
|
-
} | {
|
|
228
|
-
readonly _tag: "EndedTransition";
|
|
229
220
|
} | {
|
|
230
221
|
readonly _tag: "Opened";
|
|
231
222
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
@@ -252,7 +243,16 @@ export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
|
252
243
|
} | {
|
|
253
244
|
readonly _tag: "CompletedFocusInput";
|
|
254
245
|
} | {
|
|
255
|
-
readonly _tag: "
|
|
246
|
+
readonly _tag: "GotTransitionMessage";
|
|
247
|
+
readonly message: {
|
|
248
|
+
readonly _tag: "Showed";
|
|
249
|
+
} | {
|
|
250
|
+
readonly _tag: "Hidden";
|
|
251
|
+
} | {
|
|
252
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
253
|
+
} | {
|
|
254
|
+
readonly _tag: "EndedTransition";
|
|
255
|
+
};
|
|
256
256
|
} | {
|
|
257
257
|
readonly _tag: "UpdatedInputValue";
|
|
258
258
|
readonly value: string;
|
|
@@ -273,7 +273,7 @@ export type GroupHeading = Readonly<{
|
|
|
273
273
|
/** Configuration for rendering a combobox with `view`. */
|
|
274
274
|
export type BaseViewConfig<Message, Item extends string, Model extends BaseModel> = Readonly<{
|
|
275
275
|
model: Model;
|
|
276
|
-
toParentMessage: (message: Opened | Closed | ClosedByTab | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | UpdatedInputValue | PressedToggleButton
|
|
276
|
+
toParentMessage: (message: Opened | Closed | ClosedByTab | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | UpdatedInputValue | PressedToggleButton) => Message;
|
|
277
277
|
onSelectedItem?: (value: string) => Message;
|
|
278
278
|
items: ReadonlyArray<Item>;
|
|
279
279
|
itemToConfig: (item: Item, context: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EAEN,MAAM,IAAI,CAAC,EAEZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAQ,MAAM,YAAY,CAAA;AAK5D,OAAO,KA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+8,11 @@ import * as Task from '../../task';
|
|
|
8
8
|
import { anchorHooks } from '../anchor';
|
|
9
9
|
import { groupContiguous } from '../group';
|
|
10
10
|
import { findFirstEnabledIndex, keyToIndex } from '../keyboard';
|
|
11
|
-
|
|
11
|
+
// NOTE: Transition imports are split across schema + update to avoid a circular
|
|
12
|
+
// dependency: transition → html → runtime → devtools → combobox → transition.
|
|
13
|
+
// The barrel (../transition) imports from html, which starts the cycle.
|
|
14
|
+
import { EndedTransition as TransitionEndedTransition, Hidden as TransitionHidden, Message as TransitionMessage, Model as TransitionModel, Showed as TransitionShowed, init as transitionInit, } from '../transition/schema';
|
|
15
|
+
import { update as transitionUpdate } from '../transition/update';
|
|
12
16
|
export { groupContiguous };
|
|
13
17
|
// MODEL
|
|
14
18
|
/** Schema for the activation trigger — whether the user interacted via mouse or keyboard. */
|
|
@@ -22,7 +26,7 @@ export const BaseModel = S.Struct({
|
|
|
22
26
|
nullable: S.Boolean,
|
|
23
27
|
immediate: S.Boolean,
|
|
24
28
|
selectInputOnFocus: S.Boolean,
|
|
25
|
-
|
|
29
|
+
transition: TransitionModel,
|
|
26
30
|
maybeActiveItemIndex: S.OptionFromSelf(S.Number),
|
|
27
31
|
activationTrigger: ActivationTrigger,
|
|
28
32
|
inputValue: S.String,
|
|
@@ -37,7 +41,7 @@ export const baseInit = (config) => ({
|
|
|
37
41
|
nullable: config.nullable ?? false,
|
|
38
42
|
immediate: config.immediate ?? false,
|
|
39
43
|
selectInputOnFocus: config.selectInputOnFocus ?? false,
|
|
40
|
-
|
|
44
|
+
transition: transitionInit({ id: `${config.id}-items` }),
|
|
41
45
|
maybeActiveItemIndex: Option.none(),
|
|
42
46
|
activationTrigger: 'Keyboard',
|
|
43
47
|
inputValue: '',
|
|
@@ -89,12 +93,10 @@ export const CompletedFocusInput = m('CompletedFocusInput');
|
|
|
89
93
|
export const CompletedScrollIntoView = m('CompletedScrollIntoView');
|
|
90
94
|
/** Sent when the programmatic item click command completes. */
|
|
91
95
|
export const CompletedClickItem = m('CompletedClickItem');
|
|
92
|
-
/**
|
|
93
|
-
export const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/** Sent internally when the input wrapper moves in the viewport during a leave transition, cancelling the animation. */
|
|
97
|
-
export const DetectedInputMovement = m('DetectedInputMovement');
|
|
96
|
+
/** Wraps a Transition submodel message for delegation. */
|
|
97
|
+
export const GotTransitionMessage = m('GotTransitionMessage', {
|
|
98
|
+
message: TransitionMessage,
|
|
99
|
+
});
|
|
98
100
|
/** Sent when the user types in the input. */
|
|
99
101
|
export const UpdatedInputValue = m('UpdatedInputValue', {
|
|
100
102
|
value: S.String,
|
|
@@ -102,7 +104,7 @@ export const UpdatedInputValue = m('UpdatedInputValue', {
|
|
|
102
104
|
/** Sent when the optional toggle button is clicked. */
|
|
103
105
|
export const PressedToggleButton = m('PressedToggleButton');
|
|
104
106
|
/** Union of all messages the combobox component can produce. */
|
|
105
|
-
export const Message = S.Union(Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem,
|
|
107
|
+
export const Message = S.Union(Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, GotTransitionMessage, UpdatedInputValue, PressedToggleButton);
|
|
106
108
|
// SELECTORS
|
|
107
109
|
export const inputSelector = (id) => `#${id}-input`;
|
|
108
110
|
export const inputWrapperSelector = (id) => `#${id}-input-wrapper`;
|
|
@@ -114,14 +116,10 @@ const constrainedEvo = makeConstrainedEvo();
|
|
|
114
116
|
/** Resets only shared base fields to their closed state. Does not touch inputValue or selection — those are variant-specific. */
|
|
115
117
|
export const closedBaseModel = (model) => constrainedEvo(model, {
|
|
116
118
|
isOpen: () => false,
|
|
117
|
-
transitionState: () => model.isAnimated ? 'LeaveStart' : 'Idle',
|
|
118
119
|
maybeActiveItemIndex: () => Option.none(),
|
|
119
120
|
activationTrigger: () => 'Keyboard',
|
|
120
121
|
maybeLastPointerPosition: () => Option.none(),
|
|
121
122
|
});
|
|
122
|
-
/** Creates a combobox update function from variant-specific handlers. Shared logic (open, close, activate, transition) is handled internally; only close, selection, and immediate-activation behavior varies by variant. */
|
|
123
|
-
/** Advances the combobox's enter/leave transition by waiting a double-rAF. */
|
|
124
|
-
export const RequestFrame = Command.define('RequestFrame', AdvancedTransitionFrame);
|
|
125
123
|
/** Prevents page scrolling while the combobox popup is open in modal mode. */
|
|
126
124
|
export const LockScroll = Command.define('LockScroll', CompletedLockScroll);
|
|
127
125
|
/** Re-enables page scrolling after the combobox popup closes. */
|
|
@@ -136,14 +134,33 @@ export const FocusInput = Command.define('FocusInput', CompletedFocusInput);
|
|
|
136
134
|
export const ScrollIntoView = Command.define('ScrollIntoView', CompletedScrollIntoView);
|
|
137
135
|
/** Programmatically clicks the active combobox item's DOM element. */
|
|
138
136
|
export const ClickItem = Command.define('ClickItem', CompletedClickItem);
|
|
139
|
-
/**
|
|
140
|
-
export const
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
/** Detects whether the combobox input wrapper moved or the leave transition ended — whichever comes first. Both outcomes signal the Transition submodel that leave is complete. */
|
|
138
|
+
export const DetectMovementOrTransitionEnd = Command.define('DetectMovementOrTransitionEnd', GotTransitionMessage);
|
|
139
|
+
const delegateToTransition = (model, transitionMessage) => {
|
|
140
|
+
const [nextTransition, transitionCommands, maybeOutMessage] = transitionUpdate(model.transition, transitionMessage);
|
|
141
|
+
const mappedCommands = transitionCommands.map(Command.mapEffect(Effect.map(message => GotTransitionMessage({ message }))));
|
|
142
|
+
const additionalCommands = Option.match(maybeOutMessage, {
|
|
143
|
+
onNone: () => [],
|
|
144
|
+
onSome: M.type().pipe(M.tagsExhaustive({
|
|
145
|
+
StartedLeaveAnimating: () => [
|
|
146
|
+
DetectMovementOrTransitionEnd(Effect.raceFirst(Task.detectElementMovement(inputWrapperSelector(model.id)).pipe(Effect.as(GotTransitionMessage({
|
|
147
|
+
message: TransitionEndedTransition(),
|
|
148
|
+
}))), Task.waitForTransitions(itemsSelector(model.id)).pipe(Effect.as(GotTransitionMessage({
|
|
149
|
+
message: TransitionEndedTransition(),
|
|
150
|
+
}))))),
|
|
151
|
+
],
|
|
152
|
+
TransitionedOut: () => [],
|
|
153
|
+
})),
|
|
154
|
+
});
|
|
155
|
+
return [
|
|
156
|
+
constrainedEvo(model, { transition: () => nextTransition }),
|
|
157
|
+
[...mappedCommands, ...additionalCommands],
|
|
158
|
+
];
|
|
159
|
+
};
|
|
160
|
+
/** Creates a combobox update function from variant-specific handlers. Shared logic (open, close, activate, transition) is handled internally; only close, selection, and immediate-activation behavior varies by variant. */
|
|
143
161
|
export const makeUpdate = (handlers) => {
|
|
144
162
|
const withUpdateReturn = M.withReturnType();
|
|
145
163
|
return (model, message) => {
|
|
146
|
-
const maybeNextFrame = OptionExt.when(model.isAnimated, RequestFrame(Task.nextFrame.pipe(Effect.as(AdvancedTransitionFrame()))));
|
|
147
164
|
const maybeLockScroll = OptionExt.when(model.isModal, LockScroll(Task.lockScroll.pipe(Effect.as(CompletedLockScroll()))));
|
|
148
165
|
const maybeUnlockScroll = OptionExt.when(model.isModal, UnlockScroll(Task.unlockScroll.pipe(Effect.as(CompletedUnlockScroll()))));
|
|
149
166
|
const maybeInertOthers = OptionExt.when(model.isModal, InertOthers(Task.inertOthers(model.id, [
|
|
@@ -152,39 +169,41 @@ export const makeUpdate = (handlers) => {
|
|
|
152
169
|
]).pipe(Effect.as(CompletedSetupInert()))));
|
|
153
170
|
const maybeRestoreInert = OptionExt.when(model.isModal, RestoreInert(Task.restoreInert(model.id).pipe(Effect.as(CompletedTeardownInert()))));
|
|
154
171
|
const focusInput = FocusInput(Task.focus(inputSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusInput())));
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const nextModel =
|
|
158
|
-
isOpen: () => true,
|
|
159
|
-
transitionState: () => model.isAnimated ? 'EnterStart' : 'Idle',
|
|
160
|
-
maybeActiveItemIndex: () => maybeActiveItemIndex,
|
|
161
|
-
activationTrigger: () => Option.match(maybeActiveItemIndex, {
|
|
162
|
-
onNone: () => 'Pointer',
|
|
163
|
-
onSome: () => 'Keyboard',
|
|
164
|
-
}),
|
|
165
|
-
maybeLastPointerPosition: () => Option.none(),
|
|
166
|
-
});
|
|
172
|
+
const openCombobox = (baseModel) => {
|
|
173
|
+
if (model.isAnimated) {
|
|
174
|
+
const [nextModel, transitionCommands] = delegateToTransition(baseModel, TransitionShowed());
|
|
167
175
|
return [
|
|
168
|
-
nextModel,
|
|
169
|
-
|
|
176
|
+
constrainedEvo(nextModel, { isOpen: () => true }),
|
|
177
|
+
[
|
|
178
|
+
...Array.getSomes([maybeLockScroll, maybeInertOthers]),
|
|
179
|
+
...transitionCommands,
|
|
180
|
+
],
|
|
170
181
|
];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
}
|
|
183
|
+
return [
|
|
184
|
+
constrainedEvo(baseModel, { isOpen: () => true }),
|
|
185
|
+
Array.getSomes([maybeLockScroll, maybeInertOthers]),
|
|
186
|
+
];
|
|
187
|
+
};
|
|
188
|
+
const closeCombobox = (baseModel, commands) => {
|
|
189
|
+
const closed = handlers.handleClose(baseModel);
|
|
190
|
+
if (model.isAnimated) {
|
|
191
|
+
const [nextModel, transitionCommands] = delegateToTransition(closed, TransitionHidden());
|
|
192
|
+
return [nextModel, [...commands, ...transitionCommands]];
|
|
193
|
+
}
|
|
194
|
+
return [closed, commands];
|
|
195
|
+
};
|
|
196
|
+
return M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
197
|
+
Opened: ({ maybeActiveItemIndex }) => openCombobox(constrainedEvo(model, {
|
|
198
|
+
maybeActiveItemIndex: () => maybeActiveItemIndex,
|
|
199
|
+
activationTrigger: () => Option.match(maybeActiveItemIndex, {
|
|
200
|
+
onNone: () => 'Pointer',
|
|
201
|
+
onSome: () => 'Keyboard',
|
|
202
|
+
}),
|
|
203
|
+
maybeLastPointerPosition: () => Option.none(),
|
|
204
|
+
})),
|
|
205
|
+
Closed: () => closeCombobox(model, [focusInput]),
|
|
206
|
+
ClosedByTab: () => closeCombobox(model, []),
|
|
188
207
|
ActivatedItem: ({ index, activationTrigger, maybeImmediateSelection, }) => {
|
|
189
208
|
const highlightedModel = constrainedEvo(model, {
|
|
190
209
|
maybeActiveItemIndex: () => Option.some(index),
|
|
@@ -225,12 +244,18 @@ export const makeUpdate = (handlers) => {
|
|
|
225
244
|
[],
|
|
226
245
|
]
|
|
227
246
|
: [model, []],
|
|
228
|
-
SelectedItem: ({ item, displayText }) =>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
247
|
+
SelectedItem: ({ item, displayText }) => {
|
|
248
|
+
const [nextModel, commands] = handlers.handleSelectedItem(model, item, displayText, {
|
|
249
|
+
focusInput,
|
|
250
|
+
maybeUnlockScroll,
|
|
251
|
+
maybeRestoreInert,
|
|
252
|
+
});
|
|
253
|
+
if (model.isOpen && !nextModel.isOpen && model.isAnimated) {
|
|
254
|
+
const [transitionedModel, transitionCommands] = delegateToTransition(nextModel, TransitionHidden());
|
|
255
|
+
return [transitionedModel, [...commands, ...transitionCommands]];
|
|
256
|
+
}
|
|
257
|
+
return [nextModel, commands];
|
|
258
|
+
},
|
|
234
259
|
RequestedItemClick: ({ index }) => [
|
|
235
260
|
model,
|
|
236
261
|
[
|
|
@@ -248,73 +273,25 @@ export const makeUpdate = (handlers) => {
|
|
|
248
273
|
[],
|
|
249
274
|
];
|
|
250
275
|
}
|
|
251
|
-
|
|
252
|
-
isOpen: () => true,
|
|
253
|
-
transitionState: () => model.isAnimated ? 'EnterStart' : 'Idle',
|
|
276
|
+
return openCombobox(constrainedEvo(model, {
|
|
254
277
|
inputValue: () => value,
|
|
255
278
|
maybeActiveItemIndex: () => Option.some(0),
|
|
256
279
|
activationTrigger: () => 'Keyboard',
|
|
257
280
|
maybeLastPointerPosition: () => Option.none(),
|
|
258
|
-
});
|
|
259
|
-
return [
|
|
260
|
-
nextModel,
|
|
261
|
-
Array.getSomes([maybeNextFrame, maybeLockScroll, maybeInertOthers]),
|
|
262
|
-
];
|
|
281
|
+
}));
|
|
263
282
|
},
|
|
264
283
|
PressedToggleButton: () => {
|
|
265
284
|
if (model.isOpen) {
|
|
266
|
-
return [
|
|
267
|
-
handlers.handleClose(model),
|
|
268
|
-
pipe(Array.getSomes([
|
|
269
|
-
maybeNextFrame,
|
|
270
|
-
maybeUnlockScroll,
|
|
271
|
-
maybeRestoreInert,
|
|
272
|
-
]), Array.prepend(focusInput)),
|
|
273
|
-
];
|
|
285
|
+
return closeCombobox(model, [focusInput]);
|
|
274
286
|
}
|
|
275
|
-
const nextModel = constrainedEvo(model, {
|
|
276
|
-
isOpen: () => true,
|
|
277
|
-
transitionState: () => model.isAnimated ? 'EnterStart' : 'Idle',
|
|
287
|
+
const [nextModel, commands] = openCombobox(constrainedEvo(model, {
|
|
278
288
|
maybeActiveItemIndex: () => Option.none(),
|
|
279
289
|
activationTrigger: () => 'Pointer',
|
|
280
290
|
maybeLastPointerPosition: () => Option.none(),
|
|
281
|
-
});
|
|
282
|
-
return [
|
|
283
|
-
nextModel,
|
|
284
|
-
pipe(Array.getSomes([
|
|
285
|
-
maybeNextFrame,
|
|
286
|
-
maybeLockScroll,
|
|
287
|
-
maybeInertOthers,
|
|
288
|
-
]), Array.prepend(focusInput)),
|
|
289
|
-
];
|
|
291
|
+
}));
|
|
292
|
+
return [nextModel, [focusInput, ...commands]];
|
|
290
293
|
},
|
|
291
|
-
|
|
292
|
-
constrainedEvo(model, {
|
|
293
|
-
transitionState: () => 'EnterAnimating',
|
|
294
|
-
}),
|
|
295
|
-
[
|
|
296
|
-
WaitForTransitions(Task.waitForTransitions(itemsSelector(model.id)).pipe(Effect.as(EndedTransition()))),
|
|
297
|
-
],
|
|
298
|
-
]), M.when('LeaveStart', () => [
|
|
299
|
-
constrainedEvo(model, {
|
|
300
|
-
transitionState: () => 'LeaveAnimating',
|
|
301
|
-
}),
|
|
302
|
-
[
|
|
303
|
-
DetectMovementOrTransitionEnd(Effect.raceFirst(Task.detectElementMovement(inputWrapperSelector(model.id)).pipe(Effect.as(DetectedInputMovement())), Task.waitForTransitions(itemsSelector(model.id)).pipe(Effect.as(EndedTransition())))),
|
|
304
|
-
],
|
|
305
|
-
]), M.orElse(() => [model, []])),
|
|
306
|
-
EndedTransition: () => M.value(model.transitionState).pipe(withUpdateReturn, M.whenOr('EnterAnimating', 'LeaveAnimating', () => [
|
|
307
|
-
constrainedEvo(model, {
|
|
308
|
-
transitionState: () => 'Idle',
|
|
309
|
-
}),
|
|
310
|
-
[],
|
|
311
|
-
]), M.orElse(() => [model, []])),
|
|
312
|
-
DetectedInputMovement: () => M.value(model.transitionState).pipe(withUpdateReturn, M.when('LeaveAnimating', () => [
|
|
313
|
-
constrainedEvo(model, {
|
|
314
|
-
transitionState: () => 'Idle',
|
|
315
|
-
}),
|
|
316
|
-
[],
|
|
317
|
-
]), M.orElse(() => [model, []])),
|
|
294
|
+
GotTransitionMessage: ({ message: transitionMessage }) => delegateToTransition(model, transitionMessage),
|
|
318
295
|
CompletedLockScroll: () => [model, []],
|
|
319
296
|
CompletedUnlockScroll: () => [model, []],
|
|
320
297
|
CompletedSetupInert: () => [model, []],
|
|
@@ -328,7 +305,7 @@ export const makeUpdate = (handlers) => {
|
|
|
328
305
|
/** Creates a combobox view function from variant-specific behavior. Shared rendering logic (input, items, transitions, keyboard navigation) is handled internally; only selection display varies by variant. */
|
|
329
306
|
export const makeView = (behavior) => (config) => {
|
|
330
307
|
const { div, input, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaInvalid, AriaLabelledBy, AriaMultiSelectable, AriaSelected, Attribute, Autocomplete, Class, DataAttribute, Id, Name, OnBlur, OnClick, OnDestroy, OnFocus, OnInput, OnInsert, OnKeyDownPreventDefault, OnPointerLeave, OnPointerMove, Placeholder, Role, Style, Tabindex, Type, Value, keyed, } = html();
|
|
331
|
-
const { model: { id, isOpen, immediate, transitionState, maybeActiveItemIndex }, toParentMessage, onSelectedItem, items, itemToConfig, itemToValue, itemToDisplayText, isItemDisabled, inputClassName, inputAttributes = [], inputPlaceholder, inputWrapperClassName, inputWrapperAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], buttonContent, buttonClassName, buttonAttributes = [], formName, isDisabled, isInvalid, openOnFocus, itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor, } = config;
|
|
308
|
+
const { model: { id, isOpen, immediate, transition: { transitionState }, maybeActiveItemIndex, }, toParentMessage, onSelectedItem, items, itemToConfig, itemToValue, itemToDisplayText, isItemDisabled, inputClassName, inputAttributes = [], inputPlaceholder, inputWrapperClassName, inputWrapperAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], buttonContent, buttonClassName, buttonAttributes = [], formName, isDisabled, isInvalid, openOnFocus, itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor, } = config;
|
|
332
309
|
const dispatchSelectedItem = (item, index) => onSelectedItem
|
|
333
310
|
? onSelectedItem(itemToValue(item, index))
|
|
334
311
|
: toParentMessage(SelectedItem({
|