@foldkit/ui 0.155.0 → 0.156.0-canary.13f4f703eb6a
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 +18 -18
- package/dist/anchor/anchor.d.ts.map +1 -1
- package/dist/anchor/anchor.js +16 -16
- package/dist/animation/index.d.ts +4 -4
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +8 -8
- package/dist/animation/public.d.ts +1 -1
- package/dist/animation/public.d.ts.map +1 -1
- package/dist/animation/public.js +1 -1
- package/dist/animation/schema.d.ts +6 -6
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +5 -5
- package/dist/animation/update.d.ts +4 -2
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +18 -9
- package/dist/calendar/index.d.ts +56 -56
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +49 -37
- package/dist/checkbox/index.js +2 -2
- package/dist/combobox/multi.d.ts +19 -19
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +2 -2
- package/dist/combobox/shared.d.ts +61 -61
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +61 -61
- package/dist/combobox/single.d.ts +19 -19
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +2 -2
- package/dist/datePicker/index.d.ts +72 -72
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +12 -12
- package/dist/dialog/index.d.ts +14 -14
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +22 -22
- package/dist/disclosure/index.js +2 -2
- package/dist/dragAndDrop/index.d.ts +61 -61
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +85 -85
- package/dist/fileDrop/index.d.ts +6 -6
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +6 -6
- package/dist/hoverIntent/hoverIntent.d.ts +19 -16
- package/dist/hoverIntent/hoverIntent.d.ts.map +1 -1
- package/dist/hoverIntent/hoverIntent.js +49 -46
- package/dist/hoverIntent/message.d.ts +4 -4
- package/dist/hoverIntent/message.d.ts.map +1 -1
- package/dist/hoverIntent/message.js +4 -4
- package/dist/hoverIntent/public.d.ts +1 -1
- package/dist/hoverIntent/public.d.ts.map +1 -1
- package/dist/hoverIntent/public.js +1 -1
- package/dist/keyboard.js +2 -2
- package/dist/listbox/multi.d.ts +19 -19
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +2 -2
- package/dist/listbox/shared.d.ts +58 -58
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +61 -61
- package/dist/listbox/single.d.ts +19 -19
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +2 -2
- package/dist/menu/index.d.ts +67 -67
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +69 -66
- package/dist/popover/index.d.ts +34 -34
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +36 -36
- package/dist/radioGroup/index.d.ts +12 -12
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +16 -16
- package/dist/slider/index.d.ts +14 -14
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +31 -31
- package/dist/switch/index.js +2 -2
- package/dist/tabs/index.d.ts +14 -14
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +18 -18
- package/dist/test/apps/disabledButton.d.ts +12 -12
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +5 -5
- package/dist/textarea/index.d.ts +2 -2
- package/dist/textarea/index.d.ts.map +1 -1
- package/dist/toast/index.d.ts +63 -63
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +19 -19
- package/dist/toast/schema.d.ts +55 -55
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +29 -29
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +3 -3
- package/dist/toast/update.d.ts +61 -61
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +11 -11
- package/dist/tooltip/message.d.ts +3 -3
- package/dist/tooltip/message.d.ts.map +1 -1
- package/dist/tooltip/message.js +3 -3
- package/dist/tooltip/tooltip.d.ts +24 -24
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +13 -13
- package/dist/typeahead.d.ts.map +1 -1
- package/dist/typeahead.js +3 -3
- package/dist/virtualList/index.d.ts +16 -16
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +13 -13
- package/package.json +4 -4
package/dist/switch/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Match
|
|
2
|
+
import { Match, Option } from 'effect';
|
|
3
3
|
/** Returns the label element id, derived from the switch's base id. */
|
|
4
4
|
export const labelId = (id) => __foldkitBrandViewResult((`${id}-label`), "@foldkit/ui/switch/index.js#labelId");
|
|
5
5
|
/** Returns the description element id, derived from the switch's base id. */
|
|
@@ -28,7 +28,7 @@ export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-descriptio
|
|
|
28
28
|
export const view = (config, h) => {
|
|
29
29
|
const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, name, value: formValue = 'on', } = config;
|
|
30
30
|
const nextChecked = !isChecked;
|
|
31
|
-
const handleKeyUp = (key) => __foldkitBrandViewResult((
|
|
31
|
+
const handleKeyUp = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when(' ', () => __foldkitBrandViewResult((Option.some(onToggle(nextChecked))), "@foldkit/ui/switch/index.js#anonymous")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/switch/index.js#anonymous~2")))), "@foldkit/ui/switch/index.js#handleKeyUp");
|
|
32
32
|
const checkedAttributes = isChecked ? [h.DataAttribute('checked', '')] : [];
|
|
33
33
|
const disabledAttributes = isDisabled
|
|
34
34
|
? [h.AriaDisabled(true), h.DataAttribute('disabled', '')]
|
package/dist/tabs/index.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Effect, Option, Schema
|
|
1
|
+
import { Effect, Option, Schema } from 'effect';
|
|
2
2
|
import { type Update } from 'foldkit';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { type ChildAttribute, type Html } from 'foldkit/html';
|
|
5
5
|
import { type View as SubmodelView } from 'foldkit/submodel';
|
|
6
6
|
export { wrapIndex, findFirstEnabledIndex, keyToIndex } from '../keyboard.js';
|
|
7
7
|
/** Controls the tab list layout direction and which arrow keys navigate between tabs. */
|
|
8
|
-
export declare const Orientation:
|
|
8
|
+
export declare const Orientation: Schema.Literals<readonly ["Horizontal", "Vertical"]>;
|
|
9
9
|
export type Orientation = typeof Orientation.Type;
|
|
10
10
|
/** Controls whether tabs activate on focus (`Automatic`) or require an explicit selection (`Manual`). */
|
|
11
|
-
export declare const ActivationMode:
|
|
11
|
+
export declare const ActivationMode: Schema.Literals<readonly ["Automatic", "Manual"]>;
|
|
12
12
|
export type ActivationMode = typeof ActivationMode.Type;
|
|
13
13
|
/** Schema for the tabs component's private interaction state. The active
|
|
14
14
|
* tab is owned by the parent and passed in via `ViewInputs.selectedValue`,
|
|
15
15
|
* so it is not stored here. `maybeFocusedIndex` is the roving-tabindex
|
|
16
16
|
* cursor: `None` means keyboard focus follows the selected tab, and `Manual`
|
|
17
17
|
* activation stores `Some(index)` while focus diverges from the selection. */
|
|
18
|
-
export declare const Model:
|
|
19
|
-
readonly id:
|
|
20
|
-
readonly maybeFocusedIndex:
|
|
21
|
-
readonly activationMode:
|
|
18
|
+
export declare const Model: Schema.Struct<{
|
|
19
|
+
readonly id: Schema.String;
|
|
20
|
+
readonly maybeFocusedIndex: Schema.Option<Schema.Number>;
|
|
21
|
+
readonly activationMode: Schema.Literals<readonly ["Automatic", "Manual"]>;
|
|
22
22
|
}>;
|
|
23
23
|
export type Model = typeof Model.Type;
|
|
24
24
|
/** Union of all messages the tabs component can produce. */
|
|
25
25
|
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
26
26
|
readonly SelectedTab: {
|
|
27
|
-
index:
|
|
28
|
-
value:
|
|
27
|
+
index: Schema.Number;
|
|
28
|
+
value: Schema.String;
|
|
29
29
|
};
|
|
30
30
|
readonly FocusedTab: {
|
|
31
|
-
index:
|
|
31
|
+
index: Schema.Number;
|
|
32
32
|
};
|
|
33
33
|
readonly CompletedFocusTab: {};
|
|
34
34
|
}>;
|
|
@@ -44,8 +44,8 @@ export type Selected<Value extends string = string> = Readonly<{
|
|
|
44
44
|
* `Update.foldChild` config handles them through `foldOutMessage`. */
|
|
45
45
|
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
46
46
|
readonly Selected: {
|
|
47
|
-
value:
|
|
48
|
-
index:
|
|
47
|
+
value: Schema.String;
|
|
48
|
+
index: Schema.Number;
|
|
49
49
|
};
|
|
50
50
|
}>;
|
|
51
51
|
/** Generic over `Value extends string` so consumers using
|
|
@@ -63,8 +63,8 @@ export type InitConfig = Readonly<{
|
|
|
63
63
|
export declare const init: (config: InitConfig) => Model;
|
|
64
64
|
/** Moves focus to the tab at the given index. */
|
|
65
65
|
export declare const FocusTab: Command.CommandDefinitionWithArgs<"FocusTab", {
|
|
66
|
-
id:
|
|
67
|
-
index:
|
|
66
|
+
id: Schema.String;
|
|
67
|
+
index: Schema.Number;
|
|
68
68
|
}, Effect.Effect<{
|
|
69
69
|
readonly _tag: "CompletedFocusTab";
|
|
70
70
|
}, never, never>>;
|
package/dist/tabs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file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AAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IACnC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CAAA;AAEF;;;;;;;;4BAQ4B;AAC5B,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC/D,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;IAC1B,aAAa,EAAE,KAAK,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACxD,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAC,CAAA;AA+JF;;;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;;;;;;;;;;;;;;;;;mDAiBmD;AACnD,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,KAAK,CAmBpE,CAAA"}
|
package/dist/tabs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Array, Effect, Match
|
|
2
|
+
import { Array, Effect, Match, Option, Schema, String, pipe } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
@@ -11,35 +11,35 @@ import { keyToIndex } from '../keyboard.js';
|
|
|
11
11
|
export { wrapIndex, findFirstEnabledIndex, keyToIndex } from '../keyboard.js';
|
|
12
12
|
// MODEL
|
|
13
13
|
/** Controls the tab list layout direction and which arrow keys navigate between tabs. */
|
|
14
|
-
export const Orientation =
|
|
14
|
+
export const Orientation = Schema.Literals(['Horizontal', 'Vertical']);
|
|
15
15
|
/** Controls whether tabs activate on focus (`Automatic`) or require an explicit selection (`Manual`). */
|
|
16
|
-
export const ActivationMode =
|
|
16
|
+
export const ActivationMode = Schema.Literals(['Automatic', 'Manual']);
|
|
17
17
|
/** Schema for the tabs component's private interaction state. The active
|
|
18
18
|
* tab is owned by the parent and passed in via `ViewInputs.selectedValue`,
|
|
19
19
|
* so it is not stored here. `maybeFocusedIndex` is the roving-tabindex
|
|
20
20
|
* cursor: `None` means keyboard focus follows the selected tab, and `Manual`
|
|
21
21
|
* activation stores `Some(index)` while focus diverges from the selection. */
|
|
22
|
-
export const Model =
|
|
23
|
-
id:
|
|
24
|
-
maybeFocusedIndex:
|
|
22
|
+
export const Model = Schema.Struct({
|
|
23
|
+
id: Schema.String,
|
|
24
|
+
maybeFocusedIndex: Schema.Option(Schema.Number),
|
|
25
25
|
activationMode: ActivationMode,
|
|
26
26
|
});
|
|
27
27
|
// MESSAGE
|
|
28
28
|
/** Union of all messages the tabs component can produce. */
|
|
29
29
|
export const Message = defineMessageUnion({
|
|
30
30
|
SelectedTab: {
|
|
31
|
-
index:
|
|
32
|
-
value:
|
|
31
|
+
index: Schema.Number,
|
|
32
|
+
value: Schema.String,
|
|
33
33
|
},
|
|
34
|
-
FocusedTab: { index:
|
|
34
|
+
FocusedTab: { index: Schema.Number },
|
|
35
35
|
CompletedFocusTab: {},
|
|
36
36
|
});
|
|
37
37
|
/** Union of OutMessages the tabs component can produce. The parent's
|
|
38
38
|
* `Update.foldChild` config handles them through `foldOutMessage`. */
|
|
39
39
|
export const OutMessage = defineMessageUnion({
|
|
40
40
|
Selected: {
|
|
41
|
-
value:
|
|
42
|
-
index:
|
|
41
|
+
value: Schema.String,
|
|
42
|
+
index: Schema.Number,
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
/** Creates an initial tabs model from a config. Focus follows the selected
|
|
@@ -55,7 +55,7 @@ const tabId = (id, index) => __foldkitBrandViewResult((`${id}-tab-${index}`), "@
|
|
|
55
55
|
const tabPanelId = (id, index) => __foldkitBrandViewResult((`${id}-panel-${index}`), "@foldkit/ui/tabs/index.js#tabPanelId");
|
|
56
56
|
/** Moves focus to the tab at the given index. */
|
|
57
57
|
export const FocusTab = Command.define('FocusTab', {
|
|
58
|
-
args: { id:
|
|
58
|
+
args: { id: Schema.String, index: Schema.Number },
|
|
59
59
|
messages: [Message.CompletedFocusTab],
|
|
60
60
|
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.focus(idSelector(tabId(id, index))).pipe(Effect.ignore, Effect.as(Message.CompletedFocusTab()))), "@foldkit/ui/tabs/index.js#execute"),
|
|
61
61
|
});
|
|
@@ -82,18 +82,18 @@ const internalView = defineView((model, viewInputs, h) => {
|
|
|
82
82
|
const focusedIndex = pipe(maybeFocusedIndex, Option.filter(index => __foldkitBrandViewResult((index < tabs.length), "@foldkit/ui/tabs/index.js#anonymous~4")), Option.getOrElse(() => __foldkitBrandViewResult((activeIndex), "@foldkit/ui/tabs/index.js#anonymous~5")));
|
|
83
83
|
const isDisabled = (index) => __foldkitBrandViewResult((!!isTabDisabled &&
|
|
84
84
|
pipe(tabs, Array.get(index), Option.exists(tab => __foldkitBrandViewResult((isTabDisabled(tab, index)), "@foldkit/ui/tabs/index.js#anonymous~6")))), "@foldkit/ui/tabs/index.js#isDisabled");
|
|
85
|
-
const { nextKey, previousKey } =
|
|
85
|
+
const { nextKey, previousKey } = Match.value(orientation).pipe(Match.when('Horizontal', () => (__foldkitBrandViewResult(({
|
|
86
86
|
nextKey: 'ArrowRight',
|
|
87
87
|
previousKey: 'ArrowLeft',
|
|
88
|
-
}), "@foldkit/ui/tabs/index.js#anonymous~7"))),
|
|
88
|
+
}), "@foldkit/ui/tabs/index.js#anonymous~7"))), Match.when('Vertical', () => (__foldkitBrandViewResult(({
|
|
89
89
|
nextKey: 'ArrowDown',
|
|
90
90
|
previousKey: 'ArrowUp',
|
|
91
|
-
}), "@foldkit/ui/tabs/index.js#anonymous~8"))),
|
|
91
|
+
}), "@foldkit/ui/tabs/index.js#anonymous~8"))), Match.exhaustive);
|
|
92
92
|
const resolveKeyIndex = keyToIndex(nextKey, previousKey, tabs.length, focusedIndex, isDisabled);
|
|
93
93
|
const tabSelectedAt = (index) => __foldkitBrandViewResult((pipe(tabs, Array.get(index), Option.map(value => __foldkitBrandViewResult((Message.SelectedTab({ index, value })), "@foldkit/ui/tabs/index.js#anonymous~9")))), "@foldkit/ui/tabs/index.js#tabSelectedAt");
|
|
94
|
-
const handleAutomaticKeyDown = (key) => __foldkitBrandViewResult((
|
|
95
|
-
const handleManualKeyDown = (key) => __foldkitBrandViewResult((
|
|
96
|
-
const handleKeyDown = (key) => __foldkitBrandViewResult((
|
|
94
|
+
const handleAutomaticKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((tabSelectedAt(resolveKeyIndex(key))), "@foldkit/ui/tabs/index.js#anonymous~10")), Match.whenOr('Enter', ' ', () => __foldkitBrandViewResult((tabSelectedAt(focusedIndex)), "@foldkit/ui/tabs/index.js#anonymous~11")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#anonymous~12")))), "@foldkit/ui/tabs/index.js#handleAutomaticKeyDown");
|
|
95
|
+
const handleManualKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(Message.FocusedTab({ index: resolveKeyIndex(key) }))), "@foldkit/ui/tabs/index.js#anonymous~13")), Match.whenOr('Enter', ' ', () => __foldkitBrandViewResult((tabSelectedAt(focusedIndex)), "@foldkit/ui/tabs/index.js#anonymous~14")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#anonymous~15")))), "@foldkit/ui/tabs/index.js#handleManualKeyDown");
|
|
96
|
+
const handleKeyDown = (key) => __foldkitBrandViewResult((Match.value(activationMode).pipe(Match.when('Automatic', () => __foldkitBrandViewResult((handleAutomaticKeyDown(key)), "@foldkit/ui/tabs/index.js#anonymous~16")), Match.when('Manual', () => __foldkitBrandViewResult((handleManualKeyDown(key)), "@foldkit/ui/tabs/index.js#anonymous~17")), Match.exhaustive)), "@foldkit/ui/tabs/index.js#handleKeyDown");
|
|
97
97
|
const tabInfos = Array.map(tabs, (value, index) => {
|
|
98
98
|
const isActive = index === activeIndex;
|
|
99
99
|
const isFocused = index === focusedIndex;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Option, Schema
|
|
1
|
+
import { Option, Schema } from 'effect';
|
|
2
2
|
import type { Html, HtmlBuilder } from 'foldkit/html';
|
|
3
3
|
import * as Update from 'foldkit/update';
|
|
4
|
-
export declare const Model:
|
|
5
|
-
readonly isEnabled:
|
|
6
|
-
readonly dialog:
|
|
7
|
-
readonly id:
|
|
8
|
-
readonly isOpen:
|
|
9
|
-
readonly isAnimated:
|
|
10
|
-
readonly animation:
|
|
11
|
-
readonly id:
|
|
12
|
-
readonly isShowing:
|
|
13
|
-
readonly transitionState:
|
|
4
|
+
export declare const Model: Schema.Struct<{
|
|
5
|
+
readonly isEnabled: Schema.Boolean;
|
|
6
|
+
readonly dialog: Schema.Struct<{
|
|
7
|
+
readonly id: Schema.String;
|
|
8
|
+
readonly isOpen: Schema.Boolean;
|
|
9
|
+
readonly isAnimated: Schema.Boolean;
|
|
10
|
+
readonly animation: Schema.Struct<{
|
|
11
|
+
readonly id: Schema.String;
|
|
12
|
+
readonly isShowing: Schema.Boolean;
|
|
13
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
14
14
|
}>;
|
|
15
|
-
readonly maybeFocusSelector:
|
|
15
|
+
readonly maybeFocusSelector: Schema.Option<Schema.String>;
|
|
16
16
|
}>;
|
|
17
17
|
}>;
|
|
18
18
|
export type Model = typeof Model.Type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disabledButton.d.ts","sourceRoot":"","sources":["../../../src/test/apps/disabledButton.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"disabledButton.d.ts","sourceRoot":"","sources":["../../../src/test/apps/disabledButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAGrD,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAMxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;QAGE,OAAO;;;;;;;;;;;;;;;;;;EAC3B,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,eAAO,MAAM,YAAY,EAAE,KAG1B,CAAA;AAmBD,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQjD,CAAA;AAeJ,qCAAqC;AACrC,eAAO,MAAM,IAAI,UAAW,KAAK,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAQ5D,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,UAAW,KAAK,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAyBtE,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import {
|
|
2
|
+
import { Option, Schema } from 'effect';
|
|
3
3
|
import { defineMessageUnion } from 'foldkit/message';
|
|
4
4
|
import { evo } from 'foldkit/struct';
|
|
5
5
|
import * as Update from 'foldkit/update';
|
|
6
6
|
import * as Dialog from '../../dialog/index.js';
|
|
7
7
|
// MODEL
|
|
8
|
-
export const Model =
|
|
9
|
-
isEnabled:
|
|
8
|
+
export const Model = Schema.Struct({
|
|
9
|
+
isEnabled: Schema.Boolean,
|
|
10
10
|
dialog: Dialog.Model,
|
|
11
11
|
});
|
|
12
12
|
// MESSAGE
|
|
@@ -21,10 +21,10 @@ export const initialModel = {
|
|
|
21
21
|
dialog: Dialog.init({ id: 'test-dialog', isOpen: true }),
|
|
22
22
|
};
|
|
23
23
|
// UPDATE
|
|
24
|
-
const foldDialogOutMessage =
|
|
24
|
+
const foldDialogOutMessage = Dialog.OutMessage.match({
|
|
25
25
|
Opened: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/test/apps/disabledButton.js#anonymous"))), "@foldkit/ui/test/apps/disabledButton.js#Opened"),
|
|
26
26
|
Closed: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/test/apps/disabledButton.js#anonymous~2"))), "@foldkit/ui/test/apps/disabledButton.js#Closed"),
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
const foldDialog = Update.foldChild({
|
|
29
29
|
update: Dialog.update,
|
|
30
30
|
read: (model) => __foldkitBrandViewResult((Option.some(model.dialog)), "@foldkit/ui/test/apps/disabledButton.js#read"),
|
package/dist/textarea/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Attribute, Html, HtmlBuilder } from 'foldkit/html';
|
|
1
|
+
import type { Attribute, Html, HtmlBuilder, TextareaAttribute } from 'foldkit/html';
|
|
2
2
|
/** Attribute groups the textarea component provides to the consumer's `toView` callback. */
|
|
3
3
|
export type TextareaAttributes<Message> = Readonly<{
|
|
4
|
-
textarea: ReadonlyArray<
|
|
4
|
+
textarea: ReadonlyArray<TextareaAttribute<Message>>;
|
|
5
5
|
label: ReadonlyArray<Attribute<Message>>;
|
|
6
6
|
description: ReadonlyArray<Attribute<Message>>;
|
|
7
7
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/textarea/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/textarea/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,WAAW,EACX,iBAAiB,EAClB,MAAM,cAAc,CAAA;AAIrB,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,0DAA0D;AAC1D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACzD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IAuEF,CAAA"}
|
package/dist/toast/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import { type ChildAttribute, type Html } from 'foldkit/html';
|
|
3
3
|
import { Message, Position, Variant } from './schema.js';
|
|
4
4
|
import { WaitBeforeDismissal } from './update.js';
|
|
@@ -34,80 +34,80 @@ export type EntryHandlers = Readonly<{
|
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* ```ts
|
|
37
|
-
* const ToastPayload =
|
|
38
|
-
* bodyText:
|
|
39
|
-
* maybeLink:
|
|
40
|
-
* href:
|
|
41
|
-
* text:
|
|
37
|
+
* const ToastPayload = Schema.Struct({
|
|
38
|
+
* bodyText: Schema.String,
|
|
39
|
+
* maybeLink: Schema.Option(Schema.Struct({
|
|
40
|
+
* href: Schema.String,
|
|
41
|
+
* text: Schema.String,
|
|
42
42
|
* })),
|
|
43
43
|
* })
|
|
44
44
|
* export const Toast = Toast.make(ToastPayload)
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
export declare const make: <A, I>(payloadSchema:
|
|
48
|
-
readonly Entry:
|
|
49
|
-
readonly id:
|
|
50
|
-
readonly variant:
|
|
51
|
-
readonly animation:
|
|
52
|
-
readonly id:
|
|
53
|
-
readonly isShowing:
|
|
54
|
-
readonly transitionState:
|
|
47
|
+
export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
|
|
48
|
+
readonly Entry: Schema.Struct<{
|
|
49
|
+
readonly id: Schema.String;
|
|
50
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
51
|
+
readonly animation: Schema.Struct<{
|
|
52
|
+
readonly id: Schema.String;
|
|
53
|
+
readonly isShowing: Schema.Boolean;
|
|
54
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
55
55
|
}>;
|
|
56
|
-
readonly maybeDuration:
|
|
57
|
-
readonly pendingDismissVersion:
|
|
58
|
-
readonly isHovered:
|
|
59
|
-
readonly payload:
|
|
56
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
57
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
58
|
+
readonly isHovered: Schema.Boolean;
|
|
59
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
60
60
|
}>;
|
|
61
|
-
readonly Model:
|
|
62
|
-
readonly id:
|
|
63
|
-
readonly defaultDuration:
|
|
64
|
-
readonly entries:
|
|
65
|
-
readonly id:
|
|
66
|
-
readonly variant:
|
|
67
|
-
readonly animation:
|
|
68
|
-
readonly id:
|
|
69
|
-
readonly isShowing:
|
|
70
|
-
readonly transitionState:
|
|
61
|
+
readonly Model: Schema.Struct<{
|
|
62
|
+
readonly id: Schema.String;
|
|
63
|
+
readonly defaultDuration: Schema.DurationFromMillis;
|
|
64
|
+
readonly entries: Schema.$Array<Schema.Struct<{
|
|
65
|
+
readonly id: Schema.String;
|
|
66
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
67
|
+
readonly animation: Schema.Struct<{
|
|
68
|
+
readonly id: Schema.String;
|
|
69
|
+
readonly isShowing: Schema.Boolean;
|
|
70
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
71
71
|
}>;
|
|
72
|
-
readonly maybeDuration:
|
|
73
|
-
readonly pendingDismissVersion:
|
|
74
|
-
readonly isHovered:
|
|
75
|
-
readonly payload:
|
|
72
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
73
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
74
|
+
readonly isHovered: Schema.Boolean;
|
|
75
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
76
76
|
}>>;
|
|
77
|
-
readonly nextEntryKey:
|
|
77
|
+
readonly nextEntryKey: Schema.Number;
|
|
78
78
|
}>;
|
|
79
79
|
readonly Message: import("foldkit/message").MessageUnion<{
|
|
80
80
|
readonly Added: {
|
|
81
|
-
readonly entry:
|
|
82
|
-
readonly id:
|
|
83
|
-
readonly variant:
|
|
84
|
-
readonly animation:
|
|
85
|
-
readonly id:
|
|
86
|
-
readonly isShowing:
|
|
87
|
-
readonly transitionState:
|
|
81
|
+
readonly entry: Schema.Struct<{
|
|
82
|
+
readonly id: Schema.String;
|
|
83
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
84
|
+
readonly animation: Schema.Struct<{
|
|
85
|
+
readonly id: Schema.String;
|
|
86
|
+
readonly isShowing: Schema.Boolean;
|
|
87
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
88
88
|
}>;
|
|
89
|
-
readonly maybeDuration:
|
|
90
|
-
readonly pendingDismissVersion:
|
|
91
|
-
readonly isHovered:
|
|
92
|
-
readonly payload:
|
|
89
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
90
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
91
|
+
readonly isHovered: Schema.Boolean;
|
|
92
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
93
93
|
}>;
|
|
94
94
|
};
|
|
95
95
|
readonly Dismissed: {
|
|
96
|
-
entryId:
|
|
96
|
+
entryId: Schema.String;
|
|
97
97
|
};
|
|
98
98
|
readonly DismissedAll: {};
|
|
99
99
|
readonly CompletedWaitBeforeDismissal: {
|
|
100
|
-
entryId:
|
|
101
|
-
version:
|
|
100
|
+
entryId: Schema.String;
|
|
101
|
+
version: Schema.Number;
|
|
102
102
|
};
|
|
103
103
|
readonly HoveredEntry: {
|
|
104
|
-
entryId:
|
|
104
|
+
entryId: Schema.String;
|
|
105
105
|
};
|
|
106
106
|
readonly LeftEntry: {
|
|
107
|
-
entryId:
|
|
107
|
+
entryId: Schema.String;
|
|
108
108
|
};
|
|
109
109
|
readonly GotAnimationMessage: {
|
|
110
|
-
entryId:
|
|
110
|
+
entryId: Schema.String;
|
|
111
111
|
message: import("foldkit/message").MessageUnion<{
|
|
112
112
|
readonly Showed: {};
|
|
113
113
|
readonly Hid: {};
|
|
@@ -118,26 +118,26 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
|
|
|
118
118
|
}>;
|
|
119
119
|
readonly OutMessage: import("foldkit/message").MessageUnion<{
|
|
120
120
|
readonly DismissedToast: {
|
|
121
|
-
readonly payload:
|
|
121
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
122
122
|
};
|
|
123
123
|
}>;
|
|
124
124
|
readonly Added: import("foldkit/schema").CallableTaggedStruct<"Added", {
|
|
125
|
-
readonly entry:
|
|
126
|
-
readonly id:
|
|
127
|
-
readonly variant:
|
|
128
|
-
readonly animation:
|
|
129
|
-
readonly id:
|
|
130
|
-
readonly isShowing:
|
|
131
|
-
readonly transitionState:
|
|
125
|
+
readonly entry: Schema.Struct<{
|
|
126
|
+
readonly id: Schema.String;
|
|
127
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
128
|
+
readonly animation: Schema.Struct<{
|
|
129
|
+
readonly id: Schema.String;
|
|
130
|
+
readonly isShowing: Schema.Boolean;
|
|
131
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
132
132
|
}>;
|
|
133
|
-
readonly maybeDuration:
|
|
134
|
-
readonly pendingDismissVersion:
|
|
135
|
-
readonly isHovered:
|
|
136
|
-
readonly payload:
|
|
133
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
134
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
135
|
+
readonly isHovered: Schema.Boolean;
|
|
136
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
137
137
|
}>;
|
|
138
138
|
}>;
|
|
139
139
|
readonly DismissedToast: import("foldkit/schema").CallableTaggedStruct<"DismissedToast", {
|
|
140
|
-
readonly payload:
|
|
140
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
141
141
|
}>;
|
|
142
142
|
readonly init: (config: Readonly<{
|
|
143
143
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAG9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAe,MAAM,aAAa,CAAA;AAE9D,YAAY,EACV,4BAA4B,EAC5B,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,SAAS,GACV,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAA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index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Match
|
|
2
|
+
import { Match } from 'effect';
|
|
3
3
|
import { childAttributes } from 'foldkit/html';
|
|
4
4
|
import { defineView } from 'foldkit/submodel';
|
|
5
5
|
import { Message, Position, Variant } from './schema.js';
|
|
6
6
|
import { WaitBeforeDismissal, makeRuntime } from './update.js';
|
|
7
7
|
export * as test from './test.js';
|
|
8
8
|
export { Message, Variant, Position, WaitBeforeDismissal };
|
|
9
|
-
const variantToRole = (variant) => __foldkitBrandViewResult((
|
|
9
|
+
const variantToRole = (variant) => __foldkitBrandViewResult((Match.value(variant).pipe(Match.withReturnType(), Match.when('Info', () => __foldkitBrandViewResult(('status'), "@foldkit/ui/toast/index.js#anonymous")), Match.when('Success', () => __foldkitBrandViewResult(('status'), "@foldkit/ui/toast/index.js#anonymous~2")), Match.when('Warning', () => __foldkitBrandViewResult(('alert'), "@foldkit/ui/toast/index.js#anonymous~3")), Match.when('Error', () => __foldkitBrandViewResult(('alert'), "@foldkit/ui/toast/index.js#anonymous~4")), Match.exhaustive)), "@foldkit/ui/toast/index.js#variantToRole");
|
|
10
10
|
const positionToContainerStyle = (position) => {
|
|
11
11
|
const base = {
|
|
12
12
|
position: 'fixed',
|
|
@@ -18,39 +18,39 @@ const positionToContainerStyle = (position) => {
|
|
|
18
18
|
pointerEvents: 'none',
|
|
19
19
|
zIndex: '2147483600',
|
|
20
20
|
};
|
|
21
|
-
return __foldkitBrandViewResult((
|
|
21
|
+
return __foldkitBrandViewResult((Match.value(position).pipe(Match.withReturnType(), Match.when('TopLeft', () => (__foldkitBrandViewResult(({
|
|
22
22
|
...base,
|
|
23
23
|
top: '0',
|
|
24
24
|
left: '0',
|
|
25
25
|
flexDirection: 'column-reverse',
|
|
26
|
-
}), "@foldkit/ui/toast/index.js#anonymous~5"))),
|
|
26
|
+
}), "@foldkit/ui/toast/index.js#anonymous~5"))), Match.when('TopCenter', () => (__foldkitBrandViewResult(({
|
|
27
27
|
...base,
|
|
28
28
|
top: '0',
|
|
29
29
|
left: '50%',
|
|
30
30
|
transform: 'translateX(-50%)',
|
|
31
31
|
flexDirection: 'column-reverse',
|
|
32
|
-
}), "@foldkit/ui/toast/index.js#anonymous~6"))),
|
|
32
|
+
}), "@foldkit/ui/toast/index.js#anonymous~6"))), Match.when('TopRight', () => (__foldkitBrandViewResult(({
|
|
33
33
|
...base,
|
|
34
34
|
top: '0',
|
|
35
35
|
right: '0',
|
|
36
36
|
flexDirection: 'column-reverse',
|
|
37
|
-
}), "@foldkit/ui/toast/index.js#anonymous~7"))),
|
|
37
|
+
}), "@foldkit/ui/toast/index.js#anonymous~7"))), Match.when('BottomLeft', () => (__foldkitBrandViewResult(({
|
|
38
38
|
...base,
|
|
39
39
|
bottom: '0',
|
|
40
40
|
left: '0',
|
|
41
41
|
flexDirection: 'column',
|
|
42
|
-
}), "@foldkit/ui/toast/index.js#anonymous~8"))),
|
|
42
|
+
}), "@foldkit/ui/toast/index.js#anonymous~8"))), Match.when('BottomCenter', () => (__foldkitBrandViewResult(({
|
|
43
43
|
...base,
|
|
44
44
|
bottom: '0',
|
|
45
45
|
left: '50%',
|
|
46
46
|
transform: 'translateX(-50%)',
|
|
47
47
|
flexDirection: 'column',
|
|
48
|
-
}), "@foldkit/ui/toast/index.js#anonymous~9"))),
|
|
48
|
+
}), "@foldkit/ui/toast/index.js#anonymous~9"))), Match.when('BottomRight', () => (__foldkitBrandViewResult(({
|
|
49
49
|
...base,
|
|
50
50
|
bottom: '0',
|
|
51
51
|
right: '0',
|
|
52
52
|
flexDirection: 'column',
|
|
53
|
-
}), "@foldkit/ui/toast/index.js#anonymous~10"))),
|
|
53
|
+
}), "@foldkit/ui/toast/index.js#anonymous~10"))), Match.exhaustive)), "@foldkit/ui/toast/index.js#positionToContainerStyle");
|
|
54
54
|
};
|
|
55
55
|
const DEFAULT_ARIA_LABEL = 'Notifications';
|
|
56
56
|
/** Factory that binds `Toast` to a user-provided payload schema. The
|
|
@@ -73,11 +73,11 @@ const DEFAULT_ARIA_LABEL = 'Notifications';
|
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
75
|
* ```ts
|
|
76
|
-
* const ToastPayload =
|
|
77
|
-
* bodyText:
|
|
78
|
-
* maybeLink:
|
|
79
|
-
* href:
|
|
80
|
-
* text:
|
|
76
|
+
* const ToastPayload = Schema.Struct({
|
|
77
|
+
* bodyText: Schema.String,
|
|
78
|
+
* maybeLink: Schema.Option(Schema.Struct({
|
|
79
|
+
* href: Schema.String,
|
|
80
|
+
* text: Schema.String,
|
|
81
81
|
* })),
|
|
82
82
|
* })
|
|
83
83
|
* export const Toast = Toast.make(ToastPayload)
|
|
@@ -104,21 +104,21 @@ export const make = (payloadSchema) => {
|
|
|
104
104
|
];
|
|
105
105
|
const renderEntryItem = (entry) => {
|
|
106
106
|
const { transitionState } = entry.animation;
|
|
107
|
-
const animationAttributes =
|
|
107
|
+
const animationAttributes = Match.value(transitionState).pipe(Match.when('EnterStart', () => __foldkitBrandViewResult(([
|
|
108
108
|
h.DataAttribute('closed', ''),
|
|
109
109
|
h.DataAttribute('enter', ''),
|
|
110
110
|
h.DataAttribute('transition', ''),
|
|
111
|
-
]), "@foldkit/ui/toast/index.js#anonymous~12")),
|
|
111
|
+
]), "@foldkit/ui/toast/index.js#anonymous~12")), Match.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
112
112
|
h.DataAttribute('enter', ''),
|
|
113
113
|
h.DataAttribute('transition', ''),
|
|
114
|
-
]), "@foldkit/ui/toast/index.js#anonymous~13")),
|
|
114
|
+
]), "@foldkit/ui/toast/index.js#anonymous~13")), Match.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
115
115
|
h.DataAttribute('leave', ''),
|
|
116
116
|
h.DataAttribute('transition', ''),
|
|
117
|
-
]), "@foldkit/ui/toast/index.js#anonymous~14")),
|
|
117
|
+
]), "@foldkit/ui/toast/index.js#anonymous~14")), Match.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
118
118
|
h.DataAttribute('closed', ''),
|
|
119
119
|
h.DataAttribute('leave', ''),
|
|
120
120
|
h.DataAttribute('transition', ''),
|
|
121
|
-
]), "@foldkit/ui/toast/index.js#anonymous~15")),
|
|
121
|
+
]), "@foldkit/ui/toast/index.js#anonymous~15")), Match.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/toast/index.js#anonymous~16")));
|
|
122
122
|
const itemAttributes = [
|
|
123
123
|
h.Id(entry.id),
|
|
124
124
|
h.Role(variantToRole(entry.variant)),
|