@foldkit/ui 0.129.0 → 0.131.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/anchor.js +12 -11
- package/dist/animation/index.js +11 -10
- package/dist/animation/schema.js +3 -2
- package/dist/animation/update.js +26 -25
- package/dist/button/index.js +3 -2
- package/dist/calendar/index.js +159 -158
- package/dist/checkbox/index.js +9 -8
- package/dist/combobox/multi.js +20 -19
- package/dist/combobox/shared.js +169 -168
- package/dist/combobox/single.js +23 -22
- package/dist/datePicker/index.js +69 -68
- package/dist/dialog/index.js +52 -51
- package/dist/disclosure/index.js +11 -10
- package/dist/dragAndDrop/index.js +122 -121
- package/dist/fieldset/index.js +5 -4
- package/dist/fileDrop/index.js +23 -22
- package/dist/group.js +7 -6
- package/dist/input/index.js +4 -3
- package/dist/internal/optionExtensions.js +2 -1
- package/dist/internal/selectors.js +2 -1
- package/dist/keyboard.js +5 -4
- package/dist/listbox/multi.js +12 -11
- package/dist/listbox/shared.js +171 -170
- package/dist/listbox/single.js +13 -12
- package/dist/menu/index.js +167 -166
- package/dist/nav/index.js +7 -6
- package/dist/popover/index.js +87 -86
- package/dist/radioGroup/index.js +23 -22
- package/dist/select/index.js +4 -3
- package/dist/slider/index.js +72 -71
- package/dist/switch/index.js +6 -5
- package/dist/tabs/index.js +34 -33
- package/dist/test/apps/disabledButton.js +17 -16
- package/dist/textarea/index.js +4 -3
- package/dist/toast/index.js +19 -18
- package/dist/toast/schema.js +10 -9
- package/dist/toast/test.js +2 -1
- package/dist/toast/update.js +79 -78
- package/dist/tooltip/index.js +59 -58
- package/dist/typeahead.js +6 -5
- package/dist/virtualList/index.js +66 -65
- package/package.json +4 -3
package/dist/combobox/single.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
1
2
|
import { Array, Option, Schema as S, pipe } from 'effect';
|
|
2
3
|
import { evo } from 'foldkit/struct';
|
|
3
4
|
import { defineView } from 'foldkit/submodel';
|
|
@@ -8,52 +9,52 @@ export const Model = S.Struct({
|
|
|
8
9
|
...BaseModel.fields,
|
|
9
10
|
});
|
|
10
11
|
/** Creates an initial single-select combobox model from a config. Defaults to closed with no active item and an empty input. */
|
|
11
|
-
export const init = (config) => baseInit(config);
|
|
12
|
+
export const init = (config) => __foldkitBrandViewResult((baseInit(config)), "@foldkit/ui/combobox/single.js#init");
|
|
12
13
|
// UPDATE
|
|
13
14
|
/** Processes a combobox message and returns the next model, commands, and optional OutMessage. Closes the combobox on selection (single-select behavior); emits `Selected({ value })` for the parent to store, and `ClearedSelection` when a nullable combobox closes with an empty input. */
|
|
14
15
|
export const update = makeUpdate({
|
|
15
16
|
handleClose: (model, restingInputValue) => {
|
|
16
17
|
if (model.nullable && model.inputValue === '') {
|
|
17
|
-
return [
|
|
18
|
-
evo(closedBaseModel(model), { inputValue: () => '' }),
|
|
18
|
+
return __foldkitBrandViewResult(([
|
|
19
|
+
evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/single.js#inputValue") }),
|
|
19
20
|
Option.some(ClearedSelection()),
|
|
20
|
-
];
|
|
21
|
+
]), "@foldkit/ui/combobox/single.js#handleClose");
|
|
21
22
|
}
|
|
22
|
-
return [
|
|
23
|
-
evo(closedBaseModel(model), { inputValue: () => restingInputValue }),
|
|
23
|
+
return __foldkitBrandViewResult(([
|
|
24
|
+
evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((restingInputValue), "@foldkit/ui/combobox/single.js#inputValue~2") }),
|
|
24
25
|
Option.none(),
|
|
25
|
-
];
|
|
26
|
+
]), "@foldkit/ui/combobox/single.js#handleClose");
|
|
26
27
|
},
|
|
27
28
|
handleSelectedItem: (model, item, displayText, wasSelected, context) => {
|
|
28
29
|
const nullableDeselect = model.nullable && wasSelected;
|
|
29
|
-
return [
|
|
30
|
+
return __foldkitBrandViewResult(([
|
|
30
31
|
evo(closedBaseModel(model), {
|
|
31
|
-
inputValue: () => (nullableDeselect ? '' : displayText),
|
|
32
|
+
inputValue: () => (__foldkitBrandViewResult((nullableDeselect ? '' : displayText), "@foldkit/ui/combobox/single.js#inputValue~3")),
|
|
32
33
|
}),
|
|
33
34
|
pipe(Array.getSomes([context.maybeUnlockScroll, context.maybeRestoreInert]), Array.prepend(context.focusInput)),
|
|
34
35
|
Option.some(SharedSelected({ value: item })),
|
|
35
|
-
];
|
|
36
|
+
]), "@foldkit/ui/combobox/single.js#handleSelectedItem");
|
|
36
37
|
},
|
|
37
|
-
handleImmediateActivation: (model, item) => [
|
|
38
|
+
handleImmediateActivation: (model, item) => __foldkitBrandViewResult(([
|
|
38
39
|
model,
|
|
39
40
|
Option.some(SharedSelected({ value: item })),
|
|
40
|
-
],
|
|
41
|
+
]), "@foldkit/ui/combobox/single.js#handleImmediateActivation"),
|
|
41
42
|
});
|
|
42
43
|
/** Programmatically opens the combobox, updating the model and returning
|
|
43
44
|
* focus and modal commands. Use this in domain-event handlers to open the combobox. */
|
|
44
|
-
export const open = (model) => update(model, Opened({ maybeActiveItemIndex: Option.none() }));
|
|
45
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/combobox/single.js#open");
|
|
45
46
|
/** Programmatically closes the combobox, updating the model and returning
|
|
46
47
|
* focus and modal commands. `restingInputValue` is the text the input
|
|
47
48
|
* returns to (the parent-owned selection's display text, or empty). Use
|
|
48
49
|
* this in domain-event handlers to close the combobox. */
|
|
49
|
-
export const close = (model, restingInputValue) => update(model, Closed({ restingInputValue }));
|
|
50
|
+
export const close = (model, restingInputValue) => __foldkitBrandViewResult((update(model, Closed({ restingInputValue }))), "@foldkit/ui/combobox/single.js#close");
|
|
50
51
|
/** Programmatically selects an item in the single-select combobox, closing
|
|
51
52
|
* the combobox and emitting `Selected({ value })`. The Submodel treats the
|
|
52
53
|
* select as fresh (`wasSelected: false`), so the input rests on
|
|
53
54
|
* `displayText`; what the selection becomes is the parent's fold to decide,
|
|
54
55
|
* and a parent that toggles on its own state will still deselect an
|
|
55
56
|
* already-selected value. */
|
|
56
|
-
export const selectItem = (model, item, displayText) => update(model, SelectedItem({ item, displayText, wasSelected: false }));
|
|
57
|
+
export const selectItem = (model, item, displayText) => __foldkitBrandViewResult((update(model, SelectedItem({ item, displayText, wasSelected: false }))), "@foldkit/ui/combobox/single.js#selectItem");
|
|
57
58
|
const internalView = makeView({ ariaMultiSelectable: false });
|
|
58
59
|
/** Pairs the single-select combobox's `view` and `update` (and programmatic
|
|
59
60
|
* helpers) behind a single Item-typed entry point. See `Listbox.create`
|
|
@@ -65,15 +66,15 @@ export const create = () => {
|
|
|
65
66
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
66
67
|
const typedUpdate = update;
|
|
67
68
|
const arrayBasedView = internalView();
|
|
68
|
-
const view = defineView((model, { maybeSelectedValue, ...baseInputs }) => arrayBasedView(model, {
|
|
69
|
+
const view = defineView((model, { maybeSelectedValue, ...baseInputs }) => __foldkitBrandViewResult((arrayBasedView(model, {
|
|
69
70
|
...baseInputs,
|
|
70
71
|
selectedValues: Option.toArray(maybeSelectedValue),
|
|
71
|
-
}));
|
|
72
|
-
return {
|
|
72
|
+
})), "@foldkit/ui/combobox/single.js#anonymous"));
|
|
73
|
+
return __foldkitBrandViewResult(({
|
|
73
74
|
view,
|
|
74
75
|
update: typedUpdate,
|
|
75
|
-
selectItem: (model, item, displayText) => typedUpdate(model, SelectedItem({ item, displayText, wasSelected: false })),
|
|
76
|
-
open: model => typedUpdate(model, Opened({ maybeActiveItemIndex: Option.none() })),
|
|
77
|
-
close: (model, restingInputValue) => typedUpdate(model, Closed({ restingInputValue })),
|
|
78
|
-
};
|
|
76
|
+
selectItem: (model, item, displayText) => __foldkitBrandViewResult((typedUpdate(model, SelectedItem({ item, displayText, wasSelected: false }))), "@foldkit/ui/combobox/single.js#selectItem~2"),
|
|
77
|
+
open: model => __foldkitBrandViewResult((typedUpdate(model, Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/combobox/single.js#open~2"),
|
|
78
|
+
close: (model, restingInputValue) => __foldkitBrandViewResult((typedUpdate(model, Closed({ restingInputValue }))), "@foldkit/ui/combobox/single.js#close~2"),
|
|
79
|
+
}), "@foldkit/ui/combobox/single.js#create");
|
|
79
80
|
};
|
package/dist/datePicker/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
1
2
|
import { Function, Match as M, Option, Predicate, Schema as S } from 'effect';
|
|
2
3
|
import * as Calendar from 'foldkit/calendar';
|
|
3
4
|
import * as Command from 'foldkit/command';
|
|
@@ -74,7 +75,7 @@ export const OutMessage = S.Union([ChangedViewMonth, SelectedDate, ClearedDate])
|
|
|
74
75
|
* with derived ids so their DOM elements stay addressable. The popover is
|
|
75
76
|
* opened in `contentFocus` mode so focus lands on the calendar grid instead of
|
|
76
77
|
* the panel. */
|
|
77
|
-
export const init = (config) => ({
|
|
78
|
+
export const init = (config) => (__foldkitBrandViewResult(({
|
|
78
79
|
id: config.id,
|
|
79
80
|
calendar: UiCalendar.init({
|
|
80
81
|
id: `${config.id}-calendar`,
|
|
@@ -97,120 +98,120 @@ export const init = (config) => ({
|
|
|
97
98
|
contentFocus: true,
|
|
98
99
|
...(config.isAnimated !== undefined && { isAnimated: config.isAnimated }),
|
|
99
100
|
}),
|
|
100
|
-
});
|
|
101
|
+
}), "@foldkit/ui/datePicker/index.js#init"));
|
|
101
102
|
const withUpdateReturn = M.withReturnType();
|
|
102
|
-
const mapCalendarCommands = (commands) => Command.mapMessages(commands, message => GotCalendarMessage({ message }));
|
|
103
|
-
const mapPopoverCommands = (commands) => Command.mapMessages(commands, message => GotPopoverMessage({ message }));
|
|
103
|
+
const mapCalendarCommands = (commands) => __foldkitBrandViewResult((Command.mapMessages(commands, message => __foldkitBrandViewResult((GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#anonymous"))), "@foldkit/ui/datePicker/index.js#mapCalendarCommands");
|
|
104
|
+
const mapPopoverCommands = (commands) => __foldkitBrandViewResult((Command.mapMessages(commands, message => __foldkitBrandViewResult((GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#anonymous~2"))), "@foldkit/ui/datePicker/index.js#mapPopoverCommands");
|
|
104
105
|
const delegateToCalendar = (model, calendarMessage) => {
|
|
105
106
|
const [nextCalendar, calendarCommands, maybeCalendarOutMessage] = UiCalendar.update(model.calendar, calendarMessage);
|
|
106
|
-
const modelWithCalendar = evo(model, { calendar: () => nextCalendar });
|
|
107
|
-
return Option.match(maybeCalendarOutMessage, {
|
|
108
|
-
onNone: () => [
|
|
107
|
+
const modelWithCalendar = evo(model, { calendar: () => __foldkitBrandViewResult((nextCalendar), "@foldkit/ui/datePicker/index.js#calendar") });
|
|
108
|
+
return __foldkitBrandViewResult((Option.match(maybeCalendarOutMessage, {
|
|
109
|
+
onNone: () => __foldkitBrandViewResult(([
|
|
109
110
|
modelWithCalendar,
|
|
110
111
|
mapCalendarCommands(calendarCommands),
|
|
111
112
|
Option.none(),
|
|
112
|
-
],
|
|
113
|
+
]), "@foldkit/ui/datePicker/index.js#onNone"),
|
|
113
114
|
onSome: M.type().pipe(M.withReturnType(), M.tagsExhaustive({
|
|
114
|
-
ChangedViewMonth: ({ year, month }) => [
|
|
115
|
+
ChangedViewMonth: ({ year, month }) => __foldkitBrandViewResult(([
|
|
115
116
|
modelWithCalendar,
|
|
116
117
|
mapCalendarCommands(calendarCommands),
|
|
117
118
|
Option.some(ChangedViewMonth({ year, month })),
|
|
118
|
-
],
|
|
119
|
+
]), "@foldkit/ui/datePicker/index.js#ChangedViewMonth"),
|
|
119
120
|
SelectedDate: ({ date }) => {
|
|
120
121
|
const [nextPopover, popoverCommands] = Popover.close(model.popover);
|
|
121
|
-
return [
|
|
122
|
+
return __foldkitBrandViewResult(([
|
|
122
123
|
evo(modelWithCalendar, {
|
|
123
|
-
popover: () => nextPopover,
|
|
124
|
+
popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover"),
|
|
124
125
|
}),
|
|
125
126
|
[
|
|
126
127
|
...mapCalendarCommands(calendarCommands),
|
|
127
128
|
...mapPopoverCommands(popoverCommands),
|
|
128
129
|
],
|
|
129
130
|
Option.some(SelectedDate({ date })),
|
|
130
|
-
];
|
|
131
|
+
]), "@foldkit/ui/datePicker/index.js#SelectedDate");
|
|
131
132
|
},
|
|
132
133
|
})),
|
|
133
|
-
});
|
|
134
|
+
})), "@foldkit/ui/datePicker/index.js#delegateToCalendar");
|
|
134
135
|
};
|
|
135
136
|
const delegateToPopover = (model, popoverMessage) => {
|
|
136
137
|
const [nextPopover, popoverCommands, maybePopoverOutMessage] = Popover.update(model.popover, popoverMessage);
|
|
137
|
-
const modelWithPopover = evo(model, { popover: () => nextPopover });
|
|
138
|
-
return Option.match(maybePopoverOutMessage, {
|
|
139
|
-
onNone: () => [
|
|
138
|
+
const modelWithPopover = evo(model, { popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover~2") });
|
|
139
|
+
return __foldkitBrandViewResult((Option.match(maybePopoverOutMessage, {
|
|
140
|
+
onNone: () => __foldkitBrandViewResult(([
|
|
140
141
|
modelWithPopover,
|
|
141
142
|
mapPopoverCommands(popoverCommands),
|
|
142
143
|
Option.none(),
|
|
143
|
-
],
|
|
144
|
-
onSome: () => [
|
|
144
|
+
]), "@foldkit/ui/datePicker/index.js#onNone~2"),
|
|
145
|
+
onSome: () => __foldkitBrandViewResult(([
|
|
145
146
|
evo(modelWithPopover, {
|
|
146
|
-
calendar: () => UiCalendar.dropToDays(modelWithPopover.calendar),
|
|
147
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.dropToDays(modelWithPopover.calendar)), "@foldkit/ui/datePicker/index.js#calendar~2"),
|
|
147
148
|
}),
|
|
148
149
|
mapPopoverCommands(popoverCommands),
|
|
149
150
|
Option.none(),
|
|
150
|
-
],
|
|
151
|
-
});
|
|
151
|
+
]), "@foldkit/ui/datePicker/index.js#onSome"),
|
|
152
|
+
})), "@foldkit/ui/datePicker/index.js#delegateToPopover");
|
|
152
153
|
};
|
|
153
154
|
/** Processes a date picker message and returns the next model, commands, and
|
|
154
155
|
* optional OutMessage. */
|
|
155
|
-
export const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
156
|
-
GotCalendarMessage: ({ message: calendarMessage }) => delegateToCalendar(model, calendarMessage),
|
|
157
|
-
GotPopoverMessage: ({ message: popoverMessage }) => delegateToPopover(model, popoverMessage),
|
|
156
|
+
export const update = (model, message) => __foldkitBrandViewResult((M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
157
|
+
GotCalendarMessage: ({ message: calendarMessage }) => __foldkitBrandViewResult((delegateToCalendar(model, calendarMessage)), "@foldkit/ui/datePicker/index.js#GotCalendarMessage"),
|
|
158
|
+
GotPopoverMessage: ({ message: popoverMessage }) => __foldkitBrandViewResult((delegateToPopover(model, popoverMessage)), "@foldkit/ui/datePicker/index.js#GotPopoverMessage"),
|
|
158
159
|
Opened: () => {
|
|
159
160
|
const [nextPopover, popoverCommands] = Popover.open(model.popover);
|
|
160
|
-
return [
|
|
161
|
+
return __foldkitBrandViewResult(([
|
|
161
162
|
evo(model, {
|
|
162
|
-
popover: () => nextPopover,
|
|
163
|
-
calendar: () => UiCalendar.dropToDays(model.calendar),
|
|
163
|
+
popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover~3"),
|
|
164
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.dropToDays(model.calendar)), "@foldkit/ui/datePicker/index.js#calendar~3"),
|
|
164
165
|
}),
|
|
165
166
|
mapPopoverCommands(popoverCommands),
|
|
166
167
|
Option.none(),
|
|
167
|
-
];
|
|
168
|
+
]), "@foldkit/ui/datePicker/index.js#Opened");
|
|
168
169
|
},
|
|
169
170
|
Closed: () => {
|
|
170
171
|
const [nextPopover, popoverCommands] = Popover.close(model.popover);
|
|
171
|
-
return [
|
|
172
|
+
return __foldkitBrandViewResult(([
|
|
172
173
|
evo(model, {
|
|
173
|
-
popover: () => nextPopover,
|
|
174
|
-
calendar: () => UiCalendar.dropToDays(model.calendar),
|
|
174
|
+
popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover~4"),
|
|
175
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.dropToDays(model.calendar)), "@foldkit/ui/datePicker/index.js#calendar~4"),
|
|
175
176
|
}),
|
|
176
177
|
mapPopoverCommands(popoverCommands),
|
|
177
178
|
Option.none(),
|
|
178
|
-
];
|
|
179
|
+
]), "@foldkit/ui/datePicker/index.js#Closed");
|
|
179
180
|
},
|
|
180
181
|
RequestedSelectDate: ({ date }) => {
|
|
181
182
|
const [nextCalendar, calendarCommands] = UiCalendar.selectDate(model.calendar, date);
|
|
182
183
|
const [nextPopover, popoverCommands] = Popover.close(model.popover);
|
|
183
|
-
return [
|
|
184
|
+
return __foldkitBrandViewResult(([
|
|
184
185
|
evo(model, {
|
|
185
|
-
calendar: () => nextCalendar,
|
|
186
|
-
popover: () => nextPopover,
|
|
186
|
+
calendar: () => __foldkitBrandViewResult((nextCalendar), "@foldkit/ui/datePicker/index.js#calendar~5"),
|
|
187
|
+
popover: () => __foldkitBrandViewResult((nextPopover), "@foldkit/ui/datePicker/index.js#popover~5"),
|
|
187
188
|
}),
|
|
188
189
|
[
|
|
189
190
|
...mapCalendarCommands(calendarCommands),
|
|
190
191
|
...mapPopoverCommands(popoverCommands),
|
|
191
192
|
],
|
|
192
193
|
Option.some(SelectedDate({ date })),
|
|
193
|
-
];
|
|
194
|
+
]), "@foldkit/ui/datePicker/index.js#RequestedSelectDate");
|
|
194
195
|
},
|
|
195
|
-
Cleared: () => [model, [], Option.some(ClearedDate())],
|
|
196
|
-
}));
|
|
196
|
+
Cleared: () => __foldkitBrandViewResult(([model, [], Option.some(ClearedDate())]), "@foldkit/ui/datePicker/index.js#Cleared"),
|
|
197
|
+
}))), "@foldkit/ui/datePicker/index.js#update");
|
|
197
198
|
/** Programmatically opens the date picker, updating the model and returning
|
|
198
199
|
* focus and popover commands. Use this in domain-event handlers. */
|
|
199
|
-
export const open = (model) => update(model, Opened());
|
|
200
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, Opened())), "@foldkit/ui/datePicker/index.js#open");
|
|
200
201
|
/** Programmatically closes the date picker. Use this in domain-event handlers. */
|
|
201
|
-
export const close = (model) => update(model, Closed());
|
|
202
|
+
export const close = (model) => __foldkitBrandViewResult((update(model, Closed())), "@foldkit/ui/datePicker/index.js#close");
|
|
202
203
|
/** Programmatically selects a date, committing it and closing the popover. Emits a `SelectedDate` OutMessage just like a user-initiated selection. */
|
|
203
|
-
export const selectDate = (model, date) => update(model, RequestedSelectDate({ date }));
|
|
204
|
+
export const selectDate = (model, date) => __foldkitBrandViewResult((update(model, RequestedSelectDate({ date }))), "@foldkit/ui/datePicker/index.js#selectDate");
|
|
204
205
|
/** Programmatically clears the selected date. */
|
|
205
|
-
export const clear = (model) => update(model, Cleared());
|
|
206
|
+
export const clear = (model) => __foldkitBrandViewResult((update(model, Cleared())), "@foldkit/ui/datePicker/index.js#clear");
|
|
206
207
|
/** Moves the embedded calendar's view and cursor to a date without changing
|
|
207
208
|
* the selection (which the parent owns). Use it to navigate the picker onto a
|
|
208
209
|
* known date, for example after the parent sets its value externally (a URL
|
|
209
210
|
* parameter, a saved draft) so opening the picker shows that month. Returns
|
|
210
211
|
* the model directly because it produces no commands and no OutMessage. */
|
|
211
|
-
export const focusDate = Function.dual(2, (model, date) => evo(model, {
|
|
212
|
-
calendar: () => UiCalendar.focusDate(model.calendar, date),
|
|
213
|
-
}));
|
|
212
|
+
export const focusDate = Function.dual(2, (model, date) => __foldkitBrandViewResult((evo(model, {
|
|
213
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.focusDate(model.calendar, date)), "@foldkit/ui/datePicker/index.js#calendar~6"),
|
|
214
|
+
})), "@foldkit/ui/datePicker/index.js#anonymous~3"));
|
|
214
215
|
/** Reflects the minimum selectable date onto the embedded calendar. Pass
|
|
215
216
|
* `Option.none()` to remove the minimum. Use this when the minimum derives
|
|
216
217
|
* from other Model state (e.g. a start date field whose current selection
|
|
@@ -219,34 +220,34 @@ export const focusDate = Function.dual(2, (model, date) => evo(model, {
|
|
|
219
220
|
* Does NOT reconcile the current selection. If a previously-selected date
|
|
220
221
|
* is now below the new minimum, it remains selected. Callers should `clear`
|
|
221
222
|
* or reassign the selection explicitly if their domain requires it. */
|
|
222
|
-
export const reflectMinDate = Function.dual(2, (model, maybeMinDate) => evo(model, {
|
|
223
|
-
calendar: () => UiCalendar.reflectMinDate(model.calendar, maybeMinDate),
|
|
224
|
-
}));
|
|
223
|
+
export const reflectMinDate = Function.dual(2, (model, maybeMinDate) => __foldkitBrandViewResult((evo(model, {
|
|
224
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.reflectMinDate(model.calendar, maybeMinDate)), "@foldkit/ui/datePicker/index.js#calendar~7"),
|
|
225
|
+
})), "@foldkit/ui/datePicker/index.js#anonymous~4"));
|
|
225
226
|
/** Reflects the maximum selectable date onto the embedded calendar. Pass
|
|
226
227
|
* `Option.none()` to remove the maximum. Does NOT reconcile the current
|
|
227
228
|
* selection. */
|
|
228
|
-
export const reflectMaxDate = Function.dual(2, (model, maybeMaxDate) => evo(model, {
|
|
229
|
-
calendar: () => UiCalendar.reflectMaxDate(model.calendar, maybeMaxDate),
|
|
230
|
-
}));
|
|
229
|
+
export const reflectMaxDate = Function.dual(2, (model, maybeMaxDate) => __foldkitBrandViewResult((evo(model, {
|
|
230
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.reflectMaxDate(model.calendar, maybeMaxDate)), "@foldkit/ui/datePicker/index.js#calendar~8"),
|
|
231
|
+
})), "@foldkit/ui/datePicker/index.js#anonymous~5"));
|
|
231
232
|
/** Reflects the list of individually-disabled dates onto the embedded
|
|
232
233
|
* calendar. Pass an empty array to clear. Does NOT reconcile the current
|
|
233
234
|
* selection. */
|
|
234
|
-
export const reflectDisabledDates = Function.dual(2, (model, disabledDates) => evo(model, {
|
|
235
|
-
calendar: () => UiCalendar.reflectDisabledDates(model.calendar, disabledDates),
|
|
236
|
-
}));
|
|
235
|
+
export const reflectDisabledDates = Function.dual(2, (model, disabledDates) => __foldkitBrandViewResult((evo(model, {
|
|
236
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.reflectDisabledDates(model.calendar, disabledDates)), "@foldkit/ui/datePicker/index.js#calendar~9"),
|
|
237
|
+
})), "@foldkit/ui/datePicker/index.js#anonymous~6"));
|
|
237
238
|
/** Reflects the days of the week that are disabled onto the embedded calendar
|
|
238
239
|
* (e.g. weekends). Pass an empty array to clear. Does NOT reconcile the
|
|
239
240
|
* current selection. */
|
|
240
|
-
export const reflectDisabledDaysOfWeek = Function.dual(2, (model, disabledDaysOfWeek) => evo(model, {
|
|
241
|
-
calendar: () => UiCalendar.reflectDisabledDaysOfWeek(model.calendar, disabledDaysOfWeek),
|
|
242
|
-
}));
|
|
241
|
+
export const reflectDisabledDaysOfWeek = Function.dual(2, (model, disabledDaysOfWeek) => __foldkitBrandViewResult((evo(model, {
|
|
242
|
+
calendar: () => __foldkitBrandViewResult((UiCalendar.reflectDisabledDaysOfWeek(model.calendar, disabledDaysOfWeek)), "@foldkit/ui/datePicker/index.js#calendar~10"),
|
|
243
|
+
})), "@foldkit/ui/datePicker/index.js#anonymous~7"));
|
|
243
244
|
// SELECTORS
|
|
244
245
|
/** Returns the bare DOM id of the date picker trigger button, derived from
|
|
245
246
|
* the date picker's base id. The trigger is the embedded Popover's button,
|
|
246
247
|
* so the id is suffixed `-popover-button`. Use this to associate an external
|
|
247
248
|
* label with the trigger via a native `<label for={DatePicker.triggerId(id)}>`
|
|
248
249
|
* or an `aria-labelledby` reference. */
|
|
249
|
-
export const triggerId = (id) => `${id}-popover-button
|
|
250
|
+
export const triggerId = (id) => __foldkitBrandViewResult((`${id}-popover-button`), "@foldkit/ui/datePicker/index.js#triggerId");
|
|
250
251
|
// VIEW
|
|
251
252
|
const encodeIsoDate = S.encodeSync(Calendar.CalendarDateFromIsoString);
|
|
252
253
|
/** Renders an accessible date picker: a trigger button that opens a popover
|
|
@@ -259,13 +260,13 @@ export const view = defineView((model, viewInputs) => {
|
|
|
259
260
|
const { anchor, maybeSelectedDate, triggerContent, toCalendarView, isDisabled, name, className, attributes = [], triggerClassName, triggerAttributes = [], ariaLabel, ariaLabelledBy, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], } = viewInputs;
|
|
260
261
|
const resolveTriggerLabel = () => {
|
|
261
262
|
if (Predicate.isNotUndefined(ariaLabel)) {
|
|
262
|
-
return [h.AriaLabel(ariaLabel)];
|
|
263
|
+
return __foldkitBrandViewResult(([h.AriaLabel(ariaLabel)]), "@foldkit/ui/datePicker/index.js#resolveTriggerLabel");
|
|
263
264
|
}
|
|
264
265
|
else if (Predicate.isNotUndefined(ariaLabelledBy)) {
|
|
265
|
-
return [h.AriaLabelledBy(ariaLabelledBy)];
|
|
266
|
+
return __foldkitBrandViewResult(([h.AriaLabelledBy(ariaLabelledBy)]), "@foldkit/ui/datePicker/index.js#resolveTriggerLabel");
|
|
266
267
|
}
|
|
267
268
|
else {
|
|
268
|
-
return [];
|
|
269
|
+
return __foldkitBrandViewResult(([]), "@foldkit/ui/datePicker/index.js#resolveTriggerLabel");
|
|
269
270
|
}
|
|
270
271
|
};
|
|
271
272
|
const triggerLabelAttributes = resolveTriggerLabel();
|
|
@@ -274,7 +275,7 @@ export const view = defineView((model, viewInputs) => {
|
|
|
274
275
|
model: model.calendar,
|
|
275
276
|
view: UiCalendar.view,
|
|
276
277
|
viewInputs: { maybeSelectedDate, toView: toCalendarView },
|
|
277
|
-
toParentMessage: message => GotCalendarMessage({ message }),
|
|
278
|
+
toParentMessage: message => __foldkitBrandViewResult((GotCalendarMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage"),
|
|
278
279
|
});
|
|
279
280
|
const popoverVNode = h.submodel({
|
|
280
281
|
slotId: model.popover.id,
|
|
@@ -284,7 +285,7 @@ export const view = defineView((model, viewInputs) => {
|
|
|
284
285
|
anchor,
|
|
285
286
|
...(isDisabled !== undefined && { isDisabled }),
|
|
286
287
|
focusSelector: idSelector(`${model.calendar.id}-grid`),
|
|
287
|
-
toView: ({ button, panel, backdrop, isVisible }) => h.div([], [
|
|
288
|
+
toView: ({ button, panel, backdrop, isVisible }) => __foldkitBrandViewResult((h.div([], [
|
|
288
289
|
h.button([
|
|
289
290
|
...button,
|
|
290
291
|
...triggerLabelAttributes,
|
|
@@ -311,12 +312,12 @@ export const view = defineView((model, viewInputs) => {
|
|
|
311
312
|
], [calendarVNode]),
|
|
312
313
|
]
|
|
313
314
|
: []),
|
|
314
|
-
]),
|
|
315
|
+
])), "@foldkit/ui/datePicker/index.js#toView"),
|
|
315
316
|
},
|
|
316
|
-
toParentMessage: message => GotPopoverMessage({ message }),
|
|
317
|
+
toParentMessage: message => __foldkitBrandViewResult((GotPopoverMessage({ message })), "@foldkit/ui/datePicker/index.js#toParentMessage~2"),
|
|
317
318
|
});
|
|
318
319
|
const hiddenInputValue = Option.match(maybeSelectedDate, {
|
|
319
|
-
onNone: () => '',
|
|
320
|
+
onNone: () => __foldkitBrandViewResult((''), "@foldkit/ui/datePicker/index.js#onNone~3"),
|
|
320
321
|
onSome: encodeIsoDate,
|
|
321
322
|
});
|
|
322
323
|
const maybeHiddenInput = name !== undefined
|
|
@@ -326,5 +327,5 @@ export const view = defineView((model, viewInputs) => {
|
|
|
326
327
|
...(className !== undefined ? [h.Class(className)] : []),
|
|
327
328
|
...attributes,
|
|
328
329
|
];
|
|
329
|
-
return h.div(wrapperAttributes, [popoverVNode, ...maybeHiddenInput]);
|
|
330
|
+
return __foldkitBrandViewResult((h.div(wrapperAttributes, [popoverVNode, ...maybeHiddenInput])), "@foldkit/ui/datePicker/index.js#anonymous~8");
|
|
330
331
|
});
|
package/dist/dialog/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
1
2
|
import { Effect, Match as M, Option, Schema as S } from 'effect';
|
|
2
3
|
import * as Command from 'foldkit/command';
|
|
3
4
|
import * as Dom from 'foldkit/dom';
|
|
@@ -66,7 +67,7 @@ export const Closed = m('Closed');
|
|
|
66
67
|
/** Union of out-messages the dialog component can produce. */
|
|
67
68
|
export const OutMessage = S.Union([Opened, Closed]);
|
|
68
69
|
/** Creates an initial dialog model from a config. Defaults to closed and non-animated. */
|
|
69
|
-
export const init = (config) => ({
|
|
70
|
+
export const init = (config) => (__foldkitBrandViewResult(({
|
|
70
71
|
id: config.id,
|
|
71
72
|
isOpen: config.isOpen ?? false,
|
|
72
73
|
isAnimated: config.isAnimated ?? false,
|
|
@@ -75,9 +76,9 @@ export const init = (config) => ({
|
|
|
75
76
|
...(config.isOpen !== undefined ? { isShowing: config.isOpen } : {}),
|
|
76
77
|
}),
|
|
77
78
|
maybeFocusSelector: Option.fromNullishOr(config.focusSelector),
|
|
78
|
-
});
|
|
79
|
+
}), "@foldkit/ui/dialog/index.js#init"));
|
|
79
80
|
// UPDATE
|
|
80
|
-
const dialogSelector = (id) => idSelector(id);
|
|
81
|
+
const dialogSelector = (id) => __foldkitBrandViewResult((idSelector(id)), "@foldkit/ui/dialog/index.js#dialogSelector");
|
|
81
82
|
/** Data attribute the dialog places on the `initialFocus` RenderInfo group and
|
|
82
83
|
* focuses on open. */
|
|
83
84
|
export const initialFocusMarkerAttribute = 'foldkit-dialog-initial-focus';
|
|
@@ -90,104 +91,104 @@ const withUpdateReturn = M.withReturnType();
|
|
|
90
91
|
* high-z-index overlays stay interactive. It layers the dialog with a high
|
|
91
92
|
* z-index, traps focus, and dispatches a `cancel` event on Esc. The Dialog
|
|
92
93
|
* component supplies its own backdrop. */
|
|
93
|
-
export const ShowDialog = Command.define('ShowDialog', { id: S.String, focusSelector: S.String }, CompletedShowDialog)(({ id, focusSelector }) => Dom.lockScroll.pipe(Effect.andThen(() => Dom.showDialog(dialogSelector(id), { focusSelector })), Effect.ignore, Effect.as(CompletedShowDialog())));
|
|
94
|
+
export const ShowDialog = Command.define('ShowDialog', { id: S.String, focusSelector: S.String }, CompletedShowDialog)(({ id, focusSelector }) => __foldkitBrandViewResult((Dom.lockScroll.pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.showDialog(dialogSelector(id), { focusSelector })), "@foldkit/ui/dialog/index.js#anonymous~2")), Effect.ignore, Effect.as(CompletedShowDialog()))), "@foldkit/ui/dialog/index.js#anonymous"));
|
|
94
95
|
/** Calls `close()` on the native dialog element and unlocks page scroll. */
|
|
95
|
-
export const CloseDialog = Command.define('CloseDialog', { id: S.String }, CompletedCloseDialog)(({ id }) => Dom.closeDialog(dialogSelector(id)).pipe(Effect.andThen(() => Dom.unlockScroll), Effect.ignore, Effect.as(CompletedCloseDialog())));
|
|
96
|
+
export const CloseDialog = Command.define('CloseDialog', { id: S.String }, CompletedCloseDialog)(({ id }) => __foldkitBrandViewResult((Dom.closeDialog(dialogSelector(id)).pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.unlockScroll), "@foldkit/ui/dialog/index.js#anonymous~4")), Effect.ignore, Effect.as(CompletedCloseDialog()))), "@foldkit/ui/dialog/index.js#anonymous~3"));
|
|
96
97
|
/** Releases the framework hygiene the dialog holds while open (scroll lock,
|
|
97
98
|
* focus trap, return focus, stack entry) when the element unmounts without a
|
|
98
99
|
* purposeful close. Idempotent: a no-op if the dialog already released its
|
|
99
100
|
* resources through `CloseDialog`. */
|
|
100
|
-
export const ReleaseDialogResources = Command.define('ReleaseDialogResources', { id: S.String }, CompletedReleaseDialogResources)(({ id }) => Dom.releaseDialogResources(id).pipe(Effect.ignore, Effect.as(CompletedReleaseDialogResources())));
|
|
101
|
-
const wrapAnimationMessage = (message) => GotAnimationMessage({ message });
|
|
101
|
+
export const ReleaseDialogResources = Command.define('ReleaseDialogResources', { id: S.String }, CompletedReleaseDialogResources)(({ id }) => __foldkitBrandViewResult((Dom.releaseDialogResources(id).pipe(Effect.ignore, Effect.as(CompletedReleaseDialogResources()))), "@foldkit/ui/dialog/index.js#anonymous~5"));
|
|
102
|
+
const wrapAnimationMessage = (message) => __foldkitBrandViewResult((GotAnimationMessage({ message })), "@foldkit/ui/dialog/index.js#wrapAnimationMessage");
|
|
102
103
|
const delegateToAnimation = (model, animationMessage) => {
|
|
103
104
|
const [nextAnimation, animationCommands, maybeOutMessage] = animationUpdate(model.animation, animationMessage);
|
|
104
105
|
const mappedCommands = Command.mapMessages(animationCommands, wrapAnimationMessage);
|
|
105
106
|
const additionalCommands = Option.match(maybeOutMessage, {
|
|
106
|
-
onNone: () => [],
|
|
107
|
+
onNone: () => __foldkitBrandViewResult(([]), "@foldkit/ui/dialog/index.js#onNone"),
|
|
107
108
|
onSome: M.type().pipe(M.tagsExhaustive({
|
|
108
|
-
StartedLeaveAnimating: () => [
|
|
109
|
+
StartedLeaveAnimating: () => __foldkitBrandViewResult(([
|
|
109
110
|
Command.mapMessage(animationDefaultLeaveCommand(nextAnimation), wrapAnimationMessage),
|
|
110
|
-
],
|
|
111
|
-
TransitionedOut: () => [CloseDialog({ id: model.id })],
|
|
111
|
+
]), "@foldkit/ui/dialog/index.js#StartedLeaveAnimating"),
|
|
112
|
+
TransitionedOut: () => __foldkitBrandViewResult(([CloseDialog({ id: model.id })]), "@foldkit/ui/dialog/index.js#TransitionedOut"),
|
|
112
113
|
})),
|
|
113
114
|
});
|
|
114
|
-
return [
|
|
115
|
-
evo(model, { animation: () => nextAnimation }),
|
|
115
|
+
return __foldkitBrandViewResult(([
|
|
116
|
+
evo(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/dialog/index.js#animation") }),
|
|
116
117
|
[...mappedCommands, ...additionalCommands],
|
|
117
118
|
Option.none(),
|
|
118
|
-
];
|
|
119
|
+
]), "@foldkit/ui/dialog/index.js#delegateToAnimation");
|
|
119
120
|
};
|
|
120
121
|
/** Processes a dialog message and returns the next model and commands. */
|
|
121
|
-
export const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
122
|
+
export const update = (model, message) => __foldkitBrandViewResult((M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
122
123
|
RequestedOpen: () => {
|
|
123
124
|
const wasClosed = !model.isOpen;
|
|
124
125
|
const maybeShow = Option.liftPredicate(ShowDialog({
|
|
125
126
|
id: model.id,
|
|
126
|
-
focusSelector: Option.getOrElse(model.maybeFocusSelector, () => initialFocusMarkerSelector),
|
|
127
|
-
}), () => wasClosed);
|
|
127
|
+
focusSelector: Option.getOrElse(model.maybeFocusSelector, () => __foldkitBrandViewResult((initialFocusMarkerSelector), "@foldkit/ui/dialog/index.js#anonymous~6")),
|
|
128
|
+
}), () => __foldkitBrandViewResult((wasClosed), "@foldkit/ui/dialog/index.js#anonymous~7"));
|
|
128
129
|
const maybeOutMessage = wasClosed
|
|
129
130
|
? Option.some(Opened())
|
|
130
131
|
: Option.none();
|
|
131
132
|
if (model.isAnimated) {
|
|
132
133
|
const [nextModel, animationCommands] = delegateToAnimation(model, AnimationShowed());
|
|
133
|
-
return [
|
|
134
|
-
evo(nextModel, { isOpen: () => true }),
|
|
134
|
+
return __foldkitBrandViewResult(([
|
|
135
|
+
evo(nextModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/dialog/index.js#isOpen") }),
|
|
135
136
|
[...Option.toArray(maybeShow), ...animationCommands],
|
|
136
137
|
maybeOutMessage,
|
|
137
|
-
];
|
|
138
|
+
]), "@foldkit/ui/dialog/index.js#RequestedOpen");
|
|
138
139
|
}
|
|
139
|
-
return [
|
|
140
|
-
evo(model, { isOpen: () => true }),
|
|
140
|
+
return __foldkitBrandViewResult(([
|
|
141
|
+
evo(model, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/dialog/index.js#isOpen~2") }),
|
|
141
142
|
Option.toArray(maybeShow),
|
|
142
143
|
maybeOutMessage,
|
|
143
|
-
];
|
|
144
|
+
]), "@foldkit/ui/dialog/index.js#RequestedOpen");
|
|
144
145
|
},
|
|
145
146
|
RequestedClose: () => {
|
|
146
147
|
const { transitionState } = model.animation;
|
|
147
148
|
const isLeaving = transitionState === 'LeaveStart' ||
|
|
148
149
|
transitionState === 'LeaveAnimating';
|
|
149
150
|
if (isLeaving) {
|
|
150
|
-
return [model, [], Option.none()];
|
|
151
|
+
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#RequestedClose");
|
|
151
152
|
}
|
|
152
153
|
const wasOpen = model.isOpen;
|
|
153
154
|
const maybeOutMessage = wasOpen ? Option.some(Closed()) : Option.none();
|
|
154
155
|
if (model.isAnimated) {
|
|
155
|
-
const [nextModel, animationCommands] = delegateToAnimation(evo(model, { isOpen: () => false }), AnimationHid());
|
|
156
|
-
return [nextModel, animationCommands, maybeOutMessage];
|
|
156
|
+
const [nextModel, animationCommands] = delegateToAnimation(evo(model, { isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~3") }), AnimationHid());
|
|
157
|
+
return __foldkitBrandViewResult(([nextModel, animationCommands, maybeOutMessage]), "@foldkit/ui/dialog/index.js#RequestedClose");
|
|
157
158
|
}
|
|
158
|
-
const maybeClose = Option.liftPredicate(CloseDialog({ id: model.id }), () => wasOpen);
|
|
159
|
-
return [
|
|
160
|
-
evo(model, { isOpen: () => false }),
|
|
159
|
+
const maybeClose = Option.liftPredicate(CloseDialog({ id: model.id }), () => __foldkitBrandViewResult((wasOpen), "@foldkit/ui/dialog/index.js#anonymous~8"));
|
|
160
|
+
return __foldkitBrandViewResult(([
|
|
161
|
+
evo(model, { isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~4") }),
|
|
161
162
|
Option.toArray(maybeClose),
|
|
162
163
|
maybeOutMessage,
|
|
163
|
-
];
|
|
164
|
+
]), "@foldkit/ui/dialog/index.js#RequestedClose");
|
|
164
165
|
},
|
|
165
|
-
GotAnimationMessage: ({ message: animationMessage }) => delegateToAnimation(model, animationMessage),
|
|
166
|
+
GotAnimationMessage: ({ message: animationMessage }) => __foldkitBrandViewResult((delegateToAnimation(model, animationMessage)), "@foldkit/ui/dialog/index.js#GotAnimationMessage"),
|
|
166
167
|
Unmounted: () => {
|
|
167
168
|
const isHoldingResources = model.isOpen || model.animation.transitionState !== 'Idle';
|
|
168
169
|
if (isHoldingResources) {
|
|
169
170
|
const nextModel = evo(model, {
|
|
170
|
-
isOpen: () => false,
|
|
171
|
-
animation: () => animationInit({ id: `${model.id}-panel` }),
|
|
171
|
+
isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~5"),
|
|
172
|
+
animation: () => __foldkitBrandViewResult((animationInit({ id: `${model.id}-panel` })), "@foldkit/ui/dialog/index.js#animation~2"),
|
|
172
173
|
});
|
|
173
|
-
return [
|
|
174
|
+
return __foldkitBrandViewResult(([
|
|
174
175
|
nextModel,
|
|
175
176
|
[ReleaseDialogResources({ id: model.id })],
|
|
176
177
|
Option.none(),
|
|
177
|
-
];
|
|
178
|
+
]), "@foldkit/ui/dialog/index.js#Unmounted");
|
|
178
179
|
}
|
|
179
180
|
else {
|
|
180
|
-
return [model, [], Option.none()];
|
|
181
|
+
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#Unmounted");
|
|
181
182
|
}
|
|
182
183
|
},
|
|
183
|
-
CompletedShowDialog: () => [model, [], Option.none()],
|
|
184
|
-
CompletedCloseDialog: () => [model, [], Option.none()],
|
|
185
|
-
CompletedReleaseDialogResources: () => [model, [], Option.none()],
|
|
186
|
-
}));
|
|
184
|
+
CompletedShowDialog: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#CompletedShowDialog"),
|
|
185
|
+
CompletedCloseDialog: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#CompletedCloseDialog"),
|
|
186
|
+
CompletedReleaseDialogResources: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#CompletedReleaseDialogResources"),
|
|
187
|
+
}))), "@foldkit/ui/dialog/index.js#update");
|
|
187
188
|
/** Programmatically opens the dialog. */
|
|
188
|
-
export const open = (model) => update(model, RequestedOpen());
|
|
189
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, RequestedOpen())), "@foldkit/ui/dialog/index.js#open");
|
|
189
190
|
/** Programmatically closes the dialog. */
|
|
190
|
-
export const close = (model) => update(model, RequestedClose());
|
|
191
|
+
export const close = (model) => __foldkitBrandViewResult((update(model, RequestedClose())), "@foldkit/ui/dialog/index.js#close");
|
|
191
192
|
// VIEW
|
|
192
193
|
/** Returns the framework-managed id the dialog's `aria-labelledby` points at,
|
|
193
194
|
* the `-dialog-title` suffix on `model.id`.
|
|
@@ -197,7 +198,7 @@ export const close = (model) => update(model, RequestedClose());
|
|
|
197
198
|
* helper only when you need the id as a value outside `toView`: a Command that
|
|
198
199
|
* calls `getElementById`, a cross-element `aria-describedby`, or a test. Do not
|
|
199
200
|
* hand-roll the id string. */
|
|
200
|
-
export const titleId = (model) => `${model.id}-dialog-title
|
|
201
|
+
export const titleId = (model) => __foldkitBrandViewResult((`${model.id}-dialog-title`), "@foldkit/ui/dialog/index.js#titleId");
|
|
201
202
|
/** Returns the framework-managed id the dialog's `aria-describedby` points at,
|
|
202
203
|
* the `-dialog-description` suffix on `model.id`.
|
|
203
204
|
*
|
|
@@ -206,7 +207,7 @@ export const titleId = (model) => `${model.id}-dialog-title`;
|
|
|
206
207
|
* for you. Reach for this helper only when you need the id as a value outside
|
|
207
208
|
* `toView`: a Command that calls `getElementById`, a cross-element
|
|
208
209
|
* `aria-describedby`, or a test. Do not hand-roll the id string. */
|
|
209
|
-
export const descriptionId = (model) => `${model.id}-dialog-description
|
|
210
|
+
export const descriptionId = (model) => __foldkitBrandViewResult((`${model.id}-dialog-description`), "@foldkit/ui/dialog/index.js#descriptionId");
|
|
210
211
|
/** Renders a headless dialog component backed by the native `<dialog>`
|
|
211
212
|
* element. `ShowDialog` opens it through `Dom.showDialog`, which uses `show()`
|
|
212
213
|
* (not native `showModal()`) with a high z-index, a focus trap, a
|
|
@@ -217,21 +218,21 @@ export const view = defineView((model, viewInputs) => {
|
|
|
217
218
|
const { toView } = viewInputs;
|
|
218
219
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
219
220
|
const isVisible = isOpen || isLeaving;
|
|
220
|
-
const animationAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => [
|
|
221
|
+
const animationAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => __foldkitBrandViewResult(([
|
|
221
222
|
h.DataAttribute('closed', ''),
|
|
222
223
|
h.DataAttribute('enter', ''),
|
|
223
224
|
h.DataAttribute('transition', ''),
|
|
224
|
-
]), M.when('EnterAnimating', () => [
|
|
225
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~10")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
225
226
|
h.DataAttribute('enter', ''),
|
|
226
227
|
h.DataAttribute('transition', ''),
|
|
227
|
-
]), M.when('LeaveStart', () => [
|
|
228
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~11")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
228
229
|
h.DataAttribute('leave', ''),
|
|
229
230
|
h.DataAttribute('transition', ''),
|
|
230
|
-
]), M.when('LeaveAnimating', () => [
|
|
231
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~12")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
231
232
|
h.DataAttribute('closed', ''),
|
|
232
233
|
h.DataAttribute('leave', ''),
|
|
233
234
|
h.DataAttribute('transition', ''),
|
|
234
|
-
]), M.orElse(() => []));
|
|
235
|
+
]), "@foldkit/ui/dialog/index.js#anonymous~13")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/dialog/index.js#anonymous~14")));
|
|
235
236
|
const dialogAttributes = [
|
|
236
237
|
h.Id(id),
|
|
237
238
|
h.AriaLabelledBy(titleId(model)),
|
|
@@ -266,7 +267,7 @@ export const view = defineView((model, viewInputs) => {
|
|
|
266
267
|
h.DataAttribute(initialFocusMarkerAttribute, ''),
|
|
267
268
|
];
|
|
268
269
|
const closeButtonAttributes = isLeaving ? [] : [h.OnClick(RequestedClose())];
|
|
269
|
-
return toView({
|
|
270
|
+
return __foldkitBrandViewResult((toView({
|
|
270
271
|
dialog: childAttributes(dialogAttributes),
|
|
271
272
|
backdrop: childAttributes(backdropAttributes),
|
|
272
273
|
panel: childAttributes(panelAttributes),
|
|
@@ -275,5 +276,5 @@ export const view = defineView((model, viewInputs) => {
|
|
|
275
276
|
initialFocus: childAttributes(initialFocusAttributes),
|
|
276
277
|
closeButton: childAttributes(closeButtonAttributes),
|
|
277
278
|
isVisible,
|
|
278
|
-
});
|
|
279
|
+
})), "@foldkit/ui/dialog/index.js#anonymous~9");
|
|
279
280
|
});
|