chuijs 4.0.3 → 4.0.4

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 (258) hide show
  1. package/CHANGELOG.md +536 -0
  2. package/framework/appLayout/default/chui_app_layout.js +361 -303
  3. package/framework/appLayout/default/global_style.css +243 -89
  4. package/framework/appLayout/default/main_theme_style.css +188 -101
  5. package/framework/components/chui_accordion/accordion.js +17 -17
  6. package/framework/components/chui_accordion/styles.css +7 -7
  7. package/framework/components/chui_action_sheet/action_sheet.js +35 -32
  8. package/framework/components/chui_action_sheet/styles.css +10 -4
  9. package/framework/components/chui_actions_bar/actions_bar.js +338 -0
  10. package/framework/components/chui_actions_bar/styles.css +139 -0
  11. package/framework/components/chui_affix/affix.js +4 -4
  12. package/framework/components/chui_affix/styles.css +5 -0
  13. package/framework/components/chui_alert/alert.js +11 -5
  14. package/framework/components/chui_alert/styles.css +7 -0
  15. package/framework/components/chui_avatar/avatar.js +13 -13
  16. package/framework/components/chui_avatar/styles.css +1 -1
  17. package/framework/components/chui_avatar_group/avatar_group.js +4 -4
  18. package/framework/components/chui_avatar_group/styles.css +1 -1
  19. package/framework/components/chui_backtop/backtop.js +25 -2
  20. package/framework/components/chui_backtop/styles.css +21 -0
  21. package/framework/components/chui_badge/badge.js +15 -15
  22. package/framework/components/chui_badge/styles.css +6 -6
  23. package/framework/components/chui_banner/banner.js +222 -0
  24. package/framework/components/chui_banner/styles.css +170 -0
  25. package/framework/components/chui_breadcrumb/styles.css +1 -1
  26. package/framework/components/chui_button/button.js +24 -28
  27. package/framework/components/chui_button/styles.css +5 -5
  28. package/framework/components/chui_calendar/calendar.js +6 -6
  29. package/framework/components/chui_card/card.js +14 -14
  30. package/framework/components/chui_card_scroll/card_scroll.js +169 -0
  31. package/framework/components/chui_card_scroll/styles.css +86 -0
  32. package/framework/components/chui_chat/chat.js +73 -51
  33. package/framework/components/chui_chat/styles.css +18 -7
  34. package/framework/components/chui_clipboard_history/clipboard_history.js +25 -20
  35. package/framework/components/chui_clipboard_history/styles.css +10 -8
  36. package/framework/components/chui_code/code.js +8 -8
  37. package/framework/components/chui_code/styles.css +2 -2
  38. package/framework/components/chui_code_editor/code_editor.js +26 -26
  39. package/framework/components/chui_code_editor/styles.css +3 -3
  40. package/framework/components/chui_command_palette/command_palette.js +29 -29
  41. package/framework/components/chui_command_palette/styles.css +5 -5
  42. package/framework/components/chui_console/console.js +9 -9
  43. package/framework/components/chui_console/styles.css +5 -2
  44. package/framework/components/chui_content_block/content_block.js +2 -2
  45. package/framework/components/chui_context_menu/context_menu.js +162 -54
  46. package/framework/components/chui_context_menu/styles.css +82 -8
  47. package/framework/components/chui_custom_element/custom_element.js +11 -11
  48. package/framework/components/chui_data_grid/data_grid.js +268 -268
  49. package/framework/components/chui_data_grid/styles.css +14 -14
  50. package/framework/components/chui_descriptions/styles.css +1 -1
  51. package/framework/components/chui_details/details.js +12 -12
  52. package/framework/components/chui_details/styles.css +7 -7
  53. package/framework/components/chui_diff_viewer/diff_viewer.js +88 -88
  54. package/framework/components/chui_diff_viewer/styles.css +9 -9
  55. package/framework/components/chui_divider/divider.js +6 -6
  56. package/framework/components/chui_divider/styles.css +2 -2
  57. package/framework/components/chui_drawer/drawer.js +37 -14
  58. package/framework/components/chui_drawer/styles.css +18 -4
  59. package/framework/components/chui_drop_zone/drop_zone.js +6 -6
  60. package/framework/components/chui_drop_zone/styles.css +10 -6
  61. package/framework/components/chui_fieldset/fieldset.js +6 -6
  62. package/framework/components/chui_fieldset/styles.css +5 -5
  63. package/framework/components/chui_file_explorer/file_explorer.js +115 -115
  64. package/framework/components/chui_file_explorer/styles.css +6 -6
  65. package/framework/components/chui_form/form.js +11 -11
  66. package/framework/components/chui_gantt/gantt.js +41 -41
  67. package/framework/components/chui_gantt/styles.css +5 -5
  68. package/framework/components/chui_graphs/graphs.js +82 -46
  69. package/framework/components/chui_graphs/styles.css +26 -5
  70. package/framework/components/chui_hero/hero.js +63 -20
  71. package/framework/components/chui_hero/styles.css +176 -7
  72. package/framework/components/chui_html_block/html_block.js +5 -5
  73. package/framework/components/chui_html_block/styles.css +1 -1
  74. package/framework/components/chui_hx/styles.css +2 -2
  75. package/framework/components/chui_icons/icons.js +7 -7
  76. package/framework/components/chui_icons/styles.css +2 -1
  77. package/framework/components/chui_inputs/chui_check_box/styles.css +12 -3
  78. package/framework/components/chui_inputs/chui_chips/chips.js +92 -31
  79. package/framework/components/chui_inputs/chui_chips/styles.css +28 -5
  80. package/framework/components/chui_inputs/chui_color_picker/color_picker.js +20 -15
  81. package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
  82. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +58 -58
  83. package/framework/components/chui_inputs/chui_combo_box/styles.css +9 -9
  84. package/framework/components/chui_inputs/chui_date/date.js +93 -95
  85. package/framework/components/chui_inputs/chui_date/styles.css +8 -8
  86. package/framework/components/chui_inputs/chui_date_range/date_range.js +22 -22
  87. package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
  88. package/framework/components/chui_inputs/chui_datetime/datetime.js +12 -12
  89. package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
  90. package/framework/components/chui_inputs/chui_email/email.js +10 -10
  91. package/framework/components/chui_inputs/chui_email/styles.css +6 -6
  92. package/framework/components/chui_inputs/chui_file/file.js +8 -8
  93. package/framework/components/chui_inputs/chui_file/styles.css +12 -9
  94. package/framework/components/chui_inputs/chui_hotkey/hotkey.js +39 -39
  95. package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
  96. package/framework/components/chui_inputs/chui_masked/masked.js +44 -44
  97. package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
  98. package/framework/components/chui_inputs/chui_mention/mention.js +13 -13
  99. package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
  100. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +147 -137
  101. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +14 -8
  102. package/framework/components/chui_inputs/chui_number/number.js +42 -45
  103. package/framework/components/chui_inputs/chui_number/styles.css +6 -6
  104. package/framework/components/chui_inputs/chui_otp/otp.js +32 -32
  105. package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
  106. package/framework/components/chui_inputs/chui_password/password.js +30 -36
  107. package/framework/components/chui_inputs/chui_password/styles.css +7 -7
  108. package/framework/components/chui_inputs/chui_radio_button/styles.css +2 -2
  109. package/framework/components/chui_inputs/chui_rating/rating.js +28 -28
  110. package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
  111. package/framework/components/chui_inputs/chui_select_box/select_box.js +54 -54
  112. package/framework/components/chui_inputs/chui_select_box/styles.css +10 -10
  113. package/framework/components/chui_inputs/chui_slider/slider.js +14 -14
  114. package/framework/components/chui_inputs/chui_slider/styles.css +5 -4
  115. package/framework/components/chui_inputs/chui_text/styles.css +7 -7
  116. package/framework/components/chui_inputs/chui_text/text.js +13 -17
  117. package/framework/components/chui_inputs/chui_text_area/styles.css +8 -8
  118. package/framework/components/chui_inputs/chui_text_area/text_area.js +23 -23
  119. package/framework/components/chui_inputs/chui_time/styles.css +13 -17
  120. package/framework/components/chui_inputs/chui_time/time.js +35 -24
  121. package/framework/components/chui_inputs/chui_toggle/styles.css +10 -3
  122. package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
  123. package/framework/components/chui_json_editor/json_editor.js +87 -87
  124. package/framework/components/chui_json_editor/styles.css +5 -5
  125. package/framework/components/chui_json_viewer/json_viewer.js +80 -80
  126. package/framework/components/chui_json_viewer/styles.css +6 -6
  127. package/framework/components/chui_kanban/kanban.js +27 -27
  128. package/framework/components/chui_kanban/styles.css +8 -4
  129. package/framework/components/chui_kbd/styles.css +1 -1
  130. package/framework/components/chui_label/label.js +17 -17
  131. package/framework/components/chui_label/styles.css +1 -1
  132. package/framework/components/chui_link/link.js +9 -9
  133. package/framework/components/chui_link/styles.css +11 -4
  134. package/framework/components/chui_list/list.js +11 -11
  135. package/framework/components/chui_list/styles.css +2 -2
  136. package/framework/components/chui_markdown_editor/markdown_editor.js +66 -66
  137. package/framework/components/chui_markdown_editor/styles.css +5 -5
  138. package/framework/components/chui_media/audio.js +240 -246
  139. package/framework/components/chui_media/audio_styles.css +41 -23
  140. package/framework/components/chui_media/image.js +49 -46
  141. package/framework/components/chui_media/image_compare.js +35 -35
  142. package/framework/components/chui_media/image_compare_styles.css +5 -5
  143. package/framework/components/chui_media/image_styles.css +1 -1
  144. package/framework/components/chui_media/video.js +148 -148
  145. package/framework/components/chui_media/video_styles.css +27 -11
  146. package/framework/components/chui_menu_bar/menu_bar.js +54 -54
  147. package/framework/components/chui_menu_bar/styles.css +10 -10
  148. package/framework/components/chui_message_bar/message_bar.js +551 -0
  149. package/framework/components/chui_message_bar/styles.css +248 -0
  150. package/framework/components/chui_modal/modal.js +37 -13
  151. package/framework/components/chui_notification/notification.js +76 -54
  152. package/framework/components/chui_notification/notification_download.js +26 -81
  153. package/framework/components/chui_notification/notification_download_card.js +115 -0
  154. package/framework/components/chui_notification/notification_download_progress.css +2 -2
  155. package/framework/components/chui_notification/notification_download_progress.js +70 -108
  156. package/framework/components/chui_notification/notification_update.js +31 -31
  157. package/framework/components/chui_notification/status_plate.css +3 -3
  158. package/framework/components/chui_notification/styles.css +6 -1
  159. package/framework/components/chui_notification/styles_download.css +1 -1
  160. package/framework/components/chui_notification/styles_update.css +2 -2
  161. package/framework/components/chui_org_chart/org_chart.js +29 -29
  162. package/framework/components/chui_org_chart/styles.css +2 -2
  163. package/framework/components/chui_pagination/pagination.js +3 -3
  164. package/framework/components/chui_pagination/styles.css +1 -1
  165. package/framework/components/chui_paragraph/styles.css +2 -2
  166. package/framework/components/chui_popover/popover.js +29 -23
  167. package/framework/components/chui_popover/styles.css +1 -1
  168. package/framework/components/chui_popups/popups.js +124 -124
  169. package/framework/components/chui_popups/styles.css +5 -5
  170. package/framework/components/chui_print_button/print_button.js +15 -10
  171. package/framework/components/chui_progress_bar/progress_bar.js +34 -12
  172. package/framework/components/chui_progress_bar/styles.css +4 -4
  173. package/framework/components/chui_progress_ring/progress_ring.js +15 -15
  174. package/framework/components/chui_progress_ring/styles.css +1 -1
  175. package/framework/components/chui_qrcode/qrcode.js +12 -12
  176. package/framework/components/chui_query_builder/query_builder.js +46 -46
  177. package/framework/components/chui_query_builder/styles.css +4 -4
  178. package/framework/components/chui_radio_group/styles.css +1 -1
  179. package/framework/components/chui_result/result.js +15 -15
  180. package/framework/components/chui_result/styles.css +3 -3
  181. package/framework/components/chui_scheduler/scheduler.js +74 -74
  182. package/framework/components/chui_scheduler/styles.css +5 -5
  183. package/framework/components/chui_screen_spinner/screen_spinner.js +167 -0
  184. package/framework/components/chui_screen_spinner/styles.css +49 -0
  185. package/framework/components/chui_segmented_control/segmented_control.js +63 -6
  186. package/framework/components/chui_segmented_control/styles.css +32 -6
  187. package/framework/components/chui_settings/settings.js +45 -46
  188. package/framework/components/chui_settings/styles.css +4 -4
  189. package/framework/components/chui_shortcut_help/shortcut_help.js +32 -34
  190. package/framework/components/chui_sidebar_nav/sidebar_nav.js +98 -29
  191. package/framework/components/chui_sidebar_nav/styles.css +9 -3
  192. package/framework/components/chui_slideshow/slideshow.js +85 -85
  193. package/framework/components/chui_slideshow/styles.css +6 -6
  194. package/framework/components/chui_spinner/spinner.js +10 -10
  195. package/framework/components/chui_split_button/split_button.js +30 -12
  196. package/framework/components/chui_split_button/styles.css +21 -5
  197. package/framework/components/chui_splitter/splitter.js +11 -11
  198. package/framework/components/chui_splitter/styles.css +2 -2
  199. package/framework/components/chui_statistic/statistic.js +47 -47
  200. package/framework/components/chui_status_bar/styles.css +2 -2
  201. package/framework/components/chui_stepper/stepper.js +202 -31
  202. package/framework/components/chui_stepper/styles.css +79 -14
  203. package/framework/components/chui_sticky_bar/sticky_bar.js +44 -13
  204. package/framework/components/chui_sticky_bar/styles.css +10 -8
  205. package/framework/components/chui_tabs/chui_tabs.js +74 -26
  206. package/framework/components/chui_tabs/styles.css +40 -12
  207. package/framework/components/chui_text_editor/styles.css +7 -7
  208. package/framework/components/chui_text_editor/text_editor.js +56 -56
  209. package/framework/components/chui_text_editor/text_editor_panel.js +173 -174
  210. package/framework/components/chui_theme_toggle/theme_toggle.js +21 -5
  211. package/framework/components/chui_timeline/styles.css +3 -1
  212. package/framework/components/chui_toast_queue/styles.css +11 -11
  213. package/framework/components/chui_toast_queue/toast_queue.js +30 -27
  214. package/framework/components/chui_toolbar/styles.css +2 -2
  215. package/framework/components/chui_tooltip/styles.css +2 -2
  216. package/framework/components/chui_tooltip/tooltip.js +3 -3
  217. package/framework/components/chui_tour/styles.css +8 -8
  218. package/framework/components/chui_tour/tour.js +72 -72
  219. package/framework/components/chui_transfer/styles.css +6 -6
  220. package/framework/components/chui_transfer/transfer.js +93 -106
  221. package/framework/components/chui_tree_table/styles.css +4 -4
  222. package/framework/components/chui_tree_table/tree_table.js +45 -45
  223. package/framework/components/chui_tree_view/styles.css +10 -8
  224. package/framework/components/chui_tree_view/tree_view.js +185 -183
  225. package/framework/components/chui_user_bar/styles.css +145 -0
  226. package/framework/components/chui_user_bar/user_bar.js +402 -0
  227. package/framework/components/chui_user_list_bar/styles.css +173 -0
  228. package/framework/components/chui_user_list_bar/user_list_bar.js +485 -0
  229. package/framework/components/chui_watermark/watermark.js +17 -17
  230. package/framework/components/chui_webview/webview.js +9 -9
  231. package/framework/components/chui_write_bar/styles.css +172 -0
  232. package/framework/components/chui_write_bar/write_bar.js +320 -0
  233. package/framework/main_window.js +1234 -0
  234. package/framework/modules/chui_a11y/chui_a11y.js +78 -79
  235. package/framework/modules/chui_animations/animations.js +77 -15
  236. package/framework/modules/chui_animations/motion.js +120 -0
  237. package/framework/modules/chui_animations/styles.css +36 -3
  238. package/framework/modules/chui_functions.js +31 -27
  239. package/framework/modules/chui_highlight/styles.css +13 -10
  240. package/framework/modules/chui_i18n/chui_i18n.js +3 -3
  241. package/framework/modules/chui_i18n/locales/feedback.js +62 -0
  242. package/framework/modules/chui_i18n/locales/navigation.js +4 -0
  243. package/framework/modules/chui_json/chui_json.js +2 -2
  244. package/framework/modules/chui_logger/chui_logger.js +23 -8
  245. package/framework/modules/chui_page/page.js +10 -10
  246. package/framework/modules/chui_palette/palette.js +61 -0
  247. package/framework/modules/chui_qr/chui_qr.js +23 -23
  248. package/framework/modules/chui_scrollbar/chui_scrollbar.js +45 -45
  249. package/framework/modules/chui_scrollbar/styles.css +3 -3
  250. package/framework/modules/chui_services/chui_services.js +8 -8
  251. package/framework/modules/chui_services/desktop.js +77 -71
  252. package/framework/modules/chui_sortable/chui_sortable.js +17 -17
  253. package/framework/modules/chui_validate/chui_validate.js +3 -3
  254. package/framework/tray_bar/chui_menu_items.js +2 -2
  255. package/index.d.ts +266 -34
  256. package/index.js +20 -1168
  257. package/package.json +6 -4
  258. package/framework/components/telegram_bot/chui_telegram_bot.js +0 -191
@@ -4,11 +4,11 @@ chui_chips {
4
4
  карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
5
5
  (тот же приём у полосы меню-бара). */
6
6
  --control_padding: var(--control_padding_sm);
7
- --main_padding: var(--main_padding_sm);
7
+ --block_padding: var(--block_padding_sm);
8
8
  display: block;
9
9
  /* fill-available учитывает собственный margin, 100% — нет */
10
10
  width: -webkit-fill-available;
11
- margin: var(--margin);
11
+ margin: var(--block_margin);
12
12
  font-size: var(--font_default_size);
13
13
  color: var(--text_color);
14
14
  }
@@ -16,7 +16,7 @@ chui_chips {
16
16
  chips_title {
17
17
  display: block;
18
18
  width: max-content;
19
- margin: 0 0 var(--margin);
19
+ margin: 0 0 var(--block_margin);
20
20
  font-size: var(--font_labels_size);
21
21
  font-weight: 500;
22
22
  color: var(--text_color);
@@ -37,7 +37,7 @@ chips_field {
37
37
  height: var(--control_height);
38
38
  padding: 3px 6px;
39
39
  border: 1px solid var(--border_color);
40
- border-radius: var(--border_radius);
40
+ border-radius: var(--radius_sm);
41
41
  background: var(--element_background);
42
42
  cursor: text;
43
43
  }
@@ -193,7 +193,7 @@ chips_dropdown {
193
193
  overflow: hidden auto;
194
194
  padding: var(--control_padding);
195
195
  border: 1px solid var(--border_color);
196
- border-radius: var(--border_radius);
196
+ border-radius: var(--radius_sm);
197
197
  background: var(--header_background);
198
198
  backdrop-filter: var(--global_blur);
199
199
  box-shadow: var(--box_shadow_drop);
@@ -204,6 +204,29 @@ chips_dropdown[hidden] {
204
204
  display: none;
205
205
  }
206
206
 
207
+ /* Уход метки: она гаснет и сжимается, а из строки убирается по концу кадра */
208
+ .chips_item_leaving {
209
+ animation: chui_leave_up var(--motion_fast) var(--motion_ease) forwards;
210
+ }
211
+
212
+ /* Появление списка подсказок: общий кадр панели — он же проигрывается заново при снятии
213
+ `hidden`. Прежде список брал только общий кадр строки на быстром времени, и открытие
214
+ читалось рывком рядом с остальными дропдаунами */
215
+ chips_dropdown {
216
+ animation: chui_panel_in var(--motion_base) var(--motion_spring);
217
+ }
218
+
219
+ /* Появление метки: она встаёт на место, а не возникает рывком. Класс снимается по концу
220
+ кадра, поэтому пересборка списка метки не переигрывает */
221
+ .chips_item_appearing {
222
+ animation: chui_appear_up var(--motion_base) var(--motion_ease);
223
+ }
224
+
225
+ /* Уход: список гаснет и сходит вверх, `hidden` возвращается по концу кадра */
226
+ .chips_dropdown_leaving {
227
+ animation: chui_leave_up var(--motion_fast) var(--motion_ease) forwards;
228
+ }
229
+
207
230
  .chips_option {
208
231
  padding: 6px 8px;
209
232
  border-radius: var(--radius_sm);
@@ -1,6 +1,7 @@
1
1
  const { setStyles, optionOr } = require("../../../modules/chui_functions");
2
2
  const { Validate } = require("../../../modules/chui_validate/chui_validate");
3
3
  const { I18n } = require("../../../modules/chui_i18n/chui_i18n");
4
+ const { paletteColor } = require("../../../modules/chui_palette/palette");
4
5
 
5
6
  // Формат, который принимает и поле, и разбор значения: три или шесть знаков после «#»
6
7
  const HEX_PATTERN = "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$";
@@ -41,7 +42,11 @@ const HEX_PATTERN = "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$";
41
42
  * Слушателей и таймеров вне своих узлов нет, поэтому `destroy()` не нужен.
42
43
  */
43
44
  class ColorPicker {
44
- static PALETTE = ["#ff3b30", "#ff9500", "#ffcc00", "#34c759", "#007aff", "#5856d6", "#af52de", "#8e8e93"];
45
+ /* Готовые цвета — из общей палитры (светлая колонка: набор предлагается человеку,
46
+ а не подстраивается под схему окна) */
47
+ static PALETTE = ["red", "orange", "yellow", "green", "blue", "indigo", "purple", "gray"].map((name) =>
48
+ paletteColor(name, { scheme: "light" })
49
+ );
45
50
  static #counter = 0;
46
51
 
47
52
  #root = document.createElement("chui_color_picker");
@@ -55,15 +60,15 @@ class ColorPicker {
55
60
  #id = undefined;
56
61
  #name = undefined;
57
62
  #label = undefined;
58
- #title_text = undefined;
63
+ #titleText = undefined;
59
64
  #value = ColorPicker.PALETTE[4];
60
65
  #initial = ColorPicker.PALETTE[4];
61
66
  #items = [];
62
67
  #buttons = [];
63
- #show_input = true;
68
+ #showInput = true;
64
69
  #disabled = false;
65
70
  #listeners = [];
66
- #on_change = undefined;
71
+ #onChange = undefined;
67
72
 
68
73
  constructor(
69
74
  options = {
@@ -85,8 +90,8 @@ class ColorPicker {
85
90
  this.#root.id = this.#id;
86
91
  this.#name = options.name;
87
92
  this.#label = options.label;
88
- this.#show_input = options.showInput !== false;
89
- this.#on_change = options.onChange;
93
+ this.#showInput = options.showInput !== false;
94
+ this.#onChange = options.onChange;
90
95
  if (options.changeListener !== undefined) this.addChangeListener(options.changeListener);
91
96
  // Явно переданный цвет разбирается сразу: молча подменять его дефолтным нельзя,
92
97
  // а пустая заготовка `value: String()` из описания опций означает «цвет не задан»
@@ -104,7 +109,7 @@ class ColorPicker {
104
109
  this.#swatch.addEventListener("input", this.#onSwatchInput);
105
110
  this.#swatch.addEventListener("change", this.#onSwatchChange);
106
111
  this.#row.appendChild(this.#swatch);
107
- if (this.#show_input) {
112
+ if (this.#showInput) {
108
113
  this.#field.className = "color_picker_field";
109
114
  this.#hex.type = "text";
110
115
  this.#hex.className = "color_picker_hex";
@@ -137,7 +142,7 @@ class ColorPicker {
137
142
  this.#root,
138
143
  undefined,
139
144
  () => this.#validateValue(),
140
- this.#show_input ? this.#field : this.#row
145
+ this.#showInput ? this.#field : this.#row
141
146
  );
142
147
  this.setPresets(options.presets === undefined ? ColorPicker.PALETTE : options.presets);
143
148
  this.setDisabled(options.disabled === true);
@@ -154,7 +159,7 @@ class ColorPicker {
154
159
  }
155
160
 
156
161
  getTitle() {
157
- return this.#title_text;
162
+ return this.#titleText;
158
163
  }
159
164
 
160
165
  /** Доступное имя образца, заданное в `label` */
@@ -205,7 +210,7 @@ class ColorPicker {
205
210
 
206
211
  /** Подпись над контролом; `undefined` её убирает */
207
212
  setTitle(text = undefined) {
208
- this.#title_text = text;
213
+ this.#titleText = text;
209
214
  if (text === undefined || text === "") {
210
215
  this.#title.hidden = true;
211
216
  this.#title.innerText = "";
@@ -221,9 +226,9 @@ class ColorPicker {
221
226
  this.#label = text;
222
227
  if (text === undefined) this.#swatch.removeAttribute("aria-label");
223
228
  else this.#swatch.setAttribute("aria-label", String(text));
224
- const hex_label =
229
+ const hexLabel =
225
230
  text === undefined ? I18n.t("forms.colorPickerHex") : I18n.t("forms.colorPickerHexOf", { label: text });
226
- this.#hex.setAttribute("aria-label", hex_label);
231
+ this.#hex.setAttribute("aria-label", hexLabel);
227
232
  return this;
228
233
  }
229
234
 
@@ -287,7 +292,7 @@ class ColorPicker {
287
292
  /** Фокус на поле HEX (или на образец, если поля нет): `Form` зовёт это при ошибке */
288
293
  focus() {
289
294
  if (this.#disabled) return this;
290
- if (this.#show_input) this.#hex.focus();
295
+ if (this.#showInput) this.#hex.focus();
291
296
  else this.#swatch.focus();
292
297
  return this;
293
298
  }
@@ -300,7 +305,7 @@ class ColorPicker {
300
305
  // === ВНУТРЕННЕЕ ===
301
306
  // Что проверяют правила: текст поля (то, что ввёл человек), иначе — само значение
302
307
  #validateValue() {
303
- if (!this.#show_input) return this.#value;
308
+ if (!this.#showInput) return this.#value;
304
309
  return this.#hex.value === undefined ? "" : this.#hex.value;
305
310
  }
306
311
 
@@ -359,7 +364,7 @@ class ColorPicker {
359
364
 
360
365
  #notify() {
361
366
  for (const listener of [...this.#listeners]) listener(this.#value, this);
362
- if (this.#on_change !== undefined) this.#on_change(this.#value, this);
367
+ if (this.#onChange !== undefined) this.#onChange(this.#value, this);
363
368
  }
364
369
 
365
370
  // Системная палитра шлёт input на каждое движение, change — когда цвет выбран
@@ -5,11 +5,11 @@ chui_color_picker {
5
5
  карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
6
6
  (тот же приём у полосы меню-бара). */
7
7
  --control_padding: var(--control_padding_sm);
8
- --main_padding: var(--main_padding_sm);
8
+ --block_padding: var(--block_padding_sm);
9
9
  display: block;
10
10
  width: max-content;
11
11
  max-width: 100%;
12
- margin: var(--margin);
12
+ margin: var(--block_margin);
13
13
  color: var(--text_color);
14
14
  font-size: var(--font_default_size);
15
15
  }
@@ -17,7 +17,7 @@ chui_color_picker {
17
17
  .color_picker_title {
18
18
  display: block;
19
19
  width: max-content;
20
- margin: 0 0 var(--margin);
20
+ margin: 0 0 var(--block_margin);
21
21
  color: var(--text_color);
22
22
  font-size: var(--font_labels_size);
23
23
  font-weight: 500;
@@ -41,7 +41,7 @@ chui_color_picker {
41
41
  height: var(--control_height);
42
42
  padding: 0;
43
43
  border: 1px solid var(--border_color);
44
- border-radius: var(--border_radius);
44
+ border-radius: var(--radius_sm);
45
45
  background: var(--element_background);
46
46
  cursor: pointer;
47
47
  -webkit-appearance: none;
@@ -54,7 +54,7 @@ chui_color_picker {
54
54
 
55
55
  .color_picker_swatch::-webkit-color-swatch {
56
56
  border: none;
57
- border-radius: calc(var(--border_radius) - 1px);
57
+ border-radius: calc(var(--radius_sm) - 1px);
58
58
  }
59
59
 
60
60
  .color_picker_swatch:focus-visible {
@@ -74,9 +74,9 @@ chui_color_picker {
74
74
  box-sizing: border-box;
75
75
  min-width: 104px;
76
76
  height: var(--control_height);
77
- padding: var(--main_padding);
77
+ padding: var(--block_padding);
78
78
  border: 1px solid var(--border_color);
79
- border-radius: var(--border_radius);
79
+ border-radius: var(--radius_sm);
80
80
  background: var(--element_background);
81
81
  }
82
82
 
@@ -9,17 +9,17 @@ const { Validate } = require("../../../modules/chui_validate/chui_validate");
9
9
 
10
10
  class ComboBox {
11
11
  #id = require("randomstring").generate();
12
- #id_cb = require("randomstring").generate();
13
- #ComboBox_main = document.createElement("chui_combobox");
14
- #ComboBox_second = document.createElement("combobox");
12
+ #idCb = require("randomstring").generate();
13
+ #ComboBoxMain = document.createElement("chui_combobox");
14
+ #ComboBoxSecond = document.createElement("combobox");
15
15
  #label = document.createElement("label");
16
16
  #input = document.createElement("input");
17
- #button_open = document.createElement("combo_button_open");
18
- #button_open_disabled = document.createElement("combo_button_open");
17
+ #buttonOpen = document.createElement("combo_button_open");
18
+ #buttonOpenDisabled = document.createElement("combo_button_open");
19
19
  #dropdown = document.createElement("combobox_dropdown");
20
- #dropdown_height = "max-content";
20
+ #dropdownHeight = "max-content";
21
21
  #a11y = undefined;
22
- #window_click_bound = false;
22
+ #windowClickBound = false;
23
23
  constructor(
24
24
  options = {
25
25
  name: String(),
@@ -32,54 +32,54 @@ class ComboBox {
32
32
  ) {
33
33
  require("../../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_ComboBox");
34
34
  if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
35
- if (options.width !== undefined) this.#ComboBox_main.style.width = options.width;
35
+ if (options.width !== undefined) this.#ComboBoxMain.style.width = options.width;
36
36
  if (options.title !== undefined) {
37
37
  this.#label.classList.add("combobox_label");
38
38
  this.#label.innerText = options.title;
39
- this.#label.setAttribute("for", this.#id_cb);
40
- this.#ComboBox_main.appendChild(this.#label);
39
+ this.#label.setAttribute("for", this.#idCb);
40
+ this.#ComboBoxMain.appendChild(this.#label);
41
41
  }
42
42
  if (options.optionsLen !== undefined) {
43
- this.#dropdown_height = OPTION_ROW_HEIGHT * options.optionsLen + "px";
43
+ this.#dropdownHeight = OPTION_ROW_HEIGHT * options.optionsLen + "px";
44
44
  }
45
- this.#dropdown.style.height = this.#dropdown_height;
45
+ this.#dropdown.style.height = this.#dropdownHeight;
46
46
  if (options.name !== undefined) this.#input.name = options.name;
47
47
  if (options.required !== undefined) this.#input.required = options.required;
48
48
  // Валидация: для списка required означает «есть выбранный вариант»
49
- Validate.installField(this, options, this.#ComboBox_second, undefined, () => this.getValue());
50
- this.#input.setAttribute("id", this.#id_cb);
49
+ Validate.installField(this, options, this.#ComboBoxSecond, undefined, () => this.getValue());
50
+ this.#input.setAttribute("id", this.#idCb);
51
51
  this.#input.classList.add("combobox_input");
52
52
  this.#input.type = "text";
53
53
  // Рамку и подпись активного поля держит общее правило темы (`combobox:focus-within`
54
54
  // в global_style.css): индайновые состояние и цвет подписи перебивали тему
55
55
  // и расходились с остальными полями
56
- this.#button_open.innerHTML = new Icon(
56
+ this.#buttonOpen.innerHTML = new Icon(
57
57
  Icons.HARDWARE.KEYBOARD_ARROW_DOWN,
58
58
  undefined,
59
59
  "var(--blue_prime_background)"
60
60
  ).getHTML();
61
- this.#button_open_disabled.innerHTML = new Icon(
61
+ this.#buttonOpenDisabled.innerHTML = new Icon(
62
62
  Icons.HARDWARE.KEYBOARD_ARROW_DOWN,
63
63
  undefined,
64
64
  "var(--text_color_disabled)"
65
65
  ).getHTML();
66
66
  // Курсор выключенного поля даёт `.combobox_disabled`: `cursor` наследуется
67
67
  this.#dropdown.setAttribute("id", this.#id);
68
- this.#ComboBox_second.appendChild(this.#input);
69
- this.#ComboBox_second.appendChild(this.#button_open);
70
- this.#ComboBox_second.appendChild(this.#dropdown);
68
+ this.#ComboBoxSecond.appendChild(this.#input);
69
+ this.#ComboBoxSecond.appendChild(this.#buttonOpen);
70
+ this.#ComboBoxSecond.appendChild(this.#dropdown);
71
71
  //LISTENERS
72
72
  this.#input.addEventListener("focus", () => {
73
- this.#button_open.style.transform = "rotate(180deg)";
74
- this.#dropdown.style.height = this.#dropdown_height;
73
+ this.#buttonOpen.style.transform = "rotate(180deg)";
74
+ this.#dropdown.style.height = this.#dropdownHeight;
75
75
  });
76
76
  this.#input.addEventListener("blur", () => {
77
- this.#button_open.style.transform = "rotate(0deg)";
78
- this.#dropdown.style.height = this.#dropdown_height;
77
+ this.#buttonOpen.style.transform = "rotate(0deg)";
78
+ this.#dropdown.style.height = this.#dropdownHeight;
79
79
  });
80
- this.#ComboBox_second.addEventListener("click", (event) => {
80
+ this.#ComboBoxSecond.addEventListener("click", (event) => {
81
81
  if (!this.#input.disabled) {
82
- if (event.target.parentNode === this.#ComboBox_second) {
82
+ if (event.target.parentNode === this.#ComboBoxSecond) {
83
83
  this.#input.focus();
84
84
  this.#openDropdown();
85
85
  }
@@ -87,23 +87,23 @@ class ComboBox {
87
87
  });
88
88
 
89
89
  this.#input.addEventListener("input", (event) => {
90
- let dropdown = this.#dropdown;
91
- let query = event.target.value.toLowerCase();
92
- for (let option of dropdown.childNodes) {
90
+ const dropdown = this.#dropdown;
91
+ const query = event.target.value.toLowerCase();
92
+ for (const option of dropdown.childNodes) {
93
93
  if (typeof option.getAttribute !== "function") continue;
94
- let title = option.getAttribute("option_title");
94
+ const title = option.getAttribute("option_title");
95
95
  if (title === null) continue;
96
96
  if (!title.toLowerCase().includes(query)) {
97
97
  option.style.display = "none";
98
98
  dropdown.style.height = "max-content";
99
99
  } else {
100
100
  option.style.display = "block";
101
- dropdown.style.height = this.#dropdown_height;
101
+ dropdown.style.height = this.#dropdownHeight;
102
102
  }
103
103
  }
104
104
  this.#a11y.refresh();
105
105
  });
106
- this.#ComboBox_main.appendChild(this.#ComboBox_second);
106
+ this.#ComboBoxMain.appendChild(this.#ComboBoxSecond);
107
107
  // Клавиатура и aria: фокус в поле, стрелки/Home/End/Enter по опциям, Escape закрывает
108
108
  this.#a11y = new ComboboxKeyboard(this.#input, {
109
109
  dropdown: this.#dropdown,
@@ -113,20 +113,20 @@ class ComboBox {
113
113
  });
114
114
  }
115
115
  #openDropdown() {
116
- new Animation(this.#dropdown).fadeIn();
116
+ new Animation(this.#dropdown).panelIn();
117
117
  setOptionDisplay(this.#dropdown);
118
118
  this.#setDropdownDirection();
119
119
  this.#a11y.setExpanded(true);
120
- if (!this.#window_click_bound) {
121
- this.#window_click_bound = true;
122
- window.addEventListener("click", this.#window_click_event);
120
+ if (!this.#windowClickBound) {
121
+ this.#windowClickBound = true;
122
+ window.addEventListener("click", this.#windowClickEvent);
123
123
  }
124
124
  }
125
125
  #closeDropdown() {
126
126
  // Снимаем слушатель только если он был повешен
127
- if (this.#window_click_bound) {
128
- this.#window_click_bound = false;
129
- window.removeEventListener("click", this.#window_click_event);
127
+ if (this.#windowClickBound) {
128
+ this.#windowClickBound = false;
129
+ window.removeEventListener("click", this.#windowClickEvent);
130
130
  }
131
131
  new Animation(this.#dropdown).fadeOut();
132
132
  if (this.#a11y !== undefined) this.#a11y.setExpanded(false);
@@ -137,11 +137,11 @@ class ComboBox {
137
137
  this.#a11y.destroy();
138
138
  }
139
139
  addValueChangeListener(listener = () => {}) {
140
- this.#ComboBox_main.addEventListener("chui_combo_option_changed", listener);
140
+ this.#ComboBoxMain.addEventListener("chui_combo_option_changed", listener);
141
141
  }
142
142
  addOptions(...options) {
143
- for (let opt of options) {
144
- let option = document.createElement(`combobox_option`);
143
+ for (const opt of options) {
144
+ const option = document.createElement(`combobox_option`);
145
145
  option.innerHTML = opt.title;
146
146
  option.setAttribute("option_title", opt.title);
147
147
  option.setAttribute("option_value", opt.value);
@@ -152,10 +152,10 @@ class ComboBox {
152
152
  value: option.getAttribute("option_value"),
153
153
  },
154
154
  });
155
- this.#ComboBox_main.dispatchEvent(eventAwesome);
155
+ this.#ComboBoxMain.dispatchEvent(eventAwesome);
156
156
  this.#input.value = option.getAttribute("option_title");
157
- this.#ComboBox_main.setAttribute("option_title", option.getAttribute("option_title"));
158
- this.#ComboBox_main.setAttribute("option_value", option.getAttribute("option_value"));
157
+ this.#ComboBoxMain.setAttribute("option_title", option.getAttribute("option_title"));
158
+ this.#ComboBoxMain.setAttribute("option_value", option.getAttribute("option_value"));
159
159
  this.#markSelected(option);
160
160
  });
161
161
  this.#dropdown.appendChild(option);
@@ -166,27 +166,27 @@ class ComboBox {
166
166
  return this.#input.name;
167
167
  }
168
168
  getValue() {
169
- return this.#ComboBox_main.getAttribute("option_value");
169
+ return this.#ComboBoxMain.getAttribute("option_value");
170
170
  }
171
171
  setDisabled(boolean = Boolean()) {
172
172
  this.#input.disabled = boolean;
173
173
  if (boolean) {
174
- this.#ComboBox_second.classList.add("combobox_disabled");
174
+ this.#ComboBoxSecond.classList.add("combobox_disabled");
175
175
  this.#input.className = "combobox_input_disabled";
176
176
  this.#label.className = "combobox_label_disabled";
177
- this.#button_open.remove();
178
- this.#ComboBox_second.appendChild(this.#button_open_disabled);
177
+ this.#buttonOpen.remove();
178
+ this.#ComboBoxSecond.appendChild(this.#buttonOpenDisabled);
179
179
  } else {
180
- this.#ComboBox_second.classList.remove("combobox_disabled");
180
+ this.#ComboBoxSecond.classList.remove("combobox_disabled");
181
181
  this.#input.className = "combobox_input";
182
182
  this.#label.className = "combobox_label";
183
- this.#button_open_disabled.remove();
184
- this.#ComboBox_second.appendChild(this.#button_open);
183
+ this.#buttonOpenDisabled.remove();
184
+ this.#ComboBoxSecond.appendChild(this.#buttonOpen);
185
185
  }
186
186
  }
187
187
  clear() {
188
- this.#ComboBox_main.removeAttribute("option_title");
189
- this.#ComboBox_main.removeAttribute("option_value");
188
+ this.#ComboBoxMain.removeAttribute("option_title");
189
+ this.#ComboBoxMain.removeAttribute("option_value");
190
190
  this.#input.value = "";
191
191
  this.#markSelected(undefined);
192
192
  }
@@ -200,11 +200,11 @@ class ComboBox {
200
200
  else delete item.dataset.selected;
201
201
  }
202
202
  }
203
- #window_click_event = (event) => {
204
- if (event.target.parentNode !== this.#ComboBox_second) this.#closeDropdown();
203
+ #windowClickEvent = (event) => {
204
+ if (event.target.parentNode !== this.#ComboBoxSecond) this.#closeDropdown();
205
205
  };
206
206
  #setDropdownDirection() {
207
- const placement = dropdownPlacement(this.#dropdown, this.#ComboBox_second);
207
+ const placement = dropdownPlacement(this.#dropdown, this.#ComboBoxSecond);
208
208
  // Зазор до поля держит CSS (`top: calc(100% + 4px)`), вверх — то же число через `bottom`
209
209
  this.#dropdown.style.top = placement.up ? "auto" : "";
210
210
  this.#dropdown.style.bottom = placement.up ? "calc(100% + 4px)" : "";
@@ -213,14 +213,14 @@ class ComboBox {
213
213
  else this.#dropdown.style.removeProperty("max-height");
214
214
  }
215
215
  set() {
216
- return this.#ComboBox_main;
216
+ return this.#ComboBoxMain;
217
217
  }
218
218
  }
219
219
 
220
220
  function setOptionDisplay(element) {
221
221
  // Скрытый фильтром вариант показывается снятием инлайнового `display`:
222
222
  // базовый вид строки (блок) задаёт CSS
223
- for (let option of element.childNodes) {
223
+ for (const option of element.childNodes) {
224
224
  option.style.removeProperty("display");
225
225
  }
226
226
  }
@@ -4,11 +4,11 @@ chui_combobox {
4
4
  карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
5
5
  (тот же приём у полосы меню-бара). */
6
6
  --control_padding: var(--control_padding_sm);
7
- --main_padding: var(--main_padding_sm);
7
+ --block_padding: var(--block_padding_sm);
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
  height: max-content;
11
- margin: var(--margin);
11
+ margin: var(--block_margin);
12
12
  width: var(--control_width);
13
13
  }
14
14
 
@@ -17,7 +17,7 @@ combobox {
17
17
  display: flex;
18
18
  height: max-content;
19
19
  width: -webkit-fill-available;
20
- border-radius: var(--border_radius);
20
+ border-radius: var(--radius_sm);
21
21
  padding: 0;
22
22
  font-size: var(--font_default_size);
23
23
  background: var(--element_background);
@@ -27,7 +27,7 @@ combobox {
27
27
  .combobox_input {
28
28
  width: 100%;
29
29
  margin: 0;
30
- /* Отступ текста 11px — как у остальных полей (`--main_padding_sm`), было число 10px */
30
+ /* Отступ текста 11px — как у остальных полей (`--block_padding_sm`), было число 10px */
31
31
  padding-block: var(--control_padding) var(--control_padding);
32
32
  padding-inline: 11px 0;
33
33
  background: transparent;
@@ -54,7 +54,7 @@ combobox_dropdown {
54
54
  position: absolute;
55
55
  display: none;
56
56
  height: max-content;
57
- border-radius: var(--border_radius);
57
+ border-radius: var(--radius_sm);
58
58
  padding: var(--control_padding);
59
59
  font-size: var(--font_default_size);
60
60
  flex-direction: column;
@@ -69,7 +69,7 @@ combobox_dropdown {
69
69
  .combobox_label {
70
70
  height: max-content;
71
71
  width: max-content;
72
- margin: 0 0 var(--margin);
72
+ margin: 0 0 var(--block_margin);
73
73
  font-size: var(--font_labels_size);
74
74
  font-weight: 500;
75
75
  color: var(--text_color);
@@ -77,7 +77,7 @@ combobox_dropdown {
77
77
 
78
78
  combo_button_open {
79
79
  cursor: pointer;
80
- padding: var(--main_padding);
80
+ padding: var(--block_padding);
81
81
  color: var(--blue_prime_background);
82
82
  }
83
83
 
@@ -91,7 +91,7 @@ combobox_option {
91
91
  text-align: start;
92
92
  /* 5px отступа слоя + 6px строки = 11px — отступ текста в поле (как у остальных полей) */
93
93
  padding: var(--control_padding) 6px;
94
- border-radius: var(--border_radius);
94
+ border-radius: var(--radius_sm);
95
95
  color: var(--text_color);
96
96
  /* Подпись держит одну строку: длинный вариант усекается, а не растит список */
97
97
  white-space: nowrap;
@@ -142,7 +142,7 @@ combobox_option:active {
142
142
  cursor: not-allowed;
143
143
  height: max-content;
144
144
  width: max-content;
145
- margin: 0 0 var(--margin);
145
+ margin: 0 0 var(--block_margin);
146
146
  font-size: var(--font_labels_size);
147
147
  font-weight: 500;
148
148
  color: var(--text_color_disabled);