@iamproperty/components 3.2.0 → 3.4.5

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 (96) hide show
  1. package/README.md +30 -66
  2. package/assets/css/core.min.css.map +1 -1
  3. package/assets/css/style.min.css.map +1 -1
  4. package/assets/js/main.js +9 -9
  5. package/assets/js/modules/accordion.js +1 -0
  6. package/assets/js/modules/alert.js +37 -53
  7. package/assets/js/modules/carousel.js +74 -100
  8. package/assets/js/modules/chart.js +142 -209
  9. package/assets/js/modules/drawer.js +9 -15
  10. package/assets/js/modules/file-upload.js +30 -45
  11. package/assets/js/modules/form.js +111 -157
  12. package/assets/js/modules/helpers.js +64 -93
  13. package/assets/js/modules/modal.js +67 -88
  14. package/assets/js/modules/nav.js +17 -27
  15. package/assets/js/modules/orderablelist.js +84 -115
  16. package/assets/js/modules/table.js +387 -521
  17. package/assets/js/modules/testimonial.js +61 -80
  18. package/assets/js/modules/youtubevideo.js +104 -135
  19. package/assets/js/scripts.bundle.js +870 -936
  20. package/assets/js/scripts.bundle.js.map +1 -1
  21. package/assets/js/scripts.bundle.min.js +3 -3
  22. package/assets/js/scripts.bundle.min.js.map +1 -1
  23. package/assets/sass/_corefiles.scss +9 -9
  24. package/assets/sass/_forms.scss +1 -1
  25. package/assets/sass/_tests/{sass.spec.js → colours.spec.js} +2 -2
  26. package/assets/sass/_tests/func.spec.js +9 -0
  27. package/assets/sass/_tests/mixins.spec.js +9 -0
  28. package/assets/sass/_tests/typography.spec.js +9 -0
  29. package/assets/ts/main.ts +9 -9
  30. package/assets/ts/modules/accordion.ts +1 -0
  31. package/assets/ts/modules/alert.ts +58 -0
  32. package/assets/ts/modules/carousel.ts +103 -0
  33. package/assets/ts/modules/chart.ts +219 -0
  34. package/assets/ts/modules/drawer.ts +17 -0
  35. package/assets/ts/modules/file-upload.ts +49 -0
  36. package/assets/ts/modules/form.ts +169 -0
  37. package/assets/ts/modules/helpers.ts +120 -0
  38. package/assets/ts/modules/modal.ts +91 -0
  39. package/assets/ts/modules/nav.ts +29 -0
  40. package/assets/ts/modules/orderablelist.ts +123 -0
  41. package/assets/ts/modules/table.ts +586 -0
  42. package/assets/ts/modules/testimonial.ts +84 -0
  43. package/assets/ts/modules/youtubevideo.ts +146 -0
  44. package/dist/components.es.js +671 -750
  45. package/dist/components.umd.js +13 -13
  46. package/dist/style.css +1 -1
  47. package/package.json +54 -38
  48. package/src/components/Accordion/Accordion.vue +1 -1
  49. package/src/components/Alert/Alert.vue +1 -1
  50. package/src/{elements → components}/Card/Card.vue +1 -1
  51. package/src/components/CardDeck/CardDeck.spec.js +1 -1
  52. package/src/components/CardDeck/CardDeck.vue +1 -1
  53. package/src/components/Carousel/Carousel.vue +2 -2
  54. package/src/components/Chart/Chart.vue +2 -2
  55. package/src/{elements → components}/FileUploads/FileUploads.vue +1 -1
  56. package/src/components/Modal/Modal.vue +1 -1
  57. package/src/components/Nav/Nav.vue +2 -2
  58. package/src/components/NoteFeed/NoteFeed.vue +2 -2
  59. package/src/components/PropertySearchbar/PropertySearchbar.vue +1 -1
  60. package/src/{elements → components}/Table/Table.vue +1 -1
  61. package/src/components/Testimonial/Testimonial.vue +1 -1
  62. package/src/foundations/YoutubeVideo/YoutubeVideo.vue +1 -1
  63. package/src/index.js +4 -5
  64. package/assets/.DS_Store +0 -0
  65. package/assets/css/email.min.css +0 -1
  66. package/assets/css/email.min.css.map +0 -1
  67. package/assets/css/error.min.css +0 -1
  68. package/assets/css/error.min.css.map +0 -1
  69. package/assets/sass/components/drawer.scss +0 -47
  70. package/assets/ts/main.js +0 -57
  71. package/assets/ts/main.js.map +0 -1
  72. package/assets/ts/modules/accordion.js +0 -33
  73. package/assets/ts/modules/accordion.js.map +0 -1
  74. package/src/.DS_Store +0 -0
  75. package/src/components/Accordion/Accordion.screenshot.vue +0 -57
  76. package/src/components/Accordion/__screenshots__/win32/laptop/Accordion.png +0 -0
  77. package/src/components/Accordion/__screenshots__/win32/mobile/Accordion.png +0 -0
  78. package/src/components/Accordion/__screenshots__/win32/tablet/Accordion.png +0 -0
  79. package/src/components/Drawer/Drawer.vue +0 -53
  80. package/src/components/Drawer/README.md +0 -23
  81. /package/assets/sass/{elements → components}/buttons.scss +0 -0
  82. /package/assets/sass/{elements → components}/card.scss +0 -0
  83. /package/assets/sass/{elements → components}/container.scss +0 -0
  84. /package/assets/sass/{elements → components}/forms.scss +0 -0
  85. /package/assets/sass/{elements → components}/links.scss +0 -0
  86. /package/assets/sass/{elements → components}/lists.scss +0 -0
  87. /package/assets/sass/{elements → components}/panel.scss +0 -0
  88. /package/assets/sass/{elements → components}/tables.scss +0 -0
  89. /package/assets/sass/{elements → components}/tooltips.scss +0 -0
  90. /package/assets/sass/{elements → foundations}/type.scss +0 -0
  91. /package/src/{elements → components}/Card/README.md +0 -0
  92. /package/src/{elements → components}/FileUploads/README.md +0 -0
  93. /package/src/{elements → components}/Input/Input.vue +0 -0
  94. /package/src/{elements → components}/Input/README.md +0 -0
  95. /package/src/{elements → components}/Table/README.md +0 -0
  96. /package/src/{elements → components}/Table/Table.spec.js +0 -0
@@ -0,0 +1,146 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
4
+ */
5
+ class youtubeVideo {
6
+
7
+ /** @param {Element} embed dom element */
8
+ constructor(embed){
9
+
10
+ let createEmbed = this.createEmbed;
11
+
12
+ // If the scripts is already loaded then lets just create the embed
13
+ if(document.body.classList.contains('youtubeLoaded')){
14
+ embed.addEventListener('click', function(e){
15
+
16
+ // loop parent nodes from the target to the delegation node
17
+ for (var target = e.target; target && target != this; target = target.parentNode) {
18
+
19
+ if (target.matches('a:not([data-modal-youtube]')) {
20
+
21
+ e.preventDefault();
22
+ createEmbed(embed,target);
23
+ break;
24
+ }
25
+ }
26
+ }, false);
27
+ }
28
+ else {
29
+ this.loadScripts(embed, this.createEmbed);
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Load the YouTube scripts before trying to create the embed
35
+ * @param {HTMLElement} embed dom element
36
+ * @param {Function} createEmbed function to create the embed after script loaded.
37
+ */
38
+ loadScripts(embed, createEmbed){
39
+
40
+ return new Promise((resolve, reject) => {
41
+
42
+ const image = new Image();
43
+ image.onload = function(){
44
+
45
+ // This code loads the IFrame Player API code asynchronously.
46
+ var tag = document.createElement('script');
47
+ tag.src = "https://www.youtube.com/iframe_api";
48
+ var firstScriptTag = document.getElementsByTagName('script')[0];
49
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
50
+ document.body.classList.add('youtubeLoaded');
51
+ resolve(true);
52
+
53
+ // script has loaded, you can now use it safely
54
+ tag.onload = () => {
55
+
56
+ embed.addEventListener('click', function(e){
57
+ // loop parent nodes from the target to the delegation node
58
+ for (var target = e.target; target && target != this; target = target.parentNode) {
59
+
60
+ if (target.matches('a:not([data-modal-youtube]')) {
61
+
62
+ e.preventDefault();
63
+ createEmbed(embed,target);
64
+ break;
65
+ }
66
+ }
67
+ }, false);
68
+ }
69
+
70
+ };
71
+ image.onerror = function(){
72
+ reject(false);
73
+ };
74
+ image.src = "https://youtube.com/favicon.ico";
75
+ });
76
+
77
+ }
78
+
79
+ /**
80
+ * Create the YouTube embed after the user has clicked on it.
81
+ * @param {HTMLElement} embed dom element
82
+ */
83
+ createEmbed(embed,target){
84
+
85
+ // If there is more than one video lets make sure there is only one playing at a time.
86
+ if(typeof window.player != "undefined" && typeof window.player.pauseVideo == "function")
87
+ window.player.pauseVideo();
88
+
89
+
90
+ var video_id = target.getAttribute('data-id');
91
+ var link_id = target.getAttribute('id')
92
+
93
+ // create an id to pass t the script if one isn't present
94
+ if(typeof link_id == 'undefined' || link_id == null){
95
+
96
+ var randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
97
+ link_id = randLetter + Date.now();
98
+ target.setAttribute('id',link_id);
99
+ }
100
+
101
+ // This function creates an <iframe> (and YouTube player) after the API code downloads.
102
+ function onYouTubeIframeAPIReady() {
103
+
104
+ window.player = new YT.Player(link_id, {
105
+ height: '100%',
106
+ width: '100%',
107
+ videoId: video_id,
108
+ playerVars: {
109
+ 'modestbranding': 1,
110
+ 'playsinline': 1,
111
+ 'rel': 0,
112
+ 'showinfo': 0
113
+ },
114
+ events: {
115
+ 'onReady': onPlayerReady,
116
+ 'onStateChange': onPlayerStateChange
117
+ }
118
+ });
119
+
120
+ }
121
+ onYouTubeIframeAPIReady();
122
+
123
+ // The API will call this function when the video player is ready.
124
+ function onPlayerReady(event) {
125
+ // Play the video straight away
126
+ event.target.playVideo();
127
+
128
+ }
129
+
130
+ // The API calls this function when the player's state changes.
131
+ // The function indicates that when playing a video (state=1)
132
+ var done = false;
133
+ function onPlayerStateChange(event) {
134
+
135
+ if (event.data == YT.PlayerState.PLAYING && !done) {
136
+
137
+ var link = document.getElementById(link_id);
138
+ link.classList.add('player-ready');
139
+
140
+ done = true;
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ export default youtubeVideo