foldkit 0.60.0 → 0.62.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/calendar/arithmetic.d.ts +140 -0
- package/dist/calendar/arithmetic.d.ts.map +1 -0
- package/dist/calendar/arithmetic.js +169 -0
- package/dist/calendar/calendarDate.d.ts +162 -0
- package/dist/calendar/calendarDate.d.ts.map +1 -0
- package/dist/calendar/calendarDate.js +196 -0
- package/dist/calendar/comparison.d.ts +163 -0
- package/dist/calendar/comparison.d.ts.map +1 -0
- package/dist/calendar/comparison.js +134 -0
- package/dist/calendar/index.d.ts +7 -0
- package/dist/calendar/index.d.ts.map +1 -0
- package/dist/calendar/index.js +6 -0
- package/dist/calendar/info.d.ts +76 -0
- package/dist/calendar/info.d.ts.map +1 -0
- package/dist/calendar/info.js +125 -0
- package/dist/calendar/locale.d.ts +71 -0
- package/dist/calendar/locale.d.ts.map +1 -0
- package/dist/calendar/locale.js +171 -0
- package/dist/calendar/public.d.ts +2 -0
- package/dist/calendar/public.d.ts.map +1 -0
- package/dist/calendar/public.js +1 -0
- package/dist/calendar/today.d.ts +41 -0
- package/dist/calendar/today.d.ts.map +1 -0
- package/dist/calendar/today.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/ui/anchor.d.ts +2 -1
- package/dist/ui/anchor.d.ts.map +1 -1
- package/dist/ui/anchor.js +24 -3
- package/dist/ui/calendar/index.d.ts +242 -0
- package/dist/ui/calendar/index.d.ts.map +1 -0
- package/dist/ui/calendar/index.js +516 -0
- package/dist/ui/calendar/public.d.ts +3 -0
- package/dist/ui/calendar/public.d.ts.map +1 -0
- package/dist/ui/calendar/public.js +1 -0
- package/dist/ui/datePicker/index.d.ts +226 -0
- package/dist/ui/datePicker/index.d.ts.map +1 -0
- package/dist/ui/datePicker/index.js +231 -0
- package/dist/ui/datePicker/public.d.ts +3 -0
- package/dist/ui/datePicker/public.d.ts.map +1 -0
- package/dist/ui/datePicker/public.js +1 -0
- package/dist/ui/dragAndDrop/index.d.ts +1 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -0
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +1 -5
- package/dist/ui/popover/index.d.ts +4 -1
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +8 -9
- package/package.json +9 -1
package/dist/ui/popover/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export const Model = S.Struct({
|
|
|
18
18
|
isOpen: S.Boolean,
|
|
19
19
|
isAnimated: S.Boolean,
|
|
20
20
|
isModal: S.Boolean,
|
|
21
|
+
contentFocus: S.Boolean,
|
|
21
22
|
transition: TransitionModel,
|
|
22
23
|
maybeLastButtonPointerType: S.OptionFromSelf(S.String),
|
|
23
24
|
});
|
|
@@ -63,6 +64,7 @@ export const init = (config) => ({
|
|
|
63
64
|
isOpen: false,
|
|
64
65
|
isAnimated: config.isAnimated ?? false,
|
|
65
66
|
isModal: config.isModal ?? false,
|
|
67
|
+
contentFocus: config.contentFocus ?? false,
|
|
66
68
|
transition: transitionInit({ id: `${config.id}-panel` }),
|
|
67
69
|
maybeLastButtonPointerType: Option.none(),
|
|
68
70
|
});
|
|
@@ -118,12 +120,8 @@ export const update = (model, message) => {
|
|
|
118
120
|
panelSelector(model.id),
|
|
119
121
|
]).pipe(Effect.as(CompletedSetupInert()))));
|
|
120
122
|
const maybeRestoreInert = OptionExt.when(model.isModal, RestoreInert(Task.restoreInert(model.id).pipe(Effect.as(CompletedTeardownInert()))));
|
|
121
|
-
const focusPanel = FocusPanel(Task.focus(panelSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusPanel())));
|
|
122
123
|
const focusButton = FocusButton(Task.focus(buttonSelector(model.id)).pipe(Effect.ignore, Effect.as(CompletedFocusButton())));
|
|
123
|
-
const openCommands = [
|
|
124
|
-
focusPanel,
|
|
125
|
-
...Array.getSomes([maybeLockScroll, maybeInertOthers]),
|
|
126
|
-
];
|
|
124
|
+
const openCommands = Array.getSomes([maybeLockScroll, maybeInertOthers]);
|
|
127
125
|
const closeWithFocusCommands = [
|
|
128
126
|
focusButton,
|
|
129
127
|
...Array.getSomes([maybeUnlockScroll, maybeRestoreInert]),
|
|
@@ -200,7 +198,7 @@ export const close = (model) => update(model, Closed());
|
|
|
200
198
|
/** Renders a headless popover with a trigger button and a floating panel. Uses the disclosure ARIA pattern (aria-expanded + aria-controls) with no role on the panel. */
|
|
201
199
|
export const view = (config) => {
|
|
202
200
|
const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick, OnDestroy, OnInsert, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnPointerDown, Style, Tabindex, Type, keyed, } = html();
|
|
203
|
-
const { model: { id, isOpen, transition: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, className, attributes = [], } = config;
|
|
201
|
+
const { model: { id, isOpen, contentFocus, transition: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, focusSelector, className, attributes = [], } = config;
|
|
204
202
|
const dispatchOpened = () => onOpened ? onOpened() : toParentMessage(Opened());
|
|
205
203
|
const dispatchClosed = () => onClosed ? onClosed() : toParentMessage(Closed());
|
|
206
204
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
@@ -220,7 +218,7 @@ export const view = (config) => {
|
|
|
220
218
|
DataAttribute('leave', ''),
|
|
221
219
|
DataAttribute('transition', ''),
|
|
222
220
|
]), M.orElse(() => []));
|
|
223
|
-
const handleButtonKeyDown = (key) => M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => Option.some(isOpen ? dispatchClosed() : dispatchOpened())), M.orElse(() => Option.none()));
|
|
221
|
+
const handleButtonKeyDown = (key) => M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => Option.some(isOpen ? dispatchClosed() : dispatchOpened())), M.when('Escape', () => OptionExt.when(isOpen, dispatchClosed())), M.orElse(() => Option.none()));
|
|
224
222
|
const handleButtonPointerDown = (pointerType, button) => Option.some(toParentMessage(PressedPointerOnButton({
|
|
225
223
|
pointerType,
|
|
226
224
|
button,
|
|
@@ -266,6 +264,7 @@ export const view = (config) => {
|
|
|
266
264
|
anchor,
|
|
267
265
|
interceptTab: false,
|
|
268
266
|
focusAfterPosition: true,
|
|
267
|
+
...(focusSelector !== undefined && { focusSelector }),
|
|
269
268
|
});
|
|
270
269
|
const anchorAttributes = [
|
|
271
270
|
Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
|
|
@@ -274,14 +273,14 @@ export const view = (config) => {
|
|
|
274
273
|
];
|
|
275
274
|
const resolvedPanelAttributes = [
|
|
276
275
|
Id(`${id}-panel`),
|
|
277
|
-
Tabindex(0),
|
|
276
|
+
...(contentFocus ? [] : [Tabindex(0)]),
|
|
278
277
|
...anchorAttributes,
|
|
279
278
|
...transitionAttributes,
|
|
280
279
|
...(isLeaving
|
|
281
280
|
? []
|
|
282
281
|
: [
|
|
283
282
|
OnKeyDownPreventDefault(handlePanelKeyDown),
|
|
284
|
-
OnBlur(toParentMessage(ClosedByTab())),
|
|
283
|
+
...(contentFocus ? [] : [OnBlur(toParentMessage(ClosedByTab()))]),
|
|
285
284
|
]),
|
|
286
285
|
...(panelClassName ? [Class(panelClassName)] : []),
|
|
287
286
|
...panelAttributes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "A frontend framework for TypeScript, built on Effect, using The Elm Architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./calendar": {
|
|
15
|
+
"types": "./dist/calendar/public.d.ts",
|
|
16
|
+
"import": "./dist/calendar/public.js"
|
|
17
|
+
},
|
|
14
18
|
"./command": {
|
|
15
19
|
"types": "./dist/command/public.d.ts",
|
|
16
20
|
"import": "./dist/command/public.js"
|
|
@@ -79,6 +83,10 @@
|
|
|
79
83
|
"types": "./dist/ui/button/public.d.ts",
|
|
80
84
|
"import": "./dist/ui/button/public.js"
|
|
81
85
|
},
|
|
86
|
+
"./ui/calendar": {
|
|
87
|
+
"types": "./dist/ui/calendar/public.d.ts",
|
|
88
|
+
"import": "./dist/ui/calendar/public.js"
|
|
89
|
+
},
|
|
82
90
|
"./ui/checkbox": {
|
|
83
91
|
"types": "./dist/ui/checkbox/public.d.ts",
|
|
84
92
|
"import": "./dist/ui/checkbox/public.js"
|