@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/listbox/single.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
1
2
|
import { Option, Schema as S } from 'effect';
|
|
2
3
|
import { defineView } from 'foldkit/submodel';
|
|
3
4
|
import { BaseModel, Closed, Opened, SelectedItem, Selected as SharedSelected, baseInit, makeUpdate, makeView, } from './shared.js';
|
|
@@ -7,24 +8,24 @@ export const Model = S.Struct({
|
|
|
7
8
|
...BaseModel.fields,
|
|
8
9
|
});
|
|
9
10
|
/** Creates an initial single-select listbox model from a config. Defaults to closed with no active item. */
|
|
10
|
-
export const init = (config) => baseInit(config);
|
|
11
|
+
export const init = (config) => __foldkitBrandViewResult((baseInit(config)), "@foldkit/ui/listbox/single.js#init");
|
|
11
12
|
// UPDATE
|
|
12
13
|
/** Processes a listbox message and returns the next model, commands, and optional OutMessage. Closes the listbox on selection (single-select behavior); emits a `Selected({ value })` OutMessage the parent stores as the selection. */
|
|
13
|
-
export const update = makeUpdate((model, item, context) => context.closeWithFocus(model, Option.some(SharedSelected({ value: item }))));
|
|
14
|
+
export const update = makeUpdate((model, item, context) => __foldkitBrandViewResult((context.closeWithFocus(model, Option.some(SharedSelected({ value: item })))), "@foldkit/ui/listbox/single.js#anonymous"));
|
|
14
15
|
/** Programmatically opens the listbox, updating the model and returning
|
|
15
16
|
* focus and modal commands. Use this in domain-event handlers to open the listbox. */
|
|
16
|
-
export const open = (model) => update(model, Opened({ maybeActiveItemIndex: Option.none() }));
|
|
17
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/listbox/single.js#open");
|
|
17
18
|
/** Programmatically closes the listbox, updating the model and returning
|
|
18
19
|
* focus and modal commands. Use this in domain-event handlers to close the listbox. */
|
|
19
|
-
export const close = (model) => update(model, Closed());
|
|
20
|
+
export const close = (model) => __foldkitBrandViewResult((update(model, Closed())), "@foldkit/ui/listbox/single.js#close");
|
|
20
21
|
/** Programmatically selects an item in the single-select listbox, closing the listbox and emitting a `Selected({ value })` OutMessage. */
|
|
21
|
-
export const selectItem = (model, item) => update(model, SelectedItem({ item }));
|
|
22
|
+
export const selectItem = (model, item) => __foldkitBrandViewResult((update(model, SelectedItem({ item }))), "@foldkit/ui/listbox/single.js#selectItem");
|
|
22
23
|
const internalView = makeView({ ariaMultiSelectable: false });
|
|
23
24
|
const arrayBasedView = internalView();
|
|
24
|
-
const singleViewImpl = defineView((model, { maybeSelectedValue, ...baseInputs }) => arrayBasedView(model, {
|
|
25
|
+
const singleViewImpl = defineView((model, { maybeSelectedValue, ...baseInputs }) => __foldkitBrandViewResult((arrayBasedView(model, {
|
|
25
26
|
...baseInputs,
|
|
26
27
|
selectedValues: Option.toArray(maybeSelectedValue),
|
|
27
|
-
}));
|
|
28
|
+
})), "@foldkit/ui/listbox/single.js#anonymous~2"));
|
|
28
29
|
/** Pairs the single-select listbox's `view` and `update` (and programmatic
|
|
29
30
|
* helpers) behind a single Item-typed entry point. Declaring the listbox
|
|
30
31
|
* once at module scope ensures the view's `Item` type and the update's
|
|
@@ -51,11 +52,11 @@ export const create = () => {
|
|
|
51
52
|
const view =
|
|
52
53
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
53
54
|
singleViewImpl;
|
|
54
|
-
return {
|
|
55
|
+
return __foldkitBrandViewResult(({
|
|
55
56
|
view,
|
|
56
57
|
update: typedUpdate,
|
|
57
|
-
selectItem: (model, item) => typedUpdate(model, SelectedItem({ item })),
|
|
58
|
-
open: model => typedUpdate(model, Opened({ maybeActiveItemIndex: Option.none() })),
|
|
59
|
-
close: model => typedUpdate(model, Closed()),
|
|
60
|
-
};
|
|
58
|
+
selectItem: (model, item) => __foldkitBrandViewResult((typedUpdate(model, SelectedItem({ item }))), "@foldkit/ui/listbox/single.js#selectItem~2"),
|
|
59
|
+
open: model => __foldkitBrandViewResult((typedUpdate(model, Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/listbox/single.js#open~2"),
|
|
60
|
+
close: model => __foldkitBrandViewResult((typedUpdate(model, Closed())), "@foldkit/ui/listbox/single.js#close~2"),
|
|
61
|
+
}), "@foldkit/ui/listbox/single.js#create");
|
|
61
62
|
};
|