@webtides/element-library 0.3.1 → 0.5.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/CHANGELOG.md +300 -0
- package/README.md +72 -56
- package/all.js +16 -0
- package/catalog.js +17 -1
- package/custom-elements.json +15912 -10065
- package/package.json +1 -1
- package/src/components/accordion/accordion.changelog.md +11 -0
- package/src/components/accordion/accordion.js +15 -3
- package/src/components/accordion/accordion.readme.md +27 -1
- package/src/components/accordion/accordion.style.js +19 -0
- package/src/components/app-bar/app-bar.changelog.md +24 -0
- package/src/components/app-bar/app-bar.define.js +3 -0
- package/src/components/app-bar/app-bar.js +91 -0
- package/src/components/app-bar/app-bar.readme.md +130 -0
- package/src/components/app-bar/app-bar.style.js +103 -0
- package/src/components/app-frame/app-frame.changelog.md +59 -0
- package/src/components/app-frame/app-frame.define.js +3 -0
- package/src/components/app-frame/app-frame.events.js +6 -0
- package/src/components/app-frame/app-frame.js +1085 -0
- package/src/components/app-frame/app-frame.readme.md +425 -0
- package/src/components/app-frame/app-frame.style.js +534 -0
- package/src/components/button/button.changelog.md +21 -0
- package/src/components/button/button.events.js +3 -0
- package/src/components/button/button.js +145 -3
- package/src/components/button/button.readme.md +72 -4
- package/src/components/button/button.style.js +167 -8
- package/src/components/button-group/button-group.changelog.md +10 -0
- package/src/components/button-group/button-group.readme.md +2 -0
- package/src/components/button-group/button-group.style.js +6 -2
- package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +6 -0
- package/src/components/checkbox-group-field/checkbox-group-field.js +7 -2
- package/src/components/checkbox-group-field/checkbox-group-field.readme.md +23 -1
- package/src/components/combobox-field/combobox-field.changelog.md +6 -0
- package/src/components/combobox-field/combobox-field.readme.md +8 -0
- package/src/components/combobox-field/combobox-field.style.js +2 -0
- package/src/components/date-field/date-field.changelog.md +6 -0
- package/src/components/date-field/date-field.readme.md +10 -0
- package/src/components/date-field/date-field.style.js +8 -3
- package/src/components/description-list/description-list.changelog.md +42 -0
- package/src/components/description-list/description-list.define.js +3 -0
- package/src/components/description-list/description-list.js +49 -0
- package/src/components/description-list/description-list.readme.md +161 -0
- package/src/components/description-list/description-list.style.js +169 -0
- package/src/components/dialog/dialog.changelog.md +7 -0
- package/src/components/dialog/dialog.readme.md +5 -0
- package/src/components/dialog/dialog.style.js +17 -2
- package/src/components/divider/divider.changelog.md +6 -0
- package/src/components/divider/divider.readme.md +1 -1
- package/src/components/divider/divider.style.js +6 -0
- package/src/components/drawer/drawer.changelog.md +7 -0
- package/src/components/drawer/drawer.readme.md +7 -6
- package/src/components/drawer/drawer.style.js +35 -2
- package/src/components/dropdown/dropdown.readme.md +6 -1
- package/src/components/file-field/file-field.changelog.md +8 -0
- package/src/components/file-field/file-field.js +135 -5
- package/src/components/file-field/file-field.readme.md +35 -6
- package/src/components/file-field/file-field.style.js +71 -0
- package/src/components/form-field/form-field.js +1 -1
- package/src/components/input-field/input-field.changelog.md +10 -0
- package/src/components/input-field/input-field.js +192 -14
- package/src/components/input-field/input-field.readme.md +88 -2
- package/src/components/input-field/input-field.style.js +2 -0
- package/src/components/list/list.changelog.md +30 -0
- package/src/components/list/list.define.js +3 -0
- package/src/components/list/list.js +68 -0
- package/src/components/list/list.readme.md +123 -0
- package/src/components/list/list.style.js +56 -0
- package/src/components/list-item/list-item.changelog.md +40 -0
- package/src/components/list-item/list-item.define.js +3 -0
- package/src/components/list-item/list-item.js +130 -0
- package/src/components/list-item/list-item.readme.md +144 -0
- package/src/components/list-item/list-item.style.js +246 -0
- package/src/components/menu/menu.changelog.md +44 -0
- package/src/components/menu/menu.define.js +3 -0
- package/src/components/menu/menu.events.js +5 -0
- package/src/components/menu/menu.js +793 -0
- package/src/components/menu/menu.readme.md +313 -0
- package/src/components/menu/menu.style.js +59 -0
- package/src/components/menu-group/menu-group.changelog.md +20 -0
- package/src/components/menu-group/menu-group.define.js +3 -0
- package/src/components/menu-group/menu-group.js +44 -0
- package/src/components/menu-group/menu-group.readme.md +74 -0
- package/src/components/menu-group/menu-group.style.js +38 -0
- package/src/components/menu-item/menu-item.changelog.md +32 -0
- package/src/components/menu-item/menu-item.define.js +3 -0
- package/src/components/menu-item/menu-item.js +168 -0
- package/src/components/menu-item/menu-item.readme.md +132 -0
- package/src/components/menu-item/menu-item.style.js +117 -0
- package/src/components/nav/nav.changelog.md +35 -0
- package/src/components/nav/nav.define.js +3 -0
- package/src/components/nav/nav.js +212 -0
- package/src/components/nav/nav.readme.md +248 -0
- package/src/components/nav/nav.style.js +269 -0
- package/src/components/nav-item/nav-item.changelog.md +25 -0
- package/src/components/nav-item/nav-item.define.js +3 -0
- package/src/components/nav-item/nav-item.js +75 -0
- package/src/components/nav-item/nav-item.readme.md +111 -0
- package/src/components/nav-item/nav-item.style.js +159 -0
- package/src/components/otp-field/otp-field.changelog.md +6 -0
- package/src/components/otp-field/otp-field.readme.md +8 -0
- package/src/components/otp-field/otp-field.style.js +8 -3
- package/src/components/pagination/pagination.changelog.md +8 -0
- package/src/components/pagination/pagination.js +123 -49
- package/src/components/pagination/pagination.readme.md +24 -6
- package/src/components/pagination/pagination.style.js +11 -1
- package/src/components/password-field/password-field.changelog.md +7 -0
- package/src/components/password-field/password-field.readme.md +11 -1
- package/src/components/password-field/password-field.style.js +2 -0
- package/src/components/popover/popover.changelog.md +6 -0
- package/src/components/popover/popover.style.js +1 -0
- package/src/components/radio-field/radio-field.changelog.md +6 -0
- package/src/components/radio-field/radio-field.js +7 -2
- package/src/components/radio-field/radio-field.readme.md +23 -1
- package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
- package/src/components/scroll-to-top/scroll-to-top.js +16 -12
- package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
- package/src/components/segmented-field/segmented-field.changelog.md +27 -0
- package/src/components/segmented-field/segmented-field.define.js +3 -0
- package/src/components/segmented-field/segmented-field.js +175 -0
- package/src/components/segmented-field/segmented-field.readme.md +140 -0
- package/src/components/segmented-field/segmented-field.style.js +193 -0
- package/src/components/splitter/splitter.changelog.md +24 -0
- package/src/components/splitter/splitter.define.js +3 -0
- package/src/components/splitter/splitter.events.js +4 -0
- package/src/components/splitter/splitter.js +237 -0
- package/src/components/splitter/splitter.readme.md +164 -0
- package/src/components/splitter/splitter.style.js +100 -0
- package/src/components/status-bar/status-bar.changelog.md +25 -0
- package/src/components/status-bar/status-bar.define.js +3 -0
- package/src/components/status-bar/status-bar.js +74 -0
- package/src/components/status-bar/status-bar.readme.md +139 -0
- package/src/components/status-bar/status-bar.style.js +122 -0
- package/src/components/tab-group/tab-group.changelog.md +7 -0
- package/src/components/tab-group/tab-group.js +30 -9
- package/src/components/tab-group/tab-group.readme.md +14 -0
- package/src/components/textarea-field/textarea-field.changelog.md +6 -0
- package/src/components/textarea-field/textarea-field.js +14 -1
- package/src/components/textarea-field/textarea-field.readme.md +23 -1
- package/src/components/toast/toast.changelog.md +6 -0
- package/src/components/toast/toast.readme.md +5 -3
- package/src/components/toast/toast.style.js +22 -6
- package/src/components/toolbar/toolbar.changelog.md +24 -0
- package/src/components/toolbar/toolbar.define.js +3 -0
- package/src/components/toolbar/toolbar.js +233 -0
- package/src/components/toolbar/toolbar.readme.md +156 -0
- package/src/components/toolbar/toolbar.style.js +49 -0
- package/src/components/tooltip/tooltip.changelog.md +11 -0
- package/src/components/tooltip/tooltip.js +51 -4
- package/src/components/tooltip/tooltip.readme.md +26 -1
- package/src/components/tree/tree.changelog.md +23 -0
- package/src/components/tree/tree.define.js +3 -0
- package/src/components/tree/tree.js +138 -0
- package/src/components/tree/tree.readme.md +119 -0
- package/src/components/tree/tree.style.js +16 -0
- package/src/components/tree-item/tree-item.changelog.md +23 -0
- package/src/components/tree-item/tree-item.define.js +3 -0
- package/src/components/tree-item/tree-item.events.js +3 -0
- package/src/components/tree-item/tree-item.js +246 -0
- package/src/components/tree-item/tree-item.readme.md +128 -0
- package/src/components/tree-item/tree-item.style.js +226 -0
- package/src/styles/appearance.style.js +47 -0
- package/src/styles/choice-group.style.js +27 -1
- package/src/styles/input-control.style.js +87 -0
- package/src/styles/modal.style.js +14 -1
- package/src/styles/native.css +100 -0
- package/src/styles/size.style.js +41 -0
- package/src/utils/floating.js +15 -1
- package/src/utils/focus.js +69 -0
- package/src/utils/options.js +35 -0
- package/src/utils/scroll.js +24 -0
- package/src/utils/text-entry-attributes.js +13 -0
- package/types/all.d.ts +16 -0
- package/types/src/components/accordion/accordion.d.ts +3 -1
- package/types/src/components/app-bar/app-bar.d.ts +43 -0
- package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
- package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
- package/types/src/components/app-frame/app-frame.d.ts +497 -0
- package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
- package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
- package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
- package/types/src/components/button/button.d.ts +61 -0
- package/types/src/components/button/button.events.d.ts +4 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +5 -2
- package/types/src/components/combobox-field/combobox-field.d.ts +10 -0
- package/types/src/components/date-field/date-field.d.ts +10 -0
- package/types/src/components/description-list/description-list.d.ts +34 -0
- package/types/src/components/description-list/description-list.define.d.ts +1 -0
- package/types/src/components/description-list/description-list.style.d.ts +2 -0
- package/types/src/components/file-field/file-field.d.ts +68 -3
- package/types/src/components/form-field/form-field.d.ts +1 -1
- package/types/src/components/input-field/input-field.d.ts +99 -0
- package/types/src/components/list/list.d.ts +41 -0
- package/types/src/components/list/list.define.d.ts +1 -0
- package/types/src/components/list/list.style.d.ts +2 -0
- package/types/src/components/list-item/list-item.d.ts +64 -0
- package/types/src/components/list-item/list-item.define.d.ts +1 -0
- package/types/src/components/list-item/list-item.style.d.ts +2 -0
- package/types/src/components/menu/menu.d.ts +362 -0
- package/types/src/components/menu/menu.define.d.ts +1 -0
- package/types/src/components/menu/menu.events.d.ts +6 -0
- package/types/src/components/menu/menu.style.d.ts +2 -0
- package/types/src/components/menu-group/menu-group.d.ts +24 -0
- package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
- package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
- package/types/src/components/menu-item/menu-item.d.ts +80 -0
- package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
- package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
- package/types/src/components/nav/nav.d.ts +103 -0
- package/types/src/components/nav/nav.define.d.ts +1 -0
- package/types/src/components/nav/nav.style.d.ts +2 -0
- package/types/src/components/nav-item/nav-item.d.ts +39 -0
- package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
- package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
- package/types/src/components/otp-field/otp-field.d.ts +10 -0
- package/types/src/components/pagination/pagination.d.ts +31 -2
- package/types/src/components/password-field/password-field.d.ts +10 -0
- package/types/src/components/radio-field/radio-field.d.ts +5 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
- package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
- package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
- package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
- package/types/src/components/splitter/splitter.d.ts +127 -0
- package/types/src/components/splitter/splitter.define.d.ts +1 -0
- package/types/src/components/splitter/splitter.events.d.ts +5 -0
- package/types/src/components/splitter/splitter.style.d.ts +2 -0
- package/types/src/components/status-bar/status-bar.d.ts +44 -0
- package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
- package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
- package/types/src/components/tab-group/tab-group.d.ts +17 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +7 -0
- package/types/src/components/toolbar/toolbar.d.ts +96 -0
- package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
- package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +26 -0
- package/types/src/components/tree/tree.d.ts +62 -0
- package/types/src/components/tree/tree.define.d.ts +1 -0
- package/types/src/components/tree/tree.style.d.ts +2 -0
- package/types/src/components/tree-item/tree-item.d.ts +106 -0
- package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
- package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
- package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
- package/types/src/styles/appearance.style.d.ts +31 -0
- package/types/src/styles/choice-group.style.d.ts +1 -1
- package/types/src/styles/input-control.style.d.ts +15 -0
- package/types/src/styles/modal.style.d.ts +5 -0
- package/types/src/styles/size.style.d.ts +24 -0
- package/types/src/utils/floating.d.ts +11 -0
- package/types/src/utils/focus.d.ts +25 -0
- package/types/src/utils/options.d.ts +17 -0
- package/types/src/utils/scroll.d.ts +11 -0
- package/types/src/utils/text-entry-attributes.d.ts +10 -0
- package/web-types.json +2935 -308
|
@@ -35,6 +35,10 @@ export default class ComboboxField extends InputField {
|
|
|
35
35
|
size: string;
|
|
36
36
|
placeholder: string;
|
|
37
37
|
pattern: boolean;
|
|
38
|
+
clearable: boolean;
|
|
39
|
+
clearLabel: string;
|
|
40
|
+
maxlength: any;
|
|
41
|
+
minlength: any;
|
|
38
42
|
autocomplete: any;
|
|
39
43
|
inputmode: any;
|
|
40
44
|
enterkeyhint: any;
|
|
@@ -51,6 +55,12 @@ export default class ComboboxField extends InputField {
|
|
|
51
55
|
click: () => void;
|
|
52
56
|
touchstart: () => void;
|
|
53
57
|
};
|
|
58
|
+
'.control': {
|
|
59
|
+
click: (event: any) => void;
|
|
60
|
+
};
|
|
61
|
+
'[data-clear]': {
|
|
62
|
+
click: () => void;
|
|
63
|
+
};
|
|
54
64
|
'[ref=input]': {
|
|
55
65
|
focus: () => void;
|
|
56
66
|
blur: () => void;
|
|
@@ -43,6 +43,10 @@ export default class DateField extends InputField {
|
|
|
43
43
|
size: string;
|
|
44
44
|
placeholder: string;
|
|
45
45
|
pattern: boolean;
|
|
46
|
+
clearable: boolean;
|
|
47
|
+
clearLabel: string;
|
|
48
|
+
maxlength: any;
|
|
49
|
+
minlength: any;
|
|
46
50
|
autocomplete: any;
|
|
47
51
|
inputmode: any;
|
|
48
52
|
enterkeyhint: any;
|
|
@@ -68,6 +72,12 @@ export default class DateField extends InputField {
|
|
|
68
72
|
click: () => void;
|
|
69
73
|
touchstart: () => void;
|
|
70
74
|
};
|
|
75
|
+
'.control': {
|
|
76
|
+
click: (event: any) => void;
|
|
77
|
+
};
|
|
78
|
+
'[data-clear]': {
|
|
79
|
+
click: () => void;
|
|
80
|
+
};
|
|
71
81
|
'[ref=input]': {
|
|
72
82
|
focus: () => void;
|
|
73
83
|
blur: () => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* Rows of a name and its value, for a settings page or the page of an entry: the address, the
|
|
4
|
+
* plan, the day it was created. The element is the native `<dl>`; the page writes the names as
|
|
5
|
+
* `<dt>` and the values as `<dd>` into it, as it would into a `<dl>`.
|
|
6
|
+
*
|
|
7
|
+
* In a narrow place a name stands above its value. From a width of 30rem, which the list measures
|
|
8
|
+
* on itself, the two stand side by side, and the values of all rows begin on one line. A row can
|
|
9
|
+
* end in an action: a `<dd data-action>` with a link or a button in it.
|
|
10
|
+
*
|
|
11
|
+
* Pure presentation: the list runs no script of its own, so a server-rendered list is complete
|
|
12
|
+
* before the element takes over.
|
|
13
|
+
*
|
|
14
|
+
* @element el-description-list
|
|
15
|
+
*
|
|
16
|
+
* @slot - The rows: for each one a `<dt>` with the name, a `<dd>` with the value (or several),
|
|
17
|
+
* and, to end the row in an action, a `<dd data-action>` with a link or a button.
|
|
18
|
+
*
|
|
19
|
+
* @csspart base - The `<dl>`.
|
|
20
|
+
*
|
|
21
|
+
* @cssproperty --el-description-list-term-width - The width of the column of the names while
|
|
22
|
+
* names and values stand side by side. The gap to the values comes after it. Unset, the column
|
|
23
|
+
* is as wide as the longest name, and takes 40% of the list at most together with that gap.
|
|
24
|
+
* @cssproperty --el-description-list-padding-block - The room above and below a row. Unset, it is
|
|
25
|
+
* `--el-space-3`, and `0.75rem` without a theme.
|
|
26
|
+
* @cssproperty --el-description-list-gap - The gap between a name and its value while they stand
|
|
27
|
+
* side by side, and in front of an action. Unset, it is `--el-space-4`, and `1rem` without a
|
|
28
|
+
* theme.
|
|
29
|
+
*/
|
|
30
|
+
export default class DescriptionList extends TemplateElement {
|
|
31
|
+
constructor();
|
|
32
|
+
template(): any;
|
|
33
|
+
}
|
|
34
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,15 +7,21 @@ import FormField from '../form-field/form-field.js';
|
|
|
7
7
|
* The files come from the user. A script cannot choose one, the browser does not allow that; it can
|
|
8
8
|
* take the choice away with an empty `value`.
|
|
9
9
|
*
|
|
10
|
+
* With `drop-message` the field shows an area around its control to drop a file onto, with that
|
|
11
|
+
* text in it. The area looks different while a dragged file is over it, a click on it opens the
|
|
12
|
+
* dialog, and a drop is a choice as one in the dialog is: the control has the files, and the same
|
|
13
|
+
* events are fired.
|
|
14
|
+
*
|
|
10
15
|
* @element el-file-field
|
|
11
16
|
*
|
|
12
|
-
* @fires {CustomEvent<string[]>} input-change - Fired when the user has chosen files,
|
|
13
|
-
* choice was taken away. `detail` is the list of the names;
|
|
14
|
-
* element. Bubbles.
|
|
17
|
+
* @fires {CustomEvent<string[]>} input-change - Fired when the user has chosen files, in the
|
|
18
|
+
* dialog or with a drop, and when the choice was taken away. `detail` is the list of the names;
|
|
19
|
+
* the files are in `files` of the element. Bubbles.
|
|
15
20
|
*
|
|
16
21
|
* @cssstate touched - Set on the host once the user has left the control for another place of the
|
|
17
22
|
* page, or the browser has refused a submit because of it. Inherits `valid` and `invalid` from
|
|
18
23
|
* `FormField`.
|
|
24
|
+
* @cssstate dragover - Set on the host while a dragged file is over the area to drop onto.
|
|
19
25
|
*
|
|
20
26
|
* @property {string[]} value - The names of the chosen files. It follows the control: a script can
|
|
21
27
|
* set it to an empty list, which takes the choice away, and to nothing else.
|
|
@@ -28,8 +34,16 @@ import FormField from '../form-field/form-field.js';
|
|
|
28
34
|
* @property {'small'|'medium'|'large'} size - Size of the control: its height, its padding and its
|
|
29
35
|
* font size. Default `'medium'`. Reflected to the `size` attribute. It shows once the control is
|
|
30
36
|
* decorated (`styles/native.css`); a control with the look of the browser keeps its size.
|
|
37
|
+
* @property {string} dropMessage - The text of an area to drop a file onto: "Drop the list here,
|
|
38
|
+
* or choose it". With one the field shows the area, around its control. Default `''`.
|
|
31
39
|
*/
|
|
32
40
|
export default class FileField extends FormField {
|
|
41
|
+
/**
|
|
42
|
+
* How many elements of the area a dragged file is over: the browser tells of every one it
|
|
43
|
+
* enters and leaves, the text and the control in the area as well.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private _dragDepth;
|
|
33
47
|
/**
|
|
34
48
|
* The names the control had when the field last looked. See `_matchControl()`.
|
|
35
49
|
* @private
|
|
@@ -56,6 +70,7 @@ export default class FileField extends FormField {
|
|
|
56
70
|
multiple: boolean;
|
|
57
71
|
capture: any;
|
|
58
72
|
size: string;
|
|
73
|
+
dropMessage: string;
|
|
59
74
|
};
|
|
60
75
|
/**
|
|
61
76
|
* The chosen files, as the control has them.
|
|
@@ -75,7 +90,48 @@ export default class FileField extends FormField {
|
|
|
75
90
|
blur: () => void;
|
|
76
91
|
invalid: (event: any) => void;
|
|
77
92
|
};
|
|
93
|
+
'.drop-area': {
|
|
94
|
+
click: (event: any) => void;
|
|
95
|
+
dragenter: (event: any) => void;
|
|
96
|
+
dragover: (event: any) => void;
|
|
97
|
+
dragleave: (event: any) => void;
|
|
98
|
+
drop: (event: any) => void;
|
|
99
|
+
};
|
|
78
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* A click on the area beside its control opens the dialog, as a click on the control does.
|
|
103
|
+
* @private
|
|
104
|
+
* @param {MouseEvent} event
|
|
105
|
+
*/
|
|
106
|
+
private _onAreaClick;
|
|
107
|
+
/**
|
|
108
|
+
* A file is dragged into the area, over it or out of it. The area says that it takes the file
|
|
109
|
+
* (the browser shows a drop that is allowed with the pointer), and the host has the state
|
|
110
|
+
* `dragover` for as long. Text or a link that is dragged is nothing for this field.
|
|
111
|
+
* @private
|
|
112
|
+
* @param {DragEvent} event
|
|
113
|
+
* @param {-1 | 0 | 1} step - Into an element of the area, over one, or out of one.
|
|
114
|
+
*/
|
|
115
|
+
private _onDrag;
|
|
116
|
+
/**
|
|
117
|
+
* Files were dropped onto the area. They are a choice as one in the dialog is: the control
|
|
118
|
+
* gets them and tells of it with `input` and `change`, which the field follows as it does for
|
|
119
|
+
* the dialog.
|
|
120
|
+
*
|
|
121
|
+
* The dialog does not offer what `accept` leaves out, and one file alone without `multiple`.
|
|
122
|
+
* A drop can bring anything, so the field asks itself. A drop it cannot take as a whole is
|
|
123
|
+
* not taken at all: the control keeps what it had, and the field says that the choice was
|
|
124
|
+
* not valid, with its error message.
|
|
125
|
+
* @private
|
|
126
|
+
* @param {DragEvent} event
|
|
127
|
+
*/
|
|
128
|
+
private _onDrop;
|
|
129
|
+
/**
|
|
130
|
+
* The description of the control: the text of the area first, then the messages of the field.
|
|
131
|
+
* @private
|
|
132
|
+
* @returns {string}
|
|
133
|
+
*/
|
|
134
|
+
private _describedBy;
|
|
79
135
|
/**
|
|
80
136
|
* The user has chosen files, or has taken the choice away in the dialog.
|
|
81
137
|
* @returns {void}
|
|
@@ -112,4 +168,13 @@ export default class FileField extends FormField {
|
|
|
112
168
|
/** @private */
|
|
113
169
|
private fieldTemplate;
|
|
114
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Whether a file is one of the kinds an `accept` attribute names: an ending (`.pdf`), a type
|
|
173
|
+
* (`application/pdf`) or a group of types (`image/*`), with commas between them. Without one
|
|
174
|
+
* every file is.
|
|
175
|
+
* @param {string} accept
|
|
176
|
+
* @param {File} file
|
|
177
|
+
* @returns {boolean}
|
|
178
|
+
*/
|
|
179
|
+
export declare function accepts(accept: string, file: File): boolean;
|
|
115
180
|
export declare function define(): void;
|
|
@@ -186,7 +186,7 @@ export default class FormField extends TemplateElement {
|
|
|
186
186
|
* The id is another one on every page load. Server-rendered markup has the ids of the server
|
|
187
187
|
* until the element starts, which writes its own to the same elements.
|
|
188
188
|
* @private
|
|
189
|
-
* @param {'input' | 'help-message' | 'error-message' | 'list'} part
|
|
189
|
+
* @param {'input' | 'help-message' | 'error-message' | 'list' | 'control-start' | 'control-end' | 'drop-message'} part
|
|
190
190
|
* @returns {string}
|
|
191
191
|
*/
|
|
192
192
|
private _idOf;
|
|
@@ -4,11 +4,21 @@ import FormField from '../form-field/form-field.js';
|
|
|
4
4
|
* cross indicators) and ARIA wiring. Extends `FormField` and inherits its label / help /
|
|
5
5
|
* error / required surface.
|
|
6
6
|
*
|
|
7
|
+
* The page can put content at the start and at the end of the control: an element with
|
|
8
|
+
* `slot="start"` or `slot="end"` among the children of the field. The field has no shadow root,
|
|
9
|
+
* so these are no slots of the platform: the field takes the elements into its control when it
|
|
10
|
+
* renders. And `clearable` adds a button that empties the field.
|
|
11
|
+
*
|
|
7
12
|
* @element el-input-field
|
|
8
13
|
*
|
|
9
14
|
* @fires {CustomEvent<string>} input-change - Fired when the input's value changes.
|
|
10
15
|
* `detail` is the new value. Bubbles.
|
|
11
16
|
*
|
|
17
|
+
* @slot start - Content at the start of the control, in front of the text: an icon, a text, a
|
|
18
|
+
* button. An element of the page with `slot="start"`.
|
|
19
|
+
* @slot end - Content at the end of the control, after the text: a unit, a button. An element of
|
|
20
|
+
* the page with `slot="end"`.
|
|
21
|
+
*
|
|
12
22
|
* @property {string} type - Native `type` attribute of the underlying `<input>` (e.g.
|
|
13
23
|
* `'text'`, `'email'`, `'password'`, `'tel'`, `'url'`).
|
|
14
24
|
* @property {'small'|'medium'|'large'} size - Size of the control: its height, its padding and its
|
|
@@ -18,6 +28,15 @@ import FormField from '../form-field/form-field.js';
|
|
|
18
28
|
* @property {string | false} pattern - Regular expression used as the input's `pattern`
|
|
19
29
|
* attribute. When `false` (the default), the `pattern` attribute is omitted entirely, so
|
|
20
30
|
* the field applies no pattern constraint.
|
|
31
|
+
* @property {boolean} clearable - Whether the control has a button that empties it. The button
|
|
32
|
+
* shows while the field has a value and is not disabled. Default `false`.
|
|
33
|
+
* @property {string} clearLabel - The name of that button for assistive technology. Default
|
|
34
|
+
* `'Clear'`.
|
|
35
|
+
* @property {number | null} maxlength - Passed on to the control as `maxlength`: the browser takes
|
|
36
|
+
* no more characters than this while the user types. `null` (the default) leaves the attribute
|
|
37
|
+
* out.
|
|
38
|
+
* @property {number | null} minlength - Passed on as `minlength`: a text the user has typed that is
|
|
39
|
+
* shorter makes the field invalid. `null` (the default) leaves the attribute out.
|
|
21
40
|
* @property {string | null} autocomplete - Passed on to the control as its `autocomplete`
|
|
22
41
|
* attribute (e.g. `'email'`, `'current-password'`, `'one-time-code'`). `null` (the default)
|
|
23
42
|
* leaves the attribute out. The same holds for the five properties below.
|
|
@@ -31,6 +50,11 @@ import FormField from '../form-field/form-field.js';
|
|
|
31
50
|
* @property {boolean | string | null} spellcheck - Passed on as `spellcheck` (`true` or `false`).
|
|
32
51
|
*/
|
|
33
52
|
export default class InputField extends FormField {
|
|
53
|
+
_started: boolean;
|
|
54
|
+
_controlContent: {
|
|
55
|
+
start: Element[];
|
|
56
|
+
end: Element[];
|
|
57
|
+
};
|
|
34
58
|
constructor(options: any);
|
|
35
59
|
properties(): {
|
|
36
60
|
name: string;
|
|
@@ -47,6 +71,10 @@ export default class InputField extends FormField {
|
|
|
47
71
|
size: string;
|
|
48
72
|
placeholder: string;
|
|
49
73
|
pattern: boolean;
|
|
74
|
+
clearable: boolean;
|
|
75
|
+
clearLabel: string;
|
|
76
|
+
maxlength: any;
|
|
77
|
+
minlength: any;
|
|
50
78
|
autocomplete: any;
|
|
51
79
|
inputmode: any;
|
|
52
80
|
enterkeyhint: any;
|
|
@@ -54,11 +82,82 @@ export default class InputField extends FormField {
|
|
|
54
82
|
autocorrect: any;
|
|
55
83
|
spellcheck: any;
|
|
56
84
|
};
|
|
85
|
+
connectedCallback(): void;
|
|
57
86
|
watch(): {
|
|
58
87
|
valid: () => void;
|
|
59
88
|
touched: () => void;
|
|
60
89
|
value: (value: any, oldValue: any) => void;
|
|
61
90
|
};
|
|
91
|
+
events(): {
|
|
92
|
+
'[ref=input]': {
|
|
93
|
+
focus: () => void;
|
|
94
|
+
blur: () => void;
|
|
95
|
+
keyup: (event: any) => void;
|
|
96
|
+
change: () => void;
|
|
97
|
+
invalid: (event: any) => void;
|
|
98
|
+
};
|
|
99
|
+
'.is-invalid': {
|
|
100
|
+
focus: () => void;
|
|
101
|
+
};
|
|
102
|
+
'[data-clear-input]': {
|
|
103
|
+
click: () => void;
|
|
104
|
+
touchstart: () => void;
|
|
105
|
+
};
|
|
106
|
+
'.control': {
|
|
107
|
+
click: (event: any) => void;
|
|
108
|
+
};
|
|
109
|
+
'[data-clear]': {
|
|
110
|
+
click: () => void;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The elements the page has put into the field for the start or the end of its control:
|
|
115
|
+
* `<span slot="end">€</span>`. They are children of the field until it renders, and in
|
|
116
|
+
* their place in the control from then on, also in server-rendered markup. An element that
|
|
117
|
+
* comes later is taken in with the next render.
|
|
118
|
+
* @private
|
|
119
|
+
* @param {'start'|'end'} name
|
|
120
|
+
* @returns {Element[]}
|
|
121
|
+
*/
|
|
122
|
+
private _slotted;
|
|
123
|
+
/**
|
|
124
|
+
* The content for a place in the control. In a browser the elements of the page themselves:
|
|
125
|
+
* they are moved, not copied, and stay where they are with every render. On a server their
|
|
126
|
+
* markup, written as it is.
|
|
127
|
+
*
|
|
128
|
+
* That is what `unsafeHTML()` gives on a server. It is written out here because the directive
|
|
129
|
+
* gives nodes wherever there is a DOM, and a template that is turned into a string in a
|
|
130
|
+
* browser, as the tests of the server-rendered markup do, would lose them.
|
|
131
|
+
* @private
|
|
132
|
+
* @param {Element[]} elements
|
|
133
|
+
* @returns {Element[] | { __unsafeHTML: true, string: string }}
|
|
134
|
+
*/
|
|
135
|
+
private _content;
|
|
136
|
+
/**
|
|
137
|
+
* Whether what the page has put at a place describes the value: a unit, a currency, the start
|
|
138
|
+
* of an address. A screen reader reads it with the input then. A control there, a button or
|
|
139
|
+
* a link, has a name and a stop of the Tab key itself, and is no description. An icon is none
|
|
140
|
+
* either: it has no text, and is hidden from assistive technology (`aria-hidden`).
|
|
141
|
+
* @private
|
|
142
|
+
* @param {Element[]} elements
|
|
143
|
+
* @returns {boolean}
|
|
144
|
+
*/
|
|
145
|
+
private _describes;
|
|
146
|
+
/**
|
|
147
|
+
* The description of the control: what the page has put at its start and at its end, then the
|
|
148
|
+
* messages of the field.
|
|
149
|
+
* @private
|
|
150
|
+
* @returns {string}
|
|
151
|
+
*/
|
|
152
|
+
private _describedBy;
|
|
153
|
+
/**
|
|
154
|
+
* A click on the control beside its input, on a text or an icon of the page, puts the focus
|
|
155
|
+
* into the input: to the eye all of it is the control. A control in the content, the button
|
|
156
|
+
* that clears the field and the input itself keep their click.
|
|
157
|
+
* @private
|
|
158
|
+
* @param {MouseEvent} event
|
|
159
|
+
*/
|
|
160
|
+
private _onControlClick;
|
|
62
161
|
/**
|
|
63
162
|
* The pattern of the control. A field that extends this one can have a pattern of its own
|
|
64
163
|
* where the page gives none (`OtpField`).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* A list of rows: messages, articles, files, the entries of a settings page. The list is the
|
|
4
|
+
* surface and the list for assistive technology; every `el-list-item` slotted into it is one row.
|
|
5
|
+
* It gives its rows one density, one line between two of them and one place where their texts
|
|
6
|
+
* begin, whatever stands at the start of a row.
|
|
7
|
+
*
|
|
8
|
+
* Pure presentation: the list runs no script of its own, so a server-rendered list is complete
|
|
9
|
+
* before the element takes over.
|
|
10
|
+
*
|
|
11
|
+
* @element el-list
|
|
12
|
+
*
|
|
13
|
+
* @slot - The rows: `el-list-item` elements.
|
|
14
|
+
*
|
|
15
|
+
* @csspart base - The list (`role="list"`) and its surface.
|
|
16
|
+
*
|
|
17
|
+
* @cssproperty --el-list-padding-inline - The padding of a row at its start and its end. Unset, it
|
|
18
|
+
* is `--el-space-4`, and `1rem` without a theme. Read by the rows, so it can be set on the list
|
|
19
|
+
* or for the page.
|
|
20
|
+
* @cssproperty --el-list-gap - The gap between the start, the texts, the end and the control of a
|
|
21
|
+
* row. Unset, it is `--el-space-3`, and `0.75rem` without a theme. Read by the rows as well.
|
|
22
|
+
*
|
|
23
|
+
* @property {string} label - The name of the list for assistive technology. Unset, the list has
|
|
24
|
+
* none.
|
|
25
|
+
* @property {'default'|'compact'} density - How much room a row has above and below its texts.
|
|
26
|
+
* Default `'default'`. Reflected to the `density` attribute.
|
|
27
|
+
* @property {'plain'|'outlined'|'filled'} appearance - How the surface is painted: not at all, so
|
|
28
|
+
* the list reaches from edge to edge of its place, or as a card with the background of the page
|
|
29
|
+
* or a muted fill, a border and round corners. Default `'plain'`. Reflected to the `appearance`
|
|
30
|
+
* attribute.
|
|
31
|
+
*/
|
|
32
|
+
export default class List extends TemplateElement {
|
|
33
|
+
constructor();
|
|
34
|
+
properties(): {
|
|
35
|
+
label: string;
|
|
36
|
+
density: string;
|
|
37
|
+
appearance: string;
|
|
38
|
+
};
|
|
39
|
+
template(): any;
|
|
40
|
+
}
|
|
41
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* One row of an `el-list`. It has the parts a row has everywhere: something at the start (an icon,
|
|
4
|
+
* an avatar), a title, a line under it, something at the end (a value, a count, a chevron), and a
|
|
5
|
+
* control of its own after that.
|
|
6
|
+
*
|
|
7
|
+
* With `href` the row is a link as a whole: the title is the link, and its target is the whole
|
|
8
|
+
* row. What is slotted into `action` stays a target of its own.
|
|
9
|
+
*
|
|
10
|
+
* Pure presentation: the row runs no script of its own.
|
|
11
|
+
*
|
|
12
|
+
* @element el-list-item
|
|
13
|
+
*
|
|
14
|
+
* @slot - The title of the row.
|
|
15
|
+
* @slot description - The line under the title.
|
|
16
|
+
* @slot start - What stands in front of the texts: an icon, an avatar. The texts of all rows of a
|
|
17
|
+
* list begin after the widest start.
|
|
18
|
+
* @slot end - What stands at the end of the row and belongs to it: a value, a count, a chevron. In
|
|
19
|
+
* a row that is a link it is part of the target of the link.
|
|
20
|
+
* @slot action - A control at the very end: a button, a switch, a menu. In a row that is a link it
|
|
21
|
+
* lies on top of the link and is a target of its own.
|
|
22
|
+
*
|
|
23
|
+
* @csspart base - The row: an item of the list.
|
|
24
|
+
* @csspart mark - The dot of `mark`, in the padding at the start of the row.
|
|
25
|
+
* @csspart start - The region of the `start` slot.
|
|
26
|
+
* @csspart text - The title and the line under it.
|
|
27
|
+
* @csspart title - The title: an `<a>` with `href`, a `<span>` without.
|
|
28
|
+
* @csspart description - The region of the `description` slot.
|
|
29
|
+
* @csspart end - The region of the `end` slot.
|
|
30
|
+
* @csspart action - The region of the `action` slot.
|
|
31
|
+
*
|
|
32
|
+
* @cssproperty --el-list-padding-inline - The padding of the row at its start and its end. Unset,
|
|
33
|
+
* it is `--el-space-4`, and `1rem` without a theme.
|
|
34
|
+
* @cssproperty --el-list-gap - The gap between the start, the texts, the end and the control of
|
|
35
|
+
* the row. Unset, it is `--el-space-3`, and `0.75rem` without a theme.
|
|
36
|
+
*
|
|
37
|
+
* @property {string} href - The address the row leads to. Unset, the row is no link.
|
|
38
|
+
* @property {string} target - Where to open the address (only with `href`).
|
|
39
|
+
* @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
|
|
40
|
+
* `'noreferrer noopener'`.
|
|
41
|
+
* @property {boolean} current - The row is the current or the chosen one: it gets `aria-current`
|
|
42
|
+
* (`"page"` on the link of a row with `href`, `"true"` on a row without), a bar at its start
|
|
43
|
+
* and a heavier title. Default `false`.
|
|
44
|
+
* @property {string} mark - Marks the row with a dot in the padding at its start, which does not
|
|
45
|
+
* move the texts: an unread message, for example. The text is what assistive technology reads
|
|
46
|
+
* in front of the title ("Unread"). Unset, the row has no mark.
|
|
47
|
+
* @property {boolean} truncate - Cuts the title and the line under it after one line, with an
|
|
48
|
+
* ellipsis. Unset, a long text breaks into more lines. Default `false`.
|
|
49
|
+
*/
|
|
50
|
+
export default class ListItem extends TemplateElement {
|
|
51
|
+
constructor();
|
|
52
|
+
properties(): {
|
|
53
|
+
href: string;
|
|
54
|
+
target: string;
|
|
55
|
+
rel: string;
|
|
56
|
+
current: boolean;
|
|
57
|
+
mark: string;
|
|
58
|
+
truncate: boolean;
|
|
59
|
+
};
|
|
60
|
+
/** @private */
|
|
61
|
+
private titleTemplate;
|
|
62
|
+
template(): any;
|
|
63
|
+
}
|
|
64
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|