@foldkit/ui 0.162.0 → 0.163.0-canary.4187988d5940
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.map +1 -1
- package/dist/anchor/anchor.js +10 -1
- package/dist/animation/index.d.ts +3 -0
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/schema.d.ts +13 -4
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +8 -4
- package/dist/animation/update.d.ts +15 -5
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +59 -27
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +27 -19
- package/dist/checkbox/index.d.ts +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/combobox/multi.d.ts +5 -0
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +2 -2
- package/dist/combobox/shared.d.ts +12 -2
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +21 -21
- package/dist/combobox/single.d.ts +5 -0
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +4 -4
- package/dist/datePicker/index.d.ts +13 -2
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +10 -10
- package/dist/dialog/index.d.ts +13 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +28 -14
- package/dist/disclosure/index.d.ts +2 -2
- package/dist/disclosure/index.js +1 -1
- package/dist/dragAndDrop/index.js +14 -14
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +7 -5
- package/dist/hoverIntent/hoverIntent.d.ts.map +1 -1
- package/dist/hoverIntent/hoverIntent.js +16 -16
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/internal/accessibleName.d.ts +9 -0
- package/dist/internal/accessibleName.d.ts.map +1 -0
- package/dist/internal/accessibleName.js +12 -0
- package/dist/internal/range.d.ts +7 -0
- package/dist/internal/range.d.ts.map +1 -0
- package/dist/internal/range.js +12 -0
- package/dist/listbox/multi.d.ts +5 -0
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/shared.d.ts +12 -2
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +26 -24
- package/dist/listbox/single.d.ts +5 -0
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/menu/index.d.ts +13 -2
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +29 -23
- package/dist/meter/index.d.ts +26 -0
- package/dist/meter/index.d.ts.map +1 -0
- package/dist/meter/index.js +67 -0
- package/dist/meter/public.d.ts +3 -0
- package/dist/meter/public.d.ts.map +1 -0
- package/dist/meter/public.js +1 -0
- package/dist/popover/index.d.ts +16 -2
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +18 -16
- package/dist/progress/index.d.ts +24 -0
- package/dist/progress/index.d.ts.map +1 -0
- package/dist/progress/index.js +85 -0
- package/dist/progress/public.d.ts +3 -0
- package/dist/progress/public.d.ts.map +1 -0
- package/dist/progress/public.js +1 -0
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +5 -3
- package/dist/slider/index.d.ts +61 -28
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +163 -87
- package/dist/slider/public.d.ts +1 -1
- package/dist/slider/public.d.ts.map +1 -1
- package/dist/slider/public.js +1 -1
- package/dist/switch/index.d.ts +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +5 -3
- package/dist/test/apps/disabledButton.d.ts +12 -4
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +3 -3
- package/dist/toast/index.d.ts +869 -45
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +77 -17
- package/dist/toast/public.d.ts +2 -2
- package/dist/toast/public.d.ts.map +1 -1
- package/dist/toast/public.js +1 -1
- package/dist/toast/schema.d.ts +160 -6
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +69 -2
- package/dist/toast/swipeTarget.d.ts +5 -0
- package/dist/toast/swipeTarget.d.ts.map +1 -0
- package/dist/toast/swipeTarget.js +18 -0
- package/dist/toast/test.d.ts +7 -1
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +37 -3
- package/dist/toast/update.d.ts +768 -7
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +283 -68
- package/dist/tooltip/tooltip.d.ts +7 -7
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +14 -12
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +8 -6
- package/package.json +9 -9
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Predicate } from 'effect';
|
|
3
|
+
import { accessibleNameAttributes } from '../internal/accessibleName.js';
|
|
4
|
+
import { clamp, fractionOfValue, normalizeRangeMax, percentageFromFraction, } from '../internal/range.js';
|
|
5
|
+
/** Returns the label element id, derived from the meter's base id. */
|
|
6
|
+
export const labelId = (id) => __foldkitBrandViewResult((`${id}-label`), "@foldkit/ui/meter/index.js#labelId");
|
|
7
|
+
/** Renders an accessible meter as a stateless controlled view. */
|
|
8
|
+
export const view = (config, h) => {
|
|
9
|
+
const min = config.min ?? 0;
|
|
10
|
+
const max = normalizeRangeMax(min, config.max ?? 100);
|
|
11
|
+
const clampedValue = clamp(config.value, min, max);
|
|
12
|
+
const fraction = fractionOfValue(clampedValue, min, max);
|
|
13
|
+
const accessibleName = accessibleNameAttributes({
|
|
14
|
+
ariaLabel: config.ariaLabel,
|
|
15
|
+
ariaLabelledBy: config.ariaLabelledBy,
|
|
16
|
+
fallbackLabelId: labelId(config.id),
|
|
17
|
+
}, h);
|
|
18
|
+
const resolveValueTextAttributes = () => {
|
|
19
|
+
if (config.valueText === undefined) {
|
|
20
|
+
return __foldkitBrandViewResult(([]), "@foldkit/ui/meter/index.js#resolveValueTextAttributes");
|
|
21
|
+
}
|
|
22
|
+
else if (Predicate.isString(config.valueText)) {
|
|
23
|
+
return __foldkitBrandViewResult(([h.AriaValuetext(config.valueText)]), "@foldkit/ui/meter/index.js#resolveValueTextAttributes");
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return __foldkitBrandViewResult(([h.AriaValuetext(config.valueText(clampedValue, max))]), "@foldkit/ui/meter/index.js#resolveValueTextAttributes");
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const thresholdAttributes = [
|
|
30
|
+
...(config.low !== undefined
|
|
31
|
+
? [h.DataAttribute('low', String(config.low))]
|
|
32
|
+
: []),
|
|
33
|
+
...(config.high !== undefined
|
|
34
|
+
? [h.DataAttribute('high', String(config.high))]
|
|
35
|
+
: []),
|
|
36
|
+
...(config.optimum !== undefined
|
|
37
|
+
? [h.DataAttribute('optimum', String(config.optimum))]
|
|
38
|
+
: []),
|
|
39
|
+
];
|
|
40
|
+
const meterAttributes = [
|
|
41
|
+
h.Id(config.id),
|
|
42
|
+
h.Role('meter'),
|
|
43
|
+
h.AriaValuemin(min),
|
|
44
|
+
h.AriaValuemax(max),
|
|
45
|
+
h.AriaValuenow(clampedValue),
|
|
46
|
+
...resolveValueTextAttributes(),
|
|
47
|
+
...accessibleName,
|
|
48
|
+
h.DataAttribute('value', String(clampedValue)),
|
|
49
|
+
h.DataAttribute('min', String(min)),
|
|
50
|
+
h.DataAttribute('max', String(max)),
|
|
51
|
+
...thresholdAttributes,
|
|
52
|
+
];
|
|
53
|
+
const fillAttributes = [
|
|
54
|
+
h.Style({ width: percentageFromFraction(fraction) }),
|
|
55
|
+
h.DataAttribute('value', String(clampedValue)),
|
|
56
|
+
h.DataAttribute('min', String(min)),
|
|
57
|
+
h.DataAttribute('max', String(max)),
|
|
58
|
+
];
|
|
59
|
+
const visibleLabelAttributes = [
|
|
60
|
+
h.Id(labelId(config.id)),
|
|
61
|
+
];
|
|
62
|
+
return __foldkitBrandViewResult((config.toView({
|
|
63
|
+
meter: meterAttributes,
|
|
64
|
+
label: visibleLabelAttributes,
|
|
65
|
+
fill: fillAttributes,
|
|
66
|
+
})), "@foldkit/ui/meter/index.js#view");
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/meter/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1C,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { view, labelId } from './index.js';
|
package/dist/popover/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const Model: Schema.Struct<{
|
|
|
15
15
|
readonly id: Schema.String;
|
|
16
16
|
readonly isShowing: Schema.Boolean;
|
|
17
17
|
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
18
|
+
readonly transitionGeneration: Schema.Number;
|
|
18
19
|
}>;
|
|
19
20
|
readonly maybeLastButtonPointerType: Schema.Option<Schema.String>;
|
|
20
21
|
}>;
|
|
@@ -42,8 +43,12 @@ export declare const Message: import("foldkit/message").MessageUnion<{
|
|
|
42
43
|
message: import("foldkit/message").MessageUnion<{
|
|
43
44
|
readonly Showed: {};
|
|
44
45
|
readonly Hid: {};
|
|
45
|
-
readonly CompletedWaitForPaint: {
|
|
46
|
-
|
|
46
|
+
readonly CompletedWaitForPaint: {
|
|
47
|
+
generation: Schema.Number;
|
|
48
|
+
};
|
|
49
|
+
readonly EndedAnimation: {
|
|
50
|
+
generation: Schema.Number;
|
|
51
|
+
};
|
|
47
52
|
}>;
|
|
48
53
|
};
|
|
49
54
|
}>;
|
|
@@ -119,12 +124,15 @@ export declare const FocusButton: Command.CommandDefinitionWithArgs<"FocusButton
|
|
|
119
124
|
/** Detects whether the popover button moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation submodel that leave is complete. */
|
|
120
125
|
export declare const DetectMovementOrAnimationEnd: Command.CommandDefinitionWithArgs<"DetectMovementOrAnimationEnd", {
|
|
121
126
|
id: Schema.String;
|
|
127
|
+
generation: Schema.Number;
|
|
122
128
|
}, Effect.Effect<{
|
|
123
129
|
readonly _tag: "GotAnimationMessage";
|
|
124
130
|
readonly message: {
|
|
125
131
|
readonly _tag: "CompletedWaitForPaint";
|
|
132
|
+
readonly generation: number;
|
|
126
133
|
} | {
|
|
127
134
|
readonly _tag: "EndedAnimation";
|
|
135
|
+
readonly generation: number;
|
|
128
136
|
} | {
|
|
129
137
|
readonly _tag: "Hid";
|
|
130
138
|
} | {
|
|
@@ -144,6 +152,7 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
144
152
|
readonly id: string;
|
|
145
153
|
readonly isShowing: boolean;
|
|
146
154
|
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
|
|
155
|
+
readonly transitionGeneration: number;
|
|
147
156
|
};
|
|
148
157
|
readonly maybeLastButtonPointerType: Option.Option<string>;
|
|
149
158
|
};
|
|
@@ -181,8 +190,10 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
181
190
|
readonly _tag: "GotAnimationMessage";
|
|
182
191
|
readonly message: {
|
|
183
192
|
readonly _tag: "CompletedWaitForPaint";
|
|
193
|
+
readonly generation: number;
|
|
184
194
|
} | {
|
|
185
195
|
readonly _tag: "EndedAnimation";
|
|
196
|
+
readonly generation: number;
|
|
186
197
|
} | {
|
|
187
198
|
readonly _tag: "Hid";
|
|
188
199
|
} | {
|
|
@@ -277,6 +288,7 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
277
288
|
readonly id: string;
|
|
278
289
|
readonly isShowing: boolean;
|
|
279
290
|
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
|
|
291
|
+
readonly transitionGeneration: number;
|
|
280
292
|
};
|
|
281
293
|
readonly maybeLastButtonPointerType: Option.Option<string>;
|
|
282
294
|
}, {
|
|
@@ -313,8 +325,10 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
313
325
|
readonly _tag: "GotAnimationMessage";
|
|
314
326
|
readonly message: {
|
|
315
327
|
readonly _tag: "CompletedWaitForPaint";
|
|
328
|
+
readonly generation: number;
|
|
316
329
|
} | {
|
|
317
330
|
readonly _tag: "EndedAnimation";
|
|
331
|
+
readonly generation: number;
|
|
318
332
|
} | {
|
|
319
333
|
readonly _tag: "Hid";
|
|
320
334
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,EAEP,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAE9E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAGtC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,EACL,YAAY,EAGb,MAAM,oBAAoB,CAAA;AAe3B,qGAAqG;AACrG,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,EAEP,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,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C;;wEAEwE;AACxE,eAAO,MAAM,KAAK,UAAW,KAAK,KAAG,YACI,CAAA;AAIzC;;;;;;;;;;;;;;;;4BAgB4B;AAC5B,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACrC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACvC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,6EAA6E;AAC7E,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAVP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;oBACJ,MAAM;mBACP,MAAM;gBACT,MAAM;qBACD,MAAM;GA0KxB,CAAA"}
|
package/dist/popover/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as Dom from 'foldkit/dom';
|
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
6
6
|
import { defineMessageUnion } from 'foldkit/message';
|
|
7
7
|
import * as Mount from 'foldkit/mount';
|
|
8
|
-
import {
|
|
8
|
+
import { modifyFields } from 'foldkit/struct';
|
|
9
9
|
import { defineView } from 'foldkit/submodel';
|
|
10
10
|
import * as Update from 'foldkit/update';
|
|
11
11
|
import { AnchorConfig, anchorSetup, portalToContainingRoot, } from '../anchor/index.js';
|
|
@@ -70,7 +70,7 @@ export const init = (config) => (__foldkitBrandViewResult(({
|
|
|
70
70
|
maybeLastButtonPointerType: Option.none(),
|
|
71
71
|
}), "@foldkit/ui/popover/index.js#init"));
|
|
72
72
|
// UPDATE
|
|
73
|
-
const closedModel = (model) => __foldkitBrandViewResult((
|
|
73
|
+
const closedModel = (model) => __foldkitBrandViewResult((modifyFields(model, {
|
|
74
74
|
isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/popover/index.js#isOpen"),
|
|
75
75
|
maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#maybeLastButtonPointerType"),
|
|
76
76
|
})), "@foldkit/ui/popover/index.js#closedModel");
|
|
@@ -122,38 +122,38 @@ export const FocusButton = Command.define('FocusButton', {
|
|
|
122
122
|
});
|
|
123
123
|
/** Detects whether the popover button moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation submodel that leave is complete. */
|
|
124
124
|
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', {
|
|
125
|
-
args: { id: Schema.String },
|
|
125
|
+
args: { id: Schema.String, generation: Schema.Number },
|
|
126
126
|
messages: [Message.GotAnimationMessage],
|
|
127
|
-
execute: ({ id }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(buttonSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
128
|
-
message: Animation.Message.EndedAnimation(),
|
|
127
|
+
execute: ({ id, generation }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(buttonSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
128
|
+
message: Animation.Message.EndedAnimation({ generation }),
|
|
129
129
|
}))), Dom.waitForAnimationSettled(panelSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
130
|
-
message: Animation.Message.EndedAnimation(),
|
|
130
|
+
message: Animation.Message.EndedAnimation({ generation }),
|
|
131
131
|
}))))), "@foldkit/ui/popover/index.js#execute~5"),
|
|
132
132
|
});
|
|
133
133
|
const foldAnimationOutMessage = Animation.OutMessage.match({
|
|
134
|
-
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
134
|
+
StartedLeaveAnimating: ({ generation }) => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
135
135
|
model,
|
|
136
|
-
commands: [DetectMovementOrAnimationEnd({ id: model.id })],
|
|
136
|
+
commands: [DetectMovementOrAnimationEnd({ id: model.id, generation })],
|
|
137
137
|
}), "@foldkit/ui/popover/index.js#anonymous"))), "@foldkit/ui/popover/index.js#StartedLeaveAnimating"),
|
|
138
138
|
TransitionedOut: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#anonymous~2"))), "@foldkit/ui/popover/index.js#TransitionedOut"),
|
|
139
139
|
});
|
|
140
140
|
const foldAnimation = Update.foldChild({
|
|
141
141
|
update: animationUpdate,
|
|
142
142
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/popover/index.js#read"),
|
|
143
|
-
write: (model, nextAnimation) => __foldkitBrandViewResult((
|
|
143
|
+
write: (model, nextAnimation) => __foldkitBrandViewResult((modifyFields(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/popover/index.js#animation") })), "@foldkit/ui/popover/index.js#write"),
|
|
144
144
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/popover/index.js#toParentMessage"),
|
|
145
145
|
foldOutMessage: foldAnimationOutMessage,
|
|
146
146
|
});
|
|
147
147
|
const foldAnimationShow = Update.foldChildStep({
|
|
148
148
|
update: animationShow,
|
|
149
149
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/popover/index.js#read~2"),
|
|
150
|
-
write: (model, nextAnimation) => __foldkitBrandViewResult((
|
|
150
|
+
write: (model, nextAnimation) => __foldkitBrandViewResult((modifyFields(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/popover/index.js#animation~2") })), "@foldkit/ui/popover/index.js#write~2"),
|
|
151
151
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/popover/index.js#toParentMessage~2"),
|
|
152
152
|
});
|
|
153
153
|
const foldAnimationHide = Update.foldChildStep({
|
|
154
154
|
update: animationHide,
|
|
155
155
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/popover/index.js#read~3"),
|
|
156
|
-
write: (model, nextAnimation) => __foldkitBrandViewResult((
|
|
156
|
+
write: (model, nextAnimation) => __foldkitBrandViewResult((modifyFields(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/popover/index.js#animation~3") })), "@foldkit/ui/popover/index.js#write~3"),
|
|
157
157
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/popover/index.js#toParentMessage~3"),
|
|
158
158
|
});
|
|
159
159
|
/** Processes a Popover Message and returns the next Model, optional Commands,
|
|
@@ -179,13 +179,13 @@ export const update = (model, message) => {
|
|
|
179
179
|
stepModel => (__foldkitBrandViewResult(({ model: stepModel, commands: openCommands }), "@foldkit/ui/popover/index.js#anonymous~3")),
|
|
180
180
|
foldAnimationShow,
|
|
181
181
|
stepModel => (__foldkitBrandViewResult(({
|
|
182
|
-
model:
|
|
182
|
+
model: modifyFields(stepModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/popover/index.js#isOpen~2") }),
|
|
183
183
|
}), "@foldkit/ui/popover/index.js#anonymous~4")),
|
|
184
184
|
]);
|
|
185
185
|
return __foldkitBrandViewResult((pipe(popoverOpen, Update.withOutMessage(OutMessage.Opened()))), "@foldkit/ui/popover/index.js#openPopover");
|
|
186
186
|
}
|
|
187
187
|
return __foldkitBrandViewResult(({
|
|
188
|
-
model:
|
|
188
|
+
model: modifyFields(baseModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/popover/index.js#isOpen~3") }),
|
|
189
189
|
commands: openCommands,
|
|
190
190
|
outMessage: OutMessage.Opened(),
|
|
191
191
|
}), "@foldkit/ui/popover/index.js#openPopover");
|
|
@@ -219,7 +219,7 @@ export const update = (model, message) => {
|
|
|
219
219
|
return __foldkitBrandViewResult((closePopover(model, closeWithoutFocusCommands)), "@foldkit/ui/popover/index.js#BlurredPanel");
|
|
220
220
|
},
|
|
221
221
|
PressedPointerOnButton: ({ pointerType, button }) => {
|
|
222
|
-
const withPointerType =
|
|
222
|
+
const withPointerType = modifyFields(model, {
|
|
223
223
|
maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/popover/index.js#maybeLastButtonPointerType~2"),
|
|
224
224
|
});
|
|
225
225
|
if (pointerType !== 'mouse' || button !== LEFT_MOUSE_BUTTON) {
|
|
@@ -229,7 +229,7 @@ export const update = (model, message) => {
|
|
|
229
229
|
const popoverClose = Update.combine(withPointerType, [
|
|
230
230
|
stepModel => __foldkitBrandViewResult((closePopoverModel(stepModel, closeWithFocusCommands)), "@foldkit/ui/popover/index.js#anonymous~6"),
|
|
231
231
|
stepModel => (__foldkitBrandViewResult(({
|
|
232
|
-
model:
|
|
232
|
+
model: modifyFields(stepModel, {
|
|
233
233
|
maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/popover/index.js#maybeLastButtonPointerType~3"),
|
|
234
234
|
}),
|
|
235
235
|
}), "@foldkit/ui/popover/index.js#anonymous~7")),
|
|
@@ -246,7 +246,9 @@ export const update = (model, message) => {
|
|
|
246
246
|
CompletedInertOthers: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#CompletedInertOthers")),
|
|
247
247
|
CompletedRestoreInert: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#CompletedRestoreInert")),
|
|
248
248
|
IgnoredMouseClick: () => (__foldkitBrandViewResult(({
|
|
249
|
-
model:
|
|
249
|
+
model: modifyFields(model, {
|
|
250
|
+
maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#maybeLastButtonPointerType~4"),
|
|
251
|
+
}),
|
|
250
252
|
}), "@foldkit/ui/popover/index.js#IgnoredMouseClick")),
|
|
251
253
|
SuppressedSpaceScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#SuppressedSpaceScroll")),
|
|
252
254
|
CompletedAnchorPopover: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#CompletedAnchorPopover")),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Attribute, Html, HtmlBuilder } from 'foldkit/html';
|
|
2
|
+
/** Attribute groups provided to a Progress view. */
|
|
3
|
+
export type ProgressAttributes<Message> = Readonly<{
|
|
4
|
+
progress: ReadonlyArray<Attribute<Message>>;
|
|
5
|
+
label: ReadonlyArray<Attribute<Message>>;
|
|
6
|
+
track: ReadonlyArray<Attribute<Message>>;
|
|
7
|
+
indicator: ReadonlyArray<Attribute<Message>>;
|
|
8
|
+
}>;
|
|
9
|
+
/** Configuration for rendering Progress with {@link view}. */
|
|
10
|
+
export type ViewConfig<Message> = Readonly<{
|
|
11
|
+
id: string;
|
|
12
|
+
value?: number;
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
valueText?: string | ((value: number, max: number) => string);
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
ariaLabelledBy?: string;
|
|
18
|
+
toView: (attributes: ProgressAttributes<Message>) => Html;
|
|
19
|
+
}>;
|
|
20
|
+
/** Returns the label element id, derived from the progress base id. */
|
|
21
|
+
export declare const labelId: (id: string) => string;
|
|
22
|
+
/** Renders an accessible progress indicator as a stateless controlled view. */
|
|
23
|
+
export declare const view: <Message>(config: ViewConfig<Message>, h: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OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IAuFF,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Predicate } from 'effect';
|
|
3
|
+
import { accessibleNameAttributes } from '../internal/accessibleName.js';
|
|
4
|
+
import { clamp, fractionOfValue, normalizeRangeMax, percentageFromFraction, } from '../internal/range.js';
|
|
5
|
+
/** Returns the label element id, derived from the progress base id. */
|
|
6
|
+
export const labelId = (id) => __foldkitBrandViewResult((`${id}-label`), "@foldkit/ui/progress/index.js#labelId");
|
|
7
|
+
/** Renders an accessible progress indicator as a stateless controlled view. */
|
|
8
|
+
export const view = (config, h) => {
|
|
9
|
+
const min = config.min ?? 0;
|
|
10
|
+
const max = normalizeRangeMax(min, config.max ?? 100);
|
|
11
|
+
const accessibleName = accessibleNameAttributes({
|
|
12
|
+
ariaLabel: config.ariaLabel,
|
|
13
|
+
ariaLabelledBy: config.ariaLabelledBy,
|
|
14
|
+
fallbackLabelId: labelId(config.id),
|
|
15
|
+
}, h);
|
|
16
|
+
const visibleLabelAttributes = [
|
|
17
|
+
h.Id(labelId(config.id)),
|
|
18
|
+
];
|
|
19
|
+
const resolveDeterminateValueTextAttributes = (clampedValue) => {
|
|
20
|
+
if (config.valueText === undefined) {
|
|
21
|
+
return __foldkitBrandViewResult(([]), "@foldkit/ui/progress/index.js#resolveDeterminateValueTextAttributes");
|
|
22
|
+
}
|
|
23
|
+
else if (Predicate.isString(config.valueText)) {
|
|
24
|
+
return __foldkitBrandViewResult(([h.AriaValuetext(config.valueText)]), "@foldkit/ui/progress/index.js#resolveDeterminateValueTextAttributes");
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return __foldkitBrandViewResult(([h.AriaValuetext(config.valueText(clampedValue, max))]), "@foldkit/ui/progress/index.js#resolveDeterminateValueTextAttributes");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (config.value === undefined) {
|
|
31
|
+
const stateAttributes = [
|
|
32
|
+
h.DataAttribute('state', 'indeterminate'),
|
|
33
|
+
h.DataAttribute('indeterminate', ''),
|
|
34
|
+
];
|
|
35
|
+
const valueTextAttributes = Predicate.isString(config.valueText)
|
|
36
|
+
? [h.AriaValuetext(config.valueText)]
|
|
37
|
+
: [];
|
|
38
|
+
const progressAttributes = [
|
|
39
|
+
h.Id(config.id),
|
|
40
|
+
h.Role('progressbar'),
|
|
41
|
+
...valueTextAttributes,
|
|
42
|
+
...accessibleName,
|
|
43
|
+
...stateAttributes,
|
|
44
|
+
];
|
|
45
|
+
return __foldkitBrandViewResult((config.toView({
|
|
46
|
+
progress: progressAttributes,
|
|
47
|
+
label: visibleLabelAttributes,
|
|
48
|
+
track: stateAttributes,
|
|
49
|
+
indicator: stateAttributes,
|
|
50
|
+
})), "@foldkit/ui/progress/index.js#view");
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const clampedValue = clamp(config.value, min, max);
|
|
54
|
+
const fraction = fractionOfValue(clampedValue, min, max);
|
|
55
|
+
const state = clampedValue >= max ? 'complete' : 'loading';
|
|
56
|
+
const stateAttributes = [h.DataAttribute('state', state)];
|
|
57
|
+
const valueAttributes = [
|
|
58
|
+
h.DataAttribute('value', String(clampedValue)),
|
|
59
|
+
h.DataAttribute('min', String(min)),
|
|
60
|
+
h.DataAttribute('max', String(max)),
|
|
61
|
+
];
|
|
62
|
+
const progressAttributes = [
|
|
63
|
+
h.Id(config.id),
|
|
64
|
+
h.Role('progressbar'),
|
|
65
|
+
h.AriaValuemin(min),
|
|
66
|
+
h.AriaValuemax(max),
|
|
67
|
+
h.AriaValuenow(clampedValue),
|
|
68
|
+
...resolveDeterminateValueTextAttributes(clampedValue),
|
|
69
|
+
...accessibleName,
|
|
70
|
+
...valueAttributes,
|
|
71
|
+
...stateAttributes,
|
|
72
|
+
];
|
|
73
|
+
const indicatorAttributes = [
|
|
74
|
+
h.Style({ width: percentageFromFraction(fraction) }),
|
|
75
|
+
...valueAttributes,
|
|
76
|
+
...stateAttributes,
|
|
77
|
+
];
|
|
78
|
+
return __foldkitBrandViewResult((config.toView({
|
|
79
|
+
progress: progressAttributes,
|
|
80
|
+
label: visibleLabelAttributes,
|
|
81
|
+
track: stateAttributes,
|
|
82
|
+
indicator: indicatorAttributes,
|
|
83
|
+
})), "@foldkit/ui/progress/index.js#view");
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/progress/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1C,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { view, labelId } from './index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/radioGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EAEN,MAAM,EAGP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAG9E,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AAOxE,+FAA+F;AAC/F,eAAO,MAAM,WAAW,sDAA8C,CAAA;AACtE,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;+DAI+D;AAC/D,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,yDA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AAE,aAAa,CAAC,KAAK,CAAC,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IAC3D,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAqOF;;;sDAGsD;AACtD,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC3D,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,MAAM,EAAE,CACN,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KACb,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;CACpE,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;sDAiBsD;AACtD,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,KAAK,CAmBpE,CAAA"}
|
package/dist/radioGroup/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as Command from 'foldkit/command';
|
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
6
6
|
import { defineMessageUnion } from 'foldkit/message';
|
|
7
|
-
import {
|
|
7
|
+
import { modifyFields } from 'foldkit/struct';
|
|
8
8
|
import { defineView } from 'foldkit/submodel';
|
|
9
9
|
import { idSelector } from '../internal/selectors.js';
|
|
10
10
|
import { keyToIndex } from '../keyboard.js';
|
|
@@ -61,12 +61,14 @@ export const FocusOption = Command.define('FocusOption', {
|
|
|
61
61
|
* it back in as `selectedValue`. */
|
|
62
62
|
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
63
63
|
SelectedOption: ({ index, value }) => (__foldkitBrandViewResult(({
|
|
64
|
-
model:
|
|
64
|
+
model: modifyFields(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/radioGroup/index.js#maybeFocusedIndex") }),
|
|
65
65
|
commands: [FocusOption({ id: model.id, index })],
|
|
66
66
|
outMessage: OutMessage.Selected({ value, index }),
|
|
67
67
|
}), "@foldkit/ui/radioGroup/index.js#SelectedOption")),
|
|
68
68
|
FocusedOption: ({ index }) => (__foldkitBrandViewResult(({
|
|
69
|
-
model:
|
|
69
|
+
model: modifyFields(model, {
|
|
70
|
+
maybeFocusedIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/radioGroup/index.js#maybeFocusedIndex~2"),
|
|
71
|
+
}),
|
|
70
72
|
commands: [FocusOption({ id: model.id, index })],
|
|
71
73
|
}), "@foldkit/ui/radioGroup/index.js#FocusedOption")),
|
|
72
74
|
CompletedFocusOption: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/radioGroup/index.js#CompletedFocusOption")),
|