@3t-transform/threeteeui 0.0.16 → 0.0.18

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 (125) hide show
  1. package/dist/cjs/{index-864b7110.js → index-bf777121.js} +3 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/tttx-button.cjs.entry.js +25 -19
  4. package/dist/cjs/tttx-checkbox.cjs.entry.js +18 -18
  5. package/dist/cjs/tttx-form.cjs.entry.js +365 -365
  6. package/dist/cjs/tttx-icon.cjs.entry.js +14 -1856
  7. package/dist/cjs/tttx-input-calendar.cjs.entry.js +125 -0
  8. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +33 -0
  9. package/dist/cjs/tttx-list.cjs.entry.js +188 -188
  10. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
  11. package/dist/cjs/tttx-popover-content.cjs.entry.js +13 -13
  12. package/dist/cjs/tttx-standalone-input.cjs.entry.js +127 -127
  13. package/dist/cjs/tttx-table.cjs.entry.js +50 -50
  14. package/dist/cjs/tttx.cjs.js +2 -2
  15. package/dist/collection/collection-manifest.json +2 -0
  16. package/dist/collection/components/atoms/tttx-button/tttx-button.css +94 -18
  17. package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -93
  18. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +74 -27
  19. package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +8 -5
  20. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -116
  21. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -47
  22. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.css +26 -0
  23. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +56 -0
  24. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +12 -0
  25. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -66
  26. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
  27. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +97 -96
  28. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +23 -23
  29. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +102 -101
  30. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +9 -9
  31. package/dist/collection/components/molecules/tttx-form/tttx-form.css +95 -11
  32. package/dist/collection/components/molecules/tttx-form/tttx-form.js +452 -451
  33. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +109 -109
  34. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.css +93 -0
  35. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.js +174 -0
  36. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.js +27 -0
  37. package/dist/collection/components/molecules/tttx-list/tttx-list.js +312 -311
  38. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +14 -14
  39. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +570 -569
  40. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +134 -134
  41. package/dist/collection/components/molecules/tttx-table/tttx-table.js +174 -177
  42. package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +65 -65
  43. package/dist/collection/components/palette.stories.js +7 -7
  44. package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
  45. package/dist/collection/icons.js +2838 -2838
  46. package/dist/collection/index.js +1 -1
  47. package/dist/components/index.d.ts +2 -0
  48. package/dist/components/index.js +2 -0
  49. package/dist/components/tttx-button.js +1 -40
  50. package/dist/components/tttx-button2.js +56 -0
  51. package/dist/components/tttx-checkbox.js +36 -36
  52. package/dist/components/tttx-form.js +382 -382
  53. package/dist/components/tttx-icon2.js +32 -1874
  54. package/dist/components/tttx-input-calendar.d.ts +11 -0
  55. package/dist/components/tttx-input-calendar.js +157 -0
  56. package/dist/components/tttx-keyvalue-block.d.ts +11 -0
  57. package/dist/components/tttx-keyvalue-block.js +49 -0
  58. package/dist/components/tttx-list.js +214 -214
  59. package/dist/components/tttx-loading-spinner2.js +33 -33
  60. package/dist/components/tttx-popover-content2.js +32 -32
  61. package/dist/components/tttx-standalone-input.js +168 -169
  62. package/dist/components/tttx-table.js +79 -79
  63. package/dist/esm/{index-232e347b.js → index-a05bd606.js} +3 -0
  64. package/dist/esm/loader.js +3 -3
  65. package/dist/esm/polyfills/core-js.js +0 -0
  66. package/dist/esm/polyfills/dom.js +0 -0
  67. package/dist/esm/polyfills/es5-html-element.js +0 -0
  68. package/dist/esm/polyfills/index.js +0 -0
  69. package/dist/esm/polyfills/system.js +0 -0
  70. package/dist/esm/tttx-button.entry.js +25 -19
  71. package/dist/esm/tttx-checkbox.entry.js +18 -18
  72. package/dist/esm/tttx-form.entry.js +365 -365
  73. package/dist/esm/tttx-icon.entry.js +14 -1856
  74. package/dist/esm/tttx-input-calendar.entry.js +121 -0
  75. package/dist/esm/tttx-keyvalue-block.entry.js +29 -0
  76. package/dist/esm/tttx-list.entry.js +188 -188
  77. package/dist/esm/tttx-loading-spinner.entry.js +16 -16
  78. package/dist/esm/tttx-popover-content.entry.js +13 -13
  79. package/dist/esm/tttx-standalone-input.entry.js +127 -127
  80. package/dist/esm/tttx-table.entry.js +50 -50
  81. package/dist/esm/tttx.js +3 -3
  82. package/dist/tttx/{p-3973b7dd.entry.js → p-037d286f.entry.js} +1 -1
  83. package/dist/tttx/{p-184c4fae.js → p-07b134af.js} +1 -1
  84. package/dist/tttx/{p-125f06b3.entry.js → p-1b63f16a.entry.js} +1 -1
  85. package/dist/tttx/p-45afb84c.entry.js +1 -0
  86. package/dist/tttx/p-68ff0f39.entry.js +1 -0
  87. package/dist/tttx/{p-6828fe6f.entry.js → p-93763d3c.entry.js} +1 -1
  88. package/dist/tttx/p-a5808741.entry.js +1 -0
  89. package/dist/tttx/{p-fe4c70b2.entry.js → p-a92ca87e.entry.js} +1 -1
  90. package/dist/tttx/{p-5ce1ba22.entry.js → p-a96ca037.entry.js} +1 -1
  91. package/dist/tttx/p-dc087fd8.entry.js +1 -0
  92. package/dist/tttx/p-e3cc75bb.entry.js +1 -0
  93. package/dist/tttx/{p-01e1894e.entry.js → p-f579ed1e.entry.js} +1 -1
  94. package/dist/tttx/tttx.esm.js +1 -1
  95. package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -9
  96. package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -20
  97. package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -14
  98. package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -21
  99. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +4 -0
  100. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +6 -0
  101. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
  102. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
  103. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +7 -7
  104. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +18 -18
  105. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +9 -9
  106. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +6 -6
  107. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +134 -134
  108. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +12 -12
  109. package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.d.ts +19 -0
  110. package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.d.ts +26 -0
  111. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +51 -51
  112. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +13 -13
  113. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +38 -38
  114. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +106 -106
  115. package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +15 -15
  116. package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +21 -21
  117. package/dist/types/components/palette.stories.d.ts +6 -6
  118. package/dist/types/components.d.ts +46 -15
  119. package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
  120. package/dist/types/icons.d.ts +2 -2
  121. package/dist/types/index.d.ts +1 -1
  122. package/package.json +4 -4
  123. package/dist/tttx/p-10316ff1.entry.js +0 -1
  124. package/dist/tttx/p-b1c22f5f.entry.js +0 -1
  125. package/dist/tttx/p-c7f9be65.entry.js +0 -1
@@ -1,109 +1,109 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
- export default {
3
- title: 'molecules/Form',
4
- component: 'tttx-form',
5
- parameters: {
6
- actions: {
7
- handles: ['dataSubmitted', 'dataChanged'],
8
- },
9
- },
10
- decorators: [withActions],
11
- };
12
- const formSchema = {
13
- properties: {
14
- title: {
15
- type: 'string',
16
- format: 'string',
17
- form: {
18
- type: 'text',
19
- placeholder: 'Mr, Mrs, Dr, Hon Rev',
20
- label: 'Title',
21
- },
22
- },
23
- forename: {
24
- type: 'string',
25
- format: 'string',
26
- form: {
27
- type: 'text',
28
- placeholder: 'John',
29
- label: 'Forename',
30
- validation: {
31
- required: {
32
- message: 'Please enter your forename',
33
- },
34
- },
35
- },
36
- },
37
- surname: {
38
- type: 'string',
39
- format: 'string',
40
- form: {
41
- type: 'text',
42
- placeholder: 'Doe',
43
- label: 'Surname',
44
- validation: {
45
- required: {
46
- message: 'Please enter your surname',
47
- },
48
- },
49
- },
50
- },
51
- postcode: {
52
- type: 'string',
53
- format: 'string',
54
- form: {
55
- type: 'text',
56
- placeholder: 'AB10',
57
- label: 'Start of postcode',
58
- validation: {
59
- required: {
60
- message: 'Please enter the beginning of your postcode',
61
- },
62
- pattern: {
63
- pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
64
- message: 'Please enter the first half of your postcode. EG: ZZ99',
65
- },
66
- maxlength: 4,
67
- },
68
- },
69
- },
70
- age: {
71
- type: 'number',
72
- format: 'number',
73
- form: {
74
- type: 'number',
75
- placeholder: '',
76
- label: 'Age',
77
- validation: {
78
- required: {
79
- message: 'Please enter your age',
80
- },
81
- badInput: {
82
- message: 'Please enter a number',
83
- },
84
- },
85
- },
86
- },
87
- dob: {
88
- type: 'string',
89
- format: 'date-time',
90
- form: {
91
- type: 'date',
92
- placeholder: '',
93
- label: 'Date of birth',
94
- validation: {
95
- required: {
96
- message: 'Please enter your date of birth',
97
- },
98
- minmax: {
99
- min: '1900-01-01',
100
- max: '2100-12-31',
101
- message: 'Please enter a date between 1900 and 2100',
102
- },
103
- },
104
- },
105
- },
106
- },
107
- };
108
- const jsonFormSchema = JSON.stringify(formSchema);
109
- export const ExampleFormFromJSON = () => `<tttx-form formSchema='${jsonFormSchema}'></tttx-form>`;
1
+ import { withActions } from '@storybook/addon-actions/decorator';
2
+ export default {
3
+ title: 'molecules/Form',
4
+ component: 'tttx-form',
5
+ parameters: {
6
+ actions: {
7
+ handles: ['dataSubmitted', 'dataChanged'],
8
+ },
9
+ },
10
+ decorators: [withActions],
11
+ };
12
+ const formSchema = {
13
+ properties: {
14
+ title: {
15
+ type: 'string',
16
+ format: 'string',
17
+ form: {
18
+ type: 'text',
19
+ placeholder: 'Mr, Mrs, Dr, Hon Rev',
20
+ label: 'Title',
21
+ },
22
+ },
23
+ forename: {
24
+ type: 'string',
25
+ format: 'string',
26
+ form: {
27
+ type: 'text',
28
+ placeholder: 'John',
29
+ label: 'Forename',
30
+ validation: {
31
+ required: {
32
+ message: 'Please enter your forename',
33
+ },
34
+ },
35
+ },
36
+ },
37
+ surname: {
38
+ type: 'string',
39
+ format: 'string',
40
+ form: {
41
+ type: 'text',
42
+ placeholder: 'Doe',
43
+ label: 'Surname',
44
+ validation: {
45
+ required: {
46
+ message: 'Please enter your surname',
47
+ },
48
+ },
49
+ },
50
+ },
51
+ postcode: {
52
+ type: 'string',
53
+ format: 'string',
54
+ form: {
55
+ type: 'text',
56
+ placeholder: 'AB10',
57
+ label: 'Start of postcode',
58
+ validation: {
59
+ required: {
60
+ message: 'Please enter the beginning of your postcode',
61
+ },
62
+ pattern: {
63
+ pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
64
+ message: 'Please enter the first half of your postcode. EG: ZZ99',
65
+ },
66
+ maxlength: 4,
67
+ },
68
+ },
69
+ },
70
+ age: {
71
+ type: 'number',
72
+ format: 'number',
73
+ form: {
74
+ type: 'number',
75
+ placeholder: '',
76
+ label: 'Age',
77
+ validation: {
78
+ required: {
79
+ message: 'Please enter your age',
80
+ },
81
+ badInput: {
82
+ message: 'Please enter a number',
83
+ },
84
+ },
85
+ },
86
+ },
87
+ dob: {
88
+ type: 'string',
89
+ format: 'date-time',
90
+ form: {
91
+ type: 'date',
92
+ placeholder: '',
93
+ label: 'Date of birth',
94
+ validation: {
95
+ required: {
96
+ message: 'Please enter your date of birth',
97
+ },
98
+ minmax: {
99
+ min: '1900-01-01',
100
+ max: '2100-12-31',
101
+ message: 'Please enter a date between 1900 and 2100',
102
+ },
103
+ },
104
+ },
105
+ },
106
+ },
107
+ };
108
+ const jsonFormSchema = JSON.stringify(formSchema);
109
+ export const ExampleFormFromJSON = () => `<tttx-form formSchema='${jsonFormSchema}'></tttx-form>`;
@@ -0,0 +1,93 @@
1
+ .material-symbols-rounded {
2
+ font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
3
+ }
4
+
5
+ :host {
6
+ display: block;
7
+ --border-radius: 4px;
8
+ position: relative;
9
+ }
10
+
11
+ .calcontainer {
12
+ -webkit-perspective: 500px;
13
+ perspective: 500px;
14
+ }
15
+
16
+ .lefty {
17
+ float: left;
18
+ }
19
+
20
+ .righty {
21
+ float: right;
22
+ }
23
+
24
+ .calendar {
25
+ display: none;
26
+ position: absolute;
27
+ box-sizing: border-box;
28
+ width: 312px;
29
+ height: 332px;
30
+ background-color: white;
31
+ padding: 16px;
32
+ box-shadow: 0px 1px 5px rgba(17, 17, 17, 0.3);
33
+ border-radius: var(--border-radius);
34
+ }
35
+
36
+ .calendar-header {
37
+ display: flex;
38
+ justify-content: space-between;
39
+ margin-bottom: 8px;
40
+ }
41
+
42
+ .date-display {
43
+ margin-top: 8px;
44
+ }
45
+
46
+ .calendar-header select {
47
+ border: none;
48
+ padding: 5px;
49
+ }
50
+
51
+ .calendar-table {
52
+ width: 100%;
53
+ border-collapse: collapse;
54
+ }
55
+
56
+ .calendar-table th {
57
+ text-align: center;
58
+ padding: 4px;
59
+ text-transform: uppercase;
60
+ font-size: 14px;
61
+ color: #757575;
62
+ border-bottom: 1px solid #d5d5d5;
63
+ margin-bottom: 8px;
64
+ }
65
+
66
+ .calendar .calendar-table td {
67
+ padding: 0;
68
+ margin: 0;
69
+ width: 14.2%;
70
+ text-align: center;
71
+ height: 36px;
72
+ line-height: 36px;
73
+ }
74
+
75
+ .calendar .calendar-table td span:hover {
76
+ background-color: #f0f0f0;
77
+ }
78
+
79
+ .calendar .calendar-table td span {
80
+ display: block;
81
+ text-align: center;
82
+ padding: 4px;
83
+ cursor: pointer;
84
+ border-radius: var(--border-radius);
85
+ }
86
+
87
+ .calendar-visible {
88
+ display: block;
89
+ }
90
+
91
+ .calendar-table thead tr {
92
+ border-bottom: 1px solid #d5d5d5;
93
+ }
@@ -0,0 +1,174 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import { Host, h } from '@stencil/core';
3
+ export class TttxInputCalendar {
4
+ constructor() {
5
+ // an array of month numbers mapped to their names
6
+ this.monthNames = Array.from({ length: 12 }, (_, i) => i + 1).map((month) => {
7
+ const date = new Date(0);
8
+ date.setUTCMonth(month - 1);
9
+ return date.toLocaleString('default', { month: 'long' });
10
+ });
11
+ this.onClickOutside = (event) => {
12
+ if (!this.el.contains(event.target) && this.showCalendar) {
13
+ this.showCalendar = false;
14
+ }
15
+ };
16
+ this.onFocusIn = (event) => {
17
+ if (!this.el.contains(event.target) && this.showCalendar) {
18
+ this.showCalendar = false;
19
+ }
20
+ };
21
+ this.previousHandler = () => {
22
+ if (this.selectedMonth === 1) {
23
+ this.selectedMonth = 12;
24
+ this.selectedYear--;
25
+ }
26
+ else {
27
+ this.selectedMonth--;
28
+ }
29
+ };
30
+ this.nextHandler = () => {
31
+ if (this.selectedMonth === 12) {
32
+ this.selectedMonth = 1;
33
+ this.selectedYear++;
34
+ }
35
+ else {
36
+ this.selectedMonth++;
37
+ }
38
+ };
39
+ this.months = false;
40
+ this.years = false;
41
+ this.showCalendar = false;
42
+ this.selectedYear = new Date().getFullYear();
43
+ this.selectedMonth = new Date().getMonth() + 1;
44
+ }
45
+ componentDidLoad() {
46
+ const slot = this.el.shadowRoot.querySelector('slot');
47
+ if (slot) {
48
+ const assignedElements = slot.assignedElements();
49
+ if (assignedElements[0]) {
50
+ assignedElements[0].addEventListener('click', (event) => {
51
+ event.preventDefault();
52
+ this.showCalendar = !this.showCalendar;
53
+ });
54
+ }
55
+ }
56
+ document.addEventListener('click', this.onClickOutside);
57
+ }
58
+ disconnectedCallback() {
59
+ document.removeEventListener('click', this.onClickOutside);
60
+ }
61
+ getDaysAndDates(year, month) {
62
+ const firstDayOfMonth = new Date(year, month - 1, 1);
63
+ const lastDayOfMonth = new Date(year, month, 0);
64
+ const daysAndDates = [];
65
+ for (let day = firstDayOfMonth; day <= lastDayOfMonth; day.setDate(day.getDate() + 1)) {
66
+ const weekDay = day.getDay();
67
+ const date = day.getDate();
68
+ const dayAndDate = {
69
+ day: weekDay,
70
+ date: date
71
+ };
72
+ daysAndDates.push(dayAndDate);
73
+ }
74
+ return daysAndDates;
75
+ }
76
+ clickDateHandler(event) {
77
+ const { year, month, day } = event;
78
+ const selectedDate = new Date(year, month - 1, day + 1);
79
+ this.inputElement.valueAsDate = selectedDate;
80
+ this.showCalendar = false;
81
+ }
82
+ render() {
83
+ const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
84
+ const daysAndDates = this.getDaysAndDates(this.selectedYear, this.selectedMonth);
85
+ const currentYear = new Date().getFullYear();
86
+ const years = Array.from({ length: 11 }, (_, i) => currentYear - 5 + i);
87
+ const calendarGrid = [];
88
+ let currentWeek = [];
89
+ // Fill empty days before the first day of the month
90
+ for (let i = 0; i < daysAndDates[0].day; i++) {
91
+ currentWeek.push(h("td", null));
92
+ }
93
+ // Fill the calendar with days and dates
94
+ daysAndDates.forEach(({ day, date }) => {
95
+ currentWeek.push(h("td", null, h("span", { onClick: () => this.clickDateHandler({ year: this.selectedYear, month: this.selectedMonth, day: date }) }, date)));
96
+ if (day === 6) {
97
+ calendarGrid.push(h("tr", null, currentWeek));
98
+ currentWeek = [];
99
+ }
100
+ });
101
+ // Fill the remaining empty days in the last week
102
+ if (currentWeek.length > 0) {
103
+ while (currentWeek.length < 7) {
104
+ currentWeek.push(h("td", null));
105
+ }
106
+ calendarGrid.push(h("tr", null, currentWeek));
107
+ }
108
+ return (h(Host, null, h("div", { class: "calcontainer" }, h("slot", null), h("div", { class: `calendar ${this.showCalendar ? 'calendar-visible' : ''}` }, h("div", { class: "calendar-header" }, h("tttx-button", { onClick: this.previousHandler, design: "borderless", icon: "chevron_left", notext: true }), this.months && h("select", { id: "month-select", onInput: (event) => {
109
+ this.selectedMonth = parseInt(event.target.value);
110
+ } }, Array.from({ length: 12 }, (_, i) => i + 1).map((month) => (h("option", { value: month, selected: month === this.selectedMonth }, this.monthNames[month - 1])))), this.years && h("select", { id: "year-select", onInput: (event) => {
111
+ this.selectedYear = parseInt(event.target.value);
112
+ } }, years.map((year) => (h("option", { value: year, selected: year === this.selectedYear }, year)))), h("div", { class: "date-display" }, this.monthNames[this.selectedMonth - 1], " ", this.selectedYear), h("tttx-button", { onClick: this.nextHandler, design: "borderless", icon: "chevron_right", notext: true })), h("table", { class: "calendar-table" }, h("thead", null, h("tr", null, daysOfWeek.map((day) => (h("th", null, day))))), h("tbody", null, calendarGrid))))));
113
+ }
114
+ static get is() { return "tttx-input-calendar"; }
115
+ static get encapsulation() { return "shadow"; }
116
+ static get originalStyleUrls() {
117
+ return {
118
+ "$": ["tttx-input-calendar.scss"]
119
+ };
120
+ }
121
+ static get styleUrls() {
122
+ return {
123
+ "$": ["tttx-input-calendar.css"]
124
+ };
125
+ }
126
+ static get properties() {
127
+ return {
128
+ "months": {
129
+ "type": "boolean",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "boolean",
133
+ "resolved": "boolean",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": ""
141
+ },
142
+ "attribute": "months",
143
+ "reflect": false,
144
+ "defaultValue": "false"
145
+ },
146
+ "years": {
147
+ "type": "boolean",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "boolean",
151
+ "resolved": "boolean",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": ""
159
+ },
160
+ "attribute": "years",
161
+ "reflect": false,
162
+ "defaultValue": "false"
163
+ }
164
+ };
165
+ }
166
+ static get states() {
167
+ return {
168
+ "showCalendar": {},
169
+ "selectedYear": {},
170
+ "selectedMonth": {}
171
+ };
172
+ }
173
+ static get elementRef() { return "el"; }
174
+ }
@@ -0,0 +1,27 @@
1
+ import { withActions } from '@storybook/addon-actions/decorator';
2
+ export default {
3
+ title: 'molecules/Calendar',
4
+ component: 'tttx-input-calendar',
5
+ argTypes: {
6
+ required: {
7
+ control: {
8
+ type: 'boolean'
9
+ }
10
+ }
11
+ },
12
+ parameters: {
13
+ actions: {
14
+ handles: ['valueChanged', 'focusChanged', 'blurChanged'],
15
+ },
16
+ },
17
+ decorators: [withActions],
18
+ };
19
+ export const BasicCalendar = ({ required }) => {
20
+ return `<tttx-input-calendar>
21
+ <tttx-standalone-input ${required ? 'required' : ''} label="Choose a date" type="date" />
22
+ </tttx-input-calendar>
23
+ `;
24
+ };
25
+ BasicCalendar.args = {
26
+ required: true
27
+ };