jsl-ui 9.28.7 → 10.0.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/docs/AutoSuggestComponent.md +17 -0
- package/docs/ButtonComponent.md +14 -0
- package/docs/CheckBoxComponent.md +12 -0
- package/docs/DateComponent.md +12 -0
- package/docs/DateRangeComponent.md +13 -0
- package/docs/DateTimeComponent.md +13 -0
- package/docs/DialogComponent.md +15 -0
- package/docs/ExpanderComponent.md +13 -0
- package/docs/FormComponent.md +15 -0
- package/docs/FormFieldComponent.md +15 -0
- package/docs/GridComponent.md +19 -0
- package/docs/InputComponent.md +15 -0
- package/docs/IntervalComponent.md +13 -0
- package/docs/LoadingComponent.md +12 -0
- package/docs/NavigationComponent.md +17 -0
- package/docs/Notification.md +14 -0
- package/docs/NotificationComponent.md +13 -0
- package/docs/NumberComponent.md +12 -0
- package/docs/OverlayComponent.md +12 -0
- package/docs/ProgressComponent.md +12 -0
- package/docs/README.md +24 -0
- package/docs/RibbonMenuComponent.md +14 -0
- package/docs/SelectComponent.md +15 -0
- package/docs/SplitterComponent.md +14 -0
- package/docs/StackPanelComponent.md +13 -0
- package/docs/TabsComponent.md +16 -0
- package/docs/TimeComponent.md +13 -0
- package/docs/TreeViewComponent.md +16 -0
- package/examples/showcase/checks-and-expanders.ts +163 -0
- package/examples/showcase/cultures.ts +39 -0
- package/examples/showcase/dates.ts +182 -0
- package/examples/showcase/dialogs.ts +184 -0
- package/examples/showcase/feedback-and-navigation.ts +174 -0
- package/examples/showcase/fields.ts +178 -0
- package/examples/showcase/fonts/Jost-Variable.ttf +0 -0
- package/examples/showcase/fonts/OFL-Jost.txt +93 -0
- package/examples/showcase/grids.ts +150 -0
- package/examples/showcase/index.html +60 -0
- package/examples/showcase/layout-and-navigation.ts +47 -0
- package/examples/showcase/nivona.css +98 -0
- package/examples/showcase/selects.ts +158 -0
- package/examples/showcase/showcase.css +231 -0
- package/examples/showcase/showcase.ts +214 -0
- package/examples/showcase/tabs.ts +161 -0
- package/examples/showcase/themes.css +83 -0
- package/examples/showcase/themes.ts +54 -0
- package/lib/components/IntervalComponent.d.ts +5 -0
- package/lib/components/IntervalComponent.js +29 -13
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +11 -9
- package/lib/components/auto-suggest/AutoSuggestComponent.js +25 -38
- package/lib/components/button/ButtonComponent.d.ts +30 -1
- package/lib/components/button/ButtonComponent.js +85 -4
- package/lib/components/checkbox/CheckBoxComponent.d.ts +11 -1
- package/lib/components/checkbox/CheckBoxComponent.js +66 -56
- package/lib/components/checkbox/CheckBoxStyle.scss +72 -85
- package/lib/components/date/DateComponent.d.ts +10 -0
- package/lib/components/date/DateComponent.js +92 -44
- package/lib/components/date-range/DateRangeComponent.d.ts +14 -3
- package/lib/components/date-range/DateRangeComponent.js +96 -86
- package/lib/components/date-range/DateRangeStyle.scss +35 -11
- package/lib/components/date-time/DateTimeComponent.d.ts +8 -0
- package/lib/components/date-time/DateTimeComponent.js +64 -23
- package/lib/components/date-time/DateTimeStyle.scss +10 -7
- package/lib/components/dialog/DialogComponent.d.ts +21 -7
- package/lib/components/dialog/DialogComponent.js +179 -122
- package/lib/components/expander/ExpanderComponent.d.ts +15 -1
- package/lib/components/expander/ExpanderComponent.js +85 -64
- package/lib/components/expander/ExpanderStyle.scss +61 -47
- package/lib/components/form-field/FormFieldComponent.d.ts +45 -15
- package/lib/components/form-field/FormFieldComponent.js +249 -96
- package/lib/components/form-field/FormFieldStyle.scss +36 -87
- package/lib/components/form-field/create-control.d.ts +7 -0
- package/lib/components/form-field/create-control.js +48 -0
- package/lib/components/input/InputComponent.d.ts +18 -1
- package/lib/components/input/InputComponent.js +68 -93
- package/lib/components/loading/LoadingComponent.d.ts +9 -2
- package/lib/components/loading/LoadingComponent.js +13 -12
- package/lib/components/loading/LoadingStyle.css +19 -29
- package/lib/components/navigation/NavigationComponent.d.ts +34 -10
- package/lib/components/navigation/NavigationComponent.js +261 -33
- package/lib/components/navigation/NavigationStyle.scss +62 -226
- package/lib/components/notification/Notification.d.ts +37 -4
- package/lib/components/notification/Notification.js +160 -41
- package/lib/components/notification/Notification.scss +103 -19
- package/lib/components/number/NumberComponent.d.ts +16 -2
- package/lib/components/number/NumberComponent.js +54 -53
- package/lib/components/overlay/OverlayComponent.d.ts +13 -7
- package/lib/components/overlay/OverlayComponent.js +46 -114
- package/lib/components/overlay/overlay.css +18 -57
- package/lib/components/progress/ProgressComponent.d.ts +1 -0
- package/lib/components/progress/ProgressComponent.js +6 -6
- package/lib/components/progress/ProgressStyle.scss +5 -15
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +2 -2
- package/lib/components/ribbon-menu/RibbonMenuStyle.scss +6 -76
- package/lib/components/select/SelectComponent.d.ts +33 -3
- package/lib/components/select/SelectComponent.js +312 -278
- package/lib/components/select/SelectDDAreaComponent.d.ts +13 -7
- package/lib/components/select/SelectDDAreaComponent.js +215 -256
- package/lib/components/select/SelectStyle.scss +204 -186
- package/lib/components/slider/nouislider.css +40 -54
- package/lib/components/stack-panel/SplitterComponent.d.ts +19 -3
- package/lib/components/stack-panel/SplitterComponent.js +94 -111
- package/lib/components/stack-panel/SplitterStyle.scss +9 -45
- package/lib/components/stack-panel/StackPanelComponent.js +3 -3
- package/lib/components/stack-panel/StackPanelStyle.scss +10 -52
- package/lib/components/tabs/TabsComponent.d.ts +17 -1
- package/lib/components/tabs/TabsComponent.js +247 -123
- package/lib/components/tabs/TabsStyle.scss +138 -75
- package/lib/components/time/TimeComponent.d.ts +5 -0
- package/lib/components/time/TimeComponent.js +61 -69
- package/lib/components/time/TimeComponent.scss +4 -4
- package/lib/components/tree-view/TreeViewComponent.d.ts +10 -4
- package/lib/components/tree-view/TreeViewComponent.js +65 -32
- package/lib/components/tree-view/TreeViewStyle.scss +12 -96
- package/lib/core/date.d.ts +2 -0
- package/lib/core/date.js +6 -0
- package/lib/core/jq.js +11 -8
- package/lib/grid/slick-default-theme.css +107 -31
- package/lib/grid/slick.creator.js +23 -5
- package/lib/grid/slick.formatters.js +4 -3
- package/lib/grid/slick.grid.css +38 -26
- package/lib/grid/slick.grid.d.ts +1 -0
- package/lib/grid/slick.grid.js +2 -3
- package/lib/grid.css +3413 -454
- package/lib/index.css +2500 -1031
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interaction/moveable.d.ts +1 -0
- package/lib/interaction/moveable.js +8 -0
- package/lib/interaction/resizable.d.ts +1 -0
- package/lib/interaction/resizable.js +9 -0
- package/lib/ui/auto.suggest.css +31 -14
- package/lib/ui/auto.suggest.d.ts +1 -0
- package/lib/ui/auto.suggest.js +88 -18
- package/lib/ui/base.css +2 -48
- package/lib/ui/button.css +134 -0
- package/lib/ui/date-input.css +11 -0
- package/lib/ui/date.picker/css/tiny-date-picker.css +124 -325
- package/lib/ui/date.picker/date-picker-options.js +4 -3
- package/lib/ui/date.picker/lib/date-manip.js +9 -0
- package/lib/ui/date.picker/mode/base-mode.d.ts +2 -1
- package/lib/ui/date.picker/mode/base-mode.js +112 -22
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +2 -4
- package/lib/ui/date.picker/mode/dropdown-mode.js +29 -42
- package/lib/ui/date.picker/mode/index.d.ts +2 -1
- package/lib/ui/date.picker/mode/modal-mode.d.ts +2 -1
- package/lib/ui/date.picker/mode/modal-mode.js +4 -2
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +2 -1
- package/lib/ui/date.picker/views/day-picker.js +24 -15
- package/lib/ui/date.picker/views/month-picker.js +1 -1
- package/lib/ui/date.picker/views/year-picker.js +3 -2
- package/lib/ui/date.picker.d.ts +2 -1
- package/lib/ui/dialog.css +144 -108
- package/lib/ui/dialog.d.ts +19 -1
- package/lib/ui/dialog.js +178 -60
- package/lib/ui/input.css +35 -0
- package/lib/ui/number.input.js +50 -37
- package/lib/ui/theme.css +28 -0
- package/package.json +12 -8
- package/lib/components/drop-down/DropDownComponent.d.ts +0 -27
- package/lib/components/drop-down/DropDownComponent.js +0 -60
- package/lib/components/expander/OldExpanderStyle.scss +0 -37
- package/lib/ui/drop.down.d.ts +0 -52
- package/lib/ui/drop.down.js +0 -2112
|
@@ -1,87 +1,108 @@
|
|
|
1
1
|
import "./ExpanderStyle.scss";
|
|
2
|
+
import { helper } from "../../core/helper";
|
|
2
3
|
export class ExpanderComponent {
|
|
3
4
|
constructor(optionsOrHeader, body, expanded) {
|
|
4
|
-
var _a;
|
|
5
|
-
this.State = { expanded: false, waitingForAnimation: false };
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.options.expanded = (_a = this.options.expanded) !== null && _a !== void 0 ? _a : true;
|
|
13
|
-
}
|
|
14
|
-
this.State.expanded = this.options.expanded;
|
|
5
|
+
var _a, _b;
|
|
6
|
+
this.State = { expanded: false, waitingForAnimation: false, id: helper.newDomGuid() };
|
|
7
|
+
this.options = body != null ?
|
|
8
|
+
{ header: optionsOrHeader, body, expanded: expanded !== null && expanded !== void 0 ? expanded : true } :
|
|
9
|
+
{ ...optionsOrHeader };
|
|
10
|
+
this.options = { enabled: true, expanded: true, isToggleOnHeader: true, ...this.options };
|
|
11
|
+
this.options.isToggleOnHeader = (_a = this.options.isToggleOnHeader) !== null && _a !== void 0 ? _a : true;
|
|
12
|
+
this.State.expanded = (_b = this.options.expanded) !== null && _b !== void 0 ? _b : true;
|
|
15
13
|
}
|
|
16
14
|
getIcon(expanded) {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
15
|
return {
|
|
19
16
|
tag: "span", attr: {
|
|
20
|
-
class: "expand-collapse-icon"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"min-width:" + ((_a = this.options.iconSize) !== null && _a !== void 0 ? _a : "1.5rem") + "; min-height:" + ((_b = this.options.iconSize) !== null && _b !== void 0 ? _b : "1.5rem") +
|
|
25
|
-
";max-width:" + ((_c = this.options.iconSize) !== null && _c !== void 0 ? _c : "1.5rem") + "; max-height:" + ((_d = this.options.iconSize) !== null && _d !== void 0 ? _d : "1.5rem") + ";' " +
|
|
26
|
-
"xml:space='preserve' width='1024px' height='1024px' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='nonzero' clip-rule='evenodd' viewBox='0 0 10240 10240'>" +
|
|
27
|
-
(expanded
|
|
28
|
-
? "<path id='curve0' fill='#FFFFFF' d='M1273 3989l3621 3620c124,125 328,125 452,0l3621 -3620c124,-125 124,-328 0,-453l-905 -905c-125,-125 -328,-125 -453,0l-2489 2489 -2489 -2489c-125,-125 -328,-125 -453,0l-905 905c-124,125 -124,328 0,453z'/>"
|
|
29
|
-
: "<path id='curve0' fill='#FFFFFF' d='M3989 1273l3620 3621c125,124 125,328 0,452l-3620 3621c-125,124 -328,124 -453,0l-905 -905c-125,-125 -125,-328 0,-453l2489 -2489 -2489 -2489c-125,-125 -125,-328 0,-453l905 -905c125,-124 328,-124 453,0z'/>") +
|
|
30
|
-
"</svg>"
|
|
17
|
+
class: "expand-collapse-icon" + (expanded ? " is-expanded" : ""),
|
|
18
|
+
style: this.options.iconSize ? "width:" + this.options.iconSize + ";height:" + this.options.iconSize : undefined,
|
|
19
|
+
"aria-hidden": "true"
|
|
20
|
+
}, children: [{ tag: "span", attr: { class: "expander-chevron" } }]
|
|
31
21
|
};
|
|
32
22
|
}
|
|
33
|
-
isEqual(node) {
|
|
34
|
-
return this.__proto__ === node.__proto__;
|
|
35
|
-
}
|
|
23
|
+
isEqual(node) { return this.__proto__ === node.__proto__; }
|
|
36
24
|
render() {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
if (!this.State.expanded) {
|
|
27
|
+
this.restoreFocusFromBody();
|
|
28
|
+
}
|
|
39
29
|
this.State.waitingForAnimation = false;
|
|
30
|
+
const id = (_a = this.State.id) !== null && _a !== void 0 ? _a : (this.State.id = helper.newDomGuid());
|
|
40
31
|
return {
|
|
41
|
-
tag: "div", attr: {
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
tag: "div", attr: {
|
|
33
|
+
id: this.options.id,
|
|
34
|
+
class: "expander-comp " + (this.State.expanded ? "expanded " : "") +
|
|
35
|
+
(this.options.isToggleOnHeader ? "toggle-on-header " : "") + (!this.options.enabled ? "disabled " : "") + ((_b = this.options.class) !== null && _b !== void 0 ? _b : ""),
|
|
36
|
+
style: this.options.style
|
|
37
|
+
}, children: [
|
|
38
|
+
{ tag: "div", attr: {
|
|
44
39
|
class: "header",
|
|
45
|
-
click: (
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
40
|
+
click: (event) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
if (!this.options.enabled || !this.options.isToggleOnHeader ||
|
|
43
|
+
event.target.closest("button,a,input,select,textarea,[role=button],[contenteditable]:not([contenteditable=false])")) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
(_b = (_a = this.State.dom) === null || _a === void 0 ? void 0 : _a.querySelector(".toggler")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
48
|
+
this.toggle();
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}, children: [
|
|
52
|
+
{ tag: "button", attr: {
|
|
53
|
+
id: id + "-toggle", type: "button", class: "toggler",
|
|
54
|
+
"aria-controls": id + "-body", "aria-expanded": String(this.State.expanded),
|
|
55
|
+
"aria-label": this.options.ariaLabel,
|
|
56
|
+
"aria-labelledby": this.options.ariaLabel ? undefined : id + "-title",
|
|
57
|
+
disabled: this.options.enabled ? undefined : "disabled",
|
|
58
|
+
click: (event) => { event.stopPropagation(); this.toggle(); return false; }
|
|
59
|
+
}, children: [{ tag: "span", attr: { class: "expander-icon", "aria-hidden": "true" }, children: [
|
|
60
|
+
this.State.expanded ? (_c = this.options.expandedIcon) !== null && _c !== void 0 ? _c : this.getIcon(true) : (_d = this.options.collapsedIcon) !== null && _d !== void 0 ? _d : this.getIcon(false)
|
|
61
|
+
] }] },
|
|
62
|
+
{ tag: "div", attr: { class: "content", id: id + "-title" }, children: [this.toNode(this.options.header)] }
|
|
63
|
+
] },
|
|
64
|
+
{ tag: "div", attr: {
|
|
65
|
+
class: "body", id: id + "-body", role: "region", "aria-labelledby": id + "-toggle",
|
|
66
|
+
hidden: this.State.expanded ? undefined : "hidden"
|
|
67
|
+
}, children: [this.toNode(this.options.body)] }
|
|
66
68
|
]
|
|
67
69
|
};
|
|
68
70
|
}
|
|
71
|
+
onInit(renderer) { this.State.renderer = renderer; }
|
|
72
|
+
onCreate(node) { this.State.dom = node.dom; }
|
|
73
|
+
onRemove() { this.State.dom = null; this.State.renderer = null; }
|
|
74
|
+
isExpanded() { return this.State.expanded; }
|
|
75
|
+
/** Updates expansion silently. User activation and toggle() consult onToggle. */
|
|
76
|
+
setExpanded(expanded) {
|
|
77
|
+
var _a;
|
|
78
|
+
if (!expanded) {
|
|
79
|
+
this.restoreFocusFromBody();
|
|
80
|
+
}
|
|
81
|
+
this.State.expanded = !!expanded;
|
|
82
|
+
(_a = this.State.renderer) === null || _a === void 0 ? void 0 : _a.refresh();
|
|
83
|
+
}
|
|
84
|
+
toggle() { this.toggleExpand(); }
|
|
69
85
|
toggleExpand() {
|
|
70
|
-
|
|
71
|
-
if (this.options.
|
|
72
|
-
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
86
|
+
var _a, _b, _c;
|
|
87
|
+
if (!this.options.enabled) {
|
|
88
|
+
return;
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
const expanded = !this.State.expanded;
|
|
91
|
+
if (((_b = (_a = this.options).onToggle) === null || _b === void 0 ? void 0 : _b.call(_a, expanded)) === false) {
|
|
92
|
+
(_c = this.State.renderer) === null || _c === void 0 ? void 0 : _c.refresh();
|
|
93
|
+
return;
|
|
78
94
|
}
|
|
79
|
-
this.State.
|
|
95
|
+
this.State.waitingForAnimation = expanded;
|
|
96
|
+
this.setExpanded(expanded);
|
|
80
97
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
restoreFocusFromBody() {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
const body = (_a = this.State.dom) === null || _a === void 0 ? void 0 : _a.querySelector(":scope > .body");
|
|
101
|
+
if (body === null || body === void 0 ? void 0 : body.contains(document.activeElement)) {
|
|
102
|
+
(_b = this.State.dom.querySelector(".toggler")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
84
103
|
}
|
|
85
|
-
|
|
104
|
+
}
|
|
105
|
+
toNode(content) {
|
|
106
|
+
return typeof content === "string" ? { tag: "div", content } : content;
|
|
86
107
|
}
|
|
87
108
|
}
|
|
@@ -1,47 +1,61 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
@import "../../ui/theme.css";
|
|
2
|
+
|
|
3
|
+
.expander-comp {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
border: 1px solid var(--jsl-color-border-subtle);
|
|
7
|
+
border-radius: .625rem;
|
|
8
|
+
background: var(--jsl-color-surface);
|
|
9
|
+
color: var(--jsl-color-text);
|
|
10
|
+
font: inherit;
|
|
11
|
+
font-size: .875rem;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
}
|
|
14
|
+
.expander-comp > .header {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: .5rem;
|
|
18
|
+
min-height: 3rem;
|
|
19
|
+
padding: .5rem .875rem .5rem .625rem;
|
|
20
|
+
border-radius: inherit;
|
|
21
|
+
}
|
|
22
|
+
.expander-comp.toggle-on-header > .header { cursor: pointer; }
|
|
23
|
+
.expander-comp.toggle-on-header:not(.disabled) > .header:hover { background: var(--jsl-color-surface-hover); }
|
|
24
|
+
.expander-comp > .header > .toggler {
|
|
25
|
+
appearance: none;
|
|
26
|
+
display: inline-grid;
|
|
27
|
+
place-items: center;
|
|
28
|
+
flex: 0 0 auto;
|
|
29
|
+
min-width: 2rem;
|
|
30
|
+
min-height: 2rem;
|
|
31
|
+
padding: .25rem;
|
|
32
|
+
margin: 0;
|
|
33
|
+
border: 0;
|
|
34
|
+
border-radius: .375rem;
|
|
35
|
+
background: transparent;
|
|
36
|
+
color: var(--jsl-color-text-secondary);
|
|
37
|
+
font: inherit;
|
|
38
|
+
line-height: 1;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
.expander-comp > .header > .toggler:hover:not(:disabled) { background: var(--jsl-color-surface-selected); }
|
|
42
|
+
.expander-comp > .header > .toggler:focus-visible { outline: 2px solid var(--jsl-color-focus); outline-offset: 2px; }
|
|
43
|
+
.expander-comp > .header > .content { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
|
|
44
|
+
.expander-icon, .expand-collapse-icon { display: inline-grid; place-items: center; }
|
|
45
|
+
.expand-collapse-icon { width: 1rem; height: 1rem; }
|
|
46
|
+
.expander-chevron {
|
|
47
|
+
display: block;
|
|
48
|
+
width: 37.5%;
|
|
49
|
+
height: 37.5%;
|
|
50
|
+
border: solid currentColor;
|
|
51
|
+
border-width: 0 1.5px 1.5px 0;
|
|
52
|
+
transform: rotate(-45deg);
|
|
53
|
+
}
|
|
54
|
+
.expand-collapse-icon.is-expanded .expander-chevron { transform: rotate(45deg) translate(-1px, -1px); }
|
|
55
|
+
.expander-comp > .body { border-top: 1px solid var(--jsl-color-border-subtle); padding: 1rem 1.125rem; overflow-wrap: anywhere; }
|
|
56
|
+
.expander-comp > .body[hidden] { display: none; }
|
|
57
|
+
.expander-comp.expanded > .body { animation: jsl-expander-appear .14s ease-out; }
|
|
58
|
+
.expander-comp.disabled > .header { color: var(--jsl-color-disabled-text); cursor: default; background: var(--jsl-color-disabled-surface); }
|
|
59
|
+
.expander-comp > .header > .toggler:disabled { color: var(--jsl-color-disabled-text); cursor: not-allowed; }
|
|
60
|
+
@keyframes jsl-expander-appear { from { opacity: 0; } to { opacity: 1; } }
|
|
61
|
+
@media (prefers-reduced-motion: reduce) { .expander-comp.expanded > .body { animation: none; } }
|
|
@@ -1,39 +1,69 @@
|
|
|
1
1
|
import "./FormFieldStyle.scss";
|
|
2
|
-
import { IJSLComponent, IJSLVNode } from "jsl-render";
|
|
2
|
+
import { IJSLComponent, IJSLVNode, JSLRender } from "jsl-render";
|
|
3
3
|
import { IDatePickerOptions } from "../../ui/date.picker";
|
|
4
4
|
import { INumberInputOptions } from "../../ui/number.input";
|
|
5
5
|
import { IAutoSuggestOptions } from "../../ui/auto.suggest";
|
|
6
|
-
|
|
6
|
+
import { IInputOptions } from "../input/InputComponent";
|
|
7
|
+
export interface IFormFieldOptions<TValue = string> {
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
id?: string;
|
|
9
10
|
label: string;
|
|
10
|
-
|
|
11
|
+
/** Legacy convenience factory. A supplied control takes precedence. */
|
|
12
|
+
type?: IInputOptions["type"] | "date" | "autosuggest";
|
|
11
13
|
dateOptions?: IDatePickerOptions;
|
|
12
14
|
numberOptions?: INumberInputOptions;
|
|
13
15
|
autoSuggestOptions?: IAutoSuggestOptions;
|
|
14
|
-
value?:
|
|
16
|
+
value?: TValue;
|
|
15
17
|
maxLength?: number;
|
|
16
18
|
class?: string;
|
|
17
19
|
required?: boolean;
|
|
18
|
-
onValidate?: (val:
|
|
20
|
+
onValidate?: (val: TValue) => boolean | string;
|
|
19
21
|
onBlur?: (evt: any, input: IJSLVNode) => void;
|
|
20
22
|
onFocus?: (evt: any, input: IJSLVNode) => void;
|
|
21
23
|
onInput?: (evt: any, input: IJSLVNode) => void;
|
|
24
|
+
control?: IJSLComponent | IJSLVNode;
|
|
25
|
+
controlId?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
style?: string;
|
|
29
|
+
labelPosition?: "above" | "floating";
|
|
30
|
+
requiredMessage?: string;
|
|
31
|
+
invalidMessage?: string;
|
|
22
32
|
}
|
|
23
|
-
export declare class FormFieldComponent implements IJSLComponent {
|
|
33
|
+
export declare class FormFieldComponent<TValue = string> implements IJSLComponent {
|
|
24
34
|
private options;
|
|
25
35
|
private id;
|
|
26
|
-
private
|
|
27
|
-
private
|
|
36
|
+
private control;
|
|
37
|
+
private dom;
|
|
38
|
+
private input;
|
|
39
|
+
private renderer;
|
|
28
40
|
private validationMessage;
|
|
29
|
-
|
|
41
|
+
private validated;
|
|
42
|
+
private disposed;
|
|
43
|
+
private syncQueued;
|
|
44
|
+
private pendingValue;
|
|
45
|
+
private hasPendingValue;
|
|
46
|
+
private ownedInvalid;
|
|
47
|
+
private originalInvalid;
|
|
48
|
+
private originalRequired;
|
|
49
|
+
private originalAriaRequired;
|
|
50
|
+
private originalLabelledBy;
|
|
51
|
+
private legacySetter;
|
|
52
|
+
constructor(options: IFormFieldOptions<TValue>);
|
|
30
53
|
render(): IJSLVNode;
|
|
54
|
+
onInit(renderer: JSLRender): void;
|
|
31
55
|
onCreate(node: IJSLVNode): void;
|
|
32
|
-
onRemove(
|
|
56
|
+
onRemove(): void;
|
|
57
|
+
getControl(): IJSLComponent | IJSLVNode;
|
|
58
|
+
getValue(): TValue;
|
|
59
|
+
setValue(value: any): void;
|
|
33
60
|
validate(): boolean;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
private
|
|
61
|
+
private queueSync;
|
|
62
|
+
private syncDom;
|
|
63
|
+
private removeDecorations;
|
|
64
|
+
private callbackNode;
|
|
65
|
+
private onFocusEvent;
|
|
66
|
+
private onBlurEvent;
|
|
67
|
+
private onInputEvent;
|
|
68
|
+
private onChangeEvent;
|
|
39
69
|
}
|