@foldkit/ui 0.155.0 → 0.156.0-canary.0053b7691fcd
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/anchor/anchor.d.ts +18 -18
- package/dist/anchor/anchor.d.ts.map +1 -1
- package/dist/anchor/anchor.js +16 -16
- package/dist/animation/index.js +6 -6
- package/dist/animation/schema.d.ts +6 -6
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +5 -5
- package/dist/animation/update.d.ts +2 -2
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +9 -9
- package/dist/calendar/index.d.ts +56 -56
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +49 -37
- package/dist/checkbox/index.js +2 -2
- package/dist/combobox/multi.d.ts +19 -19
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +2 -2
- package/dist/combobox/shared.d.ts +61 -61
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +51 -51
- package/dist/combobox/single.d.ts +19 -19
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +2 -2
- package/dist/datePicker/index.d.ts +72 -72
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +9 -9
- package/dist/dialog/index.d.ts +14 -14
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +14 -14
- package/dist/disclosure/index.js +2 -2
- package/dist/dragAndDrop/index.d.ts +61 -61
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +85 -85
- package/dist/fileDrop/index.d.ts +6 -6
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +6 -6
- package/dist/hoverIntent/hoverIntent.d.ts +19 -16
- package/dist/hoverIntent/hoverIntent.d.ts.map +1 -1
- package/dist/hoverIntent/hoverIntent.js +49 -46
- package/dist/hoverIntent/message.d.ts +4 -4
- package/dist/hoverIntent/message.d.ts.map +1 -1
- package/dist/hoverIntent/message.js +4 -4
- package/dist/hoverIntent/public.d.ts +1 -1
- package/dist/hoverIntent/public.d.ts.map +1 -1
- package/dist/hoverIntent/public.js +1 -1
- package/dist/keyboard.js +2 -2
- package/dist/listbox/multi.d.ts +19 -19
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +2 -2
- package/dist/listbox/shared.d.ts +58 -58
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +52 -52
- package/dist/listbox/single.d.ts +19 -19
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +2 -2
- package/dist/menu/index.d.ts +67 -67
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +60 -57
- package/dist/popover/index.d.ts +34 -34
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +27 -27
- package/dist/radioGroup/index.d.ts +12 -12
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +16 -16
- package/dist/slider/index.d.ts +14 -14
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +31 -31
- package/dist/switch/index.js +2 -2
- package/dist/tabs/index.d.ts +14 -14
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +18 -18
- package/dist/test/apps/disabledButton.d.ts +12 -12
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +4 -4
- package/dist/toast/index.d.ts +63 -63
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +19 -19
- package/dist/toast/schema.d.ts +55 -55
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +25 -25
- package/dist/toast/update.d.ts +61 -61
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +5 -5
- package/dist/tooltip/message.d.ts +3 -3
- package/dist/tooltip/message.d.ts.map +1 -1
- package/dist/tooltip/message.js +3 -3
- package/dist/tooltip/tooltip.d.ts +24 -24
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +13 -13
- package/dist/typeahead.d.ts.map +1 -1
- package/dist/typeahead.js +3 -3
- package/dist/virtualList/index.d.ts +15 -15
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +13 -13
- package/package.json +4 -4
package/dist/combobox/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Array, Effect, Match
|
|
2
|
+
import { Array, Effect, Match, Option, Predicate, Schema, pipe } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { defineMessageUnion } from 'foldkit/message';
|
|
@@ -20,21 +20,21 @@ import { findFirstEnabledIndex, keyToIndex } from '../keyboard.js';
|
|
|
20
20
|
export { groupContiguous };
|
|
21
21
|
// MODEL
|
|
22
22
|
/** Schema for the activation trigger: whether the user interacted via mouse or keyboard. */
|
|
23
|
-
export const ActivationTrigger =
|
|
24
|
-
/** Schema fields shared by all combobox variants (single-select and multi-select). Spread into each variant's `
|
|
25
|
-
export const BaseModel =
|
|
26
|
-
id:
|
|
27
|
-
isOpen:
|
|
28
|
-
isAnimated:
|
|
29
|
-
isModal:
|
|
30
|
-
nullable:
|
|
31
|
-
immediate:
|
|
32
|
-
selectInputOnFocus:
|
|
23
|
+
export const ActivationTrigger = Schema.Literals(['Pointer', 'Keyboard']);
|
|
24
|
+
/** Schema fields shared by all combobox variants (single-select and multi-select). Spread into each variant's `Schema.Struct` to avoid duplicating field definitions. */
|
|
25
|
+
export const BaseModel = Schema.Struct({
|
|
26
|
+
id: Schema.String,
|
|
27
|
+
isOpen: Schema.Boolean,
|
|
28
|
+
isAnimated: Schema.Boolean,
|
|
29
|
+
isModal: Schema.Boolean,
|
|
30
|
+
nullable: Schema.Boolean,
|
|
31
|
+
immediate: Schema.Boolean,
|
|
32
|
+
selectInputOnFocus: Schema.Boolean,
|
|
33
33
|
animation: AnimationModel,
|
|
34
|
-
maybeActiveItemIndex:
|
|
34
|
+
maybeActiveItemIndex: Schema.Option(Schema.Number),
|
|
35
35
|
activationTrigger: ActivationTrigger,
|
|
36
|
-
inputValue:
|
|
37
|
-
maybeLastPointerPosition:
|
|
36
|
+
inputValue: Schema.String,
|
|
37
|
+
maybeLastPointerPosition: Schema.Option(Schema.Struct({ screenX: Schema.Number, screenY: Schema.Number })),
|
|
38
38
|
});
|
|
39
39
|
/** Creates the shared base fields for a combobox model from a config. Each variant spreads this and adds its selection fields. */
|
|
40
40
|
export const baseInit = (config) => (__foldkitBrandViewResult(({
|
|
@@ -54,32 +54,32 @@ export const baseInit = (config) => (__foldkitBrandViewResult(({
|
|
|
54
54
|
// MESSAGE
|
|
55
55
|
/** Union of all messages the combobox component can produce. */
|
|
56
56
|
export const Message = defineMessageUnion({
|
|
57
|
-
Opened: { maybeActiveItemIndex:
|
|
57
|
+
Opened: { maybeActiveItemIndex: Schema.Option(Schema.Number) },
|
|
58
58
|
Closed: {
|
|
59
|
-
restingInputValue:
|
|
60
|
-
isClearable:
|
|
59
|
+
restingInputValue: Schema.String,
|
|
60
|
+
isClearable: Schema.Boolean,
|
|
61
61
|
},
|
|
62
62
|
BlurredInput: {
|
|
63
|
-
restingInputValue:
|
|
64
|
-
isClearable:
|
|
63
|
+
restingInputValue: Schema.String,
|
|
64
|
+
isClearable: Schema.Boolean,
|
|
65
65
|
},
|
|
66
66
|
ActivatedItem: {
|
|
67
|
-
index:
|
|
67
|
+
index: Schema.Number,
|
|
68
68
|
activationTrigger: ActivationTrigger,
|
|
69
|
-
maybeImmediateSelection:
|
|
69
|
+
maybeImmediateSelection: Schema.Option(Schema.Struct({ item: Schema.String })),
|
|
70
70
|
},
|
|
71
71
|
DeactivatedItem: {},
|
|
72
72
|
SelectedItem: {
|
|
73
|
-
item:
|
|
74
|
-
displayText:
|
|
75
|
-
wasSelected:
|
|
73
|
+
item: Schema.String,
|
|
74
|
+
displayText: Schema.String,
|
|
75
|
+
wasSelected: Schema.Boolean,
|
|
76
76
|
},
|
|
77
77
|
MovedPointerOverItem: {
|
|
78
|
-
index:
|
|
79
|
-
screenX:
|
|
80
|
-
screenY:
|
|
78
|
+
index: Schema.Number,
|
|
79
|
+
screenX: Schema.Number,
|
|
80
|
+
screenY: Schema.Number,
|
|
81
81
|
},
|
|
82
|
-
RequestedItemClick: { index:
|
|
82
|
+
RequestedItemClick: { index: Schema.Number },
|
|
83
83
|
SuppressedItemCommit: {},
|
|
84
84
|
CompletedLockScroll: {},
|
|
85
85
|
CompletedUnlockScroll: {},
|
|
@@ -93,15 +93,15 @@ export const Message = defineMessageUnion({
|
|
|
93
93
|
CompletedAttachComboboxSelectOnFocus: {},
|
|
94
94
|
CompletedPortalComboboxBackdrop: {},
|
|
95
95
|
GotAnimationMessage: { message: AnimationMessage },
|
|
96
|
-
UpdatedInputValue: { value:
|
|
96
|
+
UpdatedInputValue: { value: Schema.String },
|
|
97
97
|
PressedToggleButton: {
|
|
98
|
-
restingInputValue:
|
|
99
|
-
isClearable:
|
|
98
|
+
restingInputValue: Schema.String,
|
|
99
|
+
isClearable: Schema.Boolean,
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
102
|
/** Union of out-messages the combobox component can produce. The parent folds `Selected` into the selection it owns and clears that selection on `ClearedSelection`. */
|
|
103
103
|
export const OutMessage = defineMessageUnion({
|
|
104
|
-
Selected: { value:
|
|
104
|
+
Selected: { value: Schema.String },
|
|
105
105
|
ClearedSelection: {},
|
|
106
106
|
});
|
|
107
107
|
// SELECTORS
|
|
@@ -137,37 +137,37 @@ export const UnlockScroll = Command.define('UnlockScroll', {
|
|
|
137
137
|
});
|
|
138
138
|
/** Marks all elements outside the combobox as inert for modal behavior. */
|
|
139
139
|
export const InertOthers = Command.define('InertOthers', {
|
|
140
|
-
args: { id:
|
|
140
|
+
args: { id: Schema.String },
|
|
141
141
|
messages: [Message.CompletedInertOthers],
|
|
142
142
|
execute: ({ id }) => __foldkitBrandViewResult((Dom.inertOthers(id, [inputWrapperSelector(id), itemsSelector(id)]).pipe(Effect.as(Message.CompletedInertOthers()))), "@foldkit/ui/combobox/shared.js#execute"),
|
|
143
143
|
});
|
|
144
144
|
/** Removes the inert attribute from elements outside the combobox. */
|
|
145
145
|
export const RestoreInert = Command.define('RestoreInert', {
|
|
146
|
-
args: { id:
|
|
146
|
+
args: { id: Schema.String },
|
|
147
147
|
messages: [Message.CompletedRestoreInert],
|
|
148
148
|
execute: ({ id }) => __foldkitBrandViewResult((Dom.restoreInert(id).pipe(Effect.as(Message.CompletedRestoreInert()))), "@foldkit/ui/combobox/shared.js#execute~2"),
|
|
149
149
|
});
|
|
150
150
|
/** Moves focus to the combobox input after selection or close. */
|
|
151
151
|
export const FocusInput = Command.define('FocusInput', {
|
|
152
|
-
args: { id:
|
|
152
|
+
args: { id: Schema.String },
|
|
153
153
|
messages: [Message.CompletedFocusInput],
|
|
154
154
|
execute: ({ id }) => __foldkitBrandViewResult((Dom.focus(inputSelector(id)).pipe(Effect.ignore, Effect.as(Message.CompletedFocusInput()))), "@foldkit/ui/combobox/shared.js#execute~3"),
|
|
155
155
|
});
|
|
156
156
|
/** Scrolls the active combobox item into view after keyboard navigation. */
|
|
157
157
|
export const ScrollIntoView = Command.define('ScrollIntoView', {
|
|
158
|
-
args: { id:
|
|
158
|
+
args: { id: Schema.String, index: Schema.Number },
|
|
159
159
|
messages: [Message.CompletedScrollIntoView],
|
|
160
160
|
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.scrollIntoView(itemSelector(id, index)).pipe(Effect.ignore, Effect.as(Message.CompletedScrollIntoView()))), "@foldkit/ui/combobox/shared.js#execute~4"),
|
|
161
161
|
});
|
|
162
162
|
/** Programmatically clicks the active combobox item's DOM element. */
|
|
163
163
|
export const ClickItem = Command.define('ClickItem', {
|
|
164
|
-
args: { id:
|
|
164
|
+
args: { id: Schema.String, index: Schema.Number },
|
|
165
165
|
messages: [Message.CompletedClickItem],
|
|
166
166
|
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.clickElement(itemSelector(id, index)).pipe(Effect.ignore, Effect.as(Message.CompletedClickItem()))), "@foldkit/ui/combobox/shared.js#execute~5"),
|
|
167
167
|
});
|
|
168
168
|
/** 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. */
|
|
169
169
|
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', {
|
|
170
|
-
args: { id:
|
|
170
|
+
args: { id: Schema.String },
|
|
171
171
|
messages: [Message.GotAnimationMessage],
|
|
172
172
|
execute: ({ id }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(inputWrapperSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
173
173
|
message: AnimationMessage.EndedAnimation(),
|
|
@@ -177,7 +177,7 @@ export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnim
|
|
|
177
177
|
});
|
|
178
178
|
/** 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. */
|
|
179
179
|
export const makeUpdate = (handlers) => {
|
|
180
|
-
const foldAnimationOutMessage =
|
|
180
|
+
const foldAnimationOutMessage = Match.type().pipe(Match.withReturnType(), Match.tagsExhaustive({
|
|
181
181
|
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
182
182
|
model,
|
|
183
183
|
commands: [DetectMovementOrAnimationEnd({ id: model.id })],
|
|
@@ -369,7 +369,7 @@ export const makeUpdate = (handlers) => {
|
|
|
369
369
|
* Scene tests can call
|
|
370
370
|
* `Scene.Mount.resolve(AnchorCombobox, CompletedAnchorCombobox())`. */
|
|
371
371
|
export const AnchorCombobox = Mount.define('AnchorCombobox', {
|
|
372
|
-
args: { buttonId:
|
|
372
|
+
args: { buttonId: Schema.String, anchor: AnchorConfig },
|
|
373
373
|
messages: [Message.CompletedAnchorCombobox],
|
|
374
374
|
execute: ({ element, buttonId, anchor }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
375
375
|
yield* Effect.acquireRelease(Effect.sync(() => {
|
|
@@ -461,21 +461,21 @@ export const makeView = (behavior) => {
|
|
|
461
461
|
const isValueSelected = (itemValue) => __foldkitBrandViewResult((Array.contains(selectedValues, itemValue)), "@foldkit/ui/combobox/shared.js#isValueSelected");
|
|
462
462
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
463
463
|
const isVisible = isOpen || isLeaving;
|
|
464
|
-
const animationAttributes =
|
|
464
|
+
const animationAttributes = Match.value(transitionState).pipe(Match.when('EnterStart', () => __foldkitBrandViewResult(([
|
|
465
465
|
h.DataAttribute('closed', ''),
|
|
466
466
|
h.DataAttribute('enter', ''),
|
|
467
467
|
h.DataAttribute('transition', ''),
|
|
468
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~25")),
|
|
468
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~25")), Match.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
469
469
|
h.DataAttribute('enter', ''),
|
|
470
470
|
h.DataAttribute('transition', ''),
|
|
471
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~26")),
|
|
471
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~26")), Match.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
472
472
|
h.DataAttribute('leave', ''),
|
|
473
473
|
h.DataAttribute('transition', ''),
|
|
474
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~27")),
|
|
474
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~27")), Match.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
475
475
|
h.DataAttribute('closed', ''),
|
|
476
476
|
h.DataAttribute('leave', ''),
|
|
477
477
|
h.DataAttribute('transition', ''),
|
|
478
|
-
]), "@foldkit/ui/combobox/shared.js#anonymous~28")),
|
|
478
|
+
]), "@foldkit/ui/combobox/shared.js#anonymous~28")), Match.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/combobox/shared.js#anonymous~29")));
|
|
479
479
|
const isDisabledAtIndex = (index) => __foldkitBrandViewResult((Predicate.isNotUndefined(isItemDisabled) &&
|
|
480
480
|
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");
|
|
481
481
|
const firstEnabledIndex = findFirstEnabledIndex(items.length, 0, isDisabledAtIndex)(0, 1);
|
|
@@ -499,7 +499,7 @@ export const makeView = (behavior) => {
|
|
|
499
499
|
return __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/combobox/shared.js#anonymous~34"))), "@foldkit/ui/combobox/shared.js#resolveCommitMessage");
|
|
500
500
|
}
|
|
501
501
|
};
|
|
502
|
-
const handleInputKeyDown = (key) => __foldkitBrandViewResult((
|
|
502
|
+
const handleInputKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when('ArrowDown', () => {
|
|
503
503
|
if (!isOpen) {
|
|
504
504
|
return __foldkitBrandViewResult((Option.some(Message.Opened({
|
|
505
505
|
maybeActiveItemIndex: Option.some(firstEnabledIndex),
|
|
@@ -511,7 +511,7 @@ export const makeView = (behavior) => {
|
|
|
511
511
|
activationTrigger: 'Keyboard',
|
|
512
512
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
513
513
|
}))), "@foldkit/ui/combobox/shared.js#anonymous~35");
|
|
514
|
-
}),
|
|
514
|
+
}), Match.when('ArrowUp', () => {
|
|
515
515
|
if (!isOpen) {
|
|
516
516
|
return __foldkitBrandViewResult((Option.some(Message.Opened({
|
|
517
517
|
maybeActiveItemIndex: Option.some(lastEnabledIndex),
|
|
@@ -523,17 +523,17 @@ export const makeView = (behavior) => {
|
|
|
523
523
|
activationTrigger: 'Keyboard',
|
|
524
524
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
525
525
|
}))), "@foldkit/ui/combobox/shared.js#anonymous~36");
|
|
526
|
-
}),
|
|
526
|
+
}), Match.when('Enter', () => {
|
|
527
527
|
if (!isOpen) {
|
|
528
528
|
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~37");
|
|
529
529
|
}
|
|
530
530
|
return __foldkitBrandViewResult((resolveCommitMessage()), "@foldkit/ui/combobox/shared.js#anonymous~37");
|
|
531
|
-
}),
|
|
531
|
+
}), Match.when('Escape', () => {
|
|
532
532
|
if (!isOpen) {
|
|
533
533
|
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~38");
|
|
534
534
|
}
|
|
535
535
|
return __foldkitBrandViewResult((Option.some(Message.Closed({ restingInputValue, isClearable: !isReadOnly }))), "@foldkit/ui/combobox/shared.js#anonymous~38");
|
|
536
|
-
}),
|
|
536
|
+
}), Match.whenOr('Home', 'End', () => {
|
|
537
537
|
if (!isOpen) {
|
|
538
538
|
return __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~39");
|
|
539
539
|
}
|
|
@@ -543,7 +543,7 @@ export const makeView = (behavior) => {
|
|
|
543
543
|
activationTrigger: 'Keyboard',
|
|
544
544
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
545
545
|
}))), "@foldkit/ui/combobox/shared.js#anonymous~39");
|
|
546
|
-
}),
|
|
546
|
+
}), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#anonymous~40")))), "@foldkit/ui/combobox/shared.js#handleInputKeyDown");
|
|
547
547
|
const maybeActiveDescendant = Option.match(maybeActiveItemIndex, {
|
|
548
548
|
onNone: () => __foldkitBrandViewResult(([]), "@foldkit/ui/combobox/shared.js#onNone~3"),
|
|
549
549
|
onSome: index => __foldkitBrandViewResult(([h.AriaActiveDescendant(itemId(id, index))]), "@foldkit/ui/combobox/shared.js#onSome~3"),
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { Option, Schema
|
|
1
|
+
import { Option, Schema } from 'effect';
|
|
2
2
|
import { type Update } from 'foldkit';
|
|
3
3
|
import { type View as SubmodelView } from 'foldkit/submodel';
|
|
4
4
|
import { type BaseInitConfig, type BaseViewInputsCommon, Message, OutMessage } from './shared.js';
|
|
5
5
|
/** Schema for the single-select combobox's private interaction state (open/closed status, active item, activation trigger, typed input value). The selection is owned by the parent and passed in via `ViewInputs.maybeSelectedValue`. */
|
|
6
|
-
export declare const Model:
|
|
7
|
-
readonly id:
|
|
8
|
-
readonly isOpen:
|
|
9
|
-
readonly isAnimated:
|
|
10
|
-
readonly isModal:
|
|
11
|
-
readonly nullable:
|
|
12
|
-
readonly immediate:
|
|
13
|
-
readonly selectInputOnFocus:
|
|
14
|
-
readonly animation:
|
|
15
|
-
readonly id:
|
|
16
|
-
readonly isShowing:
|
|
17
|
-
readonly transitionState:
|
|
6
|
+
export declare const Model: Schema.Struct<{
|
|
7
|
+
readonly id: Schema.String;
|
|
8
|
+
readonly isOpen: Schema.Boolean;
|
|
9
|
+
readonly isAnimated: Schema.Boolean;
|
|
10
|
+
readonly isModal: Schema.Boolean;
|
|
11
|
+
readonly nullable: Schema.Boolean;
|
|
12
|
+
readonly immediate: Schema.Boolean;
|
|
13
|
+
readonly selectInputOnFocus: Schema.Boolean;
|
|
14
|
+
readonly animation: Schema.Struct<{
|
|
15
|
+
readonly id: Schema.String;
|
|
16
|
+
readonly isShowing: Schema.Boolean;
|
|
17
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
18
18
|
}>;
|
|
19
|
-
readonly maybeActiveItemIndex:
|
|
20
|
-
readonly activationTrigger:
|
|
21
|
-
readonly inputValue:
|
|
22
|
-
readonly maybeLastPointerPosition:
|
|
23
|
-
readonly screenX:
|
|
24
|
-
readonly screenY:
|
|
19
|
+
readonly maybeActiveItemIndex: Schema.Option<Schema.Number>;
|
|
20
|
+
readonly activationTrigger: Schema.Literals<readonly ["Pointer", "Keyboard"]>;
|
|
21
|
+
readonly inputValue: Schema.String;
|
|
22
|
+
readonly maybeLastPointerPosition: Schema.Option<Schema.Struct<{
|
|
23
|
+
readonly screenX: Schema.Number;
|
|
24
|
+
readonly screenY: Schema.Number;
|
|
25
25
|
}>>;
|
|
26
26
|
}>;
|
|
27
27
|
export type Model = typeof Model.Type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AAExE,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,OAAO,EACP,UAAU,EAKX,MAAM,aAAa,CAAA;AAIpB,0OAA0O;AAC1O,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;EAEhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,oOAAoO;AACpO,MAAM,MAAM,UAAU,GAAG,cAAc,CAAA;AAEvC,gIAAgI;AAChI,eAAO,MAAM,IAAI,WAAY,UAAU,KAAG,KAAyB,CAAA;AAInE;;;mEAGmE;AACnE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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I,CAAC,CAAA;IAChD,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;CAC7E,CAAC,CAAA;AAEF;;;;;wDAKwD;AACxD,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,IAAI,CAuClE,CAAA"}
|
package/dist/combobox/single.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Option, Schema
|
|
2
|
+
import { Option, Schema } from 'effect';
|
|
3
3
|
import { evo } from 'foldkit/struct';
|
|
4
4
|
import { defineView } from 'foldkit/submodel';
|
|
5
5
|
import { BaseModel, Message, OutMessage, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared.js';
|
|
6
6
|
// MODEL
|
|
7
7
|
/** Schema for the single-select combobox's private interaction state (open/closed status, active item, activation trigger, typed input value). The selection is owned by the parent and passed in via `ViewInputs.maybeSelectedValue`. */
|
|
8
|
-
export const Model =
|
|
8
|
+
export const Model = Schema.Struct({
|
|
9
9
|
...BaseModel.fields,
|
|
10
10
|
});
|
|
11
11
|
/** Creates an initial single-select combobox model from a config. Defaults to closed with no active item and an empty input. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Option, Schema
|
|
1
|
+
import { Option, Schema } from 'effect';
|
|
2
2
|
import * as Calendar from 'foldkit/calendar';
|
|
3
3
|
import type { CalendarDate } from 'foldkit/calendar';
|
|
4
4
|
import type { ChildAttribute, Html } from 'foldkit/html';
|
|
@@ -11,60 +11,60 @@ import * as UiCalendar from '../calendar/index.js';
|
|
|
11
11
|
* `ViewInputs.maybeSelectedDate`. This holds the embedded Calendar submodel
|
|
12
12
|
* (the visible grid) and the embedded Popover submodel (the open/close +
|
|
13
13
|
* transition layer). */
|
|
14
|
-
export declare const Model:
|
|
15
|
-
readonly id:
|
|
16
|
-
readonly calendar:
|
|
17
|
-
readonly id:
|
|
18
|
-
readonly today:
|
|
19
|
-
readonly year:
|
|
20
|
-
readonly month:
|
|
21
|
-
readonly day:
|
|
14
|
+
export declare const Model: Schema.Struct<{
|
|
15
|
+
readonly id: Schema.String;
|
|
16
|
+
readonly calendar: Schema.Struct<{
|
|
17
|
+
readonly id: Schema.String;
|
|
18
|
+
readonly today: Schema.Struct<{
|
|
19
|
+
readonly year: Schema.Int;
|
|
20
|
+
readonly month: Schema.Int;
|
|
21
|
+
readonly day: Schema.Int;
|
|
22
22
|
}>;
|
|
23
|
-
readonly viewYear:
|
|
24
|
-
readonly viewMonth:
|
|
25
|
-
readonly viewMode:
|
|
26
|
-
readonly maybeFocusedDate:
|
|
27
|
-
readonly year:
|
|
28
|
-
readonly month:
|
|
29
|
-
readonly day:
|
|
23
|
+
readonly viewYear: Schema.Int;
|
|
24
|
+
readonly viewMonth: Schema.Int;
|
|
25
|
+
readonly viewMode: Schema.Literals<readonly ["Days", "Months", "Years"]>;
|
|
26
|
+
readonly maybeFocusedDate: Schema.Option<Schema.Struct<{
|
|
27
|
+
readonly year: Schema.Int;
|
|
28
|
+
readonly month: Schema.Int;
|
|
29
|
+
readonly day: Schema.Int;
|
|
30
30
|
}>>;
|
|
31
|
-
readonly isGridFocused:
|
|
32
|
-
readonly locale:
|
|
33
|
-
readonly firstDayOfWeek:
|
|
34
|
-
readonly monthNames:
|
|
35
|
-
readonly shortMonthNames:
|
|
36
|
-
readonly dayNames:
|
|
37
|
-
readonly shortDayNames:
|
|
31
|
+
readonly isGridFocused: Schema.Boolean;
|
|
32
|
+
readonly locale: Schema.Struct<{
|
|
33
|
+
readonly firstDayOfWeek: Schema.Literals<readonly ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]>;
|
|
34
|
+
readonly monthNames: Schema.Tuple<readonly [Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String]>;
|
|
35
|
+
readonly shortMonthNames: Schema.Tuple<readonly [Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String]>;
|
|
36
|
+
readonly dayNames: Schema.Tuple<readonly [Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String]>;
|
|
37
|
+
readonly shortDayNames: Schema.Tuple<readonly [Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String, Schema.String]>;
|
|
38
38
|
}>;
|
|
39
|
-
readonly maybeMinDate:
|
|
40
|
-
readonly year:
|
|
41
|
-
readonly month:
|
|
42
|
-
readonly day:
|
|
39
|
+
readonly maybeMinDate: Schema.Option<Schema.Struct<{
|
|
40
|
+
readonly year: Schema.Int;
|
|
41
|
+
readonly month: Schema.Int;
|
|
42
|
+
readonly day: Schema.Int;
|
|
43
43
|
}>>;
|
|
44
|
-
readonly maybeMaxDate:
|
|
45
|
-
readonly year:
|
|
46
|
-
readonly month:
|
|
47
|
-
readonly day:
|
|
44
|
+
readonly maybeMaxDate: Schema.Option<Schema.Struct<{
|
|
45
|
+
readonly year: Schema.Int;
|
|
46
|
+
readonly month: Schema.Int;
|
|
47
|
+
readonly day: Schema.Int;
|
|
48
48
|
}>>;
|
|
49
|
-
readonly disabledDaysOfWeek:
|
|
50
|
-
readonly disabledDates:
|
|
51
|
-
readonly year:
|
|
52
|
-
readonly month:
|
|
53
|
-
readonly day:
|
|
49
|
+
readonly disabledDaysOfWeek: Schema.$Array<Schema.Literals<readonly ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]>>;
|
|
50
|
+
readonly disabledDates: Schema.$Array<Schema.Struct<{
|
|
51
|
+
readonly year: Schema.Int;
|
|
52
|
+
readonly month: Schema.Int;
|
|
53
|
+
readonly day: Schema.Int;
|
|
54
54
|
}>>;
|
|
55
55
|
}>;
|
|
56
|
-
readonly popover:
|
|
57
|
-
readonly id:
|
|
58
|
-
readonly isOpen:
|
|
59
|
-
readonly isAnimated:
|
|
60
|
-
readonly isModal:
|
|
61
|
-
readonly contentFocus:
|
|
62
|
-
readonly animation:
|
|
63
|
-
readonly id:
|
|
64
|
-
readonly isShowing:
|
|
65
|
-
readonly transitionState:
|
|
56
|
+
readonly popover: Schema.Struct<{
|
|
57
|
+
readonly id: Schema.String;
|
|
58
|
+
readonly isOpen: Schema.Boolean;
|
|
59
|
+
readonly isAnimated: Schema.Boolean;
|
|
60
|
+
readonly isModal: Schema.Boolean;
|
|
61
|
+
readonly contentFocus: Schema.Boolean;
|
|
62
|
+
readonly animation: Schema.Struct<{
|
|
63
|
+
readonly id: Schema.String;
|
|
64
|
+
readonly isShowing: Schema.Boolean;
|
|
65
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
66
66
|
}>;
|
|
67
|
-
readonly maybeLastButtonPointerType:
|
|
67
|
+
readonly maybeLastButtonPointerType: Schema.Option<Schema.String>;
|
|
68
68
|
}>;
|
|
69
69
|
}>;
|
|
70
70
|
export type Model = typeof Model.Type;
|
|
@@ -73,35 +73,35 @@ export declare const Message: import("foldkit/message").MessageUnion<{
|
|
|
73
73
|
readonly GotCalendarMessage: {
|
|
74
74
|
message: import("foldkit/message").MessageUnion<{
|
|
75
75
|
readonly ClickedDay: {
|
|
76
|
-
date:
|
|
77
|
-
readonly year:
|
|
78
|
-
readonly month:
|
|
79
|
-
readonly day:
|
|
76
|
+
date: Schema.Struct<{
|
|
77
|
+
readonly year: Schema.Int;
|
|
78
|
+
readonly month: Schema.Int;
|
|
79
|
+
readonly day: Schema.Int;
|
|
80
80
|
}>;
|
|
81
81
|
};
|
|
82
82
|
readonly PressedKeyOnGrid: {
|
|
83
|
-
key:
|
|
84
|
-
isShift:
|
|
83
|
+
key: Schema.String;
|
|
84
|
+
isShift: Schema.Boolean;
|
|
85
85
|
};
|
|
86
86
|
readonly ClickedPreviousMonthButton: {};
|
|
87
87
|
readonly ClickedNextMonthButton: {};
|
|
88
88
|
readonly ClickedHeading: {};
|
|
89
89
|
readonly SelectedMonth: {
|
|
90
|
-
month:
|
|
90
|
+
month: Schema.Int;
|
|
91
91
|
};
|
|
92
92
|
readonly SelectedYear: {
|
|
93
|
-
year:
|
|
93
|
+
year: Schema.Int;
|
|
94
94
|
};
|
|
95
95
|
readonly PagedYears: {
|
|
96
|
-
direction:
|
|
96
|
+
direction: Schema.Literals<readonly [1, -1]>;
|
|
97
97
|
};
|
|
98
98
|
readonly FocusedGrid: {};
|
|
99
99
|
readonly BlurredGrid: {};
|
|
100
100
|
readonly RefreshedToday: {
|
|
101
|
-
today:
|
|
102
|
-
readonly year:
|
|
103
|
-
readonly month:
|
|
104
|
-
readonly day:
|
|
101
|
+
today: Schema.Struct<{
|
|
102
|
+
readonly year: Schema.Int;
|
|
103
|
+
readonly month: Schema.Int;
|
|
104
|
+
readonly day: Schema.Int;
|
|
105
105
|
}>;
|
|
106
106
|
};
|
|
107
107
|
readonly CompletedFocusGrid: {};
|
|
@@ -113,8 +113,8 @@ export declare const Message: import("foldkit/message").MessageUnion<{
|
|
|
113
113
|
readonly RequestedClose: {};
|
|
114
114
|
readonly BlurredPanel: {};
|
|
115
115
|
readonly PressedPointerOnButton: {
|
|
116
|
-
pointerType:
|
|
117
|
-
button:
|
|
116
|
+
pointerType: Schema.String;
|
|
117
|
+
button: Schema.Number;
|
|
118
118
|
};
|
|
119
119
|
readonly CompletedFocusPanel: {};
|
|
120
120
|
readonly CompletedFocusButton: {};
|
|
@@ -137,10 +137,10 @@ export declare const Message: import("foldkit/message").MessageUnion<{
|
|
|
137
137
|
}>;
|
|
138
138
|
};
|
|
139
139
|
readonly RequestedSelectDate: {
|
|
140
|
-
date:
|
|
141
|
-
readonly year:
|
|
142
|
-
readonly month:
|
|
143
|
-
readonly day:
|
|
140
|
+
date: Schema.Struct<{
|
|
141
|
+
readonly year: Schema.Int;
|
|
142
|
+
readonly month: Schema.Int;
|
|
143
|
+
readonly day: Schema.Int;
|
|
144
144
|
}>;
|
|
145
145
|
};
|
|
146
146
|
readonly Cleared: {};
|
|
@@ -151,14 +151,14 @@ export type Message = typeof Message.Type;
|
|
|
151
151
|
/** Union of out-messages the date picker can produce. */
|
|
152
152
|
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
153
153
|
readonly ChangedViewMonth: {
|
|
154
|
-
year:
|
|
155
|
-
month:
|
|
154
|
+
year: Schema.Int;
|
|
155
|
+
month: Schema.Int;
|
|
156
156
|
};
|
|
157
157
|
readonly SelectedDate: {
|
|
158
|
-
date:
|
|
159
|
-
readonly year:
|
|
160
|
-
readonly month:
|
|
161
|
-
readonly day:
|
|
158
|
+
date: Schema.Struct<{
|
|
159
|
+
readonly year: Schema.Int;
|
|
160
|
+
readonly month: Schema.Int;
|
|
161
|
+
readonly day: Schema.Int;
|
|
162
162
|
}>;
|
|
163
163
|
};
|
|
164
164
|
readonly ClearedDate: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAa,MAAM,EAAE,MAAM,QAAQ,CAAA;AACnE,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGxD,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAlCP,YAAY;IACpB;;yBAEqB;uBACF,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IAC9C;iEAC6D;oBAC7C,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI;IAChE;;6BAEyB;oBACT,CAAC,UAAU,EAAE,UAAU,CAAC,kBAAkB,KAAK,IAAI;iBACtD,OAAO;IACpB;;wDAEoD;WAC7C,MAAM;gBACD,MAAM;iBACL,aAAa,CAAC,cAAc,CAAC;uBACvB,MAAM;wBACL,aAAa,CAAC,cAAc,CAAC;gBACrC,MAAM;qBACD,MAAM;qBACN,MAAM;sBACL,aAAa,CAAC,cAAc,CAAC;wBAC3B,MAAM;yBACL,aAAa,CAAC,cAAc,CAAC;GAoHnD,CAAA"}
|
package/dist/datePicker/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Function, Match
|
|
2
|
+
import { Function, Match, Option, Predicate, Schema } from 'effect';
|
|
3
3
|
import * as Calendar from 'foldkit/calendar';
|
|
4
4
|
import { defineMessageUnion } from 'foldkit/message';
|
|
5
5
|
import { evo } from 'foldkit/struct';
|
|
@@ -14,8 +14,8 @@ import * as Popover from '../popover/index.js';
|
|
|
14
14
|
* `ViewInputs.maybeSelectedDate`. This holds the embedded Calendar submodel
|
|
15
15
|
* (the visible grid) and the embedded Popover submodel (the open/close +
|
|
16
16
|
* transition layer). */
|
|
17
|
-
export const Model =
|
|
18
|
-
id:
|
|
17
|
+
export const Model = Schema.Struct({
|
|
18
|
+
id: Schema.String,
|
|
19
19
|
calendar: UiCalendar.Model,
|
|
20
20
|
popover: Popover.Model,
|
|
21
21
|
});
|
|
@@ -33,8 +33,8 @@ export const Message = defineMessageUnion({
|
|
|
33
33
|
/** Union of out-messages the date picker can produce. */
|
|
34
34
|
export const OutMessage = defineMessageUnion({
|
|
35
35
|
ChangedViewMonth: {
|
|
36
|
-
year:
|
|
37
|
-
month:
|
|
36
|
+
year: Schema.Int,
|
|
37
|
+
month: Schema.Int,
|
|
38
38
|
},
|
|
39
39
|
SelectedDate: { date: Calendar.CalendarDate },
|
|
40
40
|
ClearedDate: {},
|
|
@@ -75,7 +75,7 @@ const dropCalendarToDays = model => (__foldkitBrandViewResult(({
|
|
|
75
75
|
const readPopover = (model) => __foldkitBrandViewResult((Option.some(model.popover)), "@foldkit/ui/datePicker/index.js#readPopover");
|
|
76
76
|
const writePopover = (model, nextPopover) => __foldkitBrandViewResult((evo(model, { popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover") })), "@foldkit/ui/datePicker/index.js#writePopover");
|
|
77
77
|
const toGotPopoverMessage = (message) => __foldkitBrandViewResult((Message.GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#toGotPopoverMessage");
|
|
78
|
-
const foldPopoverOutMessage =
|
|
78
|
+
const foldPopoverOutMessage = Match.type().pipe(Match.withReturnType(), Match.tagsExhaustive({
|
|
79
79
|
Opened: () => __foldkitBrandViewResult((dropCalendarToDays), "@foldkit/ui/datePicker/index.js#Opened"),
|
|
80
80
|
Closed: () => __foldkitBrandViewResult((dropCalendarToDays), "@foldkit/ui/datePicker/index.js#Closed"),
|
|
81
81
|
}));
|
|
@@ -100,11 +100,11 @@ const foldPopoverClose = Update.foldChildStep({
|
|
|
100
100
|
toParentMessage: toGotPopoverMessage,
|
|
101
101
|
foldOutMessage: foldPopoverOutMessage,
|
|
102
102
|
});
|
|
103
|
-
const foldCalendarOutMessage =
|
|
103
|
+
const foldCalendarOutMessage = Match.type().pipe(Match.withReturnType(), Match.tagsExhaustive({
|
|
104
104
|
ChangedViewMonth: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/datePicker/index.js#anonymous"))), "@foldkit/ui/datePicker/index.js#ChangedViewMonth"),
|
|
105
105
|
SelectedDate: () => __foldkitBrandViewResult((foldPopoverClose), "@foldkit/ui/datePicker/index.js#SelectedDate"),
|
|
106
106
|
}));
|
|
107
|
-
const toDatePickerOutMessage =
|
|
107
|
+
const toDatePickerOutMessage = Match.type().pipe(Match.withReturnType(), Match.tagsExhaustive({
|
|
108
108
|
ChangedViewMonth: ({ year, month }) => __foldkitBrandViewResult((OutMessage.ChangedViewMonth({ year, month })), "@foldkit/ui/datePicker/index.js#ChangedViewMonth~2"),
|
|
109
109
|
SelectedDate: ({ date }) => __foldkitBrandViewResult((OutMessage.SelectedDate({ date })), "@foldkit/ui/datePicker/index.js#SelectedDate~2"),
|
|
110
110
|
}));
|
|
@@ -188,7 +188,7 @@ export const reflectDisabledDaysOfWeek = Function.dual(2, (model, disabledDaysOf
|
|
|
188
188
|
* or an `aria-labelledby` reference. */
|
|
189
189
|
export const triggerId = (id) => __foldkitBrandViewResult((`${id}-popover-button`), "@foldkit/ui/datePicker/index.js#triggerId");
|
|
190
190
|
// VIEW
|
|
191
|
-
const encodeIsoDate =
|
|
191
|
+
const encodeIsoDate = Schema.encodeSync(Calendar.CalendarDateFromIsoString);
|
|
192
192
|
/** Renders an accessible date picker: a trigger button that opens a popover
|
|
193
193
|
* containing an accessible calendar grid. The date picker assembles the
|
|
194
194
|
* embedded Calendar and Popover components into one flat API. Consumers
|