foldkit 0.33.6 → 0.34.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/README.md +19 -19
- package/dist/devtools/overlay.d.ts.map +1 -1
- package/dist/devtools/overlay.js +76 -33
- package/dist/html/index.d.ts +431 -5
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +1 -0
- package/dist/html/public.d.ts +1 -2
- package/dist/html/public.d.ts.map +1 -1
- package/dist/html/public.js +1 -2
- package/dist/task/dom.d.ts +6 -6
- package/dist/task/dom.js +6 -6
- package/dist/task/inert.d.ts +2 -2
- package/dist/task/inert.js +2 -2
- package/dist/task/scrollLock.d.ts +2 -2
- package/dist/task/scrollLock.js +2 -2
- package/dist/ui/checkbox/index.d.ts +5 -9
- package/dist/ui/checkbox/index.d.ts.map +1 -1
- package/dist/ui/checkbox/index.js +7 -10
- package/dist/ui/checkbox/public.d.ts +1 -1
- package/dist/ui/checkbox/public.d.ts.map +1 -1
- package/dist/ui/combobox/multi.d.ts +31 -10
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/multi.js +1 -1
- package/dist/ui/combobox/public.d.ts +1 -1
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/shared.d.ts +53 -14
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +72 -28
- package/dist/ui/combobox/single.d.ts +31 -10
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/combobox/single.js +1 -1
- package/dist/ui/dialog/index.d.ts +14 -8
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +21 -12
- package/dist/ui/dialog/public.d.ts +1 -1
- package/dist/ui/dialog/public.d.ts.map +1 -1
- package/dist/ui/dialog/public.js +1 -1
- package/dist/ui/disclosure/index.d.ts +11 -8
- package/dist/ui/disclosure/index.d.ts.map +1 -1
- package/dist/ui/disclosure/index.js +20 -18
- package/dist/ui/disclosure/public.d.ts +1 -1
- package/dist/ui/disclosure/public.d.ts.map +1 -1
- package/dist/ui/listbox/multi.d.ts +34 -9
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/multi.js +1 -1
- package/dist/ui/listbox/public.d.ts +1 -1
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/shared.d.ts +57 -13
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +77 -27
- package/dist/ui/listbox/single.d.ts +34 -9
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/listbox/single.js +1 -1
- package/dist/ui/menu/index.d.ts +39 -11
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +81 -32
- package/dist/ui/menu/public.d.ts +1 -1
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/popover/index.d.ts +28 -12
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +50 -24
- package/dist/ui/popover/public.d.ts +1 -1
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/radioGroup/index.d.ts +8 -7
- package/dist/ui/radioGroup/index.d.ts.map +1 -1
- package/dist/ui/radioGroup/index.js +12 -9
- package/dist/ui/radioGroup/public.d.ts +1 -1
- package/dist/ui/radioGroup/public.d.ts.map +1 -1
- package/dist/ui/switch/index.d.ts +5 -9
- package/dist/ui/switch/index.d.ts.map +1 -1
- package/dist/ui/switch/index.js +7 -10
- package/dist/ui/switch/public.d.ts +1 -1
- package/dist/ui/switch/public.d.ts.map +1 -1
- package/dist/ui/tabs/index.d.ts +9 -7
- package/dist/ui/tabs/index.d.ts.map +1 -1
- package/dist/ui/tabs/index.js +27 -17
- package/dist/ui/tabs/public.d.ts +1 -1
- package/dist/ui/tabs/public.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Schema as S } from 'effect';
|
|
2
2
|
import type { Command } from '../../command';
|
|
3
|
-
import type
|
|
4
|
-
import type { Html } from '../../html';
|
|
3
|
+
import { type Attribute, type Html } from '../../html';
|
|
5
4
|
/** Controls the radio group layout direction and which arrow keys navigate between options. */
|
|
6
5
|
export declare const Orientation: S.Literal<["Horizontal", "Vertical"]>;
|
|
7
6
|
export type Orientation = typeof Orientation.Type;
|
|
@@ -17,15 +16,15 @@ export declare const SelectedOption: import("../../schema").CallableTaggedStruct
|
|
|
17
16
|
value: typeof S.String;
|
|
18
17
|
index: typeof S.Number;
|
|
19
18
|
}>;
|
|
20
|
-
/**
|
|
21
|
-
export declare const
|
|
19
|
+
/** Sent when the focus-option command completes. */
|
|
20
|
+
export declare const CompletedOptionFocus: import("../../schema").CallableTaggedStruct<"CompletedOptionFocus", {}>;
|
|
22
21
|
/** Union of all messages the radio group component can produce. */
|
|
23
22
|
export declare const Message: S.Union<[import("../../schema").CallableTaggedStruct<"SelectedOption", {
|
|
24
23
|
value: typeof S.String;
|
|
25
24
|
index: typeof S.Number;
|
|
26
|
-
}>, import("../../schema").CallableTaggedStruct<"
|
|
25
|
+
}>, import("../../schema").CallableTaggedStruct<"CompletedOptionFocus", {}>]>;
|
|
27
26
|
export type SelectedOption = typeof SelectedOption.Type;
|
|
28
|
-
export type
|
|
27
|
+
export type CompletedOptionFocus = typeof CompletedOptionFocus.Type;
|
|
29
28
|
export type Message = typeof Message.Type;
|
|
30
29
|
/** Configuration for creating a radio group model with `init`. */
|
|
31
30
|
export type InitConfig = Readonly<{
|
|
@@ -51,7 +50,7 @@ export type OptionConfig<Message> = Readonly<{
|
|
|
51
50
|
/** Configuration for rendering a radio group with `view`. */
|
|
52
51
|
export type ViewConfig<Message, Option extends string> = Readonly<{
|
|
53
52
|
model: Model;
|
|
54
|
-
toMessage: (message: SelectedOption |
|
|
53
|
+
toMessage: (message: SelectedOption | CompletedOptionFocus) => Message;
|
|
55
54
|
options: ReadonlyArray<Option>;
|
|
56
55
|
optionToConfig: (option: Option, context: Readonly<{
|
|
57
56
|
isSelected: boolean;
|
|
@@ -60,7 +59,9 @@ export type ViewConfig<Message, Option extends string> = Readonly<{
|
|
|
60
59
|
}>) => OptionConfig<Message>;
|
|
61
60
|
isOptionDisabled?: (option: Option, index: number) => boolean;
|
|
62
61
|
orientation?: Orientation;
|
|
62
|
+
ariaLabel: string;
|
|
63
63
|
className?: string;
|
|
64
|
+
attributes?: ReadonlyArray<Attribute<Message>>;
|
|
64
65
|
name?: string;
|
|
65
66
|
isDisabled?: boolean;
|
|
66
67
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/radioGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/radioGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAQxE,+FAA+F;AAC/F,eAAO,MAAM,WAAW,uCAAsC,CAAA;AAC9D,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD,iGAAiG;AACjG,eAAO,MAAM,KAAK;;;;EAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,6EAA6E;AAC7E,eAAO,MAAM,cAAc;;;EAGzB,CAAA;AACF,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,yEAA4B,CAAA;AAE7D,mEAAmE;AACnE,eAAO,MA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effect';
|
|
2
|
-
import { html } from '../../html';
|
|
3
|
-
import { createLazy } from '../../html/lazy';
|
|
2
|
+
import { createLazy, html } from '../../html';
|
|
4
3
|
import { m } from '../../message';
|
|
5
4
|
import { evo } from '../../struct';
|
|
6
5
|
import * as Task from '../../task';
|
|
@@ -20,10 +19,10 @@ export const SelectedOption = m('SelectedOption', {
|
|
|
20
19
|
value: S.String,
|
|
21
20
|
index: S.Number,
|
|
22
21
|
});
|
|
23
|
-
/**
|
|
24
|
-
export const
|
|
22
|
+
/** Sent when the focus-option command completes. */
|
|
23
|
+
export const CompletedOptionFocus = m('CompletedOptionFocus');
|
|
25
24
|
/** Union of all messages the radio group component can produce. */
|
|
26
|
-
export const Message = S.Union(SelectedOption,
|
|
25
|
+
export const Message = S.Union(SelectedOption, CompletedOptionFocus);
|
|
27
26
|
/** Creates an initial radio group model from a config. Defaults to no selection and vertical orientation. */
|
|
28
27
|
export const init = (config) => ({
|
|
29
28
|
id: config.id,
|
|
@@ -38,17 +37,19 @@ export const update = (model, message) => M.value(message).pipe(M.withReturnType
|
|
|
38
37
|
const selector = `#${optionId(model.id, index)}`;
|
|
39
38
|
return [
|
|
40
39
|
evo(model, { selectedValue: () => Option.some(value) }),
|
|
41
|
-
[
|
|
40
|
+
[
|
|
41
|
+
Task.focus(selector).pipe(Effect.ignore, Effect.as(CompletedOptionFocus())),
|
|
42
|
+
],
|
|
42
43
|
];
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
+
CompletedOptionFocus: () => [model, []],
|
|
45
46
|
}));
|
|
46
47
|
const labelId = (id, index) => `${id}-option-${index}-label`;
|
|
47
48
|
const descriptionId = (id, index) => `${id}-option-${index}-description`;
|
|
48
49
|
/** Renders an accessible radio group by building ARIA attribute groups and delegating layout to the consumer's `optionToConfig` callback. */
|
|
49
50
|
export const view = (config) => {
|
|
50
|
-
const { div, input, AriaChecked, AriaDescribedBy, AriaDisabled, AriaLabelledBy, AriaOrientation, Class, DataAttribute, Id, Name, OnClick, OnKeyDownPreventDefault, Role, Tabindex, Type, Value, } = html();
|
|
51
|
-
const { model, model: { id, selectedValue }, toMessage, options, optionToConfig, isOptionDisabled: isOptionDisabledFn, orientation = model.orientation, className, name, isDisabled: isGroupDisabled = false, } = config;
|
|
51
|
+
const { div, input, AriaChecked, AriaDescribedBy, AriaDisabled, AriaLabel, AriaLabelledBy, AriaOrientation, Class, DataAttribute, Id, Name, OnClick, OnKeyDownPreventDefault, Role, Tabindex, Type, Value, } = html();
|
|
52
|
+
const { model, model: { id, selectedValue }, toMessage, options, optionToConfig, isOptionDisabled: isOptionDisabledFn, orientation = model.orientation, ariaLabel, className, attributes = [], name, isDisabled: isGroupDisabled = false, } = config;
|
|
52
53
|
const isDisabled = (index) => {
|
|
53
54
|
if (isGroupDisabled) {
|
|
54
55
|
return true;
|
|
@@ -131,7 +132,9 @@ export const view = (config) => {
|
|
|
131
132
|
const groupAttributes = [
|
|
132
133
|
Role('radiogroup'),
|
|
133
134
|
AriaOrientation(String.toLowerCase(orientation)),
|
|
135
|
+
AriaLabel(ariaLabel),
|
|
134
136
|
...(className ? [Class(className)] : []),
|
|
137
|
+
...attributes,
|
|
135
138
|
];
|
|
136
139
|
return div(groupAttributes, [...renderedOptions, ...hiddenInputs]);
|
|
137
140
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { init, update, view, lazy, Model, Message } from './index';
|
|
2
|
-
export type { SelectedOption,
|
|
2
|
+
export type { SelectedOption, Orientation, InitConfig, ViewConfig, OptionAttributes, OptionConfig, } from './index';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/radioGroup/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,YAAY,EACV,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/radioGroup/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,YAAY,EACV,cAAc,EACd,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,SAAS,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Schema as S } from 'effect';
|
|
2
2
|
import type { Command } from '../../command';
|
|
3
|
-
import type
|
|
4
|
-
import type { Html } from '../../html';
|
|
3
|
+
import { type Attribute, type Html } from '../../html';
|
|
5
4
|
/** Schema for the switch component's state, tracking the toggle's checked status. */
|
|
6
5
|
export declare const Model: S.Struct<{
|
|
7
6
|
id: typeof S.String;
|
|
@@ -10,12 +9,9 @@ export declare const Model: S.Struct<{
|
|
|
10
9
|
export type Model = typeof Model.Type;
|
|
11
10
|
/** Sent when the user toggles the switch via click or Space key. */
|
|
12
11
|
export declare const Toggled: import("../../schema").CallableTaggedStruct<"Toggled", {}>;
|
|
13
|
-
/**
|
|
14
|
-
export declare const
|
|
15
|
-
/** Union of all messages the switch component can produce. */
|
|
16
|
-
export declare const Message: S.Union<[import("../../schema").CallableTaggedStruct<"Toggled", {}>, import("../../schema").CallableTaggedStruct<"NoOp", {}>]>;
|
|
12
|
+
/** Schema for all messages the switch component can produce. */
|
|
13
|
+
export declare const Message: import("../../schema").CallableTaggedStruct<"Toggled", {}>;
|
|
17
14
|
export type Toggled = typeof Toggled.Type;
|
|
18
|
-
export type NoOp = typeof NoOp.Type;
|
|
19
15
|
export type Message = typeof Message.Type;
|
|
20
16
|
/** Configuration for creating a switch model with `init`. */
|
|
21
17
|
export type InitConfig = Readonly<{
|
|
@@ -25,7 +21,7 @@ export type InitConfig = Readonly<{
|
|
|
25
21
|
/** Creates an initial switch model from a config. Defaults to unchecked. */
|
|
26
22
|
export declare const init: (config: InitConfig) => Model;
|
|
27
23
|
/** Processes a switch message and returns the next model and commands. */
|
|
28
|
-
export declare const update: (model: Model,
|
|
24
|
+
export declare const update: (model: Model, _message: Message) => [Model, ReadonlyArray<Command<Message>>];
|
|
29
25
|
/** Attribute groups the switch component provides to the consumer's `toView` callback. */
|
|
30
26
|
export type SwitchAttributes<Message> = Readonly<{
|
|
31
27
|
button: ReadonlyArray<Attribute<Message>>;
|
|
@@ -36,7 +32,7 @@ export type SwitchAttributes<Message> = Readonly<{
|
|
|
36
32
|
/** Configuration for rendering a switch with `view`. */
|
|
37
33
|
export type ViewConfig<Message> = Readonly<{
|
|
38
34
|
model: Model;
|
|
39
|
-
toMessage: (message: Toggled
|
|
35
|
+
toMessage: (message: Toggled) => Message;
|
|
40
36
|
toView: (attributes: SwitchAttributes<Message>) => Html;
|
|
41
37
|
isDisabled?: boolean;
|
|
42
38
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAExD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAExD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAMxE,qFAAqF;AACrF,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,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;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAKF,uIAAuI;AACvI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAmE3D,CAAA;AAED;6EAC6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,KAC7D,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAgBtE,CAAA"}
|
package/dist/ui/switch/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Match as M, Option, Schema as S } from 'effect';
|
|
2
|
-
import { html } from '../../html';
|
|
3
|
-
import { createLazy } from '../../html/lazy';
|
|
2
|
+
import { createLazy, html } from '../../html';
|
|
4
3
|
import { m } from '../../message';
|
|
5
4
|
import { evo } from '../../struct';
|
|
6
5
|
// MODEL
|
|
@@ -12,10 +11,8 @@ export const Model = S.Struct({
|
|
|
12
11
|
// MESSAGE
|
|
13
12
|
/** Sent when the user toggles the switch via click or Space key. */
|
|
14
13
|
export const Toggled = m('Toggled');
|
|
15
|
-
/**
|
|
16
|
-
export const
|
|
17
|
-
/** Union of all messages the switch component can produce. */
|
|
18
|
-
export const Message = S.Union(Toggled, NoOp);
|
|
14
|
+
/** Schema for all messages the switch component can produce. */
|
|
15
|
+
export const Message = Toggled;
|
|
19
16
|
/** Creates an initial switch model from a config. Defaults to unchecked. */
|
|
20
17
|
export const init = (config) => ({
|
|
21
18
|
id: config.id,
|
|
@@ -23,10 +20,10 @@ export const init = (config) => ({
|
|
|
23
20
|
});
|
|
24
21
|
// UPDATE
|
|
25
22
|
/** Processes a switch message and returns the next model and commands. */
|
|
26
|
-
export const update = (model,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
export const update = (model, _message) => [
|
|
24
|
+
evo(model, { isChecked: isChecked => !isChecked }),
|
|
25
|
+
[],
|
|
26
|
+
];
|
|
30
27
|
const labelId = (id) => `${id}-label`;
|
|
31
28
|
const descriptionId = (id) => `${id}-description`;
|
|
32
29
|
/** Renders an accessible switch toggle by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { init, update, view, lazy, Model, Message } from './index';
|
|
2
|
-
export type { Toggled,
|
|
2
|
+
export type { Toggled, InitConfig, ViewConfig, SwitchAttributes } from './index';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/switch/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,YAAY,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/switch/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/ui/tabs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema as S } from 'effect';
|
|
2
2
|
import type { Command } from '../../command';
|
|
3
|
-
import type
|
|
3
|
+
import { type Attribute, type Html, type TagName } from '../../html';
|
|
4
4
|
export { wrapIndex, findFirstEnabledIndex, keyToIndex } from '../keyboard';
|
|
5
5
|
/** Controls the tab list layout direction and which arrow keys navigate between tabs. */
|
|
6
6
|
export declare const Orientation: S.Literal<["Horizontal", "Vertical"]>;
|
|
@@ -24,17 +24,16 @@ export declare const TabSelected: import("../../schema").CallableTaggedStruct<"T
|
|
|
24
24
|
export declare const TabFocused: import("../../schema").CallableTaggedStruct<"TabFocused", {
|
|
25
25
|
index: typeof S.Number;
|
|
26
26
|
}>;
|
|
27
|
-
/**
|
|
28
|
-
export declare const
|
|
27
|
+
/** Sent when the focus-tab command completes. */
|
|
28
|
+
export declare const CompletedTabFocus: import("../../schema").CallableTaggedStruct<"CompletedTabFocus", {}>;
|
|
29
29
|
/** Union of all messages the tabs component can produce. */
|
|
30
30
|
export declare const Message: S.Union<[import("../../schema").CallableTaggedStruct<"TabSelected", {
|
|
31
31
|
index: typeof S.Number;
|
|
32
32
|
}>, import("../../schema").CallableTaggedStruct<"TabFocused", {
|
|
33
33
|
index: typeof S.Number;
|
|
34
|
-
}>, import("../../schema").CallableTaggedStruct<"
|
|
34
|
+
}>, import("../../schema").CallableTaggedStruct<"CompletedTabFocus", {}>]>;
|
|
35
35
|
export type TabSelected = typeof TabSelected.Type;
|
|
36
36
|
export type TabFocused = typeof TabFocused.Type;
|
|
37
|
-
export type NoOp = typeof NoOp.Type;
|
|
38
37
|
export type Message = typeof Message.Type;
|
|
39
38
|
/** Configuration for creating a tabs model with `init`. */
|
|
40
39
|
export type InitConfig = Readonly<{
|
|
@@ -48,9 +47,9 @@ export declare const init: (config: InitConfig) => Model;
|
|
|
48
47
|
export declare const update: (model: Model, message: Message) => [Model, ReadonlyArray<Command<Message>>];
|
|
49
48
|
/** Configuration for an individual tab's button and panel content. */
|
|
50
49
|
export type TabConfig = Readonly<{
|
|
51
|
-
buttonClassName
|
|
50
|
+
buttonClassName?: string;
|
|
52
51
|
buttonContent: Html;
|
|
53
|
-
panelClassName
|
|
52
|
+
panelClassName?: string;
|
|
54
53
|
panelContent: Html;
|
|
55
54
|
}>;
|
|
56
55
|
/** Configuration for rendering a tab group with `view`. */
|
|
@@ -68,7 +67,10 @@ export type ViewConfig<Message, Tab extends string> = Readonly<{
|
|
|
68
67
|
tabElement?: TagName;
|
|
69
68
|
panelElement?: TagName;
|
|
70
69
|
className?: string;
|
|
70
|
+
attributes?: ReadonlyArray<Attribute<Message>>;
|
|
71
71
|
tabListClassName?: string;
|
|
72
|
+
tabListAttributes?: ReadonlyArray<Attribute<Message>>;
|
|
73
|
+
tabListAriaLabel: string;
|
|
72
74
|
}>;
|
|
73
75
|
/** Renders a headless tab group with accessible ARIA roles, roving tabindex, and keyboard navigation. */
|
|
74
76
|
export declare const view: <Message, Tab extends string>(config: ViewConfig<Message, Tab>) => Html;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,OAAO,EAGb,MAAM,YAAY,CAAA;AAMnB,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI1E,yFAAyF;AACzF,eAAO,MAAM,WAAW,uCAAsC,CAAA;AAC9D,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD,yGAAyG;AACzG,eAAO,MAAM,cAAc,oCAAmC,CAAA;AAC9D,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD,kGAAkG;AAClG,eAAO,M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
|
package/dist/ui/tabs/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Array, Effect, Match as M, Option, Schema as S, String, pipe, } from 'effect';
|
|
2
|
-
import { html } from '../../html';
|
|
3
|
-
import { createLazy } from '../../html/lazy';
|
|
2
|
+
import { createLazy, html, } from '../../html';
|
|
4
3
|
import { m } from '../../message';
|
|
5
4
|
import { evo } from '../../struct';
|
|
6
5
|
import * as Task from '../../task';
|
|
@@ -23,10 +22,10 @@ export const Model = S.Struct({
|
|
|
23
22
|
export const TabSelected = m('TabSelected', { index: S.Number });
|
|
24
23
|
/** Sent when a tab receives keyboard focus in `Manual` mode without being activated. */
|
|
25
24
|
export const TabFocused = m('TabFocused', { index: S.Number });
|
|
26
|
-
/**
|
|
27
|
-
export const
|
|
25
|
+
/** Sent when the focus-tab command completes. */
|
|
26
|
+
export const CompletedTabFocus = m('CompletedTabFocus');
|
|
28
27
|
/** Union of all messages the tabs component can produce. */
|
|
29
|
-
export const Message = S.Union(TabSelected, TabFocused,
|
|
28
|
+
export const Message = S.Union(TabSelected, TabFocused, CompletedTabFocus);
|
|
30
29
|
/** Creates an initial tabs model from a config. Defaults to first tab and automatic activation. */
|
|
31
30
|
export const init = (config) => {
|
|
32
31
|
const activeIndex = config.activeIndex ?? 0;
|
|
@@ -47,24 +46,28 @@ export const update = (model, message) => M.value(message).pipe(M.withReturnType
|
|
|
47
46
|
activeIndex: () => index,
|
|
48
47
|
focusedIndex: () => index,
|
|
49
48
|
}),
|
|
50
|
-
[
|
|
49
|
+
[
|
|
50
|
+
Task.focus(tabSelector).pipe(Effect.ignore, Effect.as(CompletedTabFocus())),
|
|
51
|
+
],
|
|
51
52
|
];
|
|
52
53
|
},
|
|
53
54
|
TabFocused: ({ index }) => {
|
|
54
55
|
const tabSelector = `#${tabId(model.id, index)}`;
|
|
55
56
|
return [
|
|
56
57
|
evo(model, { focusedIndex: () => index }),
|
|
57
|
-
[
|
|
58
|
+
[
|
|
59
|
+
Task.focus(tabSelector).pipe(Effect.ignore, Effect.as(CompletedTabFocus())),
|
|
60
|
+
],
|
|
58
61
|
];
|
|
59
62
|
},
|
|
60
|
-
|
|
63
|
+
CompletedTabFocus: () => [model, []],
|
|
61
64
|
}));
|
|
62
65
|
const tabPanelId = (id, index) => `${id}-panel-${index}`;
|
|
63
66
|
const tabId = (id, index) => `${id}-tab-${index}`;
|
|
64
67
|
/** Renders a headless tab group with accessible ARIA roles, roving tabindex, and keyboard navigation. */
|
|
65
68
|
export const view = (config) => {
|
|
66
|
-
const { div, empty, AriaControls, AriaDisabled, AriaLabelledBy, AriaOrientation, AriaSelected, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDownPreventDefault, Role, Tabindex, Type, keyed, } = html();
|
|
67
|
-
const { model, model: { id, activationMode, focusedIndex }, toMessage, tabs, tabToConfig, isTabDisabled, persistPanels, orientation = 'Horizontal', tabListElement = 'div', tabElement = 'button', panelElement = 'div', className, tabListClassName, } = config;
|
|
69
|
+
const { div, empty, AriaControls, AriaDisabled, AriaLabel, AriaLabelledBy, AriaOrientation, AriaSelected, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDownPreventDefault, Role, Tabindex, Type, keyed, } = html();
|
|
70
|
+
const { model, model: { id, activationMode, focusedIndex }, toMessage, tabs, tabToConfig, isTabDisabled, persistPanels, orientation = 'Horizontal', tabListElement = 'div', tabElement = 'button', panelElement = 'div', className, attributes = [], tabListClassName, tabListAttributes = [], tabListAriaLabel, } = config;
|
|
68
71
|
const isDisabled = (index) => !!isTabDisabled &&
|
|
69
72
|
pipe(tabs, Array.get(index), Option.exists(tab => isTabDisabled(tab, index)));
|
|
70
73
|
const { nextKey, previousKey } = M.value(orientation).pipe(M.when('Horizontal', () => ({
|
|
@@ -84,7 +87,6 @@ export const view = (config) => {
|
|
|
84
87
|
const isTabDisabledAtIndex = isDisabled(index);
|
|
85
88
|
const tabConfig = tabToConfig(tab, { isActive });
|
|
86
89
|
return keyed(tabElement)(tabId(id, index), [
|
|
87
|
-
Class(tabConfig.buttonClassName),
|
|
88
90
|
Id(tabId(id, index)),
|
|
89
91
|
Role('tab'),
|
|
90
92
|
Type('button'),
|
|
@@ -96,19 +98,24 @@ export const view = (config) => {
|
|
|
96
98
|
? [Disabled(true), AriaDisabled(true), DataAttribute('disabled', '')]
|
|
97
99
|
: [OnClick(toMessage(TabSelected({ index })))]),
|
|
98
100
|
OnKeyDownPreventDefault(handleKeyDown),
|
|
101
|
+
...(tabConfig.buttonClassName
|
|
102
|
+
? [Class(tabConfig.buttonClassName)]
|
|
103
|
+
: []),
|
|
99
104
|
], [tabConfig.buttonContent]);
|
|
100
105
|
});
|
|
101
106
|
const allPanels = Array.map(tabs, (tab, index) => {
|
|
102
107
|
const isActive = index === model.activeIndex;
|
|
103
108
|
const panelConfig = tabToConfig(tab, { isActive });
|
|
104
109
|
return keyed(panelElement)(tabPanelId(id, index), [
|
|
105
|
-
Class(panelConfig.panelClassName),
|
|
106
110
|
Id(tabPanelId(id, index)),
|
|
107
111
|
Role('tabpanel'),
|
|
108
112
|
AriaLabelledBy(tabId(id, index)),
|
|
109
113
|
Tabindex(isActive ? 0 : -1),
|
|
110
114
|
Hidden(!isActive),
|
|
111
115
|
...(isActive ? [DataAttribute('selected', '')] : []),
|
|
116
|
+
...(panelConfig.panelClassName
|
|
117
|
+
? [Class(panelConfig.panelClassName)]
|
|
118
|
+
: []),
|
|
112
119
|
], [panelConfig.panelContent]);
|
|
113
120
|
});
|
|
114
121
|
const activePanelOnly = pipe(tabs, Array.get(model.activeIndex), Option.match({
|
|
@@ -116,24 +123,27 @@ export const view = (config) => {
|
|
|
116
123
|
onSome: tab => {
|
|
117
124
|
const activeConfig = tabToConfig(tab, { isActive: true });
|
|
118
125
|
return keyed(panelElement)(tabPanelId(id, model.activeIndex), [
|
|
119
|
-
Class(activeConfig.panelClassName),
|
|
120
126
|
Id(tabPanelId(id, model.activeIndex)),
|
|
121
127
|
Role('tabpanel'),
|
|
122
128
|
AriaLabelledBy(tabId(id, model.activeIndex)),
|
|
123
129
|
Tabindex(0),
|
|
124
130
|
DataAttribute('selected', ''),
|
|
131
|
+
...(activeConfig.panelClassName
|
|
132
|
+
? [Class(activeConfig.panelClassName)]
|
|
133
|
+
: []),
|
|
125
134
|
], [activeConfig.panelContent]);
|
|
126
135
|
},
|
|
127
136
|
}));
|
|
128
137
|
const tabPanels = persistPanels ? allPanels : [activePanelOnly];
|
|
129
|
-
const
|
|
138
|
+
const resolvedTabListAttributes = [
|
|
130
139
|
Role('tablist'),
|
|
131
140
|
AriaOrientation(String.toLowerCase(orientation)),
|
|
141
|
+
AriaLabel(tabListAriaLabel),
|
|
132
142
|
...(tabListClassName ? [Class(tabListClassName)] : []),
|
|
143
|
+
...tabListAttributes,
|
|
133
144
|
];
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
keyed(tabListElement)(`${id}-tablist`, tabListAttributes, tabButtons),
|
|
145
|
+
return div([...(className ? [Class(className)] : []), ...attributes], [
|
|
146
|
+
keyed(tabListElement)(`${id}-tablist`, resolvedTabListAttributes, tabButtons),
|
|
137
147
|
...tabPanels,
|
|
138
148
|
]);
|
|
139
149
|
};
|
package/dist/ui/tabs/public.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { init, update, view, lazy, Model, Message } from './index';
|
|
2
|
-
export type { Orientation, ActivationMode, TabSelected, TabFocused,
|
|
2
|
+
export type { Orientation, ActivationMode, TabSelected, TabFocused, InitConfig, ViewConfig, TabConfig, } from './index';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/tabs/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,YAAY,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/tabs/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,YAAY,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.34.0",
|
|
4
|
+
"description": "A frontend framework for TypeScript, built on Effect, using The Elm Architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"license": "MIT",
|
|
155
155
|
"repository": {
|
|
156
156
|
"type": "git",
|
|
157
|
-
"url": "https://github.com/
|
|
157
|
+
"url": "https://github.com/foldkit/foldkit.git",
|
|
158
158
|
"directory": "packages/foldkit"
|
|
159
159
|
},
|
|
160
160
|
"dependencies": {
|