@rivetjs/cdk 0.0.0-stage → 0.1.0-alpha.1
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/LICENSE +21 -0
- package/NOTICE +483 -0
- package/README.md +10 -2
- package/_adapters/collection.d.ts +160 -0
- package/_adapters/collection.js +235 -0
- package/_adapters/collections.d.ts +325 -0
- package/_adapters/collections.js +934 -0
- package/_adapters/dom-collection.d.ts +42 -0
- package/_adapters/dom-collection.js +228 -0
- package/_adapters/grid-selection.d.ts +115 -0
- package/_adapters/grid-selection.js +436 -0
- package/_adapters/interactions.d.ts +19 -0
- package/_adapters/interactions.js +45 -0
- package/_adapters/intl.d.ts +8 -0
- package/_adapters/intl.js +106 -0
- package/_adapters/press.d.ts +22 -0
- package/_adapters/press.js +34 -0
- package/_adapters/selectable.d.ts +132 -0
- package/_adapters/selectable.js +599 -0
- package/_adapters/selection.d.ts +120 -0
- package/_adapters/selection.js +709 -0
- package/_adapters/type-select.d.ts +8 -0
- package/_adapters/type-select.js +59 -0
- package/a11y/aria-describer.d.ts +46 -0
- package/a11y/aria-describer.js +169 -0
- package/a11y/focus-monitor.d.ts +98 -0
- package/a11y/focus-monitor.js +321 -0
- package/a11y/focus-trap.d.ts +137 -0
- package/a11y/focus-trap.js +378 -0
- package/a11y/high-contrast.d.ts +26 -0
- package/a11y/high-contrast.js +84 -0
- package/a11y/index.d.ts +37 -0
- package/a11y/index.js +97 -0
- package/a11y/interactivity-checker.d.ts +18 -0
- package/a11y/interactivity-checker.js +126 -0
- package/a11y/key-manager.d.ts +152 -0
- package/a11y/key-manager.js +397 -0
- package/a11y/live-announcer.d.ts +53 -0
- package/a11y/live-announcer.js +143 -0
- package/accordion/index.d.ts +2 -0
- package/accordion/index.jsx +10 -0
- package/announcer/index.d.ts +8 -0
- package/announcer/index.jsx +22 -0
- package/announcer/live-announcer.d.ts +15 -0
- package/announcer/live-announcer.js +123 -0
- package/autocomplete/behaviour.d.ts +94 -0
- package/autocomplete/behaviour.jsx +423 -0
- package/autocomplete/contexts.d.ts +54 -0
- package/autocomplete/contexts.js +28 -0
- package/autocomplete/index.d.ts +12 -0
- package/autocomplete/index.jsx +31 -0
- package/autocomplete/intl.d.ts +2 -0
- package/autocomplete/intl.js +36 -0
- package/bidi/bidi-dir.d.ts +23 -0
- package/bidi/bidi-dir.jsx +36 -0
- package/bidi/index.d.ts +58 -0
- package/bidi/index.js +84 -0
- package/breadcrumbs/behaviour.d.ts +6 -0
- package/breadcrumbs/behaviour.js +17 -0
- package/breadcrumbs/index.d.ts +68 -0
- package/breadcrumbs/index.jsx +224 -0
- package/breadcrumbs/intl.d.ts +3 -0
- package/breadcrumbs/intl.js +104 -0
- package/button/behaviour.d.ts +61 -0
- package/button/behaviour.js +90 -0
- package/button/index.d.ts +38 -0
- package/button/index.jsx +376 -0
- package/button/press.d.ts +25 -0
- package/button/press.js +54 -0
- package/calendar/behaviour.d.ts +250 -0
- package/calendar/behaviour.jsx +939 -0
- package/calendar/index.d.ts +157 -0
- package/calendar/index.jsx +484 -0
- package/calendar/intl.d.ts +3 -0
- package/calendar/intl.js +36 -0
- package/carousel/behaviour.d.ts +50 -0
- package/carousel/behaviour.jsx +365 -0
- package/carousel/engine/Alignment.d.ts +5 -0
- package/carousel/engine/Alignment.js +24 -0
- package/carousel/engine/Animations.d.ts +13 -0
- package/carousel/engine/Animations.js +28 -0
- package/carousel/engine/Axis.d.ts +14 -0
- package/carousel/engine/Axis.js +35 -0
- package/carousel/engine/Counter.d.ts +7 -0
- package/carousel/engine/Counter.js +32 -0
- package/carousel/engine/DragHandler.d.ts +22 -0
- package/carousel/engine/DragHandler.js +141 -0
- package/carousel/engine/DragTracker.d.ts +10 -0
- package/carousel/engine/DragTracker.js +29 -0
- package/carousel/engine/EmblaCarousel.d.ts +32 -0
- package/carousel/engine/EmblaCarousel.js +177 -0
- package/carousel/engine/Engine.d.ts +64 -0
- package/carousel/engine/Engine.js +137 -0
- package/carousel/engine/EventHandler.d.ts +27 -0
- package/carousel/engine/EventHandler.js +33 -0
- package/carousel/engine/EventStore.d.ts +9 -0
- package/carousel/engine/EventStore.js +25 -0
- package/carousel/engine/NodeRects.d.ts +12 -0
- package/carousel/engine/NodeRects.js +18 -0
- package/carousel/engine/Options.d.ts +40 -0
- package/carousel/engine/Options.js +22 -0
- package/carousel/engine/OptionsHandler.d.ts +10 -0
- package/carousel/engine/OptionsHandler.js +26 -0
- package/carousel/engine/PercentOfView.d.ts +4 -0
- package/carousel/engine/PercentOfView.js +9 -0
- package/carousel/engine/Plugins.d.ts +16 -0
- package/carousel/engine/Plugins.js +1 -0
- package/carousel/engine/PluginsHandler.d.ts +8 -0
- package/carousel/engine/PluginsHandler.js +16 -0
- package/carousel/engine/ResizeHandler.d.ts +13 -0
- package/carousel/engine/ResizeHandler.js +51 -0
- package/carousel/engine/ScrollBounds.d.ts +10 -0
- package/carousel/engine/ScrollBounds.js +41 -0
- package/carousel/engine/ScrollContain.d.ts +7 -0
- package/carousel/engine/ScrollContain.js +52 -0
- package/carousel/engine/ScrollLimit.d.ts +5 -0
- package/carousel/engine/ScrollLimit.js +13 -0
- package/carousel/engine/ScrollLooper.d.ts +6 -0
- package/carousel/engine/ScrollLooper.js +26 -0
- package/carousel/engine/ScrollProgress.d.ts +5 -0
- package/carousel/engine/ScrollProgress.js +11 -0
- package/carousel/engine/ScrollSnaps.d.ts +9 -0
- package/carousel/engine/ScrollSnaps.js +26 -0
- package/carousel/engine/ScrollTarget.d.ts +12 -0
- package/carousel/engine/ScrollTarget.js +47 -0
- package/carousel/engine/ScrollTo.d.ts +11 -0
- package/carousel/engine/ScrollTo.js +36 -0
- package/carousel/engine/SlideFocus.d.ts +13 -0
- package/carousel/engine/SlideFocus.js +39 -0
- package/carousel/engine/SlideLooper.d.ts +18 -0
- package/carousel/engine/SlideLooper.js +78 -0
- package/carousel/engine/SlideRegistry.d.ts +7 -0
- package/carousel/engine/SlideRegistry.js +31 -0
- package/carousel/engine/SlideSizes.d.ts +10 -0
- package/carousel/engine/SlideSizes.js +41 -0
- package/carousel/engine/SlidesHandler.d.ts +10 -0
- package/carousel/engine/SlidesHandler.js +36 -0
- package/carousel/engine/SlidesInView.d.ts +8 -0
- package/carousel/engine/SlidesInView.js +59 -0
- package/carousel/engine/SlidesToScroll.d.ts +7 -0
- package/carousel/engine/SlidesToScroll.js +41 -0
- package/carousel/engine/Translate.d.ts +7 -0
- package/carousel/engine/Translate.js +38 -0
- package/carousel/engine/index.d.ts +11 -0
- package/carousel/engine/index.js +1 -0
- package/carousel/engine/utils.d.ts +15 -0
- package/carousel/engine/utils.js +45 -0
- package/carousel/index.d.ts +202 -0
- package/carousel/index.jsx +469 -0
- package/carousel/plugins/auto-height/AutoHeight.d.ts +14 -0
- package/carousel/plugins/auto-height/AutoHeight.js +43 -0
- package/carousel/plugins/auto-height/Options.d.ts +2 -0
- package/carousel/plugins/auto-height/Options.js +1 -0
- package/carousel/plugins/auto-height/index.d.ts +2 -0
- package/carousel/plugins/auto-height/index.js +1 -0
- package/carousel/plugins/auto-scroll/AutoScroll.d.ts +25 -0
- package/carousel/plugins/auto-scroll/AutoScroll.js +185 -0
- package/carousel/plugins/auto-scroll/Options.d.ts +13 -0
- package/carousel/plugins/auto-scroll/Options.js +12 -0
- package/carousel/plugins/auto-scroll/index.d.ts +2 -0
- package/carousel/plugins/auto-scroll/index.js +1 -0
- package/carousel/plugins/auto-scroll/utils.d.ts +3 -0
- package/carousel/plugins/auto-scroll/utils.js +4 -0
- package/carousel/plugins/autoplay/Autoplay.d.ts +29 -0
- package/carousel/plugins/autoplay/Autoplay.js +173 -0
- package/carousel/plugins/autoplay/Options.d.ts +14 -0
- package/carousel/plugins/autoplay/Options.js +12 -0
- package/carousel/plugins/autoplay/index.d.ts +2 -0
- package/carousel/plugins/autoplay/index.js +1 -0
- package/carousel/plugins/autoplay/utils.d.ts +4 -0
- package/carousel/plugins/autoplay/utils.js +11 -0
- package/carousel/plugins/class-names/ClassNames.d.ts +14 -0
- package/carousel/plugins/class-names/ClassNames.js +98 -0
- package/carousel/plugins/class-names/Options.d.ts +13 -0
- package/carousel/plugins/class-names/Options.js +9 -0
- package/carousel/plugins/class-names/index.d.ts +2 -0
- package/carousel/plugins/class-names/index.js +1 -0
- package/carousel/plugins/class-names/utils.d.ts +4 -0
- package/carousel/plugins/class-names/utils.js +14 -0
- package/carousel/plugins/fade/Fade.d.ts +14 -0
- package/carousel/plugins/fade/Fade.js +199 -0
- package/carousel/plugins/fade/Options.d.ts +2 -0
- package/carousel/plugins/fade/Options.js +1 -0
- package/carousel/plugins/fade/index.d.ts +2 -0
- package/carousel/plugins/fade/index.js +1 -0
- package/carousel/plugins/fade/utils.d.ts +2 -0
- package/carousel/plugins/fade/utils.js +8 -0
- package/carousel/state.d.ts +81 -0
- package/carousel/state.js +71 -0
- package/chat/index.d.ts +83 -0
- package/chat/index.jsx +287 -0
- package/checkbox/behaviour.d.ts +172 -0
- package/checkbox/behaviour.jsx +412 -0
- package/checkbox/index.d.ts +168 -0
- package/checkbox/index.jsx +310 -0
- package/clipboard/index.d.ts +49 -0
- package/clipboard/index.js +136 -0
- package/coercion/index.d.ts +36 -0
- package/coercion/index.js +58 -0
- package/collections/base.d.ts +115 -0
- package/collections/base.js +346 -0
- package/collections/builder.d.ts +44 -0
- package/collections/builder.js +283 -0
- package/collections/components.d.ts +252 -0
- package/collections/components.jsx +745 -0
- package/collections/data-source.d.ts +26 -0
- package/collections/data-source.js +27 -0
- package/collections/dom.d.ts +34 -0
- package/collections/dom.js +127 -0
- package/collections/grid.d.ts +45 -0
- package/collections/grid.js +125 -0
- package/collections/hidden.d.ts +4 -0
- package/collections/hidden.js +12 -0
- package/collections/index.d.ts +45 -0
- package/collections/index.js +105 -0
- package/collections/list-state.d.ts +99 -0
- package/collections/list-state.js +156 -0
- package/collections/list.d.ts +20 -0
- package/collections/list.js +77 -0
- package/collections/nodes.d.ts +17 -0
- package/collections/nodes.js +107 -0
- package/collections/row-stamps.d.ts +17 -0
- package/collections/row-stamps.js +108 -0
- package/collections/selection-model.d.ts +93 -0
- package/collections/selection-model.js +192 -0
- package/collections/server-dev.d.ts +6 -0
- package/collections/server-dev.js +18 -0
- package/collections/server-off.d.ts +6 -0
- package/collections/server-off.js +9 -0
- package/collections/server-on.d.ts +29 -0
- package/collections/server-on.jsx +86 -0
- package/collections/table.d.ts +114 -0
- package/collections/table.js +439 -0
- package/collections/tree-state.d.ts +47 -0
- package/collections/tree-state.js +73 -0
- package/collections/tree.d.ts +20 -0
- package/collections/tree.js +66 -0
- package/collections/types.d.ts +229 -0
- package/collections/types.js +4 -0
- package/collections/unique-selection-dispatcher.d.ts +10 -0
- package/collections/unique-selection-dispatcher.js +25 -0
- package/color/area-state.d.ts +99 -0
- package/color/area-state.js +160 -0
- package/color/aria-intl.d.ts +3 -0
- package/color/aria-intl.js +274 -0
- package/color/channel-field-state.d.ts +50 -0
- package/color/channel-field-state.jsx +87 -0
- package/color/color.d.ts +78 -0
- package/color/color.js +738 -0
- package/color/field-state.d.ts +66 -0
- package/color/field-state.jsx +159 -0
- package/color/index.d.ts +58 -0
- package/color/index.js +88 -0
- package/color/intl.d.ts +3 -0
- package/color/intl.js +1328 -0
- package/color/picker-state.d.ts +20 -0
- package/color/picker-state.js +19 -0
- package/color/slider-state.d.ts +78 -0
- package/color/slider-state.jsx +98 -0
- package/color/value.d.ts +27 -0
- package/color/value.js +36 -0
- package/color/wheel-state.d.ts +77 -0
- package/color/wheel-state.js +152 -0
- package/color-area/behaviour.d.ts +161 -0
- package/color-area/behaviour.jsx +454 -0
- package/color-area/index.d.ts +34 -0
- package/color-area/index.jsx +187 -0
- package/color-field/behaviour.d.ts +112 -0
- package/color-field/behaviour.jsx +262 -0
- package/color-field/index.d.ts +72 -0
- package/color-field/index.jsx +309 -0
- package/color-picker/index.d.ts +19 -0
- package/color-picker/index.jsx +49 -0
- package/color-slider/behaviour.d.ts +103 -0
- package/color-slider/behaviour.jsx +234 -0
- package/color-slider/index.d.ts +40 -0
- package/color-slider/index.jsx +162 -0
- package/color-swatch/behaviour.d.ts +40 -0
- package/color-swatch/behaviour.js +36 -0
- package/color-swatch/index.d.ts +29 -0
- package/color-swatch/index.jsx +82 -0
- package/color-swatch-picker/index.d.ts +62 -0
- package/color-swatch-picker/index.jsx +95 -0
- package/color-swatch-picker/intl.d.ts +3 -0
- package/color-swatch-picker/intl.js +104 -0
- package/color-thumb/index.d.ts +85 -0
- package/color-thumb/index.jsx +93 -0
- package/color-wheel/behaviour.d.ts +123 -0
- package/color-wheel/behaviour.jsx +301 -0
- package/color-wheel/index.d.ts +50 -0
- package/color-wheel/index.jsx +166 -0
- package/combobox/behaviour.d.ts +120 -0
- package/combobox/behaviour.jsx +588 -0
- package/combobox/index.d.ts +101 -0
- package/combobox/index.jsx +365 -0
- package/combobox/intl.d.ts +2 -0
- package/combobox/intl.js +240 -0
- package/compare/behaviour.d.ts +101 -0
- package/compare/behaviour.js +288 -0
- package/compare/index.d.ts +58 -0
- package/compare/index.jsx +129 -0
- package/data/async-list.d.ts +78 -0
- package/data/async-list.jsx +257 -0
- package/data/index.d.ts +3 -0
- package/data/index.jsx +6 -0
- package/data/list-data.d.ts +88 -0
- package/data/list-data.jsx +210 -0
- package/data/tree-data.d.ts +59 -0
- package/data/tree-data.jsx +278 -0
- package/data-grid/behaviour.d.ts +95 -0
- package/data-grid/behaviour.js +725 -0
- package/data-grid/index.d.ts +138 -0
- package/data-grid/index.jsx +452 -0
- package/data-grid/state.d.ts +131 -0
- package/data-grid/state.js +288 -0
- package/date/CalendarDate.d.ts +207 -0
- package/date/CalendarDate.js +374 -0
- package/date/DateFormatter.d.ts +24 -0
- package/date/DateFormatter.js +175 -0
- package/date/calendars/BuddhistCalendar.d.ts +16 -0
- package/date/calendars/BuddhistCalendar.js +46 -0
- package/date/calendars/EthiopicCalendar.d.ts +45 -0
- package/date/calendars/EthiopicCalendar.js +178 -0
- package/date/calendars/GregorianCalendar.d.ts +26 -0
- package/date/calendars/GregorianCalendar.js +122 -0
- package/date/calendars/HebrewCalendar.d.ts +21 -0
- package/date/calendars/HebrewCalendar.js +174 -0
- package/date/calendars/IndianCalendar.d.ts +17 -0
- package/date/calendars/IndianCalendar.js +111 -0
- package/date/calendars/IslamicCalendar.d.ts +51 -0
- package/date/calendars/IslamicCalendar.js +205 -0
- package/date/calendars/JapaneseCalendar.d.ts +22 -0
- package/date/calendars/JapaneseCalendar.js +148 -0
- package/date/calendars/PersianCalendar.d.ts +19 -0
- package/date/calendars/PersianCalendar.js +85 -0
- package/date/calendars/TaiwanCalendar.d.ts +19 -0
- package/date/calendars/TaiwanCalendar.js +70 -0
- package/date/conversion.d.ts +45 -0
- package/date/conversion.js +269 -0
- package/date/createCalendar.d.ts +3 -0
- package/date/createCalendar.js +55 -0
- package/date/index.d.ts +20 -0
- package/date/index.js +30 -0
- package/date/manipulation.d.ts +25 -0
- package/date/manipulation.js +399 -0
- package/date/queries.d.ts +93 -0
- package/date/queries.js +303 -0
- package/date/serialize.d.ts +18 -0
- package/date/serialize.js +55 -0
- package/date/string.d.ts +36 -0
- package/date/string.js +223 -0
- package/date/types.d.ts +136 -0
- package/date/types.js +14 -0
- package/date/utils.d.ts +4 -0
- package/date/utils.js +16 -0
- package/date/weekStartData.d.ts +1 -0
- package/date/weekStartData.js +112 -0
- package/date-field/behaviour.d.ts +188 -0
- package/date-field/behaviour.jsx +1025 -0
- package/date-field/index.d.ts +150 -0
- package/date-field/index.jsx +354 -0
- package/date-field/intl.d.ts +3 -0
- package/date-field/intl.js +36 -0
- package/date-field/live-value.d.ts +22 -0
- package/date-field/live-value.jsx +44 -0
- package/date-picker/behaviour.d.ts +95 -0
- package/date-picker/behaviour.jsx +343 -0
- package/date-picker/index.d.ts +66 -0
- package/date-picker/index.jsx +243 -0
- package/dialog/behaviour.d.ts +63 -0
- package/dialog/behaviour.jsx +90 -0
- package/dialog/contexts.d.ts +12 -0
- package/dialog/contexts.js +8 -0
- package/dialog/index.d.ts +48 -0
- package/dialog/index.jsx +301 -0
- package/disclosure/behaviour.d.ts +50 -0
- package/disclosure/behaviour.jsx +128 -0
- package/disclosure/details.d.ts +21 -0
- package/disclosure/details.jsx +14 -0
- package/disclosure/index.d.ts +92 -0
- package/disclosure/index.jsx +300 -0
- package/drag-drop/cdk-index.d.ts +22 -0
- package/drag-drop/cdk-index.jsx +25 -0
- package/drag-drop/directives/assertions.d.ts +6 -0
- package/drag-drop/directives/assertions.js +13 -0
- package/drag-drop/directives/config.d.ts +30 -0
- package/drag-drop/directives/config.js +7 -0
- package/drag-drop/directives/drag-handle.d.ts +10 -0
- package/drag-drop/directives/drag-handle.js +29 -0
- package/drag-drop/directives/drag.d.ts +210 -0
- package/drag-drop/directives/drag.js +550 -0
- package/drag-drop/directives/drop-list-group.d.ts +25 -0
- package/drag-drop/directives/drop-list-group.js +55 -0
- package/drag-drop/directives/drop-list.d.ts +163 -0
- package/drag-drop/directives/drop-list.js +396 -0
- package/drag-drop/directives/registry.d.ts +32 -0
- package/drag-drop/directives/registry.js +61 -0
- package/drag-drop/dom/clone-node.d.ts +2 -0
- package/drag-drop/dom/clone-node.js +58 -0
- package/drag-drop/dom/coerce.d.ts +6 -0
- package/drag-drop/dom/coerce.js +8 -0
- package/drag-drop/dom/dom-rect.d.ts +37 -0
- package/drag-drop/dom/dom-rect.js +71 -0
- package/drag-drop/dom/fake-event.d.ts +4 -0
- package/drag-drop/dom/fake-event.js +22 -0
- package/drag-drop/dom/inherited-text.d.ts +4 -0
- package/drag-drop/dom/inherited-text.js +44 -0
- package/drag-drop/dom/layout-shift.d.ts +8 -0
- package/drag-drop/dom/layout-shift.js +87 -0
- package/drag-drop/dom/mount-content.d.ts +2 -0
- package/drag-drop/dom/mount-content.js +7 -0
- package/drag-drop/dom/parent-position-tracker.d.ts +32 -0
- package/drag-drop/dom/parent-position-tracker.js +71 -0
- package/drag-drop/dom/root-node.d.ts +21 -0
- package/drag-drop/dom/root-node.js +41 -0
- package/drag-drop/dom/shadow-dom.d.ts +4 -0
- package/drag-drop/dom/shadow-dom.js +18 -0
- package/drag-drop/dom/styling.d.ts +52 -0
- package/drag-drop/dom/styling.js +86 -0
- package/drag-drop/dom/transition-duration.d.ts +2 -0
- package/drag-drop/dom/transition-duration.js +29 -0
- package/drag-drop/drag-drop-registry.d.ts +69 -0
- package/drag-drop/drag-drop-registry.js +224 -0
- package/drag-drop/drag-drop.d.ts +19 -0
- package/drag-drop/drag-drop.js +10 -0
- package/drag-drop/drag-events.d.ts +117 -0
- package/drag-drop/drag-events.js +1 -0
- package/drag-drop/drag-handle.d.ts +18 -0
- package/drag-drop/drag-handle.jsx +53 -0
- package/drag-drop/drag-placeholder.d.ts +8 -0
- package/drag-drop/drag-placeholder.jsx +25 -0
- package/drag-drop/drag-preview.d.ts +10 -0
- package/drag-drop/drag-preview.jsx +31 -0
- package/drag-drop/drag-ref.d.ts +476 -0
- package/drag-drop/drag-ref.js +1306 -0
- package/drag-drop/drag-utils.d.ts +25 -0
- package/drag-drop/drag-utils.js +53 -0
- package/drag-drop/drag.d.ts +23 -0
- package/drag-drop/drag.jsx +128 -0
- package/drag-drop/drop-list-group.d.ts +22 -0
- package/drag-drop/drop-list-group.jsx +19 -0
- package/drag-drop/drop-list-ref.d.ts +295 -0
- package/drag-drop/drop-list-ref.js +707 -0
- package/drag-drop/drop-list.d.ts +19 -0
- package/drag-drop/drop-list.jsx +87 -0
- package/drag-drop/index.d.ts +1 -0
- package/drag-drop/index.jsx +4 -0
- package/drag-drop/lazy-refs.d.ts +28 -0
- package/drag-drop/lazy-refs.js +144 -0
- package/drag-drop/preview-ref.d.ts +38 -0
- package/drag-drop/preview-ref.js +132 -0
- package/drag-drop/sorting/drop-list-sort-strategy.d.ts +29 -0
- package/drag-drop/sorting/drop-list-sort-strategy.js +1 -0
- package/drag-drop/sorting/mixed-sort-strategy.d.ts +99 -0
- package/drag-drop/sorting/mixed-sort-strategy.js +259 -0
- package/drag-drop/sorting/single-axis-sort-strategy.d.ts +112 -0
- package/drag-drop/sorting/single-axis-sort-strategy.js +343 -0
- package/file-trigger/index.d.ts +24 -0
- package/file-trigger/index.jsx +41 -0
- package/flip/index.d.ts +59 -0
- package/flip/index.js +124 -0
- package/focus/focus-ring.d.ts +42 -0
- package/focus/focus-ring.jsx +77 -0
- package/focus/focus-scope.d.ts +51 -0
- package/focus/focus-scope.jsx +431 -0
- package/focus/focusable.d.ts +33 -0
- package/focus/focusable.jsx +93 -0
- package/focus/index.d.ts +74 -0
- package/focus/index.js +274 -0
- package/form/behaviour.d.ts +29 -0
- package/form/behaviour.js +145 -0
- package/form/field-error.d.ts +38 -0
- package/form/field-error.jsx +67 -0
- package/form/index.d.ts +77 -0
- package/form/index.jsx +116 -0
- package/grid/behaviour.d.ts +290 -0
- package/grid/behaviour.js +683 -0
- package/grid/intl.d.ts +2 -0
- package/grid/intl.js +36 -0
- package/grid/keyboard-delegate.d.ts +56 -0
- package/grid/keyboard-delegate.js +316 -0
- package/grid-list/behaviour.d.ts +248 -0
- package/grid-list/behaviour.js +616 -0
- package/grid-list/index.d.ts +204 -0
- package/grid-list/index.jsx +721 -0
- package/grid-list/row.d.ts +24 -0
- package/grid-list/row.js +57 -0
- package/group/index.d.ts +48 -0
- package/group/index.jsx +126 -0
- package/header/index.d.ts +13 -0
- package/header/index.jsx +34 -0
- package/heading/index.d.ts +19 -0
- package/heading/index.jsx +55 -0
- package/highlight/index.d.ts +12 -0
- package/highlight/index.jsx +357 -0
- package/i18n/filter.d.ts +16 -0
- package/i18n/filter.js +66 -0
- package/i18n/i18n-provider.d.ts +10 -0
- package/i18n/i18n-provider.jsx +15 -0
- package/i18n/index.d.ts +27 -0
- package/i18n/index.js +115 -0
- package/i18n/intl-cache.d.ts +4 -0
- package/i18n/intl-cache.js +40 -0
- package/i18n/list-formatter.d.ts +2 -0
- package/i18n/list-formatter.js +11 -0
- package/input/index.d.ts +51 -0
- package/input/index.jsx +95 -0
- package/interactions/controllable.d.ts +42 -0
- package/interactions/controllable.js +67 -0
- package/interactions/focus-visible.d.ts +68 -0
- package/interactions/focus-visible.jsx +291 -0
- package/interactions/focus.d.ts +58 -0
- package/interactions/focus.jsx +152 -0
- package/interactions/hover.d.ts +54 -0
- package/interactions/hover.jsx +139 -0
- package/interactions/index.d.ts +1 -0
- package/interactions/index.js +3 -0
- package/interactions/interact-outside.d.ts +24 -0
- package/interactions/interact-outside.jsx +57 -0
- package/interactions/keyboard.d.ts +28 -0
- package/interactions/keyboard.jsx +51 -0
- package/interactions/long-press.d.ts +41 -0
- package/interactions/long-press.jsx +79 -0
- package/interactions/merge-props.d.ts +54 -0
- package/interactions/merge-props.jsx +257 -0
- package/interactions/move.d.ts +48 -0
- package/interactions/move.jsx +96 -0
- package/interactions/press.d.ts +129 -0
- package/interactions/press.jsx +539 -0
- package/interactions/pressable.d.ts +22 -0
- package/interactions/pressable.jsx +93 -0
- package/interactions/scroll-wheel.d.ts +20 -0
- package/interactions/scroll-wheel.jsx +40 -0
- package/interactions/utils.d.ts +52 -0
- package/interactions/utils.js +253 -0
- package/keyboard/index.d.ts +12 -0
- package/keyboard/index.jsx +34 -0
- package/keys/index.d.ts +68 -0
- package/keys/index.js +199 -0
- package/label/behaviour.d.ts +54 -0
- package/label/behaviour.js +60 -0
- package/label/index.d.ts +35 -0
- package/label/index.jsx +85 -0
- package/landmark/index.d.ts +10 -0
- package/landmark/index.jsx +35 -0
- package/landmark/manager.d.ts +50 -0
- package/landmark/manager.js +364 -0
- package/layout/index.d.ts +90 -0
- package/layout/index.js +207 -0
- package/lightbox/behaviour.d.ts +82 -0
- package/lightbox/behaviour.js +490 -0
- package/lightbox/captions/index.d.ts +39 -0
- package/lightbox/captions/index.jsx +44 -0
- package/lightbox/counter/index.d.ts +10 -0
- package/lightbox/counter/index.jsx +10 -0
- package/lightbox/download/index.d.ts +32 -0
- package/lightbox/download/index.jsx +89 -0
- package/lightbox/embed/index.d.ts +15 -0
- package/lightbox/embed/index.jsx +58 -0
- package/lightbox/fullscreen/index.d.ts +24 -0
- package/lightbox/fullscreen/index.jsx +80 -0
- package/lightbox/index.d.ts +129 -0
- package/lightbox/index.jsx +284 -0
- package/lightbox/inline/index.d.ts +18 -0
- package/lightbox/inline/index.jsx +15 -0
- package/lightbox/pdf/index.d.ts +18 -0
- package/lightbox/pdf/index.jsx +31 -0
- package/lightbox/share/index.d.ts +29 -0
- package/lightbox/share/index.jsx +43 -0
- package/lightbox/slideshow/index.d.ts +24 -0
- package/lightbox/slideshow/index.jsx +118 -0
- package/lightbox/state.d.ts +334 -0
- package/lightbox/state.js +192 -0
- package/lightbox/thumbnails/index.d.ts +54 -0
- package/lightbox/thumbnails/index.jsx +96 -0
- package/lightbox/video/index.d.ts +13 -0
- package/lightbox/video/index.jsx +42 -0
- package/lightbox/zoom/index.d.ts +67 -0
- package/lightbox/zoom/index.jsx +456 -0
- package/link/behaviour.d.ts +41 -0
- package/link/behaviour.js +58 -0
- package/link/index.d.ts +30 -0
- package/link/index.jsx +179 -0
- package/link/router.d.ts +1 -0
- package/link/router.js +5 -0
- package/listbox/behaviour.d.ts +175 -0
- package/listbox/behaviour.jsx +515 -0
- package/listbox/index.d.ts +129 -0
- package/listbox/index.jsx +632 -0
- package/markdown/index.d.ts +82 -0
- package/markdown/index.jsx +654 -0
- package/masonry/behaviour.d.ts +121 -0
- package/masonry/behaviour.js +676 -0
- package/masonry/flip.d.ts +27 -0
- package/masonry/flip.js +61 -0
- package/masonry/geometry.d.ts +44 -0
- package/masonry/geometry.js +184 -0
- package/masonry/index.d.ts +153 -0
- package/masonry/index.jsx +833 -0
- package/masonry/justified.d.ts +49 -0
- package/masonry/justified.js +250 -0
- package/masonry/layout.d.ts +200 -0
- package/masonry/layout.js +668 -0
- package/masonry/masonry-layout.d.ts +57 -0
- package/masonry/masonry-layout.js +159 -0
- package/masonry/masonry.css +29 -0
- package/menu/behaviour.d.ts +205 -0
- package/menu/behaviour.jsx +847 -0
- package/menu/index.d.ts +171 -0
- package/menu/index.jsx +702 -0
- package/menu/intl.d.ts +2 -0
- package/menu/intl.js +36 -0
- package/menu/safely-mouse-to-submenu.d.ts +12 -0
- package/menu/safely-mouse-to-submenu.js +128 -0
- package/meter/behaviour.d.ts +18 -0
- package/meter/behaviour.jsx +17 -0
- package/meter/index.d.ts +30 -0
- package/meter/index.jsx +85 -0
- package/modal/index.d.ts +79 -0
- package/modal/index.jsx +359 -0
- package/modal/provider.d.ts +47 -0
- package/modal/provider.jsx +105 -0
- package/morph/index.d.ts +91 -0
- package/morph/index.jsx +372 -0
- package/morph/item.d.ts +89 -0
- package/morph/item.jsx +546 -0
- package/motion/Animations.d.ts +17 -0
- package/motion/Animations.js +56 -0
- package/motion/DragRelease.d.ts +22 -0
- package/motion/DragRelease.js +26 -0
- package/motion/DragTracker.d.ts +7 -0
- package/motion/DragTracker.js +43 -0
- package/motion/Limit.d.ts +12 -0
- package/motion/Limit.js +37 -0
- package/motion/Motion1D.d.ts +38 -0
- package/motion/Motion1D.js +72 -0
- package/motion/ScrollBody.d.ts +13 -0
- package/motion/ScrollBody.js +75 -0
- package/motion/Vector1d.d.ts +8 -0
- package/motion/Vector1d.js +29 -0
- package/motion/index.d.ts +8 -0
- package/motion/index.js +12 -0
- package/motion/utils.d.ts +5 -0
- package/motion/utils.js +23 -0
- package/native-select/index.d.ts +46 -0
- package/native-select/index.jsx +99 -0
- package/navigation-tree/index.d.ts +43 -0
- package/navigation-tree/index.jsx +110 -0
- package/number/NumberFormatter.d.ts +28 -0
- package/number/NumberFormatter.js +144 -0
- package/number/NumberParser.d.ts +27 -0
- package/number/NumberParser.js +316 -0
- package/number/index.d.ts +5 -0
- package/number/index.jsx +17 -0
- package/number/number-field-state.d.ts +132 -0
- package/number/number-field-state.jsx +364 -0
- package/number-field/behaviour.d.ts +165 -0
- package/number-field/behaviour.jsx +512 -0
- package/number-field/index.d.ts +52 -0
- package/number-field/index.jsx +207 -0
- package/number-field/intl.d.ts +2 -0
- package/number-field/intl.js +36 -0
- package/observers/index.d.ts +70 -0
- package/observers/index.js +279 -0
- package/overflow/index.d.ts +93 -0
- package/overflow/index.jsx +267 -0
- package/overlay/aria-hide-outside.d.ts +12 -0
- package/overlay/aria-hide-outside.js +141 -0
- package/overlay/close-on-scroll.d.ts +1 -0
- package/overlay/close-on-scroll.js +6 -0
- package/overlay/contexts.d.ts +34 -0
- package/overlay/contexts.js +21 -0
- package/overlay/dismiss-button.d.ts +10 -0
- package/overlay/dismiss-button.jsx +18 -0
- package/overlay/hover-trigger.d.ts +54 -0
- package/overlay/hover-trigger.jsx +221 -0
- package/overlay/index.d.ts +40 -0
- package/overlay/index.js +139 -0
- package/overlay/modal-overlay.d.ts +16 -0
- package/overlay/modal-overlay.js +38 -0
- package/overlay/overlay-strings.d.ts +4 -0
- package/overlay/overlay-strings.js +52 -0
- package/overlay/overlay-trigger-state.d.ts +1 -0
- package/overlay/overlay-trigger-state.js +3 -0
- package/overlay/overlay-trigger.d.ts +27 -0
- package/overlay/overlay-trigger.jsx +50 -0
- package/overlay/position.d.ts +160 -0
- package/overlay/position.js +559 -0
- package/overlay/prevent-scroll-ios.d.ts +17 -0
- package/overlay/prevent-scroll-ios.js +331 -0
- package/overlay/prevent-scroll.d.ts +18 -0
- package/overlay/prevent-scroll.js +122 -0
- package/overlay/safe-area.d.ts +28 -0
- package/overlay/safe-area.js +108 -0
- package/overlay-arrow/index.d.ts +23 -0
- package/overlay-arrow/index.jsx +59 -0
- package/overlay-service/connected-position.d.ts +163 -0
- package/overlay-service/connected-position.js +661 -0
- package/overlay-service/global-position.d.ts +34 -0
- package/overlay-service/global-position.js +154 -0
- package/overlay-service/index.d.ts +15 -0
- package/overlay-service/index.js +27 -0
- package/overlay-service/overlay-container.d.ts +27 -0
- package/overlay-service/overlay-container.js +93 -0
- package/overlay-service/overlay-dispatchers.d.ts +44 -0
- package/overlay-service/overlay-dispatchers.js +149 -0
- package/overlay-service/overlay-position-builder.d.ts +8 -0
- package/overlay-service/overlay-position-builder.js +15 -0
- package/overlay-service/overlay-ref.d.ts +155 -0
- package/overlay-service/overlay-ref.js +436 -0
- package/overlay-service/overlay-strategy.d.ts +48 -0
- package/overlay-service/overlay-strategy.js +3 -0
- package/overlay-service/overlay-viewport.d.ts +85 -0
- package/overlay-service/overlay-viewport.js +192 -0
- package/overlay-service/overlay.css +94 -0
- package/overlay-service/scroll-strategies.d.ts +71 -0
- package/overlay-service/scroll-strategies.js +185 -0
- package/package.json +754 -4
- package/platform/index.d.ts +100 -0
- package/platform/index.js +304 -0
- package/popover/behaviour.d.ts +23 -0
- package/popover/behaviour.js +39 -0
- package/popover/index.d.ts +60 -0
- package/popover/index.jsx +285 -0
- package/popover/popover-overlay.d.ts +27 -0
- package/popover/popover-overlay.jsx +60 -0
- package/popover/use-popover.d.ts +57 -0
- package/popover/use-popover.js +92 -0
- package/portal/index.d.ts +55 -0
- package/portal/index.jsx +83 -0
- package/portal/portal-mount.d.ts +8 -0
- package/portal/portal-mount.js +7 -0
- package/portal/portal-outlet.d.ts +88 -0
- package/portal/portal-outlet.js +222 -0
- package/preview-trigger/behaviour.d.ts +70 -0
- package/preview-trigger/behaviour.jsx +258 -0
- package/preview-trigger/index.d.ts +12 -0
- package/preview-trigger/index.jsx +82 -0
- package/progress-bar/behaviour.d.ts +77 -0
- package/progress-bar/behaviour.jsx +75 -0
- package/progress-bar/context.d.ts +4 -0
- package/progress-bar/context.js +7 -0
- package/progress-bar/index.d.ts +38 -0
- package/progress-bar/index.jsx +90 -0
- package/radio-group/behaviour.d.ts +11 -0
- package/radio-group/behaviour.js +85 -0
- package/radio-group/index.d.ts +82 -0
- package/radio-group/index.jsx +142 -0
- package/radio-group/parts.d.ts +223 -0
- package/radio-group/parts.jsx +425 -0
- package/range-calendar/behaviour.d.ts +2 -0
- package/range-calendar/behaviour.jsx +5 -0
- package/range-calendar/index.d.ts +2 -0
- package/range-calendar/index.jsx +4 -0
- package/resizable/engine/components/group/auto-save/getStorageKey.d.ts +1 -0
- package/resizable/engine/components/group/auto-save/getStorageKey.js +5 -0
- package/resizable/engine/components/group/compareDocumentPosition.d.ts +5 -0
- package/resizable/engine/components/group/compareDocumentPosition.js +19 -0
- package/resizable/engine/components/group/readLegacyLayout.d.ts +16 -0
- package/resizable/engine/components/group/readLegacyLayout.js +48 -0
- package/resizable/engine/components/group/sortByElementOffset.d.ts +4 -0
- package/resizable/engine/components/group/sortByElementOffset.js +28 -0
- package/resizable/engine/components/group/types.d.ts +50 -0
- package/resizable/engine/components/group/types.js +1 -0
- package/resizable/engine/components/panel/types.d.ts +90 -0
- package/resizable/engine/components/panel/types.js +4 -0
- package/resizable/engine/constants.d.ts +15 -0
- package/resizable/engine/constants.js +27 -0
- package/resizable/engine/global/cursor/getCursorStyle.d.ts +7 -0
- package/resizable/engine/global/cursor/getCursorStyle.js +94 -0
- package/resizable/engine/global/cursor/supportsAdvancedCursorStyles.d.ts +5 -0
- package/resizable/engine/global/cursor/supportsAdvancedCursorStyles.js +20 -0
- package/resizable/engine/global/cursor/updateCursorStyle.d.ts +1 -0
- package/resizable/engine/global/cursor/updateCursorStyle.js +64 -0
- package/resizable/engine/global/dom/calculateAvailableAxisSize.d.ts +4 -0
- package/resizable/engine/global/dom/calculateAvailableAxisSize.js +10 -0
- package/resizable/engine/global/dom/calculateHitRegions.d.ts +13 -0
- package/resizable/engine/global/dom/calculateHitRegions.js +153 -0
- package/resizable/engine/global/dom/calculateItemConstraints.d.ts +2 -0
- package/resizable/engine/global/dom/calculateItemConstraints.js +82 -0
- package/resizable/engine/global/event-handlers/onDocumentContextMenu.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentContextMenu.js +9 -0
- package/resizable/engine/global/event-handlers/onDocumentDoubleClick.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentDoubleClick.js +28 -0
- package/resizable/engine/global/event-handlers/onDocumentKeyDown.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentKeyDown.js +97 -0
- package/resizable/engine/global/event-handlers/onDocumentLostPointerCapture.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentLostPointerCapture.js +18 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerCancel.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerCancel.js +8 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerDown.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerDown.js +54 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerLeave.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerLeave.js +22 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerMove.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerMove.js +69 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerOut.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerOut.js +20 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerUp.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onDocumentPointerUp.js +15 -0
- package/resizable/engine/global/event-handlers/onWindowBlur.d.ts +1 -0
- package/resizable/engine/global/event-handlers/onWindowBlur.js +11 -0
- package/resizable/engine/global/mountAxis.d.ts +2 -0
- package/resizable/engine/global/mountAxis.js +187 -0
- package/resizable/engine/global/mutable-state/axes.d.ts +37 -0
- package/resizable/engine/global/mutable-state/axes.js +52 -0
- package/resizable/engine/global/mutable-state/interactions.d.ts +17 -0
- package/resizable/engine/global/mutable-state/interactions.js +92 -0
- package/resizable/engine/global/mutable-state/types.d.ts +32 -0
- package/resizable/engine/global/mutable-state/types.js +1 -0
- package/resizable/engine/global/styles/convertEmToPixels.d.ts +1 -0
- package/resizable/engine/global/styles/convertEmToPixels.js +7 -0
- package/resizable/engine/global/styles/convertRemToPixels.d.ts +1 -0
- package/resizable/engine/global/styles/convertRemToPixels.js +7 -0
- package/resizable/engine/global/styles/convertVhToPixels.d.ts +1 -0
- package/resizable/engine/global/styles/convertVhToPixels.js +5 -0
- package/resizable/engine/global/styles/convertVwToPixels.d.ts +1 -0
- package/resizable/engine/global/styles/convertVwToPixels.js +5 -0
- package/resizable/engine/global/styles/parseSizeAndUnit.d.ts +2 -0
- package/resizable/engine/global/styles/parseSizeAndUnit.js +29 -0
- package/resizable/engine/global/styles/sizeStyleToPixels.d.ts +5 -0
- package/resizable/engine/global/styles/sizeStyleToPixels.js +38 -0
- package/resizable/engine/global/types.d.ts +120 -0
- package/resizable/engine/global/types.js +1 -0
- package/resizable/engine/global/utils/abortActivePointerResize.d.ts +9 -0
- package/resizable/engine/global/utils/abortActivePointerResize.js +52 -0
- package/resizable/engine/global/utils/adjustLayoutByDelta.d.ts +9 -0
- package/resizable/engine/global/utils/adjustLayoutByDelta.js +219 -0
- package/resizable/engine/global/utils/adjustLayoutForSeparator.d.ts +1 -0
- package/resizable/engine/global/utils/adjustLayoutForSeparator.js +48 -0
- package/resizable/engine/global/utils/calculateDefaultLayout.d.ts +2 -0
- package/resizable/engine/global/utils/calculateDefaultLayout.js +30 -0
- package/resizable/engine/global/utils/calculateResizePreviews.d.ts +3 -0
- package/resizable/engine/global/utils/calculateResizePreviews.js +39 -0
- package/resizable/engine/global/utils/calculateSeparatorAriaValues.d.ts +12 -0
- package/resizable/engine/global/utils/calculateSeparatorAriaValues.js +43 -0
- package/resizable/engine/global/utils/compareLayoutNumbers.d.ts +1 -0
- package/resizable/engine/global/utils/compareLayoutNumbers.js +11 -0
- package/resizable/engine/global/utils/completeActivePointerResize.d.ts +6 -0
- package/resizable/engine/global/utils/completeActivePointerResize.js +49 -0
- package/resizable/engine/global/utils/doRectsIntersect.d.ts +2 -0
- package/resizable/engine/global/utils/doRectsIntersect.js +3 -0
- package/resizable/engine/global/utils/expandHitTarget.d.ts +10 -0
- package/resizable/engine/global/utils/expandHitTarget.js +19 -0
- package/resizable/engine/global/utils/findClosestHitRegion.d.ts +9 -0
- package/resizable/engine/global/utils/findClosestHitRegion.js +35 -0
- package/resizable/engine/global/utils/findClosestRect.d.ts +6 -0
- package/resizable/engine/global/utils/findClosestRect.js +22 -0
- package/resizable/engine/global/utils/findMatchingHitRegions.d.ts +7 -0
- package/resizable/engine/global/utils/findMatchingHitRegions.js +29 -0
- package/resizable/engine/global/utils/findSeparatorAxis.d.ts +21 -0
- package/resizable/engine/global/utils/findSeparatorAxis.js +12 -0
- package/resizable/engine/global/utils/formatLayoutNumber.d.ts +1 -0
- package/resizable/engine/global/utils/formatLayoutNumber.js +5 -0
- package/resizable/engine/global/utils/getDefaultLayout.d.ts +5 -0
- package/resizable/engine/global/utils/getDefaultLayout.js +11 -0
- package/resizable/engine/global/utils/getDistanceBetweenPointAndRect.d.ts +5 -0
- package/resizable/engine/global/utils/getDistanceBetweenPointAndRect.js +6 -0
- package/resizable/engine/global/utils/getImperativeAxisMethods.d.ts +4 -0
- package/resizable/engine/global/utils/getImperativeAxisMethods.js +53 -0
- package/resizable/engine/global/utils/getImperativeItemMethods.d.ts +5 -0
- package/resizable/engine/global/utils/getImperativeItemMethods.js +169 -0
- package/resizable/engine/global/utils/isCoarsePointer.d.ts +4 -0
- package/resizable/engine/global/utils/isCoarsePointer.js +17 -0
- package/resizable/engine/global/utils/isModal.d.ts +1 -0
- package/resizable/engine/global/utils/isModal.js +11 -0
- package/resizable/engine/global/utils/isViableHitTarget.d.ts +5 -0
- package/resizable/engine/global/utils/isViableHitTarget.js +50 -0
- package/resizable/engine/global/utils/itemConstraintsEqual.d.ts +2 -0
- package/resizable/engine/global/utils/itemConstraintsEqual.js +9 -0
- package/resizable/engine/global/utils/layoutNumbersEqual.d.ts +1 -0
- package/resizable/engine/global/utils/layoutNumbersEqual.js +6 -0
- package/resizable/engine/global/utils/layoutsEqual.d.ts +2 -0
- package/resizable/engine/global/utils/layoutsEqual.js +15 -0
- package/resizable/engine/global/utils/normalizeLayout.d.ts +11 -0
- package/resizable/engine/global/utils/normalizeLayout.js +21 -0
- package/resizable/engine/global/utils/notifyItemOnResize.d.ts +2 -0
- package/resizable/engine/global/utils/notifyItemOnResize.js +23 -0
- package/resizable/engine/global/utils/objectsEqual.d.ts +1 -0
- package/resizable/engine/global/utils/objectsEqual.js +14 -0
- package/resizable/engine/global/utils/preserveFixedItemSizes.d.ts +7 -0
- package/resizable/engine/global/utils/preserveFixedItemSizes.js +53 -0
- package/resizable/engine/global/utils/recordAxisLayoutChange.d.ts +15 -0
- package/resizable/engine/global/utils/recordAxisLayoutChange.js +25 -0
- package/resizable/engine/global/utils/updateActiveHitRegion.d.ts +18 -0
- package/resizable/engine/global/utils/updateActiveHitRegion.js +119 -0
- package/resizable/engine/global/utils/validateAxisLayout.d.ts +5 -0
- package/resizable/engine/global/utils/validateAxisLayout.js +70 -0
- package/resizable/engine/global/utils/validateItemSize.d.ts +7 -0
- package/resizable/engine/global/utils/validateItemSize.js +31 -0
- package/resizable/engine/global/utils/validateLayoutKeys.d.ts +2 -0
- package/resizable/engine/global/utils/validateLayoutKeys.js +13 -0
- package/resizable/engine/types.d.ts +13 -0
- package/resizable/engine/types.js +1 -0
- package/resizable/engine/utils/EventEmitter.d.ts +11 -0
- package/resizable/engine/utils/EventEmitter.js +60 -0
- package/resizable/engine/utils/assert.d.ts +1 -0
- package/resizable/engine/utils/assert.js +7 -0
- package/resizable/engine/utils/isArrayEqual.d.ts +1 -0
- package/resizable/engine/utils/isArrayEqual.js +15 -0
- package/resizable/engine/utils/isHTMLElement.d.ts +1 -0
- package/resizable/engine/utils/isHTMLElement.js +6 -0
- package/resizable/engine/utils/isShadowRoot.d.ts +1 -0
- package/resizable/engine/utils/isShadowRoot.js +6 -0
- package/resizable/engine/vendor/stacking-order.d.ts +7 -0
- package/resizable/engine/vendor/stacking-order.js +122 -0
- package/resizable/index.d.ts +263 -0
- package/resizable/index.jsx +537 -0
- package/resizable/mount.d.ts +115 -0
- package/resizable/mount.js +540 -0
- package/scheduler/behaviour.d.ts +71 -0
- package/scheduler/behaviour.js +243 -0
- package/scheduler/context.d.ts +100 -0
- package/scheduler/context.jsx +7 -0
- package/scheduler/dates.d.ts +53 -0
- package/scheduler/dates.js +183 -0
- package/scheduler/drag.d.ts +20 -0
- package/scheduler/drag.js +361 -0
- package/scheduler/event.d.ts +26 -0
- package/scheduler/event.jsx +93 -0
- package/scheduler/index.d.ts +57 -0
- package/scheduler/index.jsx +303 -0
- package/scheduler/intl.d.ts +16 -0
- package/scheduler/intl.js +529 -0
- package/scheduler/keys-month.d.ts +7 -0
- package/scheduler/keys-month.js +110 -0
- package/scheduler/keys-time-grid.d.ts +9 -0
- package/scheduler/keys-time-grid.js +115 -0
- package/scheduler/keys.d.ts +103 -0
- package/scheduler/keys.js +527 -0
- package/scheduler/layout-index.d.ts +3 -0
- package/scheduler/layout-index.js +6 -0
- package/scheduler/layout.d.ts +285 -0
- package/scheduler/layout.js +378 -0
- package/scheduler/menus.d.ts +66 -0
- package/scheduler/menus.jsx +88 -0
- package/scheduler/month.d.ts +26 -0
- package/scheduler/month.jsx +215 -0
- package/scheduler/pointer.d.ts +64 -0
- package/scheduler/pointer.js +203 -0
- package/scheduler/select.d.ts +11 -0
- package/scheduler/select.js +64 -0
- package/scheduler/selection.d.ts +34 -0
- package/scheduler/selection.js +39 -0
- package/scheduler/state.d.ts +296 -0
- package/scheduler/state.js +496 -0
- package/scheduler/time-grid-client.d.ts +32 -0
- package/scheduler/time-grid-client.jsx +133 -0
- package/scheduler/time-grid.d.ts +26 -0
- package/scheduler/time-grid.jsx +266 -0
- package/scheduler/time.d.ts +35 -0
- package/scheduler/time.js +56 -0
- package/scheduler/toolbar.d.ts +43 -0
- package/scheduler/toolbar.jsx +38 -0
- package/scroll-area/dom.d.ts +11 -0
- package/scroll-area/dom.js +55 -0
- package/scroll-area/index.d.ts +96 -0
- package/scroll-area/index.jsx +884 -0
- package/scroll-area/presence.d.ts +12 -0
- package/scroll-area/presence.jsx +131 -0
- package/scrolling/auto-size-virtual-scroll.d.ts +53 -0
- package/scrolling/auto-size-virtual-scroll.js +213 -0
- package/scrolling/behaviour.d.ts +3 -0
- package/scrolling/behaviour.js +5 -0
- package/scrolling/emitter.d.ts +34 -0
- package/scrolling/emitter.js +144 -0
- package/scrolling/fixed-size-virtual-scroll.d.ts +28 -0
- package/scrolling/fixed-size-virtual-scroll.js +107 -0
- package/scrolling/index.d.ts +11 -0
- package/scrolling/index.jsx +13 -0
- package/scrolling/rtl.d.ts +16 -0
- package/scrolling/rtl.js +64 -0
- package/scrolling/scroll-dispatcher.d.ts +49 -0
- package/scrolling/scroll-dispatcher.js +107 -0
- package/scrolling/scrollable.d.ts +75 -0
- package/scrolling/scrollable.js +149 -0
- package/scrolling/scrolling.css +11 -0
- package/scrolling/state.d.ts +92 -0
- package/scrolling/state.js +94 -0
- package/scrolling/viewport-ruler.d.ts +47 -0
- package/scrolling/viewport-ruler.js +100 -0
- package/scrolling/viewport.d.ts +54 -0
- package/scrolling/viewport.jsx +105 -0
- package/scrolling/virtual-scroll-strategy.d.ts +41 -0
- package/scrolling/virtual-scroll-strategy.js +2 -0
- package/scrolling/virtual-scroll-viewport.d.ts +95 -0
- package/scrolling/virtual-scroll-viewport.js +370 -0
- package/search-field/behaviour.d.ts +62 -0
- package/search-field/behaviour.jsx +116 -0
- package/search-field/index.d.ts +57 -0
- package/search-field/index.jsx +158 -0
- package/search-field/intl.d.ts +2 -0
- package/search-field/intl.js +36 -0
- package/select/behaviour.d.ts +188 -0
- package/select/behaviour.jsx +445 -0
- package/select/hidden-select.d.ts +44 -0
- package/select/hidden-select.jsx +68 -0
- package/select/index.d.ts +123 -0
- package/select/index.jsx +255 -0
- package/select/intl.d.ts +2 -0
- package/select/intl.js +36 -0
- package/select/parts.d.ts +11 -0
- package/select/parts.jsx +12 -0
- package/select/select-parts.d.ts +73 -0
- package/select/select-parts.jsx +293 -0
- package/select/select-value.d.ts +58 -0
- package/select/select-value.jsx +142 -0
- package/selection/dom-utils.d.ts +25 -0
- package/selection/dom-utils.js +77 -0
- package/selection/keyed.d.ts +19 -0
- package/selection/keyed.js +66 -0
- package/selection/list-keyboard-delegate.d.ts +67 -0
- package/selection/list-keyboard-delegate.js +274 -0
- package/selection/manager.d.ts +112 -0
- package/selection/manager.js +340 -0
- package/selection/selectable-collection.d.ts +123 -0
- package/selection/selectable-collection.js +560 -0
- package/selection/selectable-item.d.ts +128 -0
- package/selection/selectable-item.js +486 -0
- package/selection/selectable-list.d.ts +42 -0
- package/selection/selectable-list.js +34 -0
- package/selection/state.d.ts +96 -0
- package/selection/state.js +131 -0
- package/selection/type-select.d.ts +37 -0
- package/selection/type-select.js +114 -0
- package/selection/utils.d.ts +23 -0
- package/selection/utils.js +38 -0
- package/selection-indicator/context.d.ts +10 -0
- package/selection-indicator/context.js +7 -0
- package/selection-indicator/index.d.ts +20 -0
- package/selection-indicator/index.jsx +25 -0
- package/separator/behaviour.d.ts +17 -0
- package/separator/behaviour.js +17 -0
- package/separator/index.d.ts +23 -0
- package/separator/index.jsx +64 -0
- package/shared-element-transition/index.d.ts +36 -0
- package/shared-element-transition/index.jsx +182 -0
- package/shared-element-transition/transition.d.ts +19 -0
- package/shared-element-transition/transition.jsx +20 -0
- package/sheet-motion/index.d.ts +82 -0
- package/sheet-motion/index.js +386 -0
- package/sidebar/index.d.ts +257 -0
- package/sidebar/index.jsx +625 -0
- package/sidebar/pages.d.ts +71 -0
- package/sidebar/pages.jsx +177 -0
- package/sidebar/resize.d.ts +69 -0
- package/sidebar/resize.js +237 -0
- package/sidebar/sheet-motion.d.ts +15 -0
- package/sidebar/sheet-motion.js +170 -0
- package/sidebar/state.d.ts +126 -0
- package/sidebar/state.js +204 -0
- package/slider/behaviour.d.ts +141 -0
- package/slider/behaviour.jsx +492 -0
- package/slider/index.d.ts +171 -0
- package/slider/index.jsx +392 -0
- package/slider/state.d.ts +203 -0
- package/slider/state.js +377 -0
- package/slots/index.d.ts +248 -0
- package/slots/index.jsx +473 -0
- package/spinbutton/behaviour.d.ts +66 -0
- package/spinbutton/behaviour.jsx +312 -0
- package/spinbutton/intl.d.ts +2 -0
- package/spinbutton/intl.js +36 -0
- package/state/autocomplete.d.ts +26 -0
- package/state/autocomplete.js +32 -0
- package/state/calendar.d.ts +284 -0
- package/state/calendar.js +755 -0
- package/state/checkbox-group.d.ts +67 -0
- package/state/checkbox-group.js +76 -0
- package/state/combobox.d.ts +238 -0
- package/state/combobox.js +708 -0
- package/state/date-field.d.ts +407 -0
- package/state/date-field.js +1117 -0
- package/state/date-intl.d.ts +3 -0
- package/state/date-intl.js +36 -0
- package/state/date-picker.d.ts +144 -0
- package/state/date-picker.js +387 -0
- package/state/disclosure.d.ts +90 -0
- package/state/disclosure.js +148 -0
- package/state/form-validation.d.ts +89 -0
- package/state/form-validation.js +158 -0
- package/state/grid.d.ts +62 -0
- package/state/grid.js +127 -0
- package/state/list.d.ts +58 -0
- package/state/list.js +124 -0
- package/state/menu.d.ts +162 -0
- package/state/menu.js +185 -0
- package/state/overlays.d.ts +35 -0
- package/state/overlays.js +29 -0
- package/state/radio-group.d.ts +58 -0
- package/state/radio-group.js +68 -0
- package/state/search-field.d.ts +20 -0
- package/state/search-field.js +21 -0
- package/state/select.d.ts +150 -0
- package/state/select.js +187 -0
- package/state/selection.d.ts +3 -0
- package/state/selection.js +5 -0
- package/state/table-column-resize.d.ts +58 -0
- package/state/table-column-resize.js +76 -0
- package/state/table.d.ts +81 -0
- package/state/table.js +114 -0
- package/state/tabs.d.ts +85 -0
- package/state/tabs.js +161 -0
- package/state/time-field.d.ts +32 -0
- package/state/time-field.js +34 -0
- package/state/toast.d.ts +80 -0
- package/state/toast.js +146 -0
- package/state/toggle-group.d.ts +70 -0
- package/state/toggle-group.js +110 -0
- package/state/toggle.d.ts +40 -0
- package/state/toggle.js +39 -0
- package/state/tooltip.d.ts +53 -0
- package/state/tooltip.js +153 -0
- package/stepper/index.d.ts +117 -0
- package/stepper/index.jsx +405 -0
- package/stepper/state.d.ts +200 -0
- package/stepper/state.js +325 -0
- package/switch/behaviour.d.ts +12 -0
- package/switch/behaviour.jsx +9 -0
- package/switch/index.d.ts +150 -0
- package/switch/index.jsx +186 -0
- package/table/behaviour.d.ts +181 -0
- package/table/behaviour.js +334 -0
- package/table/collection.d.ts +49 -0
- package/table/collection.js +259 -0
- package/table/column-resize.d.ts +48 -0
- package/table/column-resize.jsx +247 -0
- package/table/index.d.ts +339 -0
- package/table/index.jsx +1326 -0
- package/table/intl.d.ts +2 -0
- package/table/intl.js +36 -0
- package/table/keyboard-delegate.d.ts +21 -0
- package/table/keyboard-delegate.js +166 -0
- package/table/rac-intl.d.ts +2 -0
- package/table/rac-intl.js +36 -0
- package/tabs/behaviour.d.ts +49 -0
- package/tabs/behaviour.js +173 -0
- package/tabs/index.d.ts +248 -0
- package/tabs/index.jsx +577 -0
- package/tabs/keyboard-delegate.d.ts +17 -0
- package/tabs/keyboard-delegate.js +64 -0
- package/tag-group/behaviour.d.ts +59 -0
- package/tag-group/behaviour.js +112 -0
- package/tag-group/index.d.ts +138 -0
- package/tag-group/index.jsx +565 -0
- package/tag-group/intl.d.ts +2 -0
- package/tag-group/intl.js +36 -0
- package/tailwind.css +12 -0
- package/tests-components/app/src/routes/index.d.ts +4 -0
- package/tests-components/app/src/routes/index.jsx +7 -0
- package/text/index.d.ts +15 -0
- package/text/index.jsx +61 -0
- package/text-area/index.d.ts +19 -0
- package/text-area/index.jsx +76 -0
- package/text-field/autosize.d.ts +70 -0
- package/text-field/autosize.js +355 -0
- package/text-field/behaviour.d.ts +140 -0
- package/text-field/behaviour.jsx +260 -0
- package/text-field/fields.d.ts +12 -0
- package/text-field/fields.js +20 -0
- package/text-field/index.d.ts +50 -0
- package/text-field/index.jsx +174 -0
- package/text-field/text-field.css +45 -0
- package/theme.css +1006 -0
- package/time-wheels/behaviour.d.ts +29 -0
- package/time-wheels/behaviour.js +156 -0
- package/time-wheels/index.d.ts +27 -0
- package/time-wheels/index.jsx +91 -0
- package/toast/behaviour.d.ts +51 -0
- package/toast/behaviour.jsx +273 -0
- package/toast/index.d.ts +94 -0
- package/toast/index.jsx +256 -0
- package/toast/intl.d.ts +2 -0
- package/toast/intl.js +36 -0
- package/toggle-button/behaviour.d.ts +15 -0
- package/toggle-button/behaviour.js +37 -0
- package/toggle-button/index.d.ts +59 -0
- package/toggle-button/index.jsx +206 -0
- package/toggle-button-group/behaviour.d.ts +19 -0
- package/toggle-button-group/behaviour.jsx +13 -0
- package/toggle-button-group/context.d.ts +7 -0
- package/toggle-button-group/context.js +9 -0
- package/toggle-button-group/index.d.ts +39 -0
- package/toggle-button-group/index.jsx +85 -0
- package/toggle-button-group/item.d.ts +30 -0
- package/toggle-button-group/item.jsx +37 -0
- package/toolbar/behaviour.d.ts +22 -0
- package/toolbar/behaviour.js +89 -0
- package/toolbar/index.d.ts +16 -0
- package/toolbar/index.jsx +67 -0
- package/tooltip/behaviour.d.ts +93 -0
- package/tooltip/behaviour.jsx +299 -0
- package/tooltip/index.d.ts +59 -0
- package/tooltip/index.jsx +193 -0
- package/tree/behaviour.d.ts +51 -0
- package/tree/behaviour.jsx +51 -0
- package/tree/cdk-index.d.ts +2 -0
- package/tree/cdk-index.js +6 -0
- package/tree/collection.d.ts +16 -0
- package/tree/collection.js +138 -0
- package/tree/control.d.ts +125 -0
- package/tree/control.js +166 -0
- package/tree/index.d.ts +154 -0
- package/tree/index.jsx +837 -0
- package/tree/intl.d.ts +2 -0
- package/tree/intl.js +36 -0
- package/tree/navigation-context.d.ts +44 -0
- package/tree/navigation-context.jsx +63 -0
- package/tree/tree-key-manager.d.ts +149 -0
- package/tree/tree-key-manager.js +336 -0
- package/utils/animation.d.ts +32 -0
- package/utils/animation.jsx +236 -0
- package/utils/data-attrs.d.ts +73 -0
- package/utils/data-attrs.jsx +217 -0
- package/utils/dev-off.d.ts +3 -0
- package/utils/dev-off.js +7 -0
- package/utils/dev-on.d.ts +3 -0
- package/utils/dev-on.js +17 -0
- package/utils/dom-props.d.ts +44 -0
- package/utils/dom-props.js +73 -0
- package/utils/dom.d.ts +85 -0
- package/utils/dom.js +402 -0
- package/utils/id.d.ts +23 -0
- package/utils/id.js +100 -0
- package/utils/index.d.ts +43 -0
- package/utils/index.js +160 -0
- package/utils/link-state.d.ts +6 -0
- package/utils/link-state.js +6 -0
- package/utils/links.d.ts +82 -0
- package/utils/links.jsx +150 -0
- package/utils/live-element.d.ts +8 -0
- package/utils/live-element.jsx +76 -0
- package/utils/live.d.ts +53 -0
- package/utils/live.jsx +169 -0
- package/utils/load-more-sentinel.d.ts +28 -0
- package/utils/load-more-sentinel.jsx +52 -0
- package/utils/motion-token.d.ts +4 -0
- package/utils/motion-token.js +48 -0
- package/utils/render.d.ts +19 -0
- package/utils/render.js +18 -0
- package/utils/transitions.d.ts +15 -0
- package/utils/transitions.js +104 -0
- package/utils/types.d.ts +111 -0
- package/utils/types.js +1 -0
- package/virtualizer/behaviour.d.ts +129 -0
- package/virtualizer/behaviour.js +437 -0
- package/virtualizer/collection-renderer.d.ts +62 -0
- package/virtualizer/collection-renderer.jsx +190 -0
- package/virtualizer/collection.d.ts +103 -0
- package/virtualizer/collection.js +155 -0
- package/virtualizer/dom.d.ts +50 -0
- package/virtualizer/dom.js +233 -0
- package/virtualizer/engine.d.ts +21 -0
- package/virtualizer/engine.js +21 -0
- package/virtualizer/grid-layout.d.ts +50 -0
- package/virtualizer/grid-layout.js +247 -0
- package/virtualizer/index.d.ts +3 -0
- package/virtualizer/index.jsx +5 -0
- package/virtualizer/layout-info.d.ts +33 -0
- package/virtualizer/layout-info.js +54 -0
- package/virtualizer/layout.d.ts +44 -0
- package/virtualizer/layout.js +30 -0
- package/virtualizer/list-layout.d.ts +103 -0
- package/virtualizer/list-layout.js +510 -0
- package/virtualizer/overscan-manager.d.ts +9 -0
- package/virtualizer/overscan-manager.js +32 -0
- package/virtualizer/point.d.ts +13 -0
- package/virtualizer/point.js +23 -0
- package/virtualizer/rect.d.ts +49 -0
- package/virtualizer/rect.js +105 -0
- package/virtualizer/reusable-view.d.ts +29 -0
- package/virtualizer/reusable-view.js +56 -0
- package/virtualizer/scroll-anchor.d.ts +62 -0
- package/virtualizer/scroll-anchor.js +130 -0
- package/virtualizer/size.d.ts +11 -0
- package/virtualizer/size.js +21 -0
- package/virtualizer/state.d.ts +35 -0
- package/virtualizer/state.js +89 -0
- package/virtualizer/table-collection.d.ts +45 -0
- package/virtualizer/table-collection.js +80 -0
- package/virtualizer/table-column-layout.d.ts +44 -0
- package/virtualizer/table-column-layout.js +210 -0
- package/virtualizer/table-layout.d.ts +55 -0
- package/virtualizer/table-layout.js +482 -0
- package/virtualizer/types.d.ts +63 -0
- package/virtualizer/types.js +1 -0
- package/virtualizer/utils.d.ts +2 -0
- package/virtualizer/utils.js +12 -0
- package/virtualizer/virtualizer-core.d.ts +61 -0
- package/virtualizer/virtualizer-core.js +304 -0
- package/virtualizer/virtualizer.d.ts +64 -0
- package/virtualizer/virtualizer.jsx +91 -0
- package/virtualizer/waterfall-layout.d.ts +41 -0
- package/virtualizer/waterfall-layout.js +227 -0
- package/wheel-picker/behaviour.d.ts +94 -0
- package/wheel-picker/behaviour.js +482 -0
- package/wheel-picker/index.d.ts +33 -0
- package/wheel-picker/index.jsx +66 -0
package/table/index.jsx
ADDED
|
@@ -0,0 +1,1326 @@
|
|
|
1
|
+
// Ported from react-aria-components (src/Table.tsx: Table, TableHeader, Column, ColumnResizer,
|
|
2
|
+
// TableBody, TableFooter, Row, Cell, TableLoadMoreItem, ResizableTableContainer, TableContext,
|
|
3
|
+
// TableStateContext, TableColumnResizeStateContext, TableOptionsContext / useTableOptions,
|
|
4
|
+
// RowFocusContext), Apache-2.0, © Adobe.
|
|
5
|
+
//
|
|
6
|
+
// A table displays data in rows and columns: keyboard navigation, row selection (checkboxes via
|
|
7
|
+
// `<Checkbox slot="selection">`), sorting, column resizing, expandable rows (treegrid), links, actions.
|
|
8
|
+
// Rivet:
|
|
9
|
+
// - The collection is built from the content (`collectionOf`, B5 build mode) into `./collection.ts`
|
|
10
|
+
// `TableCollection` (RAC's internal class), flattened by the expanded keys and filtered by the
|
|
11
|
+
// SelectableCollectionContext `filter` in a computed; `CollectionRendererContext.CollectionRoot`
|
|
12
|
+
// renders the header / body / footer sections keyed by node key (resumed rows are adopted).
|
|
13
|
+
// - State: `../state/table.ts` `createTableState` (signals + plain data); the react-stately `TableState`
|
|
14
|
+
// view (collection + SelectionManager instances) is rebuilt per event / binding. Handlers are inline
|
|
15
|
+
// arrows calling `./behaviour.ts` / `../grid/behaviour.ts` free functions with KEYS, never nodes.
|
|
16
|
+
// - `TableStateContext` / `TableColumnResizeStateContext` provide ACCESSORS of the state views
|
|
17
|
+
// (`useContext(TableStateContext)!()`), not the views (deviation: views hold class instances).
|
|
18
|
+
// - `tableOptions()` = RAC `useTableOptions()` (cdk naming: no `use*`).
|
|
19
|
+
// - Render props are accessors (`class={({ isSelected }) => (isSelected() ? "on" : "")}`); `data-*`
|
|
20
|
+
// state values `"true"`; `class` = RAC `className` (defaults `rv-Table`, `rv-TableHeader`, `rv-Column`,
|
|
21
|
+
// `rv-ColumnResizer`, `rv-TableBody`, `rv-TableFooter`, `rv-Row`, `rv-Cell`, `rv-TableLoadingIndicator`,
|
|
22
|
+
// `rv-ResizableTableContainer`).
|
|
23
|
+
// - react-aria `useDescription` elements (sort, sortable column, long-press, resizer descriptions) are
|
|
24
|
+
// rendered by the Table as hidden siblings after the `<table>` (server HTML carries them; a `<div>`
|
|
25
|
+
// inside `<table>` would be foster-parented by the HTML parser).
|
|
26
|
+
// - Selection checkbox / expand button ids derive from the table id + row key (byte-stable server HTML).
|
|
27
|
+
// Deviations:
|
|
28
|
+
// - Inside a `<CollectionVirtualizer layout={TableLayout}>` (RAC useElementType) every part renders a `div` with its role
|
|
29
|
+
// (the JSX of each part is duplicated per element type: one compiled template per tag, the native path untouched);
|
|
30
|
+
// the grid element is the scroll container (it forwards `scroll` to the renderer) and the focused key is persisted.
|
|
31
|
+
// - Drag and drop (`dragAndDropHooks`, drop indicators, `slot="drag"` button) not wired yet (DnD lane).
|
|
32
|
+
// - No `FocusScope` wrapper (nothing here reads its context); the SharedElementTransition scope is a `SharedElementContext` provider entry.
|
|
33
|
+
// - Header placeholder cells (nested columns, react-stately level) render nothing — RAC renders
|
|
34
|
+
// `node.render` of a placeholder (no render: throws); RAC `Column` is a leaf, so RAC tables never
|
|
35
|
+
// have them.
|
|
36
|
+
import { computed, createContext, provide, runWithOwner, signal, untrack, useContext } from "@rivetjs/reactivity";
|
|
37
|
+
import { For, Portal, Show, clientEffect, ref as elementRef } from "@rivetjs/runtime/dom";
|
|
38
|
+
import { isSlot, renderSlot } from "@rivetjs/runtime/slot";
|
|
39
|
+
import { Collection, CollectionRendererContext, DefaultCollectionRenderer, collectionOf, createBranchComponent, createLeafComponent, renderNodeAt, } from "../collections/components.jsx";
|
|
40
|
+
import { LoaderNode } from "../collections/base.js";
|
|
41
|
+
import { createTableState, tableState } from "../state/table.js";
|
|
42
|
+
import { resetGridFocusedKey } from "../state/grid.js";
|
|
43
|
+
import { createTableColumnResizeState, tableColumnResizeState } from "../state/table-column-resize.js";
|
|
44
|
+
import { gridBlur, gridCellClick, gridCellFocus, gridCellKeyDown, gridCellKeyDownCapture, gridCellKeyUp, gridCellPointerDown, gridCellPointerUp, gridFocus, gridKeyDown, gridKeyDownCapture, gridMouseDown, gridRowClick, gridRowDoubleClick, gridRowDragStart, gridRowFocus, gridRowKeyDown, gridRowKeyUp, gridRowPointerCancel, gridRowPointerDown, gridRowPointerUp, gridShared, highlightSelectionDescription, } from "../grid/behaviour.js";
|
|
45
|
+
import { getRowLabelledBy, normalizeKey, tableCellProps, tableColumnHeaderPress, tableColumnHeaderPressable, tableColumnHeaderProps, tableGridProps, tableHeaderRowProps, tableProps, tableRowExpandPress, tableRowKeyDown, tableRowProps, tableSelectAllCheckboxChange, tableSelectAllCheckboxProps, tableSelectionCheckboxChange, tableSelectionCheckboxProps, tableSortDescription, } from "./behaviour.js";
|
|
46
|
+
import { focusColumnResizer, tableColumnResizeProps } from "./column-resize.jsx";
|
|
47
|
+
import { TableBodyNode, TableCellNode, TableCollection, TableColumnNode, TableFooterNode, TableHeaderNode, TableRowNode } from "./collection.js";
|
|
48
|
+
import { strings as tableStrings } from "./intl.js";
|
|
49
|
+
import { strings as racStrings } from "./rac-intl.js";
|
|
50
|
+
import { formatMessage } from "../_adapters/intl.js";
|
|
51
|
+
import { pressClick, pressDragStart, pressKeyDown, pressMouseDown, pressPointerDown, pressPointerEnter, pressPointerLeave, pressPointerUp, } from "../button/press.js";
|
|
52
|
+
import { ButtonContext } from "../button/index.jsx";
|
|
53
|
+
import { CheckboxContext, CheckboxFieldContext } from "../checkbox/index.jsx";
|
|
54
|
+
import { SelectionIndicatorContext } from "../selection-indicator/context.js";
|
|
55
|
+
import { SharedElementContext } from "../shared-element-transition/transition.jsx";
|
|
56
|
+
import { FieldInputContext, SelectableCollectionContext } from "../autocomplete/contexts.js";
|
|
57
|
+
import { DEFAULT_SLOT, Provider, contextProps, mergeRefValues, renderProps, resumableContext, } from "../slots/index.jsx";
|
|
58
|
+
import { dataBool, focusStateBlur, focusStateFocus, focusStateIn, hoverStateEnter, hoverStateLeave, hoverStateOver, } from "../utils/data-attrs.jsx";
|
|
59
|
+
import { focusRingBlur, focusRingFocus, useFocusRing } from "../focus/focus-ring.jsx";
|
|
60
|
+
import { isFocusVisible } from "../interactions/focus-visible.jsx";
|
|
61
|
+
import { focusSafely, getFocusableTreeWalker } from "../focus/index.js";
|
|
62
|
+
import { getItemElement } from "../collections/dom.js";
|
|
63
|
+
import { globalDOMProps } from "../utils/dom-props.js";
|
|
64
|
+
import { isScrollable } from "../utils/dom.js";
|
|
65
|
+
import { useId } from "../utils/id.js";
|
|
66
|
+
import { useLocale } from "../i18n/index.js";
|
|
67
|
+
import { loadMoreSentinel } from "../utils/load-more-sentinel.jsx";
|
|
68
|
+
import { useRouter } from "../utils/links.jsx";
|
|
69
|
+
import { hasLive, liveKeys } from "../utils/live.jsx";
|
|
70
|
+
import { liveRenderProps } from "../slots/index.jsx";
|
|
71
|
+
export { TableCollection } from "./collection.js";
|
|
72
|
+
const read = (value) => (typeof value === "function" ? value() : value);
|
|
73
|
+
// ---------------------------------------------------------------------------------------------
|
|
74
|
+
// Contexts
|
|
75
|
+
// ---------------------------------------------------------------------------------------------
|
|
76
|
+
/** RAC `TableContext`: props for the Tables inside a component, optionally per `slot`. */
|
|
77
|
+
export const TableContext = resumableContext(createContext(null, { id: "rv-table" }));
|
|
78
|
+
/** RAC `TableStateContext` (Rivet: an accessor of the state view of the enclosing Table). */
|
|
79
|
+
export const TableStateContext = resumableContext(createContext(null, { id: "rv-table-state" }));
|
|
80
|
+
/** RAC `TableColumnResizeStateContext` (Rivet: an accessor; null outside a ResizableTableContainer). */
|
|
81
|
+
export const TableColumnResizeStateContext = resumableContext(createContext(null, { id: "rv-table-column-resize-state" }));
|
|
82
|
+
const TableOptionsContext = resumableContext(createContext(null, { id: "rv-table-options" }));
|
|
83
|
+
/** Returns options from the parent `<Table>` component (RAC `useTableOptions`). */
|
|
84
|
+
export function tableOptions() {
|
|
85
|
+
return useContext(TableOptionsContext);
|
|
86
|
+
}
|
|
87
|
+
/** RAC `RowFocusContext` (Rivet: `isFocusVisibleWithinRow` is an accessor). */
|
|
88
|
+
export const RowFocusContext = resumableContext(createContext({ isFocusVisibleWithinRow: () => false }, { id: "rv-row-focus" }));
|
|
89
|
+
const TableInternalContext = resumableContext(createContext(null, { id: "rv-table-internal" }));
|
|
90
|
+
const ResizableTableContainerContext = resumableContext(createContext(null, { id: "rv-resizable-table-container" }));
|
|
91
|
+
const ColumnResizerContext = resumableContext(createContext(null, { id: "rv-column-resizer" }));
|
|
92
|
+
const columnOf = (c, key) => (c.getItem(key) ?? undefined);
|
|
93
|
+
/** Wraps a Table to enable column resizing (ColumnResizer); measures the scrollable width. */
|
|
94
|
+
export function ResizableTableContainer(props) {
|
|
95
|
+
const container = elementRef();
|
|
96
|
+
const containerRef = mergeRefValues(container, props.ref);
|
|
97
|
+
const tableRef = elementRef();
|
|
98
|
+
const tableWidth = signal(0);
|
|
99
|
+
clientEffect(() => {
|
|
100
|
+
// Walk up the DOM from the Table to the ResizableTableContainer and stop when we reach the first
|
|
101
|
+
// scrollable element: what we measure to determine column widths (scrollbar widths).
|
|
102
|
+
const root = container();
|
|
103
|
+
let table = tableRef();
|
|
104
|
+
while (table && table !== root && !isScrollable(table))
|
|
105
|
+
table = table.parentElement;
|
|
106
|
+
const scroll = table ?? null;
|
|
107
|
+
if (!scroll)
|
|
108
|
+
return;
|
|
109
|
+
tableWidth.set(scroll.clientWidth);
|
|
110
|
+
const view = scroll.ownerDocument.defaultView;
|
|
111
|
+
if (!view || typeof view.ResizeObserver === "undefined")
|
|
112
|
+
return;
|
|
113
|
+
const observer = new view.ResizeObserver(() => tableWidth.set(scroll.clientWidth));
|
|
114
|
+
observer.observe(scroll, { box: "border-box" });
|
|
115
|
+
return () => observer.disconnect();
|
|
116
|
+
});
|
|
117
|
+
// Locals only (PROPS-CAPTURE: a literal reading `props.x` captures the whole props object).
|
|
118
|
+
const { onResizeStart, onResize, onResizeEnd } = props;
|
|
119
|
+
const ctx = { tableWidth, tableRef: tableRef, onResizeStart, onResize, onResizeEnd };
|
|
120
|
+
const dom = globalDOMProps(props, ["style"]);
|
|
121
|
+
const className = props.class || "rv-ResizableTableContainer";
|
|
122
|
+
const style = props.style;
|
|
123
|
+
const children = props.children;
|
|
124
|
+
return (<div {...dom} ref={containerRef} class={className} style={style}>
|
|
125
|
+
{provide(ResizableTableContainerContext, ctx, () => renderSlot(children))}
|
|
126
|
+
</div>);
|
|
127
|
+
}
|
|
128
|
+
/** Global DOM events / attributes Table handles itself; the user's run from its own handler. */
|
|
129
|
+
const TABLE_OWNED = ["onMouseDown", "onScroll", "style", "id"];
|
|
130
|
+
/**
|
|
131
|
+
* A table displays data in rows and columns and enables a user to navigate its contents via
|
|
132
|
+
* directional navigation keys, and optionally supports row selection and sorting.
|
|
133
|
+
*/
|
|
134
|
+
export function Table(inProps) {
|
|
135
|
+
const [tableCtxProps, tableCtxRef] = contextProps(inProps, inProps.ref, TableContext);
|
|
136
|
+
// RAC TableInner: the Autocomplete's SelectableCollectionContext merges under the table props.
|
|
137
|
+
const [props, userRef] = contextProps(tableCtxProps, tableCtxRef, SelectableCollectionContext);
|
|
138
|
+
const container = useContext(ResizableTableContainerContext);
|
|
139
|
+
const renderer = useContext(CollectionRendererContext);
|
|
140
|
+
// Module component functions are not serializable: resolve the renderer at the call site (`(custom ?? Default).X(…)`).
|
|
141
|
+
const customRenderer = renderer === DefaultCollectionRenderer ? undefined : renderer;
|
|
142
|
+
const sharedElements = {};
|
|
143
|
+
const isVirtualized = !!renderer.isVirtualized;
|
|
144
|
+
const { locale, direction } = useLocale();
|
|
145
|
+
// Separate selection options so collection components can read them via tableOptions().
|
|
146
|
+
const selectionMode = props.selectionMode ?? "none";
|
|
147
|
+
const selectionBehavior = props.selectionBehavior ?? "toggle";
|
|
148
|
+
// Locals only (PROPS-CAPTURE: literals / closures reading `props.x` capture the whole props object).
|
|
149
|
+
const { disallowEmptySelection, onRowAction, onCellAction, shouldSelectOnPressUp, keyboardNavigationBehavior, escapeKeyBehavior, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-details": ariaDetails, } = props;
|
|
150
|
+
const options = {
|
|
151
|
+
selectionMode,
|
|
152
|
+
selectionBehavior: selectionMode === "none" ? null : selectionBehavior,
|
|
153
|
+
disallowEmptySelection: !!disallowEmptySelection,
|
|
154
|
+
allowsDragging: false,
|
|
155
|
+
};
|
|
156
|
+
const children = props.children;
|
|
157
|
+
// Object-literal arrows (not call-argument arrows): the build computed captures them, so they must be
|
|
158
|
+
// resumable closures.
|
|
159
|
+
const build = {
|
|
160
|
+
content: () => provide(TableOptionsContext, options, () => Collection({ children })),
|
|
161
|
+
createCollection: () => new TableCollection(),
|
|
162
|
+
};
|
|
163
|
+
const built = collectionOf(build.content, build.createCollection);
|
|
164
|
+
const data = createTableState({
|
|
165
|
+
selectionMode,
|
|
166
|
+
selectionBehavior,
|
|
167
|
+
// Live props: a controlled `selectedKeys={keys()}` stays live (accessor; never written).
|
|
168
|
+
selectedKeys: liveKeys(props, "selectedKeys"),
|
|
169
|
+
defaultSelectedKeys: props.defaultSelectedKeys,
|
|
170
|
+
onSelectionChange: props.onSelectionChange,
|
|
171
|
+
disallowEmptySelection: props.disallowEmptySelection,
|
|
172
|
+
disabledKeys: props.disabledKeys,
|
|
173
|
+
disabledBehavior: props.disabledBehavior ?? "all",
|
|
174
|
+
sortDescriptor: props.sortDescriptor,
|
|
175
|
+
onSortChange: props.onSortChange,
|
|
176
|
+
expandedKeys: liveKeys(props, "expandedKeys"),
|
|
177
|
+
defaultExpandedKeys: props.defaultExpandedKeys,
|
|
178
|
+
onExpandedChange: props.onExpandedChange,
|
|
179
|
+
treeColumn: props.treeColumn,
|
|
180
|
+
});
|
|
181
|
+
const filter = props.filter;
|
|
182
|
+
// RAC: collection.withExpandedKeys(expandedKeys), then UNSTABLE_useFilteredTableState(state, filter).
|
|
183
|
+
const collection = computed(() => {
|
|
184
|
+
const c = built().withExpandedKeys(data.expandedKeys.value());
|
|
185
|
+
return filter ? c.filter(filter) : c;
|
|
186
|
+
});
|
|
187
|
+
const shared = gridShared({ onRowAction, onCellAction, shouldSelectOnPressUp, keyboardNavigationBehavior });
|
|
188
|
+
const gridId = useId(props.id);
|
|
189
|
+
const view = () => ({ ...tableState(data, collection()), grid: shared, gridId });
|
|
190
|
+
const sortDescriptionId = gridId + "-sort-description";
|
|
191
|
+
const descriptionId = gridId + "-description";
|
|
192
|
+
const internal = {
|
|
193
|
+
data,
|
|
194
|
+
collection,
|
|
195
|
+
gridId,
|
|
196
|
+
locale,
|
|
197
|
+
direction,
|
|
198
|
+
isVirtualized,
|
|
199
|
+
sortableDescriptionId: gridId + "-sortable-description",
|
|
200
|
+
resizerDescriptionId: gridId + "-resizer-description",
|
|
201
|
+
};
|
|
202
|
+
const aria = {
|
|
203
|
+
id: gridId,
|
|
204
|
+
"aria-label": ariaLabel,
|
|
205
|
+
"aria-labelledby": ariaLabelledby,
|
|
206
|
+
"aria-describedby": ariaDescribedby,
|
|
207
|
+
"aria-details": ariaDetails,
|
|
208
|
+
isVirtualized,
|
|
209
|
+
layoutDelegate: renderer.layoutDelegate,
|
|
210
|
+
escapeKeyBehavior,
|
|
211
|
+
keyboardNavigationBehavior,
|
|
212
|
+
onRowAction,
|
|
213
|
+
onCellAction,
|
|
214
|
+
shouldSelectOnPressUp,
|
|
215
|
+
locale,
|
|
216
|
+
direction,
|
|
217
|
+
descriptionId,
|
|
218
|
+
sortDescriptionId,
|
|
219
|
+
};
|
|
220
|
+
const disallowTypeAhead = props.disallowTypeAhead;
|
|
221
|
+
const shouldUseVirtualFocus = props.shouldUseVirtualFocus;
|
|
222
|
+
const onFocusInFromContext = props.onFocusIn;
|
|
223
|
+
// The grid handler props for the event's table element (keyboard delegate over its DOM layout).
|
|
224
|
+
const gridOf = (v, e) => tableGridProps({ ...aria, disallowTypeAhead: !!read(disallowTypeAhead) }, v, e.currentTarget);
|
|
225
|
+
const el = elementRef();
|
|
226
|
+
const rootRef = mergeRefValues(mergeRefValues(el, userRef), container?.tableRef);
|
|
227
|
+
// react-aria useHasTabbableChild (empty table with a tabbable child: the table leaves the tab order).
|
|
228
|
+
const hasTabbableChild = signal(false);
|
|
229
|
+
clientEffect(() => {
|
|
230
|
+
const root = el();
|
|
231
|
+
if (!root || collection().size !== 0)
|
|
232
|
+
return;
|
|
233
|
+
const update = () => hasTabbableChild.set(!!getFocusableTreeWalker(root, { tabbable: true }).nextNode());
|
|
234
|
+
update();
|
|
235
|
+
const observer = new MutationObserver(update);
|
|
236
|
+
observer.observe(root, { subtree: true, childList: true, attributes: true, attributeFilter: ["tabIndex", "disabled"] });
|
|
237
|
+
return () => observer.disconnect();
|
|
238
|
+
});
|
|
239
|
+
// useGridState: reset the focused key when its row leaves the collection.
|
|
240
|
+
// `blurred`: target of the last focusout to nowhere (Rivet: Chromium fires focusout when the focused row is
|
|
241
|
+
// removed, jsdom / React's detached-node events do not — a blur whose target left the DOM keeps focus in the grid).
|
|
242
|
+
const focusMemo = { last: null, blurred: null };
|
|
243
|
+
clientEffect(() => {
|
|
244
|
+
const c = collection();
|
|
245
|
+
const selection = data.selectionState;
|
|
246
|
+
const previous = untrack(selection.focusedKey);
|
|
247
|
+
resetGridFocusedKey(data, focusMemo.last, c);
|
|
248
|
+
focusMemo.last = c;
|
|
249
|
+
// useSelectableItem's focus effect for the replacement key, after the rows re-rendered.
|
|
250
|
+
const next = untrack(selection.focusedKey);
|
|
251
|
+
if (next == null || next === previous)
|
|
252
|
+
return;
|
|
253
|
+
const wasFocused = untrack(selection.isFocused);
|
|
254
|
+
queueMicrotask(() => {
|
|
255
|
+
const lost = focusMemo.blurred;
|
|
256
|
+
if (untrack(selection.focusedKey) !== next || !(wasFocused || (lost && !lost.isConnected)))
|
|
257
|
+
return;
|
|
258
|
+
const item = getItemElement(el(), next);
|
|
259
|
+
if (item && item.ownerDocument.activeElement !== item)
|
|
260
|
+
focusSafely(item);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
// Column resizing (ResizableTableContainer): the layout state over the measured width.
|
|
264
|
+
const resizeData = container ? createTableColumnResizeState({ tableWidth: container.tableWidth }) : null;
|
|
265
|
+
const layout = resizeData ? () => tableColumnResizeState(resizeData, view()) : null;
|
|
266
|
+
const focused = signal(false);
|
|
267
|
+
const focusVisible = signal(false);
|
|
268
|
+
const rootInteraction = { states: { isFocused: focused, isFocusVisible: focusVisible } };
|
|
269
|
+
const values = {
|
|
270
|
+
isFocused: () => focused(),
|
|
271
|
+
isFocusVisible: () => focusVisible(),
|
|
272
|
+
isDropTarget: () => false,
|
|
273
|
+
state: view,
|
|
274
|
+
};
|
|
275
|
+
const rp = untrack(() => renderProps({ class: props.class, style: props.style, values, defaultClassName: "rv-Table" }, hasLive(props) ? liveRenderProps(props) : undefined));
|
|
276
|
+
const style = () => {
|
|
277
|
+
const s = rp.style();
|
|
278
|
+
// due to https://bugzilla.mozilla.org/show_bug.cgi?id=1959353, we can't use "fit-content".
|
|
279
|
+
return resizeData && !isVirtualized ? { ...s, tableLayout: "fixed", width: "min-content" } : s;
|
|
280
|
+
};
|
|
281
|
+
const onMouseDown = props.onMouseDown;
|
|
282
|
+
const onScroll = props.onScroll;
|
|
283
|
+
const slot = props.slot || undefined;
|
|
284
|
+
const dom = globalDOMProps(props, TABLE_OWNED);
|
|
285
|
+
const attrs = () => {
|
|
286
|
+
const a = tableProps(aria, view(), hasTabbableChild()).gridProps;
|
|
287
|
+
// Autocomplete virtual focus: the collection itself is never tabbable.
|
|
288
|
+
return read(shouldUseVirtualFocus) ? { ...a, tabIndex: undefined } : a;
|
|
289
|
+
};
|
|
290
|
+
const sortDescription = () => tableSortDescription({ locale }, view());
|
|
291
|
+
const longPressDescription = () => {
|
|
292
|
+
const v = view();
|
|
293
|
+
return highlightSelectionDescription({
|
|
294
|
+
selectionManager: v.selectionManager,
|
|
295
|
+
hasItemActions: !!(shared.actions.onRowAction || shared.actions.onCellAction),
|
|
296
|
+
locale,
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
if (isVirtualized) {
|
|
300
|
+
// RAC useElementType: inside a Virtualizer the table is `div`s (absolutely positioned views; a `<table>` cannot
|
|
301
|
+
// hold the view wrappers). The grid element is the scroll container; its focused row / cell stays rendered.
|
|
302
|
+
const virtualScroll = customRenderer?.onScroll;
|
|
303
|
+
const focusedKey = data.selectionState.focusedKey;
|
|
304
|
+
return (<>
|
|
305
|
+
<div {...dom} {...attrs()} ref={rootRef} class={rp.class()} style={style()} slot={slot} data-focused={dataBool(focused())} data-focus-visible={dataBool(focusVisible())} onKeyDownCapture={(e) => {
|
|
306
|
+
const v = view();
|
|
307
|
+
gridKeyDownCapture(e, gridOf(v, e), v);
|
|
308
|
+
}} onKeyDown={(e) => {
|
|
309
|
+
const v = view();
|
|
310
|
+
gridKeyDown(e, gridOf(v, e), v);
|
|
311
|
+
}} onFocusIn={(e) => {
|
|
312
|
+
const v = view();
|
|
313
|
+
gridFocus(e, gridOf(v, e), v);
|
|
314
|
+
onFocusInFromContext?.(e);
|
|
315
|
+
}} onFocusOut={(e) => {
|
|
316
|
+
focusMemo.blurred = e.relatedTarget == null ? e.target : null;
|
|
317
|
+
const v = view();
|
|
318
|
+
gridBlur(e, gridOf(v, e), v);
|
|
319
|
+
}} onFocus={(e) => focusStateFocus(rootInteraction, e)} onBlur={(e) => focusStateBlur(rootInteraction, e)} onMouseDown={(e) => {
|
|
320
|
+
const v = view();
|
|
321
|
+
gridMouseDown(e, gridOf(v, e), v);
|
|
322
|
+
onMouseDown?.(e);
|
|
323
|
+
}} onScroll={(e) => {
|
|
324
|
+
virtualScroll?.(e);
|
|
325
|
+
onScroll?.(e);
|
|
326
|
+
}}>
|
|
327
|
+
<Provider values={[
|
|
328
|
+
[TableStateContext, view],
|
|
329
|
+
[TableColumnResizeStateContext, layout],
|
|
330
|
+
[TableOptionsContext, options],
|
|
331
|
+
[TableInternalContext, internal],
|
|
332
|
+
[SelectableCollectionContext, null],
|
|
333
|
+
[FieldInputContext, null],
|
|
334
|
+
// RAC: the rows share one SharedElementTransition scope (a SelectionIndicator animates between them).
|
|
335
|
+
[SharedElementContext, sharedElements],
|
|
336
|
+
]}>
|
|
337
|
+
{(customRenderer ?? DefaultCollectionRenderer).CollectionRoot({ collection: collection, scrollRef: el, focusedKey })}
|
|
338
|
+
</Provider>
|
|
339
|
+
</div>
|
|
340
|
+
<div id={sortDescriptionId} hidden>
|
|
341
|
+
{sortDescription() ?? ""}
|
|
342
|
+
</div>
|
|
343
|
+
<div id={internal.sortableDescriptionId} hidden>
|
|
344
|
+
{formatMessage(tableStrings, locale, "sortable")}
|
|
345
|
+
</div>
|
|
346
|
+
<div id={descriptionId} hidden>
|
|
347
|
+
{longPressDescription() ?? ""}
|
|
348
|
+
</div>
|
|
349
|
+
{resizeData ? (<div id={internal.resizerDescriptionId} hidden>
|
|
350
|
+
{formatMessage(tableStrings, locale, "resizerDescription")}
|
|
351
|
+
</div>) : null}
|
|
352
|
+
</>);
|
|
353
|
+
}
|
|
354
|
+
return (<>
|
|
355
|
+
<table {...dom} {...attrs()} ref={rootRef} class={rp.class()} style={style()} slot={slot} data-focused={dataBool(focused())} data-focus-visible={dataBool(focusVisible())} onKeyDownCapture={(e) => {
|
|
356
|
+
const v = view();
|
|
357
|
+
gridKeyDownCapture(e, gridOf(v, e), v);
|
|
358
|
+
}} onKeyDown={(e) => {
|
|
359
|
+
const v = view();
|
|
360
|
+
gridKeyDown(e, gridOf(v, e), v);
|
|
361
|
+
}} onFocusIn={(e) => {
|
|
362
|
+
const v = view();
|
|
363
|
+
gridFocus(e, gridOf(v, e), v);
|
|
364
|
+
onFocusInFromContext?.(e);
|
|
365
|
+
}} onFocusOut={(e) => {
|
|
366
|
+
focusMemo.blurred = e.relatedTarget == null ? e.target : null;
|
|
367
|
+
const v = view();
|
|
368
|
+
gridBlur(e, gridOf(v, e), v);
|
|
369
|
+
}} onFocus={(e) => focusStateFocus(rootInteraction, e)} onBlur={(e) => focusStateBlur(rootInteraction, e)} onMouseDown={(e) => {
|
|
370
|
+
const v = view();
|
|
371
|
+
gridMouseDown(e, gridOf(v, e), v);
|
|
372
|
+
onMouseDown?.(e);
|
|
373
|
+
}} onScroll={(e) => onScroll?.(e)}>
|
|
374
|
+
<Provider values={[
|
|
375
|
+
[TableStateContext, view],
|
|
376
|
+
[TableColumnResizeStateContext, layout],
|
|
377
|
+
[TableOptionsContext, options],
|
|
378
|
+
[TableInternalContext, internal],
|
|
379
|
+
[SelectableCollectionContext, null],
|
|
380
|
+
[FieldInputContext, null],
|
|
381
|
+
// RAC: the rows share one SharedElementTransition scope (a SelectionIndicator animates between them).
|
|
382
|
+
[SharedElementContext, sharedElements],
|
|
383
|
+
]}>
|
|
384
|
+
{(customRenderer ?? DefaultCollectionRenderer).CollectionRoot({ collection: collection, scrollRef: el })}
|
|
385
|
+
</Provider>
|
|
386
|
+
</table>
|
|
387
|
+
<div id={sortDescriptionId} hidden>
|
|
388
|
+
{sortDescription() ?? ""}
|
|
389
|
+
</div>
|
|
390
|
+
<div id={internal.sortableDescriptionId} hidden>
|
|
391
|
+
{formatMessage(tableStrings, locale, "sortable")}
|
|
392
|
+
</div>
|
|
393
|
+
<div id={descriptionId} hidden>
|
|
394
|
+
{longPressDescription() ?? ""}
|
|
395
|
+
</div>
|
|
396
|
+
{resizeData ? (<div id={internal.resizerDescriptionId} hidden>
|
|
397
|
+
{formatMessage(tableStrings, locale, "resizerDescription")}
|
|
398
|
+
</div>) : null}
|
|
399
|
+
</>);
|
|
400
|
+
}
|
|
401
|
+
const HOVER_OWNED = ["onPointerEnter", "onPointerLeave", "style"];
|
|
402
|
+
/** A header within a `<Table>`, containing the table columns. */
|
|
403
|
+
export const TableHeader = /* @__PURE__ */ createBranchComponent(TableHeaderNode, function TableHeader(props, ref) {
|
|
404
|
+
const internal = useContext(TableInternalContext);
|
|
405
|
+
const hovered = signal(false);
|
|
406
|
+
const { onHoverStart, onHoverChange, onHoverEnd } = props;
|
|
407
|
+
const interaction = {
|
|
408
|
+
onHoverStart,
|
|
409
|
+
onHoverChange,
|
|
410
|
+
onHoverEnd,
|
|
411
|
+
states: { isHovered: hovered },
|
|
412
|
+
};
|
|
413
|
+
const rp = untrack(() => renderProps({ class: props.class, style: props.style, values: { isHovered: () => hovered() }, defaultClassName: "rv-TableHeader" }, hasLive(props) ? liveRenderProps(props) : undefined));
|
|
414
|
+
const { onPointerEnter, onPointerLeave } = props;
|
|
415
|
+
const dom = globalDOMProps(props, HOVER_OWNED);
|
|
416
|
+
const rowKeys = () => internal.collection().headerRows.map((row) => row.key);
|
|
417
|
+
if (internal.isVirtualized) {
|
|
418
|
+
// Virtualized (RAC useElementType): `div` row group inside the header view.
|
|
419
|
+
return (<div {...dom} role="rowgroup" ref={ref} class={rp.class()} style={rp.style()} onPointerEnter={(e) => {
|
|
420
|
+
hoverStateEnter(interaction, e);
|
|
421
|
+
onPointerEnter?.(e);
|
|
422
|
+
}} onPointerLeave={(e) => {
|
|
423
|
+
hoverStateLeave(interaction, e);
|
|
424
|
+
onPointerLeave?.(e);
|
|
425
|
+
}}>
|
|
426
|
+
{/* Not lazy (LAZY-T6): a header row holds the virtualizer's column views (a nested collection); a lazy
|
|
427
|
+
header row materialised mid-layout lost them. Header rows are few: nothing to save. */}
|
|
428
|
+
<For each={rowKeys} by={(k) => k} lazy={false}>
|
|
429
|
+
{(k) => <TableHeaderRow rowKey={untrack(k)}/>}
|
|
430
|
+
</For>
|
|
431
|
+
</div>);
|
|
432
|
+
}
|
|
433
|
+
return (<thead {...dom} role="rowgroup" ref={ref} class={rp.class()} style={rp.style()} onPointerEnter={(e) => {
|
|
434
|
+
hoverStateEnter(interaction, e);
|
|
435
|
+
onPointerEnter?.(e);
|
|
436
|
+
}} onPointerLeave={(e) => {
|
|
437
|
+
hoverStateLeave(interaction, e);
|
|
438
|
+
onPointerLeave?.(e);
|
|
439
|
+
}}>
|
|
440
|
+
{/* Not lazy (LAZY-T6): header rows hold the column cells (a nested collection) and are few. */}
|
|
441
|
+
<For each={rowKeys} by={(k) => k} lazy={false}>
|
|
442
|
+
{(k) => <TableHeaderRow rowKey={untrack(k)}/>}
|
|
443
|
+
</For>
|
|
444
|
+
</thead>);
|
|
445
|
+
}, (props) => Collection({ items: props.columns, children: props.children }));
|
|
446
|
+
function TableHeaderRow(props) {
|
|
447
|
+
const view = useContext(TableStateContext);
|
|
448
|
+
const internal = useContext(TableInternalContext);
|
|
449
|
+
const rowKey = props.rowKey;
|
|
450
|
+
const isVirtualized = internal.isVirtualized;
|
|
451
|
+
const locale = internal.locale;
|
|
452
|
+
const attrs = () => {
|
|
453
|
+
const v = view();
|
|
454
|
+
const row = v.collection.headerRows.find((r) => r.key === rowKey);
|
|
455
|
+
return row ? tableHeaderRowProps({ node: row, isVirtualized }, v).rowProps : { role: "row" };
|
|
456
|
+
};
|
|
457
|
+
// useTableSelectAllCheckbox
|
|
458
|
+
const checkboxProps = {
|
|
459
|
+
"aria-label": untrack(() => tableSelectAllCheckboxProps(view(), locale).checkboxProps["aria-label"]),
|
|
460
|
+
isSelected: () => tableSelectAllCheckboxProps(view(), locale).checkboxProps.isSelected,
|
|
461
|
+
isDisabled: () => tableSelectAllCheckboxProps(view(), locale).checkboxProps.isDisabled,
|
|
462
|
+
isIndeterminate: () => tableSelectAllCheckboxProps(view(), locale).checkboxProps.isIndeterminate,
|
|
463
|
+
onChange: () => tableSelectAllCheckboxChange(view()),
|
|
464
|
+
};
|
|
465
|
+
const cellKeys = () => {
|
|
466
|
+
const keys = [];
|
|
467
|
+
for (const n of internal.collection().getChildren(rowKey))
|
|
468
|
+
keys.push(n.key);
|
|
469
|
+
return keys;
|
|
470
|
+
};
|
|
471
|
+
if (isVirtualized) {
|
|
472
|
+
// Virtualized: `div` row; the virtualizer renders the column views.
|
|
473
|
+
const branchRenderer = useContext(CollectionRendererContext);
|
|
474
|
+
const customBranch = branchRenderer === DefaultCollectionRenderer ? undefined : branchRenderer;
|
|
475
|
+
return (<div {...attrs()}>
|
|
476
|
+
<Provider values={[
|
|
477
|
+
[CheckboxContext, { slots: { selection: checkboxProps } }],
|
|
478
|
+
[CheckboxFieldContext, { slots: { selection: checkboxProps } }],
|
|
479
|
+
]}>
|
|
480
|
+
{/* The virtualizer renders the header row's column views (positioned by the layout). */}
|
|
481
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({
|
|
482
|
+
collection: internal.collection,
|
|
483
|
+
parent: { key: rowKey },
|
|
484
|
+
})}
|
|
485
|
+
</Provider>
|
|
486
|
+
</div>);
|
|
487
|
+
}
|
|
488
|
+
return (<tr {...attrs()}>
|
|
489
|
+
<Provider values={[
|
|
490
|
+
[CheckboxContext, { slots: { selection: checkboxProps } }],
|
|
491
|
+
[CheckboxFieldContext, { slots: { selection: checkboxProps } }],
|
|
492
|
+
]}>
|
|
493
|
+
{/* Columns are in the key map; header placeholders (nested columns) render nothing. */}
|
|
494
|
+
<For each={cellKeys} by={(k) => k}>
|
|
495
|
+
{(k) => renderNodeAt(internal.collection, k)}
|
|
496
|
+
</For>
|
|
497
|
+
</Provider>
|
|
498
|
+
</tr>);
|
|
499
|
+
}
|
|
500
|
+
const COLUMN_OWNED = ["onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onMouseDown", "onClick", "onDragStart", "style", "id"];
|
|
501
|
+
/** A column within a `<Table>`. */
|
|
502
|
+
export const Column = /* @__PURE__ */ createLeafComponent(TableColumnNode, function Column(props, forwardedRef, column) {
|
|
503
|
+
const view = useContext(TableStateContext);
|
|
504
|
+
const internal = useContext(TableInternalContext);
|
|
505
|
+
const layout = useContext(TableColumnResizeStateContext);
|
|
506
|
+
const key = column.key;
|
|
507
|
+
const isVirtualized = internal.isVirtualized;
|
|
508
|
+
const locale = internal.locale;
|
|
509
|
+
const descriptionId = internal.sortableDescriptionId;
|
|
510
|
+
const { focusMode, allowsArrowNavigation } = props;
|
|
511
|
+
const th = elementRef();
|
|
512
|
+
const thRef = mergeRefValues(th, forwardedRef);
|
|
513
|
+
const hopts = (v, el) => ({
|
|
514
|
+
node: columnOf(v.collection, key),
|
|
515
|
+
isVirtualized,
|
|
516
|
+
focusMode: focusMode ?? "child",
|
|
517
|
+
allowsArrowNavigation,
|
|
518
|
+
descriptionId,
|
|
519
|
+
locale,
|
|
520
|
+
ref: el ?? undefined,
|
|
521
|
+
});
|
|
522
|
+
const attrs = () => {
|
|
523
|
+
const v = view();
|
|
524
|
+
return columnOf(v.collection, key) ? tableColumnHeaderProps(hopts(v), v).columnHeaderProps : {};
|
|
525
|
+
};
|
|
526
|
+
const allowsSorting = () => !!columnOf(internal.collection(), key)?.props?.allowsSorting;
|
|
527
|
+
const sortDirection = () => {
|
|
528
|
+
const s = internal.data.sortDescriptor.value();
|
|
529
|
+
return s?.column === key ? s.direction : undefined;
|
|
530
|
+
};
|
|
531
|
+
const isResizing = () => !!layout && layout().resizingColumn === key;
|
|
532
|
+
const hovered = signal(false);
|
|
533
|
+
const pressed = signal(false);
|
|
534
|
+
const focused = signal(false);
|
|
535
|
+
const focusVisible = signal(false);
|
|
536
|
+
const interaction = {
|
|
537
|
+
isDisabled: () => !allowsSorting(),
|
|
538
|
+
states: { isHovered: hovered, isFocused: focused, isFocusVisible: focusVisible },
|
|
539
|
+
};
|
|
540
|
+
// usePress of useTableColumnHeader (options read per event).
|
|
541
|
+
const press = (v) => {
|
|
542
|
+
const o = hopts(v);
|
|
543
|
+
return {
|
|
544
|
+
isDisabled: !tableColumnHeaderPressable(o, v),
|
|
545
|
+
onPress: () => tableColumnHeaderPress(o, v, (k) => v.sort(k), view),
|
|
546
|
+
onPressStart: () => pressed.set(true),
|
|
547
|
+
onPressEnd: () => pressed.set(false),
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
const values = {
|
|
551
|
+
isHovered: () => hovered(),
|
|
552
|
+
isPressed: () => pressed(),
|
|
553
|
+
isFocused: () => focused(),
|
|
554
|
+
isFocusVisible: () => focusVisible(),
|
|
555
|
+
allowsSorting,
|
|
556
|
+
sortDirection,
|
|
557
|
+
isResizing,
|
|
558
|
+
startResize: () => {
|
|
559
|
+
if (!layout)
|
|
560
|
+
throw new Error("Wrap your <Table> in a <ResizableTableContainer> to enable column resizing");
|
|
561
|
+
layout().startResize(key);
|
|
562
|
+
view().setKeyboardNavigationDisabled(true);
|
|
563
|
+
focusColumnResizer(th() ?? null);
|
|
564
|
+
},
|
|
565
|
+
sort: (direction) => view().sort(key, direction),
|
|
566
|
+
};
|
|
567
|
+
const rp = untrack(() => renderProps({ class: props.class, style: props.style, children: props.children, values, defaultClassName: "rv-Column" }, hasLive(props) ? liveRenderProps(props) : undefined));
|
|
568
|
+
const style = () => {
|
|
569
|
+
const s = rp.style();
|
|
570
|
+
return layout ? { ...s, width: `${layout().getColumnWidth(key)}px` } : s;
|
|
571
|
+
};
|
|
572
|
+
const { onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onClick } = props;
|
|
573
|
+
const dom = globalDOMProps(props, COLUMN_OWNED);
|
|
574
|
+
if (isVirtualized) {
|
|
575
|
+
// Virtualized (RAC useElementType): `div` column header inside its view.
|
|
576
|
+
return (<div {...dom} {...attrs()} ref={thRef} class={rp.class()} style={style()} data-resizing={dataBool(isResizing())} data-allows-sorting={dataBool(allowsSorting())} data-sort-direction={sortDirection()} onKeyDownCapture={(e) => {
|
|
577
|
+
const v = view();
|
|
578
|
+
gridCellKeyDownCapture(e, hopts(v), v);
|
|
579
|
+
}} onKeyDown={(e) => {
|
|
580
|
+
const v = view();
|
|
581
|
+
gridCellKeyDown(e, hopts(v), v);
|
|
582
|
+
pressKeyDown(press(v), e);
|
|
583
|
+
}} onKeyUp={(e) => {
|
|
584
|
+
const v = view();
|
|
585
|
+
gridCellKeyUp(e, hopts(v), v);
|
|
586
|
+
}} onFocusIn={(e) => {
|
|
587
|
+
const v = view();
|
|
588
|
+
gridCellFocus(e, hopts(v), v);
|
|
589
|
+
}} onFocus={(e) => {
|
|
590
|
+
focusStateFocus(interaction, e);
|
|
591
|
+
}} onBlur={(e) => {
|
|
592
|
+
focusStateBlur(interaction, e);
|
|
593
|
+
}} onPointerEnter={(e) => {
|
|
594
|
+
hoverStateEnter(interaction, e);
|
|
595
|
+
pressPointerEnter(press(view()), e);
|
|
596
|
+
onPointerEnter?.(e);
|
|
597
|
+
}} onPointerLeave={(e) => {
|
|
598
|
+
hoverStateLeave(interaction, e);
|
|
599
|
+
pressPointerLeave(press(view()), e);
|
|
600
|
+
onPointerLeave?.(e);
|
|
601
|
+
}} onPointerDown={(e) => {
|
|
602
|
+
const v = view();
|
|
603
|
+
gridCellPointerDown(e, hopts(v), v);
|
|
604
|
+
pressPointerDown(press(v), e);
|
|
605
|
+
onPointerDown?.(e);
|
|
606
|
+
}} onPointerUp={(e) => {
|
|
607
|
+
const v = view();
|
|
608
|
+
gridCellPointerUp(e, hopts(v), v);
|
|
609
|
+
pressPointerUp(press(v), e);
|
|
610
|
+
onPointerUp?.(e);
|
|
611
|
+
}} onMouseDown={(e) => pressMouseDown(press(view()), e)} onClick={(e) => {
|
|
612
|
+
const v = view();
|
|
613
|
+
gridCellClick(e, hopts(v), v);
|
|
614
|
+
pressClick(press(v), e);
|
|
615
|
+
onClick?.(e);
|
|
616
|
+
}} onDragStart={(e) => pressDragStart(press(view()), e)}>
|
|
617
|
+
{
|
|
618
|
+
// A binding (not a Provider child slot): a render function that reads render-prop accessors
|
|
619
|
+
// and returns text re-runs on change, as RAC re-renders.
|
|
620
|
+
provide(ColumnResizerContext, { columnKey: key, triggerRef: th }, () => provide(CollectionRendererContext, DefaultCollectionRenderer, () => rp.children()))}
|
|
621
|
+
</div>);
|
|
622
|
+
}
|
|
623
|
+
return (<th {...dom} {...attrs()} ref={thRef} class={rp.class()} style={style()} data-resizing={dataBool(isResizing())} data-allows-sorting={dataBool(allowsSorting())} data-sort-direction={sortDirection()} onKeyDownCapture={(e) => {
|
|
624
|
+
const v = view();
|
|
625
|
+
gridCellKeyDownCapture(e, hopts(v), v);
|
|
626
|
+
}} onKeyDown={(e) => {
|
|
627
|
+
const v = view();
|
|
628
|
+
gridCellKeyDown(e, hopts(v), v);
|
|
629
|
+
pressKeyDown(press(v), e);
|
|
630
|
+
}} onKeyUp={(e) => {
|
|
631
|
+
const v = view();
|
|
632
|
+
gridCellKeyUp(e, hopts(v), v);
|
|
633
|
+
}} onFocusIn={(e) => {
|
|
634
|
+
const v = view();
|
|
635
|
+
gridCellFocus(e, hopts(v), v);
|
|
636
|
+
}} onFocus={(e) => {
|
|
637
|
+
focusStateFocus(interaction, e);
|
|
638
|
+
}} onBlur={(e) => {
|
|
639
|
+
focusStateBlur(interaction, e);
|
|
640
|
+
}} onPointerEnter={(e) => {
|
|
641
|
+
hoverStateEnter(interaction, e);
|
|
642
|
+
pressPointerEnter(press(view()), e);
|
|
643
|
+
onPointerEnter?.(e);
|
|
644
|
+
}} onPointerLeave={(e) => {
|
|
645
|
+
hoverStateLeave(interaction, e);
|
|
646
|
+
pressPointerLeave(press(view()), e);
|
|
647
|
+
onPointerLeave?.(e);
|
|
648
|
+
}} onPointerDown={(e) => {
|
|
649
|
+
const v = view();
|
|
650
|
+
gridCellPointerDown(e, hopts(v), v);
|
|
651
|
+
pressPointerDown(press(v), e);
|
|
652
|
+
onPointerDown?.(e);
|
|
653
|
+
}} onPointerUp={(e) => {
|
|
654
|
+
const v = view();
|
|
655
|
+
gridCellPointerUp(e, hopts(v), v);
|
|
656
|
+
pressPointerUp(press(v), e);
|
|
657
|
+
onPointerUp?.(e);
|
|
658
|
+
}} onMouseDown={(e) => pressMouseDown(press(view()), e)} onClick={(e) => {
|
|
659
|
+
const v = view();
|
|
660
|
+
gridCellClick(e, hopts(v), v);
|
|
661
|
+
pressClick(press(v), e);
|
|
662
|
+
onClick?.(e);
|
|
663
|
+
}} onDragStart={(e) => pressDragStart(press(view()), e)}>
|
|
664
|
+
{
|
|
665
|
+
// A binding (not a Provider child slot): a render function that reads render-prop accessors
|
|
666
|
+
// and returns text re-runs on change, as RAC re-renders.
|
|
667
|
+
provide(ColumnResizerContext, { columnKey: key, triggerRef: th }, () => provide(CollectionRendererContext, DefaultCollectionRenderer, () => rp.children()))}
|
|
668
|
+
</th>);
|
|
669
|
+
});
|
|
670
|
+
const RESIZER_OWNED = ["onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onMouseDown", "onClick", "onDragStart", "style"];
|
|
671
|
+
/** A draggable / keyboard-adjustable handle that resizes its Column (inside a ResizableTableContainer). */
|
|
672
|
+
export function ColumnResizer(props) {
|
|
673
|
+
const layout = useContext(TableColumnResizeStateContext);
|
|
674
|
+
if (!layout)
|
|
675
|
+
throw new Error("Wrap your <Table> in a <ResizableTableContainer> to enable column resizing");
|
|
676
|
+
const container = useContext(ResizableTableContainerContext);
|
|
677
|
+
const { columnKey, triggerRef } = useContext(ColumnResizerContext);
|
|
678
|
+
const internal = useContext(TableInternalContext);
|
|
679
|
+
const locale = internal.locale;
|
|
680
|
+
const direction = internal.direction;
|
|
681
|
+
const column = untrack(() => columnOf(internal.collection(), columnKey));
|
|
682
|
+
const ariaLabelProp = props["aria-label"];
|
|
683
|
+
const id = `${internal.gridId}-${normalizeKey(columnKey)}-resizer`;
|
|
684
|
+
const aria = tableColumnResizeProps({
|
|
685
|
+
column,
|
|
686
|
+
"aria-label": ariaLabelProp || formatMessage(racStrings, locale, "tableResizer"),
|
|
687
|
+
onResizeStart: container.onResizeStart,
|
|
688
|
+
onResize: container.onResize,
|
|
689
|
+
onResizeEnd: container.onResizeEnd,
|
|
690
|
+
triggerRef,
|
|
691
|
+
id,
|
|
692
|
+
descriptionId: internal.resizerDescriptionId,
|
|
693
|
+
locale,
|
|
694
|
+
}, layout);
|
|
695
|
+
const ring = useFocusRing();
|
|
696
|
+
const hovered = signal(false);
|
|
697
|
+
const { onHoverStart, onHoverChange, onHoverEnd } = props;
|
|
698
|
+
const interaction = { onHoverStart, onHoverChange, onHoverEnd, states: { isHovered: hovered } };
|
|
699
|
+
const resizableDirection = () => {
|
|
700
|
+
const l = layout();
|
|
701
|
+
const isEResizable = l.getColumnMinWidth(columnKey) >= l.getColumnWidth(columnKey);
|
|
702
|
+
const isWResizable = l.getColumnMaxWidth(columnKey) <= l.getColumnWidth(columnKey);
|
|
703
|
+
if (isEResizable)
|
|
704
|
+
return direction === "rtl" ? "right" : "left";
|
|
705
|
+
if (isWResizable)
|
|
706
|
+
return direction === "rtl" ? "left" : "right";
|
|
707
|
+
return "both";
|
|
708
|
+
};
|
|
709
|
+
const resizer = elementRef();
|
|
710
|
+
const resizerRef = mergeRefValues(resizer, props.ref);
|
|
711
|
+
// The cursor of the resizer (computed style) for the full-screen cursor overlay.
|
|
712
|
+
const cursor = signal("");
|
|
713
|
+
clientEffect(() => {
|
|
714
|
+
const node = resizer();
|
|
715
|
+
resizableDirection();
|
|
716
|
+
if (node)
|
|
717
|
+
cursor.set(node.ownerDocument.defaultView?.getComputedStyle(node).cursor ?? "");
|
|
718
|
+
});
|
|
719
|
+
const values = {
|
|
720
|
+
isHovered: () => hovered(),
|
|
721
|
+
isFocused: () => ring.isFocused(),
|
|
722
|
+
isFocusVisible: () => ring.isFocusVisible(),
|
|
723
|
+
isResizing: aria.isResizing,
|
|
724
|
+
resizableDirection,
|
|
725
|
+
};
|
|
726
|
+
const rp = untrack(() => renderProps({ class: props.class, style: props.style, children: props.children, values, defaultClassName: "rv-ColumnResizer" }, hasLive(props) ? liveRenderProps(props) : undefined));
|
|
727
|
+
const r = aria.resizerProps;
|
|
728
|
+
const input = aria.inputProps;
|
|
729
|
+
const { onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onMouseDown, onClick } = props;
|
|
730
|
+
const dom = globalDOMProps(props, RESIZER_OWNED);
|
|
731
|
+
const { onFocus: inputFocus, onBlur: inputBlur, onChange: inputChange, style: inputStyle, ...inputAttrs } = input;
|
|
732
|
+
// Cursor overlay is used to style the cursor against the entire screen.
|
|
733
|
+
// Do not turn off pointer events or the cursor will no longer be styled.
|
|
734
|
+
return (<div {...dom} ref={resizerRef} role="presentation" class={rp.class()} style={{ ...rp.style(), touchAction: "none" }} data-rv-column-resizer="" data-focused={dataBool(ring.isFocused())} data-focus-visible={dataBool(ring.isFocusVisible())} data-resizing={dataBool(aria.isResizing())} data-resizable-direction={resizableDirection()} onKeyDown={(e) => {
|
|
735
|
+
r.onKeyDown(e);
|
|
736
|
+
}} onKeyUp={(e) => {
|
|
737
|
+
r.onKeyUp(e);
|
|
738
|
+
}} onPointerDown={(e) => {
|
|
739
|
+
r.onPointerDown(e);
|
|
740
|
+
onPointerDown?.(e);
|
|
741
|
+
}} onPointerUp={(e) => {
|
|
742
|
+
r.onPointerUp(e);
|
|
743
|
+
onPointerUp?.(e);
|
|
744
|
+
}} onPointerEnter={(e) => {
|
|
745
|
+
hoverStateEnter(interaction, e);
|
|
746
|
+
r.onPointerEnter(e);
|
|
747
|
+
onPointerEnter?.(e);
|
|
748
|
+
}} onPointerLeave={(e) => {
|
|
749
|
+
hoverStateLeave(interaction, e);
|
|
750
|
+
r.onPointerLeave(e);
|
|
751
|
+
onPointerLeave?.(e);
|
|
752
|
+
}} onMouseDown={(e) => {
|
|
753
|
+
r.onMouseDown(e);
|
|
754
|
+
onMouseDown?.(e);
|
|
755
|
+
}} onClick={(e) => {
|
|
756
|
+
r.onClick(e);
|
|
757
|
+
onClick?.(e);
|
|
758
|
+
}} onDragStart={(e) => r.onDragStart(e)}>
|
|
759
|
+
{rp.children()}
|
|
760
|
+
<input {...inputAttrs} style={inputStyle} onFocus={(e) => {
|
|
761
|
+
inputFocus(e);
|
|
762
|
+
// The ring's focus-in (binds its own blur while focused).
|
|
763
|
+
ring.focusProps.onFocusIn(e);
|
|
764
|
+
}} onBlur={(e) => inputBlur(e)} onChange={(e) => inputChange(e)}/>
|
|
765
|
+
<Show when={() => aria.isResizing() && aria.isMouseResizing()}>
|
|
766
|
+
{() => (<Portal>
|
|
767
|
+
<div style={{ position: "fixed", top: "0", left: "0", bottom: "0", right: "0", cursor: cursor() }} data-testid="cursor-overlay"/>
|
|
768
|
+
</Portal>)}
|
|
769
|
+
</Show>
|
|
770
|
+
</div>);
|
|
771
|
+
}
|
|
772
|
+
/** The body of a `<Table>`, containing the table rows. */
|
|
773
|
+
export const TableBody = /* @__PURE__ */ createBranchComponent(TableBodyNode, function TableBody(props, ref, node) {
|
|
774
|
+
const internal = useContext(TableInternalContext);
|
|
775
|
+
const branchRenderer = useContext(CollectionRendererContext);
|
|
776
|
+
const customBranch = branchRenderer === DefaultCollectionRenderer ? undefined : branchRenderer;
|
|
777
|
+
// The built renderer only reads the parent key: a plain object, not the node class instance (resumable capture).
|
|
778
|
+
const branchParent = { key: node.key };
|
|
779
|
+
const isEmpty = () => internal.collection().size === 0;
|
|
780
|
+
const values = { isEmpty, isDropTarget: () => false };
|
|
781
|
+
const rp = untrack(() => renderProps({ class: props.class, style: props.style, values, defaultClassName: "rv-TableBody" }, hasLive(props) ? liveRenderProps(props) : undefined));
|
|
782
|
+
const renderEmptyState = props.renderEmptyState;
|
|
783
|
+
const numColumns = () => internal.collection().columnCount;
|
|
784
|
+
const dom = globalDOMProps(props, ["style", "id"]);
|
|
785
|
+
// TODO (upstream): TableBody doesn't support being the scrollable body of the table yet.
|
|
786
|
+
if (internal.isVirtualized) {
|
|
787
|
+
// Virtualized (RAC useElementType): `div` row group; the virtualizer renders the row views.
|
|
788
|
+
return (<div {...dom} role="rowgroup" ref={ref} class={rp.class()} style={rp.style()} data-empty={dataBool(isEmpty())}>
|
|
789
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({ collection: internal.collection, parent: branchParent })}
|
|
790
|
+
{renderEmptyState ? (<Show when={isEmpty}>
|
|
791
|
+
{() => (<div role="row" style={{ height: "100%" }}>
|
|
792
|
+
<div role="rowheader" aria-colspan={numColumns()} style={{ height: "100%" }}>
|
|
793
|
+
{renderEmptyState(values)}
|
|
794
|
+
</div>
|
|
795
|
+
</div>)}
|
|
796
|
+
</Show>) : null}
|
|
797
|
+
</div>);
|
|
798
|
+
}
|
|
799
|
+
return (<tbody {...dom} role="rowgroup" ref={ref} class={rp.class()} style={rp.style()} data-empty={dataBool(isEmpty())}>
|
|
800
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({ collection: internal.collection, parent: branchParent })}
|
|
801
|
+
{renderEmptyState ? (<Show when={isEmpty}>
|
|
802
|
+
{() => (<tr role="row">
|
|
803
|
+
<td role="rowheader" colSpan={numColumns()}>
|
|
804
|
+
{renderEmptyState(values)}
|
|
805
|
+
</td>
|
|
806
|
+
</tr>)}
|
|
807
|
+
</Show>) : null}
|
|
808
|
+
</tbody>);
|
|
809
|
+
});
|
|
810
|
+
/** The footer of a `<Table>`, containing table rows. */
|
|
811
|
+
export const TableFooter = /* @__PURE__ */ createBranchComponent(TableFooterNode, function TableFooter(props, ref, node) {
|
|
812
|
+
const internal = useContext(TableInternalContext);
|
|
813
|
+
const branchRenderer = useContext(CollectionRendererContext);
|
|
814
|
+
const customBranch = branchRenderer === DefaultCollectionRenderer ? undefined : branchRenderer;
|
|
815
|
+
// The built renderer only reads the parent key: a plain object, not the node class instance (resumable capture).
|
|
816
|
+
const branchParent = { key: node.key };
|
|
817
|
+
const dom = globalDOMProps(props, ["style", "id"]);
|
|
818
|
+
const className = props.class || "rv-TableFooter";
|
|
819
|
+
const style = props.style;
|
|
820
|
+
if (internal.isVirtualized) {
|
|
821
|
+
// Virtualized (RAC useElementType): `div` row group.
|
|
822
|
+
return (<div {...dom} role="rowgroup" ref={ref} class={className} style={style}>
|
|
823
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({ collection: internal.collection, parent: branchParent })}
|
|
824
|
+
</div>);
|
|
825
|
+
}
|
|
826
|
+
return (<tfoot {...dom} role="rowgroup" ref={ref} class={className} style={style}>
|
|
827
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({ collection: internal.collection, parent: branchParent })}
|
|
828
|
+
</tfoot>);
|
|
829
|
+
});
|
|
830
|
+
/** Global DOM events Row handles itself (the user's chain after its own); RAC drops `onClick`. */
|
|
831
|
+
const ROW_OWNED = [
|
|
832
|
+
"onPointerDown",
|
|
833
|
+
"onPointerUp",
|
|
834
|
+
"onPointerCancel",
|
|
835
|
+
"onPointerEnter",
|
|
836
|
+
"onPointerLeave",
|
|
837
|
+
"onDblClick",
|
|
838
|
+
"onDragStart",
|
|
839
|
+
"onClick",
|
|
840
|
+
"style",
|
|
841
|
+
"id",
|
|
842
|
+
];
|
|
843
|
+
const rowDerived = /* @__PURE__ */ new WeakMap();
|
|
844
|
+
// Row slot values shared by every row (one resume entry each): context consumers copy them, never write.
|
|
845
|
+
const NO_SLOT_PROPS = {};
|
|
846
|
+
const DRAG_SLOT_PROPS = { style: { pointerEvents: "none" } };
|
|
847
|
+
const ROW_BUTTONS = { slots: { [DEFAULT_SLOT]: NO_SLOT_PROPS, chevron: NO_SLOT_PROPS, drag: DRAG_SLOT_PROPS } };
|
|
848
|
+
function rowOptions(r, v, el) {
|
|
849
|
+
return {
|
|
850
|
+
node: v.collection.getItem(r.key),
|
|
851
|
+
isVirtualized: r.isVirtualized,
|
|
852
|
+
shouldSelectOnPressUp: false,
|
|
853
|
+
expandButtonId: r.expandButtonId,
|
|
854
|
+
router: r.router,
|
|
855
|
+
locale: r.locale,
|
|
856
|
+
ref: el ?? undefined,
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
/** The derived parts of a row (built once per `RowData`; owner as `cellOf`). */
|
|
860
|
+
function rowOf(r) {
|
|
861
|
+
let d = rowDerived.get(r);
|
|
862
|
+
if (!d)
|
|
863
|
+
rowDerived.set(r, (d = untrack(() => runWithOwner(null, () => deriveRow(r)))));
|
|
864
|
+
return d;
|
|
865
|
+
}
|
|
866
|
+
function initRow(r) {
|
|
867
|
+
const d = deriveRow(r);
|
|
868
|
+
rowDerived.set(r, d);
|
|
869
|
+
return d;
|
|
870
|
+
}
|
|
871
|
+
function deriveRow(r) {
|
|
872
|
+
const { view, key, locale } = r;
|
|
873
|
+
const st = computed(() => {
|
|
874
|
+
const v = view();
|
|
875
|
+
const n = v.collection.getItem(key);
|
|
876
|
+
if (!n)
|
|
877
|
+
return null;
|
|
878
|
+
const aria = tableRowProps(rowOptions(r, v), v, locale);
|
|
879
|
+
const hasChildItems = !!r.hasChildItems || v.collection.getItem(n.lastChildKey)?.type !== "cell";
|
|
880
|
+
return {
|
|
881
|
+
aria,
|
|
882
|
+
hasChildItems,
|
|
883
|
+
isExpanded: hasChildItems && v.expandedKeys.has(key),
|
|
884
|
+
level: n.level + 1,
|
|
885
|
+
selectionMode: v.selectionManager.selectionMode,
|
|
886
|
+
selectionBehavior: v.selectionManager.selectionBehavior,
|
|
887
|
+
};
|
|
888
|
+
});
|
|
889
|
+
const interaction = {
|
|
890
|
+
// because of https://bugs.webkit.org/show_bug.cgi?id=214609, hover only when selectable or with an action.
|
|
891
|
+
isDisabled: () => !st()?.aria.allowsSelection && !st()?.aria.hasAction,
|
|
892
|
+
onHoverStart: r.onHoverStart,
|
|
893
|
+
onHoverChange: r.onHoverChange,
|
|
894
|
+
onHoverEnd: r.onHoverEnd,
|
|
895
|
+
states: { isHovered: r.hovered, isFocusVisible: r.focusVisible },
|
|
896
|
+
};
|
|
897
|
+
const values = {
|
|
898
|
+
isHovered: () => r.hovered(),
|
|
899
|
+
isPressed: () => r.pressed(),
|
|
900
|
+
// Provided to the row's content (SelectionIndicatorContext, the selection checkbox): captures only `r`.
|
|
901
|
+
isSelected: () => !!rowOf(r).st()?.aria.isSelected,
|
|
902
|
+
isFocused: () => !!st()?.aria.isFocused,
|
|
903
|
+
isFocusVisible: () => r.focusVisible(),
|
|
904
|
+
isDisabled: () => !!st()?.aria.isDisabled,
|
|
905
|
+
selectionMode: () => st()?.selectionMode ?? "none",
|
|
906
|
+
selectionBehavior: () => st()?.selectionBehavior ?? "toggle",
|
|
907
|
+
allowsDragging: () => false,
|
|
908
|
+
isDragging: () => false,
|
|
909
|
+
isDropTarget: () => false,
|
|
910
|
+
isFocusVisibleWithin: () => r.withinVisible(),
|
|
911
|
+
id: key,
|
|
912
|
+
hasChildItems: () => !!st()?.hasChildItems,
|
|
913
|
+
isExpanded: () => !!st()?.isExpanded,
|
|
914
|
+
level: () => st()?.level ?? 1,
|
|
915
|
+
state: view,
|
|
916
|
+
};
|
|
917
|
+
const rp = untrack(() => renderProps({ class: r.class, style: r.style, values, defaultClassName: "rv-Row", defaultStyle: { "--table-row-level": untrack(values.level) } }, r.live));
|
|
918
|
+
// useFocusRing({ within: true }) over the row's own signals (the binding of `data-focus-visible-within` reads them).
|
|
919
|
+
const ring = {
|
|
920
|
+
props: { within: true },
|
|
921
|
+
focused: r.withinFocused,
|
|
922
|
+
visible: r.withinVisible,
|
|
923
|
+
state: { isFocused: false, isFocusVisible: isFocusVisible(), unsubscribe: null },
|
|
924
|
+
};
|
|
925
|
+
return { st, values, rp, interaction, ring };
|
|
926
|
+
}
|
|
927
|
+
/** Row `isPressed` lives in the press memo of the row element: re-read it after the row's press handlers. */
|
|
928
|
+
function rowSyncPressed(r, target) {
|
|
929
|
+
const v = r.view();
|
|
930
|
+
if (v.collection.getItem(r.key))
|
|
931
|
+
r.pressed.set(tableRowProps(rowOptions(r, v, target), v, r.locale).isPressed);
|
|
932
|
+
}
|
|
933
|
+
/** A row event through a grid row handler (+ the pressed re-read). */
|
|
934
|
+
function rowOn(r, e, fn, sync) {
|
|
935
|
+
const v = r.view();
|
|
936
|
+
fn(e, rowOptions(r, v), v);
|
|
937
|
+
if (sync)
|
|
938
|
+
rowSyncPressed(r, e.currentTarget);
|
|
939
|
+
}
|
|
940
|
+
/** The row's own attributes after the user's DOM props (one spread binding). */
|
|
941
|
+
function rowAttrs(r) {
|
|
942
|
+
const { st, values, rp } = rowOf(r);
|
|
943
|
+
const selectionMode = values.selectionMode();
|
|
944
|
+
return {
|
|
945
|
+
...(st()?.aria.rowProps ?? { role: "row" }),
|
|
946
|
+
class: rp.class(),
|
|
947
|
+
style: rp.style(),
|
|
948
|
+
"data-disabled": dataBool(values.isDisabled()),
|
|
949
|
+
"data-selected": dataBool(values.isSelected()),
|
|
950
|
+
"data-focused": dataBool(values.isFocused()),
|
|
951
|
+
"data-pressed": dataBool(r.pressed()),
|
|
952
|
+
"data-selection-mode": selectionMode === "none" ? undefined : selectionMode,
|
|
953
|
+
"data-expanded": dataBool(values.isExpanded()),
|
|
954
|
+
"data-has-child-items": dataBool(values.hasChildItems()),
|
|
955
|
+
"data-level": values.level(),
|
|
956
|
+
"data-focus-visible-within": dataBool(values.isFocusVisibleWithin()),
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
/** A row within a `<Table>`. */
|
|
960
|
+
export const Row = /* @__PURE__ */ createBranchComponent(TableRowNode, function Row(props, forwardedRef, item) {
|
|
961
|
+
const view = useContext(TableStateContext);
|
|
962
|
+
const internal = useContext(TableInternalContext);
|
|
963
|
+
const key = item.key;
|
|
964
|
+
const locale = internal.locale;
|
|
965
|
+
const rowBase = `${internal.gridId}-${normalizeKey(key)}`;
|
|
966
|
+
const expandButtonId = rowBase + "-expand";
|
|
967
|
+
const checkboxId = rowBase + "-checkbox";
|
|
968
|
+
const isTreeGrid = internal.data.treeColumn != null;
|
|
969
|
+
const live = hasLive(props);
|
|
970
|
+
const r = {
|
|
971
|
+
key,
|
|
972
|
+
view,
|
|
973
|
+
isVirtualized: internal.isVirtualized,
|
|
974
|
+
locale,
|
|
975
|
+
router: useRouter(),
|
|
976
|
+
expandButtonId,
|
|
977
|
+
hasChildItems: props.hasChildItems,
|
|
978
|
+
onHoverStart: props.onHoverStart,
|
|
979
|
+
onHoverChange: props.onHoverChange,
|
|
980
|
+
onHoverEnd: props.onHoverEnd,
|
|
981
|
+
hovered: signal(false),
|
|
982
|
+
pressed: signal(false),
|
|
983
|
+
focusVisible: signal(false),
|
|
984
|
+
withinFocused: signal(false),
|
|
985
|
+
withinVisible: signal(false),
|
|
986
|
+
class: live ? undefined : props.class,
|
|
987
|
+
style: live ? undefined : props.style,
|
|
988
|
+
live: live ? liveRenderProps(props, ["class", "style"]) : undefined,
|
|
989
|
+
};
|
|
990
|
+
const { values } = initRow(r);
|
|
991
|
+
// useTableSelectionCheckbox (Rivet: the id derives from the table id + row key, see header). One slots value for
|
|
992
|
+
// CheckboxContext + CheckboxFieldContext; closures capture `r` (the row region's providers are in its resume state).
|
|
993
|
+
const checkboxSlots = {
|
|
994
|
+
slots: {
|
|
995
|
+
[DEFAULT_SLOT]: NO_SLOT_PROPS,
|
|
996
|
+
selection: {
|
|
997
|
+
id: checkboxId,
|
|
998
|
+
"aria-label": untrack(() => tableSelectionCheckboxProps({ key, id: checkboxId, locale }, view()).checkboxProps["aria-label"]),
|
|
999
|
+
"aria-labelledby": untrack(() => `${checkboxId} ${getRowLabelledBy(view(), key)}`),
|
|
1000
|
+
isSelected: values.isSelected,
|
|
1001
|
+
isDisabled: () => !r.view().selectionManager.canSelectItem(r.key),
|
|
1002
|
+
onChange: (isSelected) => tableSelectionCheckboxChange(isSelected, { key: r.key }, r.view()),
|
|
1003
|
+
},
|
|
1004
|
+
},
|
|
1005
|
+
};
|
|
1006
|
+
const buttons = isTreeGrid
|
|
1007
|
+
? {
|
|
1008
|
+
slots: {
|
|
1009
|
+
[DEFAULT_SLOT]: NO_SLOT_PROPS,
|
|
1010
|
+
chevron: {
|
|
1011
|
+
id: expandButtonId,
|
|
1012
|
+
"aria-label": () => rowOf(r).st()?.aria.expandButtonProps["aria-label"],
|
|
1013
|
+
"aria-labelledby": untrack(() => rowOf(r).st()?.aria.expandButtonProps["aria-labelledby"]),
|
|
1014
|
+
isDisabled: () => !!rowOf(r).st()?.aria.expandButtonProps.isDisabled,
|
|
1015
|
+
excludeFromTabOrder: true,
|
|
1016
|
+
preventFocusOnPress: true,
|
|
1017
|
+
"data-react-aria-prevent-focus": "true",
|
|
1018
|
+
onPress: () => {
|
|
1019
|
+
const v = r.view();
|
|
1020
|
+
tableRowExpandPress(rowOptions(r, v), v);
|
|
1021
|
+
},
|
|
1022
|
+
},
|
|
1023
|
+
drag: DRAG_SLOT_PROPS,
|
|
1024
|
+
},
|
|
1025
|
+
}
|
|
1026
|
+
: ROW_BUTTONS;
|
|
1027
|
+
const { onPointerDown, onPointerUp, onPointerCancel, onPointerEnter, onPointerLeave, onDblClick } = props;
|
|
1028
|
+
const dom = globalDOMProps(props, ROW_OWNED);
|
|
1029
|
+
const branchRenderer = useContext(CollectionRendererContext);
|
|
1030
|
+
const customBranch = branchRenderer === DefaultCollectionRenderer ? undefined : branchRenderer;
|
|
1031
|
+
if (r.isVirtualized) {
|
|
1032
|
+
// Virtualized (RAC useElementType): `div` row inside its view; the virtualizer renders the cell views.
|
|
1033
|
+
return (<div {...dom} {...rowAttrs(r)} ref={forwardedRef} onKeyDown={(e) => {
|
|
1034
|
+
const v = r.view();
|
|
1035
|
+
gridRowKeyDown(e, rowOptions(r, v), v);
|
|
1036
|
+
if (!e.cancelBubble)
|
|
1037
|
+
tableRowKeyDown(e, rowOptions(r, v), v);
|
|
1038
|
+
rowSyncPressed(r, e.currentTarget);
|
|
1039
|
+
}} onKeyUp={(e) => rowOn(r, e, gridRowKeyUp, true)} onFocusIn={(e) => {
|
|
1040
|
+
// The row's own focus (was a native `focus` listener per row; it ran before this focusin): its `blur` binds while focused.
|
|
1041
|
+
const d = rowOf(r);
|
|
1042
|
+
focusStateIn(d.interaction, e);
|
|
1043
|
+
rowOn(r, e, gridRowFocus);
|
|
1044
|
+
focusRingFocus(d.ring, e);
|
|
1045
|
+
}} onFocusOut={(e) => focusRingBlur(rowOf(r).ring, e)} onPointerOver={(e) => hoverStateOver(rowOf(r).interaction, e)} onPointerEnter={onPointerEnter ? (e) => onPointerEnter(e) : undefined} onPointerLeave={onPointerLeave ? (e) => onPointerLeave(e) : undefined} onPointerDown={(e) => {
|
|
1046
|
+
rowOn(r, e, gridRowPointerDown, true);
|
|
1047
|
+
onPointerDown?.(e);
|
|
1048
|
+
}} onPointerUp={(e) => {
|
|
1049
|
+
rowOn(r, e, gridRowPointerUp, true);
|
|
1050
|
+
onPointerUp?.(e);
|
|
1051
|
+
}} onPointerCancel={(e) => {
|
|
1052
|
+
rowOn(r, e, gridRowPointerCancel, true);
|
|
1053
|
+
onPointerCancel?.(e);
|
|
1054
|
+
}} onClick={(e) => rowOn(r, e, gridRowClick, true)} onDblClick={(e) => {
|
|
1055
|
+
rowOn(r, e, gridRowDoubleClick);
|
|
1056
|
+
onDblClick?.(e);
|
|
1057
|
+
}} onDragStart={(e) => rowOn(r, e, gridRowDragStart)}>
|
|
1058
|
+
<Provider values={[
|
|
1059
|
+
[CheckboxContext, checkboxSlots],
|
|
1060
|
+
[CheckboxFieldContext, checkboxSlots],
|
|
1061
|
+
[ButtonContext, buttons],
|
|
1062
|
+
[SelectionIndicatorContext, { isSelected: values.isSelected }],
|
|
1063
|
+
[RowFocusContext, { isFocusVisibleWithinRow: values.isFocusVisibleWithin }],
|
|
1064
|
+
]}>
|
|
1065
|
+
{/* The built renderer only reads the parent key: the row data (`key`), not the node class instance (resumable capture). */}
|
|
1066
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({ collection: internal.collection, parent: r })}
|
|
1067
|
+
</Provider>
|
|
1068
|
+
</div>);
|
|
1069
|
+
}
|
|
1070
|
+
return (<tr {...dom} {...rowAttrs(r)} ref={forwardedRef} onKeyDown={(e) => {
|
|
1071
|
+
const v = r.view();
|
|
1072
|
+
gridRowKeyDown(e, rowOptions(r, v), v);
|
|
1073
|
+
if (!e.cancelBubble)
|
|
1074
|
+
tableRowKeyDown(e, rowOptions(r, v), v);
|
|
1075
|
+
rowSyncPressed(r, e.currentTarget);
|
|
1076
|
+
}} onKeyUp={(e) => rowOn(r, e, gridRowKeyUp, true)} onFocusIn={(e) => {
|
|
1077
|
+
// The row's own focus (was a native `focus` listener per row; it ran before this focusin): its `blur` binds while focused.
|
|
1078
|
+
const d = rowOf(r);
|
|
1079
|
+
focusStateIn(d.interaction, e);
|
|
1080
|
+
rowOn(r, e, gridRowFocus);
|
|
1081
|
+
focusRingFocus(d.ring, e);
|
|
1082
|
+
}} onFocusOut={(e) => focusRingBlur(rowOf(r).ring, e)} onPointerOver={(e) => hoverStateOver(rowOf(r).interaction, e)} onPointerEnter={onPointerEnter ? (e) => onPointerEnter(e) : undefined} onPointerLeave={onPointerLeave ? (e) => onPointerLeave(e) : undefined} onPointerDown={(e) => {
|
|
1083
|
+
rowOn(r, e, gridRowPointerDown, true);
|
|
1084
|
+
onPointerDown?.(e);
|
|
1085
|
+
}} onPointerUp={(e) => {
|
|
1086
|
+
rowOn(r, e, gridRowPointerUp, true);
|
|
1087
|
+
onPointerUp?.(e);
|
|
1088
|
+
}} onPointerCancel={(e) => {
|
|
1089
|
+
rowOn(r, e, gridRowPointerCancel, true);
|
|
1090
|
+
onPointerCancel?.(e);
|
|
1091
|
+
}} onClick={(e) => rowOn(r, e, gridRowClick, true)} onDblClick={(e) => {
|
|
1092
|
+
rowOn(r, e, gridRowDoubleClick);
|
|
1093
|
+
onDblClick?.(e);
|
|
1094
|
+
}} onDragStart={(e) => rowOn(r, e, gridRowDragStart)}>
|
|
1095
|
+
<Provider values={[
|
|
1096
|
+
[CheckboxContext, checkboxSlots],
|
|
1097
|
+
[CheckboxFieldContext, checkboxSlots],
|
|
1098
|
+
[ButtonContext, buttons],
|
|
1099
|
+
[SelectionIndicatorContext, { isSelected: values.isSelected }],
|
|
1100
|
+
[RowFocusContext, { isFocusVisibleWithinRow: values.isFocusVisibleWithin }],
|
|
1101
|
+
]}>
|
|
1102
|
+
{/* The built renderer only reads the parent key: the row data (`key`), not the node class instance (resumable capture). */}
|
|
1103
|
+
{(customBranch ?? DefaultCollectionRenderer).CollectionBranch({ collection: internal.collection, parent: r })}
|
|
1104
|
+
</Provider>
|
|
1105
|
+
</tr>);
|
|
1106
|
+
}, (props) => {
|
|
1107
|
+
const children = props.children;
|
|
1108
|
+
if (props.id == null && typeof children === "function" && !isSlot(children)) {
|
|
1109
|
+
throw new Error("No id detected for the Row element. The Row element requires a id to be provided to it when the cells are rendered dynamically.");
|
|
1110
|
+
}
|
|
1111
|
+
return Collection({ items: props.columns, children, idScope: props.id });
|
|
1112
|
+
});
|
|
1113
|
+
const CELL_OWNED = ["onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onClick", "style", "id"];
|
|
1114
|
+
const cellDerived = /* @__PURE__ */ new WeakMap();
|
|
1115
|
+
function cellNode(c, v) {
|
|
1116
|
+
const n = v.collection.getItem(c.key);
|
|
1117
|
+
if (n)
|
|
1118
|
+
n.column = v.collection.columns[n.index];
|
|
1119
|
+
return n;
|
|
1120
|
+
}
|
|
1121
|
+
function cellOptions(c, n) {
|
|
1122
|
+
return {
|
|
1123
|
+
node: n,
|
|
1124
|
+
isVirtualized: c.isVirtualized,
|
|
1125
|
+
focusMode: c.focusMode,
|
|
1126
|
+
allowsArrowNavigation: c.allowsArrowNavigation,
|
|
1127
|
+
shouldSelectOnPressUp: false,
|
|
1128
|
+
ref: undefined,
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* The derived parts of a cell: built by the component (`initCell`, under its owner) or, on a resumed page, on first
|
|
1133
|
+
* use outside any owner (page lifetime, as the resume decoder creates captured computeds) — never under the binding /
|
|
1134
|
+
* handler that asked first (its re-run would dispose the memoized computed).
|
|
1135
|
+
*/
|
|
1136
|
+
function cellOf(c) {
|
|
1137
|
+
let d = cellDerived.get(c);
|
|
1138
|
+
if (!d)
|
|
1139
|
+
cellDerived.set(c, (d = untrack(() => runWithOwner(null, () => deriveCell(c)))));
|
|
1140
|
+
return d;
|
|
1141
|
+
}
|
|
1142
|
+
function initCell(c) {
|
|
1143
|
+
cellDerived.set(c, deriveCell(c));
|
|
1144
|
+
}
|
|
1145
|
+
function deriveCell(c) {
|
|
1146
|
+
const { view, rowKey } = c;
|
|
1147
|
+
const st = computed(() => {
|
|
1148
|
+
const v = view();
|
|
1149
|
+
const n = cellNode(c, v);
|
|
1150
|
+
if (!n)
|
|
1151
|
+
return null;
|
|
1152
|
+
const row = v.collection.getItem(rowKey);
|
|
1153
|
+
const hasChildItems = !!row && (!!row.props?.hasChildItems || v.collection.getItem(row.lastChildKey)?.type !== "cell");
|
|
1154
|
+
return {
|
|
1155
|
+
...tableCellProps(cellOptions(c, n), v),
|
|
1156
|
+
isSelected: v.selectionManager.isSelected(rowKey),
|
|
1157
|
+
isDisabled: v.selectionManager.isDisabled(rowKey),
|
|
1158
|
+
hasChildItems,
|
|
1159
|
+
isExpanded: hasChildItems && v.expandedKeys.has(rowKey),
|
|
1160
|
+
level: (row?.level ?? 0) + 1,
|
|
1161
|
+
// colIndex is null, when there is no span, falling back to using the index
|
|
1162
|
+
columnIndex: n.colIndex || n.index,
|
|
1163
|
+
isTreeColumn: n.column?.key === v.treeColumn,
|
|
1164
|
+
};
|
|
1165
|
+
});
|
|
1166
|
+
const values = {
|
|
1167
|
+
isPressed: () => !!st()?.isPressed,
|
|
1168
|
+
isFocused: () => c.focused(),
|
|
1169
|
+
isFocusVisible: () => c.focusVisible(),
|
|
1170
|
+
isHovered: () => c.hovered(),
|
|
1171
|
+
isSelected: () => !!st()?.isSelected,
|
|
1172
|
+
isDisabled: () => !!st()?.isDisabled,
|
|
1173
|
+
isFocusVisibleWithinRow: c.within,
|
|
1174
|
+
id: c.key,
|
|
1175
|
+
columnIndex: () => st()?.columnIndex,
|
|
1176
|
+
isTreeColumn: () => !!st()?.isTreeColumn,
|
|
1177
|
+
isExpanded: () => !!st()?.isExpanded,
|
|
1178
|
+
hasChildItems: () => !!st()?.hasChildItems,
|
|
1179
|
+
level: () => st()?.level ?? 1,
|
|
1180
|
+
};
|
|
1181
|
+
const rp = untrack(() => renderProps({ class: c.class, style: c.style, children: c.children, values, defaultClassName: "rv-Cell" }, c.live));
|
|
1182
|
+
const interaction = { states: { isHovered: c.hovered, isFocused: c.focused, isFocusVisible: c.focusVisible } };
|
|
1183
|
+
return { st: st, values, rp, interaction };
|
|
1184
|
+
}
|
|
1185
|
+
/** A cell event with the node for the event (skipped once the cell left the collection). */
|
|
1186
|
+
function cellOn(c, e, fn) {
|
|
1187
|
+
const v = c.view();
|
|
1188
|
+
const n = cellNode(c, v);
|
|
1189
|
+
if (n)
|
|
1190
|
+
fn(e, cellOptions(c, n), v);
|
|
1191
|
+
}
|
|
1192
|
+
/** The cell's own attributes after the user's DOM props (one spread binding). */
|
|
1193
|
+
function cellAttrs(c) {
|
|
1194
|
+
const { st, values, rp } = cellOf(c);
|
|
1195
|
+
return {
|
|
1196
|
+
...(st()?.gridCellProps ?? { role: "gridcell" }),
|
|
1197
|
+
class: rp.class(),
|
|
1198
|
+
style: rp.style(),
|
|
1199
|
+
"data-focus-visible-within-row": dataBool(c.within()),
|
|
1200
|
+
"data-pressed": dataBool(values.isPressed()),
|
|
1201
|
+
"data-selected": dataBool(values.isSelected()),
|
|
1202
|
+
"data-column-index": values.columnIndex() ?? undefined,
|
|
1203
|
+
"data-expanded": dataBool(values.isExpanded()),
|
|
1204
|
+
"data-has-child-items": dataBool(values.hasChildItems()),
|
|
1205
|
+
"data-level": values.level(),
|
|
1206
|
+
"data-tree-column": dataBool(values.isTreeColumn()),
|
|
1207
|
+
"data-disabled": dataBool(values.isDisabled()),
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
/** A cell within a table row. */
|
|
1211
|
+
export const Cell = /* @__PURE__ */ createLeafComponent(TableCellNode, function Cell(props, forwardedRef, cell) {
|
|
1212
|
+
const view = useContext(TableStateContext);
|
|
1213
|
+
const internal = useContext(TableInternalContext);
|
|
1214
|
+
const rowFocus = useContext(RowFocusContext);
|
|
1215
|
+
const live = hasLive(props);
|
|
1216
|
+
const c = {
|
|
1217
|
+
key: cell.key,
|
|
1218
|
+
rowKey: cell.parentKey,
|
|
1219
|
+
view,
|
|
1220
|
+
isVirtualized: internal.isVirtualized,
|
|
1221
|
+
focusMode: props.focusMode,
|
|
1222
|
+
allowsArrowNavigation: props.allowsArrowNavigation,
|
|
1223
|
+
within: rowFocus.isFocusVisibleWithinRow,
|
|
1224
|
+
hovered: signal(false),
|
|
1225
|
+
focused: signal(false),
|
|
1226
|
+
focusVisible: signal(false),
|
|
1227
|
+
class: live ? undefined : props.class,
|
|
1228
|
+
style: live ? undefined : props.style,
|
|
1229
|
+
children: live ? undefined : props.children,
|
|
1230
|
+
live: live ? liveRenderProps(props) : undefined,
|
|
1231
|
+
};
|
|
1232
|
+
initCell(c);
|
|
1233
|
+
const { onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onClick } = props;
|
|
1234
|
+
const dom = globalDOMProps(props, CELL_OWNED);
|
|
1235
|
+
if (c.isVirtualized) {
|
|
1236
|
+
// Virtualized (RAC useElementType): `div` cell inside its view.
|
|
1237
|
+
return (<div {...dom} {...cellAttrs(c)} ref={forwardedRef} onKeyDownCapture={(e) => cellOn(c, e, gridCellKeyDownCapture)} onKeyDown={(e) => {
|
|
1238
|
+
cellOn(c, e, gridCellKeyDown);
|
|
1239
|
+
}} onKeyUp={(e) => {
|
|
1240
|
+
cellOn(c, e, gridCellKeyUp);
|
|
1241
|
+
}} onFocusIn={(e) => {
|
|
1242
|
+
// The cell's own focus (was a native `focus` listener per cell, before this focusin); its `blur` binds while focused.
|
|
1243
|
+
focusStateIn(cellOf(c).interaction, e);
|
|
1244
|
+
cellOn(c, e, gridCellFocus);
|
|
1245
|
+
}} onPointerOver={(e) => hoverStateOver(cellOf(c).interaction, e)} onPointerEnter={onPointerEnter ? (e) => onPointerEnter(e) : undefined} onPointerLeave={onPointerLeave ? (e) => onPointerLeave(e) : undefined} onPointerDown={(e) => {
|
|
1246
|
+
cellOn(c, e, gridCellPointerDown);
|
|
1247
|
+
onPointerDown?.(e);
|
|
1248
|
+
}} onPointerUp={(e) => {
|
|
1249
|
+
cellOn(c, e, gridCellPointerUp);
|
|
1250
|
+
onPointerUp?.(e);
|
|
1251
|
+
}} onClick={(e) => {
|
|
1252
|
+
cellOn(c, e, gridCellClick);
|
|
1253
|
+
onClick?.(e);
|
|
1254
|
+
}}>
|
|
1255
|
+
{provide(CollectionRendererContext, DefaultCollectionRenderer, () => cellOf(c).rp.children())}
|
|
1256
|
+
</div>);
|
|
1257
|
+
}
|
|
1258
|
+
return (<td {...dom} {...cellAttrs(c)} ref={forwardedRef} onKeyDownCapture={(e) => cellOn(c, e, gridCellKeyDownCapture)} onKeyDown={(e) => {
|
|
1259
|
+
cellOn(c, e, gridCellKeyDown);
|
|
1260
|
+
}} onKeyUp={(e) => {
|
|
1261
|
+
cellOn(c, e, gridCellKeyUp);
|
|
1262
|
+
}} onFocusIn={(e) => {
|
|
1263
|
+
// The cell's own focus (was a native `focus` listener per cell, before this focusin); its `blur` binds while focused.
|
|
1264
|
+
focusStateIn(cellOf(c).interaction, e);
|
|
1265
|
+
cellOn(c, e, gridCellFocus);
|
|
1266
|
+
}} onPointerOver={(e) => hoverStateOver(cellOf(c).interaction, e)} onPointerEnter={onPointerEnter ? (e) => onPointerEnter(e) : undefined} onPointerLeave={onPointerLeave ? (e) => onPointerLeave(e) : undefined} onPointerDown={(e) => {
|
|
1267
|
+
cellOn(c, e, gridCellPointerDown);
|
|
1268
|
+
onPointerDown?.(e);
|
|
1269
|
+
}} onPointerUp={(e) => {
|
|
1270
|
+
cellOn(c, e, gridCellPointerUp);
|
|
1271
|
+
onPointerUp?.(e);
|
|
1272
|
+
}} onClick={(e) => {
|
|
1273
|
+
cellOn(c, e, gridCellClick);
|
|
1274
|
+
onClick?.(e);
|
|
1275
|
+
}}>
|
|
1276
|
+
{provide(CollectionRendererContext, DefaultCollectionRenderer, () => cellOf(c).rp.children())}
|
|
1277
|
+
</td>);
|
|
1278
|
+
});
|
|
1279
|
+
/** A sentinel row: calls `onLoadMore` when scrolled near, and renders its children while `isLoading`. */
|
|
1280
|
+
export const TableLoadMoreItem = /* @__PURE__ */ createLeafComponent(LoaderNode, function TableLoadingIndicator(props, ref, item) {
|
|
1281
|
+
const internal = useContext(TableInternalContext);
|
|
1282
|
+
const isLoading = props.isLoading;
|
|
1283
|
+
const level = item.level + 1;
|
|
1284
|
+
const numColumns = () => internal.collection().columns.length;
|
|
1285
|
+
const sentinel = elementRef();
|
|
1286
|
+
const { onLoadMore, scrollOffset, style: userStyle } = props;
|
|
1287
|
+
loadMoreSentinel({ onLoadMore, collection: internal.collection, scrollOffset }, sentinel);
|
|
1288
|
+
const children = props.children;
|
|
1289
|
+
const className = props.class || "rv-TableLoadingIndicator";
|
|
1290
|
+
const style = { "--table-row-level": level, ...userStyle };
|
|
1291
|
+
const dom = globalDOMProps(props, ["style", "id"]);
|
|
1292
|
+
if (internal.isVirtualized) {
|
|
1293
|
+
// Virtualized (RAC useElementType): `div`s inside the loader view.
|
|
1294
|
+
return (<>
|
|
1295
|
+
<div style={{ height: "0" }} inert>
|
|
1296
|
+
<div style={{ padding: "0", border: "0" }}>
|
|
1297
|
+
<div data-testid="loadMoreSentinel" ref={sentinel} style={{ position: "relative", height: "1px", width: "1px" }}/>
|
|
1298
|
+
</div>
|
|
1299
|
+
</div>
|
|
1300
|
+
<Show when={() => !!read(isLoading) && children != null}>
|
|
1301
|
+
{() => (<div {...dom} ref={ref} role="row" class={className} style={style} aria-level={level} data-level={level}>
|
|
1302
|
+
<div role="rowheader" aria-colspan={numColumns()}>
|
|
1303
|
+
{children}
|
|
1304
|
+
</div>
|
|
1305
|
+
</div>)}
|
|
1306
|
+
</Show>
|
|
1307
|
+
</>);
|
|
1308
|
+
}
|
|
1309
|
+
return (<>
|
|
1310
|
+
{/* Always render the sentinel. For now onus is on the user for styling when using flex + gap. */}
|
|
1311
|
+
<tr style={{ height: "0" }} inert>
|
|
1312
|
+
<td style={{ padding: "0", border: "0" }}>
|
|
1313
|
+
<div data-testid="loadMoreSentinel" ref={sentinel} style={{ position: "relative", height: "1px", width: "1px" }}/>
|
|
1314
|
+
</td>
|
|
1315
|
+
</tr>
|
|
1316
|
+
<Show when={() => !!read(isLoading) && children != null}>
|
|
1317
|
+
{() => (
|
|
1318
|
+
// For now don't include aria-rowindex on loader since they aren't keyboard focusable.
|
|
1319
|
+
<tr {...dom} ref={ref} role="row" class={className} style={style} aria-level={level} data-level={level}>
|
|
1320
|
+
<td role="rowheader" colSpan={numColumns()}>
|
|
1321
|
+
{children}
|
|
1322
|
+
</td>
|
|
1323
|
+
</tr>)}
|
|
1324
|
+
</Show>
|
|
1325
|
+
</>);
|
|
1326
|
+
});
|