@neo4j-ndl/react 4.20.1 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.removeLicenseHeader = void 0;
|
|
24
24
|
/**
|
|
25
25
|
* Removes license header comments from source code
|
|
26
|
-
* @param source Raw source code string
|
|
26
|
+
* @param source - Raw source code string
|
|
27
27
|
* @returns Source code with license header removed
|
|
28
28
|
*/
|
|
29
29
|
const removeLicenseHeader = (source) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-stories-utils.js","sourceRoot":"","sources":["../../../src/_common/export-stories-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAU,EAAE;IAC5D,OAAO,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B","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 * Removes license header comments from source code\n * @param source Raw source code string\n * @returns Source code with license header removed\n */\nexport const removeLicenseHeader = (source: string): string => {\n return source.replace(/^\\/\\*[\\s\\S]*?\\*\\/\\s*/, '');\n};\n"]}
|
|
1
|
+
{"version":3,"file":"export-stories-utils.js","sourceRoot":"","sources":["../../../src/_common/export-stories-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAU,EAAE;IAC5D,OAAO,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B","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 * Removes license header comments from source code\n * @param source - Raw source code string\n * @returns Source code with license header removed\n */\nexport const removeLicenseHeader = (source: string): string => {\n return source.replace(/^\\/\\*[\\s\\S]*?\\*\\/\\s*/, '');\n};\n"]}
|
package/lib/cjs/_common/utils.js
CHANGED
|
@@ -126,7 +126,7 @@ function findUntil(direction, el, matchSelector) {
|
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Find all html elements that are focusable given a parent element
|
|
129
|
-
* @param parentElement
|
|
129
|
+
* @param parentElement - The parent element
|
|
130
130
|
* @returns an array of HTML elements
|
|
131
131
|
*/
|
|
132
132
|
const findFocusableChildren = (parentElement) => {
|
|
@@ -142,7 +142,7 @@ const findFocusableChildren = (parentElement) => {
|
|
|
142
142
|
exports.findFocusableChildren = findFocusableChildren;
|
|
143
143
|
/**
|
|
144
144
|
* Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable
|
|
145
|
-
* @param parentRef
|
|
145
|
+
* @param parentRef - The parent element
|
|
146
146
|
* @returns the previous focusable element
|
|
147
147
|
*/
|
|
148
148
|
const findFocusableSibling = (parentRef, direction) => {
|
|
@@ -167,7 +167,7 @@ exports.findFocusableSibling = findFocusableSibling;
|
|
|
167
167
|
/**
|
|
168
168
|
* Convert hex color to rgb format
|
|
169
169
|
*
|
|
170
|
-
* @param hex
|
|
170
|
+
* @param hex - Color in hex code format
|
|
171
171
|
* @returns color in rgb format rgb(_, _, _)
|
|
172
172
|
*/
|
|
173
173
|
const convertHexToRGB = (hex) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":";;;AAoHA,kCAIC;AAWD,8BA6BC;AAhKD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAAyC;AACzC,iCAMe;AAIR,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AADzB,QAAA,cAAc,kBACW;AAEtC,qCAAqC;AAC9B,MAAM,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AC3B,QAAqC,EACrC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,aAAM,CAAC,YAAY,CAAC,OAAO,IAAI,sBAAc,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB;AAEK,MAAM,cAAc,GAAG,CAAC,SAAiB,EAA4B,EAAE;IAC5E,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","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 { tokens } from '@neo4j-ndl/base';\nimport {\n type MouseEvent,\n type TouchEvent,\n useCallback,\n useEffect,\n useRef,\n} from 'react';\n\nimport type { Radius, Spacing } from './types';\n\nexport const removeNewlines = (input: string) =>\n input.replace(/(\\r\\n|\\n|\\r)/gm, '');\n\n/** Remove extra spaces from sting */\nexport const removeSpaces = (input: string) =>\n input.replace(/\\s+/g, ' ').trim();\n\nexport const needleWarningMessage = (message: string) =>\n console.warn(`[🪡 Needle]: ${message}`);\n\nconst getScrollbarSize = (doc: Document): number => {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = doc.documentElement.clientWidth;\n const scrollBarSize = Math.abs(window.innerWidth - documentWidth);\n // Firefox with 110% and 120% zoom level return 1px even if there is no scrollbar\n return scrollBarSize > 1 ? scrollBarSize : 0;\n};\n\nconst getPaddingRight = (element: Element): number =>\n parseInt(window.getComputedStyle(element).paddingRight, 10) || 0;\n\n/**\n * Toggles scroll on the provided document.\n * Useful for disabling scroll when a popup is open (ie ContextMenu/Modal)\n */\nexport const useDocumentScrollToggle = () => {\n const bodyPadding = useRef<number>(0);\n\n return useCallback((disable: boolean, doc: Document = document) => {\n if (disable) {\n const existingPaddingRight = getPaddingRight(doc.body);\n bodyPadding.current = existingPaddingRight;\n const newPaddingRight = existingPaddingRight + getScrollbarSize(doc);\n doc.body.style.overflow = 'hidden';\n doc.body.style.paddingRight = `${newPaddingRight}px`;\n } else {\n doc.body.style.overflow = '';\n doc.body.style.paddingRight = `${bodyPadding.current}px`;\n }\n }, []);\n};\n\n/**\n * Detect if there is a click event outside\n * of the provided element\n * Source:\n * https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28\n */\nexport const useOnClickOutside = <T extends HTMLElement = HTMLElement>(\n ref: React.RefObject<T>,\n handler: (event: MouseEvent | TouchEvent) => void,\n) => {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref?.current;\n if (!el || el.contains((event?.target as Node) || null)) {\n return;\n }\n\n handler(event); // Call the handler only if the click is outside of the element passed.\n };\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('touchstart', listener as any);\n\n return () => {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('touchstart', listener as any);\n };\n }, [ref, handler]); // Reload only if ref or handler changes\n};\n\n/**\n * X - char long pseudo-random string\n */\nexport const randomId = (length: number) =>\n Math.random()\n .toString(36)\n .slice(2, length + 2);\n\n// Utility / Type-Guard if the object is a ref\nexport function isRefObject<T>(\n obj: React.RefObject<T> | T,\n): obj is React.RefObject<T> {\n return obj && typeof obj === 'object' && 'current' in obj;\n}\n\n/**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n * https://api.jquery.com/nextUntil/\n *\n * Additional functionality is added to circle back\n * to the beginning of a list of siblings if it reaches the end\n * or vice versa.\n */\nexport function findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n): Element | null {\n const element: ChildNode = el;\n\n if (!element.parentElement) {\n return null;\n }\n\n const allSiblings = [...element.parentElement.children].filter((sibling) =>\n sibling.matches(matchSelector),\n );\n\n const index = allSiblings.findIndex((sibling) =>\n sibling.isEqualNode(element),\n );\n\n if (index === -1) {\n return null;\n }\n\n const newIndex =\n direction === 'next'\n ? (index + 1) % allSiblings.length\n : (index - 1 + allSiblings.length) % allSiblings.length;\n\n return allSiblings[newIndex];\n}\n\n/**\n * Find all html elements that are focusable given a parent element\n * @param parentElement the parent element\n * @returns an array of HTML elements\n */\nexport const findFocusableChildren = (parentElement: HTMLElement) => {\n const focusableElements =\n 'a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex=\"-1\"])';\n\n const focusable = Array.from(\n parentElement.querySelectorAll(focusableElements),\n ).filter((element) => {\n if (element instanceof HTMLElement) {\n return true;\n }\n\n return false;\n });\n return focusable;\n};\n\n/**\n * Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable\n * @param parentRef the parent element\n * @returns the previous focusable element\n */\nexport const findFocusableSibling = (\n parentRef: React.RefObject<HTMLElement | null>,\n direction: 'prev' | 'next',\n): HTMLElement | undefined => {\n const { current } = parentRef;\n const { activeElement } = document;\n\n if (current === null || activeElement === null) {\n return undefined;\n }\n\n const focusable = findFocusableChildren(current);\n const index = focusable.indexOf(activeElement);\n if (index > -1) {\n const siblingElement = focusable[index + (direction === 'next' ? 1 : -1)];\n if (\n siblingElement === undefined ||\n !(siblingElement instanceof HTMLElement)\n ) {\n return undefined;\n }\n return siblingElement;\n }\n return undefined;\n};\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nexport const convertHexToRGB = (hex: string) => {\n hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const SpacingDefaults = {\n gap: '4',\n padding: '4',\n paddingBlockEnd: undefined,\n paddingBlockStart: undefined,\n paddingInline: undefined,\n paddingInlineEnd: undefined,\n paddingInlineStart: undefined,\n} as const;\n\nexport const getSpacing = (\n spacing: Spacing | undefined,\n property: keyof typeof SpacingDefaults,\n) => {\n return spacing\n ? tokens.space[spacing || SpacingDefaults[property]]\n : undefined;\n};\n\nexport const RadiusDefaults = {\n borderRadius: undefined,\n};\n\nexport const getRadius = (\n spacing: Radius | undefined,\n property: keyof typeof RadiusDefaults,\n) => {\n return spacing\n ? tokens.borderRadius[spacing || RadiusDefaults[property]]\n : undefined;\n};\n\nexport const parseRgbString = (rgbString: string): [number, number, number] => {\n const match = rgbString.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n if (!match) {\n throw new Error(`Unable to parse RGB color: ${rgbString}`);\n }\n return [Number(match[1]), Number(match[2]), Number(match[3])];\n};\n"]}
|
|
1
|
+
{"version":3,"file":"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,OAA4B,EAC5B,QAAsC,EACtC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,aAAM,CAAC,KAAK,CAAC,OAAO,IAAI,uBAAe,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,UAAU,cAOrB;AAEW,QAAA,cAAc,GAAG;IAC5B,YAAY,EAAE,SAAS;CACxB,CAAC;AAEK,MAAM,SAAS,GAAG,CACvB,OAA2B,EAC3B,QAAqC,EACrC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,aAAM,CAAC,YAAY,CAAC,OAAO,IAAI,sBAAc,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB;AAEK,MAAM,cAAc,GAAG,CAAC,SAAiB,EAA4B,EAAE;IAC5E,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","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 { tokens } from '@neo4j-ndl/base';\nimport {\n type MouseEvent,\n type TouchEvent,\n useCallback,\n useEffect,\n useRef,\n} from 'react';\n\nimport type { Radius, Spacing } from './types';\n\nexport const removeNewlines = (input: string) =>\n input.replace(/(\\r\\n|\\n|\\r)/gm, '');\n\n/** Remove extra spaces from sting */\nexport const removeSpaces = (input: string) =>\n input.replace(/\\s+/g, ' ').trim();\n\nexport const needleWarningMessage = (message: string) =>\n console.warn(`[🪡 Needle]: ${message}`);\n\nconst getScrollbarSize = (doc: Document): number => {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = doc.documentElement.clientWidth;\n const scrollBarSize = Math.abs(window.innerWidth - documentWidth);\n // Firefox with 110% and 120% zoom level return 1px even if there is no scrollbar\n return scrollBarSize > 1 ? scrollBarSize : 0;\n};\n\nconst getPaddingRight = (element: Element): number =>\n parseInt(window.getComputedStyle(element).paddingRight, 10) || 0;\n\n/**\n * Toggles scroll on the provided document.\n * Useful for disabling scroll when a popup is open (ie ContextMenu/Modal)\n */\nexport const useDocumentScrollToggle = () => {\n const bodyPadding = useRef<number>(0);\n\n return useCallback((disable: boolean, doc: Document = document) => {\n if (disable) {\n const existingPaddingRight = getPaddingRight(doc.body);\n bodyPadding.current = existingPaddingRight;\n const newPaddingRight = existingPaddingRight + getScrollbarSize(doc);\n doc.body.style.overflow = 'hidden';\n doc.body.style.paddingRight = `${newPaddingRight}px`;\n } else {\n doc.body.style.overflow = '';\n doc.body.style.paddingRight = `${bodyPadding.current}px`;\n }\n }, []);\n};\n\n/**\n * Detect if there is a click event outside\n * of the provided element\n * Source:\n * https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28\n */\nexport const useOnClickOutside = <T extends HTMLElement = HTMLElement>(\n ref: React.RefObject<T>,\n handler: (event: MouseEvent | TouchEvent) => void,\n) => {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref?.current;\n if (!el || el.contains((event?.target as Node) || null)) {\n return;\n }\n\n handler(event); // Call the handler only if the click is outside of the element passed.\n };\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('touchstart', listener as any);\n\n return () => {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('touchstart', listener as any);\n };\n }, [ref, handler]); // Reload only if ref or handler changes\n};\n\n/**\n * X - char long pseudo-random string\n */\nexport const randomId = (length: number) =>\n Math.random()\n .toString(36)\n .slice(2, length + 2);\n\n// Utility / Type-Guard if the object is a ref\nexport function isRefObject<T>(\n obj: React.RefObject<T> | T,\n): obj is React.RefObject<T> {\n return obj && typeof obj === 'object' && 'current' in obj;\n}\n\n/**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n * https://api.jquery.com/nextUntil/\n *\n * Additional functionality is added to circle back\n * to the beginning of a list of siblings if it reaches the end\n * or vice versa.\n */\nexport function findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n): Element | null {\n const element: ChildNode = el;\n\n if (!element.parentElement) {\n return null;\n }\n\n const allSiblings = [...element.parentElement.children].filter((sibling) =>\n sibling.matches(matchSelector),\n );\n\n const index = allSiblings.findIndex((sibling) =>\n sibling.isEqualNode(element),\n );\n\n if (index === -1) {\n return null;\n }\n\n const newIndex =\n direction === 'next'\n ? (index + 1) % allSiblings.length\n : (index - 1 + allSiblings.length) % allSiblings.length;\n\n return allSiblings[newIndex];\n}\n\n/**\n * Find all html elements that are focusable given a parent element\n * @param parentElement - The parent element\n * @returns an array of HTML elements\n */\nexport const findFocusableChildren = (parentElement: HTMLElement) => {\n const focusableElements =\n 'a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex=\"-1\"])';\n\n const focusable = Array.from(\n parentElement.querySelectorAll(focusableElements),\n ).filter((element) => {\n if (element instanceof HTMLElement) {\n return true;\n }\n\n return false;\n });\n return focusable;\n};\n\n/**\n * Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable\n * @param parentRef - The parent element\n * @returns the previous focusable element\n */\nexport const findFocusableSibling = (\n parentRef: React.RefObject<HTMLElement | null>,\n direction: 'prev' | 'next',\n): HTMLElement | undefined => {\n const { current } = parentRef;\n const { activeElement } = document;\n\n if (current === null || activeElement === null) {\n return undefined;\n }\n\n const focusable = findFocusableChildren(current);\n const index = focusable.indexOf(activeElement);\n if (index > -1) {\n const siblingElement = focusable[index + (direction === 'next' ? 1 : -1)];\n if (\n siblingElement === undefined ||\n !(siblingElement instanceof HTMLElement)\n ) {\n return undefined;\n }\n return siblingElement;\n }\n return undefined;\n};\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex - Color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nexport const convertHexToRGB = (hex: string) => {\n hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const SpacingDefaults = {\n gap: '4',\n padding: '4',\n paddingBlockEnd: undefined,\n paddingBlockStart: undefined,\n paddingInline: undefined,\n paddingInlineEnd: undefined,\n paddingInlineStart: undefined,\n} as const;\n\nexport const getSpacing = (\n spacing: Spacing | undefined,\n property: keyof typeof SpacingDefaults,\n) => {\n return spacing\n ? tokens.space[spacing || SpacingDefaults[property]]\n : undefined;\n};\n\nexport const RadiusDefaults = {\n borderRadius: undefined,\n};\n\nexport const getRadius = (\n spacing: Radius | undefined,\n property: keyof typeof RadiusDefaults,\n) => {\n return spacing\n ? tokens.borderRadius[spacing || RadiusDefaults[property]]\n : undefined;\n};\n\nexport const parseRgbString = (rgbString: string): [number, number, number] => {\n const match = rgbString.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n if (!match) {\n throw new Error(`Unable to parse RGB color: ${rgbString}`);\n }\n return [Number(match[1]), Number(match[2]), Number(match[3])];\n};\n"]}
|
|
@@ -42,8 +42,11 @@ function getWeight(startValue, endValue, value) {
|
|
|
42
42
|
*/
|
|
43
43
|
function lerpColor(startColor, endColor, weight) {
|
|
44
44
|
return {
|
|
45
|
+
// oxlint-disable-next-line id-length
|
|
45
46
|
b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
|
|
47
|
+
// oxlint-disable-next-line id-length
|
|
46
48
|
g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
|
|
49
|
+
// oxlint-disable-next-line id-length
|
|
47
50
|
r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
|
|
48
51
|
};
|
|
49
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8BH,8BAMC;AAMD,
|
|
1
|
+
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8BH,8BAMC;AAMD,8BAaC;AA9BD;;;;GAIG;AACH,SAAgB,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CACvB,UAAoB,EACpB,QAAkB,EAClB,MAAc;IAEd,OAAO;QACL,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;KACjE,CAAC;AACJ,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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\nimport type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n // oxlint-disable-next-line id-length\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n // oxlint-disable-next-line id-length\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n // oxlint-disable-next-line id-length\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\n"]}
|
|
@@ -58,21 +58,21 @@ function parseOffsetMs(offsetStr) {
|
|
|
58
58
|
*
|
|
59
59
|
* Values wrap around midnight: `"00:00:00+01:00"` → 82,800,000 (23:00 UTC).
|
|
60
60
|
*/
|
|
61
|
-
function parseTimeString(
|
|
61
|
+
function parseTimeString(input) {
|
|
62
62
|
// Reject datetime strings and anything with an IANA timezone bracket.
|
|
63
63
|
// Temporal.PlainTime.from silently extracts the time portion from strings
|
|
64
64
|
// containing a 'T' separator. IANA brackets are meaningless for time-only
|
|
65
65
|
// values (there is no date to anchor DST to), so they are also rejected.
|
|
66
|
-
if (
|
|
66
|
+
if (input.includes('T') || input.includes('[')) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
// Offset time: detect "+HH:MM" or "-HH:MM" suffix first. Temporal.PlainTime.from
|
|
70
70
|
// silently strips offsets and returns the clock-face time, so we must handle
|
|
71
71
|
// offset strings explicitly before falling through to the plain parse.
|
|
72
|
-
const offsetMatch =
|
|
72
|
+
const offsetMatch = input.match(/([+-]\d{2}:\d{2})(\[.*\])?$/);
|
|
73
73
|
if (offsetMatch) {
|
|
74
74
|
const offsetStr = offsetMatch[1];
|
|
75
|
-
const timeStr =
|
|
75
|
+
const timeStr = input.slice(0, input.indexOf(offsetStr));
|
|
76
76
|
const offsetMs = parseOffsetMs(offsetStr);
|
|
77
77
|
if (offsetMs !== null) {
|
|
78
78
|
try {
|
|
@@ -89,7 +89,7 @@ function parseTimeString(s) {
|
|
|
89
89
|
// UTC time with Z suffix (e.g. "14:30:00Z") — strip Z and treat as local (UTC) time.
|
|
90
90
|
// Only apply when there is no 'T' in the string; a datetime string like
|
|
91
91
|
// "2024-06-15T14:30:00Z" must not be accepted here.
|
|
92
|
-
const normalized =
|
|
92
|
+
const normalized = input.endsWith('Z') && !input.includes('T') ? input.slice(0, -1) : input;
|
|
93
93
|
// Local time (no offset) — treated as UTC
|
|
94
94
|
try {
|
|
95
95
|
return plainTimeToMs(temporal_polyfill_1.Temporal.PlainTime.from(normalized));
|
|
@@ -117,17 +117,17 @@ function parseTimeString(s) {
|
|
|
117
117
|
* parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be
|
|
118
118
|
* parsed with {@link parseLocalDateString}, in the browser's local timezone.)
|
|
119
119
|
*/
|
|
120
|
-
function parseDateString(
|
|
120
|
+
function parseDateString(input) {
|
|
121
121
|
// RFC 9557 / ZonedDateTime with IANA bracket notation
|
|
122
122
|
try {
|
|
123
|
-
return temporal_polyfill_1.Temporal.ZonedDateTime.from(
|
|
123
|
+
return temporal_polyfill_1.Temporal.ZonedDateTime.from(input).epochMilliseconds;
|
|
124
124
|
}
|
|
125
125
|
catch (_a) {
|
|
126
126
|
/* empty */
|
|
127
127
|
}
|
|
128
128
|
// UTC or fixed-offset datetime (no IANA name)
|
|
129
129
|
try {
|
|
130
|
-
return temporal_polyfill_1.Temporal.Instant.from(
|
|
130
|
+
return temporal_polyfill_1.Temporal.Instant.from(input).epochMilliseconds;
|
|
131
131
|
}
|
|
132
132
|
catch (_b) {
|
|
133
133
|
/* empty */
|
|
@@ -136,7 +136,7 @@ function parseDateString(s) {
|
|
|
136
136
|
// Also covers date-only strings like "2024-01-01" (PlainDateTime.from parses
|
|
137
137
|
// them as midnight), so a separate PlainDate path is not needed.
|
|
138
138
|
try {
|
|
139
|
-
return temporal_polyfill_1.Temporal.PlainDateTime.from(
|
|
139
|
+
return temporal_polyfill_1.Temporal.PlainDateTime.from(input).toZonedDateTime('UTC')
|
|
140
140
|
.epochMilliseconds;
|
|
141
141
|
}
|
|
142
142
|
catch (_c) {
|
|
@@ -163,7 +163,7 @@ function parseDateString(s) {
|
|
|
163
163
|
* The optional `timeZone` parameter overrides the browser's local timezone,
|
|
164
164
|
* which is useful for deterministic testing.
|
|
165
165
|
*/
|
|
166
|
-
function parseLocalDateString(
|
|
166
|
+
function parseLocalDateString(input, timeZone) {
|
|
167
167
|
// Reject strings that carry explicit timezone information. This mirrors the
|
|
168
168
|
// cascade in parseDateString but uses successful parsing as a rejection
|
|
169
169
|
// signal rather than an acceptance signal:
|
|
@@ -176,14 +176,14 @@ function parseLocalDateString(s, timeZone) {
|
|
|
176
176
|
// instead of throwing, so these two pre-checks are necessary to enforce
|
|
177
177
|
// the plain-only constraint.
|
|
178
178
|
try {
|
|
179
|
-
temporal_polyfill_1.Temporal.ZonedDateTime.from(
|
|
179
|
+
temporal_polyfill_1.Temporal.ZonedDateTime.from(input);
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
182
|
catch (_a) {
|
|
183
183
|
/* not a zoned datetime — continue */
|
|
184
184
|
}
|
|
185
185
|
try {
|
|
186
|
-
temporal_polyfill_1.Temporal.Instant.from(
|
|
186
|
+
temporal_polyfill_1.Temporal.Instant.from(input);
|
|
187
187
|
return null;
|
|
188
188
|
}
|
|
189
189
|
catch (_b) {
|
|
@@ -191,7 +191,8 @@ function parseLocalDateString(s, timeZone) {
|
|
|
191
191
|
}
|
|
192
192
|
const tz = timeZone !== null && timeZone !== void 0 ? timeZone : temporal_polyfill_1.Temporal.Now.timeZoneId();
|
|
193
193
|
try {
|
|
194
|
-
return temporal_polyfill_1.Temporal.PlainDateTime.from(
|
|
194
|
+
return temporal_polyfill_1.Temporal.PlainDateTime.from(input).toZonedDateTime(tz)
|
|
195
|
+
.epochMilliseconds;
|
|
195
196
|
}
|
|
196
197
|
catch (_c) {
|
|
197
198
|
/* empty */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"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AAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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\nimport { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be\n * parsed with {@link parseLocalDateString}, in the browser's local timezone.)\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA6DH,0CA0CC;AAoBD,0CA0BC;AAqBD,oDAsCC;AA9MD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yDAA6C;AAE7C,MAAM,UAAU,GAAG,QAAU,CAAC;AAE9B,SAAS,aAAa,CAAC,EAAsB;IAC3C,OAAO,CACL,EAAE,CAAC,IAAI,GAAG,OAAS;QACnB,EAAE,CAAC,MAAM,GAAG,KAAM;QAClB,EAAE,CAAC,MAAM,GAAG,IAAK;QACjB,EAAE,CAAC,WAAW,CACf,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,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O,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,oBAAoB,CAClC,KAAa,EACb,QAAiB;IAEjB,4EAA4E;IAC5E,wEAAwE;IACxE,2CAA2C;IAC3C,EAAE;IACF,uEAAuE;IACvE,2EAA2E;IAC3E,+DAA+D;IAC/D,EAAE;IACF,uEAAuE;IACvE,wEAAwE;IACxE,6BAA6B;IAC7B,IAAI,CAAC;QACH,4BAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,qCAAqC;IACvC,CAAC;IAED,IAAI,CAAC;QACH,4BAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,4BAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACjD,IAAI,CAAC;QACH,OAAO,4BAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC;aAC1D,iBAAiB,CAAC;IACvB,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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\nimport { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(input: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (input.includes('T') || input.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = input.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = input.slice(0, input.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized =\n input.endsWith('Z') && !input.includes('T') ? input.slice(0, -1) : input;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be\n * parsed with {@link parseLocalDateString}, in the browser's local timezone.)\n */\nexport function parseDateString(input: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(input).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(input).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(input).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n input: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(input);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(input);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(input).toZonedDateTime(tz)\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
|
|
@@ -57,7 +57,7 @@ exports.NumericLiteralSchema = zod_1.z.union([
|
|
|
57
57
|
* - Date-only (treated as UTC midnight): `"2024-01-01"`
|
|
58
58
|
*/
|
|
59
59
|
exports.DatetimeLiteralSchema = zod_1.z.object({
|
|
60
|
-
datetime: zod_1.z.string().refine((
|
|
60
|
+
datetime: zod_1.z.string().refine((input) => (0, date_utils_1.parseDateString)(input) !== null, {
|
|
61
61
|
message: 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',
|
|
62
62
|
}),
|
|
63
63
|
});
|
|
@@ -75,7 +75,9 @@ exports.DatetimeLiteralSchema = zod_1.z.object({
|
|
|
75
75
|
* timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.
|
|
76
76
|
*/
|
|
77
77
|
exports.LocalDatetimeLiteralSchema = zod_1.z.object({
|
|
78
|
-
localdatetime: zod_1.z
|
|
78
|
+
localdatetime: zod_1.z
|
|
79
|
+
.string()
|
|
80
|
+
.refine((input) => (0, date_utils_1.parseLocalDateString)(input) !== null, {
|
|
79
81
|
message: 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',
|
|
80
82
|
}),
|
|
81
83
|
});
|
|
@@ -93,7 +95,7 @@ exports.LocalDatetimeLiteralSchema = zod_1.z.object({
|
|
|
93
95
|
* Full datetime strings (containing `T`) are rejected.
|
|
94
96
|
*/
|
|
95
97
|
exports.TimeLiteralSchema = zod_1.z.object({
|
|
96
|
-
time: zod_1.z.string().refine((
|
|
98
|
+
time: zod_1.z.string().refine((input) => (0, date_utils_1.parseTimeString)(input) !== null, {
|
|
97
99
|
message: 'time must be a valid ISO 8601 time string (e.g. "14:30:00" or "14:30:00+02:00")',
|
|
98
100
|
}),
|
|
99
101
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA6HH,8CAEC;AAGD,wDAIC;AAGD,sCAEC;AAzID;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6BAAwB;AAExB,6CAIsB;AAEtB;;;GAGG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE;QACrC,OAAO,EAAE,gDAAgD;KAC1D,CAAC;CACH,CAAC,CAAC;AAGH,4EAA4E;AAC/D,QAAA,oBAAoB,GAAG,OAAC,CAAC,KAAK,CAAC;IAC1C,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CAAC,MAAM,EAAE;IACV,2BAAmB;CACpB,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QACtE,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,aAAa,EAAE,OAAC;SACb,MAAM,EAAE;SACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QACvD,OAAO,EACL,kGAAkG;KACrG,CAAC;CACL,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QAClE,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,CAAC,CAAC;AAGH,SAAS,qBAAqB,CAC5B,KAAc,EACd,GAAM;IAEN,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,GAAG,IAAI,KAAK;QACZ,OAAQ,KAAiC,CAAC,GAAG,CAAC,KAAK,QAAQ,CAC5D,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,SAAgB,sBAAsB,CACpC,KAAc;IAEd,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,6FAA6F;AAC7F,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC;IACxC,4BAAoB;IACpB,6BAAqB;IACrB,kCAA0B;IAC1B,yBAAiB;CAClB,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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\nimport { z } from 'zod';\n\nimport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((input) => parseDateString(input) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z\n .string()\n .refine((input) => parseLocalDateString(input) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((input) => parseTimeString(input) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n\nfunction isObjectWithStringKey<K extends string>(\n value: unknown,\n key: K,\n): value is Record<K, string> {\n return (\n typeof value === 'object' &&\n value !== null &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === 'string'\n );\n}\n\n/** Returns whether a value is a `{ datetime: string }` wrapper. Does not validate the string. */\nexport function isDatetimeLiteral(value: unknown): value is DatetimeLiteral {\n return isObjectWithStringKey(value, 'datetime');\n}\n\n/** Returns whether a value is a `{ localdatetime: string }` wrapper. Does not validate the string. */\nexport function isLocalDatetimeLiteral(\n value: unknown,\n): value is LocalDatetimeLiteral {\n return isObjectWithStringKey(value, 'localdatetime');\n}\n\n/** Returns whether a value is a `{ time: string }` wrapper. Does not validate the string. */\nexport function isTimeLiteral(value: unknown): value is TimeLiteral {\n return isObjectWithStringKey(value, 'time');\n}\n\n/**\n * A continuous, orderable literal that can be used as a range boundary.\n * Temporal literals resolve to numbers before range interpolation.\n */\nexport const RangeLiteralSchema = z.union([\n NumericLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type RangeLiteral = z.infer<typeof RangeLiteralSchema>;\n"]}
|
|
@@ -47,7 +47,7 @@ const ndl_code_light_1 = __importDefault(require("../../code-block/themes/ndl-co
|
|
|
47
47
|
* The component is used to display code that is generated by an LLM.
|
|
48
48
|
*
|
|
49
49
|
* @alpha - Changes to this component may be breaking.
|
|
50
|
-
* @deprecated - Use
|
|
50
|
+
* @deprecated - Use `<Preview />` with `<Preview.Code />` instead.
|
|
51
51
|
*/
|
|
52
52
|
const CodePreview = (_a) => {
|
|
53
53
|
var { code, language, label, isLoading = false, headerActions, theme, ref, style, className, htmlAttributes } = _a, restProps = __rest(_a, ["code", "language", "label", "isLoading", "headerActions", "theme", "ref", "style", "className", "htmlAttributes"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodePreview.js","sourceRoot":"","sources":["../../../../src/ai/code-preview/CodePreview.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAO0B;AAC1B,4DAAoC;AACpC,iCAA4C;AAC5C,uEAA2E;AAG3E,oEAIyC;AACzC,0FAAgE;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AyB,EAAE;gCACzB,MAAM,EAAE,CAAC;gCACT,KAAK,EAAE,yCAAyC;gCAChD,UAAU,EAAE,GAAG;gCACf,SAAS,EAAE,MAAM;gCACjB,OAAO,EAAE,iBAAiB;gCAC1B,KAAK,EAAE,aAAa;6BACrB;wBAEH,2FAA2F;wBAC3F,kFAAkF;wBAClF,gBAAgB;wBAChB,YAAY,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAChD,eAAe,EAAE,KAAK,YAErB,IAAI,GACa,GAChB,GACF,CACP,KACG,CACP,CAAC;AACJ,CAAC,CAAC;AAzHW,QAAA,WAAW,eAyHtB","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 ClipboardButton,\n type CodeBlock,\n LoadingSpinner,\n StatusLabel,\n Typography,\n useNeedleTheme,\n} from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useEffect, useState } from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type CommonProps } from '../../_common/types';\nimport {\n type LanguageProp,\n Languages,\n loadLanguage,\n} from '../../code-block/code-languages';\nimport ndlCodeDark from '../../code-block/themes/ndl-code-dark';\nimport ndlCodeLight from '../../code-block/themes/ndl-code-light';\n\ntype CodePreviewProps = {\n /** The code content to display */\n code: string;\n /** The language of the code (e.g., 'cypher', 'python', 'javascript') */\n language: React.ComponentProps<typeof CodeBlock>['language'];\n /** The current state of the code block */\n label?: 'read' | 'write';\n /** Whether the code block is loading */\n isLoading?: boolean;\n /** The actions to display in the header. Should be small CleanIconButton components. */\n headerActions?: React.ReactNode;\n /** The theme of the code block */\n theme?: 'ndl-code-dark' | 'ndl-code-light';\n};\n\n/**\n * The component is used to display code that is generated by an LLM.\n *\n * @alpha - Changes to this component may be breaking.\n * @deprecated - Use
|
|
1
|
+
{"version":3,"file":"CodePreview.js","sourceRoot":"","sources":["../../../../src/ai/code-preview/CodePreview.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAO0B;AAC1B,4DAAoC;AACpC,iCAA4C;AAC5C,uEAA2E;AAG3E,oEAIyC;AACzC,0FAAgE;AAChE,4FAAkE;AAiBlE;;;;;GAKG;AACI,MAAM,WAAW,GAAG,CAAC,EAYW,EAAE,EAAE;QAZf,EAC1B,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,aAAa,EACb,KAAK,EACL,GAAG,EACH,KAAK,EACL,SAAS,EACT,cAAc,OAEuB,EADlC,SAAS,cAXc,mHAY3B,CADa;IAEZ,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAElD,IAAI,CAAC,CAAC;IACR,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAA,sBAAc,GAAE,CAAC;IAE7C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ,IAAI,CAAE,0BAA+B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtE,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,IAAA,6BAAY,EAAC,QAAwB,CAAC;aACnC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,qCAAiB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7D,iBAAi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Z,IAAI,EAAC,aAAa,YAEjB,KAAK,GACM,CACf,IACA,CACJ,GACG,EAEL,CAAC,SAAS,IAAI,CACb,iCAAK,SAAS,EAAC,6BAA6B,aAC1C,uBAAC,uBAAe,IACd,UAAU,EAAE,IAAI,EAChB,IAAI,EAAC,mBAAmB,EACxB,IAAI,EAAC,OAAO,GACZ,EACD,aAAa,IACV,CACP,IACG,EAEL,CAAC,SAAS,IAAI,CACb,gCAAK,SAAS,EAAC,6BAA6B,YAC1C,gCAAK,SAAS,EAAC,4BAA4B,YACzC,uBAAC,qCAAiB,IAChB,QAAQ,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,MAAM,EAClC,KAAK,kCACA,QAAQ,EAAE,KACb,yBAAyB,EAAE;gCACzB,MAAM,EAAE,CAAC;gCACT,KAAK,EAAE,yCAAyC;gCAChD,UAAU,EAAE,GAAG;gCACf,SAAS,EAAE,MAAM;gCACjB,OAAO,EAAE,iBAAiB;gCAC1B,KAAK,EAAE,aAAa;6BACrB;wBAEH,2FAA2F;wBAC3F,kFAAkF;wBAClF,gBAAgB;wBAChB,YAAY,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAChD,eAAe,EAAE,KAAK,YAErB,IAAI,GACa,GAChB,GACF,CACP,KACG,CACP,CAAC;AACJ,CAAC,CAAC;AAzHW,QAAA,WAAW,eAyHtB","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 ClipboardButton,\n type CodeBlock,\n LoadingSpinner,\n StatusLabel,\n Typography,\n useNeedleTheme,\n} from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useEffect, useState } from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type CommonProps } from '../../_common/types';\nimport {\n type LanguageProp,\n Languages,\n loadLanguage,\n} from '../../code-block/code-languages';\nimport ndlCodeDark from '../../code-block/themes/ndl-code-dark';\nimport ndlCodeLight from '../../code-block/themes/ndl-code-light';\n\ntype CodePreviewProps = {\n /** The code content to display */\n code: string;\n /** The language of the code (e.g., 'cypher', 'python', 'javascript') */\n language: React.ComponentProps<typeof CodeBlock>['language'];\n /** The current state of the code block */\n label?: 'read' | 'write';\n /** Whether the code block is loading */\n isLoading?: boolean;\n /** The actions to display in the header. Should be small CleanIconButton components. */\n headerActions?: React.ReactNode;\n /** The theme of the code block */\n theme?: 'ndl-code-dark' | 'ndl-code-light';\n};\n\n/**\n * The component is used to display code that is generated by an LLM.\n *\n * @alpha - Changes to this component may be breaking.\n * @deprecated - Use `<Preview />` with `<Preview.Code />` instead.\n */\nexport const CodePreview = ({\n code,\n language,\n label,\n isLoading = false,\n headerActions,\n theme,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', CodePreviewProps>) => {\n const [loadedLanguage, setLoadedLanguage] = useState<\n CodePreviewProps['language'] | null\n >(null);\n const { theme: ndlTheme } = useNeedleTheme();\n\n useEffect(() => {\n if (!language || !(Languages as readonly string[]).includes(language)) {\n setLoadedLanguage('text');\n return;\n }\n\n loadLanguage(language as LanguageProp)\n .then((module) => {\n SyntaxHighlighter.registerLanguage(language, module.default);\n setLoadedLanguage(language);\n })\n .catch((err) => console.error(err));\n }, [language]);\n\n const getTheme = () => {\n switch (theme) {\n case 'ndl-code-dark':\n return ndlCodeDark;\n case 'ndl-code-light':\n return ndlCodeLight;\n default:\n return ndlTheme === 'light' ? ndlCodeLight : ndlCodeDark;\n }\n };\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-code-preview', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {/* Header */}\n <div className=\"ndl-ai-code-preview-header\">\n <div className=\"ndl-ai-code-preview-title\">\n {isLoading ? (\n <>\n <LoadingSpinner size=\"medium\" />\n <Typography variant=\"code\">\n WRITING {language.toUpperCase()}\n </Typography>\n </>\n ) : (\n <>\n <Typography variant=\"code\">\n {language.toUpperCase()}{' '}\n {language.toLowerCase() === 'cypher' ? 'QUERY' : ''}\n </Typography>\n {label && (\n <StatusLabel\n variant={label === 'write' ? 'warning' : 'info'}\n size=\"small\"\n fill=\"semi-filled\"\n >\n {label}\n </StatusLabel>\n )}\n </>\n )}\n </div>\n\n {!isLoading && (\n <div className=\"ndl-ai-code-preview-actions\">\n <ClipboardButton\n textToCopy={code}\n type=\"clean-icon-button\"\n size=\"small\"\n />\n {headerActions}\n </div>\n )}\n </div>\n\n {!isLoading && (\n <div className=\"ndl-ai-code-preview-content\">\n <div className=\"ndl-code-content-container\">\n <SyntaxHighlighter\n language={loadedLanguage ?? 'text'}\n style={{\n ...getTheme(),\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n overflowX: 'auto',\n padding: 'var(--space-12)',\n width: 'fit-content',\n },\n }}\n // Turn on 'shouldShowLineNumbers' & 'wrapLongLines' at the same time, the display is wrong\n // https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/402\n // wrapLongLines\n codeTagProps={{ className: 'n-ai-code-preview' }}\n showLineNumbers={false}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </div>\n )}\n </div>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileTag.js","sourceRoot":"","sources":["../../../../src/ai/file-tag/FileTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA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,YAAE,QAAQ,GAAQ,EACjE,iCAAM,SAAS,EAAC,8BAA8B,YAC3C,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,EAAE,GACnB,IACH,EACL,WAAW,IAAI,CACd,uBAAC,uBAAe,IACd,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,IAAI,EACjB,cAAc,EAAE;gCACd,YAAY,EAAE,UAAU,IAAI,EAAE;gCAC9B,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;gCACtC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;gCACtC,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;gCAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;6BAC7C,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,wBAAwB,YAElC,uBAAC,mCAAgB,KAAG,GACJ,CACnB,KACS,GACI,EAClB,uBAAC,eAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,GACzB,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEO,0BAAO","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\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype FileTagProps = {\n /** The icon that represents the file type */\n icon: React.ReactNode;\n /** The name of the file */\n fileName: string;\n /** The type of the file, e.g. 'pdf', 'docx', 'txt', etc. */\n fileType: string;\n /** Callback function triggered either when the file tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (
|
|
1
|
+
{"version":3,"file":"FileTag.js","sourceRoot":"","sources":["../../../../src/ai/file-tag/FileTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA4E;AAC5E,4DAAoC;AACpC,iCAAiC;AAGjC,uFAAoF;AAiBpF;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,EAY8B,EAAE,EAAE;QAZlC,EACf,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,EACH,SAAS,GAAG,KAAK,OAE4B,EAD1C,SAAS,cAXG,sHAYhB,CADa;IAEZ,MAAM,SAAS,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAEzD,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;IACvC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE5D,OAAO,CACL,wBAAC,eAAO,IACN,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,QAAQ,EAClB,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,aAEnC,uBAAC,eAAO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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\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype FileTagProps = {\n /** The icon that represents the file type */\n icon: React.ReactNode;\n /** The name of the file */\n fileName: string;\n /** The type of the file, e.g. 'pdf', 'docx', 'txt', etc. */\n fileType: string;\n /** Callback function triggered either when the file tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Whether the file tag is removable */\n isRemovable?: boolean;\n /** Whether the file tag is loading */\n isLoading?: boolean;\n};\n\n/**\n * The component is used to display a file in a chat, or in a prompt.\n * It can be removable and it can be loading.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst FileTag = ({\n onClick,\n isRemovable = false,\n fileName,\n fileType,\n icon,\n className,\n style,\n htmlAttributes,\n ref,\n isLoading = false,\n ...restProps\n}: CommonProps<React.ElementType, FileTagProps>) => {\n const Component = isRemovable !== true ? 'button' : 'div';\n const classes = classNames('ndl-ai-file-tag', className);\n\n const file = `${fileName}.${fileType}`;\n const [isRemoveActive, setIsRemoveActive] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n placement=\"bottom\"\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...(isRemovable ? {} : { onClick })}\n // what is read by screen readers here?\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-file-tag-leading\">\n {isLoading ? <LoadingSpinner size=\"medium\" /> : icon}\n </div>\n <div className=\"ndl-ai-file-tag-content\">\n <span className=\"ndl-ai-file-tag-content-title\">{fileName}</span>\n <span className=\"ndl-ai-file-tag-content-type\">\n {fileType?.toUpperCase()}\n </span>\n </div>\n {isRemovable && (\n <CleanIconButton\n onClick={onClick}\n description={null}\n htmlAttributes={{\n 'aria-label': `Remove ${file}`,\n onBlur: () => setIsRemoveActive(false),\n onFocus: () => setIsRemoveActive(true),\n onMouseEnter: () => setIsRemoveActive(true),\n onMouseLeave: () => setIsRemoveActive(false),\n }}\n size=\"small\"\n className=\"ndl-ai-file-tag-remove\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {isRemoveActive ? `Remove ${file}` : file}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport { FileTag };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageTag.js","sourceRoot":"","sources":["../../../../src/ai/image-tag/ImageTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA4E;AAC5E,4DAAoC;AACpC,iCAAiC;AAGjC,uFAAoF;AAmBpF;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,CAAC,EAa8B,EAAE,EAAE;QAblC,EAChB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,GAAG,EACH,SAAS,EACT,KAAK,EACL,cAAc,OAEgC,EAD3C,SAAS,cAZI,4HAajB,CADa;IAEZ,MAAM,SAAS,GAAG,WAAW,KA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,SAAS,EAAC,yBAAyB,YAEnC,uBAAC,mCAAgB,KAAG,GACJ,IACjB,CACJ,EACA,SAAS,IAAI,CACZ,gCAAK,SAAS,EAAC,kCAAkC,YAC/C,uBAAC,sBAAc,IAAC,IAAI,EAAC,QAAQ,GAAG,GAC5B,CACP,KACS,GACI,EAClB,uBAAC,eAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,GAC3B,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEO,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 */\n\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype ImageTagProps = {\n /** The source of the image */\n src: string;\n /** The alt text of the image */\n alt: string;\n /** The name of the image */\n fileName: string;\n /** The type of the image, e.g. 'jpg', 'png', 'gif', etc. */\n fileType: string;\n /** Callback function triggered either when the image tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (
|
|
1
|
+
{"version":3,"file":"ImageTag.js","sourceRoot":"","sources":["../../../../src/ai/image-tag/ImageTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmB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EAAE,IAAI,EACjB,cAAc,EAAE;wCACd,YAAY,EAAE,UAAU,KAAK,EAAE;wCAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;wCACtC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;wCACtC,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;wCAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;qCAC7C,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,yBAAyB,YAEnC,uBAAC,mCAAgB,KAAG,GACJ,IACjB,CACJ,EACA,SAAS,IAAI,CACZ,gCAAK,SAAS,EAAC,kCAAkC,YAC/C,uBAAC,sBAAc,IAAC,IAAI,EAAC,QAAQ,GAAG,GAC5B,CACP,KACS,GACI,EAClB,uBAAC,eAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,GAC3B,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEO,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 */\n\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype ImageTagProps = {\n /** The source of the image */\n src: string;\n /** The alt text of the image */\n alt: string;\n /** The name of the image */\n fileName: string;\n /** The type of the image, e.g. 'jpg', 'png', 'gif', etc. */\n fileType: string;\n /** Callback function triggered either when the image tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Whether the image tag is removable */\n isRemovable?: boolean;\n /** Whether the image tag is loading */\n isLoading?: boolean;\n};\n\n/**\n * The component is used to display an image in a chat, or in a prompt.\n * It can be removable and it can be loading.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ImageTag = ({\n src,\n fileName,\n fileType,\n alt,\n onClick,\n isRemovable = false,\n isLoading = false,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<React.ElementType, ImageTagProps>) => {\n const Component = isRemovable !== true ? 'button' : 'div';\n const classes = classNames('ndl-ai-image-tag', className);\n\n const image = `${fileName}.${fileType}`;\n const [isRemoveActive, setIsRemoveActive] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n placement=\"bottom\"\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...(isRemovable ? {} : { onClick })}\n // what is read by screen readers here?\n {...restProps}\n {...htmlAttributes}\n >\n <img src={src} alt={alt} />\n {isRemovable && (\n <>\n <div className=\"ndl-ai-image-tag-remove-wrapper\" />\n <CleanIconButton\n onClick={onClick}\n description={null}\n htmlAttributes={{\n 'aria-label': `Remove ${image}`,\n onBlur: () => setIsRemoveActive(false),\n onFocus: () => setIsRemoveActive(true),\n onMouseEnter: () => setIsRemoveActive(true),\n onMouseLeave: () => setIsRemoveActive(false),\n }}\n size=\"small\"\n className=\"ndl-ai-image-tag-remove\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </>\n )}\n {isLoading && (\n <div className=\"ndl-ai-image-tag-loading-overlay\">\n <LoadingSpinner size=\"medium\" />\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {isRemoveActive ? `Remove ${image}` : image}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport { ImageTag };\n"]}
|
|
@@ -149,25 +149,25 @@ const PromptComponent = (_a) => {
|
|
|
149
149
|
(0, react_2.useEffect)(() => {
|
|
150
150
|
adjustTextareaHeight();
|
|
151
151
|
}, [value, adjustTextareaHeight]);
|
|
152
|
-
const handleInput = (
|
|
152
|
+
const handleInput = (event) => {
|
|
153
153
|
adjustTextareaHeight();
|
|
154
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
154
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
155
155
|
};
|
|
156
|
-
const handleSubmitClick = (
|
|
156
|
+
const handleSubmitClick = (event) => {
|
|
157
157
|
var _a;
|
|
158
158
|
if (hasPromptContent((_a = textareaRef.current) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
159
|
-
onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(
|
|
159
|
+
onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(event);
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper", children: [Boolean(headerContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-header", children: headerContent })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper-inner", onMouseDownCapture: focusTextareaFromPromptWrapper_1.focusTextareaFromPromptWrapper, children: [Boolean(topContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), (0, jsx_runtime_1.jsx)("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, disabled: isDisabled, "aria-label": (_b = textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps['aria-label']) !== null && _b !== void 0 ? _b : 'Prompt input', onKeyDown: (
|
|
163
|
-
const nativeEvent =
|
|
162
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper", children: [Boolean(headerContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-header", children: headerContent })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper-inner", onMouseDownCapture: focusTextareaFromPromptWrapper_1.focusTextareaFromPromptWrapper, children: [Boolean(topContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), (0, jsx_runtime_1.jsx)("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, disabled: isDisabled, "aria-label": (_b = textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps['aria-label']) !== null && _b !== void 0 ? _b : 'Prompt input', onKeyDown: (event) => {
|
|
163
|
+
const nativeEvent = event.nativeEvent;
|
|
164
164
|
const isComposing = nativeEvent.isComposing === true;
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
if (hasPromptContent(
|
|
165
|
+
if (event.key === 'Enter' && !isComposing && !event.shiftKey) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
if (hasPromptContent(event.currentTarget.value) &&
|
|
168
168
|
isSubmitDisabled !== true &&
|
|
169
169
|
isRunningPrompt !== true) {
|
|
170
|
-
onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(
|
|
170
|
+
onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(event);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
} }, textareaProps)), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-textarea-below", children: [Boolean(bottomContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-textarea-below-trailing", children: [bottomTrailingContent, (0, jsx_runtime_1.jsx)(SubmitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: handleSubmitClick, onCancel: onCancelPrompt })] })] })] })] }), Boolean(disclaimer) && ((0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
|