x4js 1.6.5 → 2.0.2

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 (292) hide show
  1. package/README.md +3 -14
  2. package/lib/README.txt +3 -14
  3. package/lib/esm/x4.css +1 -0
  4. package/lib/esm/x4.js +1 -0
  5. package/lib/src/assets/house-light.svg +1 -0
  6. package/lib/src/assets/radio.svg +4 -0
  7. package/lib/src/components/base.scss +26 -0
  8. package/lib/src/components/boxes/boxes.module.scss +37 -0
  9. package/lib/src/components/boxes/boxes.ts +125 -0
  10. package/lib/src/components/btngroup/btngroup.module.scss +29 -0
  11. package/lib/src/components/btngroup/btngroup.ts +106 -0
  12. package/lib/src/components/button/button.module.scss +154 -0
  13. package/lib/src/components/button/button.ts +117 -0
  14. package/lib/src/components/calendar/calendar-check-sharp-light.svg +1 -0
  15. package/lib/src/components/calendar/calendar.module.scss +163 -0
  16. package/lib/src/{calendar.ts → components/calendar/calendar.ts} +81 -83
  17. package/lib/src/components/calendar/chevron-left-sharp-light.svg +1 -0
  18. package/lib/src/components/calendar/chevron-right-sharp-light.svg +1 -0
  19. package/lib/src/components/checkbox/check.svg +4 -0
  20. package/lib/src/components/checkbox/checkbox.module.scss +142 -0
  21. package/lib/src/components/checkbox/checkbox.ts +125 -0
  22. package/lib/src/components/colorinput/colorinput.module.scss +65 -0
  23. package/lib/src/components/colorinput/colorinput.ts +88 -0
  24. package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +1 -0
  25. package/lib/src/components/colorpicker/colorpicker.module.scss +133 -0
  26. package/lib/src/components/colorpicker/colorpicker.ts +477 -0
  27. package/lib/src/components/combobox/combobox.module.scss +121 -0
  28. package/lib/src/components/combobox/combobox.ts +190 -0
  29. package/lib/src/components/combobox/updown.svg +4 -0
  30. package/lib/src/components/dialog/dialog.module.scss +71 -0
  31. package/lib/src/components/dialog/dialog.ts +91 -0
  32. package/lib/src/components/dialog/xmark-sharp-light.svg +1 -0
  33. package/lib/src/components/form/form.module.scss +34 -0
  34. package/lib/src/components/form/form.ts +36 -0
  35. package/lib/src/components/header/header.module.scss +40 -0
  36. package/lib/src/components/header/header.ts +124 -0
  37. package/lib/src/components/icon/icon.module.scss +30 -0
  38. package/lib/src/components/icon/icon.ts +134 -0
  39. package/lib/src/components/image/image.module.scss +21 -0
  40. package/lib/src/components/image/image.ts +67 -0
  41. package/lib/src/components/input/input.module.scss +69 -0
  42. package/lib/src/components/input/input.ts +274 -0
  43. package/lib/src/components/label/label.module.scss +52 -0
  44. package/lib/src/components/label/label.ts +55 -0
  45. package/lib/src/components/listbox/listbox.module.scss +103 -0
  46. package/lib/src/components/listbox/listbox.ts +427 -0
  47. package/lib/src/components/menu/caret-right-solid.svg +1 -0
  48. package/lib/src/components/menu/menu.module.scss +108 -0
  49. package/lib/src/components/menu/menu.ts +168 -0
  50. package/lib/src/components/messages/circle-exclamation.svg +1 -0
  51. package/lib/src/components/messages/messages.module.scss +47 -0
  52. package/lib/src/components/messages/messages.ts +64 -0
  53. package/lib/src/components/normalize.scss +386 -0
  54. package/lib/src/components/notification/circle-check-solid.svg +1 -0
  55. package/lib/src/components/notification/circle-exclamation-solid.svg +1 -0
  56. package/lib/src/components/notification/circle-notch-light.svg +1 -0
  57. package/lib/src/components/notification/notification.module.scss +82 -0
  58. package/lib/src/components/notification/notification.ts +108 -0
  59. package/lib/src/components/notification/xmark-sharp-light.svg +1 -0
  60. package/lib/src/components/panel/panel.module.scss +48 -0
  61. package/lib/src/components/panel/panel.ts +57 -0
  62. package/lib/src/components/popup/popup.module.scss +43 -0
  63. package/lib/src/components/popup/popup.ts +395 -0
  64. package/lib/src/components/progress/progress.module.scss +57 -0
  65. package/lib/src/components/progress/progress.ts +43 -0
  66. package/lib/src/components/rating/rating.module.scss +23 -0
  67. package/lib/src/components/rating/rating.ts +125 -0
  68. package/lib/src/components/rating/star-sharp-light.svg +1 -0
  69. package/lib/src/components/rating/star-sharp-solid.svg +1 -0
  70. package/lib/src/components/shared.scss +76 -0
  71. package/lib/src/components/sizers/sizer.module.scss +90 -0
  72. package/lib/src/components/sizers/sizer.ts +120 -0
  73. package/lib/src/components/slider/slider.module.scss +71 -0
  74. package/lib/src/components/slider/slider.ts +143 -0
  75. package/lib/src/components/switch/switch.module.scss +127 -0
  76. package/lib/src/components/switch/switch.ts +56 -0
  77. package/lib/src/components/tabs/tabs.module.scss +46 -0
  78. package/lib/src/components/tabs/tabs.ts +157 -0
  79. package/lib/src/components/textarea/textarea.module.scss +59 -0
  80. package/lib/src/components/textarea/textarea.ts +54 -0
  81. package/lib/src/components/textedit/textedit.module.scss +114 -0
  82. package/lib/src/components/textedit/textedit.ts +82 -0
  83. package/lib/src/components/themes.scss +77 -0
  84. package/lib/src/components/tooltips/circle-info-sharp-light.svg +1 -0
  85. package/lib/src/components/tooltips/tooltips.scss +51 -0
  86. package/lib/src/components/tooltips/tooltips.ts +103 -0
  87. package/lib/src/components/treeview/chevron-down-light.svg +1 -0
  88. package/lib/src/components/treeview/treeview.module.scss +116 -0
  89. package/lib/src/components/treeview/treeview.ts +403 -0
  90. package/lib/src/components/viewport/viewport.module.scss +25 -0
  91. package/lib/src/components/viewport/viewport.ts +38 -0
  92. package/lib/src/core/component.ts +979 -0
  93. package/lib/src/core/core_colors.ts +250 -0
  94. package/lib/src/{dom_events.ts → core/core_dom.ts} +195 -39
  95. package/lib/src/{drag_manager.ts → core/core_dragdrop.ts} +29 -44
  96. package/lib/src/core/core_element.ts +98 -0
  97. package/lib/src/core/core_events.ts +149 -0
  98. package/lib/src/{i18n.ts → core/core_i18n.ts} +43 -42
  99. package/lib/src/{router.ts → core/core_router.ts} +27 -40
  100. package/lib/src/core/core_styles.ts +215 -0
  101. package/lib/src/core/core_svg.ts +550 -0
  102. package/lib/src/core/core_tools.ts +673 -0
  103. package/lib/src/demo/assets/house-light.svg +1 -0
  104. package/lib/src/demo/assets/radio.svg +4 -0
  105. package/lib/src/demo/index.html +12 -0
  106. package/lib/src/demo/main.scss +21 -0
  107. package/lib/src/demo/main.tsx +323 -0
  108. package/lib/src/main.scss +21 -0
  109. package/lib/src/main.tsx +323 -0
  110. package/lib/src/x4.scss +19 -0
  111. package/lib/src/x4.ts +60 -0
  112. package/lib/types/x4.d.ts +26548 -0
  113. package/package.json +68 -59
  114. package/scripts/build.mjs +351 -0
  115. package/scripts/prepack.mjs +43 -0
  116. package/src/components/base.scss +26 -0
  117. package/src/components/boxes/boxes.module.scss +37 -0
  118. package/src/components/boxes/boxes.ts +125 -0
  119. package/src/components/btngroup/btngroup.module.scss +29 -0
  120. package/src/components/btngroup/btngroup.ts +106 -0
  121. package/src/components/button/button.module.scss +154 -0
  122. package/src/components/button/button.ts +117 -0
  123. package/src/components/calendar/calendar-check-sharp-light.svg +1 -0
  124. package/src/components/calendar/calendar.module.scss +163 -0
  125. package/src/components/calendar/calendar.ts +326 -0
  126. package/src/components/calendar/chevron-left-sharp-light.svg +1 -0
  127. package/src/components/calendar/chevron-right-sharp-light.svg +1 -0
  128. package/src/components/checkbox/check.svg +4 -0
  129. package/src/components/checkbox/checkbox.module.scss +142 -0
  130. package/src/components/checkbox/checkbox.ts +125 -0
  131. package/src/components/colorinput/colorinput.module.scss +65 -0
  132. package/src/components/colorinput/colorinput.ts +88 -0
  133. package/src/components/colorinput/crosshairs-simple-sharp-light.svg +1 -0
  134. package/src/components/colorpicker/colorpicker.module.scss +133 -0
  135. package/src/components/colorpicker/colorpicker.ts +477 -0
  136. package/src/components/combobox/combobox.module.scss +121 -0
  137. package/src/components/combobox/combobox.ts +190 -0
  138. package/src/components/combobox/updown.svg +4 -0
  139. package/src/components/dialog/dialog.module.scss +71 -0
  140. package/src/components/dialog/dialog.ts +91 -0
  141. package/src/components/dialog/xmark-sharp-light.svg +1 -0
  142. package/src/components/form/form.module.scss +34 -0
  143. package/src/components/form/form.ts +36 -0
  144. package/src/components/header/header.module.scss +40 -0
  145. package/src/components/header/header.ts +124 -0
  146. package/src/components/icon/icon.module.scss +30 -0
  147. package/src/components/icon/icon.ts +134 -0
  148. package/src/components/image/image.module.scss +21 -0
  149. package/src/components/image/image.ts +67 -0
  150. package/src/components/input/input.module.scss +69 -0
  151. package/src/components/input/input.ts +274 -0
  152. package/src/components/label/label.module.scss +52 -0
  153. package/src/components/label/label.ts +55 -0
  154. package/src/components/listbox/listbox.module.scss +103 -0
  155. package/src/components/listbox/listbox.ts +427 -0
  156. package/src/components/menu/caret-right-solid.svg +1 -0
  157. package/src/components/menu/menu.module.scss +108 -0
  158. package/src/components/menu/menu.ts +168 -0
  159. package/src/components/messages/circle-exclamation.svg +1 -0
  160. package/src/components/messages/messages.module.scss +47 -0
  161. package/src/components/messages/messages.ts +64 -0
  162. package/src/components/normalize.scss +386 -0
  163. package/src/components/notification/circle-check-solid.svg +1 -0
  164. package/src/components/notification/circle-exclamation-solid.svg +1 -0
  165. package/src/components/notification/circle-notch-light.svg +1 -0
  166. package/src/components/notification/notification.module.scss +82 -0
  167. package/src/components/notification/notification.ts +108 -0
  168. package/src/components/notification/xmark-sharp-light.svg +1 -0
  169. package/src/components/panel/panel.module.scss +48 -0
  170. package/src/components/panel/panel.ts +57 -0
  171. package/src/components/popup/popup.module.scss +43 -0
  172. package/src/components/popup/popup.ts +395 -0
  173. package/src/components/progress/progress.module.scss +57 -0
  174. package/src/components/progress/progress.ts +43 -0
  175. package/src/components/rating/rating.module.scss +23 -0
  176. package/src/components/rating/rating.ts +125 -0
  177. package/src/components/rating/star-sharp-light.svg +1 -0
  178. package/src/components/rating/star-sharp-solid.svg +1 -0
  179. package/src/components/shared.scss +76 -0
  180. package/src/components/sizers/sizer.module.scss +90 -0
  181. package/src/components/sizers/sizer.ts +120 -0
  182. package/src/components/slider/slider.module.scss +71 -0
  183. package/src/components/slider/slider.ts +143 -0
  184. package/src/components/switch/switch.module.scss +127 -0
  185. package/src/components/switch/switch.ts +56 -0
  186. package/src/components/tabs/tabs.module.scss +46 -0
  187. package/src/components/tabs/tabs.ts +157 -0
  188. package/src/components/textarea/textarea.module.scss +59 -0
  189. package/src/components/textarea/textarea.ts +54 -0
  190. package/src/components/textedit/textedit.module.scss +114 -0
  191. package/src/components/textedit/textedit.ts +82 -0
  192. package/src/components/themes.scss +77 -0
  193. package/src/components/tooltips/circle-info-sharp-light.svg +1 -0
  194. package/src/components/tooltips/tooltips.scss +51 -0
  195. package/src/components/tooltips/tooltips.ts +103 -0
  196. package/src/components/treeview/chevron-down-light.svg +1 -0
  197. package/src/components/treeview/treeview.module.scss +116 -0
  198. package/src/components/treeview/treeview.ts +403 -0
  199. package/src/components/viewport/viewport.module.scss +25 -0
  200. package/src/components/viewport/viewport.ts +38 -0
  201. package/src/core/component.ts +979 -0
  202. package/src/core/core_colors.ts +250 -0
  203. package/src/core/core_dom.ts +471 -0
  204. package/src/core/core_dragdrop.ts +201 -0
  205. package/src/core/core_element.ts +98 -0
  206. package/src/core/core_events.ts +149 -0
  207. package/src/core/core_i18n.ts +377 -0
  208. package/src/core/core_router.ts +221 -0
  209. package/src/core/core_styles.ts +215 -0
  210. package/src/core/core_svg.ts +550 -0
  211. package/src/core/core_tools.ts +673 -0
  212. package/src/demo/assets/house-light.svg +1 -0
  213. package/src/demo/assets/radio.svg +4 -0
  214. package/src/demo/index.html +12 -0
  215. package/src/demo/main.scss +21 -0
  216. package/src/demo/main.tsx +323 -0
  217. package/src/x4.scss +19 -0
  218. package/src/x4.ts +60 -0
  219. package/tsconfig.json +14 -0
  220. package/types/scss.d.ts +4 -0
  221. package/types/svg.d.ts +4 -0
  222. package/types/x4react.d.ts +9 -0
  223. package/lib/changelog.txt +0 -23
  224. package/lib/cjs/x4js.js +0 -39
  225. package/lib/cjs/x4js.js.map +0 -7
  226. package/lib/esm/x4js.mjs +0 -15972
  227. package/lib/esm/x4js.mjs.map +0 -7
  228. package/lib/licence.md +0 -21
  229. package/lib/src/MIT-license.md +0 -14
  230. package/lib/src/action.ts +0 -88
  231. package/lib/src/alpha.jpg +0 -0
  232. package/lib/src/app_sockets.ts +0 -81
  233. package/lib/src/application.ts +0 -262
  234. package/lib/src/autocomplete.ts +0 -232
  235. package/lib/src/base64.ts +0 -166
  236. package/lib/src/base_component.ts +0 -152
  237. package/lib/src/button.ts +0 -355
  238. package/lib/src/canvas.ts +0 -510
  239. package/lib/src/cardview.ts +0 -228
  240. package/lib/src/checkbox.ts +0 -188
  241. package/lib/src/color.ts +0 -752
  242. package/lib/src/colorpicker.ts +0 -1649
  243. package/lib/src/combobox.ts +0 -512
  244. package/lib/src/component.ts +0 -2367
  245. package/lib/src/copyright.txt +0 -27
  246. package/lib/src/datastore.ts +0 -1302
  247. package/lib/src/dialog.ts +0 -656
  248. package/lib/src/drawtext.ts +0 -355
  249. package/lib/src/fileupload.ts +0 -213
  250. package/lib/src/form.ts +0 -413
  251. package/lib/src/formatters.ts +0 -105
  252. package/lib/src/gridview.ts +0 -1185
  253. package/lib/src/icon.ts +0 -362
  254. package/lib/src/image.ts +0 -225
  255. package/lib/src/index.ts +0 -89
  256. package/lib/src/input.ts +0 -297
  257. package/lib/src/label.ts +0 -153
  258. package/lib/src/layout.ts +0 -442
  259. package/lib/src/link.ts +0 -86
  260. package/lib/src/listview.ts +0 -765
  261. package/lib/src/md5.ts +0 -438
  262. package/lib/src/menu.ts +0 -425
  263. package/lib/src/messagebox.ts +0 -224
  264. package/lib/src/panel.ts +0 -86
  265. package/lib/src/popup.ts +0 -494
  266. package/lib/src/property_editor.ts +0 -337
  267. package/lib/src/radiobtn.ts +0 -197
  268. package/lib/src/rating.ts +0 -135
  269. package/lib/src/request.ts +0 -300
  270. package/lib/src/settings.ts +0 -77
  271. package/lib/src/sidebarview.ts +0 -108
  272. package/lib/src/spreadsheet.ts +0 -1449
  273. package/lib/src/styles.ts +0 -343
  274. package/lib/src/svgcomponent.ts +0 -592
  275. package/lib/src/tabbar.ts +0 -151
  276. package/lib/src/tabview.ts +0 -110
  277. package/lib/src/textarea.ts +0 -235
  278. package/lib/src/textedit.ts +0 -533
  279. package/lib/src/toaster.ts +0 -80
  280. package/lib/src/tools.ts +0 -1473
  281. package/lib/src/tooltips.ts +0 -191
  282. package/lib/src/treeview.ts +0 -716
  283. package/lib/src/version.ts +0 -30
  284. package/lib/src/x4.less +0 -2242
  285. package/lib/src/x4dom.ts +0 -57
  286. package/lib/src/x4events.ts +0 -585
  287. package/lib/src/x4js.ts +0 -89
  288. package/lib/src/x4react.ts +0 -90
  289. package/lib/styles/x4.css +0 -1785
  290. package/lib/styles/x4.less +0 -2242
  291. package/lib/types/x4js.d.ts +0 -6728
  292. package/license.md +0 -21
@@ -0,0 +1,157 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file tabs.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+ import { Component, ComponentEvents, ComponentProps, EvClick } from '@core/component';
17
+ import { CoreEvent } from '@core/core_events';
18
+
19
+ import { Button, ButtonProps } from '../button/button';
20
+ import { HBox, VBox, StackBox } from '../boxes/boxes';
21
+
22
+ import "./tabs.module.scss"
23
+
24
+ /**
25
+ *
26
+ */
27
+
28
+
29
+ export interface TabItem {
30
+ name: string;
31
+ title: string;
32
+ icon?: string;
33
+ tab: Component;
34
+ }
35
+
36
+
37
+ class CTab extends Button {
38
+ constructor( props: ButtonProps, item: TabItem ) {
39
+ super( props );
40
+
41
+ this.addClass( "outline" );
42
+ this.setIcon( item.icon );
43
+ this.setText( item.title );
44
+ this.setData( "tabname", item.name );
45
+ }
46
+ }
47
+
48
+ /**
49
+ *
50
+ */
51
+
52
+ interface TablistClickEvent extends CoreEvent {
53
+ name: string;
54
+ }
55
+
56
+ interface TablistProps extends ComponentProps {
57
+ click: ( ev: TablistClickEvent ) => void;
58
+ }
59
+
60
+ interface TablistEvents extends ComponentEvents {
61
+ click: TablistClickEvent;
62
+ }
63
+
64
+ /**
65
+ * bar containing buttons
66
+ */
67
+ class CTabList extends HBox<TablistProps,TablistEvents> {
68
+
69
+ private _selitem: Button;
70
+ private _selection: string;
71
+
72
+ constructor( props: TablistProps, content: TabItem[] ) {
73
+ super( props );
74
+
75
+ const tabs = content.map( tab => {
76
+ return new CTab( {
77
+ click: ( ev ) => this._on_click( ev ),
78
+ }, tab );
79
+ })
80
+
81
+ this.mapPropEvents( props, "click" );
82
+ this.setContent( tabs );
83
+ }
84
+
85
+ private _on_click( ev: EvClick ) {
86
+ const name = (ev.source as Component).getData( "tabname" );
87
+ this.fire( "click", {name} );
88
+ }
89
+
90
+ select( name: string ) {
91
+ const tab = this.query<Button>( `[data-tabname="${name}"]` );
92
+ if( this._selitem ) {
93
+ this._selitem.setClass( "selected", false );
94
+ }
95
+
96
+ this._selitem = tab;
97
+ this._selection = name;
98
+
99
+ if( this._selitem ) {
100
+ this._selitem.setClass( "selected", true );
101
+ }
102
+ }
103
+ }
104
+
105
+
106
+ /**
107
+ *
108
+ */
109
+
110
+ interface TabsProps extends Omit<ComponentProps,"content"> {
111
+ default: string;
112
+ items: TabItem[]
113
+ }
114
+
115
+
116
+ export class Tabs extends VBox<TabsProps> {
117
+
118
+ private _list: CTabList;
119
+ private _stack: StackBox;
120
+
121
+ constructor( props: TabsProps ) {
122
+ super( props );
123
+
124
+ const pages = props.items?.map( x => {
125
+ return {
126
+ name: x.name,
127
+ content: x.tab ,
128
+ }
129
+ });
130
+
131
+ this.setContent( [
132
+ this._list = new CTabList( {
133
+ click: ( ev ) => this._onclick( ev ) },
134
+ props.items
135
+ ),
136
+ this._stack = new StackBox( {
137
+ cls: "body x4flex",
138
+ default: props.default,
139
+ items: pages,
140
+ } ),
141
+ ]);
142
+
143
+ if( props.default ) {
144
+ this.selectTab( props.default );
145
+ }
146
+ }
147
+
148
+ selectTab( name: string ) {
149
+ this._list.select( name );
150
+ this._stack.select( name );
151
+ }
152
+
153
+ private _onclick( ev: TablistClickEvent ) {
154
+ this.selectTab( ev.name );
155
+ }
156
+ }
157
+
@@ -0,0 +1,59 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file textarea.module.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ @use "../shared.scss";
18
+
19
+ :root {
20
+ --textarea-border: var( --border );
21
+ --textarea-border-focus: var( --border-focus );
22
+ }
23
+
24
+ .x4textarea {
25
+ margin: 5px;
26
+
27
+ .x4label{
28
+ gap: 0;
29
+ padding: 4px 0;
30
+
31
+ &::after {
32
+ content: ":"
33
+ }
34
+ }
35
+
36
+ textarea {
37
+ @extend .flex;
38
+
39
+ border: 1px solid var( --color-gray-3 );
40
+ padding: 4px;
41
+ outline: none;
42
+ font: inherit;
43
+
44
+ border: 1px solid var( --textarea-border );
45
+
46
+ &:focus {
47
+ border: 1px solid var( --textarea-border-focus );
48
+ }
49
+
50
+ &::selection {
51
+ background-color: var( --color-90 );
52
+ color: white;
53
+ }
54
+
55
+ &[resize=false] {
56
+ resize: none;
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file textarea.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ import { BaseProps } from '../input/input';
18
+ import { Component } from '@core/component';
19
+
20
+ import { Label } from '../label/label';
21
+ import { VBox } from '../boxes/boxes';
22
+
23
+ import "./textarea.module.scss";
24
+
25
+ /**
26
+ *
27
+ */
28
+
29
+ interface TextAreaProps extends BaseProps {
30
+ label?: string;
31
+ value?: string;
32
+ resize?: boolean;
33
+ }
34
+
35
+ export class TextArea extends VBox {
36
+
37
+ private _input: Component;
38
+
39
+ constructor( props: TextAreaProps ) {
40
+ super( props );
41
+
42
+ this.setContent( [
43
+ new Label( { text: props.label }),
44
+ this._input = new Component( { tag: "textarea" })
45
+ ])
46
+
47
+ this._input.setAttribute( "name", props.name );
48
+ this._input.setAttribute( "value", props.value+'' );
49
+
50
+ if( !props.resize ) {
51
+ this._input.setAttribute( "resize", false );
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file textedit.module.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ @use "../shared.scss";
18
+
19
+ :root {
20
+ --textedit-border: var( --border );
21
+ --textedit-border-focus: var( --border-focus );
22
+ --textedit-required: var( --alert-background );
23
+
24
+ --textedit-btn-background: inherit;
25
+ --textedit-btn-color: var( --text-secondary );
26
+ --textedit-btn-color-hover: var( --text-primary );
27
+
28
+ --textedit-color-disabled: var( --disabled-background );
29
+ }
30
+
31
+ .x4textedit {
32
+ @extend .hbox;
33
+ margin: 5px;
34
+ gap: 6px;
35
+
36
+ &> #label { // hbox
37
+ border-bottom: 1px solid transparent;
38
+
39
+ &> .x4label {
40
+ @extend .hbox;
41
+ height: 100%;
42
+ padding: 0;
43
+ font-weight: 500;
44
+ gap: 0;
45
+ }
46
+
47
+ &::after {
48
+ content: ":"
49
+ }
50
+ }
51
+
52
+ &> #edit {
53
+ @extend .hbox;
54
+ @extend .flex;
55
+ border-bottom: 1px solid var( --textedit-border );
56
+
57
+ .x4input {
58
+ @extend .flex;
59
+ outline: none;
60
+ margin: 0;
61
+ }
62
+
63
+ .x4button {
64
+ margin: 0;
65
+ padding: 0;
66
+ background-color: var( --textedit-btn-background );
67
+ color: var( --textedit-btn-color );
68
+
69
+ #icon {
70
+ color: var( --textedit-btn-color );
71
+ }
72
+
73
+ &:hover, &:hover #icon {
74
+ color: var( --textedit-btn-color-hover );
75
+ }
76
+
77
+ &:focus {
78
+ border-bottom-color: var( --textedit-border-focus );
79
+ }
80
+ }
81
+ }
82
+
83
+ &:focus-within {
84
+ #edit {
85
+ border-bottom-color: var( --textedit-border-focus );
86
+ }
87
+
88
+ }
89
+
90
+ &[required] {
91
+ & > #label > .x4label::before {
92
+ content: "*";
93
+ font-weight: bold;
94
+ color: var( --textedit-required )
95
+ }
96
+ }
97
+
98
+ &[disabled] {
99
+ &, * {
100
+ cursor: not-allowed;
101
+ }
102
+
103
+ #label > .x4label #text,
104
+ #label > .x4label::before,
105
+ #label::after {
106
+ color: var( --textedit-color-disabled );
107
+ }
108
+
109
+ #edit input {
110
+ color: var( --textedit-color-disabled );
111
+ background-color: unset;
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file textedit.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ import { Component, ComponentProps, makeUniqueComponentId } from '@core/component';
18
+ import { UnsafeHtml } from '@core/core_tools';
19
+
20
+ import { HBox } from '../boxes/boxes';
21
+ import { Input, TextInputProps } from "../input/input"
22
+ import { Label } from '../label/label';
23
+
24
+ import "./textedit.module.scss";
25
+
26
+ //@todo: disabled
27
+
28
+ /**
29
+ *
30
+ */
31
+
32
+ interface TextEditProps extends ComponentProps {
33
+ label: string | UnsafeHtml;
34
+ labelWidth?: number;
35
+ inputId?: string;
36
+
37
+ type?: "text" | "email" | "password";
38
+ readonly?: boolean;
39
+ required?: boolean;
40
+ value: string | number;
41
+ placeholder?: string;
42
+
43
+ inputGadgets?: Component[];
44
+ }
45
+
46
+ /**
47
+ *
48
+ */
49
+
50
+ export class TextEdit extends HBox {
51
+ constructor( props: TextEditProps ) {
52
+ super( props );
53
+
54
+ if( !props.inputId ) {
55
+ props.inputId = makeUniqueComponentId()
56
+ }
57
+
58
+ if( props.required ) {
59
+ this.setAttribute( "required", true );
60
+ }
61
+
62
+ const gadgets = props.inputGadgets ?? [];
63
+
64
+ this.setContent( [
65
+ new HBox( { id: "label", width: props.labelWidth, content: [
66
+ new Label( { tag: "label", text: props.label, labelFor: props.inputId } ),
67
+ ]}),
68
+ new HBox( { id: "edit", content: [
69
+ new Input( {
70
+ type: props.type ?? "text",
71
+ readonly: props.readonly,
72
+ value: props.value,
73
+ id: props.inputId,
74
+ required: props.required,
75
+ disabled: props.disabled,
76
+ placeholder: props.placeholder
77
+ } ),
78
+ ...gadgets,
79
+ ]})
80
+ ])
81
+ }
82
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file themes.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ :root {
18
+ --color-primary-a0: #ffffff;
19
+ --color-primary-a10: #e0eaf7;
20
+ --color-primary-a20: #c0d6ef;
21
+ --color-primary-a30: #a0c2e7;
22
+ --color-primary-a40: #7dafde;
23
+ --color-primary-a50: #569cd6;
24
+ --color-primary-a55: #{lighten(#477ba7,5%)};
25
+ --color-primary-a60: #477ba7;
26
+ --color-primary-a70: #375b7a;
27
+ --color-primary-a80: #283d51;
28
+ --color-primary-a90: #18212a;
29
+ --color-primary-a100: #000000;
30
+
31
+ --color-danger-a50: #c01010;
32
+ --color-danger-a60: #{darken(#c01010,10%)};
33
+
34
+ --color-success-a50: #10c01f;
35
+ --color-success-a60: #{darken(#10c01f,10%)};
36
+ }
37
+
38
+ :root {
39
+ // Backgrounds
40
+ --background-primary: var(--color-primary-a0); // Fond principal
41
+ --background-secondary: var(--color-primary-a10); // Fond secondaire
42
+
43
+ // Texts
44
+ --text-primary: var(--color-primary-a100); // Texte principal
45
+ --text-secondary: #999; // Texte secondaire
46
+ --text-ternary: #666; // Texte tertiaire
47
+
48
+ // disabled
49
+ --disabled-background: #ccc;
50
+ --disabled-color: white;
51
+ --disabled-color-dark: #aaa;
52
+
53
+ // accents
54
+ --accent-background: var(--color-primary-a60);
55
+ --accent-background-hover: var(--color-primary-a55);
56
+ --accent-background-focus: var(--color-primary-a70);
57
+ --accent-background-active: var(--color-primary-a80);
58
+
59
+ --accent-color: var(--color-primary-a0);
60
+ --accent-color-hover: var(--color-primary-a0);
61
+ --accent-color-focus: var(--color-primary-a0);
62
+ --accent-color-active: var(--color-primary-a0);
63
+
64
+ // Borders
65
+ --border: #e1e1e1; // Bordures
66
+ --border-hover: #c2c2c2; // Bordures au survol
67
+ --border-focus: var( --accent-background ); // Bordures si focus
68
+
69
+ --alert-background: var( --color-danger-a50 );
70
+ --alert-background-active: var( --color-danger-a60 );
71
+ --alert-color: var( --color-primary-a0 );
72
+
73
+ --success-background: var( --color-success-a50 );
74
+ --success-background-active: var( --color-success-a60 );
75
+ --success-color: var( --color-success-a0 );
76
+ }
77
+
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"> <!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448zm0 480A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM192 352v32h16 96 16V352H304 272V240 224H256 216 200v32h16 24v96H208 192zm88-168V136H232v48h48z"/></svg>
@@ -0,0 +1,51 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file tooltips.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ @use "../shared.scss";
18
+
19
+ :root {
20
+ --tooltip-background: var( --color-primary-a70 );
21
+ --tooltip-color: var( --color-primary-a0 );
22
+ --tooltip-border: var( --border-dark );
23
+ }
24
+
25
+ .x4tooltip {
26
+ @extend .shadow-lg;
27
+ display: flex;
28
+ flex-direction: row;
29
+ border: none;
30
+ font-size: 90%;
31
+ position: absolute;
32
+
33
+ .x4icon {
34
+ width: 1.6em;
35
+ height: 100%;
36
+ padding: 2px 4px;
37
+ svg {
38
+ max-height: 100%;
39
+ }
40
+
41
+ background-color: var( --tooltip-background );
42
+ color: var( --tooltip-color );
43
+ border: 1px solid var( --tooltip-border );
44
+ }
45
+
46
+ #text {
47
+ background-color: var( --tooltip-background );
48
+ color: var( --tooltip-color );
49
+ padding: 4px;
50
+ }
51
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file tooltips.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ import { Component, wrapDOM } from '@core/component';
18
+ import { Point, Rect, Timer, UnsafeHtml, unsafeHtml } from '@core/core_tools';
19
+
20
+ import { HBox } from '../boxes/boxes';
21
+ import { Popup, PopupProps } from '../popup/popup.js';
22
+ import { Icon } from '../icon/icon.js';
23
+
24
+ import "./tooltips.scss"
25
+
26
+ import icon from "./circle-info-sharp-light.svg"
27
+
28
+
29
+ let last_hit: HTMLElement = null;
30
+ let tooltip: Tooltip = null;
31
+
32
+ const timer = new Timer( );
33
+
34
+ export function initTooltips( ) {
35
+
36
+ document.addEventListener( "mouseenter", ( ev: MouseEvent ) => {
37
+ if( ev.target===document ) {
38
+ return;
39
+ }
40
+
41
+ const c = wrapDOM( ev.target as HTMLElement );
42
+ const tt = c.getAttribute( "tooltip" );
43
+ if( tt ) {
44
+ last_hit = ev.target as HTMLElement;
45
+ const rc = c.getBoundingRect( );
46
+ showTT( tt, rc, { x:ev.pageX,y:ev.pageY } );
47
+ }
48
+
49
+ }, true );
50
+
51
+ document.addEventListener( "mouseleave", ( ev: Event ) => {
52
+ //console.log( "leave", ev.target );
53
+
54
+ if( last_hit && ev.target==last_hit ) {
55
+ last_hit = null;
56
+ closeTT( );
57
+ }
58
+
59
+ }, true );
60
+ }
61
+
62
+ function showTT( text: string, rc: Rect, pt: Point ) {
63
+ if( !tooltip ) {
64
+ tooltip = new Tooltip( { } );
65
+ }
66
+
67
+ timer.setTimeout( null, 300, ( ) => {
68
+ tooltip.setText( unsafeHtml(text) );
69
+ //tooltip.displayNear( rc, "top left", "bottom left", {x:0,y:4} );
70
+ tooltip.displayAt( pt.x, pt.y );
71
+ } );
72
+ }
73
+
74
+ function closeTT( ) {
75
+ tooltip.show( false );
76
+ timer.clearTimeout( null );
77
+ }
78
+
79
+ /**
80
+ *
81
+ */
82
+
83
+ class Tooltip extends Popup {
84
+
85
+ constructor( props: PopupProps ) {
86
+ super( props );
87
+
88
+ this.setContent(
89
+ new HBox( {content: [
90
+ new Icon( { iconId: icon } ),
91
+ new Component( { id: "text" } )
92
+ ]} )
93
+ );
94
+ }
95
+
96
+ /**
97
+ *
98
+ */
99
+
100
+ setText( text: string|UnsafeHtml ) {
101
+ this.query( "#text" ).setContent( text );
102
+ }
103
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M267.3 395.3c-6.2 6.2-16.4 6.2-22.6 0l-192-192c-6.2-6.2-6.2-16.4 0-22.6s16.4-6.2 22.6 0L256 361.4 436.7 180.7c6.2-6.2 16.4-6.2 22.6 0s6.2 16.4 0 22.6l-192 192z"/></svg>