@yewdiel21/motion-kit 0.10.0 → 0.14.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 +155 -93
- package/dist/auto/index.d.ts +53 -3
- package/dist/auto/index.js +101 -3
- package/dist/auto/index.js.map +1 -1
- package/dist/{chunk-IKQ5FODN.js → chunk-6P4P7NU6.js} +2 -218
- package/dist/chunk-6P4P7NU6.js.map +1 -0
- package/dist/chunk-CU6SXW3E.js +20334 -0
- package/dist/chunk-CU6SXW3E.js.map +1 -0
- package/dist/{chunk-XAKC2QY7.js → chunk-EY4BJKC4.js} +3 -28
- package/dist/chunk-EY4BJKC4.js.map +1 -0
- package/dist/chunk-QP4QJOEN.js +72 -0
- package/dist/chunk-QP4QJOEN.js.map +1 -0
- package/dist/css/components/activity-feed.css +240 -0
- package/dist/css/components/attachment.css +266 -0
- package/dist/css/components/breadcrumb.css +110 -0
- package/dist/css/components/chart-tooltip.css +168 -0
- package/dist/css/components/chart.css +296 -0
- package/dist/css/components/code-block.css +264 -0
- package/dist/css/components/color-area.css +82 -0
- package/dist/css/components/color-field.css +67 -0
- package/dist/css/components/color-picker.css +131 -0
- package/dist/css/components/color-slider.css +113 -0
- package/dist/css/components/command-search.css +252 -0
- package/dist/css/components/context-menu.css +23 -0
- package/dist/css/components/credit-card.css +288 -0
- package/dist/css/components/data-table.css +591 -0
- package/dist/css/components/date-range-picker.css +168 -0
- package/dist/css/components/date-time-picker.css +178 -0
- package/dist/css/components/drawer.css +58 -0
- package/dist/css/components/editable-table.css +201 -0
- package/dist/css/components/empty-state.css +61 -0
- package/dist/css/components/file-explorer.css +633 -0
- package/dist/css/components/filter-builder.css +232 -0
- package/dist/css/components/hold-confirm.css +87 -0
- package/dist/css/components/hover-card.css +13 -7
- package/dist/css/components/image-preview.css +195 -0
- package/dist/css/components/json-viewer.css +272 -0
- package/dist/css/components/like-button.css +78 -0
- package/dist/css/components/link-preview.css +275 -0
- package/dist/css/components/loading-button.css +77 -0
- package/dist/css/components/multi-select.css +267 -0
- package/dist/css/components/notification-bell.css +127 -0
- package/dist/css/components/password-strength.css +183 -0
- package/dist/css/components/popover.css +25 -0
- package/dist/css/components/progress.css +140 -0
- package/dist/css/components/questionnaire.css +217 -0
- package/dist/css/components/range-calendar.css +186 -0
- package/dist/css/components/range-slider.css +192 -0
- package/dist/css/components/resizable-panel.css +243 -0
- package/dist/css/components/rich-text-editor.css +284 -0
- package/dist/css/components/scratch-card.css +75 -0
- package/dist/css/components/skeleton.css +108 -0
- package/dist/css/components/split-view.css +19 -0
- package/dist/css/components/star-rating.css +80 -0
- package/dist/css/components/stat-card.css +164 -0
- package/dist/css/components/swipe-actions.css +105 -0
- package/dist/css/components/tag-input.css +244 -0
- package/dist/css/components/time-field.css +88 -0
- package/dist/css/components/timeline.css +219 -0
- package/dist/css/components/tooltip.css +79 -0
- package/dist/css/components/tree-view.css +210 -0
- package/dist/css/components/virtual-list.css +195 -0
- package/dist/css/tokens.css +185 -181
- package/dist/elements/index.d.ts +674 -5
- package/dist/elements/index.js +1361 -8
- package/dist/elements/index.js.map +1 -1
- package/dist/{engine-GDGwQnJE.d.ts → engine-Cn6IhE3z.d.ts} +1 -1
- package/dist/engine-QECQnGz1.d.ts +33 -0
- package/dist/index.css +9104 -189
- package/dist/index.d.ts +89 -5
- package/dist/index.js +243 -9
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +579 -23
- package/dist/react/index.js +2042 -7
- package/dist/react/index.js.map +1 -1
- package/dist/{reduced-BmBzKH94.d.ts → reduced-BBUusld6.d.ts} +9 -2
- package/dist/reveal-DEvp6U6T.d.ts +2381 -0
- package/dist/{store-DYb3tTsZ.d.ts → store-DjkTBX7f.d.ts} +2 -2
- package/package.json +1 -1
- package/registry.json +406 -1
- package/src/auto/auto-init.ts +98 -0
- package/src/components/activity-feed/README.md +56 -0
- package/src/components/activity-feed/activity-feed.css +239 -0
- package/src/components/activity-feed/element.ts +36 -0
- package/src/components/activity-feed/engine.ts +351 -0
- package/src/components/activity-feed/react.tsx +32 -0
- package/src/components/attachment/README.md +27 -0
- package/src/components/attachment/attachment.css +265 -0
- package/src/components/attachment/element.ts +50 -0
- package/src/components/attachment/engine.ts +469 -0
- package/src/components/attachment/react.tsx +65 -0
- package/src/components/breadcrumb/README.md +38 -0
- package/src/components/breadcrumb/breadcrumb.css +109 -0
- package/src/components/breadcrumb/element.ts +27 -0
- package/src/components/breadcrumb/engine.ts +249 -0
- package/src/components/breadcrumb/react.tsx +30 -0
- package/src/components/chart/README.md +24 -0
- package/src/components/chart/chart.css +295 -0
- package/src/components/chart/element.ts +41 -0
- package/src/components/chart/engine.ts +811 -0
- package/src/components/chart/react.tsx +50 -0
- package/src/components/chart-tooltip/README.md +53 -0
- package/src/components/chart-tooltip/chart-tooltip.css +167 -0
- package/src/components/chart-tooltip/element.ts +37 -0
- package/src/components/chart-tooltip/engine.ts +442 -0
- package/src/components/chart-tooltip/react.tsx +47 -0
- package/src/components/code-block/README.md +19 -0
- package/src/components/code-block/code-block.css +263 -0
- package/src/components/code-block/element.ts +34 -0
- package/src/components/code-block/engine.ts +254 -0
- package/src/components/code-block/highlight.ts +244 -0
- package/src/components/code-block/react.tsx +94 -0
- package/src/components/color-area/README.md +50 -0
- package/src/components/color-area/color-area.css +81 -0
- package/src/components/color-area/element.ts +26 -0
- package/src/components/color-area/engine.ts +246 -0
- package/src/components/color-area/react.tsx +42 -0
- package/src/components/color-field/README.md +43 -0
- package/src/components/color-field/color-field.css +66 -0
- package/src/components/color-field/element.ts +26 -0
- package/src/components/color-field/engine.ts +174 -0
- package/src/components/color-field/react.tsx +42 -0
- package/src/components/color-picker/README.md +45 -0
- package/src/components/color-picker/color-picker.css +130 -0
- package/src/components/color-picker/element.ts +45 -0
- package/src/components/color-picker/engine.ts +314 -0
- package/src/components/color-picker/react.tsx +47 -0
- package/src/components/color-slider/README.md +55 -0
- package/src/components/color-slider/color-slider.css +112 -0
- package/src/components/color-slider/element.ts +26 -0
- package/src/components/color-slider/engine.ts +234 -0
- package/src/components/color-slider/react.tsx +45 -0
- package/src/components/command-search/README.md +15 -0
- package/src/components/command-search/command-search.css +251 -0
- package/src/components/command-search/element.ts +36 -0
- package/src/components/command-search/engine.ts +356 -0
- package/src/components/command-search/match.ts +53 -0
- package/src/components/command-search/react.tsx +66 -0
- package/src/components/context-menu/README.md +31 -0
- package/src/components/context-menu/context-menu.css +22 -0
- package/src/components/context-menu/element.ts +40 -0
- package/src/components/context-menu/engine.ts +153 -0
- package/src/components/context-menu/react.tsx +57 -0
- package/src/components/credit-card/README.md +20 -0
- package/src/components/credit-card/card.ts +77 -0
- package/src/components/credit-card/credit-card.css +287 -0
- package/src/components/credit-card/element.ts +33 -0
- package/src/components/credit-card/engine.ts +410 -0
- package/src/components/credit-card/react.tsx +36 -0
- package/src/components/data-table/README.md +83 -0
- package/src/components/data-table/data-table.css +590 -0
- package/src/components/data-table/element.ts +54 -0
- package/src/components/data-table/engine.ts +1059 -0
- package/src/components/data-table/react.tsx +94 -0
- package/src/components/date-range-picker/README.md +51 -0
- package/src/components/date-range-picker/date-range-picker.css +167 -0
- package/src/components/date-range-picker/element.ts +52 -0
- package/src/components/date-range-picker/engine.ts +352 -0
- package/src/components/date-range-picker/react.tsx +57 -0
- package/src/components/date-time-picker/README.md +48 -0
- package/src/components/date-time-picker/date-time-picker.css +177 -0
- package/src/components/date-time-picker/element.ts +47 -0
- package/src/components/date-time-picker/engine.ts +350 -0
- package/src/components/date-time-picker/react.tsx +54 -0
- package/src/components/dialog/README.md +103 -102
- package/src/components/dialog/element.ts +123 -118
- package/src/components/dialog/engine.ts +449 -432
- package/src/components/drawer/README.md +28 -0
- package/src/components/drawer/drawer.css +57 -0
- package/src/components/drawer/element.ts +21 -0
- package/src/components/drawer/engine.ts +56 -0
- package/src/components/drawer/react.tsx +85 -0
- package/src/components/editable-table/README.md +67 -0
- package/src/components/editable-table/editable-table.css +200 -0
- package/src/components/editable-table/element.ts +45 -0
- package/src/components/editable-table/engine.ts +775 -0
- package/src/components/editable-table/react.tsx +79 -0
- package/src/components/empty-state/README.md +41 -0
- package/src/components/empty-state/element.ts +23 -0
- package/src/components/empty-state/empty-state.css +60 -0
- package/src/components/empty-state/engine.ts +232 -0
- package/src/components/empty-state/react.tsx +34 -0
- package/src/components/file-explorer/README.md +67 -0
- package/src/components/file-explorer/element.ts +39 -0
- package/src/components/file-explorer/engine.ts +1307 -0
- package/src/components/file-explorer/file-explorer.css +632 -0
- package/src/components/file-explorer/react.tsx +77 -0
- package/src/components/filter-builder/README.md +47 -0
- package/src/components/filter-builder/element.ts +34 -0
- package/src/components/filter-builder/engine.ts +365 -0
- package/src/components/filter-builder/filter-builder.css +231 -0
- package/src/components/filter-builder/react.tsx +36 -0
- package/src/components/hold-confirm/README.md +13 -0
- package/src/components/hold-confirm/element.ts +24 -0
- package/src/components/hold-confirm/engine.ts +216 -0
- package/src/components/hold-confirm/hold-confirm.css +86 -0
- package/src/components/hold-confirm/react.tsx +28 -0
- package/src/components/hover-card/README.md +6 -2
- package/src/components/hover-card/engine.ts +68 -6
- package/src/components/hover-card/hover-card.css +13 -7
- package/src/components/image-preview/README.md +16 -0
- package/src/components/image-preview/element.ts +26 -0
- package/src/components/image-preview/engine.ts +325 -0
- package/src/components/image-preview/image-preview.css +194 -0
- package/src/components/image-preview/react.tsx +43 -0
- package/src/components/json-viewer/README.md +56 -0
- package/src/components/json-viewer/element.ts +37 -0
- package/src/components/json-viewer/engine.ts +440 -0
- package/src/components/json-viewer/json-viewer.css +271 -0
- package/src/components/json-viewer/react.tsx +56 -0
- package/src/components/like-button/README.md +13 -0
- package/src/components/like-button/element.ts +47 -0
- package/src/components/like-button/engine.ts +145 -0
- package/src/components/like-button/like-button.css +77 -0
- package/src/components/like-button/react.tsx +39 -0
- package/src/components/link-preview/README.md +19 -0
- package/src/components/link-preview/element.ts +29 -0
- package/src/components/link-preview/engine.ts +192 -0
- package/src/components/link-preview/link-preview.css +274 -0
- package/src/components/link-preview/react.tsx +101 -0
- package/src/components/loading-button/README.md +45 -0
- package/src/components/loading-button/element.ts +34 -0
- package/src/components/loading-button/engine.ts +201 -0
- package/src/components/loading-button/loading-button.css +76 -0
- package/src/components/loading-button/react.tsx +43 -0
- package/src/components/multi-select/README.md +48 -0
- package/src/components/multi-select/element.ts +28 -0
- package/src/components/multi-select/engine.ts +294 -0
- package/src/components/multi-select/multi-select.css +266 -0
- package/src/components/multi-select/react.tsx +39 -0
- package/src/components/notification-bell/README.md +14 -0
- package/src/components/notification-bell/element.ts +48 -0
- package/src/components/notification-bell/engine.ts +202 -0
- package/src/components/notification-bell/notification-bell.css +126 -0
- package/src/components/notification-bell/react.tsx +57 -0
- package/src/components/password-strength/README.md +17 -0
- package/src/components/password-strength/element.ts +22 -0
- package/src/components/password-strength/engine.ts +212 -0
- package/src/components/password-strength/password-strength.css +182 -0
- package/src/components/password-strength/react.tsx +36 -0
- package/src/components/password-strength/score.ts +62 -0
- package/src/components/popover/README.md +44 -0
- package/src/components/popover/element.ts +31 -0
- package/src/components/popover/engine.ts +114 -0
- package/src/components/popover/popover.css +24 -0
- package/src/components/popover/react.tsx +50 -0
- package/src/components/progress/README.md +17 -0
- package/src/components/progress/element.ts +30 -0
- package/src/components/progress/engine.ts +173 -0
- package/src/components/progress/progress.css +139 -0
- package/src/components/progress/react.tsx +35 -0
- package/src/components/questionnaire/README.md +32 -0
- package/src/components/questionnaire/element.ts +118 -0
- package/src/components/questionnaire/engine.ts +255 -0
- package/src/components/questionnaire/questionnaire.css +216 -0
- package/src/components/questionnaire/react.tsx +140 -0
- package/src/components/range-calendar/README.md +58 -0
- package/src/components/range-calendar/element.ts +42 -0
- package/src/components/range-calendar/engine.ts +390 -0
- package/src/components/range-calendar/range-calendar.css +185 -0
- package/src/components/range-calendar/react.tsx +56 -0
- package/src/components/range-slider/README.md +23 -0
- package/src/components/range-slider/element.ts +53 -0
- package/src/components/range-slider/engine.ts +316 -0
- package/src/components/range-slider/range-slider.css +191 -0
- package/src/components/range-slider/react.tsx +66 -0
- package/src/components/resizable-panel/README.md +61 -0
- package/src/components/resizable-panel/element.ts +36 -0
- package/src/components/resizable-panel/engine.ts +551 -0
- package/src/components/resizable-panel/react.tsx +74 -0
- package/src/components/resizable-panel/resizable-panel.css +242 -0
- package/src/components/rich-text-editor/README.md +57 -0
- package/src/components/rich-text-editor/element.ts +34 -0
- package/src/components/rich-text-editor/engine.ts +673 -0
- package/src/components/rich-text-editor/react.tsx +60 -0
- package/src/components/rich-text-editor/rich-text-editor.css +283 -0
- package/src/components/scratch-card/README.md +15 -0
- package/src/components/scratch-card/element.ts +30 -0
- package/src/components/scratch-card/engine.ts +257 -0
- package/src/components/scratch-card/react.tsx +40 -0
- package/src/components/scratch-card/scratch-card.css +74 -0
- package/src/components/skeleton/README.md +15 -0
- package/src/components/skeleton/element.ts +32 -0
- package/src/components/skeleton/engine.ts +104 -0
- package/src/components/skeleton/react.tsx +41 -0
- package/src/components/skeleton/skeleton.css +107 -0
- package/src/components/split-view/README.md +50 -0
- package/src/components/split-view/element.ts +34 -0
- package/src/components/split-view/engine.ts +114 -0
- package/src/components/split-view/react.tsx +63 -0
- package/src/components/split-view/split-view.css +18 -0
- package/src/components/star-rating/README.md +14 -0
- package/src/components/star-rating/element.ts +26 -0
- package/src/components/star-rating/engine.ts +217 -0
- package/src/components/star-rating/react.tsx +33 -0
- package/src/components/star-rating/star-rating.css +79 -0
- package/src/components/stat-card/README.md +42 -0
- package/src/components/stat-card/element.ts +40 -0
- package/src/components/stat-card/engine.ts +283 -0
- package/src/components/stat-card/react.tsx +36 -0
- package/src/components/stat-card/stat-card.css +163 -0
- package/src/components/swipe-actions/README.md +19 -0
- package/src/components/swipe-actions/element.ts +26 -0
- package/src/components/swipe-actions/engine.ts +260 -0
- package/src/components/swipe-actions/react.tsx +80 -0
- package/src/components/swipe-actions/swipe-actions.css +104 -0
- package/src/components/tag-input/README.md +42 -0
- package/src/components/tag-input/element.ts +39 -0
- package/src/components/tag-input/engine.ts +313 -0
- package/src/components/tag-input/react.tsx +54 -0
- package/src/components/tag-input/tag-input.css +243 -0
- package/src/components/time-field/README.md +54 -0
- package/src/components/time-field/element.ts +38 -0
- package/src/components/time-field/engine.ts +110 -0
- package/src/components/time-field/react.tsx +45 -0
- package/src/components/time-field/time-field.css +87 -0
- package/src/components/timeline/README.md +57 -0
- package/src/components/timeline/element.ts +31 -0
- package/src/components/timeline/engine.ts +300 -0
- package/src/components/timeline/react.tsx +59 -0
- package/src/components/timeline/timeline.css +218 -0
- package/src/components/tooltip/README.md +46 -0
- package/src/components/tooltip/element.ts +22 -0
- package/src/components/tooltip/engine.ts +288 -0
- package/src/components/tooltip/react.tsx +30 -0
- package/src/components/tooltip/tooltip.css +78 -0
- package/src/components/tree-view/README.md +61 -0
- package/src/components/tree-view/element.ts +32 -0
- package/src/components/tree-view/engine.ts +569 -0
- package/src/components/tree-view/react.tsx +78 -0
- package/src/components/tree-view/tree-view.css +209 -0
- package/src/components/virtual-list/README.md +81 -0
- package/src/components/virtual-list/element.ts +42 -0
- package/src/components/virtual-list/engine.ts +678 -0
- package/src/components/virtual-list/react.tsx +101 -0
- package/src/components/virtual-list/virtual-list.css +194 -0
- package/src/core/chips.ts +196 -0
- package/src/core/color.ts +304 -0
- package/src/core/date-range.ts +67 -0
- package/src/core/dates.ts +11 -1
- package/src/core/files.ts +107 -0
- package/src/core/filter.ts +229 -0
- package/src/core/gsap.ts +80 -65
- package/src/core/listbox.ts +332 -0
- package/src/core/mark.ts +29 -0
- package/src/core/position.ts +89 -0
- package/src/core/relative-time.ts +77 -0
- package/src/core/segment-field.ts +373 -0
- package/src/core/segments.ts +153 -0
- package/src/core/tree.ts +116 -0
- package/src/core/virtual.ts +79 -0
- package/src/css/tokens.css +186 -182
- package/src/elements/index.ts +147 -0
- package/src/index.ts +72 -0
- package/src/motion/micro.ts +248 -0
- package/src/motion/sheet.ts +88 -65
- package/src/motion/surface.ts +9 -0
- package/src/react/index.ts +57 -0
- package/dist/chunk-IKQ5FODN.js.map +0 -1
- package/dist/chunk-J6OCFNGU.js +0 -177
- package/dist/chunk-J6OCFNGU.js.map +0 -1
- package/dist/chunk-TFNRIZHU.js +0 -3977
- package/dist/chunk-TFNRIZHU.js.map +0 -1
- package/dist/chunk-XAKC2QY7.js.map +0 -1
- package/dist/reveal-jsX-uwUz.d.ts +0 -625
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef, useState, type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from 'react';
|
|
3
|
+
import { useIsomorphicLayoutEffect, useLatest } from '../../react/use-recipe';
|
|
4
|
+
import type { VirtualRange } from '../../core/virtual';
|
|
5
|
+
import { createVirtualList, type VirtualKey, type VirtualListInstance, type VirtualListOptions, type VirtualScrollOptions } from './engine';
|
|
6
|
+
|
|
7
|
+
export interface VirtualListProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect' | 'children'>, Omit<VirtualListOptions<T>, 'items' | 'renderItem' | 'onRange'> {
|
|
8
|
+
items: T[];
|
|
9
|
+
/** A row's content; without it, its text. */
|
|
10
|
+
renderItem?: (item: T, index: number) => ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface VirtualListHandle {
|
|
14
|
+
scrollToIndex(index: number, options?: VirtualScrollOptions): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const keyFor = <T,>(getKey: VirtualListOptions<T>['getKey'], item: T, index: number): VirtualKey => {
|
|
18
|
+
if (getKey) return getKey(item, index);
|
|
19
|
+
const id = item && typeof item === 'object' ? (item as { id?: unknown }).id : undefined;
|
|
20
|
+
return typeof id === 'string' || typeof id === 'number' ? id : index;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* <VirtualList items={rows} itemHeight={44} renderItem={(row) => <Row {...row} />} selectable="multiple" />.
|
|
25
|
+
* React renders only the rows in view; the engine adopts its viewport, and places, measures and picks the rows.
|
|
26
|
+
*/
|
|
27
|
+
function VirtualListInner<T>(
|
|
28
|
+
{ items, renderItem, itemHeight, estimatedHeight, overscan, itemText, getKey, selectable, selected, label, emptyLabel, locale, onSelect, onActivate, onEndReached, className, ...props }: VirtualListProps<T>,
|
|
29
|
+
handle: Ref<VirtualListHandle>,
|
|
30
|
+
) {
|
|
31
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
32
|
+
const instance = useRef<VirtualListInstance<T> | null>(null);
|
|
33
|
+
const [range, setRange] = useState<VirtualRange>({ start: 0, end: 0 });
|
|
34
|
+
const shown = useRef(items);
|
|
35
|
+
const select = useLatest(onSelect);
|
|
36
|
+
const activate = useLatest(onActivate);
|
|
37
|
+
const more = useLatest(onEndReached);
|
|
38
|
+
const text = useLatest(itemText);
|
|
39
|
+
const key = useLatest(getKey);
|
|
40
|
+
useImperativeHandle(handle, () => ({ scrollToIndex: (index, options) => instance.current?.scrollToIndex(index, options) }), []);
|
|
41
|
+
const custom = Boolean(renderItem);
|
|
42
|
+
useIsomorphicLayoutEffect(() => {
|
|
43
|
+
const created = createVirtualList<T>(ref.current, {
|
|
44
|
+
items: shown.current,
|
|
45
|
+
itemHeight,
|
|
46
|
+
estimatedHeight,
|
|
47
|
+
overscan,
|
|
48
|
+
selectable,
|
|
49
|
+
selected,
|
|
50
|
+
label,
|
|
51
|
+
emptyLabel,
|
|
52
|
+
locale,
|
|
53
|
+
itemText: itemText ? (item) => text.current?.(item) ?? '' : undefined,
|
|
54
|
+
getKey: (item, index) => keyFor(key.current, item, index),
|
|
55
|
+
onSelect: (keys, chosen) => select.current?.(keys, chosen),
|
|
56
|
+
onActivate: (item, index) => activate.current?.(item, index),
|
|
57
|
+
onEndReached: onEndReached ? () => more.current?.() : undefined,
|
|
58
|
+
onRange: custom ? setRange : undefined,
|
|
59
|
+
});
|
|
60
|
+
instance.current = created;
|
|
61
|
+
return () => {
|
|
62
|
+
created.destroy();
|
|
63
|
+
instance.current = null;
|
|
64
|
+
};
|
|
65
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
+
}, [itemHeight, estimatedHeight, overscan, String(selectable), label, emptyLabel, locale, custom, Boolean(onEndReached), Boolean(itemText)]);
|
|
67
|
+
useIsomorphicLayoutEffect(() => {
|
|
68
|
+
if (shown.current === items) return;
|
|
69
|
+
shown.current = items;
|
|
70
|
+
instance.current?.setItems(items);
|
|
71
|
+
}, [items]);
|
|
72
|
+
const selectedKey = JSON.stringify(selected ?? null);
|
|
73
|
+
useIsomorphicLayoutEffect(() => {
|
|
74
|
+
if (selected && instance.current && JSON.stringify(instance.current.selected) !== JSON.stringify(selected)) instance.current.select(selected);
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
+
}, [selectedKey]);
|
|
77
|
+
// After React drew the window: place and measure it.
|
|
78
|
+
useIsomorphicLayoutEffect(() => {
|
|
79
|
+
if (custom) instance.current?.refresh();
|
|
80
|
+
});
|
|
81
|
+
return (
|
|
82
|
+
<div {...props} ref={ref} className={['mk-virtual-list', className].filter(Boolean).join(' ')}>
|
|
83
|
+
<div data-mk-vl-viewport="">
|
|
84
|
+
<div data-mk-vl-spacer="">
|
|
85
|
+
{renderItem
|
|
86
|
+
? items.slice(range.start, Math.min(range.end, items.length)).map((item, i) => {
|
|
87
|
+
const index = range.start + i;
|
|
88
|
+
return (
|
|
89
|
+
<div key={keyFor(getKey, item, index)} data-mk-vl-item="" data-index={index}>
|
|
90
|
+
{renderItem(item, index)}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
})
|
|
94
|
+
: null}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const VirtualList = forwardRef(VirtualListInner) as <T>(props: VirtualListProps<T> & { ref?: Ref<VirtualListHandle> }) => ReactElement;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/* virtual-list — a 12 px box on surface-1 that scrolls inside (--mk-vl-height, 24rem); the rows sit on a spacer as tall
|
|
2
|
+
as all of them. Chosen rows take accent-soft and a check that pops; a 2 px accent ring glides between rows for the
|
|
3
|
+
keyboard; a row reached with scrollToIndex() flashes; the position pill (8 px, inverse glass) rides the right edge
|
|
4
|
+
while scrolling. */
|
|
5
|
+
.mk-virtual-list,
|
|
6
|
+
mk-virtual-list {
|
|
7
|
+
--mk-vl-height: 24rem;
|
|
8
|
+
position: relative;
|
|
9
|
+
display: block;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
color: var(--mk-text);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[data-mk-vl-viewport] {
|
|
15
|
+
position: relative;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
height: var(--mk-vl-height);
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
border: 1px solid var(--mk-outline-soft);
|
|
20
|
+
border-radius: 12px;
|
|
21
|
+
outline: none;
|
|
22
|
+
background: var(--mk-surface-1);
|
|
23
|
+
overscroll-behavior: contain;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-mk-vl-viewport]:focus-visible {
|
|
27
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--mk-accent) 35%, transparent);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-mk-vl-spacer] {
|
|
31
|
+
position: relative;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[data-mk-vl-item] {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 0.75rem;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
padding: 0.75rem 1rem;
|
|
46
|
+
border-bottom: 1px solid var(--mk-outline-soft);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[role='listbox'] > [data-mk-vl-spacer] > [data-mk-vl-item] {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
-webkit-user-select: none;
|
|
52
|
+
user-select: none;
|
|
53
|
+
transition:
|
|
54
|
+
background-color 0.15s,
|
|
55
|
+
color 0.15s;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[role='listbox'] > [data-mk-vl-spacer] > [data-mk-vl-item]:hover {
|
|
59
|
+
background: color-mix(in srgb, var(--mk-text) 5%, transparent);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-mk-vl-item][aria-selected='true'],
|
|
63
|
+
[role='listbox'] > [data-mk-vl-spacer] > [data-mk-vl-item][aria-selected='true']:hover {
|
|
64
|
+
background: var(--mk-accent-soft);
|
|
65
|
+
color: var(--mk-on-accent-soft, var(--mk-text));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* The check of a chosen row; it pops only on the row just chosen, not on rows scrolled into view. */
|
|
69
|
+
[role='listbox'] > [data-mk-vl-spacer] > [data-mk-vl-item]::after {
|
|
70
|
+
content: '';
|
|
71
|
+
flex: none;
|
|
72
|
+
width: 1.125rem;
|
|
73
|
+
height: 1.125rem;
|
|
74
|
+
margin-left: auto;
|
|
75
|
+
background: var(--mk-accent);
|
|
76
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
77
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
78
|
+
opacity: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[role='listbox'] > [data-mk-vl-spacer] > [data-mk-vl-item][aria-selected='true']::after {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[data-mk-vl-item][data-mk-vl-just]::after {
|
|
86
|
+
animation: mk-vl-check 0.4s cubic-bezier(0.38, 0.49, 0, 1.5);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@keyframes mk-vl-check {
|
|
90
|
+
from {
|
|
91
|
+
opacity: 0;
|
|
92
|
+
transform: scale(0.3) rotate(-20deg);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-mk-vl-cursor] {
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: 0;
|
|
99
|
+
right: 4px;
|
|
100
|
+
left: 4px;
|
|
101
|
+
z-index: 1;
|
|
102
|
+
border-radius: 8px;
|
|
103
|
+
box-shadow: inset 0 0 0 2px var(--mk-accent);
|
|
104
|
+
opacity: 0;
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
transition: opacity 0.15s;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-mk-vl-viewport]:focus-visible [data-mk-vl-cursor] {
|
|
110
|
+
opacity: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[data-mk-vl-flash] {
|
|
114
|
+
animation: mk-vl-flash 1.2s cubic-bezier(0.38, 0.49, 0, 1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes mk-vl-flash {
|
|
118
|
+
0%,
|
|
119
|
+
30% {
|
|
120
|
+
background-color: color-mix(in srgb, var(--mk-accent) 24%, var(--mk-surface-1));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[data-mk-vl-foot] {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 0;
|
|
127
|
+
right: 0;
|
|
128
|
+
left: 0;
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
gap: 0.5rem;
|
|
133
|
+
height: 48px;
|
|
134
|
+
color: var(--mk-muted);
|
|
135
|
+
font-size: 0.875rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-mk-vl-foot][hidden],
|
|
139
|
+
[data-mk-vl-empty][hidden],
|
|
140
|
+
[data-mk-vl-pill][hidden] {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
[data-mk-vl-foot][aria-busy='true']::before {
|
|
145
|
+
content: '';
|
|
146
|
+
width: 0.875rem;
|
|
147
|
+
height: 0.875rem;
|
|
148
|
+
border: 2px solid currentColor;
|
|
149
|
+
border-right-color: transparent;
|
|
150
|
+
border-radius: 50%;
|
|
151
|
+
animation: mk-vl-spin 0.8s linear infinite;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@keyframes mk-vl-spin {
|
|
155
|
+
to {
|
|
156
|
+
transform: rotate(360deg);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
[data-mk-vl-empty] {
|
|
161
|
+
position: absolute;
|
|
162
|
+
inset: 0;
|
|
163
|
+
display: grid;
|
|
164
|
+
place-items: center;
|
|
165
|
+
margin: 0;
|
|
166
|
+
color: var(--mk-muted);
|
|
167
|
+
font-size: 0.875rem;
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[data-mk-vl-pill] {
|
|
172
|
+
position: absolute;
|
|
173
|
+
top: 0.5rem;
|
|
174
|
+
right: 0.875rem;
|
|
175
|
+
z-index: 2;
|
|
176
|
+
padding: 0.3rem 0.625rem;
|
|
177
|
+
border-radius: 8px;
|
|
178
|
+
background: var(--mk-glass-inverse, var(--mk-text));
|
|
179
|
+
box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--mk-shadow-color, #000) 45%, transparent);
|
|
180
|
+
color: var(--mk-on-glass-inverse, var(--mk-surface-1));
|
|
181
|
+
font-size: 0.75rem;
|
|
182
|
+
font-variant-numeric: tabular-nums;
|
|
183
|
+
font-weight: 600;
|
|
184
|
+
white-space: nowrap;
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media (prefers-reduced-motion: reduce) {
|
|
189
|
+
[data-mk-vl-item][data-mk-vl-just]::after,
|
|
190
|
+
[data-mk-vl-flash],
|
|
191
|
+
[data-mk-vl-foot][aria-busy='true']::before {
|
|
192
|
+
animation: none;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { gsap, EASE, Flip, registerMotion } from './gsap';
|
|
2
|
+
import { reduced } from './reduced';
|
|
3
|
+
import { createScope } from './scope';
|
|
4
|
+
import { TIMING } from './timing';
|
|
5
|
+
import { ringPulse, shake } from '../motion/micro';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Chips (multi-select, tag-input): removable chips in a list. A chip that
|
|
9
|
+
* arrives pops in (scale .6 → 1, blur 6 → 0, pop curve) while the others glide
|
|
10
|
+
* to make room (Flip, layout spring); one that leaves folds away (its width,
|
|
11
|
+
* padding and margin to 0 out of a blur, .22 s) and the rest close the gap.
|
|
12
|
+
* Keyboard: from the field, ← reaches the last chip; ← / → move between chips,
|
|
13
|
+
* Delete or Backspace removes the focused one, → past the last returns to the
|
|
14
|
+
* field. arm() rings a chip that the next Backspace will remove; flash()
|
|
15
|
+
* shakes and rings one (a duplicate, a value already chosen).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export interface ChipItem {
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ChipsOptions {
|
|
24
|
+
/** A chip's remove button wants out. */
|
|
25
|
+
onRemove: (value: string) => void;
|
|
26
|
+
/** The keyboard left the chips towards the field. */
|
|
27
|
+
onExit?: () => void;
|
|
28
|
+
/** Accessible name of a chip's remove button (default 'Quitar <label>'). */
|
|
29
|
+
removeLabel?: (item: ChipItem) => string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Chips {
|
|
34
|
+
readonly element: HTMLUListElement;
|
|
35
|
+
/** Show these chips in this order; arrivals pop in and departures fold away when `animate`. */
|
|
36
|
+
set(items: ChipItem[], animate?: boolean): void;
|
|
37
|
+
/** Ring a chip as the next to go (null: none). */
|
|
38
|
+
arm(value: string | null): void;
|
|
39
|
+
readonly armed: string | null;
|
|
40
|
+
/** Shake and ring a chip. */
|
|
41
|
+
flash(value: string): void;
|
|
42
|
+
/** Focus the last chip (from the field). False when there are none. */
|
|
43
|
+
focusLast(): boolean;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const CLOSE = '<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M7 7l10 10M17 7L7 17"/></svg>';
|
|
48
|
+
|
|
49
|
+
export function createChips(options: ChipsOptions): Chips {
|
|
50
|
+
registerMotion();
|
|
51
|
+
const scope = createScope();
|
|
52
|
+
const list = document.createElement('ul');
|
|
53
|
+
list.dataset.mkChips = '';
|
|
54
|
+
list.setAttribute('role', 'list');
|
|
55
|
+
const effects = new Set<gsap.core.Animation>();
|
|
56
|
+
const keep = (animation: gsap.core.Animation | null) => {
|
|
57
|
+
if (!animation) return;
|
|
58
|
+
effects.add(animation);
|
|
59
|
+
// Finished ones leave as new ones arrive: the animation's own onComplete stays untouched.
|
|
60
|
+
for (const effect of effects) if (effect.totalProgress() === 1) effects.delete(effect);
|
|
61
|
+
};
|
|
62
|
+
scope.add(() => {
|
|
63
|
+
for (const effect of effects) effect.kill();
|
|
64
|
+
effects.clear();
|
|
65
|
+
list.remove();
|
|
66
|
+
});
|
|
67
|
+
let armed: string | null = null;
|
|
68
|
+
|
|
69
|
+
const chipOf = (value: string) => [...list.querySelectorAll<HTMLElement>('[data-mk-chip]')].find((chip) => chip.dataset.value === value && !chip.hasAttribute('data-mk-leaving')) ?? null;
|
|
70
|
+
const present = () => [...list.querySelectorAll<HTMLElement>('[data-mk-chip]:not([data-mk-leaving])')];
|
|
71
|
+
|
|
72
|
+
const make = (item: ChipItem) => {
|
|
73
|
+
const chip = document.createElement('li');
|
|
74
|
+
chip.dataset.mkChip = '';
|
|
75
|
+
chip.dataset.value = item.value;
|
|
76
|
+
chip.tabIndex = -1;
|
|
77
|
+
const label = document.createElement('span');
|
|
78
|
+
label.dataset.mkChipLabel = '';
|
|
79
|
+
label.textContent = item.label;
|
|
80
|
+
chip.append(label);
|
|
81
|
+
if (!options.disabled) {
|
|
82
|
+
const remove = document.createElement('button');
|
|
83
|
+
remove.type = 'button';
|
|
84
|
+
remove.tabIndex = -1;
|
|
85
|
+
remove.dataset.mkChipRemove = '';
|
|
86
|
+
remove.setAttribute('aria-label', options.removeLabel ? options.removeLabel(item) : `Quitar ${item.label}`);
|
|
87
|
+
remove.innerHTML = CLOSE;
|
|
88
|
+
chip.append(remove);
|
|
89
|
+
}
|
|
90
|
+
return chip;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const leave = (chip: HTMLElement, animate: boolean) => {
|
|
94
|
+
chip.setAttribute('data-mk-leaving', '');
|
|
95
|
+
if (!animate || reduced()) return chip.remove();
|
|
96
|
+
gsap.killTweensOf(chip);
|
|
97
|
+
keep(
|
|
98
|
+
gsap.to(chip, {
|
|
99
|
+
width: 0,
|
|
100
|
+
paddingLeft: 0,
|
|
101
|
+
paddingRight: 0,
|
|
102
|
+
marginLeft: 0,
|
|
103
|
+
marginRight: 0,
|
|
104
|
+
opacity: 0,
|
|
105
|
+
scale: 0.8,
|
|
106
|
+
filter: 'blur(6px)',
|
|
107
|
+
duration: 0.22,
|
|
108
|
+
ease: 'power2.in',
|
|
109
|
+
onComplete: () => chip.remove(),
|
|
110
|
+
}),
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const set = (items: ChipItem[], animate = true) => {
|
|
115
|
+
const wanted = new Set(items.map((item) => item.value));
|
|
116
|
+
const staying = present().filter((chip) => wanted.has(chip.dataset.value!));
|
|
117
|
+
const state = animate && !reduced() && staying.length ? Flip.getState(staying) : null;
|
|
118
|
+
for (const chip of present()) if (!wanted.has(chip.dataset.value!)) leave(chip, animate);
|
|
119
|
+
const arriving: HTMLElement[] = [];
|
|
120
|
+
let previous: HTMLElement | null = null;
|
|
121
|
+
for (const item of items) {
|
|
122
|
+
let chip = chipOf(item.value);
|
|
123
|
+
if (!chip) {
|
|
124
|
+
chip = make(item);
|
|
125
|
+
arriving.push(chip);
|
|
126
|
+
} else chip.querySelector<HTMLElement>('[data-mk-chip-label]')!.textContent = item.label;
|
|
127
|
+
// Keep the given order; leaving chips stay where they were while they fold.
|
|
128
|
+
if (previous) previous.after(chip);
|
|
129
|
+
else list.prepend(chip);
|
|
130
|
+
previous = chip;
|
|
131
|
+
}
|
|
132
|
+
if (armed && !wanted.has(armed)) armed = null;
|
|
133
|
+
if (state) keep(Flip.from(state, { targets: staying, duration: TIMING.layoutTravel, ease: EASE.layoutReflow }));
|
|
134
|
+
if (animate && arriving.length && !reduced()) {
|
|
135
|
+
keep(gsap.fromTo(arriving, { scale: 0.6, opacity: 0, filter: 'blur(6px)' }, { scale: 1, opacity: 1, filter: 'blur(0px)', duration: 0.3, stagger: 0.04, ease: EASE.pop, clearProps: 'scale,opacity,filter,transform' }));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const arm = (value: string | null) => {
|
|
140
|
+
armed = value;
|
|
141
|
+
for (const chip of present()) chip.toggleAttribute('data-mk-armed', chip.dataset.value === value);
|
|
142
|
+
const chip = value ? chipOf(value) : null;
|
|
143
|
+
if (chip && !reduced()) keep(gsap.fromTo(chip, { scale: 1.08 }, { scale: 1, duration: 0.3, ease: EASE.click, clearProps: 'scale' }));
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
scope.on(list, 'click', (event) => {
|
|
147
|
+
const remove = (event.target as Element | null)?.closest('[data-mk-chip-remove]');
|
|
148
|
+
const chip = remove?.closest<HTMLElement>('[data-mk-chip]');
|
|
149
|
+
if (chip && !chip.hasAttribute('data-mk-leaving')) options.onRemove(chip.dataset.value!);
|
|
150
|
+
});
|
|
151
|
+
scope.on(list, 'keydown', (event) => {
|
|
152
|
+
const key = event as KeyboardEvent;
|
|
153
|
+
const chip = (key.target as Element | null)?.closest<HTMLElement>('[data-mk-chip]');
|
|
154
|
+
if (!chip) return;
|
|
155
|
+
const chips = present();
|
|
156
|
+
const index = chips.indexOf(chip);
|
|
157
|
+
if (key.key === 'ArrowLeft') {
|
|
158
|
+
key.preventDefault();
|
|
159
|
+
chips[Math.max(0, index - 1)]?.focus();
|
|
160
|
+
} else if (key.key === 'ArrowRight') {
|
|
161
|
+
key.preventDefault();
|
|
162
|
+
if (index >= chips.length - 1) options.onExit?.();
|
|
163
|
+
else chips[index + 1]?.focus();
|
|
164
|
+
} else if ((key.key === 'Delete' || key.key === 'Backspace') && !options.disabled) {
|
|
165
|
+
key.preventDefault();
|
|
166
|
+
const next = chips[index + 1] ?? chips[index - 1] ?? null;
|
|
167
|
+
options.onRemove(chip.dataset.value!);
|
|
168
|
+
if (next && next !== chip && next.isConnected && !next.hasAttribute('data-mk-leaving')) next.focus();
|
|
169
|
+
else options.onExit?.();
|
|
170
|
+
} else if (key.key === 'Escape' || key.key === 'Tab') {
|
|
171
|
+
if (key.key === 'Escape') key.preventDefault();
|
|
172
|
+
if (key.key === 'Escape') options.onExit?.();
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
element: list,
|
|
178
|
+
set,
|
|
179
|
+
arm,
|
|
180
|
+
get armed() {
|
|
181
|
+
return armed;
|
|
182
|
+
},
|
|
183
|
+
flash(value) {
|
|
184
|
+
const chip = chipOf(value);
|
|
185
|
+
if (!chip) return;
|
|
186
|
+
keep(shake(chip, 3));
|
|
187
|
+
keep(ringPulse(chip));
|
|
188
|
+
},
|
|
189
|
+
focusLast() {
|
|
190
|
+
const chips = present();
|
|
191
|
+
chips[chips.length - 1]?.focus();
|
|
192
|
+
return chips.length > 0;
|
|
193
|
+
},
|
|
194
|
+
destroy: () => scope.dispose(),
|
|
195
|
+
};
|
|
196
|
+
}
|