diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7c369c533..cabfd400e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "8.11.0" + ".": "8.11.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 78486aeb8..aa2bdf330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [8.11.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.11.0...v8.11.1) (2025-02-18) + + +### Bug Fixes + +* **JsonViewer:** handle case sensitive search ([#1966](https://github.com/ydb-platform/ydb-embedded-ui/issues/1966)) ([f2aabb7](https://github.com/ydb-platform/ydb-embedded-ui/commit/f2aabb7041cd6cb445df78490b54df7d1dd0945b)) +* unipika styles in one file ([#1963](https://github.com/ydb-platform/ydb-embedded-ui/issues/1963)) ([ff018a1](https://github.com/ydb-platform/ydb-embedded-ui/commit/ff018a1e90404c2d7600d832723b2c75824aa786)) + ## [8.11.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.10.0...v8.11.0) (2025-02-18) diff --git a/package-lock.json b/package-lock.json index 7e71ee75c..9333b345c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ydb-embedded-ui", - "version": "8.11.0", + "version": "8.11.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ydb-embedded-ui", - "version": "8.11.0", + "version": "8.11.1", "dependencies": { "@bem-react/classname": "^1.6.0", "@ebay/nice-modal-react": "^1.2.13", diff --git a/package.json b/package.json index 8fc8ba1c6..d099b4b89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ydb-embedded-ui", - "version": "8.11.0", + "version": "8.11.1", "files": [ "dist" ], diff --git a/src/components/JsonViewer/JsonViewer.tsx b/src/components/JsonViewer/JsonViewer.tsx index 554acb457..e9a79d416 100644 --- a/src/components/JsonViewer/JsonViewer.tsx +++ b/src/components/JsonViewer/JsonViewer.tsx @@ -96,7 +96,10 @@ export function JsonViewer({ extraTools, collapsedInitially, }: JsonViewerProps) { - const [caseSensitiveSearch] = useSetting(CASE_SENSITIVE_JSON_SEARCH, false); + const [caseSensitiveSearch, setCaseSensitiveSearch] = useSetting( + CASE_SENSITIVE_JSON_SEARCH, + false, + ); const [collapsedState, setCollapsedState] = React.useState(() => { if (collapsedInitially) { @@ -155,13 +158,16 @@ export function JsonViewer({ }; const updateState = ( - changedState: Partial>, + changedState: Partial> & { + caseSensitive?: boolean; + }, cb?: () => void, ) => { const { collapsedState: newCollapsedState, matchIndex: newMatchIndex, filter: newFilter, + caseSensitive: newCaseSensitive, } = changedState; if (newCollapsedState !== undefined) { @@ -173,7 +179,15 @@ export function JsonViewer({ if (newFilter !== undefined) { setFilter(newFilter); } - setState(calculateState(value, newCollapsedState ?? collapsedState, newFilter ?? filter)); + const caseSensitive = newCaseSensitive ?? caseSensitiveSearch; + setState( + calculateState( + value, + newCollapsedState ?? collapsedState, + newFilter ?? filter, + caseSensitive, + ), + ); cb?.(); }; @@ -254,6 +268,12 @@ export function JsonViewer({ } }; + const handleUpdateCaseSensitive = () => { + const newCaseSensitive = !caseSensitiveSearch; + setCaseSensitiveSearch(newCaseSensitive); + updateState({caseSensitive: newCaseSensitive}); + }; + const renderToolbar = () => { return ( @@ -279,6 +299,8 @@ export function JsonViewer({ onKeyDown={onEnterKeyDown} onNextMatch={onNextMatch} onPrevMatch={onPrevMatch} + caseSensitive={caseSensitiveSearch} + onUpdateCaseSensitive={handleUpdateCaseSensitive} /> )} {extraTools} diff --git a/src/components/JsonViewer/components/Filter.tsx b/src/components/JsonViewer/components/Filter.tsx index 87b732b3b..966c57918 100644 --- a/src/components/JsonViewer/components/Filter.tsx +++ b/src/components/JsonViewer/components/Filter.tsx @@ -2,8 +2,6 @@ import React from 'react'; import {ActionTooltip, Button, Flex, Icon, TextInput} from '@gravity-ui/uikit'; -import {CASE_SENSITIVE_JSON_SEARCH} from '../../../utils/constants'; -import {useSetting} from '../../../utils/hooks'; import {block} from '../constants'; import i18n from '../i18n'; @@ -19,16 +17,24 @@ interface FilterProps { onKeyDown?: (event: React.KeyboardEvent) => void; onNextMatch?: (_event: unknown, diff?: number) => void; onPrevMatch?: (_event: unknown, diff?: number) => void; + caseSensitive?: boolean; + onUpdateCaseSensitive: VoidFunction; } export const Filter = React.forwardRef(function Filter( - {matchIndex, matchedRows, value, onUpdate, onKeyDown, onNextMatch, onPrevMatch}, + { + matchIndex, + matchedRows, + value, + onUpdate, + onKeyDown, + onNextMatch, + onPrevMatch, + caseSensitive, + onUpdateCaseSensitive, + }, ref, ) { - const [caseSensitiveSearch, setCaseSensitiveSearch] = useSetting( - CASE_SENSITIVE_JSON_SEARCH, - false, - ); const count = matchedRows.length; const matchPosition = count ? 1 + (matchIndex % count) : 0; return ( @@ -47,15 +53,15 @@ export const Filter = React.forwardRef(function F endContent={ diff --git a/src/index.tsx b/src/index.tsx index a0f0dcc91..d3d791f05 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,16 +1,11 @@ /* eslint-disable no-restricted-imports */ -/* eslint-disable import/order */ import ReactDOM from 'react-dom/client'; -import '@gravity-ui/uikit/styles/styles.scss'; - import {ErrorBoundary} from './lib'; import reportWebVitals from './reportWebVitals'; import {history, store} from './store/defaultStore'; -import './styles/themes.scss'; -import './styles/unipika.scss'; -import './index.css'; +import './styles/index.scss'; async function render() { let App; diff --git a/src/index.css b/src/styles/index.scss similarity index 78% rename from src/index.css rename to src/styles/index.scss index 7445bbd2c..b578f7d8b 100644 --- a/src/index.css +++ b/src/styles/index.scss @@ -1,3 +1,7 @@ +@forward '@gravity-ui/uikit/styles/styles.scss'; +@forward './themes.scss'; +@forward './unipika.scss'; + body { margin: 0; diff --git a/src/styles/themes.scss b/src/styles/themes.scss index 8b749bcc0..52b0320dc 100644 --- a/src/styles/themes.scss +++ b/src/styles/themes.scss @@ -2,7 +2,6 @@ @use './themes/light-hc'; @use './themes/dark'; @use './themes/dark-hc'; -@use '~@gravity-ui/unipika/styles/unipika.scss'; // Override @gravity-ui/uikit color palette with our own colors @@ -55,7 +54,6 @@ --g-color-text-link: var(--g-color-private-blue-550-solid); --g-color-text-link-hover: var(--g-color-private-blue-700-solid); @include dark.colors-private-dark; - @include unipika.unipika-dark; } &_theme_dark-hc { @@ -71,6 +69,5 @@ --g-color-text-link: var(--g-color-private-blue-650-solid); --g-color-text-link-hover: var(--g-color-private-blue-800-solid); @include dark-hc.colors-private-dark-hc; - @include unipika.unipika-dark; } } diff --git a/src/styles/unipika.scss b/src/styles/unipika.scss index 4ad37df8b..5dcc2019e 100644 --- a/src/styles/unipika.scss +++ b/src/styles/unipika.scss @@ -1,3 +1,5 @@ +@use '~@gravity-ui/unipika/styles/unipika.scss'; + .g-root { .unipika { font-family: var(--g-font-family-monospace); @@ -9,4 +11,9 @@ border: 0; } } + + &_theme_dark, + &_theme_dark-hc { + @include unipika.unipika-dark; + } }