@foldkit/ui 0.148.2 → 0.149.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/animation/index.d.ts +3 -3
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +2 -2
- package/dist/animation/public.d.ts +1 -1
- package/dist/animation/public.d.ts.map +1 -1
- package/dist/animation/public.js +1 -1
- package/dist/animation/schema.d.ts +12 -21
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +11 -15
- package/dist/animation/update.d.ts +1 -1
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +9 -9
- package/dist/calendar/index.d.ts +50 -105
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +61 -98
- package/dist/calendar/public.d.ts +1 -1
- package/dist/calendar/public.d.ts.map +1 -1
- package/dist/calendar/public.js +1 -1
- package/dist/combobox/multi.d.ts +9 -9
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +9 -9
- package/dist/combobox/public.d.ts +1 -1
- package/dist/combobox/public.d.ts.map +1 -1
- package/dist/combobox/public.js +1 -1
- package/dist/combobox/shared.d.ts +93 -137
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +108 -153
- package/dist/combobox/single.d.ts +9 -9
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +10 -10
- package/dist/datePicker/index.d.ts +88 -84
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +33 -63
- package/dist/datePicker/public.d.ts +1 -1
- package/dist/datePicker/public.d.ts.map +1 -1
- package/dist/datePicker/public.js +1 -1
- package/dist/dialog/index.d.ts +28 -49
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +39 -67
- package/dist/dialog/public.d.ts +1 -1
- package/dist/dialog/public.d.ts.map +1 -1
- package/dist/dialog/public.js +1 -1
- package/dist/dragAndDrop/index.d.ts +45 -72
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +72 -93
- package/dist/dragAndDrop/public.d.ts +1 -1
- package/dist/dragAndDrop/public.d.ts.map +1 -1
- package/dist/dragAndDrop/public.js +1 -1
- package/dist/fileDrop/index.d.ts +14 -35
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +20 -46
- package/dist/fileDrop/public.d.ts +1 -1
- package/dist/fileDrop/public.d.ts.map +1 -1
- package/dist/fileDrop/public.js +1 -1
- package/dist/listbox/multi.d.ts +7 -7
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +8 -8
- package/dist/listbox/public.d.ts +1 -1
- package/dist/listbox/public.d.ts.map +1 -1
- package/dist/listbox/public.js +1 -1
- package/dist/listbox/shared.d.ts +80 -127
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +92 -149
- package/dist/listbox/single.d.ts +7 -7
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +8 -8
- package/dist/menu/index.d.ts +86 -134
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +141 -189
- package/dist/menu/public.d.ts +1 -1
- package/dist/menu/public.d.ts.map +1 -1
- package/dist/menu/public.js +1 -1
- package/dist/popover/index.d.ts +39 -65
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +68 -98
- package/dist/popover/public.d.ts +1 -1
- package/dist/popover/public.d.ts.map +1 -1
- package/dist/popover/public.js +1 -1
- package/dist/radioGroup/index.d.ts +18 -29
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +22 -27
- package/dist/radioGroup/public.d.ts +1 -1
- package/dist/radioGroup/public.d.ts.map +1 -1
- package/dist/radioGroup/public.js +1 -1
- package/dist/slider/index.d.ts +29 -51
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +36 -56
- package/dist/slider/public.d.ts +1 -1
- package/dist/slider/public.d.ts.map +1 -1
- package/dist/slider/public.js +1 -1
- package/dist/tabs/index.d.ts +18 -28
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +22 -26
- package/dist/tabs/public.d.ts +1 -1
- package/dist/tabs/public.d.ts.map +1 -1
- package/dist/tabs/public.js +1 -1
- package/dist/test/apps/disabledButton.d.ts +71 -14
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +14 -13
- package/dist/toast/index.d.ts +124 -109
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +5 -5
- package/dist/toast/public.d.ts +1 -1
- package/dist/toast/public.d.ts.map +1 -1
- package/dist/toast/public.js +1 -1
- package/dist/toast/schema.d.ts +72 -84
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +31 -41
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +6 -3
- package/dist/toast/update.d.ts +104 -89
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +19 -20
- package/dist/tooltip/message.d.ts +26 -47
- package/dist/tooltip/message.d.ts.map +1 -1
- package/dist/tooltip/message.js +15 -40
- package/dist/tooltip/public.d.ts +1 -1
- package/dist/tooltip/public.d.ts.map +1 -1
- package/dist/tooltip/public.js +1 -1
- package/dist/tooltip/tooltip.d.ts +1 -1
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +15 -16
- package/dist/virtualList/index.d.ts +46 -23
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +12 -23
- package/dist/virtualList/public.d.ts +1 -1
- package/dist/virtualList/public.d.ts.map +1 -1
- package/dist/virtualList/public.js +1 -1
- package/package.json +3 -3
package/dist/popover/index.d.ts
CHANGED
|
@@ -18,75 +18,49 @@ export declare const Model: S.Struct<{
|
|
|
18
18
|
readonly maybeLastButtonPointerType: S.Option<S.String>;
|
|
19
19
|
}>;
|
|
20
20
|
export type Model = typeof Model.Type;
|
|
21
|
-
/** Sent when the popover should open via button click or keyboard activation. */
|
|
22
|
-
export declare const RequestedOpen: import("foldkit/schema").CallableTaggedStruct<"RequestedOpen", {}>;
|
|
23
|
-
/** Sent when the popover should close via Escape key or backdrop click. Returns focus to the button. */
|
|
24
|
-
export declare const RequestedClose: import("foldkit/schema").CallableTaggedStruct<"RequestedClose", {}>;
|
|
25
|
-
/** Sent when the popover panel loses focus. Does NOT return focus to the button. */
|
|
26
|
-
export declare const BlurredPanel: import("foldkit/schema").CallableTaggedStruct<"BlurredPanel", {}>;
|
|
27
|
-
/** Sent when the user presses a pointer device on the popover button. Records pointer type and toggles for mouse. */
|
|
28
|
-
export declare const PressedPointerOnButton: import("foldkit/schema").CallableTaggedStruct<"PressedPointerOnButton", {
|
|
29
|
-
pointerType: S.String;
|
|
30
|
-
button: S.Number;
|
|
31
|
-
}>;
|
|
32
|
-
/** Sent when the focus-panel command completes after opening the popover. */
|
|
33
|
-
export declare const CompletedFocusPanel: import("foldkit/schema").CallableTaggedStruct<"CompletedFocusPanel", {}>;
|
|
34
|
-
/** Sent when the focus-button command completes after closing. */
|
|
35
|
-
export declare const CompletedFocusButton: import("foldkit/schema").CallableTaggedStruct<"CompletedFocusButton", {}>;
|
|
36
|
-
/** Sent when the scroll lock command completes. */
|
|
37
|
-
export declare const CompletedLockScroll: import("foldkit/schema").CallableTaggedStruct<"CompletedLockScroll", {}>;
|
|
38
|
-
/** Sent when the scroll unlock command completes. */
|
|
39
|
-
export declare const CompletedUnlockScroll: import("foldkit/schema").CallableTaggedStruct<"CompletedUnlockScroll", {}>;
|
|
40
|
-
/** Sent when the inert-others command completes. */
|
|
41
|
-
export declare const CompletedInertOthers: import("foldkit/schema").CallableTaggedStruct<"CompletedInertOthers", {}>;
|
|
42
|
-
/** Sent when the restore-inert command completes. */
|
|
43
|
-
export declare const CompletedRestoreInert: import("foldkit/schema").CallableTaggedStruct<"CompletedRestoreInert", {}>;
|
|
44
|
-
/** Sent when a mouse click on the button is ignored because pointer-down already handled the toggle. */
|
|
45
|
-
export declare const IgnoredMouseClick: import("foldkit/schema").CallableTaggedStruct<"IgnoredMouseClick", {}>;
|
|
46
|
-
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
47
|
-
export declare const SuppressedSpaceScroll: import("foldkit/schema").CallableTaggedStruct<"SuppressedSpaceScroll", {}>;
|
|
48
|
-
/** Sent when the popover panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
49
|
-
export declare const CompletedAnchorPopover: import("foldkit/schema").CallableTaggedStruct<"CompletedAnchorPopover", {}>;
|
|
50
|
-
/** Sent when the popover backdrop mounts and is portaled to the document body. Update no-ops; surfaces the portal side effect for DevTools. */
|
|
51
|
-
export declare const CompletedPortalPopoverBackdrop: import("foldkit/schema").CallableTaggedStruct<"CompletedPortalPopoverBackdrop", {}>;
|
|
52
|
-
/** Wraps an Animation submodel message for delegation. */
|
|
53
|
-
export declare const GotAnimationMessage: import("foldkit/schema").CallableTaggedStruct<"GotAnimationMessage", {
|
|
54
|
-
message: S.Union<[import("foldkit/schema").CallableTaggedStruct<"Showed", {}>, import("foldkit/schema").CallableTaggedStruct<"Hid", {}>, import("foldkit/schema").CallableTaggedStruct<"CompletedWaitForPaint", {}>, import("foldkit/schema").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
55
|
-
}>;
|
|
56
21
|
/** Union of all messages the popover component can produce. */
|
|
57
|
-
export declare const Message:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
22
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
23
|
+
readonly RequestedOpen: {};
|
|
24
|
+
readonly RequestedClose: {};
|
|
25
|
+
readonly BlurredPanel: {};
|
|
26
|
+
readonly PressedPointerOnButton: {
|
|
27
|
+
readonly pointerType: S.String;
|
|
28
|
+
readonly button: S.Number;
|
|
29
|
+
};
|
|
30
|
+
readonly CompletedFocusPanel: {};
|
|
31
|
+
readonly CompletedFocusButton: {};
|
|
32
|
+
readonly CompletedLockScroll: {};
|
|
33
|
+
readonly CompletedUnlockScroll: {};
|
|
34
|
+
readonly CompletedInertOthers: {};
|
|
35
|
+
readonly CompletedRestoreInert: {};
|
|
36
|
+
readonly IgnoredMouseClick: {};
|
|
37
|
+
readonly SuppressedSpaceScroll: {};
|
|
38
|
+
readonly CompletedAnchorPopover: {};
|
|
39
|
+
readonly CompletedPortalPopoverBackdrop: {};
|
|
40
|
+
readonly GotAnimationMessage: {
|
|
41
|
+
readonly message: import("foldkit/message").MessageUnion<{
|
|
42
|
+
readonly Showed: {};
|
|
43
|
+
readonly Hid: {};
|
|
44
|
+
readonly CompletedWaitForPaint: {};
|
|
45
|
+
readonly EndedAnimation: {};
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
export type RequestedOpen = typeof Message.RequestedOpen.Type;
|
|
50
|
+
export type RequestedClose = typeof Message.RequestedClose.Type;
|
|
51
|
+
export type BlurredPanel = typeof Message.BlurredPanel.Type;
|
|
52
|
+
export type PressedPointerOnButton = typeof Message.PressedPointerOnButton.Type;
|
|
53
|
+
export type IgnoredMouseClick = typeof Message.IgnoredMouseClick.Type;
|
|
54
|
+
export type SuppressedSpaceScroll = typeof Message.SuppressedSpaceScroll.Type;
|
|
80
55
|
export type Message = typeof Message.Type;
|
|
81
|
-
/** Sent to the parent after the popover transitions to its open state. Fires once `update` has processed `RequestedOpen` and `isOpen` reflects the new state. */
|
|
82
|
-
export declare const Opened: import("foldkit/schema").CallableTaggedStruct<"Opened", {}>;
|
|
83
|
-
/** Sent to the parent after the popover transitions to its closed state. */
|
|
84
|
-
export declare const Closed: import("foldkit/schema").CallableTaggedStruct<"Closed", {}>;
|
|
85
56
|
/** Union of out-messages the popover component can produce. Parents reacting to open/close transitions (e.g. to reset related state, fire analytics) read this from the third element of `update`'s return tuple. */
|
|
86
|
-
export declare const OutMessage:
|
|
57
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
58
|
+
readonly Opened: {};
|
|
59
|
+
readonly Closed: {};
|
|
60
|
+
}>;
|
|
87
61
|
export type OutMessage = typeof OutMessage.Type;
|
|
88
|
-
export type Opened = typeof Opened.Type;
|
|
89
|
-
export type Closed = typeof Closed.Type;
|
|
62
|
+
export type Opened = typeof OutMessage.Opened.Type;
|
|
63
|
+
export type Closed = typeof OutMessage.Closed.Type;
|
|
90
64
|
/** Configuration for creating a popover model with `init`. `isAnimated` enables animation 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`). */
|
|
91
65
|
export type InitConfig = Readonly<{
|
|
92
66
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAE9E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAKtC,OAAO,EACL,YAAY,EAGb,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,IAAI,CAA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AEwE;AACxE,eAAO,MAAM,KAAK,GAAI,OAAO,KAAK,KAAG,YACI,CAAA;AAIzC;;;;;;;;;;;4BAW4B;AAC5B,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACrC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACvC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,6EAA6E;AAC7E,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YATP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;oBACJ,MAAM;gBACV,MAAM;qBACD,MAAM;GAoKxB,CAAA"}
|
package/dist/popover/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Array, Effect, Equal, Match as M, Option, Predicate, Schema as S, } fro
|
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
6
|
-
import {
|
|
6
|
+
import { defineMessageUnion } from 'foldkit/message';
|
|
7
7
|
import * as Mount from 'foldkit/mount';
|
|
8
8
|
import { evo } from 'foldkit/struct';
|
|
9
9
|
import { defineView } from 'foldkit/submodel';
|
|
@@ -12,7 +12,7 @@ import { AnchorConfig, anchorSetup, portalToContainingRoot, } from '../anchor/in
|
|
|
12
12
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
13
13
|
// dependency: animation → html → runtime → devtools → popover → animation.
|
|
14
14
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
15
|
-
import {
|
|
15
|
+
import { Message as AnimationMessage, Model as AnimationModel, init as animationInit, } from '../animation/schema.js';
|
|
16
16
|
import { update as animationUpdate } from '../animation/update.js';
|
|
17
17
|
import * as OptionExt from '../internal/optionExtensions.js';
|
|
18
18
|
import { idSelector } from '../internal/selectors.js';
|
|
@@ -28,66 +28,33 @@ export const Model = S.Struct({
|
|
|
28
28
|
maybeLastButtonPointerType: S.Option(S.String),
|
|
29
29
|
});
|
|
30
30
|
// MESSAGE
|
|
31
|
-
/** Sent when the popover should open via button click or keyboard activation. */
|
|
32
|
-
export const RequestedOpen = m('RequestedOpen');
|
|
33
|
-
/** Sent when the popover should close via Escape key or backdrop click. Returns focus to the button. */
|
|
34
|
-
export const RequestedClose = m('RequestedClose');
|
|
35
|
-
/** Sent when the popover panel loses focus. Does NOT return focus to the button. */
|
|
36
|
-
export const BlurredPanel = m('BlurredPanel');
|
|
37
|
-
/** Sent when the user presses a pointer device on the popover button. Records pointer type and toggles for mouse. */
|
|
38
|
-
export const PressedPointerOnButton = m('PressedPointerOnButton', {
|
|
39
|
-
pointerType: S.String,
|
|
40
|
-
button: S.Number,
|
|
41
|
-
});
|
|
42
|
-
/** Sent when the focus-panel command completes after opening the popover. */
|
|
43
|
-
export const CompletedFocusPanel = m('CompletedFocusPanel');
|
|
44
|
-
/** Sent when the focus-button command completes after closing. */
|
|
45
|
-
export const CompletedFocusButton = m('CompletedFocusButton');
|
|
46
|
-
/** Sent when the scroll lock command completes. */
|
|
47
|
-
export const CompletedLockScroll = m('CompletedLockScroll');
|
|
48
|
-
/** Sent when the scroll unlock command completes. */
|
|
49
|
-
export const CompletedUnlockScroll = m('CompletedUnlockScroll');
|
|
50
|
-
/** Sent when the inert-others command completes. */
|
|
51
|
-
export const CompletedInertOthers = m('CompletedInertOthers');
|
|
52
|
-
/** Sent when the restore-inert command completes. */
|
|
53
|
-
export const CompletedRestoreInert = m('CompletedRestoreInert');
|
|
54
|
-
/** Sent when a mouse click on the button is ignored because pointer-down already handled the toggle. */
|
|
55
|
-
export const IgnoredMouseClick = m('IgnoredMouseClick');
|
|
56
|
-
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
57
|
-
export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
58
|
-
/** Sent when the popover panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
59
|
-
export const CompletedAnchorPopover = m('CompletedAnchorPopover');
|
|
60
|
-
/** Sent when the popover backdrop mounts and is portaled to the document body. Update no-ops; surfaces the portal side effect for DevTools. */
|
|
61
|
-
export const CompletedPortalPopoverBackdrop = m('CompletedPortalPopoverBackdrop');
|
|
62
|
-
/** Wraps an Animation submodel message for delegation. */
|
|
63
|
-
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
64
|
-
message: AnimationMessage,
|
|
65
|
-
});
|
|
66
31
|
/** Union of all messages the popover component can produce. */
|
|
67
|
-
export const Message =
|
|
68
|
-
RequestedOpen,
|
|
69
|
-
RequestedClose,
|
|
70
|
-
BlurredPanel,
|
|
71
|
-
PressedPointerOnButton
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
32
|
+
export const Message = defineMessageUnion({
|
|
33
|
+
RequestedOpen: {},
|
|
34
|
+
RequestedClose: {},
|
|
35
|
+
BlurredPanel: {},
|
|
36
|
+
PressedPointerOnButton: {
|
|
37
|
+
pointerType: S.String,
|
|
38
|
+
button: S.Number,
|
|
39
|
+
},
|
|
40
|
+
CompletedFocusPanel: {},
|
|
41
|
+
CompletedFocusButton: {},
|
|
42
|
+
CompletedLockScroll: {},
|
|
43
|
+
CompletedUnlockScroll: {},
|
|
44
|
+
CompletedInertOthers: {},
|
|
45
|
+
CompletedRestoreInert: {},
|
|
46
|
+
IgnoredMouseClick: {},
|
|
47
|
+
SuppressedSpaceScroll: {},
|
|
48
|
+
CompletedAnchorPopover: {},
|
|
49
|
+
CompletedPortalPopoverBackdrop: {},
|
|
50
|
+
GotAnimationMessage: { message: AnimationMessage },
|
|
51
|
+
});
|
|
84
52
|
// OUT MESSAGE
|
|
85
|
-
/** Sent to the parent after the popover transitions to its open state. Fires once `update` has processed `RequestedOpen` and `isOpen` reflects the new state. */
|
|
86
|
-
export const Opened = m('Opened');
|
|
87
|
-
/** Sent to the parent after the popover transitions to its closed state. */
|
|
88
|
-
export const Closed = m('Closed');
|
|
89
53
|
/** Union of out-messages the popover component can produce. Parents reacting to open/close transitions (e.g. to reset related state, fire analytics) read this from the third element of `update`'s return tuple. */
|
|
90
|
-
export const OutMessage =
|
|
54
|
+
export const OutMessage = defineMessageUnion({
|
|
55
|
+
Opened: {},
|
|
56
|
+
Closed: {},
|
|
57
|
+
});
|
|
91
58
|
// INIT
|
|
92
59
|
const LEFT_MOUSE_BUTTON = 0;
|
|
93
60
|
/** Creates an initial popover model from a config. Defaults to closed. */
|
|
@@ -112,46 +79,49 @@ const panelSelector = (id) => __foldkitBrandViewResult((idSelector(`${id}-panel`
|
|
|
112
79
|
* trigger via a native `<label for={Popover.buttonId(id)}>` or an
|
|
113
80
|
* `aria-labelledby` reference. */
|
|
114
81
|
export const buttonId = (id) => __foldkitBrandViewResult((`${id}-button`), "@foldkit/ui/popover/index.js#buttonId");
|
|
115
|
-
const withUpdateReturn = M.withReturnType();
|
|
116
82
|
/** Prevents page scrolling while the popover is open in modal mode. */
|
|
117
83
|
export const LockScroll = Command.define('LockScroll', {
|
|
118
|
-
messages: [CompletedLockScroll],
|
|
119
|
-
execute: Dom.lockScroll.pipe(Effect.as(CompletedLockScroll())),
|
|
84
|
+
messages: [Message.CompletedLockScroll],
|
|
85
|
+
execute: Dom.lockScroll.pipe(Effect.as(Message.CompletedLockScroll())),
|
|
120
86
|
});
|
|
121
87
|
/** Re-enables page scrolling after the popover closes. */
|
|
122
88
|
export const UnlockScroll = Command.define('UnlockScroll', {
|
|
123
|
-
messages: [CompletedUnlockScroll],
|
|
124
|
-
execute: Dom.unlockScroll.pipe(Effect.as(CompletedUnlockScroll())),
|
|
89
|
+
messages: [Message.CompletedUnlockScroll],
|
|
90
|
+
execute: Dom.unlockScroll.pipe(Effect.as(Message.CompletedUnlockScroll())),
|
|
125
91
|
});
|
|
126
92
|
/** Marks all elements outside the popover as inert for modal behavior. */
|
|
127
93
|
export const InertOthers = Command.define('InertOthers', {
|
|
128
94
|
args: { id: S.String },
|
|
129
|
-
messages: [CompletedInertOthers],
|
|
130
|
-
execute: ({ id }) => __foldkitBrandViewResult((Dom.inertOthers(id, [buttonSelector(id), panelSelector(id)]).pipe(Effect.as(CompletedInertOthers()))), "@foldkit/ui/popover/index.js#execute"),
|
|
95
|
+
messages: [Message.CompletedInertOthers],
|
|
96
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.inertOthers(id, [buttonSelector(id), panelSelector(id)]).pipe(Effect.as(Message.CompletedInertOthers()))), "@foldkit/ui/popover/index.js#execute"),
|
|
131
97
|
});
|
|
132
98
|
/** Removes the inert attribute from elements outside the popover. */
|
|
133
99
|
export const RestoreInert = Command.define('RestoreInert', {
|
|
134
100
|
args: { id: S.String },
|
|
135
|
-
messages: [CompletedRestoreInert],
|
|
136
|
-
execute: ({ id }) => __foldkitBrandViewResult((Dom.restoreInert(id).pipe(Effect.as(CompletedRestoreInert()))), "@foldkit/ui/popover/index.js#execute~2"),
|
|
101
|
+
messages: [Message.CompletedRestoreInert],
|
|
102
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.restoreInert(id).pipe(Effect.as(Message.CompletedRestoreInert()))), "@foldkit/ui/popover/index.js#execute~2"),
|
|
137
103
|
});
|
|
138
104
|
/** Moves focus to the popover panel after opening. */
|
|
139
105
|
export const FocusPanel = Command.define('FocusPanel', {
|
|
140
106
|
args: { id: S.String },
|
|
141
|
-
messages: [CompletedFocusPanel],
|
|
142
|
-
execute: ({ id }) => __foldkitBrandViewResult((Dom.focus(panelSelector(id)).pipe(Effect.ignore, Effect.as(CompletedFocusPanel()))), "@foldkit/ui/popover/index.js#execute~3"),
|
|
107
|
+
messages: [Message.CompletedFocusPanel],
|
|
108
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.focus(panelSelector(id)).pipe(Effect.ignore, Effect.as(Message.CompletedFocusPanel()))), "@foldkit/ui/popover/index.js#execute~3"),
|
|
143
109
|
});
|
|
144
110
|
/** Moves focus back to the popover button after closing. */
|
|
145
111
|
export const FocusButton = Command.define('FocusButton', {
|
|
146
112
|
args: { id: S.String },
|
|
147
|
-
messages: [CompletedFocusButton],
|
|
148
|
-
execute: ({ id }) => __foldkitBrandViewResult((Dom.focus(buttonSelector(id)).pipe(Effect.ignore, Effect.as(CompletedFocusButton()))), "@foldkit/ui/popover/index.js#execute~4"),
|
|
113
|
+
messages: [Message.CompletedFocusButton],
|
|
114
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.focus(buttonSelector(id)).pipe(Effect.ignore, Effect.as(Message.CompletedFocusButton()))), "@foldkit/ui/popover/index.js#execute~4"),
|
|
149
115
|
});
|
|
150
116
|
/** Detects whether the popover button moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation submodel that leave is complete. */
|
|
151
117
|
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', {
|
|
152
118
|
args: { id: S.String },
|
|
153
|
-
messages: [GotAnimationMessage],
|
|
154
|
-
execute: ({ id }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(buttonSelector(id)).pipe(Effect.as(
|
|
119
|
+
messages: [Message.GotAnimationMessage],
|
|
120
|
+
execute: ({ id }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(buttonSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
121
|
+
message: AnimationMessage.EndedAnimation(),
|
|
122
|
+
}))), Dom.waitForAnimationSettled(panelSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
123
|
+
message: AnimationMessage.EndedAnimation(),
|
|
124
|
+
}))))), "@foldkit/ui/popover/index.js#execute~5"),
|
|
155
125
|
});
|
|
156
126
|
const foldAnimationOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
|
|
157
127
|
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([
|
|
@@ -164,7 +134,7 @@ const foldAnimation = Update.foldChild({
|
|
|
164
134
|
update: animationUpdate,
|
|
165
135
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/popover/index.js#read"),
|
|
166
136
|
write: (model, nextAnimation) => __foldkitBrandViewResult((evo(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/popover/index.js#animation") })), "@foldkit/ui/popover/index.js#write"),
|
|
167
|
-
toParentMessage: message => __foldkitBrandViewResult((GotAnimationMessage({ message })), "@foldkit/ui/popover/index.js#toParentMessage"),
|
|
137
|
+
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/popover/index.js#toParentMessage"),
|
|
168
138
|
toParentOutMessage: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#toParentOutMessage"),
|
|
169
139
|
foldOutMessage: foldAnimationOutMessage,
|
|
170
140
|
});
|
|
@@ -186,17 +156,17 @@ export const update = (model, message) => {
|
|
|
186
156
|
]);
|
|
187
157
|
const openPopover = (baseModel) => {
|
|
188
158
|
if (model.isAnimated) {
|
|
189
|
-
const [nextModel, animationCommands] = foldAnimation(baseModel,
|
|
159
|
+
const [nextModel, animationCommands] = foldAnimation(baseModel, AnimationMessage.Showed());
|
|
190
160
|
return __foldkitBrandViewResult(([
|
|
191
161
|
evo(nextModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/popover/index.js#isOpen~2") }),
|
|
192
162
|
[...openCommands, ...animationCommands],
|
|
193
|
-
Option.some(Opened()),
|
|
163
|
+
Option.some(OutMessage.Opened()),
|
|
194
164
|
]), "@foldkit/ui/popover/index.js#openPopover");
|
|
195
165
|
}
|
|
196
166
|
return __foldkitBrandViewResult(([
|
|
197
167
|
evo(baseModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/popover/index.js#isOpen~3") }),
|
|
198
168
|
openCommands,
|
|
199
|
-
Option.some(Opened()),
|
|
169
|
+
Option.some(OutMessage.Opened()),
|
|
200
170
|
]), "@foldkit/ui/popover/index.js#openPopover");
|
|
201
171
|
};
|
|
202
172
|
const closePopover = (baseModel, commands) => {
|
|
@@ -205,16 +175,16 @@ export const update = (model, message) => {
|
|
|
205
175
|
}
|
|
206
176
|
const closed = closedModel(baseModel);
|
|
207
177
|
if (model.isAnimated) {
|
|
208
|
-
const [nextModel, animationCommands] = foldAnimation(closed,
|
|
178
|
+
const [nextModel, animationCommands] = foldAnimation(closed, AnimationMessage.Hid());
|
|
209
179
|
return __foldkitBrandViewResult(([
|
|
210
180
|
nextModel,
|
|
211
181
|
[...commands, ...animationCommands],
|
|
212
|
-
Option.some(Closed()),
|
|
182
|
+
Option.some(OutMessage.Closed()),
|
|
213
183
|
]), "@foldkit/ui/popover/index.js#closePopover");
|
|
214
184
|
}
|
|
215
|
-
return __foldkitBrandViewResult(([closed, commands, Option.some(Closed())]), "@foldkit/ui/popover/index.js#closePopover");
|
|
185
|
+
return __foldkitBrandViewResult(([closed, commands, Option.some(OutMessage.Closed())]), "@foldkit/ui/popover/index.js#closePopover");
|
|
216
186
|
};
|
|
217
|
-
return __foldkitBrandViewResult((
|
|
187
|
+
return __foldkitBrandViewResult((Message.match(message, {
|
|
218
188
|
RequestedOpen: () => __foldkitBrandViewResult((openPopover(model)), "@foldkit/ui/popover/index.js#RequestedOpen"),
|
|
219
189
|
RequestedClose: () => __foldkitBrandViewResult((closePopover(model, closeWithFocusCommands)), "@foldkit/ui/popover/index.js#RequestedClose"),
|
|
220
190
|
BlurredPanel: () => {
|
|
@@ -257,7 +227,7 @@ export const update = (model, message) => {
|
|
|
257
227
|
SuppressedSpaceScroll: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/popover/index.js#SuppressedSpaceScroll"),
|
|
258
228
|
CompletedAnchorPopover: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/popover/index.js#CompletedAnchorPopover"),
|
|
259
229
|
CompletedPortalPopoverBackdrop: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/popover/index.js#CompletedPortalPopoverBackdrop"),
|
|
260
|
-
}))
|
|
230
|
+
})), "@foldkit/ui/popover/index.js#update");
|
|
261
231
|
};
|
|
262
232
|
/** The anchor-positioning Mount this Popover renders on its panel. Exposed so
|
|
263
233
|
* Scene tests can call `Scene.Mount.resolve(AnchorPopover, CompletedAnchorPopover())`
|
|
@@ -266,7 +236,7 @@ export const AnchorPopover = Mount.define('AnchorPopover', {
|
|
|
266
236
|
buttonId: S.String,
|
|
267
237
|
anchor: AnchorConfig,
|
|
268
238
|
focusSelector: S.optional(S.String),
|
|
269
|
-
}, CompletedAnchorPopover)(({ buttonId, anchor, focusSelector }) => __foldkitBrandViewResult((element => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
239
|
+
}, Message.CompletedAnchorPopover)(({ buttonId, anchor, focusSelector }) => __foldkitBrandViewResult((element => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
270
240
|
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((anchorSetup(element, {
|
|
271
241
|
buttonId,
|
|
272
242
|
anchor,
|
|
@@ -274,22 +244,22 @@ export const AnchorPopover = Mount.define('AnchorPopover', {
|
|
|
274
244
|
focusAfterPosition: true,
|
|
275
245
|
...(focusSelector !== undefined && { focusSelector }),
|
|
276
246
|
})), "@foldkit/ui/popover/index.js#anonymous~6")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/popover/index.js#anonymous~7"));
|
|
277
|
-
return __foldkitBrandViewResult((CompletedAnchorPopover()), "@foldkit/ui/popover/index.js#anonymous~5");
|
|
247
|
+
return __foldkitBrandViewResult((Message.CompletedAnchorPopover()), "@foldkit/ui/popover/index.js#anonymous~5");
|
|
278
248
|
})), "@foldkit/ui/popover/index.js#anonymous~4")), "@foldkit/ui/popover/index.js#anonymous~3"));
|
|
279
249
|
/** The backdrop-portaling Mount this Popover renders. Exposed so Scene tests can
|
|
280
250
|
* call `Scene.Mount.resolve(PortalPopoverBackdrop, CompletedPortalPopoverBackdrop())` to
|
|
281
251
|
* acknowledge the mount produced by the rendered backdrop. */
|
|
282
|
-
export const PortalPopoverBackdrop = Mount.define('PortalPopoverBackdrop', CompletedPortalPopoverBackdrop)(element => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
252
|
+
export const PortalPopoverBackdrop = Mount.define('PortalPopoverBackdrop', Message.CompletedPortalPopoverBackdrop)(element => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
283
253
|
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/popover/index.js#anonymous~10")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/popover/index.js#anonymous~11"));
|
|
284
|
-
return __foldkitBrandViewResult((CompletedPortalPopoverBackdrop()), "@foldkit/ui/popover/index.js#anonymous~9");
|
|
254
|
+
return __foldkitBrandViewResult((Message.CompletedPortalPopoverBackdrop()), "@foldkit/ui/popover/index.js#anonymous~9");
|
|
285
255
|
})), "@foldkit/ui/popover/index.js#anonymous~8"));
|
|
286
256
|
/** Programmatically opens the popover, updating the model and returning
|
|
287
257
|
* focus and modal commands plus an `Opened` OutMessage. */
|
|
288
|
-
export const open = (model) => __foldkitBrandViewResult((update(model, RequestedOpen())), "@foldkit/ui/popover/index.js#open");
|
|
258
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, Message.RequestedOpen())), "@foldkit/ui/popover/index.js#open");
|
|
289
259
|
/** Programmatically closes the popover. When it was open, updates the Model
|
|
290
260
|
* and returns focus and modal Commands plus a `Closed` OutMessage. When it
|
|
291
261
|
* was already closed, it is a no-op: no Commands and no OutMessage. */
|
|
292
|
-
export const close = (model) => __foldkitBrandViewResult((update(model, RequestedClose())), "@foldkit/ui/popover/index.js#close");
|
|
262
|
+
export const close = (model) => __foldkitBrandViewResult((update(model, Message.RequestedClose())), "@foldkit/ui/popover/index.js#close");
|
|
293
263
|
/** Renders a headless popover with a trigger button and a floating panel. */
|
|
294
264
|
export const view = defineView((model, viewInputs, h) => {
|
|
295
265
|
const { id, isOpen, contentFocus, animation: { transitionState }, maybeLastButtonPointerType, } = model;
|
|
@@ -311,22 +281,22 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
311
281
|
h.DataAttribute('leave', ''),
|
|
312
282
|
h.DataAttribute('transition', ''),
|
|
313
283
|
]), "@foldkit/ui/popover/index.js#anonymous~16")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/popover/index.js#anonymous~17")));
|
|
314
|
-
const handleButtonKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(isOpen ? RequestedClose() : RequestedOpen())), "@foldkit/ui/popover/index.js#anonymous~18")), M.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~19")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~20")))), "@foldkit/ui/popover/index.js#handleButtonKeyDown");
|
|
315
|
-
const handleButtonPointerDown = (pointerType, button) => __foldkitBrandViewResult((Option.some(PressedPointerOnButton({ pointerType, button }))), "@foldkit/ui/popover/index.js#handleButtonPointerDown");
|
|
284
|
+
const handleButtonKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(isOpen ? Message.RequestedClose() : Message.RequestedOpen())), "@foldkit/ui/popover/index.js#anonymous~18")), M.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~19")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~20")))), "@foldkit/ui/popover/index.js#handleButtonKeyDown");
|
|
285
|
+
const handleButtonPointerDown = (pointerType, button) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnButton({ pointerType, button }))), "@foldkit/ui/popover/index.js#handleButtonPointerDown");
|
|
316
286
|
const handleButtonClick = () => {
|
|
317
287
|
const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/popover/index.js#anonymous~21"));
|
|
318
288
|
if (isMouse) {
|
|
319
|
-
return __foldkitBrandViewResult((IgnoredMouseClick()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
289
|
+
return __foldkitBrandViewResult((Message.IgnoredMouseClick()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
320
290
|
}
|
|
321
291
|
else if (isOpen) {
|
|
322
|
-
return __foldkitBrandViewResult((RequestedClose()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
292
|
+
return __foldkitBrandViewResult((Message.RequestedClose()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
323
293
|
}
|
|
324
294
|
else {
|
|
325
|
-
return __foldkitBrandViewResult((RequestedOpen()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
295
|
+
return __foldkitBrandViewResult((Message.RequestedOpen()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
326
296
|
}
|
|
327
297
|
};
|
|
328
|
-
const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', SuppressedSpaceScroll())), "@foldkit/ui/popover/index.js#handleSpaceKeyUp");
|
|
329
|
-
const handlePanelKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~22")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~23")))), "@foldkit/ui/popover/index.js#handlePanelKeyDown");
|
|
298
|
+
const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', Message.SuppressedSpaceScroll())), "@foldkit/ui/popover/index.js#handleSpaceKeyUp");
|
|
299
|
+
const handlePanelKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~22")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~23")))), "@foldkit/ui/popover/index.js#handlePanelKeyDown");
|
|
330
300
|
const resolveButtonLabel = () => {
|
|
331
301
|
if (Predicate.isNotUndefined(ariaLabel)) {
|
|
332
302
|
return __foldkitBrandViewResult(([h.AriaLabel(ariaLabel)]), "@foldkit/ui/popover/index.js#resolveButtonLabel");
|
|
@@ -374,12 +344,12 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
374
344
|
? []
|
|
375
345
|
: [
|
|
376
346
|
h.OnKeyDownPreventDefault(handlePanelKeyDown),
|
|
377
|
-
...(contentFocus ? [] : [h.OnBlur(BlurredPanel())]),
|
|
347
|
+
...(contentFocus ? [] : [h.OnBlur(Message.BlurredPanel())]),
|
|
378
348
|
]),
|
|
379
349
|
];
|
|
380
350
|
const backdropAttributes = [
|
|
381
351
|
h.OnMount(PortalPopoverBackdrop()),
|
|
382
|
-
...(isLeaving ? [] : [h.OnClick(RequestedClose())]),
|
|
352
|
+
...(isLeaving ? [] : [h.OnClick(Message.RequestedClose())]),
|
|
383
353
|
];
|
|
384
354
|
return __foldkitBrandViewResult((toView({
|
|
385
355
|
button: childAttributes(buttonAttributes),
|
package/dist/popover/public.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, open, close, view, buttonId, Model, Message, OutMessage, Opened, Closed, RequestedOpen, RequestedClose,
|
|
1
|
+
export { init, update, open, close, view, buttonId, Model, Message, OutMessage, type Opened, type Closed, type RequestedOpen, type RequestedClose, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, type BlurredPanel, type PressedPointerOnButton, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewInputs, RenderInfo } from './index.js';
|
|
3
3
|
export type { AnchorConfig } from '../anchor/index.js';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,EAC5B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/popover/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, view, buttonId, Model, Message, OutMessage,
|
|
1
|
+
export { init, update, open, close, view, buttonId, Model, Message, OutMessage, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
@@ -15,43 +15,32 @@ export declare const Model: S.Struct<{
|
|
|
15
15
|
readonly maybeFocusedIndex: S.Option<S.Number>;
|
|
16
16
|
}>;
|
|
17
17
|
export type Model = typeof Model.Type;
|
|
18
|
-
/** Sent when an option is committed via click or keyboard. Commits the option
|
|
19
|
-
* as the new selection and moves focus onto it. */
|
|
20
|
-
export declare const SelectedOption: import("foldkit/schema").CallableTaggedStruct<"SelectedOption", {
|
|
21
|
-
index: S.Number;
|
|
22
|
-
value: S.String;
|
|
23
|
-
}>;
|
|
24
|
-
/** Sent when an option receives keyboard focus without being committed, which
|
|
25
|
-
* is how a read-only group navigates. */
|
|
26
|
-
export declare const FocusedOption: import("foldkit/schema").CallableTaggedStruct<"FocusedOption", {
|
|
27
|
-
index: S.Number;
|
|
28
|
-
}>;
|
|
29
|
-
/** Sent when the focus-option command completes. */
|
|
30
|
-
export declare const CompletedFocusOption: import("foldkit/schema").CallableTaggedStruct<"CompletedFocusOption", {}>;
|
|
31
18
|
/** Union of all messages the radio group can produce. */
|
|
32
|
-
export declare const Message:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export declare const Selected: import("foldkit/schema").CallableTaggedStruct<"Selected", {
|
|
42
|
-
value: S.String;
|
|
43
|
-
index: S.Number;
|
|
19
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
20
|
+
readonly SelectedOption: {
|
|
21
|
+
readonly index: S.Number;
|
|
22
|
+
readonly value: S.String;
|
|
23
|
+
};
|
|
24
|
+
readonly FocusedOption: {
|
|
25
|
+
readonly index: S.Number;
|
|
26
|
+
};
|
|
27
|
+
readonly CompletedFocusOption: {};
|
|
44
28
|
}>;
|
|
29
|
+
export type SelectedOption = typeof Message.SelectedOption.Type;
|
|
30
|
+
export type FocusedOption = typeof Message.FocusedOption.Type;
|
|
31
|
+
export type Message = typeof Message.Type;
|
|
45
32
|
export type Selected<Value extends string = string> = Readonly<{
|
|
46
33
|
readonly _tag: 'Selected';
|
|
47
34
|
readonly value: Value;
|
|
48
35
|
readonly index: number;
|
|
49
36
|
}>;
|
|
50
37
|
/** Union of out-messages the radio group can produce. Surfaced as the third element of `update`'s return tuple and pattern-matched by the parent. */
|
|
51
|
-
export declare const OutMessage:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
39
|
+
readonly Selected: {
|
|
40
|
+
readonly value: S.String;
|
|
41
|
+
readonly index: S.Number;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
55
44
|
/** Generic over `Value extends string` so consumers using
|
|
56
45
|
* `RadioGroup.create<MyUnion>()` receive `value: MyUnion` in the
|
|
57
46
|
* `Selected` OutMessage. Defaults to `string`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/radioGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EAEN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc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