@neo4j-ndl/react 4.20.1 → 4.21.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/lib/cjs/_common/export-stories-utils.js +1 -1
- package/lib/cjs/_common/export-stories-utils.js.map +1 -1
- package/lib/cjs/_common/utils.js +3 -3
- package/lib/cjs/_common/utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/color-utils.js +3 -0
- package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/date-utils.js +14 -13
- package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js +5 -3
- package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/cjs/ai/code-preview/CodePreview.js +1 -1
- package/lib/cjs/ai/code-preview/CodePreview.js.map +1 -1
- package/lib/cjs/ai/file-tag/FileTag.js.map +1 -1
- package/lib/cjs/ai/image-tag/ImageTag.js.map +1 -1
- package/lib/cjs/ai/prompt/Prompt.js +10 -10
- package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-context.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-context.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-default.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-default.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -1
- package/lib/cjs/ai/response/Response.js +4 -4
- package/lib/cjs/ai/response/Response.js.map +1 -1
- package/lib/cjs/ai/response/stories/response-full-example.story.js +1 -1
- package/lib/cjs/ai/response/stories/response-full-example.story.js.map +1 -1
- package/lib/cjs/ai/suggestion/Suggestion.js.map +1 -1
- package/lib/cjs/ai/thinking/thinking-duration-formatter.js +5 -5
- package/lib/cjs/ai/thinking/thinking-duration-formatter.js.map +1 -1
- package/lib/cjs/banner/Banner.js +2 -2
- package/lib/cjs/banner/Banner.js.map +1 -1
- package/lib/cjs/button/ButtonBase.js +4 -4
- package/lib/cjs/button/ButtonBase.js.map +1 -1
- package/lib/cjs/code/Code.js +3 -3
- package/lib/cjs/code/Code.js.map +1 -1
- package/lib/cjs/code-block/CodeBlock.js +2 -2
- package/lib/cjs/code-block/CodeBlock.js.map +1 -1
- package/lib/cjs/color-picker/ColorPicker.js +22 -22
- package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
- package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-default.story.js +4 -4
- package/lib/cjs/color-picker/stories/color-picker-default.story.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +4 -4
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
- package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
- package/lib/cjs/combobox/stories/combobox-large-data-set.story.js +1 -1
- package/lib/cjs/combobox/stories/combobox-large-data-set.story.js.map +1 -1
- package/lib/cjs/data-grid/Components.js +20 -20
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/DataGrid.js +3 -3
- package/lib/cjs/data-grid/DataGrid.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +55 -54
- package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/helpers.js +1 -1
- package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/index.js +2 -2
- package/lib/cjs/data-grid/data-grid-nav/index.js.map +1 -1
- package/lib/cjs/data-grid/helpers/index.js +42 -40
- package/lib/cjs/data-grid/helpers/index.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +10 -7
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
- package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
- package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js +5 -5
- package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/evaluate.js +23 -23
- package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/types.js +1 -1
- package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
- package/lib/cjs/dialog/Dialog.js +5 -5
- package/lib/cjs/dialog/Dialog.js.map +1 -1
- package/lib/cjs/dialog/dialog-types.js.map +1 -1
- package/lib/cjs/drawer/Drawer.js +5 -5
- package/lib/cjs/drawer/Drawer.js.map +1 -1
- package/lib/cjs/dropdown-button/DropdownButton.js +4 -4
- package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/cjs/dropzone/stories/dropzone-full.story.js +1 -1
- package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
- package/lib/cjs/flex/stories/flex-default.story.js +1 -1
- package/lib/cjs/flex/stories/flex-default.story.js.map +1 -1
- package/lib/cjs/hooks/index.js +3 -3
- package/lib/cjs/hooks/index.js.map +1 -1
- package/lib/cjs/icon-button-base/IconButtonBase.js +4 -4
- package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/cjs/icons/generated/custom/ScatterPlot.js +30 -0
- package/lib/cjs/icons/generated/custom/ScatterPlot.js.map +1 -0
- package/lib/cjs/icons/generated/custom/index.js +4 -2
- package/lib/cjs/icons/generated/custom/index.js.map +1 -1
- package/lib/cjs/inline-edit/InlineEdit.js +8 -8
- package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
- package/lib/cjs/kbd/kbd-utils.js +2 -2
- package/lib/cjs/kbd/kbd-utils.js.map +1 -1
- package/lib/cjs/modal/Modal.js +6 -6
- package/lib/cjs/modal/Modal.js.map +1 -1
- package/lib/cjs/next/tree-view/TreeView.js +23 -23
- package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +6 -6
- package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
- package/lib/cjs/popover/Popover.js.map +1 -1
- package/lib/cjs/popover/stories/popover-custom-offset.story.js +3 -3
- package/lib/cjs/popover/stories/popover-custom-offset.story.js.map +1 -1
- package/lib/cjs/popover/use-popover.js +2 -0
- package/lib/cjs/popover/use-popover.js.map +1 -1
- package/lib/cjs/segmented-control/SegmentedControl.js.map +1 -1
- package/lib/cjs/select/Overrides.js +30 -30
- package/lib/cjs/select/Overrides.js.map +1 -1
- package/lib/cjs/select-icon-button/SelectIconButton.js +4 -4
- package/lib/cjs/select-icon-button/SelectIconButton.js.map +1 -1
- package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
- package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
- package/lib/cjs/side-navigation/SideNavigation.js +9 -9
- package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
- package/lib/cjs/slider/Slider.js +1 -1
- package/lib/cjs/slider/Slider.js.map +1 -1
- package/lib/cjs/slider/stories/slider-single-controlled.story.js +2 -2
- package/lib/cjs/slider/stories/slider-single-controlled.story.js.map +1 -1
- package/lib/cjs/spotlight/Spotlight.js +6 -6
- package/lib/cjs/spotlight/Spotlight.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightProvider.js +6 -6
- package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightTarget.js +18 -16
- package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/cjs/status-indicator/StatusIndicator.js +4 -2
- package/lib/cjs/status-indicator/StatusIndicator.js.map +1 -1
- package/lib/cjs/tabs/Tabs.js +3 -3
- package/lib/cjs/tabs/Tabs.js.map +1 -1
- package/lib/cjs/tabs/use-tabs-scroll-overflow.js +2 -2
- package/lib/cjs/tabs/use-tabs-scroll-overflow.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-full.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-full.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/cjs/theme/agnostic.js +4 -4
- package/lib/cjs/theme/agnostic.js.map +1 -1
- package/lib/cjs/time-picker/TimePicker.js +24 -24
- package/lib/cjs/time-picker/TimePicker.js.map +1 -1
- package/lib/cjs/time-picker/generate-time-options.js +3 -3
- package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
- package/lib/cjs/timezone-picker/TimeZonePicker.js +44 -44
- package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/cjs/timezone-picker/generate-timezone-options.js +5 -5
- package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -1
- package/lib/cjs/toast/ToastControlled.js +1 -1
- package/lib/cjs/toast/ToastControlled.js.map +1 -1
- package/lib/cjs/tooltip/use-tooltip.js +8 -1
- package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
- package/lib/cjs/tree-view/TreeItemWrapper.js +8 -8
- package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
- package/lib/cjs/tree-view/TreeView.js +6 -2
- package/lib/cjs/tree-view/TreeView.js.map +1 -1
- package/lib/cjs/tree-view/TreeViewTextItem.js +17 -17
- package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
- package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js +2 -0
- package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
- package/lib/cjs/tree-view/tree-view-utils.js +12 -12
- package/lib/cjs/tree-view/tree-view-utils.js.map +1 -1
- package/lib/esm/_common/export-stories-utils.js +1 -1
- package/lib/esm/_common/export-stories-utils.js.map +1 -1
- package/lib/esm/_common/utils.js +3 -3
- package/lib/esm/_common/utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/color-utils.js +3 -0
- package/lib/esm/_generated/style-rules/color-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/date-utils.js +14 -13
- package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js +5 -3
- package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/esm/ai/code-preview/CodePreview.js +1 -1
- package/lib/esm/ai/code-preview/CodePreview.js.map +1 -1
- package/lib/esm/ai/file-tag/FileTag.js.map +1 -1
- package/lib/esm/ai/image-tag/ImageTag.js.map +1 -1
- package/lib/esm/ai/prompt/Prompt.js +10 -10
- package/lib/esm/ai/prompt/Prompt.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-context.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-context.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-default.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-default.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-header.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -1
- package/lib/esm/ai/response/Response.js +4 -4
- package/lib/esm/ai/response/Response.js.map +1 -1
- package/lib/esm/ai/response/stories/response-full-example.story.js +1 -1
- package/lib/esm/ai/response/stories/response-full-example.story.js.map +1 -1
- package/lib/esm/ai/suggestion/Suggestion.js.map +1 -1
- package/lib/esm/ai/thinking/thinking-duration-formatter.js +5 -5
- package/lib/esm/ai/thinking/thinking-duration-formatter.js.map +1 -1
- package/lib/esm/banner/Banner.js +2 -2
- package/lib/esm/banner/Banner.js.map +1 -1
- package/lib/esm/button/ButtonBase.js +4 -4
- package/lib/esm/button/ButtonBase.js.map +1 -1
- package/lib/esm/code/Code.js +3 -3
- package/lib/esm/code/Code.js.map +1 -1
- package/lib/esm/code-block/CodeBlock.js +2 -2
- package/lib/esm/code-block/CodeBlock.js.map +1 -1
- package/lib/esm/color-picker/ColorPicker.js +22 -22
- package/lib/esm/color-picker/ColorPicker.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
- package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-default.story.js +4 -4
- package/lib/esm/color-picker/stories/color-picker-default.story.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js +4 -4
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
- package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
- package/lib/esm/combobox/stories/combobox-large-data-set.story.js +1 -1
- package/lib/esm/combobox/stories/combobox-large-data-set.story.js.map +1 -1
- package/lib/esm/data-grid/Components.js +20 -20
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/DataGrid.js +3 -3
- package/lib/esm/data-grid/DataGrid.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +55 -54
- package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/helpers.js +1 -1
- package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/index.js +2 -2
- package/lib/esm/data-grid/data-grid-nav/index.js.map +1 -1
- package/lib/esm/data-grid/helpers/index.js +42 -40
- package/lib/esm/data-grid/helpers/index.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +10 -7
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
- package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
- package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-virtualization.story.js +5 -5
- package/lib/esm/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
- package/lib/esm/data-grid/style-rules/evaluate.js +23 -23
- package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/esm/data-grid/style-rules/types.js +1 -1
- package/lib/esm/data-grid/style-rules/types.js.map +1 -1
- package/lib/esm/dialog/Dialog.js +5 -5
- package/lib/esm/dialog/Dialog.js.map +1 -1
- package/lib/esm/dialog/dialog-types.js.map +1 -1
- package/lib/esm/drawer/Drawer.js +5 -5
- package/lib/esm/drawer/Drawer.js.map +1 -1
- package/lib/esm/dropdown-button/DropdownButton.js +4 -4
- package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-full.story.js +1 -1
- package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
- package/lib/esm/flex/stories/flex-default.story.js +1 -1
- package/lib/esm/flex/stories/flex-default.story.js.map +1 -1
- package/lib/esm/hooks/index.js +3 -3
- package/lib/esm/hooks/index.js.map +1 -1
- package/lib/esm/icon-button-base/IconButtonBase.js +4 -4
- package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/esm/icons/generated/custom/ScatterPlot.js +28 -0
- package/lib/esm/icons/generated/custom/ScatterPlot.js.map +1 -0
- package/lib/esm/icons/generated/custom/index.js +1 -0
- package/lib/esm/icons/generated/custom/index.js.map +1 -1
- package/lib/esm/inline-edit/InlineEdit.js +8 -8
- package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
- package/lib/esm/kbd/kbd-utils.js +2 -2
- package/lib/esm/kbd/kbd-utils.js.map +1 -1
- package/lib/esm/modal/Modal.js +6 -6
- package/lib/esm/modal/Modal.js.map +1 -1
- package/lib/esm/next/tree-view/TreeView.js +23 -23
- package/lib/esm/next/tree-view/TreeView.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +6 -6
- package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
- package/lib/esm/popover/Popover.js.map +1 -1
- package/lib/esm/popover/stories/popover-custom-offset.story.js +3 -3
- package/lib/esm/popover/stories/popover-custom-offset.story.js.map +1 -1
- package/lib/esm/popover/use-popover.js +2 -0
- package/lib/esm/popover/use-popover.js.map +1 -1
- package/lib/esm/segmented-control/SegmentedControl.js.map +1 -1
- package/lib/esm/select/Overrides.js +30 -30
- package/lib/esm/select/Overrides.js.map +1 -1
- package/lib/esm/select-icon-button/SelectIconButton.js +4 -4
- package/lib/esm/select-icon-button/SelectIconButton.js.map +1 -1
- package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
- package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
- package/lib/esm/side-navigation/SideNavigation.js +9 -9
- package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
- package/lib/esm/slider/Slider.js +1 -1
- package/lib/esm/slider/Slider.js.map +1 -1
- package/lib/esm/slider/stories/slider-single-controlled.story.js +2 -2
- package/lib/esm/slider/stories/slider-single-controlled.story.js.map +1 -1
- package/lib/esm/spotlight/Spotlight.js +6 -6
- package/lib/esm/spotlight/Spotlight.js.map +1 -1
- package/lib/esm/spotlight/SpotlightProvider.js +6 -6
- package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/esm/spotlight/SpotlightTarget.js +18 -16
- package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/esm/status-indicator/StatusIndicator.js +4 -2
- package/lib/esm/status-indicator/StatusIndicator.js.map +1 -1
- package/lib/esm/tabs/Tabs.js +3 -3
- package/lib/esm/tabs/Tabs.js.map +1 -1
- package/lib/esm/tabs/use-tabs-scroll-overflow.js +2 -2
- package/lib/esm/tabs/use-tabs-scroll-overflow.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-full.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-full.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-with-icons.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/esm/theme/agnostic.js +3 -3
- package/lib/esm/theme/agnostic.js.map +1 -1
- package/lib/esm/time-picker/TimePicker.js +24 -24
- package/lib/esm/time-picker/TimePicker.js.map +1 -1
- package/lib/esm/time-picker/generate-time-options.js +3 -3
- package/lib/esm/time-picker/generate-time-options.js.map +1 -1
- package/lib/esm/timezone-picker/TimeZonePicker.js +44 -44
- package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/esm/timezone-picker/generate-timezone-options.js +5 -5
- package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -1
- package/lib/esm/toast/ToastControlled.js +1 -1
- package/lib/esm/toast/ToastControlled.js.map +1 -1
- package/lib/esm/tooltip/use-tooltip.js +8 -1
- package/lib/esm/tooltip/use-tooltip.js.map +1 -1
- package/lib/esm/tree-view/TreeItemWrapper.js +8 -8
- package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
- package/lib/esm/tree-view/TreeView.js +6 -2
- package/lib/esm/tree-view/TreeView.js.map +1 -1
- package/lib/esm/tree-view/TreeViewTextItem.js +17 -17
- package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
- package/lib/esm/tree-view/tree-view-keyboard-coordinates.js +2 -0
- package/lib/esm/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
- package/lib/esm/tree-view/tree-view-utils.js +12 -12
- package/lib/esm/tree-view/tree-view-utils.js.map +1 -1
- package/lib/types/_common/export-stories-utils.d.ts +1 -1
- package/lib/types/_common/utils.d.ts +3 -3
- package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/date-utils.d.ts +3 -3
- package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
- package/lib/types/ai/code-preview/CodePreview.d.ts +1 -1
- package/lib/types/ai/file-tag/FileTag.d.ts +1 -1
- package/lib/types/ai/file-tag/FileTag.d.ts.map +1 -1
- package/lib/types/ai/image-tag/ImageTag.d.ts +1 -1
- package/lib/types/ai/image-tag/ImageTag.d.ts.map +1 -1
- package/lib/types/ai/prompt/Prompt.d.ts +3 -3
- package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
- package/lib/types/ai/suggestion/Suggestion.d.ts +1 -1
- package/lib/types/ai/suggestion/Suggestion.d.ts.map +1 -1
- package/lib/types/ai/thinking/thinking-duration-formatter.d.ts +5 -5
- package/lib/types/banner/Banner.d.ts +1 -1
- package/lib/types/banner/Banner.d.ts.map +1 -1
- package/lib/types/button/ButtonBase.d.ts +2 -2
- package/lib/types/button/ButtonBase.d.ts.map +1 -1
- package/lib/types/code/Code.d.ts +1 -1
- package/lib/types/code/Code.d.ts.map +1 -1
- package/lib/types/data-grid/Components.d.ts +2 -2
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/data-grid/DataGrid.d.ts +2 -2
- package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts +4 -4
- package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts.map +1 -1
- package/lib/types/data-grid/data-grid-nav/helpers.d.ts +1 -1
- package/lib/types/data-grid/data-grid-nav/index.d.ts +1 -1
- package/lib/types/data-grid/data-grid-nav/index.d.ts.map +1 -1
- package/lib/types/data-grid/helpers/index.d.ts +5 -5
- package/lib/types/data-grid/helpers/index.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-keyboard-navigation.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +2 -2
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +2 -2
- package/lib/types/data-grid/stories/datagrid-virtualization.story.d.ts.map +1 -1
- package/lib/types/data-grid/style-rules/evaluate.d.ts +1 -1
- package/lib/types/dialog/Dialog.d.ts.map +1 -1
- package/lib/types/dialog/dialog-types.d.ts +1 -1
- package/lib/types/dialog/dialog-types.d.ts.map +1 -1
- package/lib/types/drawer/Drawer.d.ts +1 -1
- package/lib/types/drawer/Drawer.d.ts.map +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
- package/lib/types/hooks/index.d.ts +3 -3
- package/lib/types/icon-button-base/IconButtonBase.d.ts +1 -1
- package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
- package/lib/types/icons/generated/custom/ScatterPlot.d.ts +29 -0
- package/lib/types/icons/generated/custom/ScatterPlot.d.ts.map +1 -0
- package/lib/types/icons/generated/custom/index.d.ts +1 -0
- package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
- package/lib/types/modal/Modal.d.ts +1 -1
- package/lib/types/modal/Modal.d.ts.map +1 -1
- package/lib/types/popover/Popover.d.ts.map +1 -1
- package/lib/types/popover/use-popover.d.ts.map +1 -1
- package/lib/types/segmented-control/SegmentedControl.d.ts +1 -1
- package/lib/types/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/lib/types/select/Overrides.d.ts.map +1 -1
- package/lib/types/select-icon-button/SelectIconButton.d.ts +1 -1
- package/lib/types/select-icon-button/SelectIconButton.d.ts.map +1 -1
- package/lib/types/selectable-tag/stories/selectable-tag-sizes.story.d.ts.map +1 -1
- package/lib/types/spotlight/SpotlightProvider.d.ts.map +1 -1
- package/lib/types/spotlight/SpotlightTarget.d.ts +4 -3
- package/lib/types/spotlight/SpotlightTarget.d.ts.map +1 -1
- package/lib/types/status-indicator/StatusIndicator.d.ts.map +1 -1
- package/lib/types/tabs/Tabs.d.ts +1 -1
- package/lib/types/tabs/Tabs.d.ts.map +1 -1
- package/lib/types/theme/agnostic.d.ts +2 -2
- package/lib/types/theme/agnostic.d.ts.map +1 -1
- package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
- package/lib/types/tree-view/TreeView.d.ts.map +1 -1
- package/lib/types/tree-view/TreeViewTextItem.d.ts.map +1 -1
- package/lib/types/tree-view/tree-view-keyboard-coordinates.d.ts.map +1 -1
- package/lib/types/tree-view/tree-view-utils.d.ts +12 -12
- package/lib/types/tree-view/tree-view-utils.d.ts.map +1 -1
- package/package.json +5 -3
- package/skills/ndl-react/components/ai/file-tag.md +1 -1
- package/skills/ndl-react/components/ai/image-tag.md +1 -1
- package/skills/ndl-react/components/ai/prompt.md +10 -10
- package/skills/ndl-react/components/ai/response.md +1 -1
- package/skills/ndl-react/components/ai/suggestion.md +1 -1
- package/skills/ndl-react/components/banner.md +1 -1
- package/skills/ndl-react/components/clean-icon-button.md +1 -1
- package/skills/ndl-react/components/code.md +1 -1
- package/skills/ndl-react/components/combobox.md +1 -1
- package/skills/ndl-react/components/data-grid.md +35 -28
- package/skills/ndl-react/components/dialog.md +1 -1
- package/skills/ndl-react/components/drawer.md +1 -1
- package/skills/ndl-react/components/dropdown-button.md +1 -1
- package/skills/ndl-react/components/dropzone.md +1 -1
- package/skills/ndl-react/components/filled-button.md +2 -2
- package/skills/ndl-react/components/flex.md +2 -2
- package/skills/ndl-react/components/icon-button.md +1 -1
- package/skills/ndl-react/components/modal.md +1 -1
- package/skills/ndl-react/components/next/tree-view.md +8 -8
- package/skills/ndl-react/components/outlined-button.md +2 -2
- package/skills/ndl-react/components/popover.md +3 -3
- package/skills/ndl-react/components/segmented-control.md +1 -1
- package/skills/ndl-react/components/select-icon-button.md +1 -1
- package/skills/ndl-react/components/selectable-tag.md +10 -4
- package/skills/ndl-react/components/slider.md +2 -2
- package/skills/ndl-react/components/tabs.md +1 -1
- package/skills/ndl-react/components/text-button.md +2 -2
- package/skills/ndl-react/components/text-input.md +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["../../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,4DAAoC;AACpC,iCAMe;AAGf,oCAA6C;AAE7C,6CAyBsB;AACtB,2DAI6B;AAC7B,mDAA8C;AAC9C,uCAA+C;AAM/C,IAAK,eAKJ;AALD,WAAK,eAAe;IAClB,yCAAsB,CAAA;IACtB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,gCAAa,CAAA;AACf,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAID,IAAK,eAGJ;AAHD,WAAK,eAAe;IAClB,oCAAiB,CAAA;IACjB,kCAAe,CAAA;AACjB,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AA4DD,MAAM,eAAe,GAAgD;IACnE,WAAW,EAAE,eAAe,CAAC,UAAU;IACvC,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,KAAK;IACvB,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C,IAAI,KAAG,IACpC,GACc,EAErB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,uBAAC,UAAU,CAAC,UAAU,KAAG,KAChD,GACmB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,YAAY,EAAZ,yBAAY;IACZ,UAAU,EAAV,uBAAU;IACV,IAAI,EAAJ,iBAAI;IACJ,QAAQ,EAAR,qBAAQ;IACR,OAAO,EAAP,oBAAO;IACP,cAAc,EAAd,2BAAc;IACd,YAAY,EAAZ,yBAAY;IACZ,MAAM,EAAN,mBAAM;IACN,UAAU,EAAV,uBAAU;IACV,WAAW,EAAX,wBAAW;IACX,cAAc,EAAd,2BAAc;IACd,kBAAkB,EAAlB,+BAAkB;IAClB,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,iBAAiB,EAAjB,8BAAiB;IACjB,+BAA+B,EAA/B,4CAA+B;IAC/B,UAAU,EAAV,uBAAU;IACV,qBAAqB,EAArB,kCAAqB;IACrB,uBAAuB,EAAvB,oCAAuB;IACvB,wBAAwB,EAAxB,qCAAwB;IACxB,WAAW,EAAX,wBAAW;IACX,WAAW,EAAX,wBAAW;IACX,UAAU,EAAV,uBAAU;IACV,YAAY,EAAZ,yBAAY;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAE7D,4BAAQ","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n type RowData,\n type Table as DataGridType,\n} from '@tanstack/react-table';\nimport classNames from 'classnames';\nimport {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useResizeObserver } from '../hooks';\nimport { type Skeleton } from '../skeleton';\nimport {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n} from './Components';\nimport {\n type DataGridComponentsInterface,\n DataGridContext,\n type DataGridContextType,\n} from './data-grid-context';\nimport { useTableNav } from './data-grid-nav';\nimport { updateColumnWidths } from './helpers';\nimport {\n type DataGridStyleRule,\n type DataGridStyleRuleValueConverters,\n} from './style-rules/types';\n\nenum BorderStyleEnum {\n AllSides = 'all-sides',\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n None = 'none',\n}\n\nexport type BorderStyle = `${BorderStyleEnum}`;\n\nenum HeaderStyleEnum {\n Filled = 'filled',\n Clean = 'clean',\n}\n\nexport type HeaderStyle = `${HeaderStyleEnum}`;\n\nexport type DataGridProps<T extends RowData> = {\n styling?: Partial<{\n /** Alternate the background color of rows */\n hasZebraStriping: boolean;\n /** Type of border that will be used */\n borderStyle: BorderStyle;\n /** If header should have styles or not (Aura example) */\n headerStyle: HeaderStyle;\n /** If background hover effects should be enabled on rows and header cells */\n hasHoverEffects: boolean;\n /** If table should have less padding */\n isCompact: boolean;\n }>;\n /** Resizing the width of columns */\n isResizable?: boolean;\n /** Enables table's loading state */\n isLoading?: boolean;\n /**\n * Enables keyboard navigation.\n * To control keyboard navigation programmatically\n * for edge cases, pass a `ref` to `tableNavRef`\n */\n isKeyboardNavigable?: boolean;\n /**\n * Enables automatic resizing of columns.\n * If `isResizable` is `true`, the columns will only be automatically resized on initial render of the table.\n * If `isResizable` is `false`, the columns will be resized automatically to always fit the table width (assuming that column maxWidths allow for it).\n * Note: Action columns are a fixed size of 40px, and Pinned columns are not resized automatically.\n * @defaultValue true\n */\n isAutoResizingColumns?: boolean;\n /**\n * Reference to the tableNav instance\n * for programmatic control\n */\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n tableNavRef?: React.RefObject<any>;\n /** Table instance created from `useTable`*/\n tableInstance: DataGridType<T>;\n /** Table sub-component overrides */\n components?: DataGridComponentsInterface<T>;\n /** @deprecated Use htmlAttributes, className and style on the root element instead */\n rootProps?: HtmlAttributes<'div'>;\n isSkeletonLoading?: boolean;\n skeletonProps?: React.ComponentProps<typeof Skeleton>;\n /** The target element for portaled elements to be rendered in, e.g. the modal root if the data grid is inside a modal.\n * This is used in for example the DropdownCell, RowsPerPage, and ColumnControls.\n */\n portalTarget?: HTMLElement | null;\n /** Rule-based conditional styling for cells and rows. */\n styleRules?: DataGridStyleRule[];\n /** Per-column converters that teach the style-rule engine how to interpret complex cell values. */\n styleRuleValueConverters?: DataGridStyleRuleValueConverters;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nconst DEFAULT_STYLING: Required<DataGridProps<unknown>['styling']> = {\n borderStyle: BorderStyleEnum.Horizontal,\n hasHoverEffects: true,\n hasZebraStriping: false,\n headerStyle: HeaderStyleEnum.Filled,\n isCompact: false,\n};\n\nconst DataGridComponent = function DataGrid<T extends RowData = unknown>({\n isResizable = true,\n isLoading = false,\n isKeyboardNavigable = true,\n isAutoResizingColumns = true,\n tableInstance,\n components,\n rootProps,\n styling = {},\n tableNavRef,\n isSkeletonLoading = false,\n skeletonProps,\n ref,\n portalTarget = document.body,\n styleRules,\n styleRuleValueConverters,\n htmlAttributes,\n className,\n style,\n ...restProps\n}: CommonProps<'div', DataGridProps<T>>) {\n const { className: rootClassName = '', style: rootStyle = {} } =\n rootProps || {};\n\n const [isScrollable, setIsScrollable] = useState(false);\n const [isMediumNavigation, setIsMediumNavigation] = useState(false);\n const [isSmallNavigation, setIsSmallNavigation] = useState(false);\n const tableRef = useRef<HTMLDivElement>(null);\n const scrollableContainerRef = useRef<HTMLDivElement>(null);\n\n tableInstance.setOptions((prevOptions) => {\n return {\n ...prevOptions,\n enableSorting: isSkeletonLoading ? false : prevOptions.enableSorting,\n };\n });\n\n // Triggers when the whole container is resized\n useResizeObserver({\n onResize: (entry) => {\n if (entry.width === undefined) {\n return;\n }\n isAutoResizingColumns &&\n !isResizable &&\n updateColumnWidths(tableInstance, entry.width); // don't resize columns when the table is resizable due to problems with the resize handler.\n setIsScrollable(tableInstance.getTotalSize() > entry.width);\n setIsMediumNavigation(entry.width <= 680);\n setIsSmallNavigation(entry.width <= 480);\n },\n ref: scrollableContainerRef as React.RefObject<HTMLElement>,\n });\n\n // Triggers when the individual columns are resized\n useResizeObserver({\n onResize: () => {\n if (scrollableContainerRef.current === null) {\n return;\n }\n setIsScrollable(\n tableInstance.getTotalSize() >\n scrollableContainerRef.current.clientWidth,\n );\n },\n ref: tableRef as React.RefObject<HTMLElement>,\n });\n\n const Styling = useMemo(\n () => ({\n ...DEFAULT_STYLING,\n ...styling,\n }),\n [styling],\n );\n\n const Components = useMemo(\n () =>\n ({\n ...DataGridComponents,\n ...components,\n }) as DataGridContextType<T>['components'],\n [components],\n );\n const ScrollableContainer = Components?.Scrollable\n ? Components.Scrollable\n : Scrollable;\n\n const { listeners, tableNav } = useTableNav({\n isDebug: false,\n });\n\n /** Surface the tableNav instance for programmatic control if needed */\n useImperativeHandle(tableNavRef, () => tableNav, [tableNav]);\n\n useEffect(() => {\n if (isAutoResizingColumns && isResizable) {\n updateColumnWidths(\n tableInstance,\n scrollableContainerRef.current?.clientWidth\n ? scrollableContainerRef.current.clientWidth - 1 // -1 to avoid horizontal scrollbar\n : 0,\n );\n }\n }, [isAutoResizingColumns, tableInstance, isResizable]);\n\n return (\n <DataGridContext.Provider\n value={\n {\n components: Components,\n dataGridNav: tableNav,\n hasResizeColumns: isAutoResizingColumns,\n isKeyboardNavigationEnabled: isKeyboardNavigable,\n isLoading: isLoading,\n isMediumNavigation,\n isResizable: isResizable,\n isSkeletonLoading,\n isSmallNavigation,\n portalTarget: portalTarget,\n skeletonProps,\n styleRuleValueConverters,\n styleRules,\n tableProps: tableInstance,\n } as DataGridContextType<T>\n }\n >\n <div\n // Root props needs to be first in order to override className\n {...rootProps}\n className={classNames('ndl-data-grid-root', rootClassName, className, {\n 'ndl-data-grid-border-horizontal':\n Styling.borderStyle === BorderStyleEnum.Horizontal ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-border-vertical':\n Styling.borderStyle === BorderStyleEnum.Vertical ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-compact': Styling.isCompact,\n 'ndl-data-grid-focusable-cells': isKeyboardNavigable,\n 'ndl-data-grid-header-filled':\n Styling.headerStyle === HeaderStyleEnum.Filled,\n 'ndl-data-grid-hover-effects': Styling.hasHoverEffects,\n 'ndl-data-grid-resizable': isResizable,\n 'ndl-data-grid-zebra-striping': Styling.hasZebraStriping,\n })}\n ref={ref}\n style={{ ...rootStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n {...(isKeyboardNavigable ? listeners : {})}\n >\n {/* Make DataGrid horizontally scrollable and avoid horizontal scrollbar have an extra vertical scrollbar (esp. Safari) */}\n {/* This behavior can be overridden by consumers through replacing the scrolling container */}\n <ScrollableContainer\n ref={scrollableContainerRef}\n htmlAttributes={{\n onKeyDown: (e) => {\n if (isScrollable && !isKeyboardNavigable) {\n if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {\n e.stopPropagation();\n }\n }\n },\n // Ensure that the user can focus and scroll inside the table with arrow keys even if there is no interactive element inside\n tabIndex: isScrollable && !isKeyboardNavigable ? 0 : undefined,\n }}\n >\n {/* Table content Area */}\n <div\n className=\"ndl-div-table\"\n role={isKeyboardNavigable ? 'grid' : 'table'}\n aria-busy={isLoading ? 'true' : 'false'}\n ref={tableRef}\n >\n {/* DataGrid Header Area */}\n {Components?.Header && <Components.Header />}\n {Components?.Body && <Components.Body />}\n </div>\n </ScrollableContainer>\n {/* Bottom Navigation Area */}\n {Components?.Navigation && <Components.Navigation />}\n </div>\n </DataGridContext.Provider>\n );\n};\n\nconst DataGridComponents = {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n};\n\nconst DataGrid = Object.assign(DataGridComponent, DataGridComponents);\n\nexport { DataGrid };\n"]}
|
|
1
|
+
{"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["../../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,4DAAoC;AACpC,iCAMe;AAGf,oCAA6C;AAE7C,6CAyBsB;AACtB,2DAI6B;AAC7B,mDAA8C;AAC9C,uCAA+C;AAM/C,IAAK,eAKJ;AALD,WAAK,eAAe;IAClB,yCAAsB,CAAA;IACtB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,gCAAa,CAAA;AACf,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAID,IAAK,eAGJ;AAHD,WAAK,eAAe;IAClB,oCAAiB,CAAA;IACjB,kCAAe,CAAA;AACjB,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AA4DD,MAAM,eAAe,GAAgD;IACnE,WAAW,EAAE,eAAe,CAAC,UA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AU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,uBAAC,UAAU,CAAC,IAAI,KAAG,IACpC,GACc,EAErB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,uBAAC,UAAU,CAAC,UAAU,KAAG,KAChD,GACmB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,YAAY,EAAZ,yBAAY;IACZ,UAAU,EAAV,uBAAU;IACV,IAAI,EAAJ,iBAAI;IACJ,QAAQ,EAAR,qBAAQ;IACR,OAAO,EAAP,oBAAO;IACP,cAAc,EAAd,2BAAc;IACd,YAAY,EAAZ,yBAAY;IACZ,MAAM,EAAN,mBAAM;IACN,UAAU,EAAV,uBAAU;IACV,WAAW,EAAX,wBAAW;IACX,cAAc,EAAd,2BAAc;IACd,kBAAkB,EAAlB,+BAAkB;IAClB,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,iBAAiB,EAAjB,8BAAiB;IACjB,+BAA+B,EAA/B,4CAA+B;IAC/B,UAAU,EAAV,uBAAU;IACV,qBAAqB,EAArB,kCAAqB;IACrB,uBAAuB,EAAvB,oCAAuB;IACvB,wBAAwB,EAAxB,qCAAwB;IACxB,WAAW,EAAX,wBAAW;IACX,WAAW,EAAX,wBAAW;IACX,UAAU,EAAV,uBAAU;IACV,YAAY,EAAZ,yBAAY;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAE7D,4BAAQ","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n type RowData,\n type Table as DataGridType,\n} from '@tanstack/react-table';\nimport classNames from 'classnames';\nimport {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useResizeObserver } from '../hooks';\nimport { type Skeleton } from '../skeleton';\nimport {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n} from './Components';\nimport {\n type DataGridComponentsInterface,\n DataGridContext,\n type DataGridContextType,\n} from './data-grid-context';\nimport { useTableNav } from './data-grid-nav';\nimport { updateColumnWidths } from './helpers';\nimport {\n type DataGridStyleRule,\n type DataGridStyleRuleValueConverters,\n} from './style-rules/types';\n\nenum BorderStyleEnum {\n AllSides = 'all-sides',\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n None = 'none',\n}\n\nexport type BorderStyle = `${BorderStyleEnum}`;\n\nenum HeaderStyleEnum {\n Filled = 'filled',\n Clean = 'clean',\n}\n\nexport type HeaderStyle = `${HeaderStyleEnum}`;\n\nexport type DataGridProps<T extends RowData> = {\n styling?: Partial<{\n /** Alternate the background color of rows */\n hasZebraStriping: boolean;\n /** Type of border that will be used */\n borderStyle: BorderStyle;\n /** If header should have styles or not (Aura example) */\n headerStyle: HeaderStyle;\n /** If background hover effects should be enabled on rows and header cells */\n hasHoverEffects: boolean;\n /** If table should have less padding */\n isCompact: boolean;\n }>;\n /** Resizing the width of columns */\n isResizable?: boolean;\n /** Enables table's loading state */\n isLoading?: boolean;\n /**\n * Enables keyboard navigation.\n * To control keyboard navigation programmatically\n * for edge cases, pass a `ref` to `tableNavRef`\n */\n isKeyboardNavigable?: boolean;\n /**\n * Enables automatic resizing of columns.\n * If `isResizable` is `true`, the columns will only be automatically resized on initial render of the table.\n * If `isResizable` is `false`, the columns will be resized automatically to always fit the table width (assuming that column maxWidths allow for it).\n * Note: Action columns are a fixed size of 40px, and Pinned columns are not resized automatically.\n * @defaultValue true\n */\n isAutoResizingColumns?: boolean;\n /**\n * Reference to the tableNav instance\n * for programmatic control\n */\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n tableNavRef?: React.RefObject<any>;\n /** Table instance created from `useTable`*/\n tableInstance: DataGridType<T>;\n /** Table sub-component overrides */\n components?: DataGridComponentsInterface<T>;\n /** @deprecated Use htmlAttributes, className and style on the root element instead */\n rootProps?: HtmlAttributes<'div'>;\n isSkeletonLoading?: boolean;\n skeletonProps?: React.ComponentProps<typeof Skeleton>;\n /** The target element for portaled elements to be rendered in, e.g. the modal root if the data grid is inside a modal.\n * This is used in for example the DropdownCell, RowsPerPage, and ColumnControls.\n */\n portalTarget?: HTMLElement | null;\n /** Rule-based conditional styling for cells and rows. */\n styleRules?: DataGridStyleRule[];\n /** Per-column converters that teach the style-rule engine how to interpret complex cell values. */\n styleRuleValueConverters?: DataGridStyleRuleValueConverters;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nconst DEFAULT_STYLING: Required<DataGridProps<unknown>['styling']> = {\n borderStyle: BorderStyleEnum.Horizontal,\n hasHoverEffects: true,\n hasZebraStriping: false,\n headerStyle: HeaderStyleEnum.Filled,\n isCompact: false,\n};\n\nconst DataGridComponent = function DataGrid<T extends RowData = unknown>({\n isResizable = true,\n isLoading = false,\n isKeyboardNavigable = true,\n isAutoResizingColumns = true,\n tableInstance,\n components,\n rootProps,\n styling = {},\n tableNavRef,\n isSkeletonLoading = false,\n skeletonProps,\n ref,\n portalTarget = document.body,\n styleRules,\n styleRuleValueConverters,\n htmlAttributes,\n className,\n style,\n ...restProps\n}: CommonProps<'div', DataGridProps<T>>) {\n const { className: rootClassName = '', style: rootStyle = {} } =\n rootProps || {};\n\n const [isScrollable, setIsScrollable] = useState(false);\n const [isMediumNavigation, setIsMediumNavigation] = useState(false);\n const [isSmallNavigation, setIsSmallNavigation] = useState(false);\n const tableRef = useRef<HTMLDivElement>(null);\n const scrollableContainerRef = useRef<HTMLDivElement>(null);\n\n tableInstance.setOptions((prevOptions) => {\n return {\n ...prevOptions,\n enableSorting: isSkeletonLoading ? false : prevOptions.enableSorting,\n };\n });\n\n // Triggers when the whole container is resized\n useResizeObserver({\n onResize: (entry) => {\n if (entry.width === undefined) {\n return;\n }\n isAutoResizingColumns &&\n !isResizable &&\n updateColumnWidths(tableInstance, entry.width); // don't resize columns when the table is resizable due to problems with the resize handler.\n setIsScrollable(tableInstance.getTotalSize() > entry.width);\n setIsMediumNavigation(entry.width <= 680);\n setIsSmallNavigation(entry.width <= 480);\n },\n ref: scrollableContainerRef as React.RefObject<HTMLElement>,\n });\n\n // Triggers when the individual columns are resized\n useResizeObserver({\n onResize: () => {\n if (scrollableContainerRef.current === null) {\n return;\n }\n setIsScrollable(\n tableInstance.getTotalSize() >\n scrollableContainerRef.current.clientWidth,\n );\n },\n ref: tableRef as React.RefObject<HTMLElement>,\n });\n\n const Styling = useMemo(\n () => ({\n ...DEFAULT_STYLING,\n ...styling,\n }),\n [styling],\n );\n\n const Components = useMemo(\n () =>\n ({\n ...DataGridComponents,\n ...components,\n }) as DataGridContextType<T>['components'],\n [components],\n );\n const ScrollableContainer = Components?.Scrollable\n ? Components.Scrollable\n : Scrollable;\n\n const { listeners, tableNav } = useTableNav({\n isDebug: false,\n });\n\n /** Surface the tableNav instance for programmatic control if needed */\n useImperativeHandle(tableNavRef, () => tableNav, [tableNav]);\n\n useEffect(() => {\n if (isAutoResizingColumns && isResizable) {\n updateColumnWidths(\n tableInstance,\n scrollableContainerRef.current?.clientWidth\n ? scrollableContainerRef.current.clientWidth - 1 // -1 to avoid horizontal scrollbar\n : 0,\n );\n }\n }, [isAutoResizingColumns, tableInstance, isResizable]);\n\n return (\n <DataGridContext.Provider\n value={\n {\n components: Components,\n dataGridNav: tableNav,\n hasResizeColumns: isAutoResizingColumns,\n isKeyboardNavigationEnabled: isKeyboardNavigable,\n isLoading: isLoading,\n isMediumNavigation,\n isResizable: isResizable,\n isSkeletonLoading,\n isSmallNavigation,\n portalTarget: portalTarget,\n skeletonProps,\n styleRuleValueConverters,\n styleRules,\n tableProps: tableInstance,\n } as DataGridContextType<T>\n }\n >\n <div\n // Root props needs to be first in order to override className\n {...rootProps}\n className={classNames('ndl-data-grid-root', rootClassName, className, {\n 'ndl-data-grid-border-horizontal':\n Styling.borderStyle === BorderStyleEnum.Horizontal ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-border-vertical':\n Styling.borderStyle === BorderStyleEnum.Vertical ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-compact': Styling.isCompact,\n 'ndl-data-grid-focusable-cells': isKeyboardNavigable,\n 'ndl-data-grid-header-filled':\n Styling.headerStyle === HeaderStyleEnum.Filled,\n 'ndl-data-grid-hover-effects': Styling.hasHoverEffects,\n 'ndl-data-grid-resizable': isResizable,\n 'ndl-data-grid-zebra-striping': Styling.hasZebraStriping,\n })}\n ref={ref}\n style={{ ...rootStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n {...(isKeyboardNavigable ? listeners : {})}\n >\n {/* Make DataGrid horizontally scrollable and avoid horizontal scrollbar have an extra vertical scrollbar (esp. Safari) */}\n {/* This behavior can be overridden by consumers through replacing the scrolling container */}\n <ScrollableContainer\n ref={scrollableContainerRef}\n htmlAttributes={{\n onKeyDown: (event) => {\n if (isScrollable && !isKeyboardNavigable) {\n if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {\n event.stopPropagation();\n }\n }\n },\n // Ensure that the user can focus and scroll inside the table with arrow keys even if there is no interactive element inside\n tabIndex: isScrollable && !isKeyboardNavigable ? 0 : undefined,\n }}\n >\n {/* Table content Area */}\n <div\n className=\"ndl-div-table\"\n role={isKeyboardNavigable ? 'grid' : 'table'}\n aria-busy={isLoading ? 'true' : 'false'}\n ref={tableRef}\n >\n {/* DataGrid Header Area */}\n {Components?.Header && <Components.Header />}\n {Components?.Body && <Components.Body />}\n </div>\n </ScrollableContainer>\n {/* Bottom Navigation Area */}\n {Components?.Navigation && <Components.Navigation />}\n </div>\n </DataGridContext.Provider>\n );\n};\n\nconst DataGridComponents = {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n};\n\nconst DataGrid = Object.assign(DataGridComponent, DataGridComponents);\n\nexport { DataGrid };\n"]}
|
|
@@ -70,9 +70,9 @@ class DataGridNav {
|
|
|
70
70
|
this.keys = [];
|
|
71
71
|
}
|
|
72
72
|
/** Used as a keyboard listener for key down */
|
|
73
|
-
tableKeyDown(
|
|
73
|
+
tableKeyDown(event) {
|
|
74
74
|
var _a;
|
|
75
|
-
this.debugLog('tableKeyDown', `Key pressed: ${
|
|
75
|
+
this.debugLog('tableKeyDown', `Key pressed: ${event.key}`);
|
|
76
76
|
if (this.disabled) {
|
|
77
77
|
this.debugLog('tableKeyDown', 'interaction is disabled');
|
|
78
78
|
return;
|
|
@@ -87,69 +87,70 @@ class DataGridNav {
|
|
|
87
87
|
* Cannot work with preventDefault as it will
|
|
88
88
|
* first capture the event from an input in cell for example
|
|
89
89
|
*/
|
|
90
|
-
if (keys_1.Keys.ArrowDown ===
|
|
91
|
-
keys_1.Keys.ArrowUp ===
|
|
92
|
-
keys_1.Keys.ArrowLeft ===
|
|
93
|
-
keys_1.Keys.ArrowRight ===
|
|
94
|
-
|
|
90
|
+
if (keys_1.Keys.ArrowDown === event.key ||
|
|
91
|
+
keys_1.Keys.ArrowUp === event.key ||
|
|
92
|
+
keys_1.Keys.ArrowLeft === event.key ||
|
|
93
|
+
keys_1.Keys.ArrowRight === event.key) {
|
|
94
|
+
event.preventDefault();
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Add key to the stack if it's
|
|
98
98
|
* not the same with the last (long press)
|
|
99
99
|
*/
|
|
100
|
-
if (this.keys.length === 0 ||
|
|
101
|
-
this.keys.
|
|
100
|
+
if (this.keys.length === 0 ||
|
|
101
|
+
this.keys[this.keys.length - 1] !== event.key) {
|
|
102
|
+
this.keys.push(event.key);
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
104
105
|
* Need to check if we are inside a grid cell
|
|
105
106
|
* or not to enable/disable Grid Navigation
|
|
106
107
|
*/
|
|
107
|
-
if (!(
|
|
108
|
+
if (!(event.target instanceof Element)) {
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
|
-
const cell = (_a =
|
|
111
|
+
const cell = (_a = event.target.parentElement) === null || _a === void 0 ? void 0 : _a.closest(`${this.selectors.Cell},${this.selectors.Row}`);
|
|
111
112
|
if (!cell) {
|
|
112
113
|
this.debugLog('tableKeyDown', 'cell not found');
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
116
|
if (cell.matches(this.selectors.Cell)) {
|
|
116
117
|
this.debugLog('tableKeyDown', 'event captured in cell');
|
|
117
|
-
this.cellNavigation(
|
|
118
|
+
this.cellNavigation(event);
|
|
118
119
|
}
|
|
119
120
|
else {
|
|
120
121
|
this.debugLog('tableKeyDown', 'event captured in grid');
|
|
121
|
-
this.gridNavigation(
|
|
122
|
+
this.gridNavigation(event);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
/**
|
|
125
126
|
* Handles the navigation inside a cell
|
|
126
127
|
*/
|
|
127
|
-
cellNavigation(
|
|
128
|
-
if (!(
|
|
128
|
+
cellNavigation(event) {
|
|
129
|
+
if (!(event.target instanceof Element)) {
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
const cell =
|
|
132
|
+
const cell = event.target.closest(this.selectors.Cell);
|
|
132
133
|
if (!cell) {
|
|
133
134
|
this.debugLog('cellNavigation', 'cell not found');
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
137
|
if (this.getValidFocusableChild(cell)) {
|
|
137
138
|
this.debugLog('cellNavigation', 'valid focusable child found');
|
|
138
|
-
this.gridNavigation(
|
|
139
|
+
this.gridNavigation(event);
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
142
|
const focusableWidgets = cell
|
|
142
143
|
? [...cell.querySelectorAll(this.selectors.Focusable)]
|
|
143
144
|
: [];
|
|
144
|
-
const widgetIdx = focusableWidgets.findIndex((el) => el ===
|
|
145
|
+
const widgetIdx = focusableWidgets.findIndex((el) => el === event.target);
|
|
145
146
|
/**
|
|
146
147
|
* Keys: Escape
|
|
147
148
|
* Restore grid navigation
|
|
148
149
|
*/
|
|
149
|
-
if (
|
|
150
|
+
if (event.key === keys_1.Keys.Escape && this.isFocusable(cell)) {
|
|
150
151
|
cell.focus();
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
event.stopPropagation();
|
|
153
154
|
return;
|
|
154
155
|
}
|
|
155
156
|
/**
|
|
@@ -159,7 +160,7 @@ class DataGridNav {
|
|
|
159
160
|
* Arrow Down disabled:
|
|
160
161
|
* https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
|
|
161
162
|
*/
|
|
162
|
-
if (
|
|
163
|
+
if (event.key === keys_1.Keys.ArrowRight || event.key === keys_1.Keys.ArrowDown) {
|
|
163
164
|
const nextFocusable = widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1;
|
|
164
165
|
const widgetToFocus = focusableWidgets[nextFocusable];
|
|
165
166
|
if (this.isFocusable(widgetToFocus)) {
|
|
@@ -174,7 +175,7 @@ class DataGridNav {
|
|
|
174
175
|
* Arrow Up disabled:
|
|
175
176
|
* https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
|
|
176
177
|
*/
|
|
177
|
-
if (
|
|
178
|
+
if (event.key === keys_1.Keys.ArrowLeft || event.key === keys_1.Keys.ArrowUp) {
|
|
178
179
|
const previousFocusable = widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1;
|
|
179
180
|
const widgetToFocus = focusableWidgets[previousFocusable];
|
|
180
181
|
if (this.isFocusable(widgetToFocus)) {
|
|
@@ -185,7 +186,7 @@ class DataGridNav {
|
|
|
185
186
|
}
|
|
186
187
|
/**
|
|
187
188
|
* Get the valid focusable child of a cell
|
|
188
|
-
* @
|
|
189
|
+
* @returns `FocusableElement` | `null` - The valid focusable child, or null if there are none or multiple focusable children
|
|
189
190
|
*/
|
|
190
191
|
getValidFocusableChild(el) {
|
|
191
192
|
const focusableChildren = [
|
|
@@ -202,9 +203,9 @@ class DataGridNav {
|
|
|
202
203
|
* Handles the navigation outside a cell
|
|
203
204
|
* on the grid level
|
|
204
205
|
*/
|
|
205
|
-
gridNavigation(
|
|
206
|
+
gridNavigation(event) {
|
|
206
207
|
var _a;
|
|
207
|
-
if (!(
|
|
208
|
+
if (!(event.target instanceof Element)) {
|
|
208
209
|
return;
|
|
209
210
|
}
|
|
210
211
|
if (this.keys.length === 1) {
|
|
@@ -213,24 +214,24 @@ class DataGridNav {
|
|
|
213
214
|
* Should move focus inside the cell to the first focusable element:
|
|
214
215
|
* https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside
|
|
215
216
|
*/
|
|
216
|
-
if (
|
|
217
|
-
const cell =
|
|
217
|
+
if (event.key === keys_1.Keys.Enter) {
|
|
218
|
+
const cell = event.target.querySelector(this.selectors.Focusable);
|
|
218
219
|
if (cell && this.isFocusable(cell)) {
|
|
219
220
|
// Enter can trigger child elements:
|
|
220
221
|
// Source: https://www.reddit.com/r/learnjavascript/comments/14kpj24/wrong_keydown_listener_is_called_with_focus/
|
|
221
|
-
// If the
|
|
222
|
+
// If the event.preventDefault causes issues, we can offset the execution with setTimeout
|
|
222
223
|
cell.focus();
|
|
223
|
-
|
|
224
|
+
event.preventDefault();
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
/**
|
|
227
228
|
* Keys: ArrowLeft, ArrowRight
|
|
228
229
|
* Should move focus to the next/previous cell
|
|
229
230
|
*/
|
|
230
|
-
if (
|
|
231
|
-
const direction =
|
|
231
|
+
if (event.key === keys_1.Keys.ArrowLeft || event.key === keys_1.Keys.ArrowRight) {
|
|
232
|
+
const direction = event.key === keys_1.Keys.ArrowLeft ? 'prev' : 'next';
|
|
232
233
|
// Get the closest cell we are currently in
|
|
233
|
-
const cell =
|
|
234
|
+
const cell = event.target.closest(this.selectors.Cell);
|
|
234
235
|
if (cell && cell instanceof Element) {
|
|
235
236
|
const closeFocusable = this.findUntil(direction, cell, this.selectors.Cell);
|
|
236
237
|
if (closeFocusable) {
|
|
@@ -248,8 +249,8 @@ class DataGridNav {
|
|
|
248
249
|
* Keys: Up,Down
|
|
249
250
|
* Should move focus to the same column of the next/previous row
|
|
250
251
|
*/
|
|
251
|
-
if (
|
|
252
|
-
this.verticalCellNavigation(
|
|
252
|
+
if (event.key === keys_1.Keys.ArrowDown || event.key === keys_1.Keys.ArrowUp) {
|
|
253
|
+
this.verticalCellNavigation(event);
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
256
|
/**
|
|
@@ -257,18 +258,18 @@ class DataGridNav {
|
|
|
257
258
|
* Should move focus to the first/last row
|
|
258
259
|
* or a predefined number of rows if user provides a value
|
|
259
260
|
*/
|
|
260
|
-
if (
|
|
261
|
-
this.pageCellNavigation(
|
|
261
|
+
if (event.key === keys_1.Keys.PageUp || event.key === keys_1.Keys.PageDown) {
|
|
262
|
+
this.pageCellNavigation(event);
|
|
262
263
|
return;
|
|
263
264
|
}
|
|
264
265
|
/**
|
|
265
266
|
* Keys: Home, End
|
|
266
267
|
* Should move focus to the first/last cell of the current row
|
|
267
268
|
*/
|
|
268
|
-
if (
|
|
269
|
-
const row =
|
|
269
|
+
if (event.key === keys_1.Keys.Home || event.key === keys_1.Keys.End) {
|
|
270
|
+
const row = event.target.closest(this.selectors.Row);
|
|
270
271
|
const rowChildren = [...((row === null || row === void 0 ? void 0 : row.children) || [])];
|
|
271
|
-
if (
|
|
272
|
+
if (event.key === 'End') {
|
|
272
273
|
rowChildren.reverse();
|
|
273
274
|
}
|
|
274
275
|
this.focusOnFirstCell(rowChildren);
|
|
@@ -282,7 +283,7 @@ class DataGridNav {
|
|
|
282
283
|
const [firstKey, secondKey] = this.keys;
|
|
283
284
|
if (firstKey === 'Control' &&
|
|
284
285
|
(secondKey === keys_1.Keys.Home || secondKey === keys_1.Keys.End)) {
|
|
285
|
-
const row =
|
|
286
|
+
const row = event.target.closest(this.selectors.Row);
|
|
286
287
|
const siblings = (_a = row.parentElement) === null || _a === void 0 ? void 0 : _a.children;
|
|
287
288
|
if (!siblings) {
|
|
288
289
|
this.debugLog('cellNavigation', 'siblings not found');
|
|
@@ -297,20 +298,20 @@ class DataGridNav {
|
|
|
297
298
|
}
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
pageCellNavigation(
|
|
301
|
+
pageCellNavigation(event) {
|
|
301
302
|
var _a;
|
|
302
|
-
if (!(
|
|
303
|
+
if (!(event.target instanceof Element)) {
|
|
303
304
|
return;
|
|
304
305
|
}
|
|
305
|
-
const row =
|
|
306
|
-
const cell =
|
|
306
|
+
const row = event.target.closest(this.selectors.Row);
|
|
307
|
+
const cell = event.target.closest(this.selectors.Cell);
|
|
307
308
|
if (row && cell) {
|
|
308
309
|
const position = this.getColumnIndex(cell);
|
|
309
310
|
if (position === undefined) {
|
|
310
311
|
this.debugLog('cellNavigation', 'position not found');
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
313
|
-
const direction =
|
|
314
|
+
const direction = event.key === keys_1.Keys.PageUp ? 'prev' : 'next';
|
|
314
315
|
const siblings = (_a = row.parentElement) === null || _a === void 0 ? void 0 : _a.children;
|
|
315
316
|
if (!siblings) {
|
|
316
317
|
this.debugLog('cellNavigation', 'siblings not found');
|
|
@@ -325,7 +326,7 @@ class DataGridNav {
|
|
|
325
326
|
return;
|
|
326
327
|
}
|
|
327
328
|
let lastVisitedSibling = sibling;
|
|
328
|
-
for (let
|
|
329
|
+
for (let index = 0; index < this.pageUpDown - 1 && sibling; index++) {
|
|
329
330
|
sibling = sibling[methodClbk];
|
|
330
331
|
if (sibling) {
|
|
331
332
|
lastVisitedSibling = sibling;
|
|
@@ -352,13 +353,13 @@ class DataGridNav {
|
|
|
352
353
|
}
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
|
-
verticalCellNavigation(
|
|
356
|
+
verticalCellNavigation(event) {
|
|
356
357
|
var _a, _b, _c, _d, _e;
|
|
357
|
-
if (!(
|
|
358
|
+
if (!(event.target instanceof Element)) {
|
|
358
359
|
return;
|
|
359
360
|
}
|
|
360
|
-
const row =
|
|
361
|
-
const cell =
|
|
361
|
+
const row = event.target.closest(this.selectors.Row);
|
|
362
|
+
const cell = event.target.closest(this.selectors.Cell);
|
|
362
363
|
if (row && cell) {
|
|
363
364
|
const cellPosition = this.getColumnIndex(cell);
|
|
364
365
|
const rowPosition = this.getRowIndex(row);
|
|
@@ -368,7 +369,7 @@ class DataGridNav {
|
|
|
368
369
|
this.debugLog('verticalCellNavigation', 'row or cell position not found');
|
|
369
370
|
return;
|
|
370
371
|
}
|
|
371
|
-
const direction =
|
|
372
|
+
const direction = event.key === keys_1.Keys.ArrowUp ? 'prev' : 'next';
|
|
372
373
|
/** Find previous rowgroup and focus on the proper cell */
|
|
373
374
|
if (rowPosition === 0 && direction === 'prev') {
|
|
374
375
|
const currentRowGroup = (_a = row.parentElement) === null || _a === void 0 ? void 0 : _a.closest(this.selectors.RowGroup);
|
|
@@ -445,8 +446,8 @@ class DataGridNav {
|
|
|
445
446
|
* reversed order
|
|
446
447
|
*/
|
|
447
448
|
focusOnFirstCell(el) {
|
|
448
|
-
for (let
|
|
449
|
-
const child = el[
|
|
449
|
+
for (let index = 0; index < el.length; index++) {
|
|
450
|
+
const child = el[index];
|
|
450
451
|
if (this.isFocusable(child)) {
|
|
451
452
|
child.focus();
|
|
452
453
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-nav.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/data-grid-nav.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAAsD;AACtD,iCAA8B;AAC9B,2CAAwC;AAexC,MAAa,WAAW;IAStB,YAAY,SAAiB,EAAE;QANvB,SAAI,GAAa,EAAE,CAAC;QAepB,aAAQ,GAAG,CAAC,YAAoB,EAAE,OAAe,EAAE,EAAE;YAC3D,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,IAAI,YAAY,MAAM,OAAO,EAAE,CAAC,CAAC;YAChD,CAAC;QACH,CAAC,CAAC;QAZA,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,UAAU,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QAC/D,IAAI,CAAC,SAAS,mCAAQ,qBAAS,GAAK,SAAS,CAAE,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAQD;;;;OAIG;IACI,OAAO;QACZ,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,MAAM;QACX,IAAI,CAA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MAAM,CAAC,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IACE,YAAY;gBACZ,OAAO,YAAY,OAAO;gBAC1B,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAC7B,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,IAAI,OAAO,YAAY,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;gBACjE,OAAO,OAA2B,CAAC;YACrC,CAAC;YAED,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArkBD,kCAqkBC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { isValidInteractiveElement } from './helpers';\nimport { Keys } from './keys';\nimport { Selectors } from './selectors';\n\ntype FocusableElement = HTMLElement | SVGElement;\n\nexport type Config =\n | {\n /** Enable debug logs */\n isDebug?: boolean;\n /** CSS Selectors being used to find Rows, Row Groups, Cells and Focusable elements */\n selectors?: Partial<typeof Selectors>;\n /** How many rows to move when pressing page up/down - Default goes to first/last row */\n pageUpDown?: number;\n }\n | undefined;\n\nexport class DataGridNav {\n private selectors: Record<keyof typeof Selectors, string>;\n readonly pageUpDown: number | undefined;\n private keys: string[] = [];\n private disabled: boolean;\n readonly debug: boolean;\n\n constructor();\n constructor(config: Config);\n constructor(config: Config = {}) {\n const { selectors = {}, pageUpDown, isDebug = false } = config;\n this.selectors = { ...Selectors, ...selectors };\n this.pageUpDown = pageUpDown;\n this.keys = [];\n this.debug = isDebug;\n this.disabled = false;\n }\n\n private debugLog = (functionName: string, message: string) => {\n if (this.debug) {\n console.info(`[${functionName}]: ${message}`);\n }\n };\n\n /**\n * Disables the keyboard listener in cases\n * that elements inside the grid need to use\n * arrows keys etc., like select dropdowns\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Enables the keyboard listeners\n */\n public enable() {\n this.disabled = false;\n }\n\n private isFocusable(el: Element): el is FocusableElement {\n return el instanceof HTMLElement || el instanceof SVGElement;\n }\n\n public focusParentCell(el: Element) {\n const cell = el.closest(this.selectors.Cell);\n if (cell && this.isFocusable(cell)) {\n cell.focus();\n }\n }\n\n /** Used as a keyboard listener for key up */\n public tableKeyUp() {\n // TODO: have a cleanup as user can press key\n // and then move to another tab, and get back to the same tab\n // so this will not be empty (the bug exists with .pop)\n this.keys = [];\n }\n\n /** Used as a keyboard listener for key down */\n public tableKeyDown(e: KeyboardEvent) {\n this.debugLog('tableKeyDown', `Key pressed: ${e.key}`);\n if (this.disabled) {\n this.debugLog('tableKeyDown', 'interaction is disabled');\n return;\n }\n /**\n * Avoid page scrolling etc.\n * Enable default behavior for:\n * Tab, Shift + Tab\n * TODO: Actually it will be better to just prevent\n * in ArrowKeys and PageKeys maybe?\n * Or should the consumer stop propagation?!\n * Cannot work with preventDefault as it will\n * first capture the event from an input in cell for example\n */\n if (\n Keys.ArrowDown === e.key ||\n Keys.ArrowUp === e.key ||\n Keys.ArrowLeft === e.key ||\n Keys.ArrowRight === e.key\n ) {\n e.preventDefault();\n }\n\n /**\n * Add key to the stack if it's\n * not the same with the last (long press)\n */\n if (this.keys.length === 0 || this.keys[this.keys.length - 1] !== e.key) {\n this.keys.push(e.key);\n }\n\n /**\n * Need to check if we are inside a grid cell\n * or not to enable/disable Grid Navigation\n */\n if (!(e.target instanceof Element)) {\n return;\n }\n const cell = e.target.parentElement?.closest(\n `${this.selectors.Cell},${this.selectors.Row}`,\n );\n\n if (!cell) {\n this.debugLog('tableKeyDown', 'cell not found');\n return;\n }\n\n if (cell.matches(this.selectors.Cell)) {\n this.debugLog('tableKeyDown', 'event captured in cell');\n this.cellNavigation(e);\n } else {\n this.debugLog('tableKeyDown', 'event captured in grid');\n this.gridNavigation(e);\n }\n }\n\n /**\n * Handles the navigation inside a cell\n */\n public cellNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n\n const cell = e.target.closest(this.selectors.Cell);\n\n if (!cell) {\n this.debugLog('cellNavigation', 'cell not found');\n return;\n }\n\n if (this.getValidFocusableChild(cell)) {\n this.debugLog('cellNavigation', 'valid focusable child found');\n this.gridNavigation(e);\n return;\n }\n\n const focusableWidgets = cell\n ? [...cell.querySelectorAll(this.selectors.Focusable)]\n : [];\n const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);\n\n /**\n * Keys: Escape\n * Restore grid navigation\n */\n if (e.key === Keys.Escape && this.isFocusable(cell)) {\n cell.focus();\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n /**\n * Keys: ArrowRight, ArrowDown\n * Move to the next focusable cell, or the first one\n *\n * Arrow Down disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (e.key === Keys.ArrowRight || e.key === Keys.ArrowDown) {\n const nextFocusable =\n widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1;\n const widgetToFocus = focusableWidgets[nextFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n\n /**\n * Keys: ArrowLeft, ArrowUp\n * Move to the previous focusable cell, or the last one\n *\n * Arrow Up disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (e.key === Keys.ArrowLeft || e.key === Keys.ArrowUp) {\n const previousFocusable =\n widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1;\n const widgetToFocus = focusableWidgets[previousFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n }\n\n /**\n * Get the valid focusable child of a cell\n * @return {FocusableElement | null} - The valid focusable child, or null if there are none or multiple focusable children\n */\n private getValidFocusableChild(el: Element): FocusableElement | null {\n const focusableChildren = [\n ...el.querySelectorAll(this.selectors.Focusable),\n ];\n if (\n focusableChildren.length === 1 &&\n isValidInteractiveElement(focusableChildren[0]) &&\n this.isFocusable(focusableChildren[0])\n ) {\n return focusableChildren[0];\n }\n return null;\n }\n\n /**\n * Handles the navigation outside a cell\n * on the grid level\n */\n public gridNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n\n if (this.keys.length === 1) {\n /**\n * Keys: Enter\n * Should move focus inside the cell to the first focusable element:\n * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside\n */\n if (e.key === Keys.Enter) {\n const cell = e.target.querySelector(this.selectors.Focusable);\n if (cell && this.isFocusable(cell)) {\n // Enter can trigger child elements:\n // Source: https://www.reddit.com/r/learnjavascript/comments/14kpj24/wrong_keydown_listener_is_called_with_focus/\n // If the e.preventDefault causes issues, we can offset the execution with setTimeout\n cell.focus();\n e.preventDefault();\n }\n }\n\n /**\n * Keys: ArrowLeft, ArrowRight\n * Should move focus to the next/previous cell\n */\n if (e.key === Keys.ArrowLeft || e.key === Keys.ArrowRight) {\n const direction = e.key === Keys.ArrowLeft ? 'prev' : 'next';\n // Get the closest cell we are currently in\n const cell = e.target.closest(this.selectors.Cell);\n\n if (cell && cell instanceof Element) {\n const closeFocusable = this.findUntil(\n direction,\n cell,\n this.selectors.Cell,\n );\n if (closeFocusable) {\n const focusableChild = this.getValidFocusableChild(closeFocusable);\n\n const toFocus = focusableChild ?? closeFocusable;\n toFocus.focus();\n toFocus.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }\n }\n\n /**\n * Keys: Up,Down\n * Should move focus to the same column of the next/previous row\n */\n if (e.key === Keys.ArrowDown || e.key === Keys.ArrowUp) {\n this.verticalCellNavigation(e);\n return;\n }\n\n /**\n * Keys: PageUp, PageDown\n * Should move focus to the first/last row\n * or a predefined number of rows if user provides a value\n */\n if (e.key === Keys.PageUp || e.key === Keys.PageDown) {\n this.pageCellNavigation(e);\n return;\n }\n\n /**\n * Keys: Home, End\n * Should move focus to the first/last cell of the current row\n */\n if (e.key === Keys.Home || e.key === Keys.End) {\n const row = e.target.closest(this.selectors.Row) as Element;\n const rowChildren = [...(row?.children || [])];\n if (e.key === 'End') {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n } else {\n /**\n * Keys: Control + Home, Control + End\n * Should move focus to the first/last cell of the first/last row\n */\n const [firstKey, secondKey] = this.keys;\n if (\n firstKey === 'Control' &&\n (secondKey === Keys.Home || secondKey === Keys.End)\n ) {\n const row = e.target.closest(this.selectors.Row) as Element;\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n const rowToFocus =\n secondKey === Keys.Home ? siblings[0] : siblings[siblings.length - 1];\n const rowChildren = [...(rowToFocus?.children || [])];\n if (secondKey === Keys.End) {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n }\n }\n\n private pageCellNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const row = e.target.closest(this.selectors.Row) as Element;\n const cell = e.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const position = this.getColumnIndex(cell);\n\n if (position === undefined) {\n this.debugLog('cellNavigation', 'position not found');\n return;\n }\n\n const direction = e.key === Keys.PageUp ? 'prev' : 'next';\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n // If pageUpDown is defined, we should move that number of rows, or to the closest possible\n let destinationRow: Element | ChildNode;\n if (this.pageUpDown) {\n const methodClbk =\n direction === 'prev' ? 'previousSibling' : 'nextSibling';\n let sibling = row[methodClbk];\n if (sibling === null) {\n return;\n }\n\n let lastVisitedSibling = sibling;\n\n for (let i = 0; i < this.pageUpDown - 1 && sibling; i++) {\n sibling = sibling[methodClbk];\n if (sibling) {\n lastVisitedSibling = sibling;\n }\n }\n destinationRow = sibling ? sibling : lastVisitedSibling;\n } else {\n destinationRow =\n direction === 'prev' ? siblings[0] : siblings[siblings.length - 1];\n }\n if (!destinationRow || !(destinationRow instanceof Element)) {\n return;\n }\n\n const child = destinationRow.children[position];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n private verticalCellNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const row = e.target.closest(this.selectors.Row) as Element;\n const cell = e.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const cellPosition = this.getColumnIndex(cell);\n const rowPosition = this.getRowIndex(row);\n this.debugLog('gridNavigation', `Initial row position: ${rowPosition}`);\n this.debugLog('gridNavigation', `Initial cell position: ${cellPosition}`);\n if (cellPosition === undefined || rowPosition === undefined) {\n this.debugLog(\n 'verticalCellNavigation',\n 'row or cell position not found',\n );\n return;\n }\n\n const direction = e.key === Keys.ArrowUp ? 'prev' : 'next';\n\n /** Find previous rowgroup and focus on the proper cell */\n if (rowPosition === 0 && direction === 'prev') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== 0) {\n const previousRowGroup = siblingRowGroups[currentRowGroupIdx - 1];\n const rows = [\n ...previousRowGroup.querySelectorAll(this.selectors.Row),\n ];\n const child = rows[rows.length - 1].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n }\n\n const siblingRows = [\n ...(row.parentElement?.querySelectorAll(this.selectors.Row) || []),\n ];\n /** Find next rowgroup and focus on the proper cell */\n if (rowPosition === siblingRows.length - 1 && direction === 'next') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== siblingRowGroups.length - 1) {\n const nextRowGroup = siblingRowGroups[currentRowGroupIdx + 1];\n const rows = [...nextRowGroup.querySelectorAll(this.selectors.Row)];\n const child = rows[0].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n return;\n }\n\n /** Navigation in the same rowgroup */\n const destinationRow = this.findUntil(direction, row, this.selectors.Row);\n if (!destinationRow) {\n return;\n }\n\n const child = destinationRow.children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n /**\n * Sending a row `Element` and then the first cell will be focused.\n *\n * If you want to focus the last cell then the row children can be passed in\n * reversed order\n */\n private focusOnFirstCell(el: Element[]) {\n for (let i = 0; i < el.length; i++) {\n const child = el[i];\n if (this.isFocusable(child)) {\n child.focus();\n return;\n }\n }\n }\n\n /**\n * Get the column index of a `cell` based on the first `row` parent.\n * `cellIndex` could be used, but it's not supported in HTML tables.\n */\n private getColumnIndex(cell: Element) {\n let position = 0;\n const siblings = cell?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (cell !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible, maybe should log here\n if (siblings[position] === undefined) {\n this.debugLog('getColumnIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Get the row index of a `row` based\n * on its sibling rows\n */\n private getRowIndex(row: Element) {\n let position = 0;\n const siblings = row?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (row !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible\n if (siblings[position] === undefined) {\n this.debugLog('getRowIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n */\n private findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n exitSelector?: string,\n ): FocusableElement | null {\n let element: ChildNode = el;\n const method = direction === 'next' ? 'nextSibling' : 'previousSibling';\n\n while (element[method]) {\n const sibling = element[method];\n if (!sibling) {\n return null;\n }\n if (\n exitSelector &&\n sibling instanceof Element &&\n sibling.matches(exitSelector)\n ) {\n return null;\n }\n\n if (sibling instanceof Element && sibling.matches(matchSelector)) {\n return sibling as FocusableElement;\n }\n\n element = sibling;\n }\n\n return null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"data-grid-nav.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/data-grid-nav.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAAsD;AACtD,iCAA8B;AAC9B,2CAAwC;AAexC,MAAa,WAAW;IAStB,YAAY,SAAiB,EAAE;QANvB,SAAI,GAAa,EAAE,CAAC;QAepB,aAAQ,GAAG,CAAC,YAAoB,EAAE,OAAe,EAAE,EAAE;YAC3D,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,IAAI,YAAY,MAAM,OAAO,EAAE,CAAC,CAA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AE,CAAC;YACtE,QAAQ,EAAE,CAAC;QACb,CAAC;QAED,sCAAsC;QACtC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,qCAAqC,CAAC,CAAC;YACpE,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACK,SAAS,CACf,SAA0B,EAC1B,EAAuB,EACvB,aAAqB,EACrB,YAAqB;QAErB,IAAI,OAAO,GAAc,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAExE,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IACE,YAAY;gBACZ,OAAO,YAAY,OAAO;gBAC1B,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAC7B,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,IAAI,OAAO,YAAY,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;gBACjE,OAAO,OAA2B,CAAC;YACrC,CAAC;YAED,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxkBD,kCAwkBC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { isValidInteractiveElement } from './helpers';\nimport { Keys } from './keys';\nimport { Selectors } from './selectors';\n\ntype FocusableElement = HTMLElement | SVGElement;\n\nexport type Config =\n | {\n /** Enable debug logs */\n isDebug?: boolean;\n /** CSS Selectors being used to find Rows, Row Groups, Cells and Focusable elements */\n selectors?: Partial<typeof Selectors>;\n /** How many rows to move when pressing page up/down - Default goes to first/last row */\n pageUpDown?: number;\n }\n | undefined;\n\nexport class DataGridNav {\n private selectors: Record<keyof typeof Selectors, string>;\n readonly pageUpDown: number | undefined;\n private keys: string[] = [];\n private disabled: boolean;\n readonly debug: boolean;\n\n constructor();\n constructor(config: Config);\n constructor(config: Config = {}) {\n const { selectors = {}, pageUpDown, isDebug = false } = config;\n this.selectors = { ...Selectors, ...selectors };\n this.pageUpDown = pageUpDown;\n this.keys = [];\n this.debug = isDebug;\n this.disabled = false;\n }\n\n private debugLog = (functionName: string, message: string) => {\n if (this.debug) {\n console.info(`[${functionName}]: ${message}`);\n }\n };\n\n /**\n * Disables the keyboard listener in cases\n * that elements inside the grid need to use\n * arrows keys etc., like select dropdowns\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Enables the keyboard listeners\n */\n public enable() {\n this.disabled = false;\n }\n\n private isFocusable(el: Element): el is FocusableElement {\n return el instanceof HTMLElement || el instanceof SVGElement;\n }\n\n public focusParentCell(el: Element) {\n const cell = el.closest(this.selectors.Cell);\n if (cell && this.isFocusable(cell)) {\n cell.focus();\n }\n }\n\n /** Used as a keyboard listener for key up */\n public tableKeyUp() {\n // TODO: have a cleanup as user can press key\n // and then move to another tab, and get back to the same tab\n // so this will not be empty (the bug exists with .pop)\n this.keys = [];\n }\n\n /** Used as a keyboard listener for key down */\n public tableKeyDown(event: KeyboardEvent) {\n this.debugLog('tableKeyDown', `Key pressed: ${event.key}`);\n if (this.disabled) {\n this.debugLog('tableKeyDown', 'interaction is disabled');\n return;\n }\n /**\n * Avoid page scrolling etc.\n * Enable default behavior for:\n * Tab, Shift + Tab\n * TODO: Actually it will be better to just prevent\n * in ArrowKeys and PageKeys maybe?\n * Or should the consumer stop propagation?!\n * Cannot work with preventDefault as it will\n * first capture the event from an input in cell for example\n */\n if (\n Keys.ArrowDown === event.key ||\n Keys.ArrowUp === event.key ||\n Keys.ArrowLeft === event.key ||\n Keys.ArrowRight === event.key\n ) {\n event.preventDefault();\n }\n\n /**\n * Add key to the stack if it's\n * not the same with the last (long press)\n */\n if (\n this.keys.length === 0 ||\n this.keys[this.keys.length - 1] !== event.key\n ) {\n this.keys.push(event.key);\n }\n\n /**\n * Need to check if we are inside a grid cell\n * or not to enable/disable Grid Navigation\n */\n if (!(event.target instanceof Element)) {\n return;\n }\n const cell = event.target.parentElement?.closest(\n `${this.selectors.Cell},${this.selectors.Row}`,\n );\n\n if (!cell) {\n this.debugLog('tableKeyDown', 'cell not found');\n return;\n }\n\n if (cell.matches(this.selectors.Cell)) {\n this.debugLog('tableKeyDown', 'event captured in cell');\n this.cellNavigation(event);\n } else {\n this.debugLog('tableKeyDown', 'event captured in grid');\n this.gridNavigation(event);\n }\n }\n\n /**\n * Handles the navigation inside a cell\n */\n public cellNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n\n const cell = event.target.closest(this.selectors.Cell);\n\n if (!cell) {\n this.debugLog('cellNavigation', 'cell not found');\n return;\n }\n\n if (this.getValidFocusableChild(cell)) {\n this.debugLog('cellNavigation', 'valid focusable child found');\n this.gridNavigation(event);\n return;\n }\n\n const focusableWidgets = cell\n ? [...cell.querySelectorAll(this.selectors.Focusable)]\n : [];\n const widgetIdx = focusableWidgets.findIndex((el) => el === event.target);\n\n /**\n * Keys: Escape\n * Restore grid navigation\n */\n if (event.key === Keys.Escape && this.isFocusable(cell)) {\n cell.focus();\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n /**\n * Keys: ArrowRight, ArrowDown\n * Move to the next focusable cell, or the first one\n *\n * Arrow Down disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (event.key === Keys.ArrowRight || event.key === Keys.ArrowDown) {\n const nextFocusable =\n widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1;\n const widgetToFocus = focusableWidgets[nextFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n\n /**\n * Keys: ArrowLeft, ArrowUp\n * Move to the previous focusable cell, or the last one\n *\n * Arrow Up disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (event.key === Keys.ArrowLeft || event.key === Keys.ArrowUp) {\n const previousFocusable =\n widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1;\n const widgetToFocus = focusableWidgets[previousFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n }\n\n /**\n * Get the valid focusable child of a cell\n * @returns `FocusableElement` | `null` - The valid focusable child, or null if there are none or multiple focusable children\n */\n private getValidFocusableChild(el: Element): FocusableElement | null {\n const focusableChildren = [\n ...el.querySelectorAll(this.selectors.Focusable),\n ];\n if (\n focusableChildren.length === 1 &&\n isValidInteractiveElement(focusableChildren[0]) &&\n this.isFocusable(focusableChildren[0])\n ) {\n return focusableChildren[0];\n }\n return null;\n }\n\n /**\n * Handles the navigation outside a cell\n * on the grid level\n */\n public gridNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n\n if (this.keys.length === 1) {\n /**\n * Keys: Enter\n * Should move focus inside the cell to the first focusable element:\n * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside\n */\n if (event.key === Keys.Enter) {\n const cell = event.target.querySelector(this.selectors.Focusable);\n if (cell && this.isFocusable(cell)) {\n // Enter can trigger child elements:\n // Source: https://www.reddit.com/r/learnjavascript/comments/14kpj24/wrong_keydown_listener_is_called_with_focus/\n // If the event.preventDefault causes issues, we can offset the execution with setTimeout\n cell.focus();\n event.preventDefault();\n }\n }\n\n /**\n * Keys: ArrowLeft, ArrowRight\n * Should move focus to the next/previous cell\n */\n if (event.key === Keys.ArrowLeft || event.key === Keys.ArrowRight) {\n const direction = event.key === Keys.ArrowLeft ? 'prev' : 'next';\n // Get the closest cell we are currently in\n const cell = event.target.closest(this.selectors.Cell);\n\n if (cell && cell instanceof Element) {\n const closeFocusable = this.findUntil(\n direction,\n cell,\n this.selectors.Cell,\n );\n if (closeFocusable) {\n const focusableChild = this.getValidFocusableChild(closeFocusable);\n\n const toFocus = focusableChild ?? closeFocusable;\n toFocus.focus();\n toFocus.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }\n }\n\n /**\n * Keys: Up,Down\n * Should move focus to the same column of the next/previous row\n */\n if (event.key === Keys.ArrowDown || event.key === Keys.ArrowUp) {\n this.verticalCellNavigation(event);\n return;\n }\n\n /**\n * Keys: PageUp, PageDown\n * Should move focus to the first/last row\n * or a predefined number of rows if user provides a value\n */\n if (event.key === Keys.PageUp || event.key === Keys.PageDown) {\n this.pageCellNavigation(event);\n return;\n }\n\n /**\n * Keys: Home, End\n * Should move focus to the first/last cell of the current row\n */\n if (event.key === Keys.Home || event.key === Keys.End) {\n const row = event.target.closest(this.selectors.Row) as Element;\n const rowChildren = [...(row?.children || [])];\n if (event.key === 'End') {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n } else {\n /**\n * Keys: Control + Home, Control + End\n * Should move focus to the first/last cell of the first/last row\n */\n const [firstKey, secondKey] = this.keys;\n if (\n firstKey === 'Control' &&\n (secondKey === Keys.Home || secondKey === Keys.End)\n ) {\n const row = event.target.closest(this.selectors.Row) as Element;\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n const rowToFocus =\n secondKey === Keys.Home ? siblings[0] : siblings[siblings.length - 1];\n const rowChildren = [...(rowToFocus?.children || [])];\n if (secondKey === Keys.End) {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n }\n }\n\n private pageCellNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n const row = event.target.closest(this.selectors.Row) as Element;\n const cell = event.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const position = this.getColumnIndex(cell);\n\n if (position === undefined) {\n this.debugLog('cellNavigation', 'position not found');\n return;\n }\n\n const direction = event.key === Keys.PageUp ? 'prev' : 'next';\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n // If pageUpDown is defined, we should move that number of rows, or to the closest possible\n let destinationRow: Element | ChildNode;\n if (this.pageUpDown) {\n const methodClbk =\n direction === 'prev' ? 'previousSibling' : 'nextSibling';\n let sibling = row[methodClbk];\n if (sibling === null) {\n return;\n }\n\n let lastVisitedSibling = sibling;\n\n for (let index = 0; index < this.pageUpDown - 1 && sibling; index++) {\n sibling = sibling[methodClbk];\n if (sibling) {\n lastVisitedSibling = sibling;\n }\n }\n destinationRow = sibling ? sibling : lastVisitedSibling;\n } else {\n destinationRow =\n direction === 'prev' ? siblings[0] : siblings[siblings.length - 1];\n }\n if (!destinationRow || !(destinationRow instanceof Element)) {\n return;\n }\n\n const child = destinationRow.children[position];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n private verticalCellNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n const row = event.target.closest(this.selectors.Row) as Element;\n const cell = event.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const cellPosition = this.getColumnIndex(cell);\n const rowPosition = this.getRowIndex(row);\n this.debugLog('gridNavigation', `Initial row position: ${rowPosition}`);\n this.debugLog('gridNavigation', `Initial cell position: ${cellPosition}`);\n if (cellPosition === undefined || rowPosition === undefined) {\n this.debugLog(\n 'verticalCellNavigation',\n 'row or cell position not found',\n );\n return;\n }\n\n const direction = event.key === Keys.ArrowUp ? 'prev' : 'next';\n\n /** Find previous rowgroup and focus on the proper cell */\n if (rowPosition === 0 && direction === 'prev') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== 0) {\n const previousRowGroup = siblingRowGroups[currentRowGroupIdx - 1];\n const rows = [\n ...previousRowGroup.querySelectorAll(this.selectors.Row),\n ];\n const child = rows[rows.length - 1].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n }\n\n const siblingRows = [\n ...(row.parentElement?.querySelectorAll(this.selectors.Row) || []),\n ];\n /** Find next rowgroup and focus on the proper cell */\n if (rowPosition === siblingRows.length - 1 && direction === 'next') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== siblingRowGroups.length - 1) {\n const nextRowGroup = siblingRowGroups[currentRowGroupIdx + 1];\n const rows = [...nextRowGroup.querySelectorAll(this.selectors.Row)];\n const child = rows[0].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n return;\n }\n\n /** Navigation in the same rowgroup */\n const destinationRow = this.findUntil(direction, row, this.selectors.Row);\n if (!destinationRow) {\n return;\n }\n\n const child = destinationRow.children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n /**\n * Sending a row `Element` and then the first cell will be focused.\n *\n * If you want to focus the last cell then the row children can be passed in\n * reversed order\n */\n private focusOnFirstCell(el: Element[]) {\n for (let index = 0; index < el.length; index++) {\n const child = el[index];\n if (this.isFocusable(child)) {\n child.focus();\n return;\n }\n }\n }\n\n /**\n * Get the column index of a `cell` based on the first `row` parent.\n * `cellIndex` could be used, but it's not supported in HTML tables.\n */\n private getColumnIndex(cell: Element) {\n let position = 0;\n const siblings = cell?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (cell !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible, maybe should log here\n if (siblings[position] === undefined) {\n this.debugLog('getColumnIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Get the row index of a `row` based\n * on its sibling rows\n */\n private getRowIndex(row: Element) {\n let position = 0;\n const siblings = row?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (row !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible\n if (siblings[position] === undefined) {\n this.debugLog('getRowIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n */\n private findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n exitSelector?: string,\n ): FocusableElement | null {\n let element: ChildNode = el;\n const method = direction === 'next' ? 'nextSibling' : 'previousSibling';\n\n while (element[method]) {\n const sibling = element[method];\n if (!sibling) {\n return null;\n }\n if (\n exitSelector &&\n sibling instanceof Element &&\n sibling.matches(exitSelector)\n ) {\n return null;\n }\n\n if (sibling instanceof Element && sibling.matches(matchSelector)) {\n return sibling as FocusableElement;\n }\n\n element = sibling;\n }\n\n return null;\n }\n}\n"]}
|
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.isValidInteractiveElement = void 0;
|
|
24
24
|
/**
|
|
25
25
|
* This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.
|
|
26
|
-
* @param element
|
|
26
|
+
* @param element - The element to check
|
|
27
27
|
* @returns true if the element is an interactive element that doesn't disrupt grid navigation
|
|
28
28
|
*/
|
|
29
29
|
const isValidInteractiveElement = (element) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH;;;;GAIG;AACI,MAAM,yBAAyB,GAAG,CAAC,OAAgB,EAAW,EAAE;IACrE,IAAI,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;QACpC,UAAU;QACV,OAAO;QACP,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,SAAS,GAAI,OAA4B,CAAC,IAAI,CAAC;QACrD,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAvBW,QAAA,yBAAyB,6BAuBpC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n/**\n * This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.\n * @param element
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH;;;;GAIG;AACI,MAAM,yBAAyB,GAAG,CAAC,OAAgB,EAAW,EAAE;IACrE,IAAI,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;QACpC,UAAU;QACV,OAAO;QACP,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,SAAS,GAAI,OAA4B,CAAC,IAAI,CAAC;QACrD,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAvBW,QAAA,yBAAyB,6BAuBpC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n/**\n * This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.\n * @param element - The element to check\n * @returns true if the element is an interactive element that doesn't disrupt grid navigation\n */\nexport const isValidInteractiveElement = (element: Element): boolean => {\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n\n const interactiveTags = new Set(['A', 'BUTTON', 'DETAILS']);\n const interactiveInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'submit',\n 'reset',\n ]);\n\n if (interactiveTags.has(element.tagName)) {\n return true;\n }\n\n if (element.tagName === 'INPUT') {\n const inputType = (element as HTMLInputElement).type;\n return interactiveInputTypes.has(inputType);\n }\n\n return false;\n};\n"]}
|
|
@@ -32,7 +32,7 @@ function useTableNav(options) {
|
|
|
32
32
|
}
|
|
33
33
|
// A piece of state to force a re-render when you want to react to instance changes
|
|
34
34
|
const [, setVersion] = (0, react_1.useState)(0);
|
|
35
|
-
const forceUpdate = (0, react_1.useCallback)(() => setVersion((
|
|
35
|
+
const forceUpdate = (0, react_1.useCallback)(() => setVersion((version) => version + 1), []);
|
|
36
36
|
// Wrap the instance in a proxy that intercepts reads/writes
|
|
37
37
|
const proxiedInstance = (0, react_1.useMemo)(() => {
|
|
38
38
|
const handler = {
|
|
@@ -69,7 +69,7 @@ function useTableNav(options) {
|
|
|
69
69
|
}, [forceUpdate]);
|
|
70
70
|
return {
|
|
71
71
|
listeners: {
|
|
72
|
-
onKeyDown: (
|
|
72
|
+
onKeyDown: (event) => proxiedInstance.tableKeyDown(event.nativeEvent),
|
|
73
73
|
onKeyUp: () => proxiedInstance.tableKeyUp(),
|
|
74
74
|
},
|
|
75
75
|
tableNav: proxiedInstance,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/index.tsx"],"names":[],"mappings":";;AAyBA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/index.tsx"],"names":[],"mappings":";;AAyBA,kCA8DC;AAlED,iCAA+D;AAE/D,mDAA2D;AAE3D,SAAgB,WAAW,CAAC,OAAgB;IAC1C,qEAAqE;IACrE,MAAM,WAAW,GAAG,IAAA,cAAM,EAAqB,IAAI,CAAC,CAAC;IACrD,IAAI,WAAW,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,WAAW,CAAC,OAAO,GAAG,IAAI,2BAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,EAC1C,EAAE,CACH,CAAC;IAEF,4DAA4D;IAC5D,MAAM,eAAe,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACnC,MAAM,OAAO,GAA8B;YACzC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;gBACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAElD,+DAA+D;gBAC/D,IA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o4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\nimport { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { type Config, DataGridNav } from './data-grid-nav';\n\nexport function useTableNav(options?: Config) {\n // Store the actual class instance in a ref so we only create it once\n const instanceRef = useRef<DataGridNav | null>(null);\n if (instanceRef.current === null) {\n instanceRef.current = new DataGridNav(options);\n }\n\n // A piece of state to force a re-render when you want to react to instance changes\n const [, setVersion] = useState(0);\n const forceUpdate = useCallback(\n () => setVersion((version) => version + 1),\n [],\n );\n\n // Wrap the instance in a proxy that intercepts reads/writes\n const proxiedInstance = useMemo(() => {\n const handler: ProxyHandler<DataGridNav> = {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n // If it's a function (a class method), we can intercept calls:\n if (typeof value === 'function') {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n return (...args: any[]) => {\n // Call the original method\n const result = value.apply(target, args);\n\n // Example: force re-render if the method is known to change internal state\n // or if you want to force re-render after *every* method call, remove the condition\n if (['enable', 'disable'].includes(String(prop))) {\n forceUpdate();\n }\n return result;\n };\n }\n\n // Otherwise, it's a property. Just return it.\n return value;\n },\n\n // Trap for property assignments, so React can re-render on changes\n set(target, prop, newValue, receiver) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const result = Reflect.set(target, prop, newValue, receiver);\n // Force re-render after setting *any* property\n forceUpdate();\n return result;\n },\n };\n\n return new Proxy(instanceRef.current as DataGridNav, handler);\n // We only want to create a new Proxy if the instanceRef or forceUpdate changes\n }, [forceUpdate]);\n\n return {\n listeners: {\n onKeyDown: (event: React.KeyboardEvent) =>\n proxiedInstance.tableKeyDown(event.nativeEvent),\n onKeyUp: () => proxiedInstance.tableKeyUp(),\n },\n tableNav: proxiedInstance,\n };\n}\n"]}
|