@foldkit/ui 0.153.0 → 0.154.0-canary.4e7d8d4010be
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 +14 -1
- package/dist/anchor/anchor.d.ts.map +1 -1
- package/dist/anchor/anchor.js +58 -5
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +91 -78
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +46 -39
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +39 -32
- package/dist/popover/index.d.ts +15 -0
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +46 -26
- package/dist/popover/public.d.ts +1 -1
- package/dist/popover/public.d.ts.map +1 -1
- package/dist/popover/public.js +1 -1
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +15 -11
- package/package.json +4 -4
package/dist/popover/index.js
CHANGED
|
@@ -81,6 +81,11 @@ const panelSelector = (id) => __foldkitBrandViewResult((idSelector(`${id}-panel`
|
|
|
81
81
|
* trigger via a native `<label for={Popover.buttonId(id)}>` or an
|
|
82
82
|
* `aria-labelledby` reference. */
|
|
83
83
|
export const buttonId = (id) => __foldkitBrandViewResult((`${id}-button`), "@foldkit/ui/popover/index.js#buttonId");
|
|
84
|
+
/** Returns the bare DOM id of the popover arrow, derived from the popover's
|
|
85
|
+
* base id. The `arrow` bundle already carries this id, so reach for this when
|
|
86
|
+
* you need the id on its own, such as asserting the panel Mount's `arrowId`
|
|
87
|
+
* argument in a Scene test. */
|
|
88
|
+
export const arrowId = (id) => __foldkitBrandViewResult((`${id}-arrow`), "@foldkit/ui/popover/index.js#arrowId");
|
|
84
89
|
/** Prevents page scrolling while the popover is open in modal mode. */
|
|
85
90
|
export const LockScroll = Command.define('LockScroll', {
|
|
86
91
|
messages: [Message.CompletedLockScroll],
|
|
@@ -240,26 +245,37 @@ export const update = (model, message) => {
|
|
|
240
245
|
* Scene tests can call `Scene.Mount.resolve(AnchorPopover, CompletedAnchorPopover())`
|
|
241
246
|
* to acknowledge the mount produced by the rendered panel. */
|
|
242
247
|
export const AnchorPopover = Mount.define('AnchorPopover', {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
248
|
+
args: {
|
|
249
|
+
buttonId: S.String,
|
|
250
|
+
anchor: AnchorConfig,
|
|
251
|
+
focusSelector: S.optional(S.String),
|
|
252
|
+
arrowId: S.optional(S.String),
|
|
253
|
+
arrowPadding: S.optional(S.Number),
|
|
254
|
+
},
|
|
255
|
+
messages: [Message.CompletedAnchorPopover],
|
|
256
|
+
execute: ({ element, buttonId, anchor, focusSelector, arrowId, arrowPadding, }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
257
|
+
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((anchorSetup(element, {
|
|
258
|
+
buttonId,
|
|
259
|
+
anchor,
|
|
260
|
+
interceptTab: false,
|
|
261
|
+
focusAfterPosition: true,
|
|
262
|
+
...(focusSelector !== undefined && { focusSelector }),
|
|
263
|
+
...(arrowId !== undefined && { arrowId }),
|
|
264
|
+
...(arrowPadding !== undefined && { arrowPadding }),
|
|
265
|
+
})), "@foldkit/ui/popover/index.js#anonymous~9")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/popover/index.js#anonymous~10"));
|
|
266
|
+
return __foldkitBrandViewResult((Message.CompletedAnchorPopover()), "@foldkit/ui/popover/index.js#anonymous~8");
|
|
267
|
+
})), "@foldkit/ui/popover/index.js#execute~6"),
|
|
268
|
+
});
|
|
256
269
|
/** The backdrop-portaling Mount this Popover renders. Exposed so Scene tests can
|
|
257
270
|
* call `Scene.Mount.resolve(PortalPopoverBackdrop, CompletedPortalPopoverBackdrop())` to
|
|
258
271
|
* acknowledge the mount produced by the rendered backdrop. */
|
|
259
|
-
export const PortalPopoverBackdrop = Mount.define('PortalPopoverBackdrop',
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
272
|
+
export const PortalPopoverBackdrop = Mount.define('PortalPopoverBackdrop', {
|
|
273
|
+
messages: [Message.CompletedPortalPopoverBackdrop],
|
|
274
|
+
execute: ({ element }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
275
|
+
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/popover/index.js#anonymous~12")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/popover/index.js#anonymous~13"));
|
|
276
|
+
return __foldkitBrandViewResult((Message.CompletedPortalPopoverBackdrop()), "@foldkit/ui/popover/index.js#anonymous~11");
|
|
277
|
+
})), "@foldkit/ui/popover/index.js#execute~7"),
|
|
278
|
+
});
|
|
263
279
|
/** Programmatically opens the Popover, updating the Model and returning
|
|
264
280
|
* focus and modal Commands plus an `Opened` OutMessage. */
|
|
265
281
|
export const open = (model) => __foldkitBrandViewResult((update(model, Message.RequestedOpen())), "@foldkit/ui/popover/index.js#open");
|
|
@@ -270,28 +286,28 @@ export const close = (model) => __foldkitBrandViewResult((update(model, Message.
|
|
|
270
286
|
/** Renders a headless popover with a trigger button and a floating panel. */
|
|
271
287
|
export const view = defineView((model, viewInputs, h) => {
|
|
272
288
|
const { id, isOpen, contentFocus, animation: { transitionState }, maybeLastButtonPointerType, } = model;
|
|
273
|
-
const { anchor, toView, isDisabled, focusSelector, ariaLabel, ariaLabelledBy, } = viewInputs;
|
|
289
|
+
const { anchor, toView, isDisabled, focusSelector, arrowPadding, ariaLabel, ariaLabelledBy, } = viewInputs;
|
|
274
290
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
275
291
|
const isVisible = isOpen || isLeaving;
|
|
276
292
|
const animationAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => __foldkitBrandViewResult(([
|
|
277
293
|
h.DataAttribute('closed', ''),
|
|
278
294
|
h.DataAttribute('enter', ''),
|
|
279
295
|
h.DataAttribute('transition', ''),
|
|
280
|
-
]), "@foldkit/ui/popover/index.js#anonymous~
|
|
296
|
+
]), "@foldkit/ui/popover/index.js#anonymous~15")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
281
297
|
h.DataAttribute('enter', ''),
|
|
282
298
|
h.DataAttribute('transition', ''),
|
|
283
|
-
]), "@foldkit/ui/popover/index.js#anonymous~
|
|
299
|
+
]), "@foldkit/ui/popover/index.js#anonymous~16")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
284
300
|
h.DataAttribute('leave', ''),
|
|
285
301
|
h.DataAttribute('transition', ''),
|
|
286
|
-
]), "@foldkit/ui/popover/index.js#anonymous~
|
|
302
|
+
]), "@foldkit/ui/popover/index.js#anonymous~17")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
287
303
|
h.DataAttribute('closed', ''),
|
|
288
304
|
h.DataAttribute('leave', ''),
|
|
289
305
|
h.DataAttribute('transition', ''),
|
|
290
|
-
]), "@foldkit/ui/popover/index.js#anonymous~
|
|
291
|
-
const handleButtonKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(isOpen ? Message.RequestedClose() : Message.RequestedOpen())), "@foldkit/ui/popover/index.js#anonymous~
|
|
306
|
+
]), "@foldkit/ui/popover/index.js#anonymous~18")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/popover/index.js#anonymous~19")));
|
|
307
|
+
const handleButtonKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(isOpen ? Message.RequestedClose() : Message.RequestedOpen())), "@foldkit/ui/popover/index.js#anonymous~20")), M.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~21")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~22")))), "@foldkit/ui/popover/index.js#handleButtonKeyDown");
|
|
292
308
|
const handleButtonPointerDown = (pointerType, button) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnButton({ pointerType, button }))), "@foldkit/ui/popover/index.js#handleButtonPointerDown");
|
|
293
309
|
const handleButtonClick = () => {
|
|
294
|
-
const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/popover/index.js#anonymous~
|
|
310
|
+
const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/popover/index.js#anonymous~23"));
|
|
295
311
|
if (isMouse) {
|
|
296
312
|
return __foldkitBrandViewResult((Message.IgnoredMouseClick()), "@foldkit/ui/popover/index.js#handleButtonClick");
|
|
297
313
|
}
|
|
@@ -303,7 +319,7 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
303
319
|
}
|
|
304
320
|
};
|
|
305
321
|
const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', Message.SuppressedSpaceScroll())), "@foldkit/ui/popover/index.js#handleSpaceKeyUp");
|
|
306
|
-
const handlePanelKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~
|
|
322
|
+
const handlePanelKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~24")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~25")))), "@foldkit/ui/popover/index.js#handlePanelKeyDown");
|
|
307
323
|
const resolveButtonLabel = () => {
|
|
308
324
|
if (Predicate.isNotUndefined(ariaLabel)) {
|
|
309
325
|
return __foldkitBrandViewResult(([h.AriaLabel(ariaLabel)]), "@foldkit/ui/popover/index.js#resolveButtonLabel");
|
|
@@ -345,6 +361,8 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
345
361
|
buttonId: `${id}-button`,
|
|
346
362
|
anchor,
|
|
347
363
|
...(focusSelector !== undefined && { focusSelector }),
|
|
364
|
+
arrowId: arrowId(id),
|
|
365
|
+
...(arrowPadding !== undefined && { arrowPadding }),
|
|
348
366
|
})),
|
|
349
367
|
...animationAttributes,
|
|
350
368
|
...(isLeaving
|
|
@@ -358,10 +376,12 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
358
376
|
h.OnMount(PortalPopoverBackdrop()),
|
|
359
377
|
...(isLeaving ? [] : [h.OnClick(Message.RequestedClose())]),
|
|
360
378
|
];
|
|
379
|
+
const arrowAttributes = [h.Id(arrowId(id)), h.AriaHidden(true)];
|
|
361
380
|
return __foldkitBrandViewResult((toView({
|
|
362
381
|
button: childAttributes(buttonAttributes),
|
|
363
382
|
panel: childAttributes(panelAttributes),
|
|
364
383
|
backdrop: childAttributes(backdropAttributes),
|
|
384
|
+
arrow: childAttributes(arrowAttributes),
|
|
365
385
|
isVisible,
|
|
366
|
-
})), "@foldkit/ui/popover/index.js#anonymous~
|
|
386
|
+
})), "@foldkit/ui/popover/index.js#anonymous~14");
|
|
367
387
|
});
|
package/dist/popover/public.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, open, close, view, buttonId, Model, Message, OutMessage, type Opened, type Closed, type RequestedOpen, type RequestedClose, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, type BlurredPanel, type PressedPointerOnButton, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
|
|
1
|
+
export { init, update, open, close, view, buttonId, arrowId, Model, Message, OutMessage, type Opened, type Closed, type RequestedOpen, type RequestedClose, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, type BlurredPanel, type PressedPointerOnButton, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewInputs, RenderInfo } from './index.js';
|
|
3
3
|
export type { AnchorConfig } from '../anchor/index.js';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,EAC5B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,EAC5B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/popover/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, view, buttonId, Model, Message, OutMessage, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
1
|
+
export { init, update, open, close, view, buttonId, arrowId, Model, Message, OutMessage, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EAKN,MAAM,EAEN,MAAM,IAAI,CAAC,EAEZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAA;AAE9D,OAAO,EAAE,O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CAAC,CAAA;AAEF;;uEAEuE;AACvE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAVP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;gBACR,MAAM;qBACD,MAAM;GAyExB,CAAA"}
|
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -52,14 +52,18 @@ export const WaitBeforeShowing = Command.define('WaitBeforeShowing', {
|
|
|
52
52
|
execute: ({ delay, version }) => __foldkitBrandViewResult((Effect.sleep(delay).pipe(Effect.as(Message.CompletedWaitBeforeShowing({ version })))), "@foldkit/ui/tooltip/tooltip.js#execute"),
|
|
53
53
|
});
|
|
54
54
|
/** The anchor-positioning Mount this Tooltip renders on its panel. */
|
|
55
|
-
export const AnchorTooltip = Mount.define('AnchorTooltip', {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
export const AnchorTooltip = Mount.define('AnchorTooltip', {
|
|
56
|
+
args: { buttonId: S.String, anchor: AnchorConfig },
|
|
57
|
+
messages: [Message.CompletedAnchorTooltip],
|
|
58
|
+
execute: ({ element, buttonId, anchor }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
59
|
+
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((anchorSetup(element, {
|
|
60
|
+
buttonId,
|
|
61
|
+
anchor,
|
|
62
|
+
interceptTab: false,
|
|
63
|
+
})), "@foldkit/ui/tooltip/tooltip.js#anonymous~2")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/tooltip/tooltip.js#anonymous~3"));
|
|
64
|
+
return __foldkitBrandViewResult((Message.CompletedAnchorTooltip()), "@foldkit/ui/tooltip/tooltip.js#anonymous");
|
|
65
|
+
})), "@foldkit/ui/tooltip/tooltip.js#execute~2"),
|
|
66
|
+
});
|
|
63
67
|
const computeUpdate = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
64
68
|
EnteredTrigger: () => {
|
|
65
69
|
if (model.isOpen || model.isDismissed) {
|
|
@@ -164,7 +168,7 @@ export const update = (model, message) => {
|
|
|
164
168
|
/** Reflects an externally-sourced hover show-delay onto the Model without
|
|
165
169
|
* emitting an OutMessage. Use to mirror an external config value (a user
|
|
166
170
|
* preference, a restored setting) onto the tooltip. */
|
|
167
|
-
export const reflectShowDelay = Function.dual(2, (model, showDelay) => __foldkitBrandViewResult((evo(model, { showDelay: () => __foldkitBrandViewResult((Duration.fromInputUnsafe(showDelay)), "@foldkit/ui/tooltip/tooltip.js#showDelay") })), "@foldkit/ui/tooltip/tooltip.js#anonymous~
|
|
171
|
+
export const reflectShowDelay = Function.dual(2, (model, showDelay) => __foldkitBrandViewResult((evo(model, { showDelay: () => __foldkitBrandViewResult((Duration.fromInputUnsafe(showDelay)), "@foldkit/ui/tooltip/tooltip.js#showDelay") })), "@foldkit/ui/tooltip/tooltip.js#anonymous~4"));
|
|
168
172
|
/** Renders a headless tooltip with an anchored non-interactive panel.
|
|
169
173
|
* Shows on hover (after delay) or focus (from keyboard, touch, or pen;
|
|
170
174
|
* mouse-click focus is excluded). Hides on leave, blur, or Escape. */
|
|
@@ -183,7 +187,7 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
183
187
|
}
|
|
184
188
|
};
|
|
185
189
|
const triggerLabelAttributes = resolveTriggerLabel();
|
|
186
|
-
const handleTriggerKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, Message.PressedEscape())), "@foldkit/ui/tooltip/tooltip.js#anonymous~
|
|
190
|
+
const handleTriggerKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, Message.PressedEscape())), "@foldkit/ui/tooltip/tooltip.js#anonymous~6")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/tooltip.js#anonymous~7")))), "@foldkit/ui/tooltip/tooltip.js#handleTriggerKeyDown");
|
|
187
191
|
const handleTriggerPointerDown = (pointerType) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnTrigger({ pointerType }))), "@foldkit/ui/tooltip/tooltip.js#handleTriggerPointerDown");
|
|
188
192
|
const triggerAttributes = [
|
|
189
193
|
h.Id(triggerId(id)),
|
|
@@ -218,5 +222,5 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
218
222
|
trigger: childAttributes(triggerAttributes),
|
|
219
223
|
panel: childAttributes(panelAttributes),
|
|
220
224
|
isVisible: isOpen,
|
|
221
|
-
})), "@foldkit/ui/tooltip/tooltip.js#anonymous~
|
|
225
|
+
})), "@foldkit/ui/tooltip/tooltip.js#anonymous~5");
|
|
222
226
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.154.0-canary.4e7d8d4010be",
|
|
4
4
|
"description": "Headless, accessible UI components for Foldkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
],
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"effect": "4.0.0-rc.112",
|
|
121
|
-
"foldkit": "
|
|
121
|
+
"foldkit": "0.154.0-canary.4e7d8d4010be"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@floating-ui/dom": "^1.7.6"
|
|
@@ -131,8 +131,8 @@
|
|
|
131
131
|
"typedoc": "^0.28.19",
|
|
132
132
|
"typescript": "^6.0.3",
|
|
133
133
|
"vitest": "^4.1.9",
|
|
134
|
-
"@foldkit/vite-plugin": "0.19.0",
|
|
135
|
-
"foldkit": "0.
|
|
134
|
+
"@foldkit/vite-plugin": "0.19.0-canary.4e7d8d4010be",
|
|
135
|
+
"foldkit": "0.154.0-canary.4e7d8d4010be"
|
|
136
136
|
},
|
|
137
137
|
"keywords": [
|
|
138
138
|
"foldkit",
|