@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,91 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
[part="button"] {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
align-content: center;
|
|
9
|
+
font-family: var(--pg-font-family);
|
|
10
|
+
font-size: 1rem;
|
|
11
|
+
line-height: 1.5rem;
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[part="button"] {
|
|
16
|
+
border: 1px solid var(--pg-button-border-color, #453C4F);
|
|
17
|
+
background-color: var(--pg-button-background-color, #fff);
|
|
18
|
+
color: var(--pg-button-color, #453C4F);
|
|
19
|
+
padding: var(--pg-button-padding, 0.25rem 0.5rem);
|
|
20
|
+
border-radius: 0.25rem;
|
|
21
|
+
outline: none;
|
|
22
|
+
--pg-icon-color: var(--pg-button-color, #453C4F);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[part="button"]:hover {
|
|
26
|
+
border: 1px solid var(--pg-button-hover-border-color, #453C4F);
|
|
27
|
+
background-color: var(--pg-button-hover-background-color, #453C4F);
|
|
28
|
+
color: var(--pg-hover-button-color, #fff);
|
|
29
|
+
--pg-icon-color: var(--pg-button-hover-color, #fff);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part="button"]:active {
|
|
33
|
+
box-shadow: 0 1px 0.25rem rgba(0, 0, 0, 0.5) inset;
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part="button"]:focus {
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[part="button"]:active::before {
|
|
42
|
+
content: '';
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: -1px;
|
|
45
|
+
right: -1px;
|
|
46
|
+
bottom: -1px;
|
|
47
|
+
left: -1px;
|
|
48
|
+
border-radius: 0.25rem;
|
|
49
|
+
box-shadow: 0 0 0 3px var(--pg-search-focus-glow, rgb(79, 143, 249, 0.6));
|
|
50
|
+
}
|
|
51
|
+
[part="button"]:focus::before {
|
|
52
|
+
content: '';
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: -1px;
|
|
55
|
+
right: -1px;
|
|
56
|
+
bottom: -1px;
|
|
57
|
+
left: -1px;
|
|
58
|
+
border-radius: 0.25rem;
|
|
59
|
+
box-shadow: 0 0 0 3px var(--pg-search-focus-glow, rgb(79, 143, 249, 0.5));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[part="button"].start {
|
|
63
|
+
border-top-right-radius: 0;
|
|
64
|
+
border-bottom-right-radius: 0;
|
|
65
|
+
margin-right: -1px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[part="button"].center {
|
|
69
|
+
border-radius: 0;
|
|
70
|
+
margin-right: -1px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[part="button"].end {
|
|
74
|
+
border-top-left-radius: 0;
|
|
75
|
+
border-bottom-left-radius: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[part="button"].active,
|
|
79
|
+
[part="button"].active:hover {
|
|
80
|
+
box-shadow: 0 1px 0.25rem rgba(0, 0, 0, 0.5) inset;
|
|
81
|
+
background-color: rgba(69, 60, 79, 0.1);
|
|
82
|
+
color: var(--pg-button-color, #453C4F);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[part="button"].block {
|
|
86
|
+
flex: 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
::slotted(*) {
|
|
90
|
+
align-self: center;
|
|
91
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './buttonLink.html';
|
|
4
|
+
import style from './buttonLink.css';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'pg-button-link',
|
|
8
|
+
style,
|
|
9
|
+
template
|
|
10
|
+
})
|
|
11
|
+
export default class PgButtonLink extends HTMLElement {
|
|
12
|
+
@Prop() href: string = '';
|
|
13
|
+
@Prop() active: string | boolean = false;
|
|
14
|
+
@Prop() block: string | boolean = false;
|
|
15
|
+
@Prop() start: string | boolean = false;
|
|
16
|
+
@Prop() center: string | boolean = false;
|
|
17
|
+
@Prop() end: string | boolean = false;
|
|
18
|
+
|
|
19
|
+
@Part() $button: HTMLAnchorElement;
|
|
20
|
+
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
this.$button.addEventListener('click', (e) => this.dispatchEvent(new CustomEvent('click')));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render(changes) {
|
|
26
|
+
if (changes.href) {
|
|
27
|
+
this.$button.href = this.href;
|
|
28
|
+
}
|
|
29
|
+
const t = [true, 'true', ''];
|
|
30
|
+
if (changes.active) {
|
|
31
|
+
this.$button.classList.toggle('active', t.includes(this.active));
|
|
32
|
+
}
|
|
33
|
+
if (changes.start) {
|
|
34
|
+
this.$button.classList.toggle('start', t.includes(this.start));
|
|
35
|
+
}
|
|
36
|
+
if (changes.end) {
|
|
37
|
+
this.$button.classList.toggle('end', t.includes(this.end));
|
|
38
|
+
}
|
|
39
|
+
if (changes.center) {
|
|
40
|
+
this.$button.classList.toggle('center', t.includes(this.center));
|
|
41
|
+
}
|
|
42
|
+
if (changes.block) {
|
|
43
|
+
this.$button.classList.toggle('block', t.includes(this.block));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# `<pg-button-toggle>`
|
|
2
|
+
|
|
3
|
+
The `pg-button-toggle` component is essentially just a button with swappable slotted content. Commonly used with icons, but using `span` elements will allow assigning text content.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pg/buttonToggle';
|
|
7
|
+
import PgButtonToggle from '@pictogrammers/components/pg/buttonToggle';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<pg-button-toggle>
|
|
12
|
+
<pg-icon slot="active" path="M...Z"></pg-icon>
|
|
13
|
+
<pg-icon slot="inactive" path="M...Z"></pg-icon>
|
|
14
|
+
</pg-button-toggle>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
| Slots | Tested | Description |
|
|
18
|
+
| ----------- | -------- | ----------- |
|
|
19
|
+
| default | ✅ | Button contents. |
|
|
20
|
+
|
|
21
|
+
| Attribute | Tested | Description |
|
|
22
|
+
| ---------- | -------- | ----------- |
|
|
23
|
+
| block | | block sizing |
|
|
24
|
+
| active | | Depressed visual state. |
|
|
25
|
+
| start | | Internal Only |
|
|
26
|
+
| end | | Internal Only |
|
|
27
|
+
| center | | Internal Only |
|
|
28
|
+
|
|
29
|
+
| Events | Tested | Description |
|
|
30
|
+
| ---------- | -------- | ----------- |
|
|
31
|
+
| click | ✅ | Standard click. |
|
|
32
|
+
|
|
33
|
+
| CSS Variables | Default | Description |
|
|
34
|
+
| ------------------- | --------- | ----------- |
|
|
35
|
+
| `--pg-button-color` | `#453C4F` | Text color |
|
|
36
|
+
| `--pg-button-background-color` | `#fff` | Background color |
|
|
37
|
+
| `--pg-button-border-color` | `#453C4F` | Border color |
|
|
38
|
+
| `--pg-button-hover-color` | `#fff` | `:hover` Text color |
|
|
39
|
+
| `--pg-button-hover-background-color` | `#453C4F` | `:hover` Background color |
|
|
40
|
+
| `--pg-button-hover-border-color` | `#453C4F` | `:hover` Border color |
|
|
41
|
+
| `--pg-button-active-color` | `#fff` | `active` Text color |
|
|
42
|
+
| `--pg-button-active-background-color` | `#453C4F` | `active` Background color |
|
|
43
|
+
| `--pg-button-active-border-color` | `#453C4F` | `active` Border color |
|
|
44
|
+
|
|
45
|
+
### Slots
|
|
46
|
+
|
|
47
|
+
Special styling is applied for `pg-icon`.
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<pg-button-toggle>
|
|
51
|
+
<pg-icon slot="active" path="M...Z"></pg-icon>
|
|
52
|
+
<pg-icon slot="inactive" path="M...Z"></pg-icon>
|
|
53
|
+
</pg-button-toggle>
|
|
54
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="example">
|
|
2
|
+
<div>click to toggle state</div>
|
|
3
|
+
<pg-button-toggle part="button">
|
|
4
|
+
<pg-icon slot="inactive" path="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"></pg-icon>
|
|
5
|
+
<pg-icon slot="active" path="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"></pg-icon>
|
|
6
|
+
</pg-button-toggle>
|
|
7
|
+
<div>
|
|
8
|
+
<code>onclick: <code part="value"></code></code>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
import PgButtonToggle from '../../buttonToggle';
|
|
3
|
+
|
|
4
|
+
import template from './basic.html';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'x-pg-button-toggle-basic',
|
|
8
|
+
template
|
|
9
|
+
})
|
|
10
|
+
export default class XPgButtonToggleBasic extends HTMLElement {
|
|
11
|
+
|
|
12
|
+
@Part() $button: PgButtonToggle;
|
|
13
|
+
@Part() $value: HTMLSpanElement;
|
|
14
|
+
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.$button.addEventListener('click', this.handleClick.bind(this));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
handleClick(e) {
|
|
20
|
+
const { active } = e.detail;
|
|
21
|
+
this.$value.innerText = `${active}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import '../button/button';
|
|
4
|
+
import PgButton from '../button/button';
|
|
5
|
+
|
|
6
|
+
import template from './buttonToggle.html';
|
|
7
|
+
import style from './buttonToggle.css';
|
|
8
|
+
|
|
9
|
+
const t = [true, 'true', ''];
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'pg-button-toggle',
|
|
13
|
+
style,
|
|
14
|
+
template
|
|
15
|
+
})
|
|
16
|
+
export default class PgButtonToggle extends HTMLElement {
|
|
17
|
+
@Prop() active: string | boolean = false;
|
|
18
|
+
|
|
19
|
+
@Part() $button: PgButton;
|
|
20
|
+
@Part() $expand: HTMLSlotElement;
|
|
21
|
+
@Part() $collapse: HTMLSlotElement;
|
|
22
|
+
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
this.$button.addEventListener('click', (e) => {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
this.active = !t.includes(this.active);
|
|
27
|
+
this.dispatchEvent(
|
|
28
|
+
new CustomEvent('click', {
|
|
29
|
+
detail: {
|
|
30
|
+
active: this.active
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render(changes) {
|
|
38
|
+
if (changes.active) {
|
|
39
|
+
this.$button.active = t.includes(this.active);
|
|
40
|
+
this.$expand.style.display = this.$button.active ? 'initial' : 'none';
|
|
41
|
+
this.$collapse.style.display = this.$button.active ? 'none' : 'initial';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# `<pg-card>`
|
|
2
|
+
|
|
3
|
+
The `pg-card` component is a presentational component for adding a shadow with rounded corners.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pg/icon';
|
|
7
|
+
import PgIcon from '@pictogrammers/components/pg/icon';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<pg-card>
|
|
12
|
+
Body
|
|
13
|
+
</pg-card>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## CSS Variables
|
|
17
|
+
|
|
18
|
+
| CSS Variables | Default | Description |
|
|
19
|
+
| --------------------- | ----------- | ----------- |
|
|
20
|
+
| `--pg-card-color` | `'#453C4F'` | Color |
|
|
21
|
+
| `--pg-card-padding` | `0` | Padding |
|
package/pg/card/card.css
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[part="body"] {
|
|
7
|
+
padding: var(--pg-card-padding, 0);
|
|
8
|
+
border-radius: var(--pg-card-padding, 0.5rem);
|
|
9
|
+
background: var(--pg-card-background, #fff);
|
|
10
|
+
box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.3);
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { selectComponent, getAttributes } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import './card';
|
|
4
|
+
import PgCard from './card';
|
|
5
|
+
|
|
6
|
+
const PG_CARD = 'pg-card';
|
|
7
|
+
|
|
8
|
+
describe('pg-card', () => {
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
var c = document.createElement(PG_CARD);
|
|
12
|
+
document.body.appendChild(c);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
while (document.body.firstChild) {
|
|
17
|
+
document.body.removeChild(document.body.firstChild);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should be registered', () => {
|
|
22
|
+
expect(customElements.get(PG_CARD)).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should only expose known props', () => {
|
|
26
|
+
const props = getAttributes(PG_CARD);
|
|
27
|
+
expect(props.length).toBe(0);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
});
|
package/pg/card/card.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './card.html';
|
|
4
|
+
import style from './card.css';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'pg-card',
|
|
8
|
+
style,
|
|
9
|
+
template
|
|
10
|
+
})
|
|
11
|
+
export default class PgCard extends HTMLElement {
|
|
12
|
+
|
|
13
|
+
}
|
package/pg/card/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# `<pg-card-user>`
|
|
2
|
+
|
|
3
|
+
The `pg-card-user` component lets one display a `User` type in a visual card.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import '@pictogrammers/components/pg/cardUser';
|
|
7
|
+
import PgIcon from '@pictogrammers/components/pg/cardUser';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<pg-card-user></pg-card-user>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
|
|
16
|
+
| Attributes | Tested | Description |
|
|
17
|
+
| ---------- | -------- | ----------- |
|
|
18
|
+
| user | ✅ | `User` |
|
|
19
|
+
|
|
20
|
+
## CSS Variables
|
|
21
|
+
|
|
22
|
+
See `pg-card`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
import PgCardUser from '../../cardUser';
|
|
3
|
+
import { AVATAR } from './constants';
|
|
4
|
+
import { User } from '../../../shared/models/user';
|
|
5
|
+
|
|
6
|
+
import template from './basic.html';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'x-pg-card-user-basic',
|
|
10
|
+
template
|
|
11
|
+
})
|
|
12
|
+
export default class XPgCardUserBasic extends HTMLElement {
|
|
13
|
+
|
|
14
|
+
@Part() $cardUser1: PgCardUser;
|
|
15
|
+
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.$cardUser1.user = new User().from({
|
|
18
|
+
"id": "c4ea5584-07e3-11e4-bf19-842b2b6cfe1b",
|
|
19
|
+
"name": "Austin Andrews",
|
|
20
|
+
"description": "Hello, I am a developer that gets bored and makes icons, then websites for icons, then more icons. Open Source is pretty awesome.",
|
|
21
|
+
"base64": AVATAR,
|
|
22
|
+
"github": "Templarian",
|
|
23
|
+
"twitter": "Templarian",
|
|
24
|
+
"iconCount": 928,
|
|
25
|
+
"website": "http:\/\/templarian.com",
|
|
26
|
+
"sponsored": true,
|
|
27
|
+
"core": true
|
|
28
|
+
} as any);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AVATAR = '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';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
font-family: var(--pg-font-family);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
[part="user"] {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-rows: 1fr 1fr;
|
|
10
|
+
grid-template-columns: 4rem 2rem 1.5rem 1fr auto;
|
|
11
|
+
padding: 0.5rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part="avatar"] {
|
|
15
|
+
grid-column: 1;
|
|
16
|
+
grid-row: 1 / span 2;
|
|
17
|
+
align-self: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[part="name"] {
|
|
21
|
+
grid-column: 2 / span 3;
|
|
22
|
+
grid-row: 1;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[part="iconCount"] {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
text-align: center;
|
|
30
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) inset;
|
|
31
|
+
border-radius: 0.25rem;
|
|
32
|
+
background: rgba(0, 0, 0, 0.05);
|
|
33
|
+
grid-column: 5;
|
|
34
|
+
grid-row: 1 / span 2;
|
|
35
|
+
padding: 0 0.5rem;
|
|
36
|
+
align-items: stretch;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
color: #444;
|
|
39
|
+
margin-left: 0.5rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[part="iconCountValue"] {
|
|
43
|
+
font-weight: bold;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[part="github"] svg,
|
|
47
|
+
[part="twitter"] svg {
|
|
48
|
+
width: 1.5rem;
|
|
49
|
+
height: 1.5rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part="github"] {
|
|
53
|
+
grid-row: 2;
|
|
54
|
+
grid-column: 2;
|
|
55
|
+
color: #333;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part="twitter"] {
|
|
59
|
+
grid-row: 2;
|
|
60
|
+
grid-column: 3;
|
|
61
|
+
color: #333;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[part="github"]:hover,
|
|
65
|
+
[part="twitter"]:hover {
|
|
66
|
+
color: #4f8ff9;
|
|
67
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<pg-card>
|
|
2
|
+
<div part="loading">
|
|
3
|
+
Loading...
|
|
4
|
+
</div>
|
|
5
|
+
<div part="user">
|
|
6
|
+
<pg-avatar part="avatar"></pg-avatar>
|
|
7
|
+
<div part="name"></div>
|
|
8
|
+
<div part="iconCount">
|
|
9
|
+
<div part="iconCountValue"></div>
|
|
10
|
+
<div part="iconCountLabel">Icons</div>
|
|
11
|
+
</div>
|
|
12
|
+
<a part="github">
|
|
13
|
+
<svg viewBox="0 0 24 24">
|
|
14
|
+
<path fill="currentColor" d="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z" />
|
|
15
|
+
</svg>
|
|
16
|
+
</a>
|
|
17
|
+
<a part="twitter">
|
|
18
|
+
<svg viewBox="0 0 24 24">
|
|
19
|
+
<path fill="currentColor" d="M22.46,6C21.69,6.35 20.86,6.58 20,6.69C20.88,6.16 21.56,5.32 21.88,4.31C21.05,4.81 20.13,5.16 19.16,5.36C18.37,4.5 17.26,4 16,4C13.65,4 11.73,5.92 11.73,8.29C11.73,8.63 11.77,8.96 11.84,9.27C8.28,9.09 5.11,7.38 3,4.79C2.63,5.42 2.42,6.16 2.42,6.94C2.42,8.43 3.17,9.75 4.33,10.5C3.62,10.5 2.96,10.3 2.38,10C2.38,10 2.38,10 2.38,10.03C2.38,12.11 3.86,13.85 5.82,14.24C5.46,14.34 5.08,14.39 4.69,14.39C4.42,14.39 4.15,14.36 3.89,14.31C4.43,16 6,17.26 7.89,17.29C6.43,18.45 4.58,19.13 2.56,19.13C2.22,19.13 1.88,19.11 1.54,19.07C3.44,20.29 5.7,21 8.12,21C16,21 20.33,14.46 20.33,8.79C20.33,8.6 20.33,8.42 20.32,8.23C21.16,7.63 21.88,6.87 22.46,6Z" />
|
|
20
|
+
</svg>
|
|
21
|
+
</a>
|
|
22
|
+
</div>
|
|
23
|
+
</pg-card>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { selectComponent, getAttributes } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import './cardUser';
|
|
4
|
+
import PgCardUser from './cardUser';
|
|
5
|
+
|
|
6
|
+
const PG_CARD_USER = 'pg-card-user';
|
|
7
|
+
|
|
8
|
+
describe('pg-card-user', () => {
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
var c = document.createElement(PG_CARD_USER);
|
|
12
|
+
document.body.appendChild(c);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
while (document.body.firstChild) {
|
|
17
|
+
document.body.removeChild(document.body.firstChild);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should be registered', () => {
|
|
22
|
+
expect(customElements.get(PG_CARD_USER)).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should only expose known props', () => {
|
|
26
|
+
const props = getAttributes(PG_CARD_USER);
|
|
27
|
+
expect(props.length).toBe(1);
|
|
28
|
+
expect(props).toContain('user');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
it('should default path value', () => {
|
|
33
|
+
const component = selectComponent<PgIcon>(PG_CARD_USER);
|
|
34
|
+
const { $path } = component;
|
|
35
|
+
expect($path.getAttribute('d')).toEqual(DEFAULT_ICON);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('path should be set', async () => {
|
|
39
|
+
const component = selectComponent<PgIcon>(PG_CARD_USER);
|
|
40
|
+
const { $path } = component;
|
|
41
|
+
await component.setAttribute('path', ICON);
|
|
42
|
+
expect($path.getAttribute('d')).toEqual(ICON);
|
|
43
|
+
});
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './cardUser.html';
|
|
4
|
+
import style from './cardUser.css';
|
|
5
|
+
|
|
6
|
+
import { addTooltip } from '../tooltip/addTooltip';
|
|
7
|
+
import { User } from '../shared/models/user';
|
|
8
|
+
import '../card/card';
|
|
9
|
+
import '../avatar/avatar';
|
|
10
|
+
import PgAvatar from '../avatar/avatar';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'pg-card-user',
|
|
14
|
+
style,
|
|
15
|
+
template
|
|
16
|
+
})
|
|
17
|
+
export default class PgCardUser extends HTMLElement {
|
|
18
|
+
@Prop() user: User | null = null;
|
|
19
|
+
|
|
20
|
+
@Part() $loading: HTMLDivElement;
|
|
21
|
+
@Part() $user: HTMLDivElement;
|
|
22
|
+
@Part() $name: HTMLDivElement;
|
|
23
|
+
@Part() $github: HTMLAnchorElement;
|
|
24
|
+
@Part() $twitter: HTMLAnchorElement;
|
|
25
|
+
@Part() $iconCountValue: HTMLDivElement;
|
|
26
|
+
@Part() $avatar: PgAvatar;
|
|
27
|
+
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
addTooltip(this.$github, () => {
|
|
30
|
+
return `View ${this.user?.github} on GitHub`;
|
|
31
|
+
});
|
|
32
|
+
addTooltip(this.$twitter, () => {
|
|
33
|
+
return `View ${this.user?.twitter} on Twitter`;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render(changes) {
|
|
38
|
+
if (changes.user && this.user) {
|
|
39
|
+
this.$avatar.user = this.user;
|
|
40
|
+
this.$name.innerText = `${this.user.name}`;
|
|
41
|
+
this.$iconCountValue.innerText = `${this.user.iconCount}`;
|
|
42
|
+
this.$github.href = `https://github.com/${this.user.github}`;
|
|
43
|
+
this.$github.style.setProperty('display', this.user.github ? null : 'none');
|
|
44
|
+
this.$twitter.href = `https://github.com/${this.user.twitter}`;
|
|
45
|
+
this.$twitter.style.setProperty('display', this.user.twitter ? null : 'none');
|
|
46
|
+
this.$user.style.setProperty('display', null);
|
|
47
|
+
this.$loading.style.setProperty('display', 'none');
|
|
48
|
+
} else {
|
|
49
|
+
this.$user.style.setProperty('display', 'none');
|
|
50
|
+
this.$loading.style.setProperty('display', null);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|