@iamproperty/components 2.9.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +9 -130
  2. package/assets/css/core.min.css +1 -1
  3. package/assets/css/core.min.css.map +1 -1
  4. package/assets/css/style.min.css +1 -1
  5. package/assets/css/style.min.css.map +1 -1
  6. package/assets/favicons/manifest.json +32 -0
  7. package/assets/js/main.js +57 -0
  8. package/assets/js/modules/chart.js +18 -17
  9. package/assets/js/modules/nav.js +9 -8
  10. package/assets/js/modules/table.js +24 -24
  11. package/assets/js/scripts.bundle.js +20 -17
  12. package/assets/js/scripts.bundle.js.map +1 -1
  13. package/assets/js/scripts.bundle.min.js +1 -1
  14. package/assets/js/scripts.bundle.min.js.map +1 -1
  15. package/assets/sass/_functions/utilities.scss +3 -3
  16. package/assets/sass/_functions/variables.scss +3 -2
  17. package/assets/sass/_tests/colours.spec.scss +45 -0
  18. package/assets/sass/_tests/func.spec.scss +233 -0
  19. package/assets/sass/_tests/mixins.spec.scss +194 -0
  20. package/assets/sass/_tests/sass.spec.js +9 -0
  21. package/assets/sass/_tests/typography.spec.scss +36 -0
  22. package/assets/sass/components/alert.scss +1 -1
  23. package/assets/sass/components/cardDeck.scss +1 -1
  24. package/assets/sass/components/carousel.scss +4 -4
  25. package/assets/sass/components/charts.scss +1 -1
  26. package/assets/sass/components/nav.scss +5 -2
  27. package/assets/sass/components/stepper.scss +3 -3
  28. package/assets/sass/elements/panel.scss +3 -3
  29. package/assets/sass/elements/tooltips.scss +1 -1
  30. package/assets/sass/foundations/root.scss +4 -4
  31. package/assets/ts/main.js +57 -0
  32. package/assets/ts/main.js.map +1 -0
  33. package/assets/ts/main.ts +9 -9
  34. package/assets/ts/modules/accordion.js +33 -0
  35. package/assets/ts/modules/accordion.js.map +1 -0
  36. package/dist/components.es.js +2504 -0
  37. package/dist/components.umd.js +56 -3784
  38. package/dist/style.css +1 -0
  39. package/package.json +87 -87
  40. package/src/components/Accordion/Accordion.screenshot.vue +57 -0
  41. package/src/components/Accordion/Accordion.spec.js +63 -0
  42. package/src/components/Accordion/AccordionItem.vue +1 -1
  43. package/src/components/Accordion/__screenshots__/win32/laptop/Accordion.png +0 -0
  44. package/src/components/Accordion/__screenshots__/win32/mobile/Accordion.png +0 -0
  45. package/src/components/Accordion/__screenshots__/win32/tablet/Accordion.png +0 -0
  46. package/src/components/Alert/Alert.spec.js +49 -0
  47. package/src/components/Alert/Alert.vue +3 -3
  48. package/src/components/Banner/Banner.spec.js +28 -0
  49. package/src/components/CardDeck/CardDeck.spec.js +99 -0
  50. package/src/components/Carousel/Carousel.spec.js +45 -0
  51. package/src/components/Chart/Chart.spec.js +201 -0
  52. package/src/components/Chart/Chart.vue +3 -3
  53. package/src/components/Header/Header.spec.js +33 -0
  54. package/src/components/Modal/Modal.spec.js +22 -0
  55. package/src/components/Nav/Nav.spec.js +35 -0
  56. package/src/components/Nav/Nav.vue +5 -2
  57. package/src/components/Stepper/Stepper.spec.js +99 -0
  58. package/src/components/Tabs/Tab.vue +6 -0
  59. package/src/components/Tabs/Tabs.vue +15 -13
  60. package/src/components/Testimonial/Testimonial.spec.js +57 -0
  61. package/src/components/Timeline/Timeline.spec.js +17 -0
  62. package/src/elements/Table/Table.spec.js +90 -0
  63. package/src/elements/Table/Table.vue +8 -5
  64. package/src/foundations/Icon/Icon.spec.js +24 -0
  65. package/src/foundations/Logo/Logo.spec.js +56 -0
  66. package/src/vue-shim.d.ts +6 -0
  67. package/dist/components.common.js +0 -3773
  68. package/dist/components.common.js.map +0 -1
  69. package/dist/components.css +0 -2
  70. package/dist/components.css.map +0 -1
  71. package/dist/components.umd.js.map +0 -1
  72. package/dist/components.umd.min.js +0 -2
  73. package/dist/components.umd.min.js.map +0 -1
  74. package/dist/demo.html +0 -1
@@ -0,0 +1,57 @@
1
+ import { shallowMount } from '@vue/test-utils'
2
+ import Header from './Testimonial.vue'
3
+
4
+ describe('Testimonial component', () => {
5
+
6
+ const test = shallowMount(Header, {
7
+ propsData: {
8
+ items: [
9
+ {
10
+ cite: 'Name goes here',
11
+ quote: `<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>`,
12
+ image: '/img/src/img.png'
13
+ },
14
+ {
15
+ cite: 'Name goes here 2',
16
+ quote: `<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</p>`,
17
+ image: '/img/src/img.png'
18
+ },
19
+ {
20
+ cite: 'Name goes here 3',
21
+ quote: `<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</p><p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.</p>`,
22
+ class: 'largest',
23
+ image: '/img/src/img.png'
24
+ }
25
+ ]
26
+ },
27
+ slots: {
28
+ default: '<p>Hello</p>'
29
+ }
30
+ })
31
+
32
+ it('renders the testimonials title', () => {
33
+ expect(test.html()).toContain('<h2>What our customers think…</h2>')
34
+ })
35
+
36
+ it('renders the content after the quotes', () => {
37
+ expect(test.html()).toContain('<p>Hello</p>')
38
+ })
39
+
40
+ it('renders the correct number of blockquotes', () => {
41
+
42
+ expect(test.findAll('blockquote').length).toBe(3)
43
+ })
44
+
45
+ it('adds the largest class on the defined blockquote', () => {
46
+
47
+ const quotes = test.findAll('blockquote');
48
+ const largestQuote = quotes.at(2)
49
+
50
+ expect(largestQuote.classes()).toContain('largest')
51
+ })
52
+
53
+ it('adds the testimonial--multi class on load', () => {
54
+
55
+ expect(test.classes()).toContain('testimonial--multi')
56
+ })
57
+ })
@@ -0,0 +1,17 @@
1
+ import { shallowMount } from '@vue/test-utils'
2
+ import Header from './Timeline.vue'
3
+
4
+ describe('Timeline component', () => {
5
+
6
+ const test = shallowMount(Header, {
7
+ propsData: {
8
+ },
9
+ slots: {
10
+ default: '<p>Hello</p>'
11
+ }
12
+ })
13
+
14
+ it('renders the content after', () => {
15
+ expect(test.html()).toContain('<p>Hello</p>')
16
+ })
17
+ })
@@ -0,0 +1,90 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import Table from './Table.vue'
3
+
4
+ describe('Table component', () => {
5
+
6
+ const test = mount(Table, {
7
+ propsData: {
8
+ fields: [
9
+ { key: 'name', filterable: true, sortable: true },
10
+ { key: 'job', filterable: true, sortable: true },
11
+ { key: 'address' },
12
+ { key: 'emergency_contact', filterable: true, sortable: true },
13
+ { key: 'actions' }
14
+ ],
15
+ items: [
16
+ {
17
+ name: 'Derrick',
18
+ job: 'Electrician',
19
+ address: '5 King Street<br> London<br> London<br> SW20 0AL<br> United Kingdom',
20
+ emergency_contact: 'Susan',
21
+ actions: '<a href="#">View</a><br><a href="#">Point of Contact</a>'
22
+ },
23
+ {
24
+ name: 'Andrew',
25
+ job: 'Electrician',
26
+ address: '5 King Street<br> London<br> London<br> SW20 0AL<br> United Kingdom',
27
+ emergency_contact: 'Susan',
28
+ actions: '<a href="#">View</a><br><a href="#">Point of Contact</a>'
29
+ },
30
+ {
31
+ name: 'Rachel',
32
+ job: 'Electrician',
33
+ address: '5 King Street<br> London<br> London<br> SW20 0AL<br> United Kingdom',
34
+ emergency_contact: 'Susan',
35
+ actions: '<a href="#">View</a><br><a href="#">Point of Contact</a>'
36
+ }
37
+ ],
38
+ show: 2
39
+ }
40
+ })
41
+
42
+ // On load
43
+ it('renders a div with the class of table wrapper', () => {
44
+
45
+ expect(test.classes()).toContain('table__wrapper')
46
+ })
47
+
48
+ it('renders a thead', () => {
49
+
50
+ expect(test.find('thead').exists()).toBe(true)
51
+ })
52
+
53
+ it('renders a tbody', () => {
54
+
55
+ expect(test.find('tbody').exists()).toBe(true)
56
+ })
57
+
58
+ it('renders a filters form when needed', () => {
59
+
60
+ expect(test.find('.table__filters').exists()).toBe(true)
61
+ })
62
+
63
+ it('renders a pagination form when needed', () => {
64
+
65
+ expect(test.find('.table__pagination').exists()).toBe(true)
66
+ })
67
+
68
+ // Events
69
+ it('can be sorted by name', async () => {
70
+
71
+ const firstCol = test.find('[data-sortable]')
72
+ expect(firstCol.html()).toContain('Name')
73
+
74
+ await firstCol.trigger('click')
75
+
76
+ let firstRowCol = test.find('tbody tr:first-child [data-label="Name"]')
77
+ expect(firstRowCol.html()).toContain('Andrew')
78
+ })
79
+
80
+ it('can be filtered by name', async () => {
81
+
82
+ const searchField = test.find('[type="search"]')
83
+
84
+ await searchField.setValue('Andrew')
85
+ await searchField.trigger('change')
86
+
87
+ expect(test.findAll('tbody tr').length).toBe(1)
88
+ })
89
+
90
+ })
@@ -22,6 +22,9 @@ import table from '../../../assets/js/modules/table.js'
22
22
 
23
23
  let numericValue = function(value) {
24
24
 
25
+ if(typeof(value) != "string")
26
+ return value;
27
+
25
28
  value = value.replace('£','')
26
29
  value = value.replace('%','')
27
30
 
@@ -85,17 +88,17 @@ export default {
85
88
  mounted(){
86
89
 
87
90
  this.$nextTick(function () {
88
-
91
+
89
92
  table(this.$refs.wrapper);
90
93
 
91
94
  // Listen for the event.
92
- this.$el.addEventListener('sorted', function (e) {
93
-
95
+ this.$el.addEventListener('sorted', function (e) {
96
+
94
97
  console.log('Table sorted')
95
98
  }, false);
96
99
 
97
- this.$el.addEventListener('filtered', function (e) {
98
-
100
+ this.$el.addEventListener('filtered', function (e) {
101
+
99
102
  console.log('Table filtered')
100
103
  }, false);
101
104
 
@@ -0,0 +1,24 @@
1
+ import { shallowMount } from '@vue/test-utils'
2
+ import Icon from './Icon.vue'
3
+
4
+ describe('Icon component', () => {
5
+ it('renders the email Icon by default', () => {
6
+ const test = shallowMount(Icon, {
7
+ propsData: { }
8
+ })
9
+
10
+ expect(test.html()).toContain('<title>email</title>')
11
+ expect(test.html()).toContain('<use xlink:href="/svg/icons.svg#icon-email"></use>')
12
+ })
13
+
14
+ it('renders the correct logo when an ID is passed', () => {
15
+ const test = shallowMount(Icon, {
16
+ propsData: {
17
+ id: 'pin'
18
+ }
19
+ })
20
+
21
+ expect(test.html()).toContain('<title>pin</title>')
22
+ expect(test.html()).toContain('<use xlink:href="/svg/icons.svg#icon-pin"></use>')
23
+ })
24
+ })
@@ -0,0 +1,56 @@
1
+ import { shallowMount } from '@vue/test-utils'
2
+ import Logo from './Logo.vue'
3
+
4
+ describe('Logo component', () => {
5
+ it('renders the iam property logo by default', () => {
6
+ const test = shallowMount(Logo, {
7
+ propsData: { }
8
+ })
9
+
10
+ expect(test.html()).toContain('<title>iam property</title>')
11
+ expect(test.html()).toContain('<use xlink:href="/svg/logo.svg#logo-property"></use>')
12
+ })
13
+
14
+ it('renders the correct logo when an ID is passed', () => {
15
+ const test = shallowMount(Logo, {
16
+ propsData: {
17
+ id: 'sold'
18
+ }
19
+ })
20
+
21
+ expect(test.html()).toContain('<title>iam sold</title>')
22
+ expect(test.html()).toContain('<use xlink:href="/svg/logo.svg#logo-sold"></use>')
23
+ })
24
+
25
+ it('renders a description when passed', () => {
26
+ const test = shallowMount(Logo, {
27
+ propsData: { }
28
+ })
29
+
30
+ expect(test.html()).not.toContain('<span></span>')
31
+
32
+ const test2 = shallowMount(Logo, {
33
+ propsData: {
34
+ desc: 'description'
35
+ }
36
+ })
37
+
38
+ expect(test2.html()).toContain('<span>description</span>')
39
+ })
40
+
41
+ it('background can be modified', () => {
42
+ const test = shallowMount(Logo, {
43
+ propsData: { }
44
+ })
45
+
46
+ expect(test.html()).not.toContain('<span></span>')
47
+
48
+ const test2 = shallowMount(Logo, {
49
+ propsData: {
50
+ desc: 'description'
51
+ }
52
+ })
53
+
54
+ expect(test2.html()).toContain('<span>description</span>')
55
+ })
56
+ })
@@ -0,0 +1,6 @@
1
+ declare module "*.vue" {
2
+ import { DefineComponent } from 'vue'
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
4
+ const component: DefineComponent<{}, {}, any>
5
+ export default component
6
+ }