@lt-ui/uikit 0.0.1 → 0.0.3

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.
Files changed (210) hide show
  1. package/_internal/base-button/styles.module.css +1 -1
  2. package/_internal/field/_motion.css +0 -0
  3. package/_internal/field/field.module.css +21 -23
  4. package/_internal/floating/use-floating.d.ts +1 -1
  5. package/_internal/floating/use-floating.js +6 -2
  6. package/_internal/picker/picker-field.module.css +1 -1
  7. package/_internal/picker/picker-sheet.module.css +1 -1
  8. package/accordion/styles.module.css +3 -4
  9. package/alert/styles/alert.module.css +8 -8
  10. package/avatar/avatar-group.module.css +1 -1
  11. package/avatar/styles.module.css +3 -3
  12. package/badge/styles.module.css +3 -3
  13. package/breadcrumbs/styles.module.css +4 -4
  14. package/button/styles.module.css +7 -7
  15. package/calendar/styles.module.css +11 -11
  16. package/caption/styles.module.css +1 -1
  17. package/checkbox/styles/style.module.css +10 -12
  18. package/chip/styles.module.css +3 -3
  19. package/cjs/_internal/base-button/styles.module.css +1 -1
  20. package/cjs/_internal/field/_motion.css +0 -0
  21. package/cjs/_internal/field/field.module.css +21 -23
  22. package/cjs/_internal/floating/use-floating.js +6 -2
  23. package/cjs/_internal/picker/picker-field.module.css +1 -1
  24. package/cjs/_internal/picker/picker-sheet.module.css +1 -1
  25. package/cjs/accordion/styles.module.css +3 -4
  26. package/cjs/alert/styles/alert.module.css +8 -8
  27. package/cjs/avatar/avatar-group.module.css +1 -1
  28. package/cjs/avatar/styles.module.css +3 -3
  29. package/cjs/badge/styles.module.css +3 -3
  30. package/cjs/breadcrumbs/styles.module.css +4 -4
  31. package/cjs/button/styles.module.css +7 -7
  32. package/cjs/calendar/styles.module.css +11 -11
  33. package/cjs/caption/styles.module.css +1 -1
  34. package/cjs/checkbox/styles/style.module.css +10 -12
  35. package/cjs/chip/styles.module.css +3 -3
  36. package/cjs/date-picker/styles.module.css +10 -10
  37. package/cjs/drawer/styles.module.css +10 -12
  38. package/cjs/file/styles.module.css +3 -4
  39. package/cjs/hint/styles/buttons.module.css +2 -2
  40. package/cjs/hint/styles/hint-content.module.css +3 -3
  41. package/cjs/hint/styles/hint.module.css +2 -2
  42. package/cjs/image/image-viewer.js +3 -13
  43. package/cjs/image/image.js +4 -27
  44. package/cjs/image/use-image-preview.js +32 -0
  45. package/cjs/image/use-image-viewer.js +21 -0
  46. package/cjs/image/viewer.module.css +1 -1
  47. package/cjs/list/list-divider/styles.module.css +2 -2
  48. package/cjs/list/list-item/styles.module.css +2 -2
  49. package/cjs/list/list-section/styles.module.css +4 -4
  50. package/cjs/modal/modal.js +4 -10
  51. package/cjs/modal/styles/_animations.css +2 -2
  52. package/cjs/modal/styles/modal-footer.module.css +3 -3
  53. package/cjs/modal/styles/modal-header.module.css +5 -5
  54. package/cjs/modal/styles/modal.module.css +9 -4
  55. package/cjs/modal/use-modal.js +15 -1
  56. package/cjs/navigation/navigation-compact.js +2 -30
  57. package/cjs/navigation/navigation-row.js +5 -65
  58. package/cjs/navigation/navigation-views.js +3 -57
  59. package/cjs/navigation/navigation.js +2 -1
  60. package/cjs/navigation/styles/navigation.module.css +98 -81
  61. package/cjs/navigation/use-navigation-flyout.js +39 -0
  62. package/cjs/navigation/use-navigation-panel-stages.js +23 -0
  63. package/cjs/navigation/use-navigation-row.js +39 -0
  64. package/cjs/pagination/styles.module.css +2 -2
  65. package/cjs/pin-input/styles.module.css +2 -2
  66. package/cjs/progress-bar/styles.module.css +1 -1
  67. package/cjs/quantity-input/styles.module.css +3 -3
  68. package/cjs/radio/styles.module.css +4 -5
  69. package/cjs/radio-group/styles.module.css +1 -1
  70. package/cjs/segmented-control/styles/segmented-control-item.module.css +9 -9
  71. package/cjs/segmented-control/styles/segmented-control.module.css +4 -4
  72. package/cjs/select/components/select-field-multiselect-value.js +2 -2
  73. package/cjs/select/components/select-field.js +8 -6
  74. package/cjs/select/components/select-multiselect-panel.js +9 -67
  75. package/cjs/select/components/select-option-row.js +7 -53
  76. package/cjs/select/hooks/use-select-multiselect-panel-layout.js +53 -0
  77. package/cjs/select/hooks/use-select-option-row.js +23 -0
  78. package/cjs/select/hooks/use-select-view-model.js +3 -1
  79. package/cjs/select/styles/select-field.module.css +20 -1
  80. package/cjs/select/styles/select.module.css +2 -2
  81. package/cjs/select/views/select-view.js +4 -4
  82. package/cjs/select/views/styles.module.css +1 -1
  83. package/cjs/snackbar/snack-view.js +9 -42
  84. package/cjs/snackbar/styles/snack.module.css +1 -1
  85. package/cjs/snackbar/use-snack-view.js +16 -0
  86. package/cjs/switch/styles/base.module.css +2 -2
  87. package/cjs/tabs/styles/tab-list.module.css +1 -1
  88. package/cjs/tabs/styles/tab.module.css +6 -6
  89. package/cjs/tabs/tab-list.js +2 -20
  90. package/cjs/tabs/tab-panel.js +4 -39
  91. package/cjs/tabs/use-tab-list-navigation.js +27 -0
  92. package/cjs/tabs/use-tab-panel.js +12 -0
  93. package/cjs/textarea/styles.module.css +1 -1
  94. package/cjs/theme-provider/styles.module.css +6 -6
  95. package/cjs/time-picker/styles.module.css +9 -9
  96. package/cjs/time-picker/time-panel.js +2 -47
  97. package/cjs/time-picker/use-time-column-list.js +48 -0
  98. package/cjs/tooltip/tooltip.js +1 -1
  99. package/cjs/tree/styles.module.css +5 -5
  100. package/cjs/tree/tree-row.js +13 -73
  101. package/cjs/tree/tree-select.module.css +2 -2
  102. package/cjs/tree/use-tree-row.js +102 -0
  103. package/cjs/utils/class-names.js +3 -1
  104. package/date-picker/styles.module.css +10 -10
  105. package/drawer/styles.module.css +10 -12
  106. package/file/styles.module.css +3 -4
  107. package/hint/styles/buttons.module.css +2 -2
  108. package/hint/styles/hint-content.module.css +3 -3
  109. package/hint/styles/hint.module.css +2 -2
  110. package/image/image-viewer.js +3 -13
  111. package/image/image.js +5 -28
  112. package/image/use-image-preview.d.ts +10 -0
  113. package/image/use-image-preview.js +29 -0
  114. package/image/use-image-viewer.d.ts +8 -0
  115. package/image/use-image-viewer.js +18 -0
  116. package/image/viewer.module.css +1 -1
  117. package/input/fields/use-text-field.d.ts +2 -0
  118. package/list/list-divider/styles.module.css +2 -2
  119. package/list/list-item/styles.module.css +2 -2
  120. package/list/list-section/styles.module.css +4 -4
  121. package/masked-input/use-mask.d.ts +2 -0
  122. package/modal/modal.d.ts +1 -0
  123. package/modal/modal.js +4 -10
  124. package/modal/styles/_animations.css +2 -2
  125. package/modal/styles/modal-footer.module.css +3 -3
  126. package/modal/styles/modal-header.module.css +5 -5
  127. package/modal/styles/modal.module.css +9 -4
  128. package/modal/types.d.ts +5 -0
  129. package/modal/use-modal.d.ts +3 -1
  130. package/modal/use-modal.js +17 -3
  131. package/navigation/navigation-compact.d.ts +1 -2
  132. package/navigation/navigation-compact.js +3 -31
  133. package/navigation/navigation-row.d.ts +1 -2
  134. package/navigation/navigation-row.js +6 -33
  135. package/navigation/navigation-views.js +3 -24
  136. package/navigation/navigation.d.ts +1 -0
  137. package/navigation/navigation.js +2 -1
  138. package/navigation/styles/navigation.module.css +98 -81
  139. package/navigation/types.d.ts +3 -2
  140. package/navigation/use-navigation-flyout.d.ts +9 -0
  141. package/navigation/use-navigation-flyout.js +36 -0
  142. package/navigation/use-navigation-panel-stages.d.ts +5 -0
  143. package/navigation/use-navigation-panel-stages.js +20 -0
  144. package/navigation/use-navigation-row.d.ts +16 -0
  145. package/navigation/use-navigation-row.js +36 -0
  146. package/number-input/use-number-input.d.ts +2 -0
  147. package/package.json +6 -2
  148. package/pagination/styles.module.css +2 -2
  149. package/pin-input/styles.module.css +2 -2
  150. package/popover/types.d.ts +2 -2
  151. package/progress-bar/styles.module.css +1 -1
  152. package/quantity-input/styles.module.css +3 -3
  153. package/radio/styles.module.css +4 -5
  154. package/radio-group/styles.module.css +1 -1
  155. package/scss/_functions.scss +12 -24
  156. package/scss/_grid.scss +2 -2
  157. package/scss/_index.scss +1 -6
  158. package/scss/_interaction.scss +3 -3
  159. package/scss/_mixins.scss +5 -51
  160. package/scss/_tokens.generated.scss +578 -0
  161. package/scss/_tokens.scss +2 -396
  162. package/scss/_typography.scss +0 -1
  163. package/segmented-control/styles/segmented-control-item.module.css +9 -9
  164. package/segmented-control/styles/segmented-control.module.css +4 -4
  165. package/select/components/select-field-multiselect-value.d.ts +1 -0
  166. package/select/components/select-field-multiselect-value.js +2 -2
  167. package/select/components/select-field.d.ts +3 -1
  168. package/select/components/select-field.js +8 -6
  169. package/select/components/select-multiselect-panel.d.ts +3 -1
  170. package/select/components/select-multiselect-panel.js +8 -66
  171. package/select/components/select-option-row.js +7 -20
  172. package/select/hooks/use-select-multiselect-panel-layout.d.ts +14 -0
  173. package/select/hooks/use-select-multiselect-panel-layout.js +49 -0
  174. package/select/hooks/use-select-option-row.d.ts +13 -0
  175. package/select/hooks/use-select-option-row.js +20 -0
  176. package/select/hooks/use-select-view-model.d.ts +4 -2
  177. package/select/hooks/use-select-view-model.js +3 -1
  178. package/select/select.d.ts +3 -2
  179. package/select/styles/select-field.module.css +20 -1
  180. package/select/styles/select.module.css +2 -2
  181. package/select/types.d.ts +6 -3
  182. package/select/views/select-view.js +4 -4
  183. package/select/views/styles.module.css +1 -1
  184. package/snackbar/snack-view.js +7 -7
  185. package/snackbar/styles/snack.module.css +1 -1
  186. package/snackbar/use-snack-view.d.ts +8 -0
  187. package/snackbar/use-snack-view.js +13 -0
  188. package/switch/styles/base.module.css +2 -2
  189. package/tabs/styles/tab-list.module.css +1 -1
  190. package/tabs/styles/tab.module.css +6 -6
  191. package/tabs/tab-list.js +4 -22
  192. package/tabs/tab-panel.js +4 -6
  193. package/tabs/use-tab-list-navigation.d.ts +2 -0
  194. package/tabs/use-tab-list-navigation.js +24 -0
  195. package/tabs/use-tab-panel.d.ts +6 -0
  196. package/tabs/use-tab-panel.js +9 -0
  197. package/textarea/styles.module.css +1 -1
  198. package/theme-provider/styles.module.css +6 -6
  199. package/time-picker/styles.module.css +9 -9
  200. package/time-picker/time-panel.js +2 -47
  201. package/time-picker/use-time-column-list.d.ts +7 -0
  202. package/time-picker/use-time-column-list.js +45 -0
  203. package/tooltip/tooltip.js +1 -1
  204. package/tree/styles.module.css +5 -5
  205. package/tree/tree-row.js +15 -75
  206. package/tree/tree-select.module.css +2 -2
  207. package/tree/use-tree-row.d.ts +331 -0
  208. package/tree/use-tree-row.js +99 -0
  209. package/utils/class-names.d.ts +1 -1
  210. package/utils/class-names.js +3 -1
@@ -11,7 +11,7 @@ const normalize_value_1 = require("../utils/normalize-value");
11
11
  const use_select_1 = require("./use-select");
12
12
  const use_select_multiselect_panel_state_1 = require("./use-select-multiselect-panel-state");
13
13
  function useSelectViewModel(props, ref) {
14
- const { value, defaultValue, onUpdate, mode, options, showSearch, strict, filterOption, disabled, open, defaultOpen, onOpenChange, allowClear: allowClearProp, placeholder, searchValue, onSearch, searchDelay, closeOnSelect, clearSearchOnSelect, loading, fetching, minCharsToSearch, notFoundContent, minCharsContent, loadingContent, onListScroll: onListScrollProp, hasMore = false, onLoadMore, chipsVariant = 'none', defaultChipsExpanded = false, chipsExpandedMode = 'auto', showPanelHeader: showPanelHeaderProp, hideHeaderOnSearch = false, emptySelectionLabel, selectedCountLabel, overflowSelectedLabel, collapseLabel, clearLabel, dropdownMaxHeight, virtualized, multiselectChipsMaxRows, label, status, theme, caption, mobile, variant: variantProp, fullWidth, className, size: sizeProp, popoverClassName, dropdownWidth = 'field', placement = 'bottom-start', container, children, 'data-testid': testId = 'select', } = props;
14
+ const { value, defaultValue, onUpdate, mode, options, showSearch, strict, filterOption, disabled, open, defaultOpen, onOpenChange, allowClear: allowClearProp, placeholder, searchValue, onSearch, searchDelay, closeOnSelect, clearSearchOnSelect, loading, fetching, minCharsToSearch, notFoundContent, minCharsContent, loadingContent, onListScroll: onListScrollProp, hasMore = false, onLoadMore, chipsVariant = 'none', defaultChipsExpanded = false, chipsExpandedMode = 'auto', showPanelHeader: showPanelHeaderProp, hideHeaderOnSearch = false, emptySelectionLabel, selectedCountLabel, overflowSelectedLabel, collapseLabel, clearLabel, dropdownMaxHeight, virtualized, multiselectChipsMaxRows, label, startAdornment, status, theme, caption, mobile, variant: variantProp, fullWidth, className, size: sizeProp, popoverClassName, dropdownWidth = 'field', placement = 'bottom-start', container, children, 'data-testid': testId = 'select', } = props;
15
15
  // Подгрузка порциями: `onLoadMore` вызывается при прокрутке списка к концу, пока `hasMore` и не `fetching`
16
16
  const loadMore = (0, use_load_more_1.useLoadMore)({
17
17
  hasMore,
@@ -120,9 +120,11 @@ function useSelectViewModel(props, ref) {
120
120
  return {
121
121
  testId,
122
122
  dataProps: (0, data_attributes_1.getDataAttributes)(props),
123
+ ariaLabel: props['aria-label'],
123
124
  select,
124
125
  isMultiple,
125
126
  label,
127
+ startAdornment,
126
128
  status,
127
129
  theme,
128
130
  caption,
@@ -3,6 +3,25 @@
3
3
  --input-right-padding: var(--space-16);
4
4
  }
5
5
 
6
+ .trigger {
7
+ border-radius: var(--rounding-m);
8
+ }
9
+ .trigger > [aria-hidden=true] {
10
+ display: none;
11
+ }
12
+ @media (hover: hover) and (min-width: 768px) {
13
+ .trigger:hover {
14
+ background: var(--background-secondary);
15
+ }
16
+ }
17
+ .trigger:active {
18
+ background: var(--background-secondary);
19
+ }
20
+ .trigger:focus-within {
21
+ outline: 2px solid var(--control-primary);
22
+ outline-offset: 2px;
23
+ }
24
+
6
25
  .selectRoot_withClear {
7
26
  --field-cross-w: 24px;
8
27
  }
@@ -45,7 +64,7 @@
45
64
  }
46
65
 
47
66
  .selectValuePlaceholderReveal {
48
- animation: select-placeholder-reveal calc(var(--field-label-duration) / 2) var(--field-label-easing) calc(var(--field-label-duration) * 0.6) both;
67
+ animation: select-placeholder-reveal 0.1s ease-in-out 0.12s both;
49
68
  }
50
69
 
51
70
  @keyframes select-placeholder-reveal {
@@ -111,7 +111,7 @@
111
111
  gap: 6px;
112
112
  align-items: center;
113
113
  max-width: 100%;
114
- padding: 6px 8px 6px 12px;
114
+ padding: 6px var(--space-8) 6px var(--space-12);
115
115
  color: var(--text-invert);
116
116
  background: var(--control-primary);
117
117
  border: none;
@@ -446,7 +446,7 @@
446
446
  line-height: 1.2307692308;
447
447
  letter-spacing: 0.25px;
448
448
  display: block;
449
- padding: 8px 16px 4px;
449
+ padding: var(--space-8) var(--space-16) var(--space-4);
450
450
  color: var(--text-minor);
451
451
  }
452
452
 
@@ -24,7 +24,7 @@ const styles_module_scss_1 = __importDefault(require("./styles.module.css"));
24
24
  const SHEET_MULTISELECT_HEIGHT = 'calc(90dvh - 230px)';
25
25
  function SelectView({ vm }) {
26
26
  var _a;
27
- const { testId, select, isMultiple, label, status, theme, caption, placeholder, disabled, fullWidth, className, size, fieldDisplayValue, selectedValueText, hasValue, popoverClassName, dropdownWidth, placement, container, children, presentation, variant, listSize, onOpen, onToggle, onSearchChange, onClear, onRemoveChip, onToggleChips, onChipsOverflow, chipsVariant, showPanelHeader, multiselectPanel, emptySelectionLabel, selectedCountLabel, overflowSelectedLabel, collapseLabel, clearLabel, dropdownMaxHeight, virtualized, multiselectChipsMaxRows, selectedArray, onListScroll, fetching, } = vm;
27
+ const { testId, select, isMultiple, label, ariaLabel, startAdornment, status, theme, caption, placeholder, disabled, fullWidth, className, size, fieldDisplayValue, selectedValueText, hasValue, popoverClassName, dropdownWidth, placement, container, children, presentation, variant, listSize, onOpen, onToggle, onSearchChange, onClear, onRemoveChip, onToggleChips, onChipsOverflow, chipsVariant, showPanelHeader, multiselectPanel, emptySelectionLabel, selectedCountLabel, overflowSelectedLabel, collapseLabel, clearLabel, dropdownMaxHeight, virtualized, multiselectChipsMaxRows, selectedArray, onListScroll, fetching, } = vm;
28
28
  const { t } = (0, use_locale_1.useLocale)();
29
29
  const sheet = presentation !== 'popup';
30
30
  const classNames = (0, class_names_context_1.useSelectClassNames)();
@@ -45,10 +45,10 @@ function SelectView({ vm }) {
45
45
  popupRef,
46
46
  inputRef: select.inputRef,
47
47
  });
48
- const field = ((0, jsx_runtime_1.jsx)(select_field_1.SelectField, { ref: activatorRef, label: label, placeholder: placeholder, displayValue: fieldDisplayValue, mode: select.mode, multiselectLabels: select.multiselectDisplayLabels, chipsVariant: chipsVariant, open: select.open, disabled: disabled, status: status, theme: theme, filled: hasValue, size: size, variant: variant, fullWidth: fullWidth,
48
+ const field = ((0, jsx_runtime_1.jsx)(select_field_1.SelectField, { ref: activatorRef, label: label, "aria-label": ariaLabel, startAdornment: startAdornment, placeholder: placeholder, displayValue: fieldDisplayValue, mode: select.mode, multiselectLabels: select.multiselectDisplayLabels, chipsVariant: chipsVariant, open: select.open, disabled: disabled, status: status, theme: theme, filled: hasValue, size: size, variant: variant, fullWidth: fullWidth,
49
49
  // В шторке поле только открывает её: запрос вводят в строке поиска шторки, иначе клавиатура закрыла бы список
50
50
  showSearch: select.showSearch && !sheet, searchValue: select.searchValue, selectedValueText: selectedValueText, onSearchChange: onSearchChange, onOpen: onOpen, onToggle: onToggle, overflowSelectedLabel: overflowSelectedLabel, allowClear: select.allowClear, onClear: onClear, caption: caption, className: className, listboxId: select.listboxId, controlRef: select.inputRef, activeDescendantId: select.activeOptionId, onComboboxKeyDown: select.onComboboxKeyDown }));
51
- const panel = isMultiple ? ((0, jsx_runtime_1.jsx)(select_multiselect_panel_1.SelectMultiselectPanel, { id: select.listboxId, options: select.listOptions, chipOptions: select.options, searchActive: !!select.searchValue, value: selectedArray, onUpdate: select.handleSelect, onRemoveChip: onRemoveChip, onClear: onClear, showPanelHeader: showPanelHeader, chipsExpanded: multiselectPanel.chipsExpanded, chipsExpandedMode: multiselectPanel.mode, onToggleChips: onToggleChips, onChipsOverflow: onChipsOverflow, emptySelectionLabel: emptySelectionLabel, selectedCountLabel: selectedCountLabel, collapseLabel: collapseLabel, clearLabel: clearLabel, virtualized: virtualized, chipsMaxRows: multiselectChipsMaxRows, size: listSize, open: select.open, showLoader: select.showLoader, showNotFound: select.showNotFound, showMinCharsHint: select.showMinCharsHint, notFoundContent: select.notFoundContent, minCharsContent: select.minCharsContent, loadingContent: select.loadingContent, className: panelClassName, activeValue: select.activeOptionValue, onOptionMouseMove: select.onOptionMouseMove, onListMouseMove: select.onListMouseMove, keyboardNavActive: select.keyboardNavActive, restoreComboboxFocus: select.restoreComboboxFocus, maxHeight: sheet ? SHEET_MULTISELECT_HEIGHT : dropdownMaxHeight, mobile: sheet, children: children })) : ((0, jsx_runtime_1.jsx)(select_single_panel_1.SelectSinglePanel, { id: select.listboxId, selectionMode: "single", value: select.selectedValues, onUpdate: select.handleSelect, options: select.listOptions, size: listSize, open: select.open, showNotFound: select.showNotFound, showMinCharsHint: select.showMinCharsHint, notFoundContent: select.notFoundContent, minCharsContent: select.minCharsContent, loadingContent: select.loadingContent, loading: select.loading, fetching: fetching, maxHeight: sheet ? 'none' : dropdownMaxHeight, virtualized: virtualized, onListScroll: onListScroll, activeValue: select.activeOptionValue, onOptionMouseMove: select.onOptionMouseMove, onListMouseMove: select.onListMouseMove, keyboardNavActive: select.keyboardNavActive, className: panelClassName, mobile: sheet, children: children }));
51
+ const panel = isMultiple ? ((0, jsx_runtime_1.jsx)(select_multiselect_panel_1.SelectMultiselectPanel, { id: select.listboxId, options: select.listOptions, chipOptions: select.options, searchActive: !!select.searchValue, value: selectedArray, onUpdate: select.handleSelect, onRemoveChip: onRemoveChip, onClear: onClear, showPanelHeader: showPanelHeader, chipsEnabled: chipsVariant === 'inside', chipsExpanded: multiselectPanel.chipsExpanded, chipsExpandedMode: multiselectPanel.mode, onToggleChips: onToggleChips, onChipsOverflow: onChipsOverflow, emptySelectionLabel: emptySelectionLabel, selectedCountLabel: selectedCountLabel, collapseLabel: collapseLabel, clearLabel: clearLabel, virtualized: virtualized, chipsMaxRows: multiselectChipsMaxRows, size: listSize, open: select.open, showLoader: select.showLoader, showNotFound: select.showNotFound, showMinCharsHint: select.showMinCharsHint, notFoundContent: select.notFoundContent, minCharsContent: select.minCharsContent, loadingContent: select.loadingContent, className: panelClassName, activeValue: select.activeOptionValue, onOptionMouseMove: select.onOptionMouseMove, onListMouseMove: select.onListMouseMove, keyboardNavActive: select.keyboardNavActive, restoreComboboxFocus: select.restoreComboboxFocus, maxHeight: sheet ? SHEET_MULTISELECT_HEIGHT : dropdownMaxHeight, mobile: sheet, children: children })) : ((0, jsx_runtime_1.jsx)(select_single_panel_1.SelectSinglePanel, { id: select.listboxId, selectionMode: "single", value: select.selectedValues, onUpdate: select.handleSelect, options: select.listOptions, size: listSize, open: select.open, showNotFound: select.showNotFound, showMinCharsHint: select.showMinCharsHint, notFoundContent: select.notFoundContent, minCharsContent: select.minCharsContent, loadingContent: select.loadingContent, loading: select.loading, fetching: fetching, maxHeight: sheet ? 'none' : dropdownMaxHeight, virtualized: virtualized, onListScroll: onListScroll, activeValue: select.activeOptionValue, onOptionMouseMove: select.onOptionMouseMove, onListMouseMove: select.onListMouseMove, keyboardNavActive: select.keyboardNavActive, className: panelClassName, mobile: sheet, children: children }));
52
52
  // Нет ни вариантов, ни статуса (загрузка, «ничего не найдено», подсказка): пустую панель не показываем
53
53
  const hasNoPanelContent = !isMultiple &&
54
54
  select.listOptions.length === 0 &&
@@ -66,5 +66,5 @@ function SelectView({ vm }) {
66
66
  return ((0, jsx_runtime_1.jsx)("div", { ref: select.containerRef, ...vm.dataProps, "data-testid": testId, "data-lt-ui": "select", className: (0, clsx_1.default)(styles_module_scss_1.default.root, fullWidth && styles_module_scss_1.default.rootFullWidth), children: (0, jsx_runtime_1.jsx)(popover_1.Popover, { "data-testid": (0, data_attributes_1.getRelatedTestId)(testId, 'popup'), anchor: field, open: select.open && !hasNoPanelContent, onOpenChange: open => {
67
67
  if (!open)
68
68
  onPopoverClose();
69
- }, trigger: "manual", layer: false, returnFocus: false, arrow: false, matchWidth: dropdownWidth === 'content' ? 'min' : true, placement: placement, offset: 4, container: container, className: styles_module_scss_1.default.selectPopover, children: (0, jsx_runtime_1.jsx)("div", { ref: popupRef, role: "presentation", children: panel }) }) }));
69
+ }, trigger: "manual", layer: false, returnFocus: false, arrow: false, matchWidth: dropdownWidth === 'content' ? 'min' : dropdownWidth === 'field' ? true : dropdownWidth, placement: placement, offset: 4, container: container, className: styles_module_scss_1.default.selectPopover, children: (0, jsx_runtime_1.jsx)("div", { ref: popupRef, role: "presentation", children: panel }) }) }));
70
70
  }
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
  .searchListboxCaption {
29
- padding: 12px 16px;
29
+ padding: var(--space-12) var(--space-16);
30
30
  color: var(--text-minor);
31
31
  }
32
32
 
@@ -1,38 +1,5 @@
1
1
  'use client';
2
2
  "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
5
  };
@@ -40,17 +7,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
7
  exports.SnackView = exports.SnackViewContext = void 0;
41
8
  const jsx_runtime_1 = require("react/jsx-runtime");
42
9
  const clsx_1 = __importDefault(require("clsx"));
43
- const react_1 = __importStar(require("react"));
10
+ const react_1 = __importDefault(require("react"));
44
11
  const collapse_box_1 = require("../_internal/collapse-box");
45
12
  const compat_1 = require("../_internal/compat");
46
- const hooks_1 = require("../_internal/hooks");
47
- const hooks_2 = require("../hooks");
13
+ const hooks_1 = require("../hooks");
48
14
  const icon_1 = require("../icon");
49
15
  const icons_1 = require("../icons");
50
16
  const use_locale_1 = require("../locale/use-locale");
51
17
  const theme_context_1 = require("../theme-provider/theme-context");
52
18
  const utils_1 = require("../utils");
53
19
  const snack_module_scss_1 = __importDefault(require("./styles/snack.module.css"));
20
+ const use_snack_view_1 = require("./use-snack-view");
54
21
  exports.SnackViewContext = react_1.default.createContext({});
55
22
  const SnackViewProvider = (0, compat_1.contextProvider)(exports.SnackViewContext);
56
23
  /** Заливки, цвет текста на которых — `text-invert`: на них схема обратна окружению */
@@ -74,11 +41,12 @@ exports.SnackView = (0, compat_1.withRef)(function SnackView({ className, classN
74
41
  var _a;
75
42
  const classNames = (0, utils_1.useClassNames)('Snack', classNamesProp);
76
43
  const { t } = (0, use_locale_1.useLocale)();
77
- const detailsId = (0, hooks_2.useUniqID)(5, 'snack-details');
78
- const [expanded, setExpanded] = (0, hooks_1.useControllableState)({
79
- value: expandedProp,
80
- defaultValue: defaultExpanded,
81
- onChange: onExpandedChange,
44
+ const detailsId = (0, hooks_1.useUniqID)(5, 'snack-details');
45
+ const { expanded, setExpanded, contextValue } = (0, use_snack_view_1.useSnackViewState)({
46
+ variant,
47
+ expanded: expandedProp,
48
+ defaultExpanded,
49
+ onExpandedChange,
82
50
  });
83
51
  const hasText = header || paragraph;
84
52
  const snackClassName = (0, clsx_1.default)(snack_module_scss_1.default.snack, snack_module_scss_1.default[variant], classNames.root, className);
@@ -86,7 +54,6 @@ exports.SnackView = (0, compat_1.withRef)(function SnackView({ className, classN
86
54
  const haveButtonsInHeader = closeButton || (!wideButton && haveChildren);
87
55
  const haveButtonsInFooter = haveChildren && (wideButton || closeButton);
88
56
  const expandable = expandedContent != null && expandedContent !== false;
89
- const contextValue = (0, react_1.useMemo)(() => ({ variant }), [variant]);
90
57
  // Заливки с цветом текста `text-invert`: кнопки на них берут схему, обратную окружению (текст остаётся ambient)
91
58
  const opposite = (0, theme_context_1.useOppositeTheme)();
92
59
  // Жёлтая заливка одинакова в обеих схемах: кнопки на ней всегда в светлой
@@ -18,7 +18,7 @@
18
18
  }
19
19
  .snackHeader .icon {
20
20
  height: 32px;
21
- padding: 4px;
21
+ padding: var(--space-4);
22
22
  }
23
23
  .snackHeader .textInfo {
24
24
  display: flex;
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSnackViewState = useSnackViewState;
5
+ const react_1 = require("react");
6
+ const hooks_1 = require("../_internal/hooks");
7
+ function useSnackViewState(props) {
8
+ const { variant, expanded: expandedProp, defaultExpanded, onExpandedChange } = props;
9
+ const [expanded, setExpanded] = (0, hooks_1.useControllableState)({
10
+ value: expandedProp,
11
+ defaultValue: defaultExpanded !== null && defaultExpanded !== void 0 ? defaultExpanded : false,
12
+ onChange: onExpandedChange,
13
+ });
14
+ const contextValue = (0, react_1.useMemo)(() => ({ variant }), [variant]);
15
+ return { expanded, setExpanded, contextValue };
16
+ }
@@ -19,7 +19,7 @@
19
19
  }
20
20
  @media (pointer: coarse) {
21
21
  .switchRoot {
22
- padding-inline: 4px;
22
+ padding-inline: var(--space-4);
23
23
  }
24
24
  }
25
25
  .switchRoot.disabled {
@@ -120,7 +120,7 @@
120
120
  }
121
121
 
122
122
  .label {
123
- gap: 12px;
123
+ gap: var(--space-12);
124
124
  align-items: center;
125
125
  }
126
126
  .label.labelLeft {
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  .pills {
18
- gap: 4px;
18
+ gap: var(--space-4);
19
19
  }
20
20
 
21
21
  .enclosed {
@@ -33,7 +33,7 @@
33
33
  align-items: center;
34
34
  justify-content: center;
35
35
  padding-block: var(--tab-padding);
36
- margin-inline: 8px;
36
+ margin-inline: var(--space-8);
37
37
  color: var(--lt-ui-tabs-color, var(--text-minor));
38
38
  touch-action: manipulation;
39
39
  background-color: transparent;
@@ -82,7 +82,7 @@
82
82
 
83
83
  .variant-pills {
84
84
  padding-inline: 14px;
85
- margin-inline: 2px;
85
+ margin-inline: var(--space-2);
86
86
  border-radius: var(--rounding-circular);
87
87
  }
88
88
  .variant-pills:not(.divider, .active) {
@@ -105,7 +105,7 @@
105
105
  }
106
106
 
107
107
  .variant-enclosed {
108
- padding-inline: 16px;
108
+ padding-inline: var(--space-16);
109
109
  margin-inline: 0 -1px;
110
110
  background-color: var(--control-minor);
111
111
  border: 1px solid var(--control-secondary);
@@ -151,7 +151,7 @@
151
151
  }
152
152
 
153
153
  .xl {
154
- --tab-padding: 12px;
154
+ --tab-padding: var(--space-12);
155
155
  --tab-icon-size: 28px;
156
156
  --tab-badge-size: 28px;
157
157
  font-size: 27px;
@@ -180,7 +180,7 @@
180
180
  .tabIcon {
181
181
  width: var(--tab-icon-size);
182
182
  height: var(--tab-icon-size);
183
- margin-inline: 4px;
183
+ margin-inline: var(--space-4);
184
184
  }
185
185
 
186
186
  .tabBadge {
@@ -189,7 +189,7 @@
189
189
  justify-content: center;
190
190
  min-width: var(--tab-badge-size);
191
191
  height: var(--tab-badge-size);
192
- margin-inline: 4px;
192
+ margin-inline: var(--space-4);
193
193
  }
194
194
  .tabBadge [role=status] {
195
195
  opacity: 0.5;
@@ -45,6 +45,7 @@ const theme_context_1 = require("../theme-provider/theme-context");
45
45
  const hooks_1 = require("../hooks");
46
46
  const context_1 = require("./context");
47
47
  const use_tabs_1 = require("./use-tabs");
48
+ const use_tab_list_navigation_1 = require("./use-tab-list-navigation");
48
49
  const tab_list_module_scss_1 = __importDefault(require("./styles/tab-list.module.css"));
49
50
  const compat_1 = require("../_internal/compat");
50
51
  const ListNavigationProvider = (0, compat_1.contextProvider)(hooks_1.ListNavigationContext);
@@ -65,27 +66,8 @@ const StandaloneList = (0, compat_1.withRef)(function StandaloneList(props, ref)
65
66
  return ((0, jsx_runtime_1.jsx)(TabsProvider, { value: context, children: (0, jsx_runtime_1.jsx)(TabListView, { ...rest, context: context, ref: ref }) }));
66
67
  });
67
68
  const TabListView = (0, compat_1.withRef)(function TabListView({ context, align = 'start', className, children, theme, ...rest }, ref) {
68
- const { value, activation, select, getTabId, valueById } = context;
69
69
  const themeAttribute = (0, theme_context_1.useThemeAttribute)(theme);
70
- const navigation = (0, hooks_1.useListNavigation)({
71
- mode: 'focus',
72
- tabStop: 'single',
73
- orientation: 'horizontal',
74
- defaultActiveId: value === undefined ? undefined : getTabId(value),
75
- onActiveChange: (id, reason) => {
76
- if (activation !== 'auto' || reason !== 'keyboard' || id === null)
77
- return;
78
- const next = valueById.get(id);
79
- if (next !== undefined && next !== value)
80
- select(next);
81
- },
82
- });
83
- // Выбранная снаружи вкладка становится точкой входа в список
84
- const { api } = navigation;
85
- (0, react_1.useEffect)(() => {
86
- if (value !== undefined)
87
- api.setActive(getTabId(value), 'api');
88
- }, [value, api, getTabId]);
70
+ const navigation = (0, use_tab_list_navigation_1.useTabListNavigation)(context);
89
71
  return ((0, jsx_runtime_1.jsx)("div", { role: "tablist", "aria-orientation": "horizontal", ...rest, ...navigation.rootProps, ref: ref, className: (0, clsx_1.default)(tab_list_module_scss_1.default.tabList, tab_list_module_scss_1.default[align], tab_list_module_scss_1.default[context.variant], context.divider && context.variant === 'line' && tab_list_module_scss_1.default.divider, context.classNames.list, className), "data-lt-ui-theme": themeAttribute, "data-lt-ui": "tab-list", children: (0, jsx_runtime_1.jsx)(ListNavigationProvider, { value: navigation.context, children: children }) }));
90
72
  });
91
73
  /**
@@ -1,55 +1,20 @@
1
1
  'use client';
2
2
  "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
5
  };
39
6
  Object.defineProperty(exports, "__esModule", { value: true });
40
7
  exports.TabPanel = void 0;
41
8
  const jsx_runtime_1 = require("react/jsx-runtime");
42
- const react_1 = __importStar(require("react"));
9
+ const react_1 = __importDefault(require("react"));
43
10
  const clsx_1 = __importDefault(require("clsx"));
44
- const context_1 = require("./context");
45
11
  const tab_panel_module_scss_1 = __importDefault(require("./styles/tab-panel.module.css"));
46
12
  const compat_1 = require("../_internal/compat");
13
+ const use_tab_panel_1 = require("./use-tab-panel");
47
14
  /**
48
15
  * `<TabPanel />` — содержимое вкладки. Скрыта, пока вкладка не выбрана; размонтируется, если не задан `keepMounted`.
49
16
  */
50
17
  exports.TabPanel = (0, compat_1.withRef)(function TabPanel({ value, keepMounted = false, className, children, ...rest }, ref) {
51
- const { value: selectedValue, getTabId, getPanelId, registerPanel, classNames, } = (0, context_1.useTabsContext)('TabPanel');
52
- const selected = selectedValue === value;
53
- (0, react_1.useEffect)(() => registerPanel(value), [registerPanel, value]);
54
- return ((0, jsx_runtime_1.jsx)("div", { role: "tabpanel", tabIndex: selected ? 0 : -1, ...rest, ref: ref, id: getPanelId(value), "aria-labelledby": getTabId(value), hidden: !selected, className: (0, clsx_1.default)(tab_panel_module_scss_1.default.panel, classNames.panel, className), "data-lt-ui": "tab-panel", children: selected || keepMounted ? children : null }));
18
+ const { selected, tabId, panelId, classNames } = (0, use_tab_panel_1.useTabPanel)(value);
19
+ return ((0, jsx_runtime_1.jsx)("div", { role: "tabpanel", tabIndex: selected ? 0 : -1, ...rest, ref: ref, id: panelId, "aria-labelledby": tabId, hidden: !selected, className: (0, clsx_1.default)(tab_panel_module_scss_1.default.panel, classNames.panel, className), "data-lt-ui": "tab-panel", children: selected || keepMounted ? children : null }));
55
20
  });
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useTabListNavigation = useTabListNavigation;
5
+ const react_1 = require("react");
6
+ const hooks_1 = require("../hooks");
7
+ function useTabListNavigation(context) {
8
+ const { value, activation, select, getTabId, valueById } = context;
9
+ const navigation = (0, hooks_1.useListNavigation)({
10
+ mode: 'focus',
11
+ tabStop: 'single',
12
+ orientation: 'horizontal',
13
+ defaultActiveId: value === undefined ? undefined : getTabId(value),
14
+ onActiveChange: (id, reason) => {
15
+ if (activation !== 'auto' || reason !== 'keyboard' || id === null)
16
+ return;
17
+ const next = valueById.get(id);
18
+ if (next !== undefined && next !== value)
19
+ select(next);
20
+ },
21
+ });
22
+ (0, react_1.useEffect)(() => {
23
+ if (value !== undefined)
24
+ navigation.api.setActive(getTabId(value), 'api');
25
+ }, [value, navigation.api, getTabId]);
26
+ return navigation;
27
+ }
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useTabPanel = useTabPanel;
5
+ const react_1 = require("react");
6
+ const context_1 = require("./context");
7
+ function useTabPanel(value) {
8
+ const { value: selectedValue, getTabId, getPanelId, registerPanel, classNames, } = (0, context_1.useTabsContext)('TabPanel');
9
+ const selected = selectedValue === value;
10
+ (0, react_1.useEffect)(() => registerPanel(value), [registerPanel, value]);
11
+ return { selected, tabId: getTabId(value), panelId: getPanelId(value), classNames };
12
+ }
@@ -19,7 +19,7 @@
19
19
  width: 20px;
20
20
  height: 20px;
21
21
  padding: 3px;
22
- margin: 0 2px 2px 0;
22
+ margin: 0 var(--space-2) var(--space-2) 0;
23
23
  color: var(--control-secondary);
24
24
  touch-action: none;
25
25
  }
@@ -68,6 +68,12 @@
68
68
  --palette-red-light: #FFD7D4;
69
69
  --palette-black: #000000;
70
70
  --palette-white: #FFFFFF;
71
+ --box-shadow-s: 0 1px 4px rgba(0, 0, 0, 0.16), 0 2px 9px rgba(0, 0, 0, 0.02);
72
+ --box-shadow-m: 0 1.17px 2px rgba(0, 0, 0, 0.0196802), 0 1.4px 5px rgba(0, 0, 0, 0.03), 0 2px 10px rgba(0, 0, 0, 0.03), 0 2px 18px rgba(0, 0, 0, 0.04), 0 9px 33px rgba(0, 0, 0, 0.03);
73
+ --box-shadow-l: 0 0.166035px 2.21381px rgba(0, 0, 0, 0.0196802), 0 0.399006px 5.32008px rgba(0, 0, 0, 0.0282725), 0 0.751293px 10.0172px rgba(0, 0, 0, 0.035), 0 12px 40px rgba(0, 0, 0, 0.08);
74
+ --box-shadow-s-up: 0 -1px 4px rgba(0, 0, 0, 0.16), 0 -2px 9px rgba(0, 0, 0, 0.02);
75
+ --box-shadow-m-up: 0 -1.17px 2px rgba(0, 0, 0, 0.0196802), 0 -1.4px 5px rgba(0, 0, 0, 0.03), 0 -2px 10px rgba(0, 0, 0, 0.03), 0 -2px 18px rgba(0, 0, 0, 0.04), 0 -9px 33px rgba(0, 0, 0, 0.03);
76
+ --box-shadow-l-up: 0 -0.166035px 2.21381px rgba(0, 0, 0, 0.0196802), 0 -0.399006px 5.32008px rgba(0, 0, 0, 0.0282725), 0 -0.751293px 10.0172px rgba(0, 0, 0, 0.035), 0 -12px 40px rgba(0, 0, 0, 0.08);
71
77
  --space-2: 2px;
72
78
  --space-4: 4px;
73
79
  --space-8: 8px;
@@ -85,12 +91,6 @@
85
91
  --rounding-l: 8px;
86
92
  --rounding-xl: 16px;
87
93
  --rounding-circular: 100vmin;
88
- --box-shadow-s: 0 1px 4px rgba(0, 0, 0, 0.16), 0 2px 9px rgba(0, 0, 0, 0.02);
89
- --box-shadow-m: 0 1.17px 2px rgba(0, 0, 0, 0.0196802), 0 1.4px 5px rgba(0, 0, 0, 0.03), 0 2px 10px rgba(0, 0, 0, 0.03), 0 2px 18px rgba(0, 0, 0, 0.04), 0 9px 33px rgba(0, 0, 0, 0.03);
90
- --box-shadow-l: 0 0.166035px 2.21381px rgba(0, 0, 0, 0.0196802), 0 0.399006px 5.32008px rgba(0, 0, 0, 0.0282725), 0 0.751293px 10.0172px rgba(0, 0, 0, 0.035), 0 12px 40px rgba(0, 0, 0, 0.08);
91
- --box-shadow-s-up: 0 -1px 4px rgba(0, 0, 0, 0.16), 0 -2px 9px rgba(0, 0, 0, 0.02);
92
- --box-shadow-m-up: 0 -1.17px 2px rgba(0, 0, 0, 0.0196802), 0 -1.4px 5px rgba(0, 0, 0, 0.03), 0 -2px 10px rgba(0, 0, 0, 0.03), 0 -2px 18px rgba(0, 0, 0, 0.04), 0 -9px 33px rgba(0, 0, 0, 0.03);
93
- --box-shadow-l-up: 0 -0.166035px 2.21381px rgba(0, 0, 0, 0.0196802), 0 -0.399006px 5.32008px rgba(0, 0, 0, 0.0282725), 0 -0.751293px 10.0172px rgba(0, 0, 0, 0.035), 0 -12px 40px rgba(0, 0, 0, 0.08);
94
94
  --opacity-40: 0.4;
95
95
  --opacity-60: 0.6;
96
96
  --opacity-80: 0.8;
@@ -2,8 +2,8 @@
2
2
  --time-option-h: 36px;
3
3
  --time-column-w: 56px;
4
4
  display: inline-flex;
5
- gap: 4px;
6
- padding: 8px;
5
+ gap: var(--space-4);
6
+ padding: var(--space-8);
7
7
  }
8
8
 
9
9
  .s {
@@ -15,9 +15,9 @@
15
15
  position: relative;
16
16
  display: flex;
17
17
  flex-direction: column;
18
- gap: 2px;
18
+ gap: var(--space-2);
19
19
  width: var(--time-column-w);
20
- height: calc(var(--time-option-h) * 6 + 10px);
20
+ height: calc(var(--time-option-h) * 6 + var(--space-2) * 5);
21
21
  padding: 0;
22
22
  overflow-y: auto;
23
23
  overscroll-behavior: contain;
@@ -92,15 +92,15 @@
92
92
 
93
93
  .rangePanels {
94
94
  display: flex;
95
- gap: 4px;
96
- padding: 4px;
95
+ gap: var(--space-4);
96
+ padding: var(--space-4);
97
97
  }
98
98
 
99
99
  .rangePanels > hr.rangeDivider {
100
100
  --vertical-length: auto;
101
101
  align-self: stretch;
102
102
  height: auto;
103
- margin: 8px 0;
103
+ margin: var(--space-8) 0;
104
104
  }
105
105
 
106
106
  .rangeColumn {
@@ -113,12 +113,12 @@
113
113
  font-weight: 600;
114
114
  line-height: 1.2;
115
115
  letter-spacing: 0.2px;
116
- padding: 8px 8px 0;
116
+ padding: var(--space-8) var(--space-8) 0;
117
117
  color: var(--text-primary);
118
118
  }
119
119
 
120
120
  .sheetPanel {
121
121
  display: flex;
122
122
  justify-content: center;
123
- padding: 0 16px 8px;
123
+ padding: 0 var(--space-16) var(--space-8);
124
124
  }
@@ -7,61 +7,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.TimePanel = void 0;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const clsx_1 = __importDefault(require("clsx"));
10
- const react_1 = require("react");
11
10
  const compat_1 = require("../_internal/compat");
12
11
  const hooks_1 = require("../hooks");
13
12
  const use_locale_1 = require("../locale/use-locale");
14
13
  const data_attributes_1 = require("../utils/data-attributes");
15
14
  const styles_module_scss_1 = __importDefault(require("./styles.module.css"));
16
15
  const use_time_panel_1 = require("./use-time-panel");
16
+ const use_time_column_list_1 = require("./use-time-column-list");
17
17
  /** Одна колонка: список вариантов с блуждающим фокусом; стрелки двигают фокус и сразу выбирают значение */
18
18
  function TimeColumnList({ column, label, onSelect }) {
19
- const listRef = (0, react_1.useRef)(null);
20
- const selectedIndex = column.options.findIndex(option => option.selected);
21
- const firstEnabled = column.options.findIndex(option => !option.disabled);
22
- const rovingIndex = selectedIndex !== -1 ? selectedIndex : Math.max(firstEnabled, 0);
23
- // Выбранный вариант держим в видимой части колонки, строки целиком: он становится третьим сверху,
24
- // а колонка прокручивается кратно высоте строки (сверху и снизу нет «обрезанных» вариантов).
25
- // Первый показ — сразу, без анимации. Дальше, если вариант уже виден целиком, колонка стоит на месте
26
- // (клик по видимому значению ничего не двигает), иначе плавно подъезжает к нужной строке
27
- const placed = (0, react_1.useRef)(false);
28
- (0, react_1.useEffect)(() => {
29
- const list = listRef.current;
30
- // Без выбранного значения показываем первый доступный вариант (например, начало рабочих часов)
31
- const target = list === null || list === void 0 ? void 0 : list.querySelectorAll('[role="option"]')[rovingIndex];
32
- if (!list || !target)
33
- return;
34
- const gap = Number.parseFloat(getComputedStyle(list).rowGap) || 0;
35
- const top = target.offsetTop - 2 * (target.offsetHeight + gap);
36
- const first = !placed.current;
37
- placed.current = true;
38
- const visible = target.offsetTop >= list.scrollTop &&
39
- target.offsetTop + target.offsetHeight <= list.scrollTop + list.clientHeight;
40
- if (!first && visible)
41
- return;
42
- const calm = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
43
- if (first || calm || typeof list.scrollTo !== 'function')
44
- list.scrollTop = top;
45
- else
46
- list.scrollTo({ top, behavior: 'smooth' });
47
- }, [rovingIndex]);
48
- const onKeyDown = (event) => {
49
- var _a, _b;
50
- const step = { ArrowDown: 1, ArrowUp: -1 }[event.key];
51
- const edge = { Home: 0, End: column.options.length - 1 }[event.key];
52
- if (step === undefined && edge === undefined)
53
- return;
54
- event.preventDefault();
55
- let index = step === undefined ? edge : rovingIndex + step;
56
- const direction = step !== null && step !== void 0 ? step : (edge === 0 ? 1 : -1);
57
- while (index >= 0 && index < column.options.length && column.options[index].disabled)
58
- index += direction;
59
- if (index < 0 || index >= column.options.length)
60
- return;
61
- onSelect(column.options[index].value);
62
- const options = (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('[role="option"]');
63
- (_b = options === null || options === void 0 ? void 0 : options[index]) === null || _b === void 0 ? void 0 : _b.focus();
64
- };
19
+ const { listRef, rovingIndex, onKeyDown } = (0, use_time_column_list_1.useTimeColumnList)(column, onSelect);
65
20
  return ((0, jsx_runtime_1.jsx)("div", { ref: listRef, role: "listbox", "aria-label": label, className: styles_module_scss_1.default.column, onKeyDown: onKeyDown, children: column.options.map((option, index) => ((0, jsx_runtime_1.jsx)("button", { type: "button", role: "option", className: (0, clsx_1.default)(styles_module_scss_1.default.option, option.selected && styles_module_scss_1.default.selected), "aria-selected": option.selected, disabled: option.disabled, tabIndex: index === rovingIndex ? 0 : -1, onClick: () => onSelect(option.value), children: option.label }, option.value))) }));
66
21
  }
67
22
  /**