@foldkit/ui 0.150.0 → 0.151.0-canary.aafef6783aec
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 +10 -9
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +27 -35
- package/dist/calendar/index.d.ts +100 -11
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +66 -80
- package/dist/checkbox/index.d.ts +3 -4
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +3 -4
- package/dist/combobox/multi.d.ts +40 -51
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +19 -16
- package/dist/combobox/shared.d.ts +20 -20
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +134 -128
- package/dist/combobox/single.d.ts +38 -51
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +21 -17
- package/dist/datePicker/index.d.ts +182 -15
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +37 -54
- package/dist/dialog/index.d.ts +45 -7
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +54 -49
- package/dist/disclosure/index.d.ts +3 -4
- package/dist/disclosure/index.d.ts.map +1 -1
- package/dist/disclosure/index.js +3 -4
- package/dist/dragAndDrop/index.d.ts +96 -7
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +49 -61
- package/dist/fileDrop/index.d.ts +26 -11
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +16 -23
- package/dist/listbox/multi.d.ts +39 -52
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +9 -7
- package/dist/listbox/shared.d.ts +14 -22
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +113 -114
- package/dist/listbox/single.d.ts +40 -55
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +8 -7
- package/dist/menu/index.d.ts +131 -37
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +111 -120
- package/dist/popover/index.d.ts +71 -10
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +80 -73
- package/dist/radioGroup/index.d.ts +31 -19
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +18 -18
- package/dist/slider/index.d.ts +44 -13
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +33 -38
- package/dist/switch/index.d.ts +3 -4
- package/dist/switch/index.d.ts.map +1 -1
- package/dist/switch/index.js +3 -4
- package/dist/tabs/index.d.ts +31 -17
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +17 -17
- package/dist/test/apps/disabledButton.d.ts +17 -17
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +6 -4
- package/dist/toast/index.d.ts +96 -100
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/update.d.ts +97 -100
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +60 -58
- package/dist/tooltip/index.d.ts +2 -1
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +1 -1
- package/dist/tooltip/tooltip.d.ts +5 -10
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +45 -48
- package/dist/virtualList/index.d.ts +30 -29
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +21 -21
- package/package.json +4 -4
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { Effect,
|
|
1
|
+
import { Effect, Schema as S } from 'effect';
|
|
2
|
+
import { type Update } from 'foldkit';
|
|
2
3
|
import * as Command from 'foldkit/command';
|
|
3
|
-
import { Message, type Model, OutMessage } from './schema.js';
|
|
4
|
-
type UpdateReturn =
|
|
5
|
-
Model,
|
|
6
|
-
ReadonlyArray<Command.Command<Message>>,
|
|
7
|
-
Option.Option<OutMessage>
|
|
8
|
-
];
|
|
4
|
+
import { type Hid, Message, type Model, OutMessage, type Showed } from './schema.js';
|
|
5
|
+
type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
9
6
|
/** Waits for paint via double-rAF before the enter/leave lifecycle advances. */
|
|
10
7
|
export declare const WaitForPaint: Command.CommandDefinitionNoArgs<"WaitForPaint", Effect.Effect<{
|
|
11
8
|
readonly _tag: "CompletedWaitForPaint";
|
|
@@ -16,8 +13,12 @@ export declare const WaitForAnimationSettled: Command.CommandDefinitionWithArgs<
|
|
|
16
13
|
}, Effect.Effect<{
|
|
17
14
|
readonly _tag: "EndedAnimation";
|
|
18
15
|
}, never, never>>;
|
|
19
|
-
/** Processes an
|
|
20
|
-
|
|
16
|
+
/** Processes an Animation Message and returns the next Model, optional
|
|
17
|
+
* Commands, and an optional OutMessage. `Showed` and `Hid` start a transition
|
|
18
|
+
* but cannot finish one, so direct calls with either Message return a plain
|
|
19
|
+
* update result. */
|
|
20
|
+
export declare function update(model: Model, message: Showed | Hid): Update.Return<Model, Message>;
|
|
21
|
+
export declare function update(model: Model, message: Message): UpdateReturn;
|
|
21
22
|
/** Creates the standard leave-phase command that waits for CSS animations on the element to settle. Use this when handling the `StartedLeaveAnimating` OutMessage for components that don't need custom leave behavior. */
|
|
22
23
|
export declare const defaultLeaveCommand: (model: Model) => Command.Command<Message>;
|
|
23
24
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/animation/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/animation/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAM1C,OAAO,EACL,KAAK,GAAG,EACR,OAAO,EACP,KAAK,KAAK,EACV,UAAU,EACV,KAAK,MAAM,EACZ,MAAM,aAAa,CAAA;AAMpB,KAAK,YAAY,GAAG,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;AAG3E,gFAAgF;AAChF,eAAO,MAAM,YAAY;;iBAGvB,CAAA;AACF,sHAAsH;AACtH,eAAO,MAAM,uBAAuB;;;;iBAUnC,CAAA;AAED;;;qBAGqB;AACrB,wBAAgB,MAAM,CACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,GAAG,GAAG,GACpB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AAChC,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY,CAAA;AAkEpE,2NAA2N;AAC3N,eAAO,MAAM,mBAAmB,GAAI,OAAO,KAAK,KAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAC/B,CAAA"}
|
package/dist/animation/update.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Effect, Match as M,
|
|
2
|
+
import { Effect, Match as M, Schema as S } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import * as Render from 'foldkit/render';
|
|
6
6
|
import { evo } from 'foldkit/struct';
|
|
7
7
|
import { idSelector } from '../internal/selectors.js';
|
|
8
|
-
import { Message, OutMessage } from './schema.js';
|
|
8
|
+
import { Message, OutMessage, } from './schema.js';
|
|
9
9
|
// UPDATE
|
|
10
10
|
const elementSelector = (id) => __foldkitBrandViewResult((idSelector(id)), "@foldkit/ui/animation/update.js#elementSelector");
|
|
11
11
|
const withUpdateReturn = M.withReturnType();
|
|
@@ -20,57 +20,49 @@ export const WaitForAnimationSettled = Command.define('WaitForAnimationSettled',
|
|
|
20
20
|
messages: [Message.EndedAnimation],
|
|
21
21
|
execute: ({ id }) => __foldkitBrandViewResult((Dom.waitForAnimationSettled(elementSelector(id)).pipe(Effect.as(Message.EndedAnimation()))), "@foldkit/ui/animation/update.js#execute"),
|
|
22
22
|
});
|
|
23
|
-
|
|
24
|
-
export const update = (model, message) => {
|
|
23
|
+
export function update(model, message) {
|
|
25
24
|
const maybeNextFrame = WaitForPaint();
|
|
26
25
|
return __foldkitBrandViewResult((Message.match(message, {
|
|
27
26
|
Showed: () => {
|
|
28
27
|
if (model.isShowing) {
|
|
29
|
-
return __foldkitBrandViewResult((
|
|
28
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/animation/update.js#Showed");
|
|
30
29
|
}
|
|
31
|
-
return __foldkitBrandViewResult((
|
|
32
|
-
evo(model, {
|
|
30
|
+
return __foldkitBrandViewResult(({
|
|
31
|
+
model: evo(model, {
|
|
33
32
|
isShowing: () => __foldkitBrandViewResult((true), "@foldkit/ui/animation/update.js#isShowing"),
|
|
34
33
|
transitionState: () => __foldkitBrandViewResult(('EnterStart'), "@foldkit/ui/animation/update.js#transitionState"),
|
|
35
34
|
}),
|
|
36
|
-
[maybeNextFrame],
|
|
37
|
-
|
|
38
|
-
]), "@foldkit/ui/animation/update.js#Showed");
|
|
35
|
+
commands: [maybeNextFrame],
|
|
36
|
+
}), "@foldkit/ui/animation/update.js#Showed");
|
|
39
37
|
},
|
|
40
38
|
Hid: () => {
|
|
41
39
|
const isLeaving = model.transitionState === 'LeaveStart' ||
|
|
42
40
|
model.transitionState === 'LeaveAnimating';
|
|
43
41
|
if (isLeaving || !model.isShowing) {
|
|
44
|
-
return __foldkitBrandViewResult((
|
|
42
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/animation/update.js#Hid");
|
|
45
43
|
}
|
|
46
|
-
return __foldkitBrandViewResult((
|
|
47
|
-
evo(model, {
|
|
44
|
+
return __foldkitBrandViewResult(({
|
|
45
|
+
model: evo(model, {
|
|
48
46
|
isShowing: () => __foldkitBrandViewResult((false), "@foldkit/ui/animation/update.js#isShowing~2"),
|
|
49
47
|
transitionState: () => __foldkitBrandViewResult(('LeaveStart'), "@foldkit/ui/animation/update.js#transitionState~2"),
|
|
50
48
|
}),
|
|
51
|
-
[maybeNextFrame],
|
|
52
|
-
|
|
53
|
-
]), "@foldkit/ui/animation/update.js#Hid");
|
|
49
|
+
commands: [maybeNextFrame],
|
|
50
|
+
}), "@foldkit/ui/animation/update.js#Hid");
|
|
54
51
|
},
|
|
55
|
-
CompletedWaitForPaint: () => __foldkitBrandViewResult((M.value(model.transitionState).pipe(withUpdateReturn, M.when('EnterStart', () => __foldkitBrandViewResult((
|
|
56
|
-
evo(model, { transitionState: () => __foldkitBrandViewResult(('EnterAnimating'), "@foldkit/ui/animation/update.js#transitionState~3") }),
|
|
57
|
-
[WaitForAnimationSettled({ id: model.id })],
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
evo(model, { transitionState: () => __foldkitBrandViewResult(('Idle'), "@foldkit/ui/animation/update.js#transitionState~
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
]), "@foldkit/ui/animation/update.js#anonymous~4")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
69
|
-
evo(model, { transitionState: () => __foldkitBrandViewResult(('Idle'), "@foldkit/ui/animation/update.js#transitionState~6") }),
|
|
70
|
-
[],
|
|
71
|
-
Option.some(OutMessage.TransitionedOut()),
|
|
72
|
-
]), "@foldkit/ui/animation/update.js#anonymous~5")), M.orElse(() => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/animation/update.js#anonymous~6")))), "@foldkit/ui/animation/update.js#EndedAnimation"),
|
|
52
|
+
CompletedWaitForPaint: () => __foldkitBrandViewResult((M.value(model.transitionState).pipe(withUpdateReturn, M.when('EnterStart', () => (__foldkitBrandViewResult(({
|
|
53
|
+
model: evo(model, { transitionState: () => __foldkitBrandViewResult(('EnterAnimating'), "@foldkit/ui/animation/update.js#transitionState~3") }),
|
|
54
|
+
commands: [WaitForAnimationSettled({ id: model.id })],
|
|
55
|
+
}), "@foldkit/ui/animation/update.js#anonymous"))), M.when('LeaveStart', () => (__foldkitBrandViewResult(({
|
|
56
|
+
model: evo(model, { transitionState: () => __foldkitBrandViewResult(('LeaveAnimating'), "@foldkit/ui/animation/update.js#transitionState~4") }),
|
|
57
|
+
outMessage: OutMessage.StartedLeaveAnimating(),
|
|
58
|
+
}), "@foldkit/ui/animation/update.js#anonymous~2"))), M.orElse(() => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/animation/update.js#anonymous~3"))))), "@foldkit/ui/animation/update.js#CompletedWaitForPaint"),
|
|
59
|
+
EndedAnimation: () => __foldkitBrandViewResult((M.value(model.transitionState).pipe(withUpdateReturn, M.when('EnterAnimating', () => (__foldkitBrandViewResult(({
|
|
60
|
+
model: evo(model, { transitionState: () => __foldkitBrandViewResult(('Idle'), "@foldkit/ui/animation/update.js#transitionState~5") }),
|
|
61
|
+
}), "@foldkit/ui/animation/update.js#anonymous~4"))), M.when('LeaveAnimating', () => (__foldkitBrandViewResult(({
|
|
62
|
+
model: evo(model, { transitionState: () => __foldkitBrandViewResult(('Idle'), "@foldkit/ui/animation/update.js#transitionState~6") }),
|
|
63
|
+
outMessage: OutMessage.TransitionedOut(),
|
|
64
|
+
}), "@foldkit/ui/animation/update.js#anonymous~5"))), M.orElse(() => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/animation/update.js#anonymous~6"))))), "@foldkit/ui/animation/update.js#EndedAnimation"),
|
|
73
65
|
})), "@foldkit/ui/animation/update.js#update");
|
|
74
|
-
}
|
|
66
|
+
}
|
|
75
67
|
/** Creates the standard leave-phase command that waits for CSS animations on the element to settle. Use this when handling the `StartedLeaveAnimating` OutMessage for components that don't need custom leave behavior. */
|
|
76
68
|
export const defaultLeaveCommand = (model) => __foldkitBrandViewResult((WaitForAnimationSettled({ id: model.id })), "@foldkit/ui/animation/update.js#defaultLeaveCommand");
|
package/dist/calendar/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { CalendarDate } from 'foldkit/calendar';
|
|
|
4
4
|
import * as Command from 'foldkit/command';
|
|
5
5
|
import { type ChildAttribute, type Html } from 'foldkit/html';
|
|
6
6
|
import { type Reflect } from 'foldkit/submodel';
|
|
7
|
+
import * as Update from 'foldkit/update';
|
|
7
8
|
/** Which grid the calendar is currently displaying. `Days` is the standard
|
|
8
9
|
* 6×7 day grid; `Months` is a 3×4 month-name grid for fast month jumps;
|
|
9
10
|
* `Years` is a 3×4 year grid paged in 12-year windows for fast year jumps. */
|
|
@@ -128,11 +129,7 @@ export type InitConfig = Readonly<{
|
|
|
128
129
|
* defaults to `initialViewDate` (pass the parent's selected date to open onto
|
|
129
130
|
* it), or today when omitted. */
|
|
130
131
|
export declare const init: (config: InitConfig) => Model;
|
|
131
|
-
type UpdateReturn =
|
|
132
|
-
Model,
|
|
133
|
-
ReadonlyArray<Command.Command<Message>>,
|
|
134
|
-
Option.Option<OutMessage>
|
|
135
|
-
];
|
|
132
|
+
type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
136
133
|
/** Focuses the calendar grid container. Parent components like DatePicker
|
|
137
134
|
* dispatch this after opening to hand focus to the grid's keyboard layer. */
|
|
138
135
|
export declare const FocusGrid: Command.CommandDefinitionWithArgs<"FocusGrid", {
|
|
@@ -183,9 +180,102 @@ export declare const reflectDisabledDaysOfWeek: Reflect<Model, ReadonlyArray<Cal
|
|
|
183
180
|
* cause `aria-activedescendant` to point at a non-rendered cell and the
|
|
184
181
|
* next ArrowLeft to jump to the cursor's stale year. */
|
|
185
182
|
export declare const dropToDays: (model: Model) => Model;
|
|
186
|
-
/** Processes a
|
|
187
|
-
* optional OutMessage. */
|
|
188
|
-
export declare const update: (model: Model, message: Message) =>
|
|
183
|
+
/** Processes a Calendar Message and returns the next Model, optional Commands,
|
|
184
|
+
* and an optional OutMessage. */
|
|
185
|
+
export declare const update: (model: Model, message: Message) => Readonly<{
|
|
186
|
+
model: {
|
|
187
|
+
readonly id: string;
|
|
188
|
+
readonly today: {
|
|
189
|
+
readonly year: number;
|
|
190
|
+
readonly month: number;
|
|
191
|
+
readonly day: number;
|
|
192
|
+
};
|
|
193
|
+
readonly viewYear: number;
|
|
194
|
+
readonly viewMonth: number;
|
|
195
|
+
readonly viewMode: "Days" | "Months" | "Years";
|
|
196
|
+
readonly maybeFocusedDate: Option.Option<{
|
|
197
|
+
readonly year: number;
|
|
198
|
+
readonly month: number;
|
|
199
|
+
readonly day: number;
|
|
200
|
+
}>;
|
|
201
|
+
readonly isGridFocused: boolean;
|
|
202
|
+
readonly locale: {
|
|
203
|
+
readonly firstDayOfWeek: "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday";
|
|
204
|
+
readonly monthNames: readonly [string, string, string, string, string, string, string, string, string, string, string, string];
|
|
205
|
+
readonly shortMonthNames: readonly [string, string, string, string, string, string, string, string, string, string, string, string];
|
|
206
|
+
readonly dayNames: readonly [string, string, string, string, string, string, string];
|
|
207
|
+
readonly shortDayNames: readonly [string, string, string, string, string, string, string];
|
|
208
|
+
};
|
|
209
|
+
readonly maybeMinDate: Option.Option<{
|
|
210
|
+
readonly year: number;
|
|
211
|
+
readonly month: number;
|
|
212
|
+
readonly day: number;
|
|
213
|
+
}>;
|
|
214
|
+
readonly maybeMaxDate: Option.Option<{
|
|
215
|
+
readonly year: number;
|
|
216
|
+
readonly month: number;
|
|
217
|
+
readonly day: number;
|
|
218
|
+
}>;
|
|
219
|
+
readonly disabledDaysOfWeek: readonly ("Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday")[];
|
|
220
|
+
readonly disabledDates: readonly {
|
|
221
|
+
readonly year: number;
|
|
222
|
+
readonly month: number;
|
|
223
|
+
readonly day: number;
|
|
224
|
+
}[];
|
|
225
|
+
};
|
|
226
|
+
commands?: Update.Commands<{
|
|
227
|
+
readonly _tag: "ClickedDay";
|
|
228
|
+
readonly date: {
|
|
229
|
+
readonly year: number;
|
|
230
|
+
readonly month: number;
|
|
231
|
+
readonly day: number;
|
|
232
|
+
};
|
|
233
|
+
} | {
|
|
234
|
+
readonly _tag: "PressedKeyOnGrid";
|
|
235
|
+
readonly key: string;
|
|
236
|
+
readonly isShift: boolean;
|
|
237
|
+
} | {
|
|
238
|
+
readonly _tag: "ClickedPreviousMonthButton";
|
|
239
|
+
} | {
|
|
240
|
+
readonly _tag: "ClickedNextMonthButton";
|
|
241
|
+
} | {
|
|
242
|
+
readonly _tag: "ClickedHeading";
|
|
243
|
+
} | {
|
|
244
|
+
readonly _tag: "SelectedMonth";
|
|
245
|
+
readonly month: number;
|
|
246
|
+
} | {
|
|
247
|
+
readonly _tag: "SelectedYear";
|
|
248
|
+
readonly year: number;
|
|
249
|
+
} | {
|
|
250
|
+
readonly _tag: "PagedYears";
|
|
251
|
+
readonly direction: 1 | -1;
|
|
252
|
+
} | {
|
|
253
|
+
readonly _tag: "FocusedGrid";
|
|
254
|
+
} | {
|
|
255
|
+
readonly _tag: "BlurredGrid";
|
|
256
|
+
} | {
|
|
257
|
+
readonly _tag: "RefreshedToday";
|
|
258
|
+
readonly today: {
|
|
259
|
+
readonly year: number;
|
|
260
|
+
readonly month: number;
|
|
261
|
+
readonly day: number;
|
|
262
|
+
};
|
|
263
|
+
} | {
|
|
264
|
+
readonly _tag: "CompletedFocusGrid";
|
|
265
|
+
}, never>;
|
|
266
|
+
outMessage?: {
|
|
267
|
+
readonly _tag: "ChangedViewMonth";
|
|
268
|
+
readonly year: number;
|
|
269
|
+
readonly month: number;
|
|
270
|
+
} | {
|
|
271
|
+
readonly _tag: "SelectedDate";
|
|
272
|
+
readonly date: {
|
|
273
|
+
readonly year: number;
|
|
274
|
+
readonly month: number;
|
|
275
|
+
readonly day: number;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
}>;
|
|
189
279
|
/** Information about a single day cell in the rendered calendar grid. */
|
|
190
280
|
export type DayCell = Readonly<{
|
|
191
281
|
date: CalendarDate;
|
|
@@ -288,9 +378,8 @@ export type CalendarAttributes = DaysModeAttributes | MonthsModeAttributes | Yea
|
|
|
288
378
|
/** Per-render view inputs passed to `view` via `h.submodel`'s `viewInputs` field.
|
|
289
379
|
*
|
|
290
380
|
* The Calendar dispatches its own `ClickedDay` message on date commit
|
|
291
|
-
* and emits a `SelectedDate` OutMessage.
|
|
292
|
-
*
|
|
293
|
-
* `GotCalendarMessage` handler. */
|
|
381
|
+
* and emits a `SelectedDate` OutMessage. Handle the selection in the
|
|
382
|
+
* `foldOutMessage` of the Calendar's `Update.foldChild` config. */
|
|
294
383
|
export type ViewInputs = Readonly<{
|
|
295
384
|
/** The selected date, read straight from the parent Model. The selected-day
|
|
296
385
|
* marker derives from it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAIN,MAAM,EACN,MAAM,IAAI,CAAC,EAEZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,IAAI,EAGV,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,M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Y,CAAC,CAAA;IAC9C,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAC,CAAA;AAueF;;;yCAGyC;AACzC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IArff;kCAC8B;uBACX,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;YACtC,CAAC,UAAU,EAAE,kBAAkB,KAAK,IAAI;yBAC3B,MAAM;qBACV,MAAM;6BACE,MAAM;yBACV,MAAM;6BACF,MAAM;+BACJ,MAAM;GAuflC,CAAA"}
|
package/dist/calendar/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { childAttributes, } from 'foldkit/html';
|
|
|
7
7
|
import { defineMessageUnion } from 'foldkit/message';
|
|
8
8
|
import { evo } from 'foldkit/struct';
|
|
9
9
|
import { defineView } from 'foldkit/submodel';
|
|
10
|
+
import * as Update from 'foldkit/update';
|
|
10
11
|
import * as OptionExt from '../internal/optionExtensions.js';
|
|
11
12
|
import { idSelector } from '../internal/selectors.js';
|
|
12
13
|
// MODEL
|
|
@@ -200,14 +201,14 @@ const currentOrFallbackFocus = (model) => __foldkitBrandViewResult((Option.getOr
|
|
|
200
201
|
* month boundary. Always emits `SelectedDate` carrying the committed date;
|
|
201
202
|
* the parent infers month transitions from the date itself rather than from
|
|
202
203
|
* a separate `ChangedViewMonth` signal that would race with the selection. */
|
|
203
|
-
const commitSelection = (model, date) => {
|
|
204
|
-
|
|
204
|
+
const commitSelection = (model, date) => (__foldkitBrandViewResult(({
|
|
205
|
+
model: evo(model, {
|
|
205
206
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(date)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~3"),
|
|
206
207
|
viewYear: () => __foldkitBrandViewResult((date.year), "@foldkit/ui/calendar/index.js#viewYear~2"),
|
|
207
208
|
viewMonth: () => __foldkitBrandViewResult((date.month), "@foldkit/ui/calendar/index.js#viewMonth~2"),
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
};
|
|
209
|
+
}),
|
|
210
|
+
outMessage: OutMessage.SelectedDate({ date }),
|
|
211
|
+
}), "@foldkit/ui/calendar/index.js#commitSelection"));
|
|
211
212
|
/** Applies a focus move to the model, clamping to the allowed range and
|
|
212
213
|
* skipping disabled dates. Emits `ChangedViewMonth` if the move crossed a
|
|
213
214
|
* month boundary. */
|
|
@@ -220,11 +221,18 @@ const applyFocusMove = (model, candidate, direction, cap) => {
|
|
|
220
221
|
viewYear: () => __foldkitBrandViewResult((nextFocus.year), "@foldkit/ui/calendar/index.js#viewYear~3"),
|
|
221
222
|
viewMonth: () => __foldkitBrandViewResult((nextFocus.month), "@foldkit/ui/calendar/index.js#viewMonth~3"),
|
|
222
223
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
if (crossedMonth) {
|
|
225
|
+
return __foldkitBrandViewResult(({
|
|
226
|
+
model: nextModel,
|
|
227
|
+
outMessage: OutMessage.ChangedViewMonth({
|
|
228
|
+
year: nextFocus.year,
|
|
229
|
+
month: nextFocus.month,
|
|
230
|
+
}),
|
|
231
|
+
}), "@foldkit/ui/calendar/index.js#applyFocusMove");
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
return __foldkitBrandViewResult(({ model: nextModel }), "@foldkit/ui/calendar/index.js#applyFocusMove");
|
|
235
|
+
}
|
|
228
236
|
};
|
|
229
237
|
/** Computes the focused-date cursor for a view-month change. Preserves the
|
|
230
238
|
* current day-of-month (clamping to the new month's length when needed),
|
|
@@ -242,7 +250,7 @@ const moveFocusForViewChange = (model, year, month, direction) => {
|
|
|
242
250
|
};
|
|
243
251
|
const applyViewMonthChange = (model, year, month, direction) => {
|
|
244
252
|
if (year === model.viewYear && month === model.viewMonth) {
|
|
245
|
-
return __foldkitBrandViewResult((
|
|
253
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#applyViewMonthChange");
|
|
246
254
|
}
|
|
247
255
|
const nextFocus = moveFocusForViewChange(model, year, month, direction);
|
|
248
256
|
const nextModel = evo(model, {
|
|
@@ -250,11 +258,10 @@ const applyViewMonthChange = (model, year, month, direction) => {
|
|
|
250
258
|
viewMonth: () => __foldkitBrandViewResult((month), "@foldkit/ui/calendar/index.js#viewMonth~4"),
|
|
251
259
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~5"),
|
|
252
260
|
});
|
|
253
|
-
return __foldkitBrandViewResult((
|
|
254
|
-
nextModel,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
]), "@foldkit/ui/calendar/index.js#applyViewMonthChange");
|
|
261
|
+
return __foldkitBrandViewResult(({
|
|
262
|
+
model: nextModel,
|
|
263
|
+
outMessage: OutMessage.ChangedViewMonth({ year, month }),
|
|
264
|
+
}), "@foldkit/ui/calendar/index.js#applyViewMonthChange");
|
|
258
265
|
};
|
|
259
266
|
/** Direction the user moved when jumping to a new view year/month via grid
|
|
260
267
|
* selection. Used by `skipDisabled` so a forward jump skips forward through
|
|
@@ -278,14 +285,12 @@ const resolveYearsKey = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.w
|
|
|
278
285
|
const applyMonthsFocusShift = (model, monthShift) => {
|
|
279
286
|
const focused = currentOrFallbackFocus(model);
|
|
280
287
|
const nextFocus = Calendar.addMonths(focused, monthShift);
|
|
281
|
-
return __foldkitBrandViewResult((
|
|
282
|
-
evo(model, {
|
|
288
|
+
return __foldkitBrandViewResult(({
|
|
289
|
+
model: evo(model, {
|
|
283
290
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~6"),
|
|
284
291
|
viewYear: () => __foldkitBrandViewResult((nextFocus.year), "@foldkit/ui/calendar/index.js#viewYear~5"),
|
|
285
292
|
}),
|
|
286
|
-
|
|
287
|
-
Option.none(),
|
|
288
|
-
]), "@foldkit/ui/calendar/index.js#applyMonthsFocusShift");
|
|
293
|
+
}), "@foldkit/ui/calendar/index.js#applyMonthsFocusShift");
|
|
289
294
|
};
|
|
290
295
|
/** Applies a years-grid focus shift, updating only `maybeFocusedDate`.
|
|
291
296
|
* `viewYear` is preserved so the "selected" highlight (`year === viewYear`)
|
|
@@ -294,51 +299,44 @@ const applyMonthsFocusShift = (model, monthShift) => {
|
|
|
294
299
|
const applyYearsFocusShift = (model, yearShift) => {
|
|
295
300
|
const focused = currentOrFallbackFocus(model);
|
|
296
301
|
const nextFocus = Calendar.addYears(focused, yearShift);
|
|
297
|
-
return __foldkitBrandViewResult((
|
|
298
|
-
evo(model, {
|
|
302
|
+
return __foldkitBrandViewResult(({
|
|
303
|
+
model: evo(model, {
|
|
299
304
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~7"),
|
|
300
305
|
}),
|
|
301
|
-
|
|
302
|
-
Option.none(),
|
|
303
|
-
]), "@foldkit/ui/calendar/index.js#applyYearsFocusShift");
|
|
306
|
+
}), "@foldkit/ui/calendar/index.js#applyYearsFocusShift");
|
|
304
307
|
};
|
|
305
|
-
/** Processes a
|
|
306
|
-
* optional OutMessage. */
|
|
308
|
+
/** Processes a Calendar Message and returns the next Model, optional Commands,
|
|
309
|
+
* and an optional OutMessage. */
|
|
307
310
|
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
308
311
|
ClickedDay: ({ date }) => {
|
|
309
312
|
if (isDateDisabled(model, date)) {
|
|
310
|
-
return __foldkitBrandViewResult((
|
|
313
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#ClickedDay");
|
|
311
314
|
}
|
|
312
315
|
else {
|
|
313
|
-
|
|
314
|
-
return __foldkitBrandViewResult(([nextModel, [], maybeOutMessage]), "@foldkit/ui/calendar/index.js#ClickedDay");
|
|
316
|
+
return __foldkitBrandViewResult((commitSelection(model, date)), "@foldkit/ui/calendar/index.js#ClickedDay");
|
|
315
317
|
}
|
|
316
318
|
},
|
|
317
319
|
PressedKeyOnGrid: ({ key, isShift }) => __foldkitBrandViewResult((M.value(model.viewMode).pipe(withUpdateReturn, M.when('Days', () => {
|
|
318
320
|
const focused = currentOrFallbackFocus(model);
|
|
319
321
|
if (isCommitKey(key)) {
|
|
320
322
|
if (isDateDisabled(model, focused)) {
|
|
321
|
-
return __foldkitBrandViewResult((
|
|
323
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#anonymous~32");
|
|
322
324
|
}
|
|
323
325
|
else {
|
|
324
|
-
|
|
325
|
-
return __foldkitBrandViewResult(([nextModel, [], maybeOutMessage]), "@foldkit/ui/calendar/index.js#anonymous~32");
|
|
326
|
+
return __foldkitBrandViewResult((commitSelection(model, focused)), "@foldkit/ui/calendar/index.js#anonymous~32");
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
329
|
else {
|
|
329
330
|
return __foldkitBrandViewResult((Option.match(resolveNavigationKey(key, isShift, focused, model.locale.firstDayOfWeek), {
|
|
330
|
-
onNone: () => __foldkitBrandViewResult((
|
|
331
|
-
onSome: ([candidate, direction, cap]) =>
|
|
332
|
-
const [nextModel, maybeOutMessage] = applyFocusMove(model, candidate, direction, cap);
|
|
333
|
-
return __foldkitBrandViewResult(([nextModel, [], maybeOutMessage]), "@foldkit/ui/calendar/index.js#onSome~5");
|
|
334
|
-
},
|
|
331
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#onNone~5")),
|
|
332
|
+
onSome: ([candidate, direction, cap]) => __foldkitBrandViewResult((applyFocusMove(model, candidate, direction, cap)), "@foldkit/ui/calendar/index.js#onSome~5"),
|
|
335
333
|
})), "@foldkit/ui/calendar/index.js#anonymous~32");
|
|
336
334
|
}
|
|
337
335
|
}), M.when('Months', () => __foldkitBrandViewResult((Option.match(resolveMonthsKey(key), {
|
|
338
|
-
onNone: () => __foldkitBrandViewResult((
|
|
336
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#onNone~6")),
|
|
339
337
|
onSome: shift => __foldkitBrandViewResult((applyMonthsFocusShift(model, shift)), "@foldkit/ui/calendar/index.js#onSome~6"),
|
|
340
338
|
})), "@foldkit/ui/calendar/index.js#anonymous~33")), M.when('Years', () => __foldkitBrandViewResult((Option.match(resolveYearsKey(key), {
|
|
341
|
-
onNone: () => __foldkitBrandViewResult((
|
|
339
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#onNone~7")),
|
|
342
340
|
onSome: shift => __foldkitBrandViewResult((applyYearsFocusShift(model, shift)), "@foldkit/ui/calendar/index.js#onSome~7"),
|
|
343
341
|
})), "@foldkit/ui/calendar/index.js#anonymous~34")), M.exhaustive)), "@foldkit/ui/calendar/index.js#PressedKeyOnGrid"),
|
|
344
342
|
ClickedPreviousMonthButton: () => {
|
|
@@ -349,58 +347,46 @@ export const update = (model, message) => __foldkitBrandViewResult((Message.matc
|
|
|
349
347
|
const next = Calendar.addMonths(Calendar.make(model.viewYear, model.viewMonth, 1), 1);
|
|
350
348
|
return __foldkitBrandViewResult((applyViewMonthChange(model, next.year, next.month, 1)), "@foldkit/ui/calendar/index.js#ClickedNextMonthButton");
|
|
351
349
|
},
|
|
352
|
-
ClickedHeading: () => __foldkitBrandViewResult((M.value(model.viewMode).pipe(withUpdateReturn, M.when('Days', () => __foldkitBrandViewResult((
|
|
353
|
-
evo(model, { viewMode: () => __foldkitBrandViewResult(('Months'), "@foldkit/ui/calendar/index.js#viewMode~2") }),
|
|
354
|
-
[FocusGrid({ id: model.id })],
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
Option.none(),
|
|
360
|
-
]), "@foldkit/ui/calendar/index.js#anonymous~36")), M.when('Years', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/calendar/index.js#anonymous~37")), M.exhaustive)), "@foldkit/ui/calendar/index.js#ClickedHeading"),
|
|
350
|
+
ClickedHeading: () => __foldkitBrandViewResult((M.value(model.viewMode).pipe(withUpdateReturn, M.when('Days', () => (__foldkitBrandViewResult(({
|
|
351
|
+
model: evo(model, { viewMode: () => __foldkitBrandViewResult(('Months'), "@foldkit/ui/calendar/index.js#viewMode~2") }),
|
|
352
|
+
commands: [FocusGrid({ id: model.id })],
|
|
353
|
+
}), "@foldkit/ui/calendar/index.js#anonymous~35"))), M.when('Months', () => (__foldkitBrandViewResult(({
|
|
354
|
+
model: evo(model, { viewMode: () => __foldkitBrandViewResult(('Years'), "@foldkit/ui/calendar/index.js#viewMode~3") }),
|
|
355
|
+
commands: [FocusGrid({ id: model.id })],
|
|
356
|
+
}), "@foldkit/ui/calendar/index.js#anonymous~36"))), M.when('Years', () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#anonymous~37"))), M.exhaustive)), "@foldkit/ui/calendar/index.js#ClickedHeading"),
|
|
361
357
|
SelectedMonth: ({ month }) => {
|
|
362
358
|
if (isMonthDisabled(model, model.viewYear, month)) {
|
|
363
|
-
return __foldkitBrandViewResult((
|
|
359
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#SelectedMonth");
|
|
364
360
|
}
|
|
365
361
|
else {
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
evo(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
362
|
+
const viewMonthChange = applyViewMonthChange(model, model.viewYear, month, jumpDirection(model, model.viewYear, month));
|
|
363
|
+
const monthSelection = {
|
|
364
|
+
model: evo(viewMonthChange.model, { viewMode: () => __foldkitBrandViewResult(('Days'), "@foldkit/ui/calendar/index.js#viewMode~4") }),
|
|
365
|
+
commands: [FocusGrid({ id: model.id })],
|
|
366
|
+
};
|
|
367
|
+
return __foldkitBrandViewResult((pipe(monthSelection, Update.withOutMessage(viewMonthChange.outMessage))), "@foldkit/ui/calendar/index.js#SelectedMonth");
|
|
372
368
|
}
|
|
373
369
|
},
|
|
374
370
|
SelectedYear: ({ year }) => {
|
|
375
371
|
if (isYearDisabled(model, year)) {
|
|
376
|
-
return __foldkitBrandViewResult((
|
|
372
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#SelectedYear");
|
|
377
373
|
}
|
|
378
374
|
else {
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
evo(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
375
|
+
const yearViewMonthChange = applyViewMonthChange(model, year, model.viewMonth, jumpDirection(model, year, model.viewMonth));
|
|
376
|
+
const yearSelection = {
|
|
377
|
+
model: evo(yearViewMonthChange.model, { viewMode: () => __foldkitBrandViewResult(('Months'), "@foldkit/ui/calendar/index.js#viewMode~5") }),
|
|
378
|
+
commands: [FocusGrid({ id: model.id })],
|
|
379
|
+
};
|
|
380
|
+
return __foldkitBrandViewResult((pipe(yearSelection, Update.withOutMessage(yearViewMonthChange.outMessage))), "@foldkit/ui/calendar/index.js#SelectedYear");
|
|
385
381
|
}
|
|
386
382
|
},
|
|
387
383
|
PagedYears: ({ direction }) => __foldkitBrandViewResult((applyYearsFocusShift(model, direction * YEARS_PAGE_SIZE)), "@foldkit/ui/calendar/index.js#PagedYears"),
|
|
388
|
-
FocusedGrid: () => __foldkitBrandViewResult((
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
evo(model, { isGridFocused: () => __foldkitBrandViewResult((false), "@foldkit/ui/calendar/index.js#isGridFocused~2") }),
|
|
395
|
-
[],
|
|
396
|
-
Option.none(),
|
|
397
|
-
]), "@foldkit/ui/calendar/index.js#BlurredGrid"),
|
|
398
|
-
RefreshedToday: ({ today }) => __foldkitBrandViewResult(([
|
|
399
|
-
evo(model, { today: () => __foldkitBrandViewResult((today), "@foldkit/ui/calendar/index.js#today") }),
|
|
400
|
-
[],
|
|
401
|
-
Option.none(),
|
|
402
|
-
]), "@foldkit/ui/calendar/index.js#RefreshedToday"),
|
|
403
|
-
CompletedFocusGrid: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/calendar/index.js#CompletedFocusGrid"),
|
|
384
|
+
FocusedGrid: () => (__foldkitBrandViewResult(({ model: evo(model, { isGridFocused: () => __foldkitBrandViewResult((true), "@foldkit/ui/calendar/index.js#isGridFocused") }) }), "@foldkit/ui/calendar/index.js#FocusedGrid")),
|
|
385
|
+
BlurredGrid: () => (__foldkitBrandViewResult(({ model: evo(model, { isGridFocused: () => __foldkitBrandViewResult((false), "@foldkit/ui/calendar/index.js#isGridFocused~2") }) }), "@foldkit/ui/calendar/index.js#BlurredGrid")),
|
|
386
|
+
RefreshedToday: ({ today }) => (__foldkitBrandViewResult(({
|
|
387
|
+
model: evo(model, { today: () => __foldkitBrandViewResult((today), "@foldkit/ui/calendar/index.js#today") }),
|
|
388
|
+
}), "@foldkit/ui/calendar/index.js#RefreshedToday")),
|
|
389
|
+
CompletedFocusGrid: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#CompletedFocusGrid")),
|
|
404
390
|
})), "@foldkit/ui/calendar/index.js#update");
|
|
405
391
|
// VIEW
|
|
406
392
|
const headingId = (modelId) => __foldkitBrandViewResult((`${modelId}-heading`), "@foldkit/ui/calendar/index.js#headingId");
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -75,10 +75,9 @@ export declare const descriptionId: (id: string) => string;
|
|
|
75
75
|
* )
|
|
76
76
|
*
|
|
77
77
|
* // In update:
|
|
78
|
-
* ToggledTerms: ({ isChecked }) =>
|
|
79
|
-
* evo(model, { acceptedTerms: () => isChecked }),
|
|
80
|
-
*
|
|
81
|
-
* ],
|
|
78
|
+
* ToggledTerms: ({ isChecked }) => ({
|
|
79
|
+
* model: evo(model, { acceptedTerms: () => isChecked }),
|
|
80
|
+
* }),
|
|
82
81
|
* ``` */
|
|
83
82
|
export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
84
83
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkbox/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE;;;;;;;;;;;;;;;;;;;sEAmBsE;AACtE,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;yEAiByE;AACzE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAA;IACzC,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACzD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UA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EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,yEAAyE;AACzE,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAuB,CAAA;AAE5D,+EAA+E;AAC/E,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;UAoBU;AACV,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,QAAQ,UAAU,CAAC,OAAO,CAAC,EAC3B,GAAG,WAAW,CAAC,OAAO,CAAC,KACtB,IAyEF,CAAA"}
|
package/dist/checkbox/index.js
CHANGED
|
@@ -21,10 +21,9 @@ export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-descriptio
|
|
|
21
21
|
* )
|
|
22
22
|
*
|
|
23
23
|
* // In update:
|
|
24
|
-
* ToggledTerms: ({ isChecked }) =>
|
|
25
|
-
* evo(model, { acceptedTerms: () => isChecked }),
|
|
26
|
-
*
|
|
27
|
-
* ],
|
|
24
|
+
* ToggledTerms: ({ isChecked }) => ({
|
|
25
|
+
* model: evo(model, { acceptedTerms: () => isChecked }),
|
|
26
|
+
* }),
|
|
28
27
|
* ``` */
|
|
29
28
|
export const view = (config, h) => {
|
|
30
29
|
const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, isIndeterminate = false, name, value: formValue = 'on', } = config;
|