@hotosm/ui 0.2.0-b4 → 0.2.0-b6

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.
Files changed (54) hide show
  1. package/README.md +99 -107
  2. package/components/header/header.styles.ts +103 -0
  3. package/components/header/header.ts +117 -194
  4. package/components/icons.ts +1 -1
  5. package/components/index.ts +68 -62
  6. package/components/logo/logo.styles.ts +8 -0
  7. package/components/logo/logo.ts +37 -0
  8. package/components/react/Header.ts +16 -0
  9. package/components/react/Logo.ts +15 -0
  10. package/components/react/Toolbar.ts +24 -0
  11. package/components/react/Tracking.ts +17 -0
  12. package/components/react/index.ts +63 -0
  13. package/components/toolbar/toolbar.styles.ts +6 -0
  14. package/components/toolbar/toolbar.ts +100 -57
  15. package/components/tracking/tracking.styles.ts +23 -0
  16. package/components/tracking/tracking.ts +89 -85
  17. package/dist/components/header/header.d.ts +28 -0
  18. package/dist/components/header/header.styles.d.ts +6 -0
  19. package/dist/components/index.d.ts +130 -0
  20. package/dist/components/logo/logo.d.ts +10 -0
  21. package/dist/components/logo/logo.styles.d.ts +2 -0
  22. package/dist/components/react/Tracking.d.ts +2 -0
  23. package/dist/components/react/index.d.ts +62 -0
  24. package/dist/components/toolbar/toolbar.d.ts +20 -0
  25. package/dist/components/toolbar/toolbar.styles.d.ts +2 -0
  26. package/{components → dist/components}/tracking/tracking.d.ts +8 -9
  27. package/dist/components/tracking/tracking.styles.d.ts +2 -0
  28. package/dist/{components.js → hotosm-ui.js} +3707 -3671
  29. package/dist/style.css +1 -1
  30. package/package.json +35 -33
  31. package/theme/hot-sl.css +180 -0
  32. package/theme/hot.css +177 -121
  33. package/theme/logo/hot-logo-icon.svg +1 -0
  34. package/theme/logo/hot-logo-png.png +0 -0
  35. package/theme/logo/hot-logo-text.svg +1 -0
  36. package/components/header/header.d.ts +0 -30
  37. package/components/header/header.js +0 -237
  38. package/components/icons.js +0 -78
  39. package/components/index.d.ts +0 -127
  40. package/components/index.js +0 -127
  41. package/components/toolbar/toolbar.d.ts +0 -24
  42. package/components/toolbar/toolbar.js +0 -121
  43. package/components/tracking/tracking.js +0 -164
  44. package/react/Header.js +0 -14
  45. package/react/Toolbar.js +0 -21
  46. package/react/Tracking.js +0 -15
  47. package/react/index.d.ts +0 -3
  48. package/react/index.js +0 -5
  49. package/theme/logo.png +0 -0
  50. package/theme/sl-custom.css +0 -74
  51. /package/{components → dist/components}/icons.d.ts +0 -0
  52. /package/{react → dist/components/react}/Header.d.ts +0 -0
  53. /package/{react/Toolbar.d.ts → dist/components/react/Logo.d.ts} +0 -0
  54. /package/{react/Tracking.d.ts → dist/components/react/Toolbar.d.ts} +0 -0
@@ -1,78 +0,0 @@
1
- //
2
- // Bundled icons hardcoded into hotosm/ui.
3
- // They are a subset of used Shoelace icons (which use Bootstrap icons)
4
- //
5
- import { registerIconLibrary } from '@shoelace-style/shoelace/dist/utilities/icon-library.js';
6
- const icons = {
7
- list: `
8
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16">
9
- <path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/>
10
- </svg>
11
- `,
12
- 'info-circle': `
13
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
14
- <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
15
- <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
16
- </svg>
17
- `,
18
- 'arrow-counterclockwise': `
19
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
20
- <path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z"/>
21
- <path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z"/>
22
- </svg>
23
- `,
24
- 'arrow-clockwise': `
25
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
26
- <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>
27
- <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>
28
- </svg>
29
- `,
30
- 'type-bold': `
31
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-type-bold" viewBox="0 0 16 16">
32
- <path d="M8.21 13c2.106 0 3.412-1.087 3.412-2.823 0-1.306-.984-2.283-2.324-2.386v-.055a2.176 2.176 0 0 0 1.852-2.14c0-1.51-1.162-2.46-3.014-2.46H3.843V13H8.21zM5.908 4.674h1.696c.963 0 1.517.451 1.517 1.244 0 .834-.629 1.32-1.73 1.32H5.908V4.673zm0 6.788V8.598h1.73c1.217 0 1.88.492 1.88 1.415 0 .943-.643 1.449-1.832 1.449H5.907z"/>
33
- </svg>
34
- `,
35
- 'type-italic': `
36
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-type-italic" viewBox="0 0 16 16">
37
- <path d="M7.991 11.674 9.53 4.455c.123-.595.246-.71 1.347-.807l.11-.52H7.211l-.11.52c1.06.096 1.128.212 1.005.807L6.57 11.674c-.123.595-.246.71-1.346.806l-.11.52h3.774l.11-.52c-1.06-.095-1.129-.211-1.006-.806z"/>
38
- </svg>
39
- `,
40
- 'type-underline': `
41
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-type-underline" viewBox="0 0 16 16">
42
- <path d="M5.313 3.136h-1.23V9.54c0 2.105 1.47 3.623 3.917 3.623s3.917-1.518 3.917-3.623V3.136h-1.23v6.323c0 1.49-.978 2.57-2.687 2.57-1.709 0-2.687-1.08-2.687-2.57V3.136zM12.5 15h-9v-1h9v1z"/>
43
- </svg>
44
- `,
45
- 'justify-left': `
46
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-justify-left" viewBox="0 0 16 16">
47
- <path fill-rule="evenodd" d="M2 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>
48
- </svg>
49
- `,
50
- justify: `
51
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-justify" viewBox="0 0 16 16">
52
- <path fill-rule="evenodd" d="M2 12.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>
53
- </svg>
54
- `,
55
- 'justify-right': `
56
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-justify-right" viewBox="0 0 16 16">
57
- <path fill-rule="evenodd" d="M6 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-4-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>
58
- </svg>
59
- `,
60
- 'person-circle': `
61
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
62
- <path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
63
- <path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
64
- </svg>
65
- `
66
- };
67
- const libraryResolver = (name) => {
68
- if (name in icons) {
69
- return `data:image/svg+xml,${encodeURIComponent(icons[name])}`;
70
- }
71
- return '';
72
- };
73
- function registerBundledIcons() {
74
- registerIconLibrary('bundled', {
75
- resolver: libraryResolver,
76
- });
77
- }
78
- export default registerBundledIcons;
@@ -1,127 +0,0 @@
1
- import SlAlert from '@shoelace-style/shoelace/dist/components/alert/alert.component.js';
2
- import SlAnimatedImage from '@shoelace-style/shoelace/dist/components/animated-image/animated-image.component.js';
3
- import SlAnimation from '@shoelace-style/shoelace/dist/components/animation/animation.component.js';
4
- import SlAvatar from '@shoelace-style/shoelace/dist/components/avatar/avatar.component.js';
5
- import SlBadge from '@shoelace-style/shoelace/dist/components/badge/badge.component.js';
6
- import SlBreadcrumb from '@shoelace-style/shoelace/dist/components/breadcrumb/breadcrumb.component.js';
7
- import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/components/breadcrumb-item/breadcrumb-item.component.js';
8
- import SlButton from '@shoelace-style/shoelace/dist/components/button/button.component.js';
9
- import SlButtonGroup from '@shoelace-style/shoelace/dist/components/button-group/button-group.component.js';
10
- import SlCard from '@shoelace-style/shoelace/dist/components/card/card.component.js';
11
- import SlCarousel from '@shoelace-style/shoelace/dist/components/carousel/carousel.component.js';
12
- import SlCarouselItem from '@shoelace-style/shoelace/dist/components/carousel-item/carousel-item.component.js';
13
- import SlCheckbox from '@shoelace-style/shoelace/dist/components/checkbox/checkbox.component.js';
14
- import SlColorPicker from '@shoelace-style/shoelace/dist/components/color-picker/color-picker.component.js';
15
- import SlCopyButton from '@shoelace-style/shoelace/dist/components/copy-button/copy-button.component.js';
16
- import SlDetails from '@shoelace-style/shoelace/dist/components/details/details.component.js';
17
- import SlDialog from '@shoelace-style/shoelace/dist/components/dialog/dialog.component.js';
18
- import SlDivider from '@shoelace-style/shoelace/dist/components/divider/divider.component.js';
19
- import SlDrawer from '@shoelace-style/shoelace/dist/components/drawer/drawer.component.js';
20
- import SlDropdown from '@shoelace-style/shoelace/dist/components/dropdown/dropdown.component.js';
21
- import SlFormatBytes from '@shoelace-style/shoelace/dist/components/format-bytes/format-bytes.component.js';
22
- import SlFormatDate from '@shoelace-style/shoelace/dist/components/format-date/format-date.component.js';
23
- import SlFormatNumber from '@shoelace-style/shoelace/dist/components/format-number/format-number.component.js';
24
- import SlIcon from '@shoelace-style/shoelace/dist/components/icon/icon.component.js';
25
- import SlIconButton from '@shoelace-style/shoelace/dist/components/icon-button/icon-button.component.js';
26
- import SlImageComparer from '@shoelace-style/shoelace/dist/components/image-comparer/image-comparer.component.js';
27
- import SlInclude from '@shoelace-style/shoelace/dist/components/include/include.component.js';
28
- import SlInput from '@shoelace-style/shoelace/dist/components/input/input.component.js';
29
- import SlMenu from '@shoelace-style/shoelace/dist/components/menu/menu.component.js';
30
- import SlMenuItem from '@shoelace-style/shoelace/dist/components/menu-item/menu-item.component.js';
31
- import SlMenuLabel from '@shoelace-style/shoelace/dist/components/menu-label/menu-label.component.js';
32
- import SlMutationObserver from '@shoelace-style/shoelace/dist/components/mutation-observer/mutation-observer.component.js';
33
- import SlOption from '@shoelace-style/shoelace/dist/components/option/option.component.js';
34
- import SlPopup from '@shoelace-style/shoelace/dist/components/popup/popup.component.js';
35
- import SlProgressBar from '@shoelace-style/shoelace/dist/components/progress-bar/progress-bar.component.js';
36
- import SlProgressRing from '@shoelace-style/shoelace/dist/components/progress-ring/progress-ring.component.js';
37
- import SlQRCode from '@shoelace-style/shoelace/dist/components/qr-code/qr-code.component.js';
38
- import SlRadio from '@shoelace-style/shoelace/dist/components/radio/radio.component.js';
39
- import SlRadioButton from '@shoelace-style/shoelace/dist/components/radio-button/radio-button.component.js';
40
- import SlRadioGroup from '@shoelace-style/shoelace/dist/components/radio-group/radio-group.component.js';
41
- import SlRange from '@shoelace-style/shoelace/dist/components/range/range.component.js';
42
- import SlRating from '@shoelace-style/shoelace/dist/components/rating/rating.component.js';
43
- import SlRelativeTime from '@shoelace-style/shoelace/dist/components/relative-time/relative-time.component.js';
44
- import SlResizeObserver from '@shoelace-style/shoelace/dist/components/resize-observer/resize-observer.component.js';
45
- import SlSelect from '@shoelace-style/shoelace/dist/components/select/select.component.js';
46
- import SlSkeleton from '@shoelace-style/shoelace/dist/components/skeleton/skeleton.component.js';
47
- import SlSpinner from '@shoelace-style/shoelace/dist/components/spinner/spinner.component.js';
48
- import SlSplitPanel from '@shoelace-style/shoelace/dist/components/split-panel/split-panel.component.js';
49
- import SlSwitch from '@shoelace-style/shoelace/dist/components/switch/switch.component.js';
50
- import SlTab from '@shoelace-style/shoelace/dist/components/tab/tab.component.js';
51
- import SlTabGroup from '@shoelace-style/shoelace/dist/components/tab-group/tab-group.component.js';
52
- import SlTabPanel from '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.component.js';
53
- import SlTag from '@shoelace-style/shoelace/dist/components/tag/tag.component.js';
54
- import SlTextarea from '@shoelace-style/shoelace/dist/components/textarea/textarea.component.js';
55
- import SlTooltip from '@shoelace-style/shoelace/dist/components/tooltip/tooltip.component.js';
56
- import SlTree from '@shoelace-style/shoelace/dist/components/tree/tree.component.js';
57
- import SlTreeItem from '@shoelace-style/shoelace/dist/components/tree-item/tree-item.component.js';
58
- import SlVisuallyHidden from '@shoelace-style/shoelace/dist/components/visually-hidden/visually-hidden.component.js';
59
- import HotHeader from './header/header';
60
- import HotToolbar from './toolbar/toolbar';
61
- import HotTracking from './tracking/tracking';
62
- declare global {
63
- interface HTMLElementTagNameMap {
64
- 'hot-alert': SlAlert;
65
- 'hot-animated-image': SlAnimatedImage;
66
- 'hot-animation': SlAnimation;
67
- 'hot-avatar': SlAvatar;
68
- 'hot-badge': SlBadge;
69
- 'hot-breadcrumb': SlBreadcrumb;
70
- 'hot-breadcrumb-item': SlBreadcrumbItem;
71
- 'hot-button': SlButton;
72
- 'hot-button-group': SlButtonGroup;
73
- 'hot-card': SlCard;
74
- 'hot-carousel': SlCarousel;
75
- 'hot-carousel-item': SlCarouselItem;
76
- 'hot-checkbox': SlCheckbox;
77
- 'hot-color-picker': SlColorPicker;
78
- 'hot-copy-button': SlCopyButton;
79
- 'hot-details': SlDetails;
80
- 'hot-dialog': SlDialog;
81
- 'hot-divider': SlDivider;
82
- 'hot-drawer': SlDrawer;
83
- 'hot-dropdown': SlDropdown;
84
- 'hot-format-bytes': SlFormatBytes;
85
- 'hot-format-date': SlFormatDate;
86
- 'hot-format-number': SlFormatNumber;
87
- 'hot-icon': SlIcon;
88
- 'hot-icon-button': SlIconButton;
89
- 'hot-image-comparer': SlImageComparer;
90
- 'hot-include': SlInclude;
91
- 'hot-input': SlInput;
92
- 'hot-menu': SlMenu;
93
- 'hot-menu-item': SlMenuItem;
94
- 'hot-menu-label': SlMenuLabel;
95
- 'hot-mutation-observer': SlMutationObserver;
96
- 'hot-option': SlOption;
97
- 'hot-popup': SlPopup;
98
- 'hot-progress-bar': SlProgressBar;
99
- 'hot-progress-ring': SlProgressRing;
100
- 'hot-qrcode': SlQRCode;
101
- 'hot-radio': SlRadio;
102
- 'hot-radio-button': SlRadioButton;
103
- 'hot-radio-group': SlRadioGroup;
104
- 'hot-range': SlRange;
105
- 'hot-rating': SlRating;
106
- 'hot-relative-time': SlRelativeTime;
107
- 'hot-resize-observer': SlResizeObserver;
108
- 'hot-select': SlSelect;
109
- 'hot-skeleton': SlSkeleton;
110
- 'hot-spinner': SlSpinner;
111
- 'hot-split-panel': SlSplitPanel;
112
- 'hot-switch': SlSwitch;
113
- 'hot-tab': SlTab;
114
- 'hot-tab-group': SlTabGroup;
115
- 'hot-tab-panel': SlTabPanel;
116
- 'hot-tag': SlTag;
117
- 'hot-textarea': SlTextarea;
118
- 'hot-tooltip': SlTooltip;
119
- 'hot-tree': SlTree;
120
- 'hot-tree-item': SlTreeItem;
121
- 'hot-visually-hidden': SlVisuallyHidden;
122
- 'hot-header': HotHeader;
123
- 'hot-toolbar': HotToolbar;
124
- 'hot-tracking': HotTracking;
125
- }
126
- }
127
- export { SlAlert, SlAnimatedImage, SlAnimation, SlAvatar, SlBadge, SlBreadcrumb, SlBreadcrumbItem, SlButton, SlButtonGroup, SlCard, SlCarousel, SlCarouselItem, SlCheckbox, SlColorPicker, SlCopyButton, SlDetails, SlDialog, SlDivider, SlDrawer, SlDropdown, SlFormatBytes, SlFormatDate, SlFormatNumber, SlIcon, SlIconButton, SlImageComparer, SlInclude, SlInput, SlMenu, SlMenuItem, SlMenuLabel, SlMutationObserver, SlOption, SlPopup, SlProgressBar, SlProgressRing, SlQRCode, SlRadio, SlRadioButton, SlRadioGroup, SlRange, SlRating, SlRelativeTime, SlResizeObserver, SlSelect, SlSkeleton, SlSpinner, SlSplitPanel, SlSwitch, SlTab, SlTabGroup, SlTabPanel, SlTag, SlTextarea, SlTooltip, SlTree, SlTreeItem, SlVisuallyHidden, HotHeader, HotToolbar, HotTracking, };
@@ -1,127 +0,0 @@
1
- // Index to import all components together
2
- // import '@hotosm/ui/components';
3
- // Default Shoelace exports
4
- import SlAlert from '@shoelace-style/shoelace/dist/components/alert/alert.component.js';
5
- import SlAnimatedImage from '@shoelace-style/shoelace/dist/components/animated-image/animated-image.component.js';
6
- import SlAnimation from '@shoelace-style/shoelace/dist/components/animation/animation.component.js';
7
- import SlAvatar from '@shoelace-style/shoelace/dist/components/avatar/avatar.component.js';
8
- import SlBadge from '@shoelace-style/shoelace/dist/components/badge/badge.component.js';
9
- import SlBreadcrumb from '@shoelace-style/shoelace/dist/components/breadcrumb/breadcrumb.component.js';
10
- import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/components/breadcrumb-item/breadcrumb-item.component.js';
11
- import SlButton from '@shoelace-style/shoelace/dist/components/button/button.component.js';
12
- import SlButtonGroup from '@shoelace-style/shoelace/dist/components/button-group/button-group.component.js';
13
- import SlCard from '@shoelace-style/shoelace/dist/components/card/card.component.js';
14
- import SlCarousel from '@shoelace-style/shoelace/dist/components/carousel/carousel.component.js';
15
- import SlCarouselItem from '@shoelace-style/shoelace/dist/components/carousel-item/carousel-item.component.js';
16
- import SlCheckbox from '@shoelace-style/shoelace/dist/components/checkbox/checkbox.component.js';
17
- import SlColorPicker from '@shoelace-style/shoelace/dist/components/color-picker/color-picker.component.js';
18
- import SlCopyButton from '@shoelace-style/shoelace/dist/components/copy-button/copy-button.component.js';
19
- import SlDetails from '@shoelace-style/shoelace/dist/components/details/details.component.js';
20
- import SlDialog from '@shoelace-style/shoelace/dist/components/dialog/dialog.component.js';
21
- import SlDivider from '@shoelace-style/shoelace/dist/components/divider/divider.component.js';
22
- import SlDrawer from '@shoelace-style/shoelace/dist/components/drawer/drawer.component.js';
23
- import SlDropdown from '@shoelace-style/shoelace/dist/components/dropdown/dropdown.component.js';
24
- import SlFormatBytes from '@shoelace-style/shoelace/dist/components/format-bytes/format-bytes.component.js';
25
- import SlFormatDate from '@shoelace-style/shoelace/dist/components/format-date/format-date.component.js';
26
- import SlFormatNumber from '@shoelace-style/shoelace/dist/components/format-number/format-number.component.js';
27
- import SlIcon from '@shoelace-style/shoelace/dist/components/icon/icon.component.js';
28
- import SlIconButton from '@shoelace-style/shoelace/dist/components/icon-button/icon-button.component.js';
29
- import SlImageComparer from '@shoelace-style/shoelace/dist/components/image-comparer/image-comparer.component.js';
30
- import SlInclude from '@shoelace-style/shoelace/dist/components/include/include.component.js';
31
- import SlInput from '@shoelace-style/shoelace/dist/components/input/input.component.js';
32
- import SlMenu from '@shoelace-style/shoelace/dist/components/menu/menu.component.js';
33
- import SlMenuItem from '@shoelace-style/shoelace/dist/components/menu-item/menu-item.component.js';
34
- import SlMenuLabel from '@shoelace-style/shoelace/dist/components/menu-label/menu-label.component.js';
35
- import SlMutationObserver from '@shoelace-style/shoelace/dist/components/mutation-observer/mutation-observer.component.js';
36
- import SlOption from '@shoelace-style/shoelace/dist/components/option/option.component.js';
37
- import SlPopup from '@shoelace-style/shoelace/dist/components/popup/popup.component.js';
38
- import SlProgressBar from '@shoelace-style/shoelace/dist/components/progress-bar/progress-bar.component.js';
39
- import SlProgressRing from '@shoelace-style/shoelace/dist/components/progress-ring/progress-ring.component.js';
40
- import SlQRCode from '@shoelace-style/shoelace/dist/components/qr-code/qr-code.component.js';
41
- import SlRadio from '@shoelace-style/shoelace/dist/components/radio/radio.component.js';
42
- import SlRadioButton from '@shoelace-style/shoelace/dist/components/radio-button/radio-button.component.js';
43
- import SlRadioGroup from '@shoelace-style/shoelace/dist/components/radio-group/radio-group.component.js';
44
- import SlRange from '@shoelace-style/shoelace/dist/components/range/range.component.js';
45
- import SlRating from '@shoelace-style/shoelace/dist/components/rating/rating.component.js';
46
- import SlRelativeTime from '@shoelace-style/shoelace/dist/components/relative-time/relative-time.component.js';
47
- import SlResizeObserver from '@shoelace-style/shoelace/dist/components/resize-observer/resize-observer.component.js';
48
- import SlSelect from '@shoelace-style/shoelace/dist/components/select/select.component.js';
49
- import SlSkeleton from '@shoelace-style/shoelace/dist/components/skeleton/skeleton.component.js';
50
- import SlSpinner from '@shoelace-style/shoelace/dist/components/spinner/spinner.component.js';
51
- import SlSplitPanel from '@shoelace-style/shoelace/dist/components/split-panel/split-panel.component.js';
52
- import SlSwitch from '@shoelace-style/shoelace/dist/components/switch/switch.component.js';
53
- import SlTab from '@shoelace-style/shoelace/dist/components/tab/tab.component.js';
54
- import SlTabGroup from '@shoelace-style/shoelace/dist/components/tab-group/tab-group.component.js';
55
- import SlTabPanel from '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.component.js';
56
- import SlTag from '@shoelace-style/shoelace/dist/components/tag/tag.component.js';
57
- import SlTextarea from '@shoelace-style/shoelace/dist/components/textarea/textarea.component.js';
58
- import SlTooltip from '@shoelace-style/shoelace/dist/components/tooltip/tooltip.component.js';
59
- import SlTree from '@shoelace-style/shoelace/dist/components/tree/tree.component.js';
60
- import SlTreeItem from '@shoelace-style/shoelace/dist/components/tree-item/tree-item.component.js';
61
- import SlVisuallyHidden from '@shoelace-style/shoelace/dist/components/visually-hidden/visually-hidden.component.js';
62
- // Custom composite components
63
- import HotHeader from './header/header';
64
- import HotToolbar from './toolbar/toolbar';
65
- import HotTracking from './tracking/tracking';
66
- // Define web component names for Shoelace components
67
- SlAlert.define('hot-alert');
68
- SlAnimatedImage.define('hot-animated-image');
69
- SlAnimation.define('hot-animation');
70
- SlAvatar.define('hot-avatar');
71
- SlBadge.define('hot-badge');
72
- SlBreadcrumb.define('hot-breadcrumb');
73
- SlBreadcrumbItem.define('hot-breadcrumb-item');
74
- SlButton.define('hot-button');
75
- SlButtonGroup.define('hot-button-group');
76
- SlCard.define('hot-card');
77
- SlCarousel.define('hot-carousel');
78
- SlCarouselItem.define('hot-carousel-item');
79
- SlCheckbox.define('hot-checkbox');
80
- SlColorPicker.define('hot-color-picker');
81
- SlCopyButton.define('hot-copy-button');
82
- SlDetails.define('hot-details');
83
- SlDialog.define('hot-dialog');
84
- SlDivider.define('hot-divider');
85
- SlDrawer.define('hot-drawer');
86
- SlDropdown.define('hot-dropdown');
87
- SlFormatBytes.define('hot-format-bytes');
88
- SlFormatDate.define('hot-format-date');
89
- SlFormatNumber.define('hot-format-number');
90
- SlIcon.define('hot-icon');
91
- SlIconButton.define('hot-icon-button');
92
- SlImageComparer.define('hot-image-comparer');
93
- SlInclude.define('hot-include');
94
- SlInput.define('hot-input');
95
- SlMenu.define('hot-menu');
96
- SlMenuItem.define('hot-menu-item');
97
- SlMenuLabel.define('hot-menu-label');
98
- SlMutationObserver.define('hot-mutation-observer');
99
- SlOption.define('hot-option');
100
- SlPopup.define('hot-popup');
101
- SlProgressBar.define('hot-progress-bar');
102
- SlProgressRing.define('hot-progress-ring');
103
- SlQRCode.define('hot-qr-code');
104
- SlRadio.define('hot-radio');
105
- SlRadioButton.define('hot-radio-button');
106
- SlRadioGroup.define('hot-radio-group');
107
- SlRange.define('hot-range');
108
- SlRating.define('hot-rating');
109
- SlRelativeTime.define('hot-relative-time');
110
- SlResizeObserver.define('hot-resize-observer');
111
- SlSelect.define('hot-select');
112
- SlSkeleton.define('hot-skeleton');
113
- SlSpinner.define('hot-spinner');
114
- SlSplitPanel.define('hot-split-panel');
115
- SlSwitch.define('hot-switch');
116
- SlTab.define('hot-tab');
117
- SlTabGroup.define('hot-tab-group');
118
- SlTabPanel.define('hot-tab-panel');
119
- SlTag.define('hot-tag');
120
- SlTextarea.define('hot-textarea');
121
- SlTooltip.define('hot-tooltip');
122
- SlTree.define('hot-tree');
123
- SlTreeItem.define('hot-tree-item');
124
- SlVisuallyHidden.define('hot-visually-hidden');
125
- export { SlAlert, SlAnimatedImage, SlAnimation, SlAvatar, SlBadge, SlBreadcrumb, SlBreadcrumbItem, SlButton, SlButtonGroup, SlCard, SlCarousel, SlCarouselItem, SlCheckbox, SlColorPicker, SlCopyButton, SlDetails, SlDialog, SlDivider, SlDrawer, SlDropdown, SlFormatBytes, SlFormatDate, SlFormatNumber, SlIcon, SlIconButton, SlImageComparer, SlInclude, SlInput, SlMenu, SlMenuItem, SlMenuLabel, SlMutationObserver, SlOption, SlPopup, SlProgressBar, SlProgressRing, SlQRCode, SlRadio, SlRadioButton, SlRadioGroup, SlRange, SlRating, SlRelativeTime, SlResizeObserver, SlSelect, SlSkeleton, SlSpinner, SlSplitPanel, SlSwitch, SlTab, SlTabGroup, SlTabPanel, SlTag, SlTextarea, SlTooltip, SlTree, SlTreeItem, SlVisuallyHidden,
126
- // Custom composite components
127
- HotHeader, HotToolbar, HotTracking, };
@@ -1,24 +0,0 @@
1
- import "../../theme/sl-custom.css";
2
- import '@shoelace-style/shoelace/dist/components/button/button.js';
3
- import '@shoelace-style/shoelace/dist/components/button-group/button-group.js';
4
- import '@shoelace-style/shoelace/dist/components/icon/icon.js';
5
- import '@shoelace-style/shoelace/dist/components/tooltip/tooltip.js';
6
- import { LitElement } from "lit";
7
- export declare class Toolbar extends LitElement {
8
- name: string;
9
- /** Change the position of the tooltips relative to buttons. */
10
- tooltipPosition: string;
11
- static styles: import("lit").CSSResult[];
12
- protected render(): import("lit").TemplateResult<1>;
13
- private renderButtonGroup;
14
- private renderButton;
15
- private readonly undo;
16
- private readonly redo;
17
- private readonly bold;
18
- private readonly italic;
19
- private readonly underline;
20
- private readonly alignLeft;
21
- private readonly alignCenter;
22
- private readonly alignRight;
23
- }
24
- export default Toolbar;
@@ -1,121 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import "../../theme/sl-custom.css";
8
- import '@shoelace-style/shoelace/dist/components/button/button.js';
9
- import '@shoelace-style/shoelace/dist/components/button-group/button-group.js';
10
- import '@shoelace-style/shoelace/dist/components/icon/icon.js';
11
- import '@shoelace-style/shoelace/dist/components/tooltip/tooltip.js';
12
- import { LitElement, css, html } from "lit";
13
- import { property } from "lit/decorators.js";
14
- import registerBundledIcons from '../../components/icons';
15
- registerBundledIcons();
16
- // import { cva } from "class-variance-authority";
17
- // const toolbarStyle = cva(
18
- // "some-css-var",
19
- // {
20
- // variants: {
21
- // someProperty: {
22
- // true: "some-css-var",
23
- // false: "some-css-var",
24
- // },
25
- // },
26
- // },
27
- // );
28
- export class Toolbar extends LitElement {
29
- constructor() {
30
- super(...arguments);
31
- this.name = "hot-toolbar";
32
- /** Change the position of the tooltips relative to buttons. */
33
- this.tooltipPosition = "top";
34
- this.undo = (e) => {
35
- // As the original event is also named 'click'
36
- // stop propagation of the original event
37
- e.stopPropagation();
38
- this.dispatchEvent(new Event("undo"));
39
- };
40
- this.redo = (e) => {
41
- e.stopPropagation();
42
- this.dispatchEvent(new Event("redo"));
43
- };
44
- this.bold = (e) => {
45
- e.stopPropagation();
46
- this.dispatchEvent(new Event("bold"));
47
- };
48
- this.italic = (e) => {
49
- e.stopPropagation();
50
- this.dispatchEvent(new Event("italic"));
51
- };
52
- this.underline = (e) => {
53
- e.stopPropagation();
54
- this.dispatchEvent(new Event("underline"));
55
- };
56
- this.alignLeft = (e) => {
57
- e.stopPropagation();
58
- this.dispatchEvent(new Event("leftalign"));
59
- };
60
- this.alignCenter = (e) => {
61
- e.stopPropagation();
62
- this.dispatchEvent(new Event("centeralign"));
63
- };
64
- this.alignRight = (e) => {
65
- e.stopPropagation();
66
- this.dispatchEvent(new Event("rightalign"));
67
- };
68
- }
69
- // class=${toolbarStyle({
70
- // someProperty: this.someProperty,
71
- // })}
72
- render() {
73
- return html `
74
- <div class="button-group-toolbar">
75
- ${this.renderButtonGroup('History', [
76
- { content: 'Undo', icon: 'arrow-counterclockwise', label: 'Undo', action: this.undo },
77
- { content: 'Redo', icon: 'arrow-clockwise', label: 'Redo', action: this.redo }
78
- ])}
79
- ${this.renderButtonGroup('Formatting', [
80
- { content: 'Bold', icon: 'type-bold', label: 'Bold', action: this.bold },
81
- { content: 'Italic', icon: 'type-italic', label: 'Italic', action: this.italic },
82
- { content: 'Underline', icon: 'type-underline', label: 'Underline', action: this.underline }
83
- ])}
84
- ${this.renderButtonGroup('Alignment', [
85
- { content: 'Align Left', icon: 'justify-left', label: 'Align Left', action: this.alignLeft },
86
- { content: 'Align Center', icon: 'justify', label: 'Align Center', action: this.alignCenter },
87
- { content: 'Align Right', icon: 'justify-right', label: 'Align Right', action: this.alignRight }
88
- ])}
89
- </div>
90
- `;
91
- }
92
- renderButtonGroup(label, buttons) {
93
- return html `
94
- <sl-button-group label=${label}>
95
- ${buttons.map(button => this.renderButton(button))}
96
- </sl-button-group>
97
- `;
98
- }
99
- renderButton({ content, icon, label, action }) {
100
- return html `
101
- <sl-tooltip content=${content} placement="${this.tooltipPosition}">
102
- <sl-button @click=${action ?? (() => { })}><sl-icon library="bundled" name=${icon} label=${label}></sl-icon></sl-button>
103
- </sl-tooltip>
104
- `;
105
- }
106
- }
107
- Toolbar.styles = [
108
- css `
109
- @unocss-placeholder;
110
- `,
111
- // unsafeCSS(reset),
112
- ];
113
- __decorate([
114
- property()
115
- ], Toolbar.prototype, "name", void 0);
116
- __decorate([
117
- property({ type: String, attribute: "tooltip-position" })
118
- ], Toolbar.prototype, "tooltipPosition", void 0);
119
- export default Toolbar;
120
- // Define web component
121
- customElements.define("hot-toolbar", Toolbar);
@@ -1,164 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import "../../theme/sl-custom.css";
8
- import '@shoelace-style/shoelace/dist/components/alert/alert.js';
9
- import { LitElement, css, html } from "lit";
10
- import { property, state } from "lit/decorators.js";
11
- import registerBundledIcons from '../../components/icons';
12
- registerBundledIcons();
13
- export class Tracking extends LitElement {
14
- constructor() {
15
- super(...arguments);
16
- this.name = "hot-tracking";
17
- /** The Matomo site id for tracking. */
18
- this.siteId = "";
19
- /** The domains to apply tracking. */
20
- this.domain = "";
21
- /** Force display the banner. */
22
- this.force = false;
23
- this.isOpen = true;
24
- }
25
- render() {
26
- return html `<sl-alert
27
- variant="danger"
28
- ?open=${this.isOpen}
29
- >
30
- <sl-icon id="hot-red-text" library="bundled" slot="icon" name="info-circle"></sl-icon>
31
-
32
- <p id="tracking-header">
33
- About the information we collect
34
- </p>
35
-
36
- <p>
37
- We use cookies and similar technologies to recognize and analyze your visits,
38
- and measure traffic usage and activity. You can learn about how we use the data
39
- about your visit or information you provide reading our
40
- <a
41
- style="color: #d63f3f;"
42
- href="https://www.hotosm.org/privacy"
43
- target="_blank"
44
- rel="noopener noreferrer"
45
- >privacy policy</a>.
46
- By clicking "I Agree", you consent to the use of cookies.
47
- </p>
48
-
49
- <sl-button @click=${(e) => { this._setAgree(e); }}>I Agree</sl-button>
50
- <sl-button @click=${(e) => { this._setDisagree(e); }}>I Do Not Agree</sl-button>
51
- </sl-alert>`;
52
- }
53
- _setAgree(_e) {
54
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
55
- const _paq = (window._paq = window._paq || []);
56
- if (_paq.length === 0)
57
- return;
58
- _paq.push(['rememberConsentGiven']);
59
- this.isOpen = false;
60
- localStorage.setItem(`${this.siteId}-matomo-agree`, 'true');
61
- this.dispatchEvent(new Event('agree', { bubbles: true, composed: true }));
62
- }
63
- _setDisagree(_e) {
64
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
65
- const _paq = (window._paq = window._paq || []);
66
- if (_paq.length === 0)
67
- return;
68
- _paq.push(['forgetConsentGiven']);
69
- this.isOpen = false;
70
- localStorage.setItem(`${this.siteId}-matomo-agree`, 'false');
71
- this.dispatchEvent(new Event('disagree', { bubbles: true, composed: true }));
72
- }
73
- connectedCallback() {
74
- super.connectedCallback();
75
- // Close and halt execution if wrong domain
76
- if (!this.force && window.location.hostname !== this.domain) {
77
- console.warn(`Matomo init failed. ${window.location.hostname} does not match ${this.domain}.`);
78
- this.isOpen = false;
79
- return;
80
- }
81
- const matomoTrackingId = this.siteId;
82
- // Close and halt execution if siteId or domain not set
83
- if (!this.force && (matomoTrackingId.length === 0 || this.domain.length === 0)) {
84
- console.warn('Matomo init failed. No site id or domains provided.');
85
- this.isOpen = false;
86
- return;
87
- }
88
- // Close and halt execution if already disagreed
89
- const consent = localStorage.getItem(`${this.siteId}-matomo-agree`);
90
- if (consent === 'false') {
91
- this.isOpen = false;
92
- return;
93
- }
94
- // Close prompt only if already agreed, continue
95
- if (consent === 'true') {
96
- this.isOpen = false;
97
- }
98
- console.log(`Setting Matomo tracking for site=${matomoTrackingId} domain=${this.domain}`);
99
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
100
- const _paq = (window._paq = window._paq || []);
101
- // tracker methods like "setCustomDimension" should be called before "trackPageView"
102
- _paq.push(['requireConsent']);
103
- _paq.push(['setDomains', [this.domain]]);
104
- _paq.push(['trackPageView']);
105
- _paq.push(['enableLinkTracking']); // Tracks downloads
106
- _paq.push(['trackVisibleContentImpressions']); // Tracks content
107
- (function () {
108
- const u = '//matomo.hotosm.org/';
109
- _paq.push(['setTrackerUrl', u + 'matomo.php']);
110
- _paq.push(['setSiteId', matomoTrackingId]);
111
- const d = document;
112
- const g = d.createElement('script');
113
- const s = d.getElementsByTagName('script')[0];
114
- if (s?.parentNode != null) {
115
- g.async = true;
116
- g.src = u + 'matomo.js';
117
- s.parentNode.insertBefore(g, s);
118
- }
119
- else {
120
- console.warn('Script insertion failed. Parent node is null.');
121
- }
122
- })();
123
- }
124
- }
125
- Tracking.styles = [
126
- css `
127
- @unocss-placeholder;
128
- `,
129
- // Temp styles until UnoCSS setup
130
- css `
131
- #tracking-header {
132
- font-weight: var(--sl-font-weight-bold);
133
- font-size: var(--sl-font-size-large);
134
- text-align: center;
135
- }
136
- sl-alert::part(base) {
137
- position: absolute;
138
- bottom: 20px;
139
- left: 50%;
140
- transform: translateX(-50%);
141
- z-index: 1000;
142
- width: 80vw;
143
- text-align: center;
144
- }
145
- `
146
- ];
147
- __decorate([
148
- property()
149
- ], Tracking.prototype, "name", void 0);
150
- __decorate([
151
- property({ type: String, attribute: "site-id" })
152
- ], Tracking.prototype, "siteId", void 0);
153
- __decorate([
154
- property({ type: String })
155
- ], Tracking.prototype, "domain", void 0);
156
- __decorate([
157
- property({ type: Boolean })
158
- ], Tracking.prototype, "force", void 0);
159
- __decorate([
160
- state()
161
- ], Tracking.prototype, "isOpen", void 0);
162
- export default Tracking;
163
- // Define web component
164
- customElements.define("hot-tracking", Tracking);