@jsenv/navi 0.2.0 → 0.3.0
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/dist/jsenv_navi.js +12049 -11790
- package/index.js +5 -2
- package/package.json +3 -3
- package/src/components/callout/callout.js +944 -0
- package/src/{validation/demos/validation_message_demo.html → components/callout/callout_demo.html} +40 -42
- package/src/components/callout/test_dynamic_positioning.html +161 -0
- package/src/components/field/button.jsx +135 -130
- package/src/components/field/checkbox_list.jsx +5 -3
- package/src/components/field/input_checkbox.jsx +118 -109
- package/src/components/field/input_radio.jsx +148 -138
- package/src/components/field/input_textual.jsx +76 -75
- package/src/components/field/label.jsx +9 -7
- package/src/components/field/radio_list.jsx +5 -3
- package/src/navi_css_vars.js +14 -0
- package/src/validation/custom_constraint_validation.js +3 -3
- package/src/validation/demos/form_validation_vs_native_demo.html +2 -2
- package/src/components/field/field_css.js +0 -87
- package/src/components/field/navi_css_vars.js +0 -8
- package/src/validation/validation_message.js +0 -749
|
@@ -34,7 +34,6 @@ import { useExecuteAction } from "../action_execution/use_execute_action.js";
|
|
|
34
34
|
import { LoadableInlineElement } from "../loader/loader_background.jsx";
|
|
35
35
|
import { useAutoFocus } from "../use_auto_focus.js";
|
|
36
36
|
import { initCustomField } from "./custom_field.js";
|
|
37
|
-
import "./field_css.js";
|
|
38
37
|
import { ReportReadOnlyOnLabelContext } from "./label.jsx";
|
|
39
38
|
import { useActionEvents } from "./use_action_events.js";
|
|
40
39
|
import {
|
|
@@ -49,80 +48,82 @@ import {
|
|
|
49
48
|
} from "./use_ui_state_controller.js";
|
|
50
49
|
|
|
51
50
|
import.meta.css = /* css */ `
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
51
|
+
@layer navi {
|
|
52
|
+
.navi_input {
|
|
53
|
+
--border-width: 1px;
|
|
54
|
+
--outline-width: 1px;
|
|
55
|
+
--outer-width: calc(var(--border-width) + var(--outline-width));
|
|
56
|
+
--padding-x: 6px;
|
|
57
|
+
--padding-y: 1px;
|
|
58
|
+
|
|
59
|
+
--outline-color: light-dark(#4476ff, #3b82f6);
|
|
60
|
+
|
|
61
|
+
--border-radius: 2px;
|
|
62
|
+
--border-color: light-dark(#767676, #8e8e93);
|
|
63
|
+
--border-color-hover: color-mix(in srgb, var(--border-color) 70%, black);
|
|
64
|
+
--border-color-active: color-mix(in srgb, var(--border-color) 90%, black);
|
|
65
|
+
--border-color-readonly: color-mix(
|
|
66
|
+
in srgb,
|
|
67
|
+
var(--border-color) 45%,
|
|
68
|
+
transparent
|
|
69
|
+
);
|
|
70
|
+
--border-color-disabled: var(--border-color-readonly);
|
|
71
|
+
|
|
72
|
+
--background-color: white;
|
|
73
|
+
--background-color-hover: color-mix(
|
|
74
|
+
in srgb,
|
|
75
|
+
var(--background-color) 95%,
|
|
76
|
+
black
|
|
77
|
+
);
|
|
78
|
+
--background-color-readonly: var(--background-color);
|
|
79
|
+
--background-color-disabled: color-mix(
|
|
80
|
+
in srgb,
|
|
81
|
+
var(--background-color) 60%,
|
|
82
|
+
transparent
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
--color: currentColor;
|
|
86
|
+
--color-readonly: color-mix(in srgb, currentColor 60%, transparent);
|
|
87
|
+
--color-disabled: var(--color-readonly);
|
|
88
|
+
color: var(--color);
|
|
89
|
+
|
|
90
|
+
background-color: var(--background-color);
|
|
91
|
+
border-width: var(--outer-width);
|
|
92
|
+
border-width: var(--outer-width);
|
|
93
|
+
border-style: solid;
|
|
94
|
+
border-color: transparent;
|
|
95
|
+
border-radius: var(--border-radius);
|
|
96
|
+
outline-width: var(--border-width);
|
|
97
|
+
outline-style: solid;
|
|
98
|
+
outline-color: var(--border-color);
|
|
99
|
+
outline-offset: calc(-1 * (var(--border-width)));
|
|
100
|
+
}
|
|
101
|
+
/* Focus */
|
|
102
|
+
.navi_input[data-focus] {
|
|
103
|
+
border-color: var(--outline-color);
|
|
104
|
+
outline-width: var(--outer-width);
|
|
105
|
+
outline-color: var(--outline-color);
|
|
106
|
+
outline-offset: calc(-1 * var(--outer-width));
|
|
107
|
+
}
|
|
108
|
+
/* Readonly */
|
|
109
|
+
.navi_input[data-readonly] {
|
|
110
|
+
color: var(--color-readonly);
|
|
111
|
+
background-color: var(--background-color-readonly);
|
|
112
|
+
outline-color: var(--border-color-readonly);
|
|
113
|
+
}
|
|
114
|
+
.navi_input[data-readonly]::placeholder {
|
|
115
|
+
color: var(--color-readonly);
|
|
116
|
+
}
|
|
117
|
+
/* Disabled */
|
|
118
|
+
.navi_input[data-disabled] {
|
|
119
|
+
color: var(--color-disabled);
|
|
120
|
+
background-color: var(--background-color-disabled);
|
|
121
|
+
outline-color: var(--border-color-disabled);
|
|
122
|
+
}
|
|
123
|
+
/* Callout (info, warning, error) */
|
|
124
|
+
.navi_input[data-callout] {
|
|
125
|
+
border-color: var(--callout-color);
|
|
126
|
+
}
|
|
126
127
|
}
|
|
127
128
|
`;
|
|
128
129
|
|
|
@@ -3,14 +3,16 @@ import { forwardRef } from "preact/compat";
|
|
|
3
3
|
import { useImperativeHandle, useRef, useState } from "preact/hooks";
|
|
4
4
|
|
|
5
5
|
import.meta.css = /* css */ `
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
@layer navi {
|
|
7
|
+
label {
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
label[data-readonly],
|
|
12
|
+
label[data-disabled] {
|
|
13
|
+
color: rgba(0, 0, 0, 0.5);
|
|
14
|
+
cursor: default;
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
`;
|
|
16
18
|
|
|
@@ -28,9 +28,11 @@ import {
|
|
|
28
28
|
} from "./use_ui_state_controller.js";
|
|
29
29
|
|
|
30
30
|
import.meta.css = /* css */ `
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
@layer navi {
|
|
32
|
+
.navi_radio_list {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
`;
|
|
36
38
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import.meta.css = /* css */ `
|
|
2
|
+
@layer navi {
|
|
3
|
+
:root {
|
|
4
|
+
--navi-background-color-readonly: #d3d3d3;
|
|
5
|
+
--navi-color-readonly: grey;
|
|
6
|
+
--navi-background-color-disabled: #d3d3d3;
|
|
7
|
+
--navi-color-disabled: #eeeeee;
|
|
8
|
+
|
|
9
|
+
--navi-info-color: #2196f3;
|
|
10
|
+
--navi-warning-color: #ff9800;
|
|
11
|
+
--navi-error-color: #f44336;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* - Validation messages that follow the input element and adapt to viewport
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
import { openCallout } from "../components/callout/callout.js";
|
|
30
31
|
import {
|
|
31
32
|
DISABLED_CONSTRAINT,
|
|
32
33
|
MAX_CONSTRAINT,
|
|
@@ -39,7 +40,6 @@ import {
|
|
|
39
40
|
TYPE_NUMBER_CONSTRAINT,
|
|
40
41
|
} from "./constraints/native_constraints.js";
|
|
41
42
|
import { READONLY_CONSTRAINT } from "./constraints/readonly_constraint.js";
|
|
42
|
-
import { openValidationMessage } from "./validation_message.js";
|
|
43
43
|
|
|
44
44
|
let debug = false;
|
|
45
45
|
|
|
@@ -373,10 +373,10 @@ export const installCustomConstraintValidation = (
|
|
|
373
373
|
const elementTarget =
|
|
374
374
|
failedConstraintInfo.target || elementReceivingValidationMessage;
|
|
375
375
|
|
|
376
|
-
validationInterface.validationMessage =
|
|
377
|
-
elementTarget,
|
|
376
|
+
validationInterface.validationMessage = openCallout(
|
|
378
377
|
failedConstraintInfo.message,
|
|
379
378
|
{
|
|
379
|
+
anchors: elementTarget,
|
|
380
380
|
level: failedConstraintInfo.level,
|
|
381
381
|
closeOnClickOutside: failedConstraintInfo.closeOnClickOutside,
|
|
382
382
|
onClose: () => {
|
|
@@ -154,12 +154,12 @@ lorsqu'on zoom le comportement semble étrange
|
|
|
154
154
|
<div style="background: red; width: 2000px; height: 1px"></div>
|
|
155
155
|
<div style="background: blue; height: 400px"></div>
|
|
156
156
|
<script type="module">
|
|
157
|
-
import {
|
|
157
|
+
import { openCallout } from "../../components/callout/callout.js";
|
|
158
158
|
|
|
159
159
|
const inputs = document.querySelectorAll("input");
|
|
160
160
|
for (const input of inputs) {
|
|
161
161
|
input.addEventListener("focus", () => {
|
|
162
|
-
|
|
162
|
+
openCallout(input, "Veuillez respecter le format requis.");
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import.meta.css = /* css */ `
|
|
2
|
-
:root {
|
|
3
|
-
--navi-field-border-width: 1px;
|
|
4
|
-
--navi-field-outline-width: 1px;
|
|
5
|
-
|
|
6
|
-
--navi-field-border-color: light-dark(#767676, #8e8e93);
|
|
7
|
-
--navi-field-outline-color: light-dark(#355fcc, #3b82f6);
|
|
8
|
-
--navi-field-background-color: light-dark(#f3f4f6, #2d3748);
|
|
9
|
-
--navi-field-accent-color: light-dark(#355fcc, #3b82f6);
|
|
10
|
-
|
|
11
|
-
--navi-field-disabled-border-color: color-mix(
|
|
12
|
-
in srgb,
|
|
13
|
-
var(--navi-field-border-color) 30%,
|
|
14
|
-
white
|
|
15
|
-
);
|
|
16
|
-
--navi-field-readonly-border-color: var(--navi-field-disabled-border-color);
|
|
17
|
-
--navi-field-active-border-color: color-mix(
|
|
18
|
-
in srgb,
|
|
19
|
-
var(--navi-field-border-color) 90%,
|
|
20
|
-
black
|
|
21
|
-
);
|
|
22
|
-
--navi-field-hover-border-color: color-mix(
|
|
23
|
-
in srgb,
|
|
24
|
-
var(--navi-field-border-color) 70%,
|
|
25
|
-
black
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
--navi-field-disabled-background-color: var(--navi-field-background-color);
|
|
29
|
-
--navi-field-readonly-background-color: var(
|
|
30
|
-
--navi-field-disabled-background-color
|
|
31
|
-
);
|
|
32
|
-
--navi-field-hover-background-color: color-mix(
|
|
33
|
-
in srgb,
|
|
34
|
-
var(--navi-field-background-color) 95%,
|
|
35
|
-
black
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
--navi-field-readonly-color: color-mix(
|
|
39
|
-
in srgb,
|
|
40
|
-
currentColor 30%,
|
|
41
|
-
transparent
|
|
42
|
-
);
|
|
43
|
-
--navi-field-disabled-color: var(--navi-field-readonly-color);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
[data-field-border-and-outline] {
|
|
47
|
-
border-width: calc(
|
|
48
|
-
var(--navi-field-border-width) + var(--navi-field-outline-width)
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
border-style: solid;
|
|
52
|
-
|
|
53
|
-
border-color: transparent;
|
|
54
|
-
outline-width: var(--navi-field-border-width);
|
|
55
|
-
outline-style: none;
|
|
56
|
-
outline-color: var(--navi-field-border-color);
|
|
57
|
-
outline-offset: calc(-1 * (var(--navi-field-border-width)));
|
|
58
|
-
}
|
|
59
|
-
[data-field-wrapper][data-focus-visible] [data-field-border-and-outline] {
|
|
60
|
-
outline-width: calc(
|
|
61
|
-
var(--navi-field-border-width) + var(--navi-field-outline-width)
|
|
62
|
-
);
|
|
63
|
-
outline-style: solid;
|
|
64
|
-
outline-offset: calc(
|
|
65
|
-
-1 * (var(--navi-field-border-width) + var(--navi-field-outline-width))
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
[data-field-wrapper][data-readonly] [data-field-border-and-outline] {
|
|
69
|
-
--navi-field-outline-color: var(--navi-field-readonly-border-color);
|
|
70
|
-
--navi-field-background-color: none;
|
|
71
|
-
}
|
|
72
|
-
[data-field-wrapper][data-active] [data-field-border-and-outline] {
|
|
73
|
-
--navi-field-outline-color: var(--navi-field-active-border-color);
|
|
74
|
-
--navi-field-background-color: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
[data-field-border-hover-only] {
|
|
78
|
-
border: 0;
|
|
79
|
-
}
|
|
80
|
-
[data-field-wrapper][data-hover] [data-field-with-hover-effect-on-border] {
|
|
81
|
-
outline-color: var(--navi-field-hover-border-color);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
[data-field-wrapper][data-readonly] [data-field] {
|
|
85
|
-
--navi-field-color: var(--navi-field-readonly-color);
|
|
86
|
-
}
|
|
87
|
-
`;
|