@gravity-ui/navigation 1.3.0 → 1.4.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.
@@ -294,18 +294,14 @@ function getSettingsPageFromChildren(children, filterRe) {
294
294
  page.hidden = hidden && page.hidden;
295
295
  }
296
296
  else {
297
- const { title, header, withBadge, showTitle = true } = element.props;
297
+ const { withBadge, showTitle = true } = element.props;
298
298
  const { items, hidden } = getSettingsItemsFromChildren(element.props.children, filterRe);
299
299
  page.withBadge = withBadge || page.withBadge;
300
300
  page.hidden = hidden && page.hidden;
301
- page.sections.push({
302
- title,
303
- header,
304
- withBadge,
301
+ page.sections.push(Object.assign(Object.assign({}, element.props), { withBadge,
305
302
  items,
306
303
  hidden,
307
- showTitle,
308
- });
304
+ showTitle }));
309
305
  }
310
306
  });
311
307
  return page;
@@ -325,31 +321,89 @@ function getSettingsItemsFromChildren(children, filterRe) {
325
321
  hidden = hidden && fragmentItems.hidden;
326
322
  }
327
323
  else {
328
- const item = {
329
- title: element.props.title,
330
- renderTitleComponent: element.props.renderTitleComponent,
331
- element,
332
- hidden: !filterRe.test(element.props.title),
333
- };
324
+ const item = Object.assign(Object.assign({}, element.props), { element, hidden: !filterRe.test(element.props.title) });
334
325
  items.push(item);
335
326
  hidden = hidden && item.hidden;
336
327
  }
337
328
  });
338
329
  return { items, hidden };
339
330
  }
331
+ function getSelectedSettingsPart(pages, selection) {
332
+ if (!selection.settingId && !selection.section && !selection.page) {
333
+ return {};
334
+ }
335
+ for (const page of Object.values(pages)) {
336
+ if (!selection.settingId && !selection.section) {
337
+ if (selection.page !== page.id)
338
+ continue;
339
+ return { page };
340
+ }
341
+ for (const section of page.sections) {
342
+ if (selection.settingId) {
343
+ for (const setting of section.items) {
344
+ if (setting.id === selection.settingId) {
345
+ return { page, section, setting };
346
+ }
347
+ }
348
+ }
349
+ else if (selection.section &&
350
+ ('id' in selection.section
351
+ ? selection.section.id === section.id
352
+ : selection.section.title === section.title)) {
353
+ return { page, section };
354
+ }
355
+ }
356
+ }
357
+ return {};
358
+ }
359
+
360
+ const defaultValue = {};
361
+ const context = React__default["default"].createContext(defaultValue);
362
+ context.displayName = 'SettingsSelectionContext';
363
+ function useSettingsSelectionProviderValue(pages, selection) {
364
+ const selectedRef = React__default["default"].useRef(null);
365
+ const contextValue = React__default["default"].useMemo(() => {
366
+ if (!selection)
367
+ return { selectedRef };
368
+ return Object.assign({ selectedRef }, getSelectedSettingsPart(pages, selection));
369
+ }, [pages, selection]);
370
+ return contextValue;
371
+ }
372
+ const SettingsSelectionContextProvider = context.Provider;
373
+ function useSettingsSelectionContext() {
374
+ return React__default["default"].useContext(context);
375
+ }
376
+
377
+ function isSectionSelected(selected, pageId, section) {
378
+ var _a;
379
+ if (!selected.section || selected.setting) {
380
+ return false;
381
+ }
382
+ else if (selected.section.id && selected.section.id === section.id) {
383
+ return true;
384
+ }
385
+ else if (((_a = selected.page) === null || _a === void 0 ? void 0 : _a.id) === pageId &&
386
+ selected.section.title &&
387
+ selected.section.title === section.title) {
388
+ return true;
389
+ }
390
+ else {
391
+ return false;
392
+ }
393
+ }
340
394
 
341
- var css_248z = ".gn-settings{display:grid;grid-template-columns:216px 1fr;height:100%;width:834px}.gn-settings_view_mobile{display:block;height:calc(80vh - 56px);overflow-x:hidden;width:auto}@supports (height:90dvh){.gn-settings_view_mobile{height:calc(90dvh - 56px)}}.gn-settings_view_mobile.gn-settings_loading{text-align:center}.gn-settings_view_mobile .gn-settings__loader{margin-top:20px}.gn-settings_view_mobile .gn-settings__search{margin:4px 0 16px;padding:0 20px}.gn-settings_view_mobile .gn-settings__page{overflow-y:visible}.gn-settings_view_mobile .gn-settings__tabs .yc-tabs__item:first-child{margin-left:20px}.gn-settings_view_mobile .gn-settings__tabs .yc-tabs__item:last-child{margin-right:20px}.gn-settings_view_mobile .gn-settings__section-heading{font-size:var(--g-text-subheader-3-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-3-line-height)}.gn-settings_view_mobile .gn-settings__section-subheader{color:var(--g-color-text-secondary)}.gn-settings_view_mobile .gn-settings__section-heading+.gn-settings-subheader{margin-top:8px}.gn-settings_view_mobile .gn-settings__section-item{margin-top:0}.gn-settings_view_mobile .gn-settings__section-heading+.gn-settings__section-item,.gn-settings_view_mobile .gn-settings__section-subheader+.gn-settings__section-item{margin-top:30px}.gn-settings_view_mobile .gn-settings__section-item+.gn-settings__section-item{margin-top:22px}.gn-settings_view_mobile .gn-settings__item:not(.gn-settings_view_mobile .gn-settings__item_mode_row){gap:8px;grid-template-columns:1fr}.gn-settings_view_mobile .gn-settings__item-heading{font-size:var(--g-text-body-2-font-size);font-weight:var(--g-text-body-font-weight);line-height:var(--g-text-body-2-line-height)}.gn-settings_view_mobile .gn-settings__item-description{font-size:var(--g-text-body-1-font-size);font-weight:var(--g-text-body-font-weight);line-height:var(--g-text-body-1-line-height)}.gn-settings_view_mobile .gn-settings__item_mode_row{grid-template-columns:1fr auto}.gn-settings_view_mobile .gn-settings__item_mode_row .gn-settings__item-heading{padding-right:20px}.gn-settings_view_mobile .gn-settings__item-content{width:100%}.gn-settings_view_mobile .gn-settings__not-found{color:var(--g-color-text-hint);font-size:var(--g-text-body-2-font-size);font-weight:var(--g-text-body-font-weight);justify-items:start;line-height:var(--g-text-body-2-line-height);margin:20px 0 0 20px}.gn-settings_loading{grid-template-columns:auto}.gn-settings__loader{align-self:center;justify-self:center}.gn-settings__not-found{align-items:center;display:grid;height:100%;justify-items:center}.gn-settings__menu{border-right:1px solid var(--g-color-line-generic)}.gn-settings__heading{font-size:var(--g-text-subheader-2-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-2-line-height);margin:20px 20px 0}.gn-settings__search{margin:0 20px 16px}.gn-settings__page{overflow-y:auto}.gn-settings__content{padding:20px}.gn-settings__section-heading{font-size:var(--g-text-subheader-2-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-2-line-height);margin:0}.gn-settings__section-item{margin-top:24px}.gn-settings__section+.gn-settings__section{margin-top:32px}.gn-settings__item{display:grid;grid-template-columns:216px 1fr;justify-items:start}.gn-settings__item_align_top{align-items:start}.gn-settings__item_align_center{align-items:center}.gn-settings__item-title_badge{position:relative}.gn-settings__item-title_badge:after{background-color:var(--g-color-text-danger);border-radius:50%;content:\"\";display:block;height:6px;position:absolute;right:-8px;top:1px;width:6px}.gn-settings__item-description{color:var(--g-color-text-secondary);display:block;font-size:var(--g-text-caption-2-font-size);font-weight:var(--g-text-caption-font-weight);line-height:var(--g-text-caption-2-line-height);margin-top:2px;padding-right:20px}.gn-settings__item-right-adornment_hidden{opacity:0;transition:opacity .2s}.gn-settings__item:hover .gn-settings__item-right-adornment_hidden{opacity:1}.gn-settings__found{background:var(--g-color-base-selection);font-weight:var(--g-text-accent-font-weight)}";
395
+ var css_248z = ".gn-settings{display:grid;grid-template-columns:216px 1fr;height:100%;width:834px}.gn-settings_view_mobile{display:block;height:calc(80vh - 56px);overflow-x:hidden;width:auto}@supports (height:90dvh){.gn-settings_view_mobile{height:calc(90dvh - 56px)}}.gn-settings_view_mobile.gn-settings_loading{text-align:center}.gn-settings_view_mobile .gn-settings__loader{margin-top:20px}.gn-settings_view_mobile .gn-settings__search{margin:4px 0 16px;padding:0 20px}.gn-settings_view_mobile .gn-settings__page{overflow-y:visible}.gn-settings_view_mobile .gn-settings__tabs .yc-tabs__item:first-child{margin-left:20px}.gn-settings_view_mobile .gn-settings__tabs .yc-tabs__item:last-child{margin-right:20px}.gn-settings_view_mobile .gn-settings__section-heading{font-size:var(--g-text-subheader-3-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-3-line-height)}.gn-settings_view_mobile .gn-settings__section-subheader{color:var(--g-color-text-secondary)}.gn-settings_view_mobile .gn-settings__section-heading+.gn-settings-subheader{margin-top:8px}.gn-settings_view_mobile .gn-settings__section-item{margin-top:0}.gn-settings_view_mobile .gn-settings__section-heading+.gn-settings__section-item,.gn-settings_view_mobile .gn-settings__section-subheader+.gn-settings__section-item{margin-top:30px}.gn-settings_view_mobile .gn-settings__section-item+.gn-settings__section-item{margin-top:22px}.gn-settings_view_mobile .gn-settings__item:not(.gn-settings_view_mobile .gn-settings__item_mode_row){gap:8px;grid-template-columns:1fr}.gn-settings_view_mobile .gn-settings__item-heading{font-size:var(--g-text-body-2-font-size);font-weight:var(--g-text-body-font-weight);line-height:var(--g-text-body-2-line-height)}.gn-settings_view_mobile .gn-settings__item-description{font-size:var(--g-text-body-1-font-size);font-weight:var(--g-text-body-font-weight);line-height:var(--g-text-body-1-line-height)}.gn-settings_view_mobile .gn-settings__item_mode_row{grid-template-columns:1fr auto}.gn-settings_view_mobile .gn-settings__item_mode_row .gn-settings__item-heading{padding-right:20px}.gn-settings_view_mobile .gn-settings__item-content{width:100%}.gn-settings_view_mobile .gn-settings__not-found{color:var(--g-color-text-hint);font-size:var(--g-text-body-2-font-size);font-weight:var(--g-text-body-font-weight);justify-items:start;line-height:var(--g-text-body-2-line-height);margin:20px 0 0 20px}.gn-settings_loading{grid-template-columns:auto}.gn-settings__loader{align-self:center;justify-self:center}.gn-settings__not-found{align-items:center;display:grid;height:100%;justify-items:center}.gn-settings__menu{border-right:1px solid var(--g-color-line-generic)}.gn-settings__heading{font-size:var(--g-text-subheader-2-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-2-line-height);margin:20px 20px 0}.gn-settings__search{margin:0 20px 16px}.gn-settings__page{overflow-y:auto}.gn-settings__content{padding:20px}.gn-settings__section-right-adornment_hidden{opacity:0;transition:opacity .2s}.gn-settings__section-heading:hover .gn-settings__section-right-adornment_hidden{opacity:1}.gn-settings__section-heading{font-size:var(--g-text-subheader-2-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-2-line-height);margin:0}.gn-settings__section-item{margin-top:24px}.gn-settings__section+.gn-settings__section{margin-top:32px}.gn-settings__item{display:grid;grid-template-columns:216px 1fr;justify-items:start}.gn-settings__item_align_top{align-items:start}.gn-settings__item_align_center{align-items:center}.gn-settings__item-title_badge{position:relative}.gn-settings__item-title_badge:after{background-color:var(--g-color-text-danger);border-radius:50%;content:\"\";display:block;height:6px;position:absolute;right:-8px;top:1px;width:6px}.gn-settings__item-description{color:var(--g-color-text-secondary);display:block;font-size:var(--g-text-caption-2-font-size);font-weight:var(--g-text-caption-font-weight);line-height:var(--g-text-caption-2-line-height);margin-top:2px;padding-right:20px}.gn-settings__item-right-adornment_hidden{opacity:0;transition:opacity .2s}.gn-settings__item:hover .gn-settings__item-right-adornment_hidden{opacity:1}.gn-settings__item_selected,.gn-settings__section_selected{background:var(--g-color-base-selection);border-radius:8px;margin-left:-8px;padding:8px}.gn-settings__found{background:var(--g-color-base-selection);font-weight:var(--g-text-accent-font-weight)}";
342
396
  styleInject_es.styleInject(css_248z);
343
397
 
344
398
  const b = styleInject_es.block('settings');
345
399
  const SettingsContext = React__default["default"].createContext({});
346
400
  const useSettingsContext = () => React__default["default"].useContext(SettingsContext);
347
401
  function Settings(_a) {
348
- var { loading, renderLoading, children, view = 'normal', renderRightAdornment, showRightAdornmentOnHover = true } = _a, props = tslib_es6.__rest(_a, ["loading", "renderLoading", "children", "view", "renderRightAdornment", "showRightAdornmentOnHover"]);
402
+ var { loading, renderLoading, children, view = 'normal', renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover = true } = _a, props = tslib_es6.__rest(_a, ["loading", "renderLoading", "children", "view", "renderRightAdornment", "renderSectionRightAdornment", "showRightAdornmentOnHover"]);
349
403
  if (loading) {
350
404
  return (React__default["default"].createElement("div", { className: b({ loading: true, view }) }, typeof renderLoading === 'function' ? (renderLoading()) : (React__default["default"].createElement(uikit.Loader, { className: b('loader'), size: "m" }))));
351
405
  }
352
- return (React__default["default"].createElement(SettingsContext.Provider, { value: { renderRightAdornment, showRightAdornmentOnHover } },
406
+ return (React__default["default"].createElement(SettingsContext.Provider, { value: { renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover } },
353
407
  React__default["default"].createElement(SettingsContent, Object.assign({ view: view }, props), children)));
354
408
  }
355
409
  const getPageTitleById = (menu, activePage) => {
@@ -364,12 +418,16 @@ const getPageTitleById = (menu, activePage) => {
364
418
  }
365
419
  return '';
366
420
  };
367
- function SettingsContent({ initialPage, initialSearch, children, renderNotFound, title = i18n('label_title'), filterPlaceholder = i18n('label_filter-placeholder'), emptyPlaceholder = i18n('label_empty-placeholder'), view, onPageChange, onClose, }) {
421
+ function SettingsContent({ initialPage, initialSearch, selection, children, renderNotFound, title = i18n('label_title'), filterPlaceholder = i18n('label_filter-placeholder'), emptyPlaceholder = i18n('label_empty-placeholder'), view, onPageChange, onClose, }) {
368
422
  var _a, _b;
423
+ const { renderSectionRightAdornment, showRightAdornmentOnHover } = useSettingsContext();
369
424
  const [search, setSearch] = React__default["default"].useState(initialSearch !== null && initialSearch !== void 0 ? initialSearch : '');
370
425
  const { menu, pages } = getSettingsFromChildren(children, search);
426
+ const selected = useSettingsSelectionProviderValue(pages, selection);
371
427
  const pageKeys = Object.keys(pages);
372
- const [selectedPage, setCurrentPage] = React__default["default"].useState(initialPage && pageKeys.includes(initialPage) ? initialPage : undefined);
428
+ const selectionInitialPage = selected.page && pageKeys.includes(selected.page.id) ? selected.page.id : undefined;
429
+ const [selectedPage, setCurrentPage] = React__default["default"].useState(selectionInitialPage ||
430
+ (initialPage && pageKeys.includes(initialPage) ? initialPage : undefined));
373
431
  const searchInputRef = React__default["default"].useRef(null);
374
432
  const menuRef = React__default["default"].useRef(null);
375
433
  const isMobile = view === 'mobile';
@@ -404,39 +462,60 @@ function SettingsContent({ initialPage, initialSearch, children, renderNotFound,
404
462
  handlePageChange(activePage);
405
463
  }
406
464
  });
407
- const renderPageContent = () => {
408
- if (!activePage) {
465
+ React__default["default"].useEffect(() => {
466
+ if (!selectionInitialPage)
467
+ return;
468
+ setCurrentPage(selectionInitialPage);
469
+ }, [selectionInitialPage]);
470
+ React__default["default"].useEffect(() => {
471
+ var _a;
472
+ if ((_a = selected.selectedRef) === null || _a === void 0 ? void 0 : _a.current) {
473
+ selected.selectedRef.current.scrollIntoView();
474
+ }
475
+ }, [selected.selectedRef]);
476
+ const renderSetting = ({ title: settingTitle, element }) => {
477
+ return (React__default["default"].createElement("div", { key: settingTitle, className: b('section-item') }, React__default["default"].cloneElement(element, Object.assign(Object.assign({}, element.props), { highlightedTitle: search && settingTitle ? prepareTitle(settingTitle, search) : settingTitle }))));
478
+ };
479
+ const renderSection = (page, section) => {
480
+ const isSelected = isSectionSelected(selected, page, section);
481
+ return (React__default["default"].createElement("div", { key: section.title, className: b('section', { selected: isSelected }), ref: isSelected ? selected.selectedRef : undefined },
482
+ section.showTitle && (React__default["default"].createElement("h3", { className: b('section-heading') }, renderSectionRightAdornment ? (React__default["default"].createElement(uikit.Flex, { gap: 2, alignItems: 'center' },
483
+ section.title,
484
+ React__default["default"].createElement("div", { className: b('section-right-adornment', {
485
+ hidden: showRightAdornmentOnHover,
486
+ }) }, renderSectionRightAdornment(section)))) : (section.title))),
487
+ section.header &&
488
+ (isMobile ? (React__default["default"].createElement("div", { className: b('section-subheader') }, section.header)) : (section.header)),
489
+ section.items.map((setting) => (setting.hidden ? null : renderSetting(setting)))));
490
+ };
491
+ const renderPageContent = (page) => {
492
+ if (!page) {
409
493
  return typeof renderNotFound === 'function' ? (renderNotFound()) : (React__default["default"].createElement("div", { className: b('not-found') }, emptyPlaceholder));
410
494
  }
411
- const filteredSections = pages[activePage].sections.filter((section) => !section.hidden);
495
+ const filteredSections = pages[page].sections.filter((section) => !section.hidden);
412
496
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
413
- !isMobile && (React__default["default"].createElement(Title.Title, { hasSeparator: true, onClose: onClose }, getPageTitleById(menu, activePage))),
414
- React__default["default"].createElement("div", { className: b('content') }, filteredSections.map((section) => (React__default["default"].createElement("div", { key: section.title, className: b('section') },
415
- section.showTitle && (React__default["default"].createElement("h3", { className: b('section-heading') }, section.title)),
416
- section.header &&
417
- (isMobile ? (React__default["default"].createElement("div", { className: b('section-subheader') }, section.header)) : (section.header)),
418
- section.items.map(({ hidden, title, element }) => hidden ? null : (React__default["default"].createElement("div", { key: title, className: b('section-item') }, React__default["default"].cloneElement(element, Object.assign(Object.assign({}, element.props), { highlightedTitle: search && title
419
- ? prepareTitle(title, search)
420
- : title })))))))))));
497
+ !isMobile && (React__default["default"].createElement(Title.Title, { hasSeparator: true, onClose: onClose }, getPageTitleById(menu, page))),
498
+ React__default["default"].createElement("div", { className: b('content') }, filteredSections.map((section) => renderSection(page, section)))));
421
499
  };
422
- return (React__default["default"].createElement("div", { className: b({ view }) },
423
- isMobile ? (React__default["default"].createElement(React__default["default"].Fragment, null,
424
- React__default["default"].createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), initialValue: initialSearch, onChange: setSearch, autoFocus: false, inputSize: 'xl' }),
425
- React__default["default"].createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b('tabs') }))) : (React__default["default"].createElement("div", { className: b('menu'), onClick: () => {
426
- if (searchInputRef.current) {
427
- searchInputRef.current.focus();
428
- }
429
- }, onKeyDown: (event) => {
430
- if (menuRef.current) {
431
- if (menuRef.current.handleKeyDown(event)) {
432
- event.preventDefault();
500
+ return (React__default["default"].createElement(SettingsSelectionContextProvider, { value: selected },
501
+ React__default["default"].createElement("div", { className: b({ view }) },
502
+ isMobile ? (React__default["default"].createElement(React__default["default"].Fragment, null,
503
+ React__default["default"].createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), initialValue: initialSearch, onChange: setSearch, autoFocus: false, inputSize: 'xl' }),
504
+ React__default["default"].createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b('tabs') }))) : (React__default["default"].createElement("div", { className: b('menu'), onClick: () => {
505
+ if (searchInputRef.current) {
506
+ searchInputRef.current.focus();
433
507
  }
434
- }
435
- } },
436
- React__default["default"].createElement(Title.Title, null, title),
437
- React__default["default"].createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), initialValue: initialSearch, onChange: setSearch, placeholder: filterPlaceholder, autoFocus: true }),
438
- React__default["default"].createElement(SettingsMenu, { ref: menuRef, items: menu, onChange: handlePageChange, activeItemId: activePage }))),
439
- React__default["default"].createElement("div", { className: b('page') }, renderPageContent())));
508
+ }, onKeyDown: (event) => {
509
+ if (menuRef.current) {
510
+ if (menuRef.current.handleKeyDown(event)) {
511
+ event.preventDefault();
512
+ }
513
+ }
514
+ } },
515
+ React__default["default"].createElement(Title.Title, null, title),
516
+ React__default["default"].createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), initialValue: initialSearch, onChange: setSearch, placeholder: filterPlaceholder, autoFocus: true }),
517
+ React__default["default"].createElement(SettingsMenu, { ref: menuRef, items: menu, onChange: handlePageChange, activeItemId: activePage }))),
518
+ React__default["default"].createElement("div", { className: b('page') }, renderPageContent(activePage)))));
440
519
  }
441
520
  Settings.Group = function SettingsGroup({ children }) {
442
521
  return React__default["default"].createElement(React__default["default"].Fragment, null, children);
@@ -447,16 +526,19 @@ Settings.Page = function SettingsPage({ children }) {
447
526
  Settings.Section = function SettingsSection({ children }) {
448
527
  return React__default["default"].createElement(React__default["default"].Fragment, null, children);
449
528
  };
450
- Settings.Item = function SettingsItem({ title, highlightedTitle, children, align = 'center', withBadge, renderTitleComponent = identity_1, mode, description, }) {
529
+ Settings.Item = function SettingsItem(setting) {
530
+ const { id, highlightedTitle, children, align = 'center', withBadge, renderTitleComponent = identity_1, mode, description, } = setting;
531
+ const selected = useSettingsSelectionContext();
532
+ const isSettingSelected = selected.setting && selected.setting.id === id;
451
533
  const { renderRightAdornment, showRightAdornmentOnHover } = useSettingsContext();
452
534
  const titleNode = (React__default["default"].createElement("span", { className: b('item-title', { badge: withBadge }) }, renderTitleComponent(highlightedTitle)));
453
- return (React__default["default"].createElement("div", { className: b('item', { align, mode }) },
535
+ return (React__default["default"].createElement("div", { className: b('item', { align, mode, selected: isSettingSelected }), ref: isSettingSelected ? selected.selectedRef : undefined },
454
536
  React__default["default"].createElement("label", { className: b('item-heading') },
455
537
  renderRightAdornment ? (React__default["default"].createElement(uikit.Flex, { className: b('item-title-wrapper'), gap: 3 },
456
538
  titleNode,
457
539
  React__default["default"].createElement("div", { className: b('item-right-adornment', {
458
540
  hidden: showRightAdornmentOnHover,
459
- }) }, renderRightAdornment({ title })))) : (titleNode),
541
+ }) }, renderRightAdornment(setting)))) : (titleNode),
460
542
  description ? React__default["default"].createElement("span", { className: b('item-description') }, description) : null),
461
543
  React__default["default"].createElement("div", { className: b('item-content') }, children)));
462
544
  };
@@ -486,4 +568,4 @@ function prepareTitle(string, search) {
486
568
 
487
569
  exports.Settings = Settings;
488
570
  exports.useSettingsContext = useSettingsContext;
489
- //# sourceMappingURL=Settings-014971f7.js.map
571
+ //# sourceMappingURL=Settings-4b4e8a46.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Settings-4b4e8a46.js","sources":["../../node_modules/lodash/identity.js","../../../src/components/Settings/helpers.ts","../../../src/components/Settings/SettingsSearch/SettingsSearch.tsx","../../../src/components/Settings/SettingsMenu/SettingsMenu.tsx","../../../src/components/Settings/SettingsMenuMobile/SettingsMenuMobile.tsx","../../../src/components/Settings/i18n/index.ts","../../../src/components/Settings/collect-settings.ts","../../../src/components/Settings/Selection/context.ts","../../../src/components/Settings/Selection/utils.ts","../../../src/components/Settings/Settings.tsx"],"sourcesContent":["/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","import * as React from 'react';\n\ntype AnyFunc = (...args: any[]) => any;\n\nexport function useStableCallback<T extends AnyFunc>(\n func: T,\n): (...args: Parameters<T>) => ReturnType<T> | undefined {\n const funcRef = React.useRef<T>();\n\n React.useEffect(() => {\n funcRef.current = func;\n return () => {\n funcRef.current = undefined;\n };\n }, [func]);\n\n return React.useCallback((...args: Parameters<T>) => {\n if (typeof funcRef.current === 'function') {\n return funcRef.current(...args);\n }\n return undefined;\n }, []);\n}\n\nexport function useCurrent<T>(value: T) {\n const ref = React.useRef(value);\n ref.current = value;\n return React.useCallback(() => ref.current, []);\n}\n\nexport function invariant(cond: boolean, message: string): void {\n if (!cond) {\n throw new Error(message);\n }\n}\n\nexport function escapeStringForRegExp(input: string) {\n return input.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n","import React from 'react';\nimport debounceFn from 'lodash/debounce';\n\nimport {TextInput, TextInputSize} from '@gravity-ui/uikit';\n\nimport {block} from '../../utils/cn';\nimport {useStableCallback} from '../helpers';\n\nconst b = block('settings-search');\n\ninterface SettingsSearchProps {\n className?: string;\n initialValue?: string;\n onChange: (search: string) => void;\n debounce?: number;\n inputRef?: React.Ref<HTMLInputElement>;\n inputSize?: TextInputSize;\n placeholder?: string;\n autoFocus?: boolean;\n}\n\nexport function SettingsSearch({\n className,\n initialValue,\n onChange,\n debounce = 200,\n inputRef,\n inputSize,\n placeholder,\n autoFocus = true,\n}: SettingsSearchProps) {\n const [value, setValue] = React.useState(initialValue ?? '');\n\n const onChangeDebounced = useStableCallback(debounceFn(onChange, debounce));\n const handleUpdate = useStableCallback((updated: string) => {\n setValue(updated);\n onChangeDebounced(updated);\n });\n\n return (\n <div className={b(null, className)}>\n <TextInput\n value={value}\n controlRef={inputRef}\n hasClear\n autoFocus={autoFocus}\n size={inputSize}\n placeholder={placeholder}\n onUpdate={handleUpdate}\n />\n </div>\n );\n}\n","import React from 'react';\n\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../utils/cn';\nimport {useCurrent, useStableCallback} from '../helpers';\nimport {Item, SettingsMenuProps} from '../types';\n\nimport './SettingsMenu.scss';\n\nconst b = block('settings-menu');\n\nexport interface SettingsMenuInstance {\n handleKeyDown(event: React.KeyboardEvent): boolean;\n clearFocus(): void;\n}\n\nexport const SettingsMenu = React.forwardRef<SettingsMenuInstance, SettingsMenuProps>(\n // eslint-disable-next-line prefer-arrow-callback\n function SettingsMenu({items, onChange, activeItemId}, ref) {\n const [focusItemId, setFocusId] = React.useState<string>();\n const containerRef = React.useRef<HTMLDivElement>(null);\n const handleChange = useStableCallback(onChange);\n const getFocused = useCurrent(focusItemId);\n\n React.useImperativeHandle(\n ref,\n () => ({\n handleKeyDown(event) {\n if (!containerRef.current) {\n return false;\n }\n const focused = getFocused();\n if (focused && event.key === 'Enter') {\n handleChange(focused);\n return true;\n } else if (event.key === 'ArrowDown') {\n setFocusId(focusNext(containerRef.current, focused, 1));\n return true;\n } else if (event.key === 'ArrowUp') {\n setFocusId(focusNext(containerRef.current, focused, -1));\n return true;\n }\n return false;\n },\n clearFocus() {\n setFocusId(undefined);\n },\n }),\n [getFocused, handleChange],\n );\n\n return (\n <div ref={containerRef} className={b()}>\n {items.map((firstLevelItem) => {\n if ('groupTitle' in firstLevelItem) {\n return (\n <div key={firstLevelItem.groupTitle} className={b('group')}>\n <span className={b('group-heading')}>\n {firstLevelItem.groupTitle}\n </span>\n {firstLevelItem.items.map((item) => {\n return renderMenuItem(\n item,\n onChange,\n activeItemId,\n focusItemId,\n );\n })}\n </div>\n );\n }\n return renderMenuItem(firstLevelItem, onChange, activeItemId, focusItemId);\n })}\n </div>\n );\n },\n);\n\nfunction renderMenuItem(\n item: Item,\n onChange: (id: string) => void,\n activeItemId: string | undefined,\n focusItemId: string | undefined,\n) {\n return (\n <span\n key={item.title}\n className={b('item', {\n selected: activeItemId === item.id,\n disabled: item.disabled,\n focused: focusItemId === item.id,\n badge: item.withBadge,\n })}\n onClick={() => {\n if (!item.disabled) {\n onChange(item.id);\n }\n }}\n data-id={item.id}\n >\n {item.icon ? <Icon size={16} {...item.icon} className={b('item-icon')} /> : undefined}\n <span>{item.title}</span>\n </span>\n );\n}\n\nfunction focusNext(container: HTMLElement, focused: string | undefined, direction: number) {\n const elements = container.querySelectorAll(`.${b('item')}:not(.${b('item')}_disabled)`);\n if (elements.length === 0) {\n return undefined;\n }\n\n let currentIndex = direction > 0 ? -1 : 0;\n if (focused) {\n currentIndex = Array.prototype.findIndex.call(\n elements,\n (element) => element.getAttribute('data-id') === focused,\n );\n }\n\n currentIndex = (elements.length + currentIndex + direction) % elements.length;\n return elements[currentIndex].getAttribute('data-id') ?? undefined;\n}\n","import React from 'react';\nimport {Tabs, TabsItemProps} from '@gravity-ui/uikit';\nimport {block} from '../../utils/cn';\nimport {SettingsMenuProps} from '../types';\n\nimport './SettingsMenuMobile.scss';\n\nconst b = block('settings-menu-mobile');\n\nexport const SettingsMenuMobile = ({\n items,\n onChange,\n activeItemId,\n className,\n}: SettingsMenuProps) => {\n const ref = React.useRef<HTMLDivElement>(null);\n\n const tabItems = React.useMemo(() => {\n const tabItems: TabsItemProps[] = [];\n\n items.forEach((firstLevelItem) => {\n if ('groupTitle' in firstLevelItem) {\n tabItems.push(\n ...firstLevelItem.items.map(({id, title, disabled, withBadge}) => ({\n id,\n title,\n disabled,\n className: b('item', {badge: withBadge}),\n })),\n );\n } else {\n const {id, title, disabled, withBadge} = firstLevelItem;\n tabItems.push({id, title, disabled, className: b('item', {badge: withBadge})});\n }\n });\n return tabItems;\n }, [items]);\n\n const handleTouchMove = (e: React.TouchEvent<HTMLDivElement>) => {\n e.stopPropagation();\n };\n\n return (\n <div ref={ref} onTouchMove={handleTouchMove}>\n <Tabs\n items={tabItems}\n className={b(null, className)}\n size=\"l\"\n activeTab={activeItemId}\n onSelectTab={onChange}\n />\n </div>\n );\n};\n","import {registerKeyset} from '../../utils/registerKeyset';\n\nimport en from './en.json';\nimport ru from './ru.json';\n\nconst COMPONENT = 'Settings';\nexport default registerKeyset({en, ru}, COMPONENT);\n","import React from 'react';\nimport {IconProps} from '@gravity-ui/uikit';\nimport {escapeStringForRegExp, invariant} from './helpers';\nimport {SettingsSelection} from './Selection/types';\n\nexport type SettingsMenu = (SettingsMenuGroup | SettingsMenuItem)[];\n\ninterface SettingsMenuGroup {\n groupTitle: string;\n items: SettingsMenuItem[];\n}\n\ninterface SettingsMenuItem {\n id: string;\n title: string;\n icon?: IconProps;\n withBadge?: boolean;\n disabled?: boolean;\n}\n\nexport interface SettingsPage {\n id: string;\n sections: SettingsPageSection[];\n hidden?: boolean;\n withBadge?: boolean;\n}\n\nexport interface SettingsPageSection {\n id?: string;\n title: string;\n header?: React.ReactNode;\n items: SettingsItem[];\n hidden?: boolean;\n withBadge?: boolean;\n showTitle?: boolean;\n}\n\nexport interface SettingsItem {\n id?: string;\n title: string;\n element: React.ReactElement;\n hidden: boolean;\n titleComponent?: React.ReactNode;\n renderTitleComponent?: (highlightedTitle: React.ReactNode | null) => React.ReactNode;\n}\n\nexport interface SelectedSettingsPart {\n page?: SettingsPage;\n section?: SettingsPageSection;\n setting?: SettingsItem;\n}\n\ninterface SettingsDescription {\n menu: SettingsMenu;\n pages: Record<string, SettingsPage>;\n}\nexport function getSettingsFromChildren(\n children: React.ReactNode,\n searchText = '',\n): SettingsDescription {\n // 'abc def fg' -> abc.*?cde.*?fg\n const preparedFilter = escapeStringForRegExp(searchText).replace(/\\s+/g, '.*?');\n const filterRe = new RegExp(preparedFilter, 'i');\n\n return getSettingsFromChildrenRecursive(children, '', filterRe);\n}\n\nfunction getSettingsFromChildrenRecursive(\n children: React.ReactNode,\n basepath = '',\n filterRe: RegExp,\n): SettingsDescription {\n const menu: SettingsMenu = [];\n const pages: Record<string, SettingsPage> = {};\n let hasGroup = false;\n let hasItems = false;\n React.Children.forEach(children, (element) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements.\n return;\n }\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n const {menu: menuFragment, pages: pagesFragment} = getSettingsFromChildrenRecursive(\n element.props.children,\n basepath,\n filterRe,\n );\n menu.push(...menuFragment);\n Object.assign(pages, pagesFragment);\n } else if (element.props.groupTitle) {\n if (process.env.NODE_ENV === 'development') {\n invariant(!hasItems, 'Setting menu must not mix groups and pages on one level');\n }\n\n const pageId = `${basepath}/${element.props.id ?? element.props.groupTitle}`;\n hasGroup = true;\n\n const {menu: menuFragment, pages: pagesFragment} = getSettingsFromChildrenRecursive(\n element.props.children,\n pageId,\n filterRe,\n );\n\n if (process.env.NODE_ENV === 'development') {\n const hasInnerGroup = menuFragment.some((item) => 'groupTitle' in item);\n invariant(\n !hasInnerGroup,\n `Group ${element.props.groupTitle} should not include groups`,\n );\n }\n\n menu.push({\n groupTitle: element.props.groupTitle,\n // @ts-ignore\n items: menuFragment,\n });\n Object.assign(pages, pagesFragment);\n } else {\n hasItems = true;\n const pageId = `${basepath}/${element.props.id ?? element.props.title}`;\n\n if (process.env.NODE_ENV === 'development') {\n invariant(Boolean(element.props.title), 'Component must include title prop');\n invariant(!hasGroup, 'Setting menu must not mix groups and pages on one level');\n invariant(!pages[pageId], `Setting menu page id must be uniq (${pageId})`);\n }\n\n pages[pageId] = getSettingsPageFromChildren(element.props.children, filterRe);\n pages[pageId].id = pageId;\n menu.push({\n id: pageId,\n title: element.props.title,\n icon: element.props.icon,\n withBadge: pages[pageId].withBadge,\n disabled: pages[pageId].hidden,\n });\n }\n });\n return {menu, pages};\n}\n\nfunction getSettingsPageFromChildren(children: React.ReactNode, filterRe: RegExp): SettingsPage {\n const page: SettingsPage = {id: '', sections: [], hidden: true};\n React.Children.forEach(children, (element) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements.\n return;\n }\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n const {sections, withBadge, hidden} = getSettingsPageFromChildren(\n element.props.children,\n filterRe,\n );\n page.sections.push(...sections);\n page.withBadge = withBadge || page.withBadge;\n page.hidden = hidden && page.hidden;\n } else {\n const {withBadge, showTitle = true} = element.props;\n const {items, hidden} = getSettingsItemsFromChildren(element.props.children, filterRe);\n page.withBadge = withBadge || page.withBadge;\n page.hidden = hidden && page.hidden;\n page.sections.push({\n ...element.props,\n withBadge,\n items,\n hidden,\n showTitle,\n });\n }\n });\n return page;\n}\n\nfunction getSettingsItemsFromChildren(children: React.ReactNode, filterRe: RegExp) {\n let hidden = true;\n const items: SettingsItem[] = [];\n React.Children.forEach(children, (element) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements.\n return;\n }\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n const fragmentItems = getSettingsItemsFromChildren(element.props.children, filterRe);\n items.push(...fragmentItems.items);\n hidden = hidden && fragmentItems.hidden;\n } else {\n const item: SettingsItem = {\n ...element.props,\n element,\n hidden: !filterRe.test(element.props.title),\n };\n items.push(item);\n hidden = hidden && item.hidden;\n }\n });\n return {items, hidden};\n}\n\nexport function getSelectedSettingsPart(\n pages: Record<string, SettingsPage>,\n selection: SettingsSelection,\n): SelectedSettingsPart {\n if (!selection.settingId && !selection.section && !selection.page) {\n return {};\n }\n\n for (const page of Object.values(pages)) {\n if (!selection.settingId && !selection.section) {\n if (selection.page !== page.id) continue;\n\n return {page};\n }\n\n for (const section of page.sections) {\n if (selection.settingId) {\n for (const setting of section.items) {\n if (setting.id === selection.settingId) {\n return {page, section, setting};\n }\n }\n } else if (\n selection.section &&\n ('id' in selection.section\n ? selection.section.id === section.id\n : selection.section.title === section.title)\n ) {\n return {page, section};\n }\n }\n }\n\n return {};\n}\n","import React from 'react';\nimport {SelectedSettingsPart, SettingsPage, getSelectedSettingsPart} from '../collect-settings';\nimport {SettingsSelection} from './types';\n\ninterface ContextValue extends SelectedSettingsPart {\n selectedRef?: React.RefObject<HTMLDivElement>;\n}\n\nconst defaultValue: ContextValue = {};\n\nconst context = React.createContext(defaultValue);\ncontext.displayName = 'SettingsSelectionContext';\n\nexport function useSettingsSelectionProviderValue(\n pages: Record<string, SettingsPage>,\n selection: SettingsSelection | undefined,\n): ContextValue {\n const selectedRef = React.useRef<HTMLDivElement>(null);\n\n const contextValue: ContextValue = React.useMemo(() => {\n if (!selection) return {selectedRef};\n\n return {selectedRef, ...getSelectedSettingsPart(pages, selection)};\n }, [pages, selection]);\n\n return contextValue;\n}\n\nexport const SettingsSelectionContextProvider = context.Provider;\n\nexport function useSettingsSelectionContext() {\n return React.useContext(context);\n}\n","import {SelectedSettingsPart, SettingsPageSection} from '../collect-settings';\n\nexport function isSectionSelected(\n selected: SelectedSettingsPart,\n pageId: string,\n section: SettingsPageSection,\n) {\n if (!selected.section || selected.setting) {\n return false;\n } else if (selected.section.id && selected.section.id === section.id) {\n return true;\n } else if (\n selected.page?.id === pageId &&\n selected.section.title &&\n selected.section.title === section.title\n ) {\n return true;\n } else {\n return false;\n }\n}\n","import React from 'react';\nimport {block} from '../utils/cn';\nimport identity from 'lodash/identity';\n\nimport {Flex, IconProps, Loader} from '@gravity-ui/uikit';\nimport {SettingsSearch} from './SettingsSearch/SettingsSearch';\nimport {SettingsMenu, SettingsMenuInstance} from './SettingsMenu/SettingsMenu';\nimport {SettingsMenuMobile} from './SettingsMenuMobile/SettingsMenuMobile';\nimport {Title} from '../Title';\nimport i18n from './i18n';\n\nimport type {\n SettingsItem,\n SettingsMenu as SettingsMenuType,\n SettingsPageSection,\n} from './collect-settings';\nimport {getSettingsFromChildren} from './collect-settings';\nimport {escapeStringForRegExp} from './helpers';\n\nimport {SettingsSelection} from './Selection';\nimport {\n SettingsSelectionContextProvider,\n useSettingsSelectionContext,\n useSettingsSelectionProviderValue,\n} from './Selection/context';\nimport {isSectionSelected} from './Selection/utils';\n\nimport './Settings.scss';\n\nconst b = block('settings');\n\nexport interface SettingsProps {\n children: React.ReactNode;\n title?: string;\n filterPlaceholder?: string;\n emptyPlaceholder?: string;\n initialPage?: string;\n initialSearch?: string;\n selection?: SettingsSelection;\n onPageChange?: (page: string | undefined) => void;\n renderNotFound?: () => React.ReactNode;\n renderLoading?: () => React.ReactNode;\n loading?: boolean;\n view?: 'normal' | 'mobile';\n onClose?: () => void;\n renderRightAdornment?: (item: SettingsItemProps) => React.ReactNode;\n renderSectionRightAdornment?: (section: SettingsPageSection) => React.ReactNode;\n showRightAdornmentOnHover?: boolean;\n}\n\nexport interface SettingsGroupProps {\n id?: string;\n groupTitle: string;\n children: React.ReactNode;\n}\n\nexport interface SettingsPageProps {\n id?: string;\n title: string;\n icon?: IconProps;\n children: React.ReactNode;\n}\n\nexport interface SettingsSectionProps {\n id?: string;\n title: string;\n header?: React.ReactNode;\n children: React.ReactNode;\n withBadge?: boolean;\n showTitle?: boolean;\n}\n\nexport interface SettingsItemProps {\n id?: string;\n title: string;\n highlightedTitle?: React.ReactNode | null;\n renderTitleComponent?: (highlightedTitle: React.ReactNode | null) => React.ReactNode;\n align?: 'top' | 'center';\n children: React.ReactNode;\n withBadge?: boolean;\n mode?: 'row';\n description?: React.ReactNode;\n}\n\nexport interface SettingsContextType\n extends Pick<\n SettingsProps,\n 'renderRightAdornment' | 'renderSectionRightAdornment' | 'showRightAdornmentOnHover'\n > {}\n\nconst SettingsContext = React.createContext<SettingsContextType>({});\n\nexport const useSettingsContext = () => React.useContext(SettingsContext);\n\nexport function Settings({\n loading,\n renderLoading,\n children,\n view = 'normal',\n renderRightAdornment,\n renderSectionRightAdornment,\n showRightAdornmentOnHover = true,\n ...props\n}: SettingsProps) {\n if (loading) {\n return (\n <div className={b({loading: true, view})}>\n {typeof renderLoading === 'function' ? (\n renderLoading()\n ) : (\n <Loader className={b('loader')} size=\"m\" />\n )}\n </div>\n );\n }\n\n return (\n <SettingsContext.Provider\n value={{renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover}}\n >\n <SettingsContent view={view} {...props}>\n {children}\n </SettingsContent>\n </SettingsContext.Provider>\n );\n}\n\nconst getPageTitleById = (menu: SettingsMenuType, activePage: string) => {\n for (const firstLevel of menu) {\n if ('groupTitle' in firstLevel) {\n for (const secondLevel of firstLevel.items)\n if (secondLevel.id === activePage) return secondLevel.title;\n } else if (firstLevel.id === activePage) return firstLevel.title;\n }\n\n return '';\n};\n\ntype SettingsContentProps = Omit<SettingsProps, 'loading' | 'renderLoading'>;\nfunction SettingsContent({\n initialPage,\n initialSearch,\n selection,\n children,\n renderNotFound,\n title = i18n('label_title'),\n filterPlaceholder = i18n('label_filter-placeholder'),\n emptyPlaceholder = i18n('label_empty-placeholder'),\n view,\n onPageChange,\n onClose,\n}: SettingsContentProps) {\n const {renderSectionRightAdornment, showRightAdornmentOnHover} = useSettingsContext();\n\n const [search, setSearch] = React.useState(initialSearch ?? '');\n const {menu, pages} = getSettingsFromChildren(children, search);\n\n const selected = useSettingsSelectionProviderValue(pages, selection);\n\n const pageKeys = Object.keys(pages);\n const selectionInitialPage =\n selected.page && pageKeys.includes(selected.page.id) ? selected.page.id : undefined;\n const [selectedPage, setCurrentPage] = React.useState<string | undefined>(\n selectionInitialPage ||\n (initialPage && pageKeys.includes(initialPage) ? initialPage : undefined),\n );\n const searchInputRef = React.useRef<HTMLInputElement>(null);\n const menuRef = React.useRef<SettingsMenuInstance>(null);\n const isMobile = view === 'mobile';\n\n React.useEffect(() => {\n menuRef.current?.clearFocus();\n }, [search]);\n\n React.useEffect(() => {\n const handler = () => {\n menuRef.current?.clearFocus();\n };\n window.addEventListener('click', handler);\n return () => {\n window.removeEventListener('click', handler);\n };\n }, []);\n\n let activePage = selectedPage;\n if (!activePage || pages[activePage]?.hidden) {\n activePage = Object.values(pages).find(({hidden}) => !hidden)?.id;\n }\n\n const handlePageChange = (newPage: string | undefined) => {\n setCurrentPage((prevPage) => {\n if (prevPage !== newPage) {\n onPageChange?.(newPage);\n }\n return newPage;\n });\n };\n\n React.useEffect(() => {\n if (activePage !== selectedPage) {\n handlePageChange(activePage);\n }\n });\n\n React.useEffect(() => {\n if (!selectionInitialPage) return;\n setCurrentPage(selectionInitialPage);\n }, [selectionInitialPage]);\n\n React.useEffect(() => {\n if (selected.selectedRef?.current) {\n selected.selectedRef.current.scrollIntoView();\n }\n }, [selected.selectedRef]);\n\n const renderSetting = ({title: settingTitle, element}: SettingsItem) => {\n return (\n <div key={settingTitle} className={b('section-item')}>\n {React.cloneElement(element, {\n ...element.props,\n highlightedTitle:\n search && settingTitle ? prepareTitle(settingTitle, search) : settingTitle,\n })}\n </div>\n );\n };\n\n const renderSection = (page: string, section: SettingsPageSection) => {\n const isSelected = isSectionSelected(selected, page, section);\n\n return (\n <div\n key={section.title}\n className={b('section', {selected: isSelected})}\n ref={isSelected ? selected.selectedRef : undefined}\n >\n {section.showTitle && (\n <h3 className={b('section-heading')}>\n {renderSectionRightAdornment ? (\n <Flex gap={2} alignItems={'center'}>\n {section.title}\n <div\n className={b('section-right-adornment', {\n hidden: showRightAdornmentOnHover,\n })}\n >\n {renderSectionRightAdornment(section)}\n </div>\n </Flex>\n ) : (\n section.title\n )}\n </h3>\n )}\n\n {section.header &&\n (isMobile ? (\n <div className={b('section-subheader')}>{section.header}</div>\n ) : (\n section.header\n ))}\n\n {section.items.map((setting) => (setting.hidden ? null : renderSetting(setting)))}\n </div>\n );\n };\n\n const renderPageContent = (page: string | undefined) => {\n if (!page) {\n return typeof renderNotFound === 'function' ? (\n renderNotFound()\n ) : (\n <div className={b('not-found')}>{emptyPlaceholder}</div>\n );\n }\n\n const filteredSections = pages[page].sections.filter((section) => !section.hidden);\n\n return (\n <>\n {!isMobile && (\n <Title hasSeparator onClose={onClose}>\n {getPageTitleById(menu, page)}\n </Title>\n )}\n\n <div className={b('content')}>\n {filteredSections.map((section) => renderSection(page, section))}\n </div>\n </>\n );\n };\n\n return (\n <SettingsSelectionContextProvider value={selected}>\n <div className={b({view})}>\n {isMobile ? (\n <>\n <SettingsSearch\n inputRef={searchInputRef}\n className={b('search')}\n initialValue={initialSearch}\n onChange={setSearch}\n autoFocus={false}\n inputSize={'xl'}\n />\n <SettingsMenuMobile\n items={menu}\n onChange={handlePageChange}\n activeItemId={activePage}\n className={b('tabs')}\n />\n </>\n ) : (\n <div\n className={b('menu')}\n onClick={() => {\n if (searchInputRef.current) {\n searchInputRef.current.focus();\n }\n }}\n onKeyDown={(event) => {\n if (menuRef.current) {\n if (menuRef.current.handleKeyDown(event)) {\n event.preventDefault();\n }\n }\n }}\n >\n <Title>{title}</Title>\n <SettingsSearch\n inputRef={searchInputRef}\n className={b('search')}\n initialValue={initialSearch}\n onChange={setSearch}\n placeholder={filterPlaceholder}\n autoFocus\n />\n <SettingsMenu\n ref={menuRef}\n items={menu}\n onChange={handlePageChange}\n activeItemId={activePage}\n />\n </div>\n )}\n <div className={b('page')}>{renderPageContent(activePage)}</div>\n </div>\n </SettingsSelectionContextProvider>\n );\n}\n\nSettings.Group = function SettingsGroup({children}: SettingsGroupProps) {\n return <React.Fragment>{children}</React.Fragment>;\n};\n\nSettings.Page = function SettingsPage({children}: SettingsPageProps) {\n return <React.Fragment>{children}</React.Fragment>;\n};\n\nSettings.Section = function SettingsSection({children}: SettingsSectionProps) {\n return <React.Fragment>{children}</React.Fragment>;\n};\n\nSettings.Item = function SettingsItem(setting: SettingsItemProps) {\n const {\n id,\n highlightedTitle,\n children,\n align = 'center',\n withBadge,\n renderTitleComponent = identity,\n mode,\n description,\n } = setting;\n\n const selected = useSettingsSelectionContext();\n const isSettingSelected = selected.setting && selected.setting.id === id;\n\n const {renderRightAdornment, showRightAdornmentOnHover} = useSettingsContext();\n const titleNode = (\n <span className={b('item-title', {badge: withBadge})}>\n {renderTitleComponent(highlightedTitle)}\n </span>\n );\n return (\n <div\n className={b('item', {align, mode, selected: isSettingSelected})}\n ref={isSettingSelected ? selected.selectedRef : undefined}\n >\n <label className={b('item-heading')}>\n {renderRightAdornment ? (\n <Flex className={b('item-title-wrapper')} gap={3}>\n {titleNode}\n <div\n className={b('item-right-adornment', {\n hidden: showRightAdornmentOnHover,\n })}\n >\n {renderRightAdornment(setting)}\n </div>\n </Flex>\n ) : (\n titleNode\n )}\n {description ? <span className={b('item-description')}>{description}</span> : null}\n </label>\n <div className={b('item-content')}>{children}</div>\n </div>\n );\n};\n\nfunction prepareTitle(string: string, search: string) {\n let temp = string.slice(0);\n const title: React.ReactNode[] = [];\n const parts = escapeStringForRegExp(search).split(' ').filter(Boolean);\n let key = 0;\n for (const part of parts) {\n const regex = new RegExp(part, 'ig');\n const match = regex.exec(temp);\n if (match) {\n const m = match[0];\n const i = match.index;\n if (i > 0) {\n title.push(temp.slice(0, i));\n }\n title.push(\n <strong key={key++} className={b('found')}>\n {m}\n </strong>,\n );\n temp = temp.slice(i + m.length);\n }\n }\n if (temp) {\n title.push(temp);\n }\n return title;\n}\n"],"names":["React","b","block","debounce","debounceFn","TextInput","Icon","Tabs","registerKeyset","__rest","Loader","Flex","Title","identity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,EAAE,OAAO,KAAK,CAAC;AACf,CAAC;AACD;AACA,IAAA,UAAc,GAAG,QAAQ;;AChBnB,SAAU,iBAAiB,CAC7B,IAAO,EAAA;AAEP,IAAA,MAAM,OAAO,GAAGA,gBAAK,CAAC,MAAM,EAAK,CAAC;AAElC,IAAAA,gBAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;AACvB,QAAA,OAAO,MAAK;AACR,YAAA,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;AAChC,SAAC,CAAC;AACN,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAOA,gBAAK,CAAC,WAAW,CAAC,CAAC,GAAG,IAAmB,KAAI;AAChD,QAAA,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE;AACvC,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AACnC,SAAA;AACD,QAAA,OAAO,SAAS,CAAC;KACpB,EAAE,EAAE,CAAC,CAAC;AACX,CAAC;AAEK,SAAU,UAAU,CAAI,KAAQ,EAAA;IAClC,MAAM,GAAG,GAAGA,gBAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChC,IAAA,GAAG,CAAC,OAAO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GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,QAAA,IAAI,KAAK,EAAE;AACP,YAAA,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACnB,YAAA,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,EAAE;AACP,gBAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChC,aAAA;AACD,YAAA,KAAK,CAAC,IAAI,CACNA,oDAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,IACpC,CAAC,CACG,CACZ,CAAC;YACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AACnC,SAAA;AACJ,KAAA;AACD,IAAA,IAAI,IAAI,EAAE;AACN,QAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACjB;;;;;"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SelectedSettingsPart, SettingsPage } from '../collect-settings';
3
+ import { SettingsSelection } from './types';
4
+ interface ContextValue extends SelectedSettingsPart {
5
+ selectedRef?: React.RefObject<HTMLDivElement>;
6
+ }
7
+ export declare function useSettingsSelectionProviderValue(pages: Record<string, SettingsPage>, selection: SettingsSelection | undefined): ContextValue;
8
+ export declare const SettingsSelectionContextProvider: React.Provider<ContextValue>;
9
+ export declare function useSettingsSelectionContext(): ContextValue;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './context';
2
+ export * from './types';
@@ -0,0 +1,9 @@
1
+ export interface SettingsSelection {
2
+ page?: string;
3
+ section?: {
4
+ id: string;
5
+ } | {
6
+ title: string;
7
+ };
8
+ settingId?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ import { SelectedSettingsPart, SettingsPageSection } from '../collect-settings';
2
+ export declare function isSectionSelected(selected: SelectedSettingsPart, pageId: string, section: SettingsPageSection): boolean;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IconProps } from '@gravity-ui/uikit';
3
+ import type { SettingsPageSection } from './collect-settings';
4
+ import { SettingsSelection } from './Selection';
3
5
  import './Settings.scss';
4
6
  export interface SettingsProps {
5
7
  children: React.ReactNode;
@@ -8,13 +10,15 @@ export interface SettingsProps {
8
10
  emptyPlaceholder?: string;
9
11
  initialPage?: string;
10
12
  initialSearch?: string;
13
+ selection?: SettingsSelection;
11
14
  onPageChange?: (page: string | undefined) => void;
12
15
  renderNotFound?: () => React.ReactNode;
13
16
  renderLoading?: () => React.ReactNode;
14
17
  loading?: boolean;
15
18
  view?: 'normal' | 'mobile';
16
19
  onClose?: () => void;
17
- renderRightAdornment?: (item: Pick<SettingsItemProps, 'title'>) => React.ReactNode;
20
+ renderRightAdornment?: (item: SettingsItemProps) => React.ReactNode;
21
+ renderSectionRightAdornment?: (section: SettingsPageSection) => React.ReactNode;
18
22
  showRightAdornmentOnHover?: boolean;
19
23
  }
20
24
  export interface SettingsGroupProps {
@@ -29,6 +33,7 @@ export interface SettingsPageProps {
29
33
  children: React.ReactNode;
30
34
  }
31
35
  export interface SettingsSectionProps {
36
+ id?: string;
32
37
  title: string;
33
38
  header?: React.ReactNode;
34
39
  children: React.ReactNode;
@@ -36,6 +41,7 @@ export interface SettingsSectionProps {
36
41
  showTitle?: boolean;
37
42
  }
38
43
  export interface SettingsItemProps {
44
+ id?: string;
39
45
  title: string;
40
46
  highlightedTitle?: React.ReactNode | null;
41
47
  renderTitleComponent?: (highlightedTitle: React.ReactNode | null) => React.ReactNode;
@@ -45,13 +51,13 @@ export interface SettingsItemProps {
45
51
  mode?: 'row';
46
52
  description?: React.ReactNode;
47
53
  }
48
- export interface SettingsContextType extends Pick<SettingsProps, 'renderRightAdornment' | 'showRightAdornmentOnHover'> {
54
+ export interface SettingsContextType extends Pick<SettingsProps, 'renderRightAdornment' | 'renderSectionRightAdornment' | 'showRightAdornmentOnHover'> {
49
55
  }
50
56
  export declare const useSettingsContext: () => SettingsContextType;
51
- export declare function Settings({ loading, renderLoading, children, view, renderRightAdornment, showRightAdornmentOnHover, ...props }: SettingsProps): React.JSX.Element;
57
+ export declare function Settings({ loading, renderLoading, children, view, renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover, ...props }: SettingsProps): React.JSX.Element;
52
58
  export declare namespace Settings {
53
59
  var Group: ({ children }: SettingsGroupProps) => React.JSX.Element;
54
60
  var Page: ({ children }: SettingsPageProps) => React.JSX.Element;
55
61
  var Section: ({ children }: SettingsSectionProps) => React.JSX.Element;
56
- var Item: ({ title, highlightedTitle, children, align, withBadge, renderTitleComponent, mode, description, }: SettingsItemProps) => React.JSX.Element;
62
+ var Item: (setting: SettingsItemProps) => React.JSX.Element;
57
63
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IconProps } from '@gravity-ui/uikit';
3
+ import { SettingsSelection } from './Selection/types';
3
4
  export type SettingsMenu = (SettingsMenuGroup | SettingsMenuItem)[];
4
5
  interface SettingsMenuGroup {
5
6
  groupTitle: string;
@@ -18,7 +19,8 @@ export interface SettingsPage {
18
19
  hidden?: boolean;
19
20
  withBadge?: boolean;
20
21
  }
21
- interface SettingsPageSection {
22
+ export interface SettingsPageSection {
23
+ id?: string;
22
24
  title: string;
23
25
  header?: React.ReactNode;
24
26
  items: SettingsItem[];
@@ -26,16 +28,23 @@ interface SettingsPageSection {
26
28
  withBadge?: boolean;
27
29
  showTitle?: boolean;
28
30
  }
29
- interface SettingsItem {
31
+ export interface SettingsItem {
32
+ id?: string;
30
33
  title: string;
31
34
  element: React.ReactElement;
32
35
  hidden: boolean;
33
36
  titleComponent?: React.ReactNode;
34
37
  renderTitleComponent?: (highlightedTitle: React.ReactNode | null) => React.ReactNode;
35
38
  }
39
+ export interface SelectedSettingsPart {
40
+ page?: SettingsPage;
41
+ section?: SettingsPageSection;
42
+ setting?: SettingsItem;
43
+ }
36
44
  interface SettingsDescription {
37
45
  menu: SettingsMenu;
38
46
  pages: Record<string, SettingsPage>;
39
47
  }
40
48
  export declare function getSettingsFromChildren(children: React.ReactNode, searchText?: string): SettingsDescription;
49
+ export declare function getSelectedSettingsPart(pages: Record<string, SettingsPage>, selection: SettingsSelection): SelectedSettingsPart;
41
50
  export {};
@@ -12,7 +12,7 @@ var registerKeyset = require('./registerKeyset-f4ce9ee7.js');
12
12
  var ActionBar = require('./ActionBar-393db3ea.js');
13
13
  var Title = require('./Title-d58ff158.js');
14
14
  var HotkeysPanel = require('./HotkeysPanel-9e5af200.js');
15
- var Settings = require('./Settings-014971f7.js');
15
+ var Settings = require('./Settings-4b4e8a46.js');
16
16
  var FooterItem$1 = require('./FooterItem-01b32eb7.js');
17
17
  require('./tslib.es6-705c6589.js');
18
18
  require('react');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Settings = require('./Settings-014971f7.js');
5
+ var Settings = require('./Settings-4b4e8a46.js');
6
6
  require('./tslib.es6-705c6589.js');
7
7
  require('react');
8
8
  require('./style-inject.es-935afc04.js');