@foldkit/ui 0.135.0 → 0.136.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/update.d.ts.map +1 -1
- package/dist/animation/update.js +13 -6
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +41 -37
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +85 -55
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +23 -11
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +67 -58
- package/dist/internal/selectors.d.ts +10 -0
- package/dist/internal/selectors.d.ts.map +1 -1
- package/dist/internal/selectors.js +10 -0
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +84 -46
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +79 -41
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +48 -22
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +2 -1
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +16 -12
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +21 -17
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +11 -7
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +22 -18
- package/package.json +2 -2
package/dist/combobox/shared.js
CHANGED
|
@@ -175,24 +175,54 @@ export const closedBaseModel = (model) => __foldkitBrandViewResult((constrainedE
|
|
|
175
175
|
maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#maybeLastPointerPosition"),
|
|
176
176
|
})), "@foldkit/ui/combobox/shared.js#closedBaseModel");
|
|
177
177
|
/** Prevents page scrolling while the combobox popup is open in modal mode. */
|
|
178
|
-
export const LockScroll = Command.define('LockScroll',
|
|
178
|
+
export const LockScroll = Command.define('LockScroll', {
|
|
179
|
+
messages: [CompletedLockScroll],
|
|
180
|
+
execute: Dom.lockScroll.pipe(Effect.as(CompletedLockScroll())),
|
|
181
|
+
});
|
|
179
182
|
/** Re-enables page scrolling after the combobox popup closes. */
|
|
180
|
-
export const UnlockScroll = Command.define('UnlockScroll',
|
|
183
|
+
export const UnlockScroll = Command.define('UnlockScroll', {
|
|
184
|
+
messages: [CompletedUnlockScroll],
|
|
185
|
+
execute: Dom.unlockScroll.pipe(Effect.as(CompletedUnlockScroll())),
|
|
186
|
+
});
|
|
181
187
|
/** Marks all elements outside the combobox as inert for modal behavior. */
|
|
182
|
-
export const InertOthers = Command.define('InertOthers', {
|
|
188
|
+
export const InertOthers = Command.define('InertOthers', {
|
|
189
|
+
args: { id: S.String },
|
|
190
|
+
messages: [CompletedInertOthers],
|
|
191
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.inertOthers(id, [inputWrapperSelector(id), itemsSelector(id)]).pipe(Effect.as(CompletedInertOthers()))), "@foldkit/ui/combobox/shared.js#execute"),
|
|
192
|
+
});
|
|
183
193
|
/** Removes the inert attribute from elements outside the combobox. */
|
|
184
|
-
export const RestoreInert = Command.define('RestoreInert', {
|
|
194
|
+
export const RestoreInert = Command.define('RestoreInert', {
|
|
195
|
+
args: { id: S.String },
|
|
196
|
+
messages: [CompletedRestoreInert],
|
|
197
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.restoreInert(id).pipe(Effect.as(CompletedRestoreInert()))), "@foldkit/ui/combobox/shared.js#execute~2"),
|
|
198
|
+
});
|
|
185
199
|
/** Moves focus to the combobox input after selection or close. */
|
|
186
|
-
export const FocusInput = Command.define('FocusInput', {
|
|
200
|
+
export const FocusInput = Command.define('FocusInput', {
|
|
201
|
+
args: { id: S.String },
|
|
202
|
+
messages: [CompletedFocusInput],
|
|
203
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.focus(inputSelector(id)).pipe(Effect.ignore, Effect.as(CompletedFocusInput()))), "@foldkit/ui/combobox/shared.js#execute~3"),
|
|
204
|
+
});
|
|
187
205
|
/** Scrolls the active combobox item into view after keyboard navigation. */
|
|
188
|
-
export const ScrollIntoView = Command.define('ScrollIntoView', {
|
|
206
|
+
export const ScrollIntoView = Command.define('ScrollIntoView', {
|
|
207
|
+
args: { id: S.String, index: S.Number },
|
|
208
|
+
messages: [CompletedScrollIntoView],
|
|
209
|
+
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.scrollIntoView(itemSelector(id, index)).pipe(Effect.ignore, Effect.as(CompletedScrollIntoView()))), "@foldkit/ui/combobox/shared.js#execute~4"),
|
|
210
|
+
});
|
|
189
211
|
/** Programmatically clicks the active combobox item's DOM element. */
|
|
190
|
-
export const ClickItem = Command.define('ClickItem', {
|
|
212
|
+
export const ClickItem = Command.define('ClickItem', {
|
|
213
|
+
args: { id: S.String, index: S.Number },
|
|
214
|
+
messages: [CompletedClickItem],
|
|
215
|
+
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.clickElement(itemSelector(id, index)).pipe(Effect.ignore, Effect.as(CompletedClickItem()))), "@foldkit/ui/combobox/shared.js#execute~5"),
|
|
216
|
+
});
|
|
191
217
|
/** Detects whether the combobox input wrapper moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation submodel that leave is complete. */
|
|
192
|
-
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', {
|
|
218
|
+
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', {
|
|
219
|
+
args: { id: S.String },
|
|
220
|
+
messages: [GotAnimationMessage],
|
|
221
|
+
execute: ({ id }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(inputWrapperSelector(id)).pipe(Effect.as(GotAnimationMessage({ message: AnimationEndedAnimation() }))), Dom.waitForAnimationSettled(itemsSelector(id)).pipe(Effect.as(GotAnimationMessage({ message: AnimationEndedAnimation() }))))), "@foldkit/ui/combobox/shared.js#execute~6"),
|
|
222
|
+
});
|
|
193
223
|
const delegateToAnimation = (model, animationMessage) => {
|
|
194
224
|
const [nextAnimation, animationCommands, maybeOutMessage] = animationUpdate(model.animation, animationMessage);
|
|
195
|
-
const mappedCommands = Command.mapMessages(animationCommands, message => __foldkitBrandViewResult((GotAnimationMessage({ message })), "@foldkit/ui/combobox/shared.js#anonymous
|
|
225
|
+
const mappedCommands = Command.mapMessages(animationCommands, message => __foldkitBrandViewResult((GotAnimationMessage({ message })), "@foldkit/ui/combobox/shared.js#anonymous"));
|
|
196
226
|
const additionalCommands = Option.match(maybeOutMessage, {
|
|
197
227
|
onNone: () => __foldkitBrandViewResult(([]), "@foldkit/ui/combobox/shared.js#onNone"),
|
|
198
228
|
onSome: M.type().pipe(M.tagsExhaustive({
|
|
@@ -247,7 +277,7 @@ export const makeUpdate = (handlers) => {
|
|
|
247
277
|
}
|
|
248
278
|
return __foldkitBrandViewResult(([closed, commands, maybeCloseOutMessage]), "@foldkit/ui/combobox/shared.js#closeCombobox");
|
|
249
279
|
};
|
|
250
|
-
return __foldkitBrandViewResult((M.value(message).pipe(withUpdateReturn, M.tag('CompletedLockScroll', 'CompletedUnlockScroll', 'CompletedInertOthers', 'CompletedRestoreInert', 'CompletedFocusInput', 'CompletedScrollIntoView', 'CompletedClickItem', 'CompletedAnchorCombobox', 'CompletedAttachComboboxPreventBlur', 'CompletedAttachComboboxSelectOnFocus', 'CompletedPortalComboboxBackdrop', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
280
|
+
return __foldkitBrandViewResult((M.value(message).pipe(withUpdateReturn, M.tag('CompletedLockScroll', 'CompletedUnlockScroll', 'CompletedInertOthers', 'CompletedRestoreInert', 'CompletedFocusInput', 'CompletedScrollIntoView', 'CompletedClickItem', 'CompletedAnchorCombobox', 'CompletedAttachComboboxPreventBlur', 'CompletedAttachComboboxSelectOnFocus', 'CompletedPortalComboboxBackdrop', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/combobox/shared.js#anonymous~2")), M.tagsExhaustive({
|
|
251
281
|
Opened: ({ maybeActiveItemIndex }) => __foldkitBrandViewResult((openCombobox(constrainedEvo(model, {
|
|
252
282
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((maybeActiveItemIndex), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~2"),
|
|
253
283
|
activationTrigger: () => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
|
|
@@ -285,7 +315,7 @@ export const makeUpdate = (handlers) => {
|
|
|
285
315
|
]), "@foldkit/ui/combobox/shared.js#ActivatedItem");
|
|
286
316
|
},
|
|
287
317
|
MovedPointerOverItem: ({ index, screenX, screenY }) => {
|
|
288
|
-
const isSamePosition = Option.exists(model.maybeLastPointerPosition, position => __foldkitBrandViewResult((position.screenX === screenX && position.screenY === screenY), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
318
|
+
const isSamePosition = Option.exists(model.maybeLastPointerPosition, position => __foldkitBrandViewResult((position.screenX === screenX && position.screenY === screenY), "@foldkit/ui/combobox/shared.js#anonymous~3"));
|
|
289
319
|
if (isSamePosition) {
|
|
290
320
|
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/combobox/shared.js#MovedPointerOverItem");
|
|
291
321
|
}
|
|
@@ -390,10 +420,10 @@ export const AnchorCombobox = Mount.define('AnchorCombobox', { buttonId: S.Strin
|
|
|
390
420
|
capture: true,
|
|
391
421
|
});
|
|
392
422
|
teardownAnchor();
|
|
393
|
-
}), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
394
|
-
}), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
395
|
-
return __foldkitBrandViewResult((CompletedAnchorCombobox()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
396
|
-
})), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
423
|
+
}), "@foldkit/ui/combobox/shared.js#anonymous~7");
|
|
424
|
+
}), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/combobox/shared.js#anonymous~9"));
|
|
425
|
+
return __foldkitBrandViewResult((CompletedAnchorCombobox()), "@foldkit/ui/combobox/shared.js#anonymous~6");
|
|
426
|
+
})), "@foldkit/ui/combobox/shared.js#anonymous~5")), "@foldkit/ui/combobox/shared.js#anonymous~4"));
|
|
397
427
|
/** The Mount this Combobox renders to install a `pointerdown`-cancelling
|
|
398
428
|
* capture listener that prevents blur on item presses. Exposed so Scene
|
|
399
429
|
* tests can call
|
|
@@ -404,12 +434,12 @@ export const AttachComboboxPreventBlur = Mount.define('AttachComboboxPreventBlur
|
|
|
404
434
|
event.preventDefault();
|
|
405
435
|
};
|
|
406
436
|
element.addEventListener('pointerdown', handler, { capture: true });
|
|
407
|
-
return __foldkitBrandViewResult((handler), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
437
|
+
return __foldkitBrandViewResult((handler), "@foldkit/ui/combobox/shared.js#anonymous~12");
|
|
408
438
|
}), handler => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((element.removeEventListener('pointerdown', handler, {
|
|
409
439
|
capture: true,
|
|
410
|
-
})), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
411
|
-
return __foldkitBrandViewResult((CompletedAttachComboboxPreventBlur()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
412
|
-
})), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
440
|
+
})), "@foldkit/ui/combobox/shared.js#anonymous~14"))), "@foldkit/ui/combobox/shared.js#anonymous~13"));
|
|
441
|
+
return __foldkitBrandViewResult((CompletedAttachComboboxPreventBlur()), "@foldkit/ui/combobox/shared.js#anonymous~11");
|
|
442
|
+
})), "@foldkit/ui/combobox/shared.js#anonymous~10"));
|
|
413
443
|
/** The Mount this Combobox renders to install the input's select-on-focus
|
|
414
444
|
* behavior. Exposed so Scene tests can call
|
|
415
445
|
* `Scene.Mount.resolve(AttachComboboxSelectOnFocus, CompletedAttachComboboxSelectOnFocus())`. */
|
|
@@ -421,17 +451,17 @@ export const AttachComboboxSelectOnFocus = Mount.define('AttachComboboxSelectOnF
|
|
|
421
451
|
}
|
|
422
452
|
};
|
|
423
453
|
element.addEventListener('focus', handler);
|
|
424
|
-
return __foldkitBrandViewResult((handler), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
425
|
-
}), handler => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((element.removeEventListener('focus', handler)), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
426
|
-
return __foldkitBrandViewResult((CompletedAttachComboboxSelectOnFocus()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
427
|
-
})), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
454
|
+
return __foldkitBrandViewResult((handler), "@foldkit/ui/combobox/shared.js#anonymous~17");
|
|
455
|
+
}), handler => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((element.removeEventListener('focus', handler)), "@foldkit/ui/combobox/shared.js#anonymous~19"))), "@foldkit/ui/combobox/shared.js#anonymous~18"));
|
|
456
|
+
return __foldkitBrandViewResult((CompletedAttachComboboxSelectOnFocus()), "@foldkit/ui/combobox/shared.js#anonymous~16");
|
|
457
|
+
})), "@foldkit/ui/combobox/shared.js#anonymous~15"));
|
|
428
458
|
/** The backdrop-portaling Mount this Combobox renders. Exposed so Scene tests can
|
|
429
459
|
* call `Scene.Mount.resolve(PortalComboboxBackdrop, CompletedPortalComboboxBackdrop())` to
|
|
430
460
|
* acknowledge the mount produced by the rendered backdrop. */
|
|
431
461
|
export const PortalComboboxBackdrop = Mount.define('PortalComboboxBackdrop', CompletedPortalComboboxBackdrop)(element => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
432
|
-
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
433
|
-
return __foldkitBrandViewResult((CompletedPortalComboboxBackdrop()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
434
|
-
})), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
462
|
+
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/combobox/shared.js#anonymous~22")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/combobox/shared.js#anonymous~23"));
|
|
463
|
+
return __foldkitBrandViewResult((CompletedPortalComboboxBackdrop()), "@foldkit/ui/combobox/shared.js#anonymous~21");
|
|
464
|
+
})), "@foldkit/ui/combobox/shared.js#anonymous~20"));
|
|
435
465
|
/** Creates a combobox view function from variant-specific behavior. Shared rendering logic (input, items, transitions, keyboard navigation) is handled internally; only listbox multi-select semantics vary by variant. */
|
|
436
466
|
export const makeView = (behavior) => {
|
|
437
467
|
const impl = defineView((model, viewInputs, h) => {
|
|
@@ -456,70 +486,70 @@ export const makeView = (behavior) => {
|
|
|
456
486
|
h.DataAttribute('closed', ''),
|
|
457
487
|
h.DataAttribute('enter', ''),
|
|
458
488
|
h.DataAttribute('transition', ''),
|
|
459
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
489
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~25")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
460
490
|
h.DataAttribute('enter', ''),
|
|
461
491
|
h.DataAttribute('transition', ''),
|
|
462
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
492
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~26")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
463
493
|
h.DataAttribute('leave', ''),
|
|
464
494
|
h.DataAttribute('transition', ''),
|
|
465
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
495
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~27")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
466
496
|
h.DataAttribute('closed', ''),
|
|
467
497
|
h.DataAttribute('leave', ''),
|
|
468
498
|
h.DataAttribute('transition', ''),
|
|
469
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
499
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~28")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/combobox/shared.js#anonymous~29")));
|
|
470
500
|
const isDisabledAtIndex = (index) => __foldkitBrandViewResult((Predicate.isNotUndefined(isItemDisabled) &&
|
|
471
|
-
pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((isItemDisabled(item, index)), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
501
|
+
pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((isItemDisabled(item, index)), "@foldkit/ui/combobox/shared.js#anonymous~30")))), "@foldkit/ui/combobox/shared.js#isDisabledAtIndex");
|
|
472
502
|
const firstEnabledIndex = findFirstEnabledIndex(items.length, 0, isDisabledAtIndex)(0, 1);
|
|
473
503
|
const lastEnabledIndex = findFirstEnabledIndex(items.length, 0, isDisabledAtIndex)(items.length - 1, -1);
|
|
474
|
-
const resolveActiveIndex = keyToIndex('ArrowDown', 'ArrowUp', items.length, Option.getOrElse(maybeActiveItemIndex, () => __foldkitBrandViewResult((-1), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
475
|
-
const resolveImmediateSelection = (targetIndex) => __foldkitBrandViewResult((pipe(OptionExt.when(immediate, targetIndex), Option.flatMap(index => __foldkitBrandViewResult((Array.get(items, index)), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
504
|
+
const resolveActiveIndex = keyToIndex('ArrowDown', 'ArrowUp', items.length, Option.getOrElse(maybeActiveItemIndex, () => __foldkitBrandViewResult((-1), "@foldkit/ui/combobox/shared.js#anonymous~31")), isDisabledAtIndex);
|
|
505
|
+
const resolveImmediateSelection = (targetIndex) => __foldkitBrandViewResult((pipe(OptionExt.when(immediate, targetIndex), Option.flatMap(index => __foldkitBrandViewResult((Array.get(items, index)), "@foldkit/ui/combobox/shared.js#anonymous~32")), Option.map(targetItem => (__foldkitBrandViewResult(({
|
|
476
506
|
item: itemToValue(targetItem, targetIndex),
|
|
477
|
-
}), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
507
|
+
}), "@foldkit/ui/combobox/shared.js#anonymous~33"))))), "@foldkit/ui/combobox/shared.js#resolveImmediateSelection");
|
|
478
508
|
const handleInputKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('ArrowDown', () => {
|
|
479
509
|
if (!isOpen) {
|
|
480
510
|
return __foldkitBrandViewResult((Option.some(Opened({
|
|
481
511
|
maybeActiveItemIndex: Option.some(firstEnabledIndex),
|
|
482
|
-
}))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
512
|
+
}))), "@foldkit/ui/combobox/shared.js#anonymous~34");
|
|
483
513
|
}
|
|
484
514
|
const targetIndex = resolveActiveIndex('ArrowDown');
|
|
485
515
|
return __foldkitBrandViewResult((Option.some(ActivatedItem({
|
|
486
516
|
index: targetIndex,
|
|
487
517
|
activationTrigger: 'Keyboard',
|
|
488
518
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
489
|
-
}))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
519
|
+
}))), "@foldkit/ui/combobox/shared.js#anonymous~34");
|
|
490
520
|
}), M.when('ArrowUp', () => {
|
|
491
521
|
if (!isOpen) {
|
|
492
522
|
return __foldkitBrandViewResult((Option.some(Opened({
|
|
493
523
|
maybeActiveItemIndex: Option.some(lastEnabledIndex),
|
|
494
|
-
}))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
524
|
+
}))), "@foldkit/ui/combobox/shared.js#anonymous~35");
|
|
495
525
|
}
|
|
496
526
|
const targetIndex = resolveActiveIndex('ArrowUp');
|
|
497
527
|
return __foldkitBrandViewResult((Option.some(ActivatedItem({
|
|
498
528
|
index: targetIndex,
|
|
499
529
|
activationTrigger: 'Keyboard',
|
|
500
530
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
501
|
-
}))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
531
|
+
}))), "@foldkit/ui/combobox/shared.js#anonymous~35");
|
|
502
532
|
}), M.when('Enter', () => {
|
|
503
533
|
if (!isOpen) {
|
|
504
|
-
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
534
|
+
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~36");
|
|
505
535
|
}
|
|
506
|
-
return __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((RequestedItemClick({ index })), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
536
|
+
return __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((RequestedItemClick({ index })), "@foldkit/ui/combobox/shared.js#anonymous~37"))), "@foldkit/ui/combobox/shared.js#anonymous~36");
|
|
507
537
|
}), M.when('Escape', () => {
|
|
508
538
|
if (!isOpen) {
|
|
509
|
-
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
539
|
+
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~38");
|
|
510
540
|
}
|
|
511
|
-
return __foldkitBrandViewResult((Option.some(Closed({ restingInputValue }))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
541
|
+
return __foldkitBrandViewResult((Option.some(Closed({ restingInputValue }))), "@foldkit/ui/combobox/shared.js#anonymous~38");
|
|
512
542
|
}), M.whenOr('Home', 'End', () => {
|
|
513
543
|
if (!isOpen) {
|
|
514
|
-
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
544
|
+
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~39");
|
|
515
545
|
}
|
|
516
546
|
const targetIndex = resolveActiveIndex(key);
|
|
517
547
|
return __foldkitBrandViewResult((Option.some(ActivatedItem({
|
|
518
548
|
index: targetIndex,
|
|
519
549
|
activationTrigger: 'Keyboard',
|
|
520
550
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
521
|
-
}))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
522
|
-
}), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
551
|
+
}))), "@foldkit/ui/combobox/shared.js#anonymous~39");
|
|
552
|
+
}), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~40")))), "@foldkit/ui/combobox/shared.js#handleInputKeyDown");
|
|
523
553
|
const maybeActiveDescendant = Option.match(maybeActiveItemIndex, {
|
|
524
554
|
onNone: () => __foldkitBrandViewResult(([]), "@foldkit/ui/combobox/shared.js#onNone~4"),
|
|
525
555
|
onSome: index => __foldkitBrandViewResult(([h.AriaActiveDescendant(itemId(id, index))]), "@foldkit/ui/combobox/shared.js#onSome~3"),
|
|
@@ -539,7 +569,7 @@ export const makeView = (behavior) => {
|
|
|
539
569
|
...(isDisabled
|
|
540
570
|
? [h.AriaDisabled(true), h.DataAttribute('disabled', '')]
|
|
541
571
|
: [
|
|
542
|
-
h.OnInput(value => __foldkitBrandViewResult((UpdatedInputValue({ value })), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
572
|
+
h.OnInput(value => __foldkitBrandViewResult((UpdatedInputValue({ value })), "@foldkit/ui/combobox/shared.js#anonymous~41")),
|
|
543
573
|
h.OnKeyDownPreventDefault(handleInputKeyDown),
|
|
544
574
|
h.OnBlur(BlurredInput({ restingInputValue })),
|
|
545
575
|
...(openOnFocus
|
|
@@ -579,7 +609,7 @@ export const makeView = (behavior) => {
|
|
|
579
609
|
...itemsAttributes,
|
|
580
610
|
];
|
|
581
611
|
const comboboxItems = Array.map(items, (item, index) => {
|
|
582
|
-
const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
612
|
+
const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/combobox/shared.js#anonymous~43"));
|
|
583
613
|
const isDisabledItem = isDisabledAtIndex(index);
|
|
584
614
|
const isSelectedItem = isValueSelected(itemToValue(item, index));
|
|
585
615
|
const itemConfig = itemToConfig(item, {
|
|
@@ -607,13 +637,13 @@ export const makeView = (behavior) => {
|
|
|
607
637
|
...(isActiveItem
|
|
608
638
|
? []
|
|
609
639
|
: [
|
|
610
|
-
h.OnPointerMove((screenX, screenY, pointerType) => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', MovedPointerOverItem({ index, screenX, screenY }))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
640
|
+
h.OnPointerMove((screenX, screenY, pointerType) => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', MovedPointerOverItem({ index, screenX, screenY }))), "@foldkit/ui/combobox/shared.js#anonymous~44")),
|
|
611
641
|
]),
|
|
612
|
-
h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', DeactivatedItem())), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
642
|
+
h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', DeactivatedItem())), "@foldkit/ui/combobox/shared.js#anonymous~45")),
|
|
613
643
|
]
|
|
614
644
|
: []),
|
|
615
645
|
...(itemConfig.className ? [h.Class(itemConfig.className)] : []),
|
|
616
|
-
], [itemConfig.content])), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
646
|
+
], [itemConfig.content])), "@foldkit/ui/combobox/shared.js#anonymous~42");
|
|
617
647
|
});
|
|
618
648
|
const renderGroupedItems = () => {
|
|
619
649
|
if (!itemGroupKey) {
|
|
@@ -622,7 +652,7 @@ export const makeView = (behavior) => {
|
|
|
622
652
|
const segments = groupContiguous(comboboxItems, (_, index) => __foldkitBrandViewResult((Array.get(items, index).pipe(Option.match({
|
|
623
653
|
onNone: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/shared.js#onNone~5"),
|
|
624
654
|
onSome: item => __foldkitBrandViewResult((itemGroupKey(item, index)), "@foldkit/ui/combobox/shared.js#onSome~4"),
|
|
625
|
-
}))), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
655
|
+
}))), "@foldkit/ui/combobox/shared.js#anonymous~46"));
|
|
626
656
|
return __foldkitBrandViewResult((Array.flatMap(segments, (segment, segmentIndex) => {
|
|
627
657
|
const maybeHeading = Option.fromNullishOr(groupToHeading && groupToHeading(segment.key));
|
|
628
658
|
const headingId = `${id}-heading-${segment.key}`;
|
|
@@ -658,7 +688,7 @@ export const makeView = (behavior) => {
|
|
|
658
688
|
], []),
|
|
659
689
|
]
|
|
660
690
|
: [];
|
|
661
|
-
return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
691
|
+
return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/combobox/shared.js#anonymous~47");
|
|
662
692
|
})), "@foldkit/ui/combobox/shared.js#renderGroupedItems");
|
|
663
693
|
};
|
|
664
694
|
const backdrop = h.keyed('div')(`${id}-backdrop`, [
|
|
@@ -713,7 +743,7 @@ export const makeView = (behavior) => {
|
|
|
713
743
|
h.Type('hidden'),
|
|
714
744
|
h.Name(formName),
|
|
715
745
|
h.Value(selectedValue),
|
|
716
|
-
])), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
746
|
+
])), "@foldkit/ui/combobox/shared.js#anonymous~48")),
|
|
717
747
|
})
|
|
718
748
|
: [];
|
|
719
749
|
const wrapperAttributes = [
|
|
@@ -732,9 +762,9 @@ export const makeView = (behavior) => {
|
|
|
732
762
|
? visibleContent
|
|
733
763
|
: []),
|
|
734
764
|
...hiddenInputs,
|
|
735
|
-
])), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
765
|
+
])), "@foldkit/ui/combobox/shared.js#anonymous~24");
|
|
736
766
|
});
|
|
737
767
|
return __foldkitBrandViewResult((() =>
|
|
738
768
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
739
|
-
__foldkitBrandViewResult((impl), "@foldkit/ui/combobox/shared.js#anonymous~
|
|
769
|
+
__foldkitBrandViewResult((impl), "@foldkit/ui/combobox/shared.js#anonymous~49")), "@foldkit/ui/combobox/shared.js#makeView");
|
|
740
770
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAwB9E,6IAA6I;AAC7I,eAAO,MAAM,KAAK;;;;;;;;;;EAMhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,yEAAyE;AACzE,eAAO,MAAM,aAAa,oEAAqB,CAAA;AAC/C,uFAAuF;AACvF,eAAO,MAAM,cAAc,qEAAsB,CAAA;AACjD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,0EAA2B,CAAA;AAC3D,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,2EAA4B,CAAA;AAC7D;;;;;4DAK4D;AAC5D,eAAO,MAAM,SAAS,gEAAiB,CAAA;AACvC,gEAAgE;AAChE,eAAO,MAAM,+BAA+B,sFAE3C,CAAA;AACD,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB;;EAE9B,CAAA;AAEF,8DAA8D;AAC9D,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,KAAK,CAC3B;IACE,OAAO,aAAa;IACpB,OAAO,cAAc;IACrB,OAAO,mBAAmB;IAC1B,OAAO,oBAAoB;IAC3B,OAAO,SAAS;IAChB,OAAO,+BAA+B;IAC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;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;CACrC,CAAC,CAAA;AAEF;;;2EAG2E;AAC3E,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAPP,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;GA4FrC,CAAA"}
|
package/dist/dialog/index.js
CHANGED
|
@@ -91,14 +91,26 @@ const withUpdateReturn = M.withReturnType();
|
|
|
91
91
|
* high-z-index overlays stay interactive. It layers the dialog with a high
|
|
92
92
|
* z-index, traps focus, and dispatches a `cancel` event on Esc. The Dialog
|
|
93
93
|
* component supplies its own backdrop. */
|
|
94
|
-
export const ShowDialog = Command.define('ShowDialog', {
|
|
94
|
+
export const ShowDialog = Command.define('ShowDialog', {
|
|
95
|
+
args: { id: S.String, focusSelector: S.String },
|
|
96
|
+
messages: [CompletedShowDialog],
|
|
97
|
+
execute: ({ id, focusSelector }) => __foldkitBrandViewResult((Dom.lockScroll.pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.showDialog(dialogSelector(id), { focusSelector })), "@foldkit/ui/dialog/index.js#anonymous")), Effect.ignore, Effect.as(CompletedShowDialog()))), "@foldkit/ui/dialog/index.js#execute"),
|
|
98
|
+
});
|
|
95
99
|
/** Calls `close()` on the native dialog element and unlocks page scroll. */
|
|
96
|
-
export const CloseDialog = Command.define('CloseDialog', {
|
|
100
|
+
export const CloseDialog = Command.define('CloseDialog', {
|
|
101
|
+
args: { id: S.String },
|
|
102
|
+
messages: [CompletedCloseDialog],
|
|
103
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.closeDialog(dialogSelector(id)).pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.unlockScroll), "@foldkit/ui/dialog/index.js#anonymous~2")), Effect.ignore, Effect.as(CompletedCloseDialog()))), "@foldkit/ui/dialog/index.js#execute~2"),
|
|
104
|
+
});
|
|
97
105
|
/** Releases the framework hygiene the dialog holds while open (scroll lock,
|
|
98
106
|
* focus trap, return focus, stack entry) when the element unmounts without a
|
|
99
107
|
* purposeful close. Idempotent: a no-op if the dialog already released its
|
|
100
108
|
* resources through `CloseDialog`. */
|
|
101
|
-
export const ReleaseDialogResources = Command.define('ReleaseDialogResources', {
|
|
109
|
+
export const ReleaseDialogResources = Command.define('ReleaseDialogResources', {
|
|
110
|
+
args: { id: S.String },
|
|
111
|
+
messages: [CompletedReleaseDialogResources],
|
|
112
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.releaseDialogResources(id).pipe(Effect.ignore, Effect.as(CompletedReleaseDialogResources()))), "@foldkit/ui/dialog/index.js#execute~3"),
|
|
113
|
+
});
|
|
102
114
|
const wrapAnimationMessage = (message) => __foldkitBrandViewResult((GotAnimationMessage({ message })), "@foldkit/ui/dialog/index.js#wrapAnimationMessage");
|
|
103
115
|
const delegateToAnimation = (model, animationMessage) => {
|
|
104
116
|
const [nextAnimation, animationCommands, maybeOutMessage] = animationUpdate(model.animation, animationMessage);
|
|
@@ -124,8 +136,8 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
124
136
|
const wasClosed = !model.isOpen;
|
|
125
137
|
const maybeShow = Option.liftPredicate(ShowDialog({
|
|
126
138
|
id: model.id,
|
|
127
|
-
focusSelector: Option.getOrElse(model.maybeFocusSelector, () => __foldkitBrandViewResult((initialFocusMarkerSelector), "@foldkit/ui/dialog/index.js#anonymous~
|
|
128
|
-
}), () => __foldkitBrandViewResult((wasClosed), "@foldkit/ui/dialog/index.js#anonymous~
|
|
139
|
+
focusSelector: Option.getOrElse(model.maybeFocusSelector, () => __foldkitBrandViewResult((initialFocusMarkerSelector), "@foldkit/ui/dialog/index.js#anonymous~3")),
|
|
140
|
+
}), () => __foldkitBrandViewResult((wasClosed), "@foldkit/ui/dialog/index.js#anonymous~4"));
|
|
129
141
|
const maybeOutMessage = wasClosed
|
|
130
142
|
? Option.some(Opened())
|
|
131
143
|
: Option.none();
|
|
@@ -156,7 +168,7 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
156
168
|
const [nextModel, animationCommands] = delegateToAnimation(evo(model, { isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~3") }), AnimationHid());
|
|
157
169
|
return __foldkitBrandViewResult(([nextModel, animationCommands, maybeOutMessage]), "@foldkit/ui/dialog/index.js#RequestedClose");
|
|
158
170
|
}
|
|
159
|
-
const maybeClose = Option.liftPredicate(CloseDialog({ id: model.id }), () => __foldkitBrandViewResult((wasOpen), "@foldkit/ui/dialog/index.js#anonymous~
|
|
171
|
+
const maybeClose = Option.liftPredicate(CloseDialog({ id: model.id }), () => __foldkitBrandViewResult((wasOpen), "@foldkit/ui/dialog/index.js#anonymous~5"));
|
|
160
172
|
return __foldkitBrandViewResult(([
|
|
161
173
|
evo(model, { isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~4") }),
|
|
162
174
|
Option.toArray(maybeClose),
|
|
@@ -221,17 +233,17 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
221
233
|
h.DataAttribute('closed', ''),
|
|
222
234
|
h.DataAttribute('enter', ''),
|
|
223
235
|
h.DataAttribute('transition', ''),
|
|
224
|
-
]), "@foldkit/ui/dialog/index.js#anonymous~
|
|
236
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~7")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
225
237
|
h.DataAttribute('enter', ''),
|
|
226
238
|
h.DataAttribute('transition', ''),
|
|
227
|
-
]), "@foldkit/ui/dialog/index.js#anonymous~
|
|
239
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~8")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
228
240
|
h.DataAttribute('leave', ''),
|
|
229
241
|
h.DataAttribute('transition', ''),
|
|
230
|
-
]), "@foldkit/ui/dialog/index.js#anonymous~
|
|
242
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~9")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
231
243
|
h.DataAttribute('closed', ''),
|
|
232
244
|
h.DataAttribute('leave', ''),
|
|
233
245
|
h.DataAttribute('transition', ''),
|
|
234
|
-
]), "@foldkit/ui/dialog/index.js#anonymous~
|
|
246
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~10")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/dialog/index.js#anonymous~11")));
|
|
235
247
|
const dialogAttributes = [
|
|
236
248
|
h.Id(id),
|
|
237
249
|
h.AriaLabelledBy(titleId(model)),
|
|
@@ -275,5 +287,5 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
275
287
|
initialFocus: childAttributes(initialFocusAttributes),
|
|
276
288
|
closeButton: childAttributes(closeButtonAttributes),
|
|
277
289
|
isVisible,
|
|
278
|
-
})), "@foldkit/ui/dialog/index.js#anonymous~
|
|
290
|
+
})), "@foldkit/ui/dialog/index.js#anonymous~6");
|
|
279
291
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dragAndDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,WAAW,EAEX,MAAM,EAEN,MAAM,IAAI,CAAC,EACX,MAAM,EAEP,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAmB,MAAM,cAAc,CAAA;AAIhF,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dragAndDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,WAAW,EAEX,MAAM,EAEN,MAAM,IAAI,CAAC,EACX,MAAM,EAEP,MAAM,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