@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/checkbox/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
1
2
|
import { Match as M, Option } from 'effect';
|
|
2
3
|
import { html } from 'foldkit/html';
|
|
3
|
-
const labelId = (id) => `${id}-label
|
|
4
|
-
const descriptionId = (id) => `${id}-description
|
|
4
|
+
const labelId = (id) => __foldkitBrandViewResult((`${id}-label`), "@foldkit/ui/checkbox/index.js#labelId");
|
|
5
|
+
const descriptionId = (id) => __foldkitBrandViewResult((`${id}-description`), "@foldkit/ui/checkbox/index.js#descriptionId");
|
|
5
6
|
/** Renders an accessible checkbox as a stateless controlled component. The
|
|
6
7
|
* parent owns the checked state (`isChecked`) and receives the new state via
|
|
7
8
|
* `onToggle` when the user toggles it.
|
|
@@ -25,16 +26,16 @@ export const view = (config) => {
|
|
|
25
26
|
const h = html();
|
|
26
27
|
const { id, isChecked, onToggle, toView, isDisabled = false, isIndeterminate = false, name, value: formValue = 'on', } = config;
|
|
27
28
|
const nextChecked = !isChecked;
|
|
28
|
-
const handleKeyUp = (key) => M.value(key).pipe(M.when(' ', () => Option.some(onToggle(nextChecked))), M.orElse(() => Option.none()));
|
|
29
|
+
const handleKeyUp = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when(' ', () => __foldkitBrandViewResult((Option.some(onToggle(nextChecked))), "@foldkit/ui/checkbox/index.js#anonymous")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/checkbox/index.js#anonymous~2")))), "@foldkit/ui/checkbox/index.js#handleKeyUp");
|
|
29
30
|
const resolveStateAttributes = () => {
|
|
30
31
|
if (isIndeterminate) {
|
|
31
|
-
return [h.DataAttribute('indeterminate', '')];
|
|
32
|
+
return __foldkitBrandViewResult(([h.DataAttribute('indeterminate', '')]), "@foldkit/ui/checkbox/index.js#resolveStateAttributes");
|
|
32
33
|
}
|
|
33
34
|
else if (isChecked) {
|
|
34
|
-
return [h.DataAttribute('checked', '')];
|
|
35
|
+
return __foldkitBrandViewResult(([h.DataAttribute('checked', '')]), "@foldkit/ui/checkbox/index.js#resolveStateAttributes");
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
return [];
|
|
38
|
+
return __foldkitBrandViewResult(([]), "@foldkit/ui/checkbox/index.js#resolveStateAttributes");
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
const disabledAttributes = isDisabled
|
|
@@ -63,10 +64,10 @@ export const view = (config) => {
|
|
|
63
64
|
const hiddenInputAttributes = name
|
|
64
65
|
? [h.Type('hidden'), h.Name(name), h.Value(isChecked ? formValue : '')]
|
|
65
66
|
: [];
|
|
66
|
-
return toView({
|
|
67
|
+
return __foldkitBrandViewResult((toView({
|
|
67
68
|
checkbox: checkboxAttributes,
|
|
68
69
|
label: labelAttributes,
|
|
69
70
|
description: descriptionAttributes,
|
|
70
71
|
hiddenInput: hiddenInputAttributes,
|
|
71
|
-
});
|
|
72
|
+
})), "@foldkit/ui/checkbox/index.js#view");
|
|
72
73
|
};
|
package/dist/combobox/multi.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 { evo } from 'foldkit/struct';
|
|
3
4
|
import { BaseModel, ClearedSelection, Closed, Opened, SelectedItem, Selected as SharedSelected, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared.js';
|
|
@@ -7,42 +8,42 @@ export const Model = S.Struct({
|
|
|
7
8
|
...BaseModel.fields,
|
|
8
9
|
});
|
|
9
10
|
/** Creates an initial multi-select combobox model from a config. Defaults to closed with no active item and an empty input. */
|
|
10
|
-
export const init = (config) => baseInit(config);
|
|
11
|
+
export const init = (config) => __foldkitBrandViewResult((baseInit(config)), "@foldkit/ui/combobox/multi.js#init");
|
|
11
12
|
// UPDATE
|
|
12
13
|
/** Processes a combobox message and returns the next model, commands, and optional OutMessage. Stays open on selection (multi-select behavior); emits a `Selected({ value })` OutMessage the parent folds by toggling the value's membership, and `ClearedSelection` when a nullable combobox closes with an empty input. The multi-select input always rests empty on close, so it ignores the message's `restingInputValue`; multi consumers pass `''`. */
|
|
13
14
|
export const update = makeUpdate({
|
|
14
15
|
handleClose: model => {
|
|
15
16
|
if (model.nullable && model.inputValue === '') {
|
|
16
|
-
return [
|
|
17
|
-
evo(closedBaseModel(model), { inputValue: () => '' }),
|
|
17
|
+
return __foldkitBrandViewResult(([
|
|
18
|
+
evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/multi.js#inputValue") }),
|
|
18
19
|
Option.some(ClearedSelection()),
|
|
19
|
-
];
|
|
20
|
+
]), "@foldkit/ui/combobox/multi.js#handleClose");
|
|
20
21
|
}
|
|
21
|
-
return [
|
|
22
|
-
evo(closedBaseModel(model), { inputValue: () => '' }),
|
|
22
|
+
return __foldkitBrandViewResult(([
|
|
23
|
+
evo(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/multi.js#inputValue~2") }),
|
|
23
24
|
Option.none(),
|
|
24
|
-
];
|
|
25
|
+
]), "@foldkit/ui/combobox/multi.js#handleClose");
|
|
25
26
|
},
|
|
26
|
-
handleSelectedItem: (model, item) => [
|
|
27
|
+
handleSelectedItem: (model, item) => __foldkitBrandViewResult(([
|
|
27
28
|
model,
|
|
28
29
|
[],
|
|
29
30
|
Option.some(SharedSelected({ value: item })),
|
|
30
|
-
],
|
|
31
|
-
handleImmediateActivation: (model, item) => [
|
|
31
|
+
]), "@foldkit/ui/combobox/multi.js#handleSelectedItem"),
|
|
32
|
+
handleImmediateActivation: (model, item) => __foldkitBrandViewResult(([
|
|
32
33
|
model,
|
|
33
34
|
Option.some(SharedSelected({ value: item })),
|
|
34
|
-
],
|
|
35
|
+
]), "@foldkit/ui/combobox/multi.js#handleImmediateActivation"),
|
|
35
36
|
});
|
|
36
37
|
/** Programmatically opens the combobox, updating the model and returning
|
|
37
38
|
* focus and modal commands. Use this in domain-event handlers to open the combobox. */
|
|
38
|
-
export const open = (model) => update(model, Opened({ maybeActiveItemIndex: Option.none() }));
|
|
39
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/combobox/multi.js#open");
|
|
39
40
|
/** Programmatically closes the combobox, updating the model and returning
|
|
40
41
|
* focus and modal commands. The multi-select input always rests empty on
|
|
41
42
|
* close. Use this in domain-event handlers to close the combobox. */
|
|
42
|
-
export const close = (model) => update(model, Closed({ restingInputValue: '' }));
|
|
43
|
+
export const close = (model) => __foldkitBrandViewResult((update(model, Closed({ restingInputValue: '' }))), "@foldkit/ui/combobox/multi.js#close");
|
|
43
44
|
/** Programmatically activates an item in the multi-select combobox. Emits
|
|
44
45
|
* `Selected({ value })`; the parent toggles the value's membership. */
|
|
45
|
-
export const selectItem = (model, item) => update(model, SelectedItem({ item, displayText: item, wasSelected: false }));
|
|
46
|
+
export const selectItem = (model, item) => __foldkitBrandViewResult((update(model, SelectedItem({ item, displayText: item, wasSelected: false }))), "@foldkit/ui/combobox/multi.js#selectItem");
|
|
46
47
|
const internalView = makeView({ ariaMultiSelectable: true });
|
|
47
48
|
/** Pairs the multi-select combobox's `view` and `update` (and programmatic
|
|
48
49
|
* helpers) behind a single Item-typed entry point. `selectItem` emits
|
|
@@ -50,11 +51,11 @@ const internalView = makeView({ ariaMultiSelectable: true });
|
|
|
50
51
|
export const create = () => {
|
|
51
52
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
52
53
|
const typedUpdate = update;
|
|
53
|
-
return {
|
|
54
|
+
return __foldkitBrandViewResult(({
|
|
54
55
|
view: internalView(),
|
|
55
56
|
update: typedUpdate,
|
|
56
|
-
selectItem: (model, item) => typedUpdate(model, SelectedItem({ item, displayText: item, wasSelected: false })),
|
|
57
|
-
open: model => typedUpdate(model, Opened({ maybeActiveItemIndex: Option.none() })),
|
|
58
|
-
close: model => typedUpdate(model, Closed({ restingInputValue: '' })),
|
|
59
|
-
};
|
|
57
|
+
selectItem: (model, item) => __foldkitBrandViewResult((typedUpdate(model, SelectedItem({ item, displayText: item, wasSelected: false }))), "@foldkit/ui/combobox/multi.js#selectItem~2"),
|
|
58
|
+
open: model => __foldkitBrandViewResult((typedUpdate(model, Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/combobox/multi.js#open~2"),
|
|
59
|
+
close: model => __foldkitBrandViewResult((typedUpdate(model, Closed({ restingInputValue: '' }))), "@foldkit/ui/combobox/multi.js#close~2"),
|
|
60
|
+
}), "@foldkit/ui/combobox/multi.js#create");
|
|
60
61
|
};
|