x4js 2.0.7 → 2.0.9
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.
- package/lib/cjs/x4.js +1 -1
- package/lib/esm/x4.mjs +1 -1
- package/lib/output.d.ts +1472 -0
- package/lib/src/components/boxes/boxes.ts +1 -1
- package/lib/src/components/btngroup/btngroup.ts +7 -11
- package/lib/src/components/button/button.ts +3 -3
- package/lib/src/components/calendar/calendar.ts +6 -6
- package/lib/src/components/checkbox/checkbox.ts +3 -3
- package/lib/src/components/colorinput/colorinput.ts +3 -3
- package/lib/src/components/colorpicker/colorpicker.ts +3 -3
- package/lib/src/components/combobox/combobox.ts +1 -1
- package/lib/src/components/dialog/dialog.ts +3 -2
- package/lib/src/components/header/header.ts +1 -1
- package/lib/src/components/icon/icon.ts +1 -1
- package/lib/src/components/image/image.ts +1 -1
- package/lib/src/components/input/input.ts +2 -2
- package/lib/src/components/label/label.ts +2 -2
- package/lib/src/components/listbox/listbox.ts +1 -1
- package/lib/src/components/menu/menu.ts +3 -3
- package/lib/src/components/messages/messages.ts +2 -2
- package/lib/src/components/notification/notification.ts +2 -2
- package/lib/src/components/panel/panel.ts +2 -2
- package/lib/src/components/popup/popup.ts +2 -2
- package/lib/src/components/progress/progress.ts +1 -1
- package/lib/src/components/rating/rating.ts +2 -2
- package/lib/src/components/sizers/sizer.ts +2 -2
- package/lib/src/components/slider/slider.ts +2 -2
- package/lib/src/components/switch/switch.ts +1 -1
- package/lib/src/components/tabs/tabs.ts +2 -2
- package/lib/src/components/textarea/textarea.ts +1 -1
- package/lib/src/components/textedit/textedit.ts +2 -2
- package/lib/src/components/tooltips/tooltips.ts +2 -2
- package/lib/src/components/treeview/treeview.ts +1 -1
- package/lib/src/components/viewport/viewport.ts +1 -1
- package/lib/src/core/component.ts +1 -1
- package/lib/src/core/core_styles.ts +0 -1
- package/lib/src/types/svg.d.ts +1 -0
- package/lib/src/types/x4react.d.ts +9 -0
- package/lib/types/x4.d.ts +6144 -178
- package/package.json +6 -1
- package/build/x4.css +0 -1
- package/build/x4.js +0 -1
- package/scripts/build.mjs +0 -362
- package/scripts/prepack.mjs +0 -51
- package/src/components/base.scss +0 -26
- package/src/components/boxes/boxes.module.scss +0 -37
- package/src/components/boxes/boxes.ts +0 -125
- package/src/components/btngroup/btngroup.module.scss +0 -29
- package/src/components/btngroup/btngroup.ts +0 -106
- package/src/components/button/button.module.scss +0 -154
- package/src/components/button/button.ts +0 -117
- package/src/components/calendar/calendar-check-sharp-light.svg +0 -1
- package/src/components/calendar/calendar.module.scss +0 -163
- package/src/components/calendar/calendar.ts +0 -326
- package/src/components/calendar/chevron-left-sharp-light.svg +0 -1
- package/src/components/calendar/chevron-right-sharp-light.svg +0 -1
- package/src/components/checkbox/check.svg +0 -4
- package/src/components/checkbox/checkbox.module.scss +0 -142
- package/src/components/checkbox/checkbox.ts +0 -125
- package/src/components/colorinput/colorinput.module.scss +0 -65
- package/src/components/colorinput/colorinput.ts +0 -88
- package/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
- package/src/components/colorpicker/colorpicker.module.scss +0 -133
- package/src/components/colorpicker/colorpicker.ts +0 -477
- package/src/components/combobox/combobox.module.scss +0 -121
- package/src/components/combobox/combobox.ts +0 -190
- package/src/components/combobox/updown.svg +0 -4
- package/src/components/dialog/dialog.module.scss +0 -71
- package/src/components/dialog/dialog.ts +0 -91
- package/src/components/dialog/xmark-sharp-light.svg +0 -1
- package/src/components/form/form.module.scss +0 -34
- package/src/components/form/form.ts +0 -36
- package/src/components/header/header.module.scss +0 -40
- package/src/components/header/header.ts +0 -124
- package/src/components/icon/icon.module.scss +0 -30
- package/src/components/icon/icon.ts +0 -134
- package/src/components/image/image.module.scss +0 -21
- package/src/components/image/image.ts +0 -67
- package/src/components/input/input.module.scss +0 -69
- package/src/components/input/input.ts +0 -274
- package/src/components/label/label.module.scss +0 -52
- package/src/components/label/label.ts +0 -55
- package/src/components/listbox/listbox.module.scss +0 -103
- package/src/components/listbox/listbox.ts +0 -427
- package/src/components/menu/caret-right-solid.svg +0 -1
- package/src/components/menu/menu.module.scss +0 -108
- package/src/components/menu/menu.ts +0 -168
- package/src/components/messages/circle-exclamation.svg +0 -1
- package/src/components/messages/messages.module.scss +0 -47
- package/src/components/messages/messages.ts +0 -64
- package/src/components/normalize.scss +0 -386
- package/src/components/notification/circle-check-solid.svg +0 -1
- package/src/components/notification/circle-exclamation-solid.svg +0 -1
- package/src/components/notification/circle-notch-light.svg +0 -1
- package/src/components/notification/notification.module.scss +0 -82
- package/src/components/notification/notification.ts +0 -108
- package/src/components/notification/xmark-sharp-light.svg +0 -1
- package/src/components/panel/panel.module.scss +0 -48
- package/src/components/panel/panel.ts +0 -57
- package/src/components/popup/popup.module.scss +0 -43
- package/src/components/popup/popup.ts +0 -395
- package/src/components/progress/progress.module.scss +0 -57
- package/src/components/progress/progress.ts +0 -43
- package/src/components/rating/rating.module.scss +0 -23
- package/src/components/rating/rating.ts +0 -125
- package/src/components/rating/star-sharp-light.svg +0 -1
- package/src/components/rating/star-sharp-solid.svg +0 -1
- package/src/components/shared.scss +0 -76
- package/src/components/sizers/sizer.module.scss +0 -90
- package/src/components/sizers/sizer.ts +0 -120
- package/src/components/slider/slider.module.scss +0 -71
- package/src/components/slider/slider.ts +0 -143
- package/src/components/switch/switch.module.scss +0 -127
- package/src/components/switch/switch.ts +0 -56
- package/src/components/tabs/tabs.module.scss +0 -46
- package/src/components/tabs/tabs.ts +0 -157
- package/src/components/textarea/textarea.module.scss +0 -59
- package/src/components/textarea/textarea.ts +0 -54
- package/src/components/textedit/textedit.module.scss +0 -114
- package/src/components/textedit/textedit.ts +0 -82
- package/src/components/themes.scss +0 -77
- package/src/components/tooltips/circle-info-sharp-light.svg +0 -1
- package/src/components/tooltips/tooltips.scss +0 -51
- package/src/components/tooltips/tooltips.ts +0 -103
- package/src/components/treeview/chevron-down-light.svg +0 -1
- package/src/components/treeview/treeview.module.scss +0 -116
- package/src/components/treeview/treeview.ts +0 -403
- package/src/components/viewport/viewport.module.scss +0 -25
- package/src/components/viewport/viewport.ts +0 -38
- package/src/core/component.ts +0 -979
- package/src/core/core_colors.ts +0 -250
- package/src/core/core_dom.ts +0 -471
- package/src/core/core_dragdrop.ts +0 -201
- package/src/core/core_element.ts +0 -98
- package/src/core/core_events.ts +0 -149
- package/src/core/core_i18n.ts +0 -377
- package/src/core/core_router.ts +0 -221
- package/src/core/core_styles.ts +0 -215
- package/src/core/core_svg.ts +0 -550
- package/src/core/core_tools.ts +0 -673
- package/src/demo/assets/house-light.svg +0 -1
- package/src/demo/assets/radio.svg +0 -4
- package/src/demo/index.html +0 -12
- package/src/demo/main.scss +0 -21
- package/src/demo/main.tsx +0 -323
- package/src/x4.scss +0 -19
- package/tsconfig.json +0 -14
- package/types/svg.d.ts +0 -4
- package/types/x4react.d.ts +0 -9
- /package/{types → lib/src/types}/scss.d.ts +0 -0
|
@@ -1,157 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1 +0,0 @@
|
|
|
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>
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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>
|