chuijs 3.6.2 → 3.6.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 (119) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1203 -162
  3. package/framework/appLayout/default/chui_app_layout.js +747 -747
  4. package/framework/appLayout/default/global_style.css +592 -568
  5. package/framework/appLayout/default/main_theme_style.css +118 -101
  6. package/framework/components/chui_accordion/accordion.js +63 -63
  7. package/framework/components/chui_accordion/styles.css +79 -75
  8. package/framework/components/chui_badge/badge.js +55 -55
  9. package/framework/components/chui_badge/styles.css +29 -29
  10. package/framework/components/chui_button/button.js +48 -48
  11. package/framework/components/chui_button/styles.css +75 -70
  12. package/framework/components/chui_calendar/calendar.js +97 -97
  13. package/framework/components/chui_card/card.js +87 -0
  14. package/framework/components/chui_card/styles.css +72 -0
  15. package/framework/components/chui_code/code.js +18 -18
  16. package/framework/components/chui_code/styles.css +9 -9
  17. package/framework/components/chui_console/console.js +27 -27
  18. package/framework/components/chui_console/styles.css +31 -31
  19. package/framework/components/chui_content_block/content_block.js +51 -51
  20. package/framework/components/chui_content_block/styles.css +2 -2
  21. package/framework/components/chui_context_menu/context_menu.js +230 -0
  22. package/framework/components/chui_context_menu/styles.css +136 -0
  23. package/framework/components/chui_custom_element/custom_element.js +24 -24
  24. package/framework/components/chui_details/details.js +85 -85
  25. package/framework/components/chui_details/styles.css +70 -66
  26. package/framework/components/chui_fieldset/fieldset.js +40 -40
  27. package/framework/components/chui_fieldset/styles.css +24 -24
  28. package/framework/components/chui_form/form.js +40 -40
  29. package/framework/components/chui_form/styles.css +21 -21
  30. package/framework/components/chui_graphs/graphs.js +234 -190
  31. package/framework/components/chui_graphs/styles.css +37 -32
  32. package/framework/components/chui_hero/hero.js +98 -0
  33. package/framework/components/chui_hero/styles.css +91 -0
  34. package/framework/components/chui_html_block/html_block.js +16 -16
  35. package/framework/components/chui_html_block/styles.css +5 -5
  36. package/framework/components/chui_hx/hx.js +15 -15
  37. package/framework/components/chui_hx/styles.css +38 -38
  38. package/framework/components/chui_icons/icons.js +2144 -2144
  39. package/framework/components/chui_icons/styles.css +13 -13
  40. package/framework/components/chui_inputs/chui_check_box/check_box.js +32 -32
  41. package/framework/components/chui_inputs/chui_check_box/styles.css +91 -86
  42. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +166 -150
  43. package/framework/components/chui_inputs/chui_combo_box/styles.css +113 -107
  44. package/framework/components/chui_inputs/chui_date/date.js +177 -174
  45. package/framework/components/chui_inputs/chui_date/styles.css +163 -128
  46. package/framework/components/chui_inputs/chui_email/email.js +61 -61
  47. package/framework/components/chui_inputs/chui_email/styles.css +69 -71
  48. package/framework/components/chui_inputs/chui_file/file.js +76 -76
  49. package/framework/components/chui_inputs/chui_file/styles.css +99 -99
  50. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +295 -295
  51. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +212 -235
  52. package/framework/components/chui_inputs/chui_number/number.js +108 -108
  53. package/framework/components/chui_inputs/chui_number/styles.css +84 -84
  54. package/framework/components/chui_inputs/chui_password/password.js +99 -99
  55. package/framework/components/chui_inputs/chui_password/styles.css +97 -97
  56. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +45 -45
  57. package/framework/components/chui_inputs/chui_radio_button/styles.css +76 -73
  58. package/framework/components/chui_inputs/chui_select_box/select_box.js +187 -170
  59. package/framework/components/chui_inputs/chui_select_box/styles.css +123 -117
  60. package/framework/components/chui_inputs/chui_text/styles.css +83 -84
  61. package/framework/components/chui_inputs/chui_text/text.js +91 -91
  62. package/framework/components/chui_inputs/chui_text_area/styles.css +57 -57
  63. package/framework/components/chui_inputs/chui_text_area/text_area.js +61 -61
  64. package/framework/components/chui_inputs/chui_toggle/styles.css +66 -61
  65. package/framework/components/chui_inputs/chui_toggle/toggle.js +36 -36
  66. package/framework/components/chui_label/label.js +54 -54
  67. package/framework/components/chui_label/styles.css +11 -11
  68. package/framework/components/chui_media/audio.js +908 -908
  69. package/framework/components/chui_media/audio_styles.css +458 -458
  70. package/framework/components/chui_media/image.js +105 -105
  71. package/framework/components/chui_media/image_styles.css +61 -61
  72. package/framework/components/chui_media/video.js +248 -248
  73. package/framework/components/chui_media/video_styles.css +160 -160
  74. package/framework/components/chui_menu_bar/menu_bar.js +66 -74
  75. package/framework/components/chui_menu_bar/styles.css +114 -76
  76. package/framework/components/chui_modal/modal.js +142 -135
  77. package/framework/components/chui_modal/styles.css +36 -36
  78. package/framework/components/chui_notification/notification.js +72 -72
  79. package/framework/components/chui_notification/notification_download.js +78 -78
  80. package/framework/components/chui_notification/notification_download_progress.css +119 -123
  81. package/framework/components/chui_notification/notification_download_progress.js +105 -105
  82. package/framework/components/chui_notification/notification_update.js +54 -54
  83. package/framework/components/chui_notification/styles.css +91 -91
  84. package/framework/components/chui_notification/styles_download.css +85 -85
  85. package/framework/components/chui_notification/styles_update.css +73 -73
  86. package/framework/components/chui_paragraph/paragraph.js +14 -14
  87. package/framework/components/chui_paragraph/styles.css +6 -6
  88. package/framework/components/chui_popups/popups.js +250 -250
  89. package/framework/components/chui_popups/styles.css +129 -115
  90. package/framework/components/chui_progress_bar/progress_bar.js +28 -28
  91. package/framework/components/chui_progress_bar/styles.css +28 -28
  92. package/framework/components/chui_radio_group/radio_group.js +57 -57
  93. package/framework/components/chui_radio_group/styles.css +3 -3
  94. package/framework/components/chui_slideshow/slideshow.js +75 -75
  95. package/framework/components/chui_slideshow/styles.css +94 -85
  96. package/framework/components/chui_spinner/spinner.js +45 -45
  97. package/framework/components/chui_spinner/styles.css +23 -23
  98. package/framework/components/chui_table/styles.css +42 -42
  99. package/framework/components/chui_table/table.js +234 -234
  100. package/framework/components/chui_tabs/chui_tabs.js +77 -77
  101. package/framework/components/chui_tabs/styles.css +54 -48
  102. package/framework/components/chui_text_editor/styles.css +217 -217
  103. package/framework/components/chui_text_editor/text_editor.js +144 -144
  104. package/framework/components/chui_text_editor/text_editor_panel.js +568 -568
  105. package/framework/components/chui_tree_view/styles.css +81 -75
  106. package/framework/components/chui_tree_view/tree_view.js +90 -90
  107. package/framework/components/chui_webview/styles.css +27 -27
  108. package/framework/components/chui_webview/webview.js +103 -103
  109. package/framework/components/telegram_bot/chui_telegram_bot.js +183 -183
  110. package/framework/modules/chui_animations/animations.js +121 -121
  111. package/framework/modules/chui_animations/styles.css +79 -79
  112. package/framework/modules/chui_fonts.js +7129 -6974
  113. package/framework/modules/chui_functions.js +106 -78
  114. package/framework/modules/chui_logger/chui_logger.js +53 -53
  115. package/framework/modules/chui_page/page.js +86 -86
  116. package/framework/modules/chui_page/styles.css +9 -9
  117. package/framework/tray_bar/chui_menu_items.js +48 -48
  118. package/index.js +570 -555
  119. package/package.json +51 -46
@@ -1,118 +1,124 @@
1
- chui_selectbox {
2
- display: flex;
3
- flex-direction: column;
4
- height: max-content;
5
- margin: var(--margin);
6
- width: 200px
7
- }
8
-
9
- selectbox {
10
- position: relative;
11
- display:flex;
12
- outline: none;
13
- height: max-content;
14
- width: -webkit-fill-available;
15
- border-radius: var(--border_radius);
16
- padding: 0;
17
- font-size: var(--font_default_size);
18
- color: var(--text_color);
19
- background: var(--element_background);
20
- border: 1px solid var(--border_color);
21
- }
22
-
23
- .selectbox_input {
24
- cursor: pointer;
25
- width:100%;
26
- display: block;
27
- outline: none;
28
- margin: 0;
29
- padding: var(--test_padding) 0 var(--main_padding);
30
- background: transparent;
31
- color: var(--text_color);
32
- text-align: start;
33
- border: none;
34
- font-size: var(--font_default_size);
35
- }
36
-
37
- selectbox_dropdown {
38
- overflow: hidden hidden;
39
- background: var(--element_background);
40
- color: var(--text_color);
41
- outline: none;
42
- position:absolute;
43
- display:none;
44
- height: max-content;
45
- width: -webkit-fill-available;
46
- border-radius: var(--border_radius);
47
- margin-top: 0;
48
- margin-left: 0;
49
- padding: var(--test_padding);
50
- font-size: var(--font_default_size);
51
- flex-direction: column;
52
- z-index: 1;
53
- box-shadow: var(--box_shadow_main);
54
- border: 1px solid var(--border_color);
55
- }
56
-
57
- selectbox_dropdown:hover {
58
- overflow: hidden overlay;
59
- }
60
-
61
- select_button_open {
62
- cursor: pointer;
63
- outline: none;
64
- padding: var(--main_padding);
65
- }
66
-
67
- selectbox_option {
68
- cursor: pointer;
69
- text-align: start;
70
- padding: var(--test_padding);
71
- border-radius: var(--border_radius)
72
- }
73
-
74
- selectbox_option:hover {
75
- padding: var(--main_padding);
76
- background: var(--blue_prime_background);
77
- color: var(--text_color_hover);
78
- }
79
-
80
- .select_label {
81
- height: max-content;
82
- width: max-content;
83
- margin: var(--margin);
84
- font-size: var(--font_labels_size);
85
- font-weight:500;
86
- color: var(--text_color)
87
- }
88
-
89
- /* DISABLED STYLES */
90
- .selectbox_disabled {
91
- cursor: not-allowed;
92
- background: var(--element_background_disabled);
93
- border: 1px solid var(--border_color);
94
- }
95
-
96
- .selectbox_input_disabled {
97
- cursor: not-allowed;
98
- width:100%;
99
- margin: 0;
100
- padding: var(--test_padding) 0 var(--main_padding);
101
- background: transparent;
102
- color: var(--text_color_disabled);
103
- text-align: start;
104
- border: none;
105
- font-size: var(--font_default_size);
106
- display: block;
107
- outline: none;
108
- }
109
-
110
- .select_label_disabled {
111
- cursor: not-allowed;
112
- height: max-content;
113
- width: max-content;
114
- margin: var(--margin);
115
- font-size: var(--font_labels_size);
116
- font-weight:500;
117
- color: var(--text_color_disabled)
1
+ chui_selectbox {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: max-content;
5
+ margin: var(--margin);
6
+ width: var(--control_width)
7
+ }
8
+
9
+ selectbox {
10
+ position: relative;
11
+ display:flex;
12
+ outline: none;
13
+ height: max-content;
14
+ width: -webkit-fill-available;
15
+ border-radius: var(--border_radius);
16
+ padding: 0;
17
+ font-size: var(--font_default_size);
18
+ color: var(--text_color);
19
+ background: var(--element_background);
20
+ border: 1px solid var(--border_color);
21
+ }
22
+
23
+ .selectbox_input {
24
+ cursor: pointer;
25
+ width:100%;
26
+ display: block;
27
+ outline: none;
28
+ margin: 0;
29
+ padding: var(--test_padding) 0 var(--main_padding);
30
+ background: transparent;
31
+ color: var(--text_color);
32
+ text-align: start;
33
+ border: none;
34
+ font-size: var(--font_default_size);
35
+ }
36
+
37
+ selectbox_dropdown {
38
+ overflow: hidden hidden;
39
+ background: var(--header_background);
40
+ backdrop-filter: var(--global_blur);
41
+ -webkit-backdrop-filter: var(--global_blur);
42
+ color: var(--text_color);
43
+ outline: none;
44
+ position:absolute;
45
+ display:none;
46
+ height: max-content;
47
+ width: -webkit-fill-available;
48
+ border-radius: var(--border_radius);
49
+ margin-top: 0;
50
+ margin-left: 0;
51
+ padding: var(--test_padding);
52
+ font-size: var(--font_default_size);
53
+ flex-direction: column;
54
+ z-index: 1;
55
+ box-shadow: var(--box_shadow_main);
56
+ border: 1px solid var(--border_color);
57
+ }
58
+
59
+ selectbox_dropdown:hover {
60
+ overflow: hidden overlay;
61
+ }
62
+
63
+ select_button_open {
64
+ cursor: pointer;
65
+ outline: none;
66
+ padding: var(--main_padding);
67
+ }
68
+
69
+ selectbox_option {
70
+ cursor: pointer;
71
+ text-align: start;
72
+ padding: var(--test_padding);
73
+ border-radius: var(--border_radius)
74
+ }
75
+
76
+ selectbox_option:hover {
77
+ background: var(--blue_prime_background);
78
+ color: var(--text_color_hover);
79
+ }
80
+
81
+ selectbox_option:active {
82
+ background: var(--element_background_prime);
83
+ color: var(--text_color_hover);
84
+ }
85
+
86
+ .select_label {
87
+ height: max-content;
88
+ width: max-content;
89
+ margin: var(--margin);
90
+ font-size: var(--font_labels_size);
91
+ font-weight:500;
92
+ color: var(--text_color)
93
+ }
94
+
95
+ /* DISABLED STYLES */
96
+ .selectbox_disabled {
97
+ cursor: not-allowed;
98
+ background: var(--element_background_disabled);
99
+ border: 1px solid var(--border_color);
100
+ }
101
+
102
+ .selectbox_input_disabled {
103
+ cursor: not-allowed;
104
+ width:100%;
105
+ margin: 0;
106
+ padding: var(--test_padding) 0 var(--main_padding);
107
+ background: transparent;
108
+ color: var(--text_color_disabled);
109
+ text-align: start;
110
+ border: none;
111
+ font-size: var(--font_default_size);
112
+ display: block;
113
+ outline: none;
114
+ }
115
+
116
+ .select_label_disabled {
117
+ cursor: not-allowed;
118
+ height: max-content;
119
+ width: max-content;
120
+ margin: var(--margin);
121
+ font-size: var(--font_labels_size);
122
+ font-weight:500;
123
+ color: var(--text_color_disabled)
118
124
  }
@@ -1,85 +1,84 @@
1
- chui_text_input {
2
- display: flex;
3
- flex-direction: column;
4
- width: 200px;
5
- height: max-content;
6
- margin: var(--margin)
7
- }
8
-
9
- chui_text_main {
10
- display: flex;
11
- width: -webkit-fill-available;
12
- height: max-content;
13
- margin: 0;
14
- border-radius: var(--border_radius);
15
- background: var(--element_background);
16
- color: var(--text_color);
17
- align-items: center;
18
- position: relative;
19
- padding: var(--main_padding);
20
- background: var(--element_background);
21
- border: 1px solid var(--border_color);
22
- }
23
-
24
- .text_input {
25
- width: -webkit-fill-available;
26
- margin: 0;
27
- padding: 0;
28
- background: transparent;
29
- color: var(--text_color);
30
- text-align: start;
31
- border: none;
32
- font-size: var(--font_default_size);
33
- }
34
-
35
- .input_label {
36
- height: max-content;
37
- width: max-content;
38
- margin: var(--margin);
39
- font-size: var(--font_labels_size);
40
- font-weight:500;
41
- color: var(--text_color)
42
- }
43
-
44
- error_message_text {
45
- display: none;
46
- height: max-content;
47
- width: max-content;
48
- margin: var(--margin) var(--margin) 0 var(--margin);
49
- font-size: var(--font_labels_size);
50
- font-weight:500;
51
- color: var(--red_prime_background)
52
- }
53
-
54
- .error_border {
55
- border: none;
56
- }
57
-
58
- /* DISABLED STYLES */
59
- .chui_text_main_disabled {
60
- cursor: not-allowed;
61
- background: var(--element_background_disabled);
62
- border: 1px solid var(--border_color);
63
- }
64
-
65
- .text_input_disabled {
66
- cursor: not-allowed;
67
- width: -webkit-fill-available;
68
- margin: 0;
69
- padding: 0;
70
- background: transparent;
71
- color: var(--text_color_disabled);
72
- text-align: start;
73
- border: none;
74
- font-size: var(--font_default_size);
75
- }
76
-
77
- .input_label_disabled {
78
- cursor: not-allowed;
79
- height: max-content;
80
- width: max-content;
81
- margin: var(--margin);
82
- font-size: var(--font_labels_size);
83
- font-weight:500;
84
- color: var(--text_color_disabled)
1
+ chui_text_input {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: var(--control_width);
5
+ height: max-content;
6
+ margin: var(--margin)
7
+ }
8
+
9
+ chui_text_main {
10
+ display: flex;
11
+ width: -webkit-fill-available;
12
+ height: max-content;
13
+ margin: 0;
14
+ border-radius: var(--border_radius);
15
+ background: var(--element_background);
16
+ color: var(--text_color);
17
+ align-items: center;
18
+ position: relative;
19
+ padding: var(--main_padding);
20
+ border: 1px solid var(--border_color);
21
+ }
22
+
23
+ .text_input {
24
+ width: -webkit-fill-available;
25
+ margin: 0;
26
+ padding: 0;
27
+ background: transparent;
28
+ color: var(--text_color);
29
+ text-align: start;
30
+ border: none;
31
+ font-size: var(--font_default_size);
32
+ }
33
+
34
+ .input_label {
35
+ height: max-content;
36
+ width: max-content;
37
+ margin: var(--margin);
38
+ font-size: var(--font_labels_size);
39
+ font-weight:500;
40
+ color: var(--text_color)
41
+ }
42
+
43
+ error_message_text {
44
+ display: none;
45
+ height: max-content;
46
+ width: max-content;
47
+ margin: var(--margin) var(--margin) 0 var(--margin);
48
+ font-size: var(--font_labels_size);
49
+ font-weight:500;
50
+ color: var(--red_prime_background)
51
+ }
52
+
53
+ .error_border {
54
+ border: 1px solid var(--red_prime_background);
55
+ }
56
+
57
+ /* DISABLED STYLES */
58
+ .chui_text_main_disabled {
59
+ cursor: not-allowed;
60
+ background: var(--element_background_disabled);
61
+ border: 1px solid var(--border_color);
62
+ }
63
+
64
+ .text_input_disabled {
65
+ cursor: not-allowed;
66
+ width: -webkit-fill-available;
67
+ margin: 0;
68
+ padding: 0;
69
+ background: transparent;
70
+ color: var(--text_color_disabled);
71
+ text-align: start;
72
+ border: none;
73
+ font-size: var(--font_default_size);
74
+ }
75
+
76
+ .input_label_disabled {
77
+ cursor: not-allowed;
78
+ height: max-content;
79
+ width: max-content;
80
+ margin: var(--margin);
81
+ font-size: var(--font_labels_size);
82
+ font-weight:500;
83
+ color: var(--text_color_disabled)
85
84
  }
@@ -1,91 +1,91 @@
1
- //version: 1.0.0
2
- const {Animation} = require('../../../modules/chui_animations/animations');
3
-
4
- class TextInput {
5
- #chui_text_main = document.createElement('chui_text_main');
6
- #chui_text_input = document.createElement('chui_text_input');
7
- #id = require("randomstring").generate();
8
- #title = String();
9
- #input = document.createElement('input');
10
- #label = document.createElement('label');
11
- #error_message_text = document.createElement("error_message_text");
12
- constructor(options = {
13
- name: String(),
14
- title: String(),
15
- placeholder: String(),
16
- width: String(),
17
- required: Boolean(),
18
- value: String(),
19
- disableFocus: Boolean(),
20
- inputListener: () => {},
21
- focusListener: () => {},
22
- blurListener: () => {}
23
- }) {
24
- require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_TextInput');
25
- this.#input.type = 'text';
26
- this.#input.className = 'text_input';
27
- this.#input.id = this.#id;
28
-
29
- //Options
30
- if (options.inputListener !== undefined) this.#input.addEventListener('input', options.inputListener);
31
- if (options.focusListener !== undefined) this.#input.addEventListener('focus', options.focusListener);
32
- if (options.blurListener !== undefined) this.#input.addEventListener('blur', options.blurListener);
33
- if (options.name !== undefined) this.#input.name = options.name;
34
- if (options.value !== undefined) this.#input.value = options.value;
35
- if (options.required !== undefined) this.#input.required = options.required;
36
- if (options.disableFocus !== undefined) this.#input.addEventListener("mousedown", () => { return false });
37
- if (options.title !== undefined) {
38
- this.#label.innerText = options.title;
39
- this.#label.className = 'input_label';
40
- this.#label.setAttribute('for', this.#id);
41
- this.#chui_text_input.appendChild(this.#label);
42
- }
43
- if (options.width !== undefined) this.#chui_text_input.style.width = options.width;
44
- if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
45
- this.#input.addEventListener('focus', () => {
46
- if (options.disableFocus) return false
47
- this.#chui_text_main.style.border = '1px solid var(--blue_prime_background)';
48
- this.#label.style.color = 'var(--blue_prime_background)';
49
- })
50
- this.#input.addEventListener('blur', () => {
51
- this.#chui_text_main.removeAttribute("style");
52
- this.#label.removeAttribute("style");
53
- })
54
- this.#chui_text_main.appendChild(this.#input);
55
- this.#chui_text_input.appendChild(this.#chui_text_main);
56
-
57
- //
58
- this.#input.addEventListener("input", () => {
59
- this.#chui_text_main.classList.remove("error_border");
60
- new Animation(this.#error_message_text).fadeOut();
61
- })
62
- }
63
- addInputListener(listener = () => {}) { this.#input.addEventListener('input', listener); }
64
- addFocusListener(listener = () => {}) { this.#input.addEventListener('focus', listener); }
65
- addBlurListener(listener = () => {}) { this.#input.addEventListener('blur', listener); }
66
- getName() { return this.#input.name; }
67
- getTitle() { return this.#title; }
68
- getValue() { return this.#input.value; }
69
- setValue(text = String()) { this.#input.value = text; }
70
- setDisabled(boolean = Boolean()) {
71
- this.#input.disabled = boolean
72
- if (boolean) {
73
- this.#chui_text_main.classList.add("chui_text_main_disabled")
74
- this.#input.className = "text_input_disabled"
75
- this.#label.className = "input_label_disabled"
76
- } else {
77
- this.#chui_text_main.classList.remove("chui_text_main_disabled")
78
- this.#input.className = "text_input"
79
- this.#label.className = "input_label"
80
- }
81
- }
82
- setErrorMessage(message = String()) {
83
- this.#chui_text_main.classList.add("error_border");
84
- this.#error_message_text.innerText = message;
85
- this.#chui_text_input.appendChild(this.#error_message_text);
86
- new Animation(this.#error_message_text).fadeIn();
87
- }
88
- set() { return this.#chui_text_input; }
89
- }
90
-
91
- exports.TextInput = TextInput
1
+ //version: 1.0.0
2
+ const {Animation} = require('../../../modules/chui_animations/animations');
3
+
4
+ class TextInput {
5
+ #chui_text_main = document.createElement('chui_text_main');
6
+ #chui_text_input = document.createElement('chui_text_input');
7
+ #id = require("randomstring").generate();
8
+ #title = String();
9
+ #input = document.createElement('input');
10
+ #label = document.createElement('label');
11
+ #error_message_text = document.createElement("error_message_text");
12
+ constructor(options = {
13
+ name: String(),
14
+ title: String(),
15
+ placeholder: String(),
16
+ width: String(),
17
+ required: Boolean(),
18
+ value: String(),
19
+ disableFocus: Boolean(),
20
+ inputListener: () => {},
21
+ focusListener: () => {},
22
+ blurListener: () => {}
23
+ }) {
24
+ require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_TextInput');
25
+ this.#input.type = 'text';
26
+ this.#input.className = 'text_input';
27
+ this.#input.id = this.#id;
28
+
29
+ //Options
30
+ if (options.inputListener !== undefined) this.#input.addEventListener('input', options.inputListener);
31
+ if (options.focusListener !== undefined) this.#input.addEventListener('focus', options.focusListener);
32
+ if (options.blurListener !== undefined) this.#input.addEventListener('blur', options.blurListener);
33
+ if (options.name !== undefined) this.#input.name = options.name;
34
+ if (options.value !== undefined) this.#input.value = options.value;
35
+ if (options.required !== undefined) this.#input.required = options.required;
36
+ if (options.disableFocus !== undefined) this.#input.addEventListener("mousedown", () => { return false });
37
+ if (options.title !== undefined) {
38
+ this.#label.innerText = options.title;
39
+ this.#label.className = 'input_label';
40
+ this.#label.setAttribute('for', this.#id);
41
+ this.#chui_text_input.appendChild(this.#label);
42
+ }
43
+ if (options.width !== undefined) this.#chui_text_input.style.width = options.width;
44
+ if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
45
+ this.#input.addEventListener('focus', () => {
46
+ if (options.disableFocus) return false
47
+ this.#chui_text_main.style.border = '1px solid var(--blue_prime_background)';
48
+ this.#label.style.color = 'var(--blue_prime_background)';
49
+ })
50
+ this.#input.addEventListener('blur', () => {
51
+ this.#chui_text_main.removeAttribute("style");
52
+ this.#label.removeAttribute("style");
53
+ })
54
+ this.#chui_text_main.appendChild(this.#input);
55
+ this.#chui_text_input.appendChild(this.#chui_text_main);
56
+
57
+ //
58
+ this.#input.addEventListener("input", () => {
59
+ this.#chui_text_main.classList.remove("error_border");
60
+ new Animation(this.#error_message_text).fadeOut();
61
+ })
62
+ }
63
+ addInputListener(listener = () => {}) { this.#input.addEventListener('input', listener); }
64
+ addFocusListener(listener = () => {}) { this.#input.addEventListener('focus', listener); }
65
+ addBlurListener(listener = () => {}) { this.#input.addEventListener('blur', listener); }
66
+ getName() { return this.#input.name; }
67
+ getTitle() { return this.#title; }
68
+ getValue() { return this.#input.value; }
69
+ setValue(text = String()) { this.#input.value = text; }
70
+ setDisabled(boolean = Boolean()) {
71
+ this.#input.disabled = boolean
72
+ if (boolean) {
73
+ this.#chui_text_main.classList.add("chui_text_main_disabled")
74
+ this.#input.className = "text_input_disabled"
75
+ this.#label.className = "input_label_disabled"
76
+ } else {
77
+ this.#chui_text_main.classList.remove("chui_text_main_disabled")
78
+ this.#input.className = "text_input"
79
+ this.#label.className = "input_label"
80
+ }
81
+ }
82
+ setErrorMessage(message = String()) {
83
+ this.#chui_text_main.classList.add("error_border");
84
+ this.#error_message_text.innerText = message;
85
+ this.#chui_text_input.appendChild(this.#error_message_text);
86
+ new Animation(this.#error_message_text).fadeIn();
87
+ }
88
+ set() { return this.#chui_text_input; }
89
+ }
90
+
91
+ exports.TextInput = TextInput