@gravity-ui/markdown-editor 15.25.0 → 15.27.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/build/cjs/bundle/MarkdownEditorView.js +1 -1
- package/build/cjs/bundle/MarkdownEditorView.js.map +1 -1
- package/build/cjs/bundle/types.d.ts +5 -0
- package/build/cjs/bundle/types.js.map +1 -1
- package/build/cjs/bundle/useMarkdownEditor.js +1 -0
- package/build/cjs/bundle/useMarkdownEditor.js.map +1 -1
- package/build/cjs/bundle/wysiwyg-preset.d.ts +1 -0
- package/build/cjs/bundle/wysiwyg-preset.js +1 -0
- package/build/cjs/bundle/wysiwyg-preset.js.map +1 -1
- package/build/cjs/extensions/additional/Math/const.d.ts +1 -0
- package/build/cjs/extensions/additional/Math/const.js +11 -1
- package/build/cjs/extensions/additional/Math/const.js.map +1 -1
- package/build/cjs/extensions/additional/Math/index.d.ts +1 -0
- package/build/cjs/extensions/additional/Math/index.js +6 -1
- package/build/cjs/extensions/additional/Math/index.js.map +1 -1
- package/build/cjs/extensions/additional/Math/latex-paste-plugin.d.ts +2 -0
- package/build/cjs/extensions/additional/Math/latex-paste-plugin.js +54 -0
- package/build/cjs/extensions/additional/Math/latex-paste-plugin.js.map +1 -0
- package/build/cjs/extensions/additional/Math/utils.d.ts +7 -0
- package/build/cjs/extensions/additional/Math/utils.js +45 -0
- package/build/cjs/extensions/additional/Math/utils.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/Search.d.ts +4 -0
- package/build/cjs/extensions/behavior/Search/Search.js +10 -0
- package/build/cjs/extensions/behavior/Search/Search.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/SearchViewPlugin.d.ts +7 -0
- package/build/cjs/extensions/behavior/Search/SearchViewPlugin.js +157 -0
- package/build/cjs/extensions/behavior/Search/SearchViewPlugin.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/commands.d.ts +7 -0
- package/build/cjs/extensions/behavior/Search/commands.js +42 -0
- package/build/cjs/extensions/behavior/Search/commands.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/const.d.ts +7 -0
- package/build/cjs/extensions/behavior/Search/const.js +10 -0
- package/build/cjs/extensions/behavior/Search/const.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/index.d.ts +1 -0
- package/build/cjs/extensions/behavior/Search/index.js +5 -0
- package/build/cjs/extensions/behavior/Search/index.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/key-handler.d.ts +1 -0
- package/build/cjs/extensions/behavior/Search/key-handler.js +14 -0
- package/build/cjs/extensions/behavior/Search/key-handler.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/search-plugin.css +7 -0
- package/build/cjs/extensions/behavior/Search/types.d.ts +3 -0
- package/build/cjs/extensions/behavior/Search/types.js +3 -0
- package/build/cjs/extensions/behavior/Search/types.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/utils/connect-tracker.d.ts +7 -0
- package/build/cjs/extensions/behavior/Search/utils/connect-tracker.js +24 -0
- package/build/cjs/extensions/behavior/Search/utils/connect-tracker.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/utils/focus-manager.d.ts +6 -0
- package/build/cjs/extensions/behavior/Search/utils/focus-manager.js +18 -0
- package/build/cjs/extensions/behavior/Search/utils/focus-manager.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/utils/search-counter.d.ts +3 -0
- package/build/cjs/extensions/behavior/Search/utils/search-counter.js +18 -0
- package/build/cjs/extensions/behavior/Search/utils/search-counter.js.map +1 -0
- package/build/cjs/extensions/behavior/Search/utils/wrap-command.d.ts +4 -0
- package/build/cjs/extensions/behavior/Search/utils/wrap-command.js +16 -0
- package/build/cjs/extensions/behavior/Search/utils/wrap-command.js.map +1 -0
- package/build/cjs/extensions/behavior/SelectionContext/index.d.ts +2 -0
- package/build/cjs/extensions/behavior/SelectionContext/index.js +20 -2
- package/build/cjs/extensions/behavior/SelectionContext/index.js.map +1 -1
- package/build/cjs/extensions/behavior/index.d.ts +2 -0
- package/build/cjs/extensions/behavior/index.js +3 -0
- package/build/cjs/extensions/behavior/index.js.map +1 -1
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.css +8 -0
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.d.ts +3 -0
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js +68 -7
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js.map +1 -1
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +4 -0
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.d.ts +1 -1
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js +53 -28
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js.map +1 -1
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockSpecs/index.d.ts +6 -0
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js +28 -2
- package/build/cjs/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js.map +1 -1
- package/build/cjs/extensions/markdown/CodeBlock/index.d.ts +2 -1
- package/build/cjs/extensions/markdown/CodeBlock/index.js +21 -6
- package/build/cjs/extensions/markdown/CodeBlock/index.js.map +1 -1
- package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/schema.js +29 -17
- package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/schema.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +2 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.d.ts +5 -2
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +59 -2
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.d.ts +4 -2
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js +3 -4
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.d.ts +3 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js +36 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.d.ts +13 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js +7 -10
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.d.ts +3 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js +39 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js +9 -4
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.d.ts +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js +25 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +4 -2
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -1
- package/build/cjs/i18n/codeblock/en.json +2 -1
- package/build/cjs/i18n/codeblock/index.d.ts +2 -1
- package/build/cjs/i18n/codeblock/ru.json +2 -1
- package/build/cjs/i18n/search/en.json +9 -2
- package/build/cjs/i18n/search/index.d.ts +9 -2
- package/build/cjs/i18n/search/ru.json +10 -3
- package/build/cjs/markup/codemirror/create.js +1 -1
- package/build/cjs/markup/codemirror/create.js.map +1 -1
- package/build/cjs/markup/codemirror/search-plugin/plugin.d.ts +7 -9
- package/build/cjs/markup/codemirror/search-plugin/plugin.js +44 -55
- package/build/cjs/markup/codemirror/search-plugin/plugin.js.map +1 -1
- package/build/cjs/markup/codemirror/search-plugin/theme.d.ts +1 -0
- package/build/cjs/markup/codemirror/search-plugin/theme.js +15 -0
- package/build/cjs/markup/codemirror/search-plugin/theme.js.map +1 -0
- package/build/cjs/modules/search/components/SearchCardView.css +7 -0
- package/build/cjs/modules/search/components/SearchCardView.d.ts +17 -0
- package/build/cjs/modules/search/components/SearchCardView.js +22 -0
- package/build/cjs/modules/search/components/SearchCardView.js.map +1 -0
- package/build/cjs/modules/search/components/SearchCompactView.css +5 -0
- package/build/cjs/modules/search/components/SearchCompactView.d.ts +13 -0
- package/build/cjs/modules/search/components/SearchCompactView.js +26 -0
- package/build/cjs/modules/search/components/SearchCompactView.js.map +1 -0
- package/build/cjs/modules/search/components/SearchCounter.d.ts +6 -0
- package/build/cjs/modules/search/components/SearchCounter.js +15 -0
- package/build/cjs/modules/search/components/SearchCounter.js.map +1 -0
- package/build/cjs/modules/search/components/SearchPopup.css +9 -0
- package/build/cjs/modules/search/components/SearchPopup.d.ts +15 -0
- package/build/cjs/modules/search/components/SearchPopup.js +29 -0
- package/build/cjs/modules/search/components/SearchPopup.js.map +1 -0
- package/build/cjs/modules/search/components/SearchTextInput.d.ts +10 -0
- package/build/cjs/modules/search/components/SearchTextInput.js +24 -0
- package/build/cjs/modules/search/components/SearchTextInput.js.map +1 -0
- package/build/cjs/modules/search/hooks/use-search.d.ts +24 -0
- package/build/cjs/modules/search/hooks/use-search.js +47 -0
- package/build/cjs/modules/search/hooks/use-search.js.map +1 -0
- package/build/cjs/modules/search/index.d.ts +3 -0
- package/build/cjs/modules/search/index.js +9 -0
- package/build/cjs/modules/search/index.js.map +1 -0
- package/build/cjs/modules/search/qa.d.ts +14 -0
- package/build/cjs/modules/search/qa.js +18 -0
- package/build/cjs/modules/search/qa.js.map +1 -0
- package/build/cjs/modules/search/types.d.ts +10 -0
- package/build/cjs/modules/search/types.js +3 -0
- package/build/cjs/modules/search/types.js.map +1 -0
- package/build/cjs/react-utils/useAutoFocus.d.ts +1 -1
- package/build/cjs/react-utils/useAutoFocus.js +8 -10
- package/build/cjs/react-utils/useAutoFocus.js.map +1 -1
- package/build/cjs/styles/styles.css +289 -0
- package/build/cjs/styles/yfm-themes.css +288 -0
- package/build/cjs/table-utils/table-desc.d.ts +1 -0
- package/build/cjs/table-utils/table-desc.js +3 -0
- package/build/cjs/table-utils/table-desc.js.map +1 -1
- package/build/cjs/version.js +1 -1
- package/build/cjs/version.js.map +1 -1
- package/build/cjs/view/hocs/withYfmHtml/index.d.ts +1 -0
- package/build/cjs/view/hocs/withYfmHtml/index.js +3 -0
- package/build/cjs/view/hocs/withYfmHtml/index.js.map +1 -1
- package/build/cjs/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.d.ts +5 -1
- package/build/cjs/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js +8 -1
- package/build/cjs/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js.map +1 -1
- package/build/esm/bundle/MarkdownEditorView.js +1 -1
- package/build/esm/bundle/MarkdownEditorView.js.map +1 -1
- package/build/esm/bundle/types.d.ts +5 -0
- package/build/esm/bundle/types.js.map +1 -1
- package/build/esm/bundle/useMarkdownEditor.js +1 -0
- package/build/esm/bundle/useMarkdownEditor.js.map +1 -1
- package/build/esm/bundle/wysiwyg-preset.d.ts +1 -0
- package/build/esm/bundle/wysiwyg-preset.js +1 -0
- package/build/esm/bundle/wysiwyg-preset.js.map +1 -1
- package/build/esm/extensions/additional/Math/const.d.ts +1 -0
- package/build/esm/extensions/additional/Math/const.js +10 -0
- package/build/esm/extensions/additional/Math/const.js.map +1 -1
- package/build/esm/extensions/additional/Math/index.d.ts +1 -0
- package/build/esm/extensions/additional/Math/index.js +3 -0
- package/build/esm/extensions/additional/Math/index.js.map +1 -1
- package/build/esm/extensions/additional/Math/latex-paste-plugin.d.ts +2 -0
- package/build/esm/extensions/additional/Math/latex-paste-plugin.js +50 -0
- package/build/esm/extensions/additional/Math/latex-paste-plugin.js.map +1 -0
- package/build/esm/extensions/additional/Math/utils.d.ts +7 -0
- package/build/esm/extensions/additional/Math/utils.js +39 -0
- package/build/esm/extensions/additional/Math/utils.js.map +1 -0
- package/build/esm/extensions/behavior/Search/Search.d.ts +4 -0
- package/build/esm/extensions/behavior/Search/Search.js +6 -0
- package/build/esm/extensions/behavior/Search/Search.js.map +1 -0
- package/build/esm/extensions/behavior/Search/SearchViewPlugin.d.ts +7 -0
- package/build/esm/extensions/behavior/Search/SearchViewPlugin.js +153 -0
- package/build/esm/extensions/behavior/Search/SearchViewPlugin.js.map +1 -0
- package/build/esm/extensions/behavior/Search/commands.d.ts +7 -0
- package/build/esm/extensions/behavior/Search/commands.js +37 -0
- package/build/esm/extensions/behavior/Search/commands.js.map +1 -0
- package/build/esm/extensions/behavior/Search/const.d.ts +7 -0
- package/build/esm/extensions/behavior/Search/const.js +7 -0
- package/build/esm/extensions/behavior/Search/const.js.map +1 -0
- package/build/esm/extensions/behavior/Search/index.d.ts +1 -0
- package/build/esm/extensions/behavior/Search/index.js +2 -0
- package/build/esm/extensions/behavior/Search/index.js.map +1 -0
- package/build/esm/extensions/behavior/Search/key-handler.d.ts +1 -0
- package/build/esm/extensions/behavior/Search/key-handler.js +11 -0
- package/build/esm/extensions/behavior/Search/key-handler.js.map +1 -0
- package/build/esm/extensions/behavior/Search/search-plugin.css +7 -0
- package/build/esm/extensions/behavior/Search/types.d.ts +3 -0
- package/build/esm/extensions/behavior/Search/types.js +2 -0
- package/build/esm/extensions/behavior/Search/types.js.map +1 -0
- package/build/esm/extensions/behavior/Search/utils/connect-tracker.d.ts +7 -0
- package/build/esm/extensions/behavior/Search/utils/connect-tracker.js +21 -0
- package/build/esm/extensions/behavior/Search/utils/connect-tracker.js.map +1 -0
- package/build/esm/extensions/behavior/Search/utils/focus-manager.d.ts +6 -0
- package/build/esm/extensions/behavior/Search/utils/focus-manager.js +14 -0
- package/build/esm/extensions/behavior/Search/utils/focus-manager.js.map +1 -0
- package/build/esm/extensions/behavior/Search/utils/search-counter.d.ts +3 -0
- package/build/esm/extensions/behavior/Search/utils/search-counter.js +15 -0
- package/build/esm/extensions/behavior/Search/utils/search-counter.js.map +1 -0
- package/build/esm/extensions/behavior/Search/utils/wrap-command.d.ts +4 -0
- package/build/esm/extensions/behavior/Search/utils/wrap-command.js +13 -0
- package/build/esm/extensions/behavior/Search/utils/wrap-command.js.map +1 -0
- package/build/esm/extensions/behavior/SelectionContext/index.d.ts +2 -0
- package/build/esm/extensions/behavior/SelectionContext/index.js +19 -2
- package/build/esm/extensions/behavior/SelectionContext/index.js.map +1 -1
- package/build/esm/extensions/behavior/index.d.ts +2 -0
- package/build/esm/extensions/behavior/index.js +3 -0
- package/build/esm/extensions/behavior/index.js.map +1 -1
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.css +8 -0
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.d.ts +3 -0
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js +69 -8
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js.map +1 -1
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +4 -0
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.d.ts +1 -1
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js +54 -29
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js.map +1 -1
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockSpecs/index.d.ts +6 -0
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js +28 -2
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js.map +1 -1
- package/build/esm/extensions/markdown/CodeBlock/index.d.ts +2 -1
- package/build/esm/extensions/markdown/CodeBlock/index.js +21 -6
- package/build/esm/extensions/markdown/CodeBlock/index.js.map +1 -1
- package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/schema.js +29 -17
- package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/schema.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +2 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.d.ts +5 -2
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +59 -2
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.d.ts +4 -2
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js +4 -4
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.d.ts +3 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js +38 -3
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.d.ts +13 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js +8 -10
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.d.ts +3 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js +38 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js +9 -4
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +2 -2
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.d.ts +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js +22 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +4 -2
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -1
- package/build/esm/i18n/codeblock/en.json +2 -1
- package/build/esm/i18n/codeblock/index.d.ts +2 -1
- package/build/esm/i18n/codeblock/ru.json +2 -1
- package/build/esm/i18n/search/en.json +9 -2
- package/build/esm/i18n/search/index.d.ts +9 -2
- package/build/esm/i18n/search/ru.json +10 -3
- package/build/esm/markup/codemirror/create.js +1 -1
- package/build/esm/markup/codemirror/create.js.map +1 -1
- package/build/esm/markup/codemirror/search-plugin/plugin.d.ts +7 -9
- package/build/esm/markup/codemirror/search-plugin/plugin.js +44 -55
- package/build/esm/markup/codemirror/search-plugin/plugin.js.map +1 -1
- package/build/esm/markup/codemirror/search-plugin/theme.d.ts +1 -0
- package/build/esm/markup/codemirror/search-plugin/theme.js +12 -0
- package/build/esm/markup/codemirror/search-plugin/theme.js.map +1 -0
- package/build/esm/modules/search/components/SearchCardView.css +7 -0
- package/build/esm/modules/search/components/SearchCardView.d.ts +17 -0
- package/build/esm/modules/search/components/SearchCardView.js +18 -0
- package/build/esm/modules/search/components/SearchCardView.js.map +1 -0
- package/build/esm/modules/search/components/SearchCompactView.css +5 -0
- package/build/esm/modules/search/components/SearchCompactView.d.ts +13 -0
- package/build/esm/modules/search/components/SearchCompactView.js +22 -0
- package/build/esm/modules/search/components/SearchCompactView.js.map +1 -0
- package/build/esm/modules/search/components/SearchCounter.d.ts +6 -0
- package/build/esm/modules/search/components/SearchCounter.js +11 -0
- package/build/esm/modules/search/components/SearchCounter.js.map +1 -0
- package/build/esm/modules/search/components/SearchPopup.css +9 -0
- package/build/esm/modules/search/components/SearchPopup.d.ts +15 -0
- package/build/esm/modules/search/components/SearchPopup.js +24 -0
- package/build/esm/modules/search/components/SearchPopup.js.map +1 -0
- package/build/esm/modules/search/components/SearchTextInput.d.ts +10 -0
- package/build/esm/modules/search/components/SearchTextInput.js +20 -0
- package/build/esm/modules/search/components/SearchTextInput.js.map +1 -0
- package/build/esm/modules/search/hooks/use-search.d.ts +24 -0
- package/build/esm/modules/search/hooks/use-search.js +44 -0
- package/build/esm/modules/search/hooks/use-search.js.map +1 -0
- package/build/esm/modules/search/index.d.ts +3 -0
- package/build/esm/modules/search/index.js +4 -0
- package/build/esm/modules/search/index.js.map +1 -0
- package/build/esm/modules/search/qa.d.ts +14 -0
- package/build/esm/modules/search/qa.js +15 -0
- package/build/esm/modules/search/qa.js.map +1 -0
- package/build/esm/modules/search/types.d.ts +10 -0
- package/build/esm/modules/search/types.js +2 -0
- package/build/esm/modules/search/types.js.map +1 -0
- package/build/esm/react-utils/useAutoFocus.d.ts +1 -1
- package/build/esm/react-utils/useAutoFocus.js +7 -8
- package/build/esm/react-utils/useAutoFocus.js.map +1 -1
- package/build/esm/styles/styles.css +289 -0
- package/build/esm/styles/yfm-themes.css +288 -0
- package/build/esm/table-utils/table-desc.d.ts +1 -0
- package/build/esm/table-utils/table-desc.js +3 -0
- package/build/esm/table-utils/table-desc.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esm/view/hocs/withYfmHtml/index.d.ts +1 -0
- package/build/esm/view/hocs/withYfmHtml/index.js +1 -0
- package/build/esm/view/hocs/withYfmHtml/index.js.map +1 -1
- package/build/esm/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.d.ts +5 -1
- package/build/esm/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js +7 -1
- package/build/esm/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js.map +1 -1
- package/build/styles.css +617 -10
- package/package.json +11 -9
- package/build/cjs/markup/codemirror/search-plugin/view/ReplaceIcons.d.ts +0 -3
- package/build/cjs/markup/codemirror/search-plugin/view/ReplaceIcons.js +0 -9
- package/build/cjs/markup/codemirror/search-plugin/view/ReplaceIcons.js.map +0 -1
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.css +0 -10
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.d.ts +0 -27
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.js +0 -83
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.js.map +0 -1
- package/build/esm/markup/codemirror/search-plugin/view/ReplaceIcons.d.ts +0 -3
- package/build/esm/markup/codemirror/search-plugin/view/ReplaceIcons.js +0 -4
- package/build/esm/markup/codemirror/search-plugin/view/ReplaceIcons.js.map +0 -1
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.css +0 -10
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.d.ts +0 -27
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.js +0 -77
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.js.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchTheme = void 0;
|
|
4
|
+
const view_1 = require("../../../cm/view.js");
|
|
5
|
+
exports.searchTheme = view_1.EditorView.baseTheme({
|
|
6
|
+
'&light, &dark': {
|
|
7
|
+
'& .cm-searchMatch': {
|
|
8
|
+
backgroundColor: 'var(--g-color-base-info-light)',
|
|
9
|
+
},
|
|
10
|
+
'& .cm-searchMatch-selected': {
|
|
11
|
+
backgroundColor: 'var(--g-color-base-info-heavy)',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"../../../../../src","sources":["markup/codemirror/search-plugin/theme.ts"],"names":[],"mappings":";;;AAAA,8CAAoC;AAEvB,QAAA,WAAW,GAAG,iBAAU,CAAC,SAAS,CAAC;IAC5C,eAAe,EAAE;QACb,mBAAmB,EAAE;YACjB,eAAe,EAAE,gCAAgC;SACpD;QACD,4BAA4B,EAAE;YAC1B,eAAe,EAAE,gCAAgC;SACpD;KACJ;CACJ,CAAC,CAAC","sourcesContent":["import {EditorView} from '#cm/view';\n\nexport const searchTheme = EditorView.baseTheme({\n '&light, &dark': {\n '& .cm-searchMatch': {\n backgroundColor: 'var(--g-color-base-info-light)',\n },\n '& .cm-searchMatch-selected': {\n backgroundColor: 'var(--g-color-base-info-heavy)',\n },\n },\n});\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type DOMProps } from '@gravity-ui/uikit';
|
|
2
|
+
import type { SearchCounter, SearchState } from "../types.js";
|
|
3
|
+
import "./SearchCardView.css";
|
|
4
|
+
export type SearchCardViewProps = DOMProps & {
|
|
5
|
+
counter?: SearchCounter;
|
|
6
|
+
searchState: SearchState;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onSearchChange: (value: string) => void;
|
|
9
|
+
onReplacementChange: (value: string) => void;
|
|
10
|
+
onFindPrevious: () => void;
|
|
11
|
+
onFindNext: () => void;
|
|
12
|
+
onReplace: () => void;
|
|
13
|
+
onReplaceAll: () => void;
|
|
14
|
+
onWholeWordChange: (value: boolean) => void;
|
|
15
|
+
onCaseSensitiveChange: (value: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const SearchCardView: React.FC<SearchCardViewProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchCardView = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const components_1 = require("@gravity-ui/components");
|
|
7
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
8
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
|
+
const classname_1 = require("../../../classname.js");
|
|
10
|
+
const search_1 = require("../../../i18n/search/index.js");
|
|
11
|
+
const useAutoFocus_1 = require("../../../react-utils/useAutoFocus.js");
|
|
12
|
+
const qa_1 = require("../qa.js");
|
|
13
|
+
const SearchTextInput_1 = require("./SearchTextInput.js");
|
|
14
|
+
require("./SearchCardView.css");
|
|
15
|
+
const b = (0, classname_1.cn)('search-card');
|
|
16
|
+
const SearchCardView = ({ style, className, counter, searchState, onClose, onSearchChange, onReplacementChange, onFindPrevious, onFindNext, onReplace, onReplaceAll, onWholeWordChange, onCaseSensitiveChange, }) => {
|
|
17
|
+
const searchInputRef = (0, react_1.useRef)(null);
|
|
18
|
+
(0, useAutoFocus_1.useAutoFocus)(searchInputRef, [], 200);
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(uikit_1.Card, { size: "l", spacing: { pt: 4, pb: 5, pl: 5, pr: 5 }, style: style, className: b(null, className), children: [(0, jsx_runtime_1.jsxs)(uikit_1.Flex, { spacing: { mb: 5 }, alignItems: "center", justifyContent: "space-between", className: b('header'), children: [(0, jsx_runtime_1.jsx)(uikit_1.Text, { variant: "subheader-2", className: b('title'), children: (0, search_1.i18n)('title') }), (0, jsx_runtime_1.jsx)(uikit_1.Button, { size: "m", view: "flat", onClick: onClose, "aria-label": (0, search_1.i18n)('action_close'), qa: qa_1.SearchQA.CloseBtn, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Xmark }) })] }), (0, jsx_runtime_1.jsxs)(components_1.FormRow, { direction: "row", label: (0, search_1.i18n)('title_search'), className: b('row', (0, uikit_1.sp)({ mb: 4 })), children: [(0, jsx_runtime_1.jsx)(SearchTextInput_1.SearchTextInput, { counter: counter, onFindNext: onFindNext, onFindPrevious: onFindPrevious, controlRef: searchInputRef, className: (0, uikit_1.sp)({ mb: 2 }), onUpdate: onSearchChange, value: searchState.search, delay: 300 }), (0, jsx_runtime_1.jsx)(uikit_1.Checkbox, { size: "m", onUpdate: onCaseSensitiveChange, checked: searchState.caseSensitive, qa: qa_1.SearchQA.CaseSensitiveCheck, className: (0, uikit_1.sp)({ mr: 4 }), children: (0, search_1.i18n)('label_case-sensitive') }), (0, jsx_runtime_1.jsx)(uikit_1.Checkbox, { size: "m", checked: searchState.wholeWord, onUpdate: onWholeWordChange, qa: qa_1.SearchQA.WholeWordCheck, children: (0, search_1.i18n)('label_whole-word') })] }), (0, jsx_runtime_1.jsx)(components_1.FormRow, { direction: "row", label: (0, search_1.i18n)('title_replace'), className: b('row', (0, uikit_1.sp)({ mb: 5 })), children: (0, jsx_runtime_1.jsx)(components_1.DelayedTextInput, { size: "l", delay: 300, value: searchState.replace, onUpdate: onReplacementChange, qa: qa_1.SearchQA.ReplaceInput }) }), (0, jsx_runtime_1.jsxs)(uikit_1.Flex, { justifyContent: "flex-end", gap: 2, className: b('footer'), children: [(0, jsx_runtime_1.jsx)(uikit_1.Button, { size: "l", view: "normal", onClick: onReplaceAll, disabled: !searchState.search, qa: qa_1.SearchQA.ReplaceAllBtn, children: (0, search_1.i18n)('action_replace_all') }), (0, jsx_runtime_1.jsx)(uikit_1.Button, { view: "action", size: "l", disabled: !searchState.search, onClick: onReplace, qa: qa_1.SearchQA.ReplaceBtn, children: (0, search_1.i18n)('action_replace') })] })] }));
|
|
20
|
+
};
|
|
21
|
+
exports.SearchCardView = SearchCardView;
|
|
22
|
+
//# sourceMappingURL=SearchCardView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchCardView.js","sourceRoot":"../../../../../src","sources":["modules/search/components/SearchCardView.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6B;AAE7B,uDAAiE;AACjE,6CAAwC;AACxC,6CAA8F;AAE9F,qDAAiC;AACjC,0DAAqC;AACrC,uEAA0D;AAE1D,iCAA+B;AAG/B,0DAAkD;AAElD,gCAA+B;AAgB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3B,GACI,EAEV,wBAAC,YAAI,IAAC,cAAc,EAAC,UAAU,EAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,aAC1D,uBAAC,cAAM,IACH,IAAI,EAAC,GAAG,EACR,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,CAAC,WAAW,CAAC,MAAM,EAC7B,EAAE,EAAE,aAAQ,CAAC,aAAa,YAEzB,IAAA,aAAI,EAAC,oBAAoB,CAAC,GACtB,EACT,uBAAC,cAAM,IACH,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,GAAG,EACR,QAAQ,EAAE,CAAC,WAAW,CAAC,MAAM,EAC7B,OAAO,EAAE,SAAS,EAClB,EAAE,EAAE,aAAQ,CAAC,UAAU,YAEtB,IAAA,aAAI,EAAC,gBAAgB,CAAC,GAClB,IACN,IACJ,CACV,CAAC;AACN,CAAC,CAAC;AAnHW,QAAA,cAAc,kBAmHzB","sourcesContent":["import {useRef} from 'react';\n\nimport {DelayedTextInput, FormRow} from '@gravity-ui/components';\nimport {Xmark} from '@gravity-ui/icons';\nimport {Button, Card, Checkbox, type DOMProps, Flex, Icon, Text, sp} from '@gravity-ui/uikit';\n\nimport {cn} from 'src/classname';\nimport {i18n} from 'src/i18n/search';\nimport {useAutoFocus} from 'src/react-utils/useAutoFocus';\n\nimport {SearchQA} from '../qa';\nimport type {SearchCounter, SearchState} from '../types';\n\nimport {SearchTextInput} from './SearchTextInput';\n\nimport './SearchCardView.scss';\n\nexport type SearchCardViewProps = DOMProps & {\n counter?: SearchCounter;\n searchState: SearchState;\n onClose: () => void;\n onSearchChange: (value: string) => void;\n onReplacementChange: (value: string) => void;\n onFindPrevious: () => void;\n onFindNext: () => void;\n onReplace: () => void;\n onReplaceAll: () => void;\n onWholeWordChange: (value: boolean) => void;\n onCaseSensitiveChange: (value: boolean) => void;\n};\n\nconst b = cn('search-card');\n\nexport const SearchCardView: React.FC<SearchCardViewProps> = ({\n style,\n className,\n\n counter,\n searchState,\n onClose,\n onSearchChange,\n onReplacementChange,\n onFindPrevious,\n onFindNext,\n onReplace,\n onReplaceAll,\n onWholeWordChange,\n onCaseSensitiveChange,\n}) => {\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n useAutoFocus(searchInputRef, [], 200);\n\n return (\n <Card\n size=\"l\"\n spacing={{pt: 4, pb: 5, pl: 5, pr: 5}}\n style={style}\n className={b(null, className)}\n >\n <Flex\n spacing={{mb: 5}}\n alignItems=\"center\"\n justifyContent=\"space-between\"\n className={b('header')}\n >\n <Text variant=\"subheader-2\" className={b('title')}>\n {i18n('title')}\n </Text>\n <Button\n size=\"m\"\n view=\"flat\"\n onClick={onClose}\n aria-label={i18n('action_close')}\n qa={SearchQA.CloseBtn}\n >\n <Icon data={Xmark} />\n </Button>\n </Flex>\n\n <FormRow direction=\"row\" label={i18n('title_search')} className={b('row', sp({mb: 4}))}>\n <SearchTextInput\n counter={counter}\n onFindNext={onFindNext}\n onFindPrevious={onFindPrevious}\n controlRef={searchInputRef}\n className={sp({mb: 2})}\n onUpdate={onSearchChange}\n value={searchState.search}\n delay={300}\n />\n\n <Checkbox\n size=\"m\"\n onUpdate={onCaseSensitiveChange}\n checked={searchState.caseSensitive}\n qa={SearchQA.CaseSensitiveCheck}\n className={sp({mr: 4})}\n >\n {i18n('label_case-sensitive')}\n </Checkbox>\n\n <Checkbox\n size=\"m\"\n checked={searchState.wholeWord}\n onUpdate={onWholeWordChange}\n qa={SearchQA.WholeWordCheck}\n >\n {i18n('label_whole-word')}\n </Checkbox>\n </FormRow>\n\n <FormRow\n direction=\"row\"\n label={i18n('title_replace')}\n className={b('row', sp({mb: 5}))}\n >\n <DelayedTextInput\n size=\"l\"\n delay={300}\n value={searchState.replace}\n onUpdate={onReplacementChange}\n qa={SearchQA.ReplaceInput}\n />\n </FormRow>\n\n <Flex justifyContent=\"flex-end\" gap={2} className={b('footer')}>\n <Button\n size=\"l\"\n view=\"normal\"\n onClick={onReplaceAll}\n disabled={!searchState.search}\n qa={SearchQA.ReplaceAllBtn}\n >\n {i18n('action_replace_all')}\n </Button>\n <Button\n view=\"action\"\n size=\"l\"\n disabled={!searchState.search}\n onClick={onReplace}\n qa={SearchQA.ReplaceBtn}\n >\n {i18n('action_replace')}\n </Button>\n </Flex>\n </Card>\n );\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DOMProps, type QAProps } from '@gravity-ui/uikit';
|
|
2
|
+
import type { SearchCounter } from "../types.js";
|
|
3
|
+
import "./SearchCompactView.css";
|
|
4
|
+
export type SearchCompactProps = DOMProps & QAProps & {
|
|
5
|
+
value: string;
|
|
6
|
+
counter?: SearchCounter;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
onFindPrevious: () => void;
|
|
9
|
+
onFindNext: () => void;
|
|
10
|
+
onExpand: () => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const SeachCompactView: React.FC<SearchCompactProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SeachCompactView = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
7
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
+
const classname_1 = require("../../../classname.js");
|
|
9
|
+
const search_1 = require("../../../i18n/search/index.js");
|
|
10
|
+
const useAutoFocus_1 = require("../../../react-utils/useAutoFocus.js");
|
|
11
|
+
const qa_1 = require("../qa.js");
|
|
12
|
+
const SearchTextInput_1 = require("./SearchTextInput.js");
|
|
13
|
+
require("./SearchCompactView.css");
|
|
14
|
+
const b = (0, classname_1.cn)('search-compact');
|
|
15
|
+
const SeachCompactView = function SearchCompactView({ value, counter, onChange, onFindNext, onFindPrevious, onExpand, onClose, qa, style, className, }) {
|
|
16
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
17
|
+
(0, useAutoFocus_1.useAutoFocus)(inputRef, [], 200);
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(uikit_1.Card, { spacing: { pr: 1 }, "data-qa": qa, style: style, className: b(null, className), children: [(0, jsx_runtime_1.jsx)(SearchTextInput_1.SearchTextInput, { counter: counter, onFindNext: onFindNext, onFindPrevious: onFindPrevious, value: value, view: "clear", delay: 300, onUpdate: onChange, controlRef: inputRef, placeholder: (0, search_1.i18n)('search_placeholder'), className: (0, uikit_1.sp)({ pl: 3 }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, uikit_1.sp)({ mr: 1 }), style: {
|
|
19
|
+
flexShrink: 0,
|
|
20
|
+
background: 'var(--g-color-line-generic-solid)',
|
|
21
|
+
height: '36px',
|
|
22
|
+
width: '1px',
|
|
23
|
+
} }), (0, jsx_runtime_1.jsx)(uikit_1.Tooltip, { content: (0, search_1.i18n)('action_expand'), role: "label", children: (props, ref) => ((0, jsx_runtime_1.jsx)(uikit_1.Button, { ...props, size: "m", view: "flat-secondary", onClick: onExpand, qa: qa_1.SearchQA.ExpandBtn, ref: ref, "aria-label": (0, search_1.i18n)('action_expand'), children: (0, jsx_runtime_1.jsx)(uikit_1.ButtonIcon, { children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ChevronsExpandUpRight }) }) })) }), (0, jsx_runtime_1.jsx)(uikit_1.Button, { size: "m", view: "flat-secondary", onClick: onClose, className: (0, uikit_1.sp)({ ml: 1 }), "aria-label": (0, search_1.i18n)('action_close'), qa: qa_1.SearchQA.CloseBtn, children: (0, jsx_runtime_1.jsx)(uikit_1.ButtonIcon, { children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Xmark }) }) })] }));
|
|
24
|
+
};
|
|
25
|
+
exports.SeachCompactView = SeachCompactView;
|
|
26
|
+
//# sourceMappingURL=SearchCompactView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchCompactView.js","sourceRoot":"../../../../../src","sources":["modules/search/components/SearchCompactView.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6B;AAE7B,6CAA+D;AAC/D,6CAS2B;AAE3B,qDAAiC;AACjC,0DAAqC;AACrC,uEAA0D;AAE1D,iCAA+B;AAG/B,0DAAkD;AAElD,mCAAkC;AAElC,MAAM,CAAC,GAAG,IAAA,cAAE,EAAC,gBAAgB,CAAC,CAAC;AAaxB,MAAM,gBAAgB,GAAiC,SAAS,iBAAiB,CAAC,EACrF,KAAK,EACL,OAAO,EAEP,QAAQ,EACR,UAAU,EACV,cAAc,EACd,QAAQ,EACR,OAAO,EAEP,EAAE,EACF,KAAK,EACL,SAAS,GACZ;IACG,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAEhD,IAAA,2BAAY,EAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAEhC,OAAO,CACH,wBAAC,YAAI,IAAC,OAAO,EAAE,EAAC,EAAE,EAAE,CAAC,EAAC,aAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,aAC5E,uBAAC,iCAAe,IACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,QAAQ,EACpB,WAAW,EAAE,IAAA,aAAI,EAAC,oBAAoB,CAAC,EACvC,SAAS,EAAE,IAAA,UAAE,EAAC,EAAC,EAAE,EAAE,CAAC,EAAC,CAAC,GACxB,EAEF,gCACI,SAAS,EAAE,IAAA,UAAE,EAAC,EAAC,EAAE,EAAE,CAAC,EAAC,CAAC,EACtB,KAAK,EAAE;oBACH,UAAU,EAAE,CAAC;oBACb,UAAU,EAAE,mCAAmC;oBAC/C,MAAM,EAAE,MAAM;oBACd,KAAK,EAAE,KAAK;iBACf,GACH,EAGF,uBAAC,eAAO,IAAC,OAAO,EAAE,IAAA,aAAI,EAAC,eAAe,CAAC,EAAE,IAAI,EAAC,OAAO,YAChD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CACb,uBAAC,cAAM,OACC,KAAK,EACT,IAAI,EAAC,GAAG,EACR,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,QAAQ,EACjB,EAAE,EAAE,aAAQ,CAAC,SAAS,EACtB,GAAG,EAAE,GAAmC,gBAC5B,IAAA,aAAI,EAAC,eAAe,CAAC,YAEjC,uBAAC,kBAAU,cACP,uBAAC,YAAI,IAAC,IAAI,EAAE,6BAAqB,GAAI,GAC5B,GACR,CACZ,GACK,EACV,uBAAC,cAAM,IACH,IAAI,EAAC,GAAG,EACR,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,IAAA,UAAE,EAAC,EAAC,EAAE,EAAE,CAAC,EAAC,CAAC,gBACV,IAAA,aAAI,EAAC,cAAc,CAAC,EAChC,EAAE,EAAE,aAAQ,CAAC,QAAQ,YAErB,uBAAC,kBAAU,cACP,uBAAC,YAAI,IAAC,IAAI,EAAE,aAAK,GAAI,GACZ,GACR,IACN,CACV,CAAC;AACN,CAAC,CAAC;AA3EW,QAAA,gBAAgB,oBA2E3B","sourcesContent":["import {useRef} from 'react';\n\nimport {ChevronsExpandUpRight, Xmark} from '@gravity-ui/icons';\nimport {\n Button,\n ButtonIcon,\n Card,\n type DOMProps,\n Icon,\n type QAProps,\n Tooltip,\n sp,\n} from '@gravity-ui/uikit';\n\nimport {cn} from 'src/classname';\nimport {i18n} from 'src/i18n/search';\nimport {useAutoFocus} from 'src/react-utils/useAutoFocus';\n\nimport {SearchQA} from '../qa';\nimport type {SearchCounter} from '../types';\n\nimport {SearchTextInput} from './SearchTextInput';\n\nimport './SearchCompactView.scss';\n\nconst b = cn('search-compact');\n\nexport type SearchCompactProps = DOMProps &\n QAProps & {\n value: string;\n counter?: SearchCounter;\n onChange: (value: string) => void;\n onFindPrevious: () => void;\n onFindNext: () => void;\n onExpand: () => void;\n onClose: () => void;\n };\n\nexport const SeachCompactView: React.FC<SearchCompactProps> = function SearchCompactView({\n value,\n counter,\n\n onChange,\n onFindNext,\n onFindPrevious,\n onExpand,\n onClose,\n\n qa,\n style,\n className,\n}) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n useAutoFocus(inputRef, [], 200);\n\n return (\n <Card spacing={{pr: 1}} data-qa={qa} style={style} className={b(null, className)}>\n <SearchTextInput\n counter={counter}\n onFindNext={onFindNext}\n onFindPrevious={onFindPrevious}\n value={value}\n view=\"clear\"\n delay={300}\n onUpdate={onChange}\n controlRef={inputRef}\n placeholder={i18n('search_placeholder')}\n className={sp({pl: 3})}\n />\n\n <div\n className={sp({mr: 1})}\n style={{\n flexShrink: 0,\n background: 'var(--g-color-line-generic-solid)',\n height: '36px',\n width: '1px',\n }}\n />\n\n {/* eslint-disable-next-line jsx-a11y/aria-role */}\n <Tooltip content={i18n('action_expand')} role=\"label\">\n {(props, ref) => (\n <Button\n {...props}\n size=\"m\"\n view=\"flat-secondary\"\n onClick={onExpand}\n qa={SearchQA.ExpandBtn}\n ref={ref as React.Ref<HTMLButtonElement>}\n aria-label={i18n('action_expand')}\n >\n <ButtonIcon>\n <Icon data={ChevronsExpandUpRight} />\n </ButtonIcon>\n </Button>\n )}\n </Tooltip>\n <Button\n size=\"m\"\n view=\"flat-secondary\"\n onClick={onClose}\n className={sp({ml: 1})}\n aria-label={i18n('action_close')}\n qa={SearchQA.CloseBtn}\n >\n <ButtonIcon>\n <Icon data={Xmark} />\n </ButtonIcon>\n </Button>\n </Card>\n );\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchCounterText = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
+
const search_1 = require("../../../i18n/search/index.js");
|
|
7
|
+
const qa_1 = require("../qa.js");
|
|
8
|
+
const SearchCounterText = ({ counter, style, className }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(uikit_1.Text, { whiteSpace: "nowrap", style: style, className: className, qa: qa_1.SearchQA.Counter, children: (0, search_1.i18n)('search_counter', {
|
|
10
|
+
current: String(counter.current),
|
|
11
|
+
total: String(counter.total),
|
|
12
|
+
}) }));
|
|
13
|
+
};
|
|
14
|
+
exports.SearchCounterText = SearchCounterText;
|
|
15
|
+
//# sourceMappingURL=SearchCounter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchCounter.js","sourceRoot":"../../../../../src","sources":["modules/search/components/SearchCounter.tsx"],"names":[],"mappings":";;;;AAAA,6CAAsD;AAEtD,0DAAqC;AAErC,iCAA+B;AAOxB,MAAM,iBAAiB,GAAiC,CAAC,EAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAC,EAAE,EAAE;IAC3F,OAAO,CACH,uBAAC,YAAI,IAAC,UAAU,EAAC,QAAQ,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,aAAQ,CAAC,OAAO,YAC7E,IAAA,aAAI,EAAC,gBAAgB,EAAE;YACpB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;YAChC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SAC/B,CAAC,GACC,CACV,CAAC;AACN,CAAC,CAAC;AATW,QAAA,iBAAiB,qBAS5B","sourcesContent":["import {type DOMProps, Text} from '@gravity-ui/uikit';\n\nimport {i18n} from 'src/i18n/search';\n\nimport {SearchQA} from '../qa';\nimport type {SearchCounter} from '../types';\n\nexport type SearchCounterProps = DOMProps & {\n counter: SearchCounter;\n};\n\nexport const SearchCounterText: React.FC<SearchCounterProps> = ({counter, style, className}) => {\n return (\n <Text whiteSpace=\"nowrap\" style={style} className={className} qa={SearchQA.Counter}>\n {i18n('search_counter', {\n current: String(counter.current),\n total: String(counter.total),\n })}\n </Text>\n );\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UseSearchProps } from "../hooks/use-search.js";
|
|
2
|
+
import type { SearchCounter } from "../types.js";
|
|
3
|
+
import "./SearchPopup.css";
|
|
4
|
+
export type SearchPopupProps = UseSearchProps & {
|
|
5
|
+
open: boolean;
|
|
6
|
+
anchor: Element;
|
|
7
|
+
counter?: SearchCounter;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const SearchPopup: React.FC<SearchPopupProps>;
|
|
11
|
+
interface SearchPopupWithRefProps extends Omit<SearchPopupProps, 'anchor'> {
|
|
12
|
+
anchor: Element | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function renderSearchPopup({ anchor, ...props }: SearchPopupWithRefProps): JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchPopup = void 0;
|
|
4
|
+
exports.renderSearchPopup = renderSearchPopup;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const classname_1 = require("../../../classname.js");
|
|
8
|
+
const use_search_1 = require("../hooks/use-search.js");
|
|
9
|
+
const qa_1 = require("../qa.js");
|
|
10
|
+
const SearchCardView_1 = require("./SearchCardView.js");
|
|
11
|
+
const SearchCompactView_1 = require("./SearchCompactView.js");
|
|
12
|
+
require("./SearchPopup.css");
|
|
13
|
+
const b = (0, classname_1.cn)('search-popup');
|
|
14
|
+
const SearchPopup = ({ open, anchor, counter, onClose, ...props }) => {
|
|
15
|
+
const { isCompact, searchState, handlers } = (0, use_search_1.useSearch)(props);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(uikit_1.Popup, { open: open, qa: qa_1.SearchQA.Panel, anchorElement: anchor, placement: "bottom-end", className: b({ compact: isCompact }), onOpenChange: (_open, _event, reason) => {
|
|
17
|
+
if (reason === 'escape-key') {
|
|
18
|
+
onClose();
|
|
19
|
+
}
|
|
20
|
+
}, children: isCompact ? ((0, jsx_runtime_1.jsx)(SearchCompactView_1.SeachCompactView, { counter: counter, onClose: onClose, value: searchState.search, onExpand: handlers.onExpand, onChange: handlers.onSearchChange, onFindNext: handlers.onFindNext, onFindPrevious: handlers.onFindPrevious })) : ((0, jsx_runtime_1.jsx)(SearchCardView_1.SearchCardView, { counter: counter, onClose: onClose, searchState: searchState, onSearchChange: handlers.onSearchChange, onReplacementChange: handlers.onReplaceChange, onFindNext: handlers.onFindNext, onFindPrevious: handlers.onFindPrevious, onReplace: handlers.onReplace, onReplaceAll: handlers.onReplaceAll, onWholeWordChange: handlers.onWholeWordChange, onCaseSensitiveChange: handlers.onCaseSensitiveChange })) }));
|
|
21
|
+
};
|
|
22
|
+
exports.SearchPopup = SearchPopup;
|
|
23
|
+
exports.SearchPopup.displayName = 'SearchPopup';
|
|
24
|
+
function renderSearchPopup({ anchor, ...props }) {
|
|
25
|
+
if (!anchor)
|
|
26
|
+
return null;
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(exports.SearchPopup, { anchor: anchor, ...props });
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=SearchPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchPopup.js","sourceRoot":"../../../../../src","sources":["modules/search/components/SearchPopup.tsx"],"names":[],"mappings":";;;AA+EA,8CAIC;;AAnFD,6CAAwC;AAExC,qDAAiC;AAEjC,uDAAmE;AACnE,iCAA+B;AAG/B,wDAAgD;AACh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AE,QAAQ,CAAC,SAAS,EAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY,EACnC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,EAC7C,qBAAqB,EAAE,QAAQ,CAAC,qBAAqB,GACvD,CACL,GACG,CACX,CAAC;AACN,CAAC,CAAC;AAjDW,QAAA,WAAW,eAiDtB;AAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAMxC,SAAgB,iBAAiB,CAAC,EAAC,MAAM,EAAE,GAAG,KAAK,EAA0B;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,OAAO,uBAAC,mBAAW,IAAC,MAAM,EAAE,MAAM,KAAM,KAAK,GAAI,CAAC;AACtD,CAAC","sourcesContent":["import {Popup} from '@gravity-ui/uikit';\n\nimport {cn} from 'src/classname';\n\nimport {type UseSearchProps, useSearch} from '../hooks/use-search';\nimport {SearchQA} from '../qa';\nimport type {SearchCounter} from '../types';\n\nimport {SearchCardView} from './SearchCardView';\nimport {SeachCompactView} from './SearchCompactView';\n\nimport './SearchPopup.scss';\n\nconst b = cn('search-popup');\n\nexport type SearchPopupProps = UseSearchProps & {\n open: boolean;\n anchor: Element;\n counter?: SearchCounter;\n onClose: () => void;\n};\n\nexport const SearchPopup: React.FC<SearchPopupProps> = ({\n open,\n anchor,\n counter,\n onClose,\n ...props\n}) => {\n const {isCompact, searchState, handlers} = useSearch(props);\n\n return (\n <Popup\n open={open}\n qa={SearchQA.Panel}\n anchorElement={anchor}\n placement=\"bottom-end\"\n className={b({compact: isCompact})}\n onOpenChange={(_open, _event, reason) => {\n if (reason === 'escape-key') {\n onClose();\n }\n }}\n >\n {isCompact ? (\n <SeachCompactView\n counter={counter}\n onClose={onClose}\n value={searchState.search}\n onExpand={handlers.onExpand}\n onChange={handlers.onSearchChange}\n onFindNext={handlers.onFindNext}\n onFindPrevious={handlers.onFindPrevious}\n />\n ) : (\n <SearchCardView\n counter={counter}\n onClose={onClose}\n searchState={searchState}\n onSearchChange={handlers.onSearchChange}\n onReplacementChange={handlers.onReplaceChange}\n onFindNext={handlers.onFindNext}\n onFindPrevious={handlers.onFindPrevious}\n onReplace={handlers.onReplace}\n onReplaceAll={handlers.onReplaceAll}\n onWholeWordChange={handlers.onWholeWordChange}\n onCaseSensitiveChange={handlers.onCaseSensitiveChange}\n />\n )}\n </Popup>\n );\n};\n\nSearchPopup.displayName = 'SearchPopup';\n\ninterface SearchPopupWithRefProps extends Omit<SearchPopupProps, 'anchor'> {\n anchor: Element | null;\n}\n\nexport function renderSearchPopup({anchor, ...props}: SearchPopupWithRefProps) {\n if (!anchor) return null;\n\n return <SearchPopup anchor={anchor} {...props} />;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DelayedTextInput } from '@gravity-ui/components';
|
|
2
|
+
import type { SearchCounter } from "../types.js";
|
|
3
|
+
type DelayedTextInputProps = React.ComponentProps<typeof DelayedTextInput>;
|
|
4
|
+
export type SearchTextInputProps = DelayedTextInputProps & {
|
|
5
|
+
counter?: SearchCounter;
|
|
6
|
+
onFindNext: () => void;
|
|
7
|
+
onFindPrevious: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const SearchTextInput: React.FC<SearchTextInputProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchTextInput = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const components_1 = require("@gravity-ui/components");
|
|
7
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
8
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
|
+
const search_1 = require("../../../i18n/search/index.js");
|
|
10
|
+
const qa_1 = require("../qa.js");
|
|
11
|
+
const SearchCounter_1 = require("./SearchCounter.js");
|
|
12
|
+
const SearchTextInput = function SearchTextInput({ counter, onFindNext, onFindPrevious, ...inputProps }) {
|
|
13
|
+
const handleKeyDown = (0, react_1.useCallback)((event) => {
|
|
14
|
+
if (event.key === 'Enter') {
|
|
15
|
+
if (event.shiftKey)
|
|
16
|
+
onFindPrevious();
|
|
17
|
+
else
|
|
18
|
+
onFindNext();
|
|
19
|
+
}
|
|
20
|
+
}, [onFindNext, onFindPrevious]);
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(components_1.DelayedTextInput, { size: "l", qa: qa_1.SearchQA.FindInput, onKeyDown: handleKeyDown, endContent: Boolean(inputProps.value) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [counter && (0, jsx_runtime_1.jsx)(SearchCounter_1.SearchCounterText, { counter: counter, className: (0, uikit_1.sp)({ px: 1 }) }), (0, jsx_runtime_1.jsx)(uikit_1.Button, { size: "m", view: "flat-secondary", onClick: onFindPrevious, "aria-label": (0, search_1.i18n)('action_prev'), qa: qa_1.SearchQA.PrevBtn, children: (0, jsx_runtime_1.jsx)(uikit_1.ButtonIcon, { children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ChevronUp }) }) }), (0, jsx_runtime_1.jsx)(uikit_1.Button, { size: "m", view: "flat-secondary", onClick: onFindNext, className: (0, uikit_1.sp)({ ml: 1 }), "aria-label": (0, search_1.i18n)('action_next'), qa: qa_1.SearchQA.NextBtn, children: (0, jsx_runtime_1.jsx)(uikit_1.ButtonIcon, { children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ChevronDown }) }) })] })), ...inputProps }));
|
|
22
|
+
};
|
|
23
|
+
exports.SearchTextInput = SearchTextInput;
|
|
24
|
+
//# sourceMappingURL=SearchTextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchTextInput.js","sourceRoot":"../../../../../src","sources":["modules/search/components/SearchTextInput.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAElC,uDAAwD;AACxD,6CAAyD;A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AAO,YAEpB,uBAAC,kBAAU,cACP,uBAAC,YAAI,IAAC,IAAI,EAAE,mBAAW,GAAI,GAClB,GACR,IACV,CACN,KAED,UAAU,GAChB,CACL,CAAC;AACN,CAAC,CAAC;AAtDW,QAAA,eAAe,mBAsD1B","sourcesContent":["import {useCallback} from 'react';\n\nimport {DelayedTextInput} from '@gravity-ui/components';\nimport {ChevronDown, ChevronUp} from '@gravity-ui/icons';\nimport {Button, ButtonIcon, Icon, sp} from '@gravity-ui/uikit';\n\nimport {i18n} from 'src/i18n/search';\n\nimport {SearchQA} from '../qa';\nimport type {SearchCounter} from '../types';\n\nimport {SearchCounterText} from './SearchCounter';\n\ntype DelayedTextInputProps = React.ComponentProps<typeof DelayedTextInput>;\n\nexport type SearchTextInputProps = DelayedTextInputProps & {\n counter?: SearchCounter;\n onFindNext: () => void;\n onFindPrevious: () => void;\n};\n\nexport const SearchTextInput: React.FC<SearchTextInputProps> = function SearchTextInput({\n counter,\n onFindNext,\n onFindPrevious,\n ...inputProps\n}) {\n const handleKeyDown = useCallback<React.KeyboardEventHandler>(\n (event) => {\n if (event.key === 'Enter') {\n if (event.shiftKey) onFindPrevious();\n else onFindNext();\n }\n },\n [onFindNext, onFindPrevious],\n );\n\n return (\n <DelayedTextInput\n size=\"l\"\n qa={SearchQA.FindInput}\n onKeyDown={handleKeyDown}\n endContent={\n Boolean(inputProps.value) && (\n <>\n {counter && <SearchCounterText counter={counter} className={sp({px: 1})} />}\n <Button\n size=\"m\"\n view=\"flat-secondary\"\n onClick={onFindPrevious}\n aria-label={i18n('action_prev')}\n qa={SearchQA.PrevBtn}\n >\n <ButtonIcon>\n <Icon data={ChevronUp} />\n </ButtonIcon>\n </Button>\n <Button\n size=\"m\"\n view=\"flat-secondary\"\n onClick={onFindNext}\n className={sp({ml: 1})}\n aria-label={i18n('action_next')}\n qa={SearchQA.NextBtn}\n >\n <ButtonIcon>\n <Icon data={ChevronDown} />\n </ButtonIcon>\n </Button>\n </>\n )\n }\n {...inputProps}\n />\n );\n};\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SearchState } from "../types.js";
|
|
2
|
+
export type UseSearchProps = {
|
|
3
|
+
state: SearchState;
|
|
4
|
+
onChange: (config: SearchState) => void;
|
|
5
|
+
onSearchPrev: (config: SearchState) => void;
|
|
6
|
+
onSearchNext: (config: SearchState) => void;
|
|
7
|
+
onReplaceNext: (config: SearchState) => void;
|
|
8
|
+
onReplaceAll: (config: SearchState) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function useSearch({ state, onChange, onSearchPrev, onSearchNext, onReplaceNext, onReplaceAll, }: UseSearchProps): {
|
|
11
|
+
isCompact: boolean;
|
|
12
|
+
searchState: SearchState;
|
|
13
|
+
handlers: {
|
|
14
|
+
onExpand: () => void;
|
|
15
|
+
onSearchChange: (value: string) => void;
|
|
16
|
+
onReplaceChange: (value: string) => void;
|
|
17
|
+
onWholeWordChange: (val: boolean) => void;
|
|
18
|
+
onCaseSensitiveChange: (val: boolean) => void;
|
|
19
|
+
onFindPrevious: () => void;
|
|
20
|
+
onFindNext: () => void;
|
|
21
|
+
onReplace: () => void;
|
|
22
|
+
onReplaceAll: () => void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearch = useSearch;
|
|
4
|
+
const react_utils_1 = require("../../../react-utils/index.js");
|
|
5
|
+
function useSearch({ state, onChange, onSearchPrev, onSearchNext, onReplaceNext, onReplaceAll, }) {
|
|
6
|
+
const [isCompact, , showFullForm] = (0, react_utils_1.useBooleanState)(true);
|
|
7
|
+
const handleSearchChange = (value) => {
|
|
8
|
+
onChange({ ...state, search: value });
|
|
9
|
+
};
|
|
10
|
+
const handleReplacementChange = (value) => {
|
|
11
|
+
onChange({ ...state, replace: value });
|
|
12
|
+
};
|
|
13
|
+
const handleFindPrevious = () => {
|
|
14
|
+
onSearchPrev(state);
|
|
15
|
+
};
|
|
16
|
+
const handleFindNext = () => {
|
|
17
|
+
onSearchNext(state);
|
|
18
|
+
};
|
|
19
|
+
const handleReplace = () => {
|
|
20
|
+
onReplaceNext(state);
|
|
21
|
+
};
|
|
22
|
+
const handleReplaceAll = () => {
|
|
23
|
+
onReplaceAll(state);
|
|
24
|
+
};
|
|
25
|
+
const handleCaseSensitiveChange = (val) => {
|
|
26
|
+
onChange({ ...state, caseSensitive: val });
|
|
27
|
+
};
|
|
28
|
+
const handleWholeWordChange = (val) => {
|
|
29
|
+
onChange({ ...state, wholeWord: val });
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
isCompact,
|
|
33
|
+
searchState: state,
|
|
34
|
+
handlers: {
|
|
35
|
+
onExpand: showFullForm,
|
|
36
|
+
onSearchChange: handleSearchChange,
|
|
37
|
+
onReplaceChange: handleReplacementChange,
|
|
38
|
+
onWholeWordChange: handleWholeWordChange,
|
|
39
|
+
onCaseSensitiveChange: handleCaseSensitiveChange,
|
|
40
|
+
onFindPrevious: handleFindPrevious,
|
|
41
|
+
onFindNext: handleFindNext,
|
|
42
|
+
onReplace: handleReplace,
|
|
43
|
+
onReplaceAll: handleReplaceAll,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=use-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search.js","sourceRoot":"../../../../../src","sources":["modules/search/hooks/use-search.ts"],"names":[],"mappings":";;AAaA,8BA+DC;AA5ED,+DAAgD;AAahD,SAAgB,SAAS,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,GACC;IACb,MAAM,CAAC,SAAS,EAAE,AAAD,EAAG,YAAY,CAAC,GAAG,IAAA,6BAAe,EAAC,IAAI,CAAC,CAAC;IAE1D,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,EA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,CAAC;AACN,CAAC","sourcesContent":["import {useBooleanState} from 'src/react-utils';\n\nimport type {SearchState} from '../types';\n\nexport type UseSearchProps = {\n state: SearchState;\n onChange: (config: SearchState) => void;\n onSearchPrev: (config: SearchState) => void;\n onSearchNext: (config: SearchState) => void;\n onReplaceNext: (config: SearchState) => void;\n onReplaceAll: (config: SearchState) => void;\n};\n\nexport function useSearch({\n state,\n onChange,\n onSearchPrev,\n onSearchNext,\n onReplaceNext,\n onReplaceAll,\n}: UseSearchProps) {\n const [isCompact, , showFullForm] = useBooleanState(true);\n\n const handleSearchChange = (value: string) => {\n onChange({...state, search: value});\n };\n\n const handleReplacementChange = (value: string) => {\n onChange({...state, replace: value});\n };\n\n const handleFindPrevious = () => {\n onSearchPrev(state);\n };\n\n const handleFindNext = () => {\n onSearchNext(state);\n };\n\n const handleReplace = () => {\n onReplaceNext(state);\n };\n\n const handleReplaceAll = () => {\n onReplaceAll(state);\n };\n\n const handleCaseSensitiveChange = (val: boolean) => {\n onChange({...state, caseSensitive: val});\n };\n\n const handleWholeWordChange = (val: boolean) => {\n onChange({...state, wholeWord: val});\n };\n\n return {\n isCompact,\n\n searchState: state,\n\n handlers: {\n onExpand: showFullForm,\n\n onSearchChange: handleSearchChange,\n onReplaceChange: handleReplacementChange,\n\n onWholeWordChange: handleWholeWordChange,\n onCaseSensitiveChange: handleCaseSensitiveChange,\n\n onFindPrevious: handleFindPrevious,\n onFindNext: handleFindNext,\n\n onReplace: handleReplace,\n onReplaceAll: handleReplaceAll,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchQA = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./types.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./components/SearchPopup.js"), exports);
|
|
7
|
+
var qa_1 = require("./qa.js");
|
|
8
|
+
Object.defineProperty(exports, "SearchQA", { enumerable: true, get: function () { return qa_1.SearchQA; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["modules/search/index.ts"],"names":[],"mappings":";;;;AAAA,qDAAwB;AACxB,sEAAyC;AACzC,8BAA8B;AAAtB,8FAAA,QAAQ,OAAA","sourcesContent":["export * from './types';\nexport * from './components/SearchPopup';\nexport {SearchQA} from './qa';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const SearchQA: {
|
|
2
|
+
readonly Panel: "g-md-search-panel";
|
|
3
|
+
readonly Counter: "g-md-search-counter";
|
|
4
|
+
readonly NextBtn: "g-md-search-next-btn";
|
|
5
|
+
readonly PrevBtn: "g-md-search-prev-btn";
|
|
6
|
+
readonly FindInput: "g-md-search-find-input";
|
|
7
|
+
readonly ReplaceInput: "g-md-search-replace-input";
|
|
8
|
+
readonly ReplaceBtn: "g-md-search-replace-btn";
|
|
9
|
+
readonly ReplaceAllBtn: "g-md-search-replace-all-btn";
|
|
10
|
+
readonly ExpandBtn: "g-md-search-expand-btn";
|
|
11
|
+
readonly CaseSensitiveCheck: "g-md-search-case-sensitive-check";
|
|
12
|
+
readonly WholeWordCheck: "g-md-search-whole-word-check";
|
|
13
|
+
readonly CloseBtn: "g-md-search-close-btn";
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchQA = void 0;
|
|
4
|
+
exports.SearchQA = {
|
|
5
|
+
Panel: 'g-md-search-panel',
|
|
6
|
+
Counter: 'g-md-search-counter',
|
|
7
|
+
NextBtn: 'g-md-search-next-btn',
|
|
8
|
+
PrevBtn: 'g-md-search-prev-btn',
|
|
9
|
+
FindInput: 'g-md-search-find-input',
|
|
10
|
+
ReplaceInput: 'g-md-search-replace-input',
|
|
11
|
+
ReplaceBtn: 'g-md-search-replace-btn',
|
|
12
|
+
ReplaceAllBtn: 'g-md-search-replace-all-btn',
|
|
13
|
+
ExpandBtn: 'g-md-search-expand-btn',
|
|
14
|
+
CaseSensitiveCheck: 'g-md-search-case-sensitive-check',
|
|
15
|
+
WholeWordCheck: 'g-md-search-whole-word-check',
|
|
16
|
+
CloseBtn: 'g-md-search-close-btn',
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=qa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa.js","sourceRoot":"../../../../src","sources":["modules/search/qa.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACpB,KAAK,EAAE,mBAAmB;IAC1B,OAAO,EAAE,qBAAqB;IAC9B,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,sBAAsB;IAC/B,SAAS,EAAE,wBAAwB;IACnC,YAAY,EAAE,2BAA2B;IACzC,UAAU,EAAE,yBAAyB;IACrC,aAAa,EAAE,6BAA6B;IAC5C,SAAS,EAAE,wBAAwB;IACnC,kBAAkB,EAAE,kCAAkC;IACtD,cAAc,EAAE,8BAA8B;IAC9C,QAAQ,EAAE,uBAAuB;CAC3B,CAAC","sourcesContent":["export const SearchQA = {\n Panel: 'g-md-search-panel',\n Counter: 'g-md-search-counter',\n NextBtn: 'g-md-search-next-btn',\n PrevBtn: 'g-md-search-prev-btn',\n FindInput: 'g-md-search-find-input',\n ReplaceInput: 'g-md-search-replace-input',\n ReplaceBtn: 'g-md-search-replace-btn',\n ReplaceAllBtn: 'g-md-search-replace-all-btn',\n ExpandBtn: 'g-md-search-expand-btn',\n CaseSensitiveCheck: 'g-md-search-case-sensitive-check',\n WholeWordCheck: 'g-md-search-whole-word-check',\n CloseBtn: 'g-md-search-close-btn',\n} as const;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../../../../src","sources":["modules/search/types.ts"],"names":[],"mappings":"","sourcesContent":["export type SearchState = {\n search: string;\n replace: string;\n caseSensitive: boolean;\n wholeWord: boolean;\n};\n\nexport type SearchCounter = {\n current: number;\n total: number;\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function useAutoFocus<T extends HTMLElement>(ref: RefObject<T>, dependencies?: unknown[], timeout?: number): void;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAutoFocus =
|
|
3
|
+
exports.useAutoFocus = useAutoFocus;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
|
|
5
|
+
function useAutoFocus(ref, dependencies = [], timeout = 0) {
|
|
6
6
|
(0, react_1.useEffect)(() => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
7
|
+
const timeoutId = setTimeout(() => {
|
|
8
|
+
ref.current?.focus();
|
|
9
|
+
}, timeout);
|
|
11
10
|
return () => {
|
|
12
|
-
clearTimeout(
|
|
11
|
+
clearTimeout(timeoutId);
|
|
13
12
|
};
|
|
14
13
|
// https://github.com/facebook/react/issues/23392#issuecomment-1055610198
|
|
15
14
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
exports.useAutoFocus = useAutoFocus;
|
|
15
|
+
}, dependencies);
|
|
16
|
+
}
|
|
19
17
|
//# sourceMappingURL=useAutoFocus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoFocus.js","sourceRoot":"../../../src","sources":["react-utils/useAutoFocus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAutoFocus.js","sourceRoot":"../../../src","sources":["react-utils/useAutoFocus.ts"],"names":[],"mappings":";;AAEA,oCAgBC;AAlBD,iCAAgD;AAEhD,SAAgB,YAAY,CACxB,GAAiB,EACjB,eAA0B,EAAE,EAC5B,OAAO,GAAG,CAAC;IAEX,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QACzB,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,OAAO,GAAG,EAAE;YACR,YAAY,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,CAAC;QACF,yEAAyE;QACzE,uDAAuD;IAC3D,CAAC,EAAE,YAAY,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import {type RefObject, useEffect} from 'react';\n\nexport function useAutoFocus<T extends HTMLElement>(\n ref: RefObject<T>,\n dependencies: unknown[] = [],\n timeout = 0,\n) {\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n ref.current?.focus();\n }, timeout);\n\n return () => {\n clearTimeout(timeoutId);\n };\n // https://github.com/facebook/react/issues/23392#issuecomment-1055610198\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n"]}
|