@pictogrammers/components 0.3.1
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/@types/css.d.ts +4 -0
- package/@types/html.d.ts +4 -0
- package/README.md +49 -0
- package/dist/main.js +3819 -0
- package/dist/pgAnnoy.js +116 -0
- package/dist/pgAvatar.js +136 -0
- package/dist/pgButton.js +116 -0
- package/dist/pgButtonGroup.js +116 -0
- package/dist/pgButtonLink.js +116 -0
- package/dist/pgButtonToggle.js +146 -0
- package/dist/pgCard.js +116 -0
- package/dist/pgCardUser.js +196 -0
- package/dist/pgColor.js +136 -0
- package/dist/pgDatabase.js +236 -0
- package/dist/pgDropdown.js +686 -0
- package/dist/pgGrid.js +126 -0
- package/dist/pgHeader.js +116 -0
- package/dist/pgIcon.js +116 -0
- package/dist/pgInputCheck.js +116 -0
- package/dist/pgInputCheckList.js +126 -0
- package/dist/pgInputFileLocal.js +116 -0
- package/dist/pgInputHexRgb.js +126 -0
- package/dist/pgInputRange.js +116 -0
- package/dist/pgInputSelect.js +116 -0
- package/dist/pgInputText.js +116 -0
- package/dist/pgInputTextIcon.js +176 -0
- package/dist/pgInputUserSelect.js +116 -0
- package/dist/pgListTag.js +136 -0
- package/dist/pgMarkdown.js +346 -0
- package/dist/pgMenuIcon.js +206 -0
- package/dist/pgModalAlert.js +126 -0
- package/dist/pgModification.js +396 -0
- package/dist/pgNav.js +116 -0
- package/dist/pgOverlay.js +96 -0
- package/dist/pgPicker.js +116 -0
- package/dist/pgPreview.js +116 -0
- package/dist/pgScroll.js +266 -0
- package/dist/pgSearch.js +146 -0
- package/dist/pgTab.js +116 -0
- package/dist/pgTabs.js +136 -0
- package/dist/pgToast.js +136 -0
- package/dist/pgToasts.js +136 -0
- package/dist/pgTooltip.js +126 -0
- package/index.html +302 -0
- package/package.json +25 -0
- package/pg/annoy/README.md +18 -0
- package/pg/annoy/__examples__/basic/basic.html +8 -0
- package/pg/annoy/__examples__/basic/basic.ts +11 -0
- package/pg/annoy/annoy.css +238 -0
- package/pg/annoy/annoy.html +59 -0
- package/pg/annoy/annoy.ts +48 -0
- package/pg/annoy/index.ts +3 -0
- package/pg/avatar/README.md +23 -0
- package/pg/avatar/__examples__/basic/basic.html +6 -0
- package/pg/avatar/__examples__/basic/basic.ts +41 -0
- package/pg/avatar/__examples__/basic/constants.ts +1 -0
- package/pg/avatar/avatar.css +45 -0
- package/pg/avatar/avatar.html +8 -0
- package/pg/avatar/avatar.spec.ts +51 -0
- package/pg/avatar/avatar.ts +37 -0
- package/pg/avatar/index.ts +3 -0
- package/pg/button/README.md +51 -0
- package/pg/button/__examples__/basic/basic.html +11 -0
- package/pg/button/__examples__/basic/basic.ts +11 -0
- package/pg/button/__examples__/states/states.html +8 -0
- package/pg/button/__examples__/states/states.ts +20 -0
- package/pg/button/button.css +91 -0
- package/pg/button/button.html +3 -0
- package/pg/button/button.ts +45 -0
- package/pg/button/index.ts +3 -0
- package/pg/buttonGroup/README.md +28 -0
- package/pg/buttonGroup/__examples__/basic/basic.html +12 -0
- package/pg/buttonGroup/__examples__/basic/basic.ts +11 -0
- package/pg/buttonGroup/buttonGroup.css +4 -0
- package/pg/buttonGroup/buttonGroup.html +1 -0
- package/pg/buttonGroup/buttonGroup.spec.ts +30 -0
- package/pg/buttonGroup/buttonGroup.ts +50 -0
- package/pg/buttonGroup/index.ts +3 -0
- package/pg/buttonLink/README.md +51 -0
- package/pg/buttonLink/__examples__/basic/basic.html +17 -0
- package/pg/buttonLink/__examples__/basic/basic.ts +11 -0
- package/pg/buttonLink/buttonLink.css +91 -0
- package/pg/buttonLink/buttonLink.html +3 -0
- package/pg/buttonLink/buttonLink.ts +46 -0
- package/pg/buttonLink/index.ts +3 -0
- package/pg/buttonToggle/README.md +54 -0
- package/pg/buttonToggle/__examples__/basic/basic.html +10 -0
- package/pg/buttonToggle/__examples__/basic/basic.ts +23 -0
- package/pg/buttonToggle/buttonToggle.css +8 -0
- package/pg/buttonToggle/buttonToggle.html +4 -0
- package/pg/buttonToggle/buttonToggle.ts +44 -0
- package/pg/buttonToggle/index.ts +3 -0
- package/pg/card/README.md +21 -0
- package/pg/card/__examples__/basic/basic.html +5 -0
- package/pg/card/__examples__/basic/basic.ts +11 -0
- package/pg/card/card.css +11 -0
- package/pg/card/card.html +3 -0
- package/pg/card/card.spec.ts +30 -0
- package/pg/card/card.ts +13 -0
- package/pg/card/index.ts +3 -0
- package/pg/cardUser/README.md +22 -0
- package/pg/cardUser/__examples__/basic/basic.html +3 -0
- package/pg/cardUser/__examples__/basic/basic.ts +30 -0
- package/pg/cardUser/__examples__/basic/constants.ts +1 -0
- package/pg/cardUser/cardUser.css +67 -0
- package/pg/cardUser/cardUser.html +23 -0
- package/pg/cardUser/cardUser.spec.ts +46 -0
- package/pg/cardUser/cardUser.ts +53 -0
- package/pg/cardUser/index.ts +3 -0
- package/pg/color/README.md +13 -0
- package/pg/color/__examples__/basic/basic.html +4 -0
- package/pg/color/__examples__/basic/basic.ts +20 -0
- package/pg/color/color.css +21 -0
- package/pg/color/color.html +1 -0
- package/pg/color/color.ts +97 -0
- package/pg/color/constants.ts +357 -0
- package/pg/color/index.ts +3 -0
- package/pg/color/utils.ts +27 -0
- package/pg/database/README.md +28 -0
- package/pg/database/__examples__/basic/basic.html +9 -0
- package/pg/database/__examples__/basic/basic.ts +37 -0
- package/pg/database/database.css +0 -0
- package/pg/database/database.html +0 -0
- package/pg/database/database.ts +42 -0
- package/pg/database/index.ts +3 -0
- package/pg/dropdown/README.md +13 -0
- package/pg/dropdown/__examples__/basic/basic.html +14 -0
- package/pg/dropdown/__examples__/basic/basic.ts +11 -0
- package/pg/dropdown/dropdown.css +46 -0
- package/pg/dropdown/dropdown.html +5 -0
- package/pg/dropdown/dropdown.ts +60 -0
- package/pg/dropdown/index.ts +3 -0
- package/pg/grid/README.md +97 -0
- package/pg/grid/__examples__/basic/basic.html +29 -0
- package/pg/grid/__examples__/basic/basic.ts +139 -0
- package/pg/grid/grid.css +68 -0
- package/pg/grid/grid.html +6 -0
- package/pg/grid/grid.spec.ts +66 -0
- package/pg/grid/grid.ts +417 -0
- package/pg/grid/index.ts +3 -0
- package/pg/header/README.md +23 -0
- package/pg/header/__examples__/basic/basic.html +8 -0
- package/pg/header/__examples__/basic/basic.ts +11 -0
- package/pg/header/header.css +42 -0
- package/pg/header/header.html +15 -0
- package/pg/header/header.ts +28 -0
- package/pg/header/index.ts +3 -0
- package/pg/icon/README.md +26 -0
- package/pg/icon/__examples__/basic/basic.html +16 -0
- package/pg/icon/__examples__/basic/basic.ts +34 -0
- package/pg/icon/__examples__/basic/constants.ts +2 -0
- package/pg/icon/icon.css +9 -0
- package/pg/icon/icon.html +3 -0
- package/pg/icon/icon.spec.ts +46 -0
- package/pg/icon/icon.ts +23 -0
- package/pg/icon/index.ts +3 -0
- package/pg/inputCheck/README.md +32 -0
- package/pg/inputCheck/__examples__/basic/basic.html +8 -0
- package/pg/inputCheck/__examples__/basic/basic.ts +23 -0
- package/pg/inputCheck/index.ts +3 -0
- package/pg/inputCheck/inputCheck.css +45 -0
- package/pg/inputCheck/inputCheck.html +6 -0
- package/pg/inputCheck/inputCheck.ts +42 -0
- package/pg/inputCheckList/README.md +35 -0
- package/pg/inputCheckList/__examples__/basic/basic.html +4 -0
- package/pg/inputCheckList/__examples__/basic/basic.ts +31 -0
- package/pg/inputCheckList/index.ts +3 -0
- package/pg/inputCheckList/inputCheckList.css +70 -0
- package/pg/inputCheckList/inputCheckList.html +1 -0
- package/pg/inputCheckList/inputCheckList.ts +103 -0
- package/pg/inputCheckList/templates/option.html +8 -0
- package/pg/inputFileLocal/README.md +30 -0
- package/pg/inputFileLocal/__examples__/basic/basic.html +4 -0
- package/pg/inputFileLocal/__examples__/basic/basic.ts +23 -0
- package/pg/inputFileLocal/index.ts +3 -0
- package/pg/inputFileLocal/inputFileLocal.css +80 -0
- package/pg/inputFileLocal/inputFileLocal.html +5 -0
- package/pg/inputFileLocal/inputFileLocal.ts +82 -0
- package/pg/inputHexRgb/README.md +15 -0
- package/pg/inputHexRgb/__examples__/basic/basic.html +4 -0
- package/pg/inputHexRgb/__examples__/basic/basic.ts +23 -0
- package/pg/inputHexRgb/index.ts +3 -0
- package/pg/inputHexRgb/inputHexRgb.css +96 -0
- package/pg/inputHexRgb/inputHexRgb.html +9 -0
- package/pg/inputHexRgb/inputHexRgb.ts +79 -0
- package/pg/inputHexRgb/utils.ts +27 -0
- package/pg/inputRange/README.md +18 -0
- package/pg/inputRange/__examples__/basic/basic.html +9 -0
- package/pg/inputRange/__examples__/basic/basic.ts +30 -0
- package/pg/inputRange/index.ts +3 -0
- package/pg/inputRange/inputRange.css +0 -0
- package/pg/inputRange/inputRange.html +1 -0
- package/pg/inputRange/inputRange.ts +53 -0
- package/pg/inputSelect/README.md +25 -0
- package/pg/inputSelect/__examples__/basic/basic.html +6 -0
- package/pg/inputSelect/__examples__/basic/basic.ts +30 -0
- package/pg/inputSelect/index.ts +3 -0
- package/pg/inputSelect/inputSelect.css +36 -0
- package/pg/inputSelect/inputSelect.html +4 -0
- package/pg/inputSelect/inputSelect.ts +57 -0
- package/pg/inputText/README.md +27 -0
- package/pg/inputText/__examples__/basic/basic.html +9 -0
- package/pg/inputText/__examples__/basic/basic.ts +30 -0
- package/pg/inputText/index.ts +3 -0
- package/pg/inputText/inputText.css +20 -0
- package/pg/inputText/inputText.html +1 -0
- package/pg/inputText/inputText.spec.ts +59 -0
- package/pg/inputText/inputText.ts +59 -0
- package/pg/inputTextIcon/README.md +26 -0
- package/pg/inputTextIcon/index.ts +3 -0
- package/pg/inputTextIcon/inputTextIcon.css +24 -0
- package/pg/inputTextIcon/inputTextIcon.html +4 -0
- package/pg/inputTextIcon/inputTextIcon.spec.ts +44 -0
- package/pg/inputTextIcon/inputTextIcon.ts +26 -0
- package/pg/inputUserSelect/README.md +31 -0
- package/pg/inputUserSelect/__examples__/basic/basic.html +4 -0
- package/pg/inputUserSelect/__examples__/basic/basic.ts +25 -0
- package/pg/inputUserSelect/__examples__/basic/constants.ts +33 -0
- package/pg/inputUserSelect/index.ts +3 -0
- package/pg/inputUserSelect/inputUserSelect.css +174 -0
- package/pg/inputUserSelect/inputUserSelect.html +18 -0
- package/pg/inputUserSelect/inputUserSelect.ts +266 -0
- package/pg/listTag/README.md +26 -0
- package/pg/listTag/__examples__/basic/basic.html +16 -0
- package/pg/listTag/__examples__/basic/basic.ts +53 -0
- package/pg/listTag/__examples__/basic/constants.ts +22 -0
- package/pg/listTag/index.ts +3 -0
- package/pg/listTag/listTag.css +9 -0
- package/pg/listTag/listTag.html +1 -0
- package/pg/listTag/listTag.ts +48 -0
- package/pg/listTag/partials/tag.html +3 -0
- package/pg/markdown/README.md +13 -0
- package/pg/markdown/__examples__/basic/basic.html +3 -0
- package/pg/markdown/__examples__/basic/basic.ts +51 -0
- package/pg/markdown/__examples__/basic/constants.ts +129 -0
- package/pg/markdown/index.ts +5 -0
- package/pg/markdown/markdown.css +760 -0
- package/pg/markdown/markdown.html +1 -0
- package/pg/markdown/markdown.md +123 -0
- package/pg/markdown/markdown.spec.ts +87 -0
- package/pg/markdown/markdown.ts +381 -0
- package/pg/markdown/markdownReplace.ts +7 -0
- package/pg/menuIcon/README.md +13 -0
- package/pg/menuIcon/__examples__/basic/basic.html +3 -0
- package/pg/menuIcon/__examples__/basic/basic.ts +15 -0
- package/pg/menuIcon/index.ts +3 -0
- package/pg/menuIcon/menuIcon.css +168 -0
- package/pg/menuIcon/menuIcon.html +64 -0
- package/pg/menuIcon/menuIcon.ts +271 -0
- package/pg/modalAlert/README.md +17 -0
- package/pg/modalAlert/__examples__/basic/basic.html +4 -0
- package/pg/modalAlert/__examples__/basic/basic.ts +27 -0
- package/pg/modalAlert/index.ts +3 -0
- package/pg/modalAlert/modalAlert.css +43 -0
- package/pg/modalAlert/modalAlert.html +22 -0
- package/pg/modalAlert/modalAlert.ts +45 -0
- package/pg/modification/README.md +34 -0
- package/pg/modification/__examples__/basic/basic.html +8 -0
- package/pg/modification/__examples__/basic/basic.ts +63 -0
- package/pg/modification/__examples__/basic/constants.ts +416 -0
- package/pg/modification/index.ts +3 -0
- package/pg/modification/modification.css +311 -0
- package/pg/modification/modification.html +1 -0
- package/pg/modification/modification.spec.ts +33 -0
- package/pg/modification/modification.ts +201 -0
- package/pg/modification/type/date.html +1 -0
- package/pg/modification/type/iconAliasCreated.html +13 -0
- package/pg/modification/type/iconAliasDeleted.html +13 -0
- package/pg/modification/type/iconAuthorModified.html +13 -0
- package/pg/modification/type/iconCreated.html +13 -0
- package/pg/modification/type/iconDeleted.html +13 -0
- package/pg/modification/type/iconDeprecated.html +13 -0
- package/pg/modification/type/iconDescriptionModified.html +10 -0
- package/pg/modification/type/iconModified.html +14 -0
- package/pg/modification/type/iconRenamed.html +13 -0
- package/pg/modification/type/iconTagCreated.html +13 -0
- package/pg/modification/type/iconTagDeleted.html +13 -0
- package/pg/modification/type/news.html +5 -0
- package/pg/nav/README.md +16 -0
- package/pg/nav/__examples__/basic/basic.html +5 -0
- package/pg/nav/__examples__/basic/basic.ts +11 -0
- package/pg/nav/index.ts +3 -0
- package/pg/nav/nav.css +14 -0
- package/pg/nav/nav.html +16 -0
- package/pg/nav/nav.ts +21 -0
- package/pg/overlay/README.md +37 -0
- package/pg/overlay/__examples__/basic/basic.css +3 -0
- package/pg/overlay/__examples__/basic/basic.html +3 -0
- package/pg/overlay/__examples__/basic/basic.ts +13 -0
- package/pg/overlay/index.ts +3 -0
- package/pg/overlay/overlay.ts +26 -0
- package/pg/picker/README.md +13 -0
- package/pg/picker/index.ts +3 -0
- package/pg/picker/picker.css +56 -0
- package/pg/picker/picker.html +8 -0
- package/pg/picker/picker.ts +66 -0
- package/pg/preview/README.md +19 -0
- package/pg/preview/__examples__/basic/basic.html +11 -0
- package/pg/preview/__examples__/basic/basic.ts +22 -0
- package/pg/preview/index.ts +3 -0
- package/pg/preview/preview.css +34 -0
- package/pg/preview/preview.html +5 -0
- package/pg/preview/preview.ts +38 -0
- package/pg/scroll/README.md +42 -0
- package/pg/scroll/__examples__/basic/basic.css +4 -0
- package/pg/scroll/__examples__/basic/basic.html +11 -0
- package/pg/scroll/__examples__/basic/basic.ts +88 -0
- package/pg/scroll/index.ts +3 -0
- package/pg/scroll/scroll.css +7 -0
- package/pg/scroll/scroll.html +3 -0
- package/pg/scroll/scroll.ts +158 -0
- package/pg/search/README.md +59 -0
- package/pg/search/__examples__/basic/basic.html +3 -0
- package/pg/search/__examples__/basic/basic.ts +29 -0
- package/pg/search/__examples__/basic/constants.ts +3 -0
- package/pg/search/index.ts +3 -0
- package/pg/search/search.css +188 -0
- package/pg/search/search.html +18 -0
- package/pg/search/search.ts +252 -0
- package/pg/search/utils.ts +12 -0
- package/pg/shared/README.md +28 -0
- package/pg/shared/copy.ts +25 -0
- package/pg/shared/database.ts +35 -0
- package/pg/shared/databaseService.ts +230 -0
- package/pg/shared/debounce.ts +12 -0
- package/pg/shared/enums/modificationType.ts +19 -0
- package/pg/shared/filter.ts +14 -0
- package/pg/shared/http.ts +83 -0
- package/pg/shared/iconFilter.spec.ts +61 -0
- package/pg/shared/iconFilter.ts +71 -0
- package/pg/shared/list.ts +34 -0
- package/pg/shared/models/alias.ts +40 -0
- package/pg/shared/models/font.ts +31 -0
- package/pg/shared/models/fontIcon.ts +25 -0
- package/pg/shared/models/fontVersion.ts +22 -0
- package/pg/shared/models/icon.ts +97 -0
- package/pg/shared/models/modification.ts +45 -0
- package/pg/shared/models/style.ts +12 -0
- package/pg/shared/models/tag.ts +37 -0
- package/pg/shared/models/user.ts +35 -0
- package/pg/shared/models/version.ts +20 -0
- package/pg/shared/removeDiacritics.ts +94 -0
- package/pg/shared/toast.ts +47 -0
- package/pg/shared/uuid.ts +6 -0
- package/pg/tab/README.md +18 -0
- package/pg/tab/index.ts +3 -0
- package/pg/tab/tab.css +13 -0
- package/pg/tab/tab.html +3 -0
- package/pg/tab/tab.ts +51 -0
- package/pg/tabs/README.md +31 -0
- package/pg/tabs/__examples__/basic/basic.html +13 -0
- package/pg/tabs/__examples__/basic/basic.ts +11 -0
- package/pg/tabs/index.ts +3 -0
- package/pg/tabs/partials/tab.html +3 -0
- package/pg/tabs/tabs.css +69 -0
- package/pg/tabs/tabs.html +4 -0
- package/pg/tabs/tabs.ts +102 -0
- package/pg/toast/README.md +13 -0
- package/pg/toast/index.ts +3 -0
- package/pg/toast/toast.css +112 -0
- package/pg/toast/toast.html +13 -0
- package/pg/toast/toast.ts +39 -0
- package/pg/toasts/README.md +37 -0
- package/pg/toasts/__examples__/basic/basic.html +11 -0
- package/pg/toasts/__examples__/basic/basic.ts +86 -0
- package/pg/toasts/index.ts +3 -0
- package/pg/toasts/toasts.css +8 -0
- package/pg/toasts/toasts.html +1 -0
- package/pg/toasts/toasts.ts +51 -0
- package/pg/tooltip/README.md +51 -0
- package/pg/tooltip/__examples__/basic/basic.css +38 -0
- package/pg/tooltip/__examples__/basic/basic.html +21 -0
- package/pg/tooltip/__examples__/basic/basic.ts +55 -0
- package/pg/tooltip/addTooltip.ts +31 -0
- package/pg/tooltip/index.ts +20 -0
- package/pg/tooltip/position.ts +15 -0
- package/pg/tooltip/tooltip.css +36 -0
- package/pg/tooltip/tooltip.html +4 -0
- package/pg/tooltip/tooltip.ts +170 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './inputFileLocal.html';
|
|
4
|
+
import style from './inputFileLocal.css';
|
|
5
|
+
|
|
6
|
+
const noIcon = 'M0 0h24v24H0V0zm2 2v20h20V2H2z';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'pg-input-file-local',
|
|
10
|
+
style,
|
|
11
|
+
template
|
|
12
|
+
})
|
|
13
|
+
export default class PgInputFileLocal extends HTMLElement {
|
|
14
|
+
@Prop() acceptsFileType: string = '';
|
|
15
|
+
|
|
16
|
+
@Part() $file: HTMLInputElement;
|
|
17
|
+
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
this.$file.addEventListener('change', () => {
|
|
20
|
+
if (this.$file.files === null || this.$file.files.length === 0) {
|
|
21
|
+
alert('Error : No file selected');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// first file selected by user
|
|
26
|
+
var file = this.$file.files[0];
|
|
27
|
+
|
|
28
|
+
// perform validation on file type & size if required
|
|
29
|
+
if (this.acceptsFileType) {
|
|
30
|
+
var types = this.acceptsFileType.split(',').join('|');
|
|
31
|
+
var regex = new RegExp(`(${types})$`, 'i');
|
|
32
|
+
if (file.name.match(regex) === null) {
|
|
33
|
+
alert(`${this.acceptsFileType} file only`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// read the file
|
|
39
|
+
var reader = new FileReader();
|
|
40
|
+
|
|
41
|
+
// file reading started
|
|
42
|
+
reader.addEventListener('loadstart', function () {
|
|
43
|
+
// console.log('File reading started');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// file reading finished successfully
|
|
47
|
+
reader.addEventListener('load', (e: any) => {
|
|
48
|
+
// contents of file in variable
|
|
49
|
+
var text = e.target.result;
|
|
50
|
+
|
|
51
|
+
this.dispatchEvent(
|
|
52
|
+
new CustomEvent('change', {
|
|
53
|
+
detail: {
|
|
54
|
+
value: text,
|
|
55
|
+
name: file.name
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// file reading failed
|
|
62
|
+
reader.addEventListener('error', function () {
|
|
63
|
+
alert('Error : Failed to read file');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// file read progress
|
|
67
|
+
reader.addEventListener('progress', function (e) {
|
|
68
|
+
if (e.lengthComputable == true) {
|
|
69
|
+
var percent_read = Math.floor((e.loaded / e.total) * 100);
|
|
70
|
+
// console.log(percent_read + '% read');
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// read as text file
|
|
75
|
+
reader.readAsText(file);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
render(changes) {
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `<pg-input-hex-rgb>`
|
|
2
|
+
|
|
3
|
+
The `pg-input-hex-rgb` component allows quick input of hex or RGB color input. This is commonly placed above the `pg-color` selection.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pgInputHexRgb.js';
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<pg-input-hex-rgb value="#000000"></pg-input-hex-rgb>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
| Attributes | Tested | Description |
|
|
14
|
+
| ---------- | -------- | ----------- |
|
|
15
|
+
| value | | Hex |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
import PgInputHexRgb from '../../inputHexRgb';
|
|
3
|
+
|
|
4
|
+
import template from './basic.html';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'x-pg-input-hex-rgb-basic',
|
|
8
|
+
template
|
|
9
|
+
})
|
|
10
|
+
export default class XPgInputHexRgbBasic extends HTMLElement {
|
|
11
|
+
|
|
12
|
+
@Part() $input: PgInputHexRgb;
|
|
13
|
+
@Part() $value: HTMLSpanElement;
|
|
14
|
+
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.$input.addEventListener('change', this.handleChange.bind(this));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
handleChange(e: CustomEvent) {
|
|
20
|
+
var { value } = e.target as any;
|
|
21
|
+
this.$value.innerText = `${value}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:host > div {
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-rows: auto 1rem 2rem 1rem 2rem 1rem 2rem;
|
|
8
|
+
grid-template-rows: 1fr;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[part~="hex"] {
|
|
12
|
+
grid-row: 1;
|
|
13
|
+
grid-column: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[part~="labelRed"] {
|
|
17
|
+
grid-row: 1;
|
|
18
|
+
grid-column: 2;
|
|
19
|
+
background: red;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[part~="red"] {
|
|
23
|
+
grid-row: 1;
|
|
24
|
+
grid-column: 3;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[part~="labelGreen"] {
|
|
28
|
+
grid-row: 1;
|
|
29
|
+
grid-column: 4;
|
|
30
|
+
background: green;
|
|
31
|
+
color: white;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[part~="green"] {
|
|
35
|
+
grid-row: 1;
|
|
36
|
+
grid-column: 5;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part~="labelBlue"] {
|
|
40
|
+
grid-row: 1;
|
|
41
|
+
grid-column: 6;
|
|
42
|
+
background: blue;
|
|
43
|
+
color: white;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[part~="blue"] {
|
|
47
|
+
grid-row: 1;
|
|
48
|
+
grid-column: 7;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[part~="labelRed"],
|
|
52
|
+
[part~="labelGreen"],
|
|
53
|
+
[part~="labelBlue"] {
|
|
54
|
+
display: flex;
|
|
55
|
+
margin-left: 0.25rem;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
border-radius: 0.25rem 0 0 0.25rem;
|
|
59
|
+
color: white;
|
|
60
|
+
min-width: 1rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[part~="hex"] {
|
|
64
|
+
border-radius: 0.25rem;
|
|
65
|
+
min-width: 4rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[part~="hex"],
|
|
69
|
+
[part~="red"],
|
|
70
|
+
[part~="green"],
|
|
71
|
+
[part~="blue"] {
|
|
72
|
+
outline: none;
|
|
73
|
+
font-size: 1rem;
|
|
74
|
+
padding: 0.25rem 0.5rem;
|
|
75
|
+
border: 0;
|
|
76
|
+
width: calc(100% - 1rem);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[part~="red"],
|
|
80
|
+
[part~="green"],
|
|
81
|
+
[part~="blue"] {
|
|
82
|
+
border-radius: 0 0.25rem 0.25rem 0;
|
|
83
|
+
-moz-appearance: textfield;
|
|
84
|
+
width: calc(100% - 1rem);
|
|
85
|
+
min-width: 2rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[part~="red"]::-webkit-inner-spin-button,
|
|
89
|
+
[part~="red"]::-webkit-outer-spin-button,
|
|
90
|
+
[part~="green"]::-webkit-inner-spin-button,
|
|
91
|
+
[part~="green"]::-webkit-outer-spin-button,
|
|
92
|
+
[part~="blue"]::-webkit-inner-spin-button,
|
|
93
|
+
[part~="blue"]::-webkit-outer-spin-button {
|
|
94
|
+
-webkit-appearance: none;
|
|
95
|
+
margin: 0;
|
|
96
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<input part="hex" type="text" />
|
|
3
|
+
<label part="labelRed">R</label>
|
|
4
|
+
<input part="red" type="number" step="1" min="0" max="255" />
|
|
5
|
+
<label part="labelGreen">G</label>
|
|
6
|
+
<input part="green" type="number" step="1" min="0" max="255" />
|
|
7
|
+
<label part="labelBlue">B</label>
|
|
8
|
+
<input part="blue" type="number" step="1" min="0" max="255" />
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
import { normalizeHex, hexToRgb, rgbToHex } from './utils';
|
|
3
|
+
|
|
4
|
+
import template from './inputHexRgb.html';
|
|
5
|
+
import style from './inputHexRgb.css';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'pg-input-hex-rgb',
|
|
9
|
+
style,
|
|
10
|
+
template
|
|
11
|
+
})
|
|
12
|
+
export default class PgInputHexRgb extends HTMLElement {
|
|
13
|
+
@Prop() value: string = '#000000';
|
|
14
|
+
|
|
15
|
+
@Part() $hex: HTMLInputElement;
|
|
16
|
+
@Part() $red: HTMLInputElement;
|
|
17
|
+
@Part() $green: HTMLInputElement;
|
|
18
|
+
@Part() $blue: HTMLInputElement;
|
|
19
|
+
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
this.$hex.value = this.value;
|
|
22
|
+
this.updateRgb();
|
|
23
|
+
this.$hex.addEventListener('input', this.updateRgbDispatch.bind(this));
|
|
24
|
+
this.$red.addEventListener('input', this.updateHexDispatch.bind(this));
|
|
25
|
+
this.$green.addEventListener('input', this.updateHexDispatch.bind(this));
|
|
26
|
+
this.$blue.addEventListener('input', this.updateHexDispatch.bind(this));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
updateRgb() {
|
|
30
|
+
const hex = normalizeHex(this.$hex.value);
|
|
31
|
+
const rgb = hexToRgb(hex);
|
|
32
|
+
if (rgb !== null) {
|
|
33
|
+
this.$red.value = rgb.r.toString();
|
|
34
|
+
this.$green.value = rgb.g.toString();
|
|
35
|
+
this.$blue.value = rgb.b.toString();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
updateRgbDispatch() {
|
|
40
|
+
this.updateRgb();
|
|
41
|
+
this.dispatchSelect();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
updateHexDispatch() {
|
|
45
|
+
this.$hex.value = rgbToHex(
|
|
46
|
+
parseInt(this.$red.value || '0', 10),
|
|
47
|
+
parseInt(this.$green.value || '0', 10),
|
|
48
|
+
parseInt(this.$blue.value || '0', 10)
|
|
49
|
+
);
|
|
50
|
+
this.dispatchSelect();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
dispatchSelect() {
|
|
54
|
+
const hex = normalizeHex(this.$hex.value);
|
|
55
|
+
const rgb = rgbToHex(
|
|
56
|
+
parseInt(this.$red.value || '0', 10),
|
|
57
|
+
parseInt(this.$green.value || '0'),
|
|
58
|
+
parseInt(this.$blue.value || '0')
|
|
59
|
+
);
|
|
60
|
+
this.value = hex;
|
|
61
|
+
this.dispatchEvent(
|
|
62
|
+
new CustomEvent('change', {
|
|
63
|
+
detail: {
|
|
64
|
+
hex,
|
|
65
|
+
rgb
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
render() {
|
|
72
|
+
const hex = normalizeHex(this.value);
|
|
73
|
+
const rgb = hexToRgb(hex);
|
|
74
|
+
this.$hex.value = hex;
|
|
75
|
+
this.$red.value = `${rgb ? rgb.r : 0}`;
|
|
76
|
+
this.$green.value = `${rgb ? rgb.g : 0}`;
|
|
77
|
+
this.$blue.value = `${rgb ? rgb.b : 0}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function hexToRgb(hex): { r: number, g: number, b: number} | null {
|
|
2
|
+
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
3
|
+
return result ? {
|
|
4
|
+
r: parseInt(result[1], 16),
|
|
5
|
+
g: parseInt(result[2], 16),
|
|
6
|
+
b: parseInt(result[3], 16)
|
|
7
|
+
} : null;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function normalizeHex(hex: string) {
|
|
11
|
+
const h = hex.toUpperCase();
|
|
12
|
+
if (h.length === 7) {
|
|
13
|
+
return h;
|
|
14
|
+
} else if (h.length === 4) {
|
|
15
|
+
return `#${h[1]}${h[1]}${h[2]}${h[2]}${h[3]}${h[3]}`;
|
|
16
|
+
}
|
|
17
|
+
return '#000000';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function cToHex(c) {
|
|
21
|
+
var hex = c.toString(16);
|
|
22
|
+
return hex.length == 1 ? "0" + hex : hex;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function rgbToHex(r, g, b) {
|
|
26
|
+
return "#" + cToHex(r) + cToHex(g) + cToHex(b);
|
|
27
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# `<pg-input-range>`
|
|
2
|
+
|
|
3
|
+
The `pg-input-range` component creates an input range slider.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pgInputRange';
|
|
7
|
+
import { PgInputRange } from '@pictogrammers/components/pgInputRange';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<pg-input-range value="50" min="1" max="100"></pg-input-range>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Attributes | Tested | Description |
|
|
15
|
+
| ---------- | -------- | ----------- |
|
|
16
|
+
| min | | Min |
|
|
17
|
+
| max | | Max |
|
|
18
|
+
| step | | Step = 1 |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
import PgInputRange from '../../inputRange';
|
|
3
|
+
|
|
4
|
+
import template from './basic.html';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'x-pg-input-range-basic',
|
|
8
|
+
template
|
|
9
|
+
})
|
|
10
|
+
export default class XPgInputRangeBasic extends HTMLElement {
|
|
11
|
+
|
|
12
|
+
@Part() $input: PgInputRange;
|
|
13
|
+
@Part() $value1: HTMLSpanElement;
|
|
14
|
+
@Part() $value2: HTMLSpanElement;
|
|
15
|
+
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.$input.addEventListener('change', this.handleChange.bind(this));
|
|
18
|
+
this.$input.addEventListener('input', this.handleInput.bind(this));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
handleChange(e: CustomEvent) {
|
|
22
|
+
const { value } = e.detail;
|
|
23
|
+
this.$value1.innerText = value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handleInput(e: CustomEvent) {
|
|
27
|
+
const { value } = e.detail;
|
|
28
|
+
this.$value2.innerText = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<input part="input" type="range" />
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './inputRange.html';
|
|
4
|
+
import style from './inputRange.css';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'pg-input-range',
|
|
8
|
+
style,
|
|
9
|
+
template
|
|
10
|
+
})
|
|
11
|
+
export default class PgInputRange extends HTMLElement {
|
|
12
|
+
@Prop() min: string = '0';
|
|
13
|
+
@Prop() max: string = '100';
|
|
14
|
+
@Prop() step: string = '1';
|
|
15
|
+
@Prop() name: string = '';
|
|
16
|
+
|
|
17
|
+
@Part() $input: HTMLInputElement;
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
this.$input.min = this.min;
|
|
21
|
+
this.$input.max = this.max;
|
|
22
|
+
this.$input.step = this.step;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
this.$input.addEventListener('change', this.handleChange.bind(this));
|
|
27
|
+
this.$input.addEventListener('input', this.handleInput.bind(this));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
handleChange(e) {
|
|
31
|
+
const { value } = e.target;
|
|
32
|
+
this.dispatchEvent(
|
|
33
|
+
new CustomEvent('change', {
|
|
34
|
+
detail: {
|
|
35
|
+
value,
|
|
36
|
+
name: this.name
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
handleInput(e) {
|
|
43
|
+
const { value } = e.target;
|
|
44
|
+
this.dispatchEvent(
|
|
45
|
+
new CustomEvent('input', {
|
|
46
|
+
detail: {
|
|
47
|
+
value,
|
|
48
|
+
name: this.name
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# `<pg-input-select>`
|
|
2
|
+
|
|
3
|
+
The `pg-input-select` component creates an select drop down.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pgInputSelect';
|
|
7
|
+
import { PgInputSelect } '@mdi/components/pgInputSelect';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<pg-input-select></pg-input-select>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
|
|
16
|
+
| Attributes | Tested | Description |
|
|
17
|
+
| ---------- | -------- | ----------- |
|
|
18
|
+
| options | | `[{ label: 'hello', value: 'world' }]` |
|
|
19
|
+
| value | | `world` |
|
|
20
|
+
|
|
21
|
+
## Events
|
|
22
|
+
|
|
23
|
+
| Event | Tested | Detail |
|
|
24
|
+
| --------- | -------- | ----------- |
|
|
25
|
+
| change | | `{ label: 'hello', value: 'world' }` |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
import PgInputSelect from '../../inputSelect';
|
|
3
|
+
|
|
4
|
+
import template from './basic.html';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'x-pg-input-select-basic',
|
|
8
|
+
template
|
|
9
|
+
})
|
|
10
|
+
export default class XPgInputSelectBasic extends HTMLElement {
|
|
11
|
+
|
|
12
|
+
@Part() $input: PgInputSelect;
|
|
13
|
+
@Part() $value: HTMLSpanElement;
|
|
14
|
+
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.$input.options = [
|
|
17
|
+
{ label: 'Option 1', value: 'option1' },
|
|
18
|
+
{ label: 'Option 2', value: 'option2' },
|
|
19
|
+
{ label: 'Option 3', value: 'option3' },
|
|
20
|
+
{ label: 'Option 4', value: 'option4' }
|
|
21
|
+
];
|
|
22
|
+
this.$input.value = this.$input.options[1].value;
|
|
23
|
+
this.$input.addEventListener('change', this.handleChange.bind(this));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handleChange(e) {
|
|
27
|
+
const { value } = e.detail;
|
|
28
|
+
this.$value.innerText = `${value}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
font-family: var(--pg-font-family);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[part="wrapper"] {
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-rows: auto;
|
|
9
|
+
grid-template-columns: 100% 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[part="select"] {
|
|
13
|
+
grid-row: 1;
|
|
14
|
+
grid-column: 1;
|
|
15
|
+
border: 1px solid var(--pg-input-select-border-color, #453C4F);
|
|
16
|
+
border-radius: 0.25rem;
|
|
17
|
+
padding: 0.5rem 0.75rem;
|
|
18
|
+
width: 100%;
|
|
19
|
+
font-size: 1rem;
|
|
20
|
+
outline: 0;
|
|
21
|
+
-webkit-appearance: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[part="select"]:focus {
|
|
25
|
+
box-shadow: 0 0 0 3px rgba(79, 143, 249, 0.5);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[part="chevron"] {
|
|
29
|
+
grid-row: 1;
|
|
30
|
+
grid-column: 2;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
width: 1.5rem;
|
|
33
|
+
height: 1.5rem;
|
|
34
|
+
align-self: center;
|
|
35
|
+
transform: translate(-2rem, 0);
|
|
36
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './inputSelect.html';
|
|
4
|
+
import style from './inputSelect.css';
|
|
5
|
+
|
|
6
|
+
interface InputSelectItem {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'pg-input-select',
|
|
13
|
+
style,
|
|
14
|
+
template
|
|
15
|
+
})
|
|
16
|
+
export default class PgInputSelect extends HTMLElement {
|
|
17
|
+
@Prop() options: InputSelectItem[] = [];
|
|
18
|
+
@Prop() value: string;
|
|
19
|
+
@Prop() name: string = '';
|
|
20
|
+
|
|
21
|
+
@Part() $select: HTMLSelectElement;
|
|
22
|
+
|
|
23
|
+
render(changes) {
|
|
24
|
+
if (changes.options) {
|
|
25
|
+
this.options.forEach(o => {
|
|
26
|
+
const option = document.createElement('option');
|
|
27
|
+
option.innerText = o.label;
|
|
28
|
+
option.value = o.value;
|
|
29
|
+
this.$select.appendChild(option);
|
|
30
|
+
});
|
|
31
|
+
if (this.$select.value !== this.value) {
|
|
32
|
+
this.$select.value = this.value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (changes.value) {
|
|
36
|
+
if (this.$select.value !== this.value) {
|
|
37
|
+
this.$select.value = this.value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
this.$select.addEventListener('change', this.handleSelect.bind(this));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
handleSelect(e) {
|
|
47
|
+
const { value } = e.target;
|
|
48
|
+
this.dispatchEvent(
|
|
49
|
+
new CustomEvent('change', {
|
|
50
|
+
detail: {
|
|
51
|
+
value,
|
|
52
|
+
name: this.name
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# `<pg-input-text>`
|
|
2
|
+
|
|
3
|
+
The `pg-input-text` component creates an input that accepts text input.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pgInputText';
|
|
7
|
+
import { PgInputText } from '@pictogrammers/components/pgInputText';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<pg-input-text value="50"></pg-input-text>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
|
|
16
|
+
| Attributes | Tested | Description |
|
|
17
|
+
| ----------- | -------- | ----------- |
|
|
18
|
+
| name | | Unique name in `pg-form` |
|
|
19
|
+
| value | | Field value |
|
|
20
|
+
| placeholder | | Placeholder text |
|
|
21
|
+
|
|
22
|
+
## Events
|
|
23
|
+
|
|
24
|
+
| Events | Tested | Description |
|
|
25
|
+
| ---------- | -------- | ----------- |
|
|
26
|
+
| change | | `{ detail: { value }` |
|
|
27
|
+
| input | | `{ detail: { value }` |
|