@3t-transform/threeteeui 0.0.9 → 0.0.11

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 (82) hide show
  1. package/dist/cjs/{index-8a4cb9bc.js → index-bf39be87.js} +41 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/tttx-button.cjs.entry.js +2 -2
  4. package/dist/cjs/tttx-checkbox.cjs.entry.js +3 -3
  5. package/dist/cjs/tttx-form.cjs.entry.js +169 -41
  6. package/dist/cjs/tttx-icon.cjs.entry.js +2 -2
  7. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +26 -0
  8. package/dist/cjs/tttx-popover-content.cjs.entry.js +2 -2
  9. package/dist/cjs/tttx-standalone-input.cjs.entry.js +134 -0
  10. package/dist/cjs/tttx.cjs.js +2 -2
  11. package/dist/collection/collection-manifest.json +3 -2
  12. package/dist/collection/components/atoms/tttx-button/tttx-button.css +1 -0
  13. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +3 -3
  14. package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +8 -4
  15. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +15 -15
  16. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.css +48 -0
  17. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +66 -0
  18. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -0
  19. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +1 -1
  20. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +3 -3
  21. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +86 -43
  22. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +1 -1
  23. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +5 -5
  24. package/dist/collection/components/molecules/tttx-form/tttx-form.css +230 -0
  25. package/dist/collection/components/molecules/tttx-form/tttx-form.js +195 -55
  26. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +97 -28
  27. package/dist/collection/components/molecules/{tttx-input/tttx-input.css → tttx-standalone-input/tttx-standalone-input.css} +78 -53
  28. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +561 -0
  29. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +156 -0
  30. package/dist/collection/components/palette.stories.js +81 -81
  31. package/dist/collection/docs/gettingstarted-developer.stories.js +4 -4
  32. package/dist/components/index.d.ts +2 -1
  33. package/dist/components/index.js +2 -1
  34. package/dist/components/tttx-button.js +1 -1
  35. package/dist/components/tttx-checkbox.js +2 -2
  36. package/dist/components/tttx-form.js +167 -39
  37. package/dist/components/tttx-icon2.js +1 -1
  38. package/dist/components/{tttx-input.d.ts → tttx-loading-spinner.d.ts} +4 -4
  39. package/dist/components/tttx-loading-spinner.js +43 -0
  40. package/dist/components/tttx-popover-content.js +1 -1
  41. package/dist/components/tttx-standalone-input.d.ts +11 -0
  42. package/dist/components/tttx-standalone-input.js +178 -0
  43. package/dist/esm/{index-9654537d.js → index-63c4d25e.js} +41 -0
  44. package/dist/esm/loader.js +3 -3
  45. package/dist/esm/tttx-button.entry.js +2 -2
  46. package/dist/esm/tttx-checkbox.entry.js +3 -3
  47. package/dist/esm/tttx-form.entry.js +169 -41
  48. package/dist/esm/tttx-icon.entry.js +2 -2
  49. package/dist/esm/tttx-loading-spinner.entry.js +22 -0
  50. package/dist/esm/tttx-popover-content.entry.js +2 -2
  51. package/dist/esm/tttx-standalone-input.entry.js +130 -0
  52. package/dist/esm/tttx.js +3 -3
  53. package/dist/tttx/{p-3cb692d6.entry.js → p-1a4eb1f3.entry.js} +1 -1
  54. package/dist/tttx/p-2d54f8aa.entry.js +1 -0
  55. package/dist/tttx/p-338b3976.entry.js +1 -0
  56. package/dist/tttx/p-4c57bcbd.entry.js +1 -0
  57. package/dist/tttx/p-709246f5.entry.js +1 -0
  58. package/dist/tttx/p-95a29e09.entry.js +1 -0
  59. package/dist/tttx/{p-1884203f.entry.js → p-ad0c3fe4.entry.js} +1 -1
  60. package/dist/tttx/p-bec472d8.js +2 -0
  61. package/dist/tttx/tttx.esm.js +1 -1
  62. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -0
  63. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -0
  64. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +14 -7
  65. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +1 -8
  66. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +38 -0
  67. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +106 -0
  68. package/dist/types/components.d.ts +73 -31
  69. package/package.json +67 -65
  70. package/readme.md +89 -86
  71. package/dist/cjs/tttx-input.cjs.entry.js +0 -44
  72. package/dist/collection/components/molecules/tttx-input/tttx-input.js +0 -259
  73. package/dist/collection/components/molecules/tttx-input/tttx-input.stories.js +0 -106
  74. package/dist/components/tttx-input.js +0 -77
  75. package/dist/esm/tttx-input.entry.js +0 -40
  76. package/dist/tttx/p-8e977b49.entry.js +0 -1
  77. package/dist/tttx/p-b6cc2780.js +0 -2
  78. package/dist/tttx/p-beb8e3fc.entry.js +0 -1
  79. package/dist/tttx/p-ece1c722.entry.js +0 -1
  80. package/dist/tttx/p-f30a0e84.entry.js +0 -1
  81. package/dist/types/components/molecules/tttx-input/tttx-input.d.ts +0 -20
  82. package/dist/types/components/molecules/tttx-input/tttx-input.stories.d.ts +0 -60
@@ -0,0 +1,156 @@
1
+ import icons from '../../../icons';
2
+ export default {
3
+ title: 'Molecules/Standalone Input',
4
+ component: 'tttx-standalone-input',
5
+ argTypes: {
6
+ iconleft: {
7
+ options: icons,
8
+ control: { type: 'select' },
9
+ },
10
+ iconright: {
11
+ options: icons,
12
+ control: { type: 'select' },
13
+ },
14
+ label: {
15
+ control: { type: 'text' },
16
+ },
17
+ errormsg: {
18
+ control: { type: 'text' },
19
+ },
20
+ showerrormsg: {
21
+ control: { type: 'boolean' },
22
+ },
23
+ checked: {
24
+ control: { type: 'boolean' },
25
+ },
26
+ disabled: {
27
+ control: { type: 'boolean' },
28
+ },
29
+ max: {
30
+ control: { type: 'text' },
31
+ },
32
+ maxlength: {
33
+ control: { type: 'text' },
34
+ },
35
+ min: {
36
+ control: { type: 'text' },
37
+ },
38
+ minlength: {
39
+ control: { type: 'text' },
40
+ },
41
+ name: {
42
+ control: { type: 'text' },
43
+ },
44
+ pattern: {
45
+ control: { type: 'text' },
46
+ },
47
+ placeholder: {
48
+ control: { type: 'text' },
49
+ },
50
+ readonly: {
51
+ control: { type: 'boolean' },
52
+ },
53
+ required: {
54
+ control: { type: 'boolean' },
55
+ },
56
+ step: {
57
+ control: { type: 'text' },
58
+ },
59
+ type: {
60
+ options: ['text', 'password', 'email', 'number'],
61
+ control: { type: 'radio' },
62
+ },
63
+ value: {
64
+ control: { type: 'text' },
65
+ },
66
+ },
67
+ };
68
+ const TemplateTextInput = ({ iconleft, iconright, label, errormsg, showerrormsg, checked, disabled, max, maxlength, min, minlength, name, pattern, placeholder, readonly, required, step, type, value, }) => `
69
+ <tttx-standalone-input
70
+ iconleft="${iconleft || ''}"
71
+ iconright="${iconright || ''}"
72
+ label="${label}"
73
+ errormsg="${errormsg}"
74
+ ${showerrormsg ? 'showerrormsg' : ''}
75
+ ${checked ? 'checked' : ''}
76
+ ${disabled ? 'disabled' : ''}
77
+ ${max ? `max=${max}` : ''}
78
+ ${maxlength ? `maxlength=${maxlength}` : ''}
79
+ ${min ? `min=${min}` : ''}
80
+ ${minlength ? `minlength=${minlength}` : ''}
81
+ ${name ? `name=${name}` : ''}
82
+ ${pattern ? `pattern=${pattern}` : ''}
83
+ ${placeholder ? `placeholder=${placeholder}` : ''}
84
+ ${readonly ? 'readonly' : ''}
85
+ ${required ? 'required' : ''}
86
+ ${step ? 'step' : ''}
87
+ type="${type}"
88
+ value="${value}"
89
+ />
90
+ `;
91
+ export const InputField = TemplateTextInput.bind({});
92
+ InputField.args = {
93
+ value: '',
94
+ label: 'First name',
95
+ type: 'text',
96
+ errormsg: 'Please enter your first name',
97
+ required: false,
98
+ showerrormsg: false,
99
+ placeholder: 'Enter first name',
100
+ };
101
+ // export const TextInputIconLeft = TemplateTextInput.bind({});
102
+ // TextInputIconLeft.args = {
103
+ // value: 'Uh egg',
104
+ // label: 'Please tell me about your egg',
105
+ // iconleft: 'egg',
106
+ // type: 'text',
107
+ // errormsg: 'Incorrect egg, please egg again.',
108
+ // required: true,
109
+ // showerrormsg: true,
110
+ // placeholder: 'Please for the love of god tell me about your egg',
111
+ // };
112
+ // export const TextInputIconRight = TemplateTextInput.bind({});
113
+ // TextInputIconRight.args = {
114
+ // value: 'Uh egg',
115
+ // label: 'Please tell me about your egg',
116
+ // iconright: 'egg',
117
+ // type: 'text',
118
+ // errormsg: 'Incorrect egg, please egg again.',
119
+ // required: true,
120
+ // showerrormsg: true,
121
+ // placeholder: 'Please for the love of god tell me about your egg',
122
+ // };
123
+ // export const PasswordInputBasic = TemplateTextInput.bind({});
124
+ // PasswordInputBasic.args = {
125
+ // value: 'qwefdweferg',
126
+ // label: 'Input your Password',
127
+ // iconleft: 'lock',
128
+ // type: 'password',
129
+ // errormsg: 'Password is not strong enough',
130
+ // required: true,
131
+ // showerrormsg: true,
132
+ // placeholder: 'Your password',
133
+ // };
134
+ // export const EmailInputBasic = TemplateTextInput.bind({});
135
+ // EmailInputBasic.args = {
136
+ // value: 'email.address@website.com',
137
+ // label: 'Choose an email address',
138
+ // iconleft: 'mail',
139
+ // type: 'email',
140
+ // errormsg: 'This email smells funny',
141
+ // required: true,
142
+ // valid: false,
143
+ // showerrormsg: true,
144
+ // placeholder: 'Your email address',
145
+ // };
146
+ // export const NumberInputBasic = TemplateTextInput.bind({});
147
+ // NumberInputBasic.args = {
148
+ // value: '42069',
149
+ // label: 'What is your favourite number?',
150
+ // iconleft: '123',
151
+ // type: 'number',
152
+ // errormsg: 'This number feels wrong',
153
+ // required: true,
154
+ // showerrormsg: true,
155
+ // placeholder: 'Your favourite number',
156
+ // };
@@ -2,87 +2,87 @@ export default {
2
2
  title: 'Foundations/Palette',
3
3
  component: 'tttx-palette',
4
4
  };
5
- const Swatch = (colour, name = "") => `
6
- <div class="swatch">
7
- <div class="swatchcontent" style="background-color:${colour};">
8
- <div class="pill">${colour}</div>
9
- </div>
10
- <p>${name}</p>
11
- </div>
5
+ const Swatch = (colour, name = '') => `
6
+ <div class="swatch">
7
+ <div class="swatchcontent" style="background-color:${colour};">
8
+ <div class="pill">${colour}</div>
9
+ </div>
10
+ <p>${name}</p>
11
+ </div>
12
12
  `;
13
- const Template = () => `
14
-
15
- <style>
16
- h2 { clear:both; margin-top: 2em; display: block; }
17
- .swatch { width:130px; height:130px; float:left; font-size: 12px; }
18
- .swatchcontent { width:120px; height:80px; }
19
- .pill {
20
- margin: 0.5em;
21
- display: inline-block;
22
- padding: 0.25em 0.5em;
23
- border-radius: 1em;
24
- background-color: #FFFFFF;
25
- color: #000000;
26
- font-size: 1em;
27
- font-weight: bold;
28
- }
29
- p { margin: 8px 0 0 0; }
30
- </style>
31
-
32
- <h2>Primary</h2>
33
- ${Swatch("#111111", "$black")}
34
- ${Swatch("#FFFFFF", "$white")}
35
- ${Swatch("#00187C", "$brand")}
36
- ${Swatch("#1579C6", "$accent")}
37
- ${Swatch("#E7F1F9", "$selected")}
38
-
39
- <h2>Text and icons</h2>
40
- ${Swatch("#212121", "$ui-primary")}
41
- ${Swatch("#757575", "$ui-secondary")}
42
- ${Swatch("#9E9E9E", "$ui-placeholder")}
43
- ${Swatch("#4C4C4C", "$ui-disabled")}
44
-
45
- <h2>Layout</h2>
46
- ${Swatch("#F0F0F0", "$background")}
47
- ${Swatch("#FAFAFA", "$backround-secondary")}
48
- ${Swatch("#D5D5D5", "$ui-border")}
49
-
50
- <h2>Buttons</h2>
51
- ${Swatch("#1579C6", "$btn-accent")}
52
- ${Swatch("#146EB3", "$btn-accent-hover")}
53
- ${Swatch("#10609D", "$btn-accent-active")}
54
- <div style="clear:both;"></div>
55
- ${Swatch("#FFFFFF", "$btn-default")}
56
- ${Swatch("#e6e6e6", "$btn-hover")}
57
- ${Swatch("#cccccc", "$btn-active")}
58
- <div style="clear:both;"></div>
59
- ${Swatch("#DC0000", "$btn-danger")}
60
- ${Swatch("#C70101", "$btn-danger-hover")}
61
- ${Swatch("#B30303", "$btn-danger-active")}
62
- <div style="clear:both;"></div>
63
- ${Swatch("#BDBDBD", "$btn-disabled")}
64
-
65
- <h2>Severity</h2>
66
- ${Swatch("#DC0000", "$severity-critical")}
67
- ${Swatch("#F59500", "$severity-warning")}
68
- ${Swatch("#A2BB31", "$severity-success")}
69
- ${Swatch("#00187C", "$severity-info")}
70
- <div style="clear:both;"></div>
71
- ${Swatch("#F2BEBE", "$message-critical")}
72
- ${Swatch("#F9E1BE", "$message-warning")}
73
- ${Swatch("#E4EBC9", "$message-success")}
74
- ${Swatch("#C2DAEE", "$message-info")}
75
-
76
- <h2>Diverging</h2>
77
- ${Swatch("#0373A5", "$dv-lowest")}
78
- ${Swatch("#00C2D1", "$dv-very-low")}
79
- ${Swatch("#50A472", "$dv-low")}
80
- ${Swatch("#A2BB31", "$dv-med-low")}
81
- ${Swatch("#FDC500", "$dv-medium")}
82
- ${Swatch("#F59500", "$dv-med-high")}
83
- ${Swatch("#EA6100", "$dv-high")}
84
- ${Swatch("#DC0000", "$dv-very-high")}
85
- ${Swatch("#A20000", "$dv-highest")}
86
-
13
+ const Template = () => `
14
+
15
+ <style>
16
+ h2 { clear:both; margin-top: 2em; display: block; }
17
+ .swatch { width:130px; height:130px; float:left; font-size: 12px; }
18
+ .swatchcontent { width:120px; height:80px; }
19
+ .pill {
20
+ margin: 0.5em;
21
+ display: inline-block;
22
+ padding: 0.25em 0.5em;
23
+ border-radius: 1em;
24
+ background-color: #FFFFFF;
25
+ color: #000000;
26
+ font-size: 1em;
27
+ font-weight: bold;
28
+ }
29
+ p { margin: 8px 0 0 0; }
30
+ </style>
31
+
32
+ <h2>Primary</h2>
33
+ ${Swatch('#111111', '$black')}
34
+ ${Swatch('#FFFFFF', '$white')}
35
+ ${Swatch('#00187C', '$brand')}
36
+ ${Swatch('#1579C6', '$accent')}
37
+ ${Swatch('#E7F1F9', '$selected')}
38
+
39
+ <h2>Text and icons</h2>
40
+ ${Swatch('#212121', '$ui-primary')}
41
+ ${Swatch('#757575', '$ui-secondary')}
42
+ ${Swatch('#9E9E9E', '$ui-placeholder')}
43
+ ${Swatch('#4C4C4C', '$ui-disabled')}
44
+
45
+ <h2>Layout</h2>
46
+ ${Swatch('#F0F0F0', '$background')}
47
+ ${Swatch('#FAFAFA', '$backround-secondary')}
48
+ ${Swatch('#D5D5D5', '$ui-border')}
49
+
50
+ <h2>Buttons</h2>
51
+ ${Swatch('#1579C6', '$btn-accent')}
52
+ ${Swatch('#146EB3', '$btn-accent-hover')}
53
+ ${Swatch('#10609D', '$btn-accent-active')}
54
+ <div style="clear:both;"></div>
55
+ ${Swatch('#FFFFFF', '$btn-default')}
56
+ ${Swatch('#e6e6e6', '$btn-hover')}
57
+ ${Swatch('#cccccc', '$btn-active')}
58
+ <div style="clear:both;"></div>
59
+ ${Swatch('#DC0000', '$btn-danger')}
60
+ ${Swatch('#C70101', '$btn-danger-hover')}
61
+ ${Swatch('#B30303', '$btn-danger-active')}
62
+ <div style="clear:both;"></div>
63
+ ${Swatch('#BDBDBD', '$btn-disabled')}
64
+
65
+ <h2>Severity</h2>
66
+ ${Swatch('#DC0000', '$severity-critical')}
67
+ ${Swatch('#F59500', '$severity-warning')}
68
+ ${Swatch('#A2BB31', '$severity-success')}
69
+ ${Swatch('#00187C', '$severity-info')}
70
+ <div style="clear:both;"></div>
71
+ ${Swatch('#F2BEBE', '$message-critical')}
72
+ ${Swatch('#F9E1BE', '$message-warning')}
73
+ ${Swatch('#E4EBC9', '$message-success')}
74
+ ${Swatch('#C2DAEE', '$message-info')}
75
+
76
+ <h2>Diverging</h2>
77
+ ${Swatch('#0373A5', '$dv-lowest')}
78
+ ${Swatch('#00C2D1', '$dv-very-low')}
79
+ ${Swatch('#50A472', '$dv-low')}
80
+ ${Swatch('#A2BB31', '$dv-med-low')}
81
+ ${Swatch('#FDC500', '$dv-medium')}
82
+ ${Swatch('#F59500', '$dv-med-high')}
83
+ ${Swatch('#EA6100', '$dv-high')}
84
+ ${Swatch('#DC0000', '$dv-very-high')}
85
+ ${Swatch('#A20000', '$dv-highest')}
86
+
87
87
  `;
88
88
  export const Default = Template.bind({});
@@ -1,9 +1,9 @@
1
1
  export default {
2
2
  title: 'Getting Started/Developer',
3
3
  };
4
- const Template = () => `
5
- <tttx-typography>
6
- <p>Quick start guide for developers</p>
7
- </tttx-typography>
4
+ const Template = () => `
5
+ <tttx-typography>
6
+ <p>Quick start guide for developers</p>
7
+ </tttx-typography>
8
8
  `;
9
9
  export const Default = Template.bind({});
@@ -3,8 +3,9 @@ export { TttxButton as TttxButton } from '../types/components/atoms/tttx-button/
3
3
  export { TttxCheckbox as TttxCheckbox } from '../types/components/atoms/ttx-checkbox/tttx-checkbox';
4
4
  export { TttxForm as TttxForm } from '../types/components/molecules/tttx-form/tttx-form';
5
5
  export { TttxIcon as TttxIcon } from '../types/components/atoms/tttx-icon/tttx-icon';
6
- export { TttxInput as TttxInput } from '../types/components/molecules/tttx-input/tttx-input';
6
+ export { TttxLoadingSpinner as TttxLoadingSpinner } from '../types/components/atoms/tttx-loading-spinner/tttx-loading-spinner';
7
7
  export { TttxPopoverContent as TttxPopoverContent } from '../types/components/atoms/tttx-popover-content/tttx-popover-content';
8
+ export { TttxInput as TttxStandaloneInput } from '../types/components/molecules/tttx-standalone-input/tttx-standalone-input';
8
9
 
9
10
  /**
10
11
  * Used to manually set the base path where assets can be found.
@@ -3,5 +3,6 @@ export { TttxButton, defineCustomElement as defineCustomElementTttxButton } from
3
3
  export { TttxCheckbox, defineCustomElement as defineCustomElementTttxCheckbox } from './tttx-checkbox.js';
4
4
  export { TttxForm, defineCustomElement as defineCustomElementTttxForm } from './tttx-form.js';
5
5
  export { TttxIcon, defineCustomElement as defineCustomElementTttxIcon } from './tttx-icon.js';
6
- export { TttxInput, defineCustomElement as defineCustomElementTttxInput } from './tttx-input.js';
6
+ export { TttxLoadingSpinner, defineCustomElement as defineCustomElementTttxLoadingSpinner } from './tttx-loading-spinner.js';
7
7
  export { TttxPopoverContent, defineCustomElement as defineCustomElementTttxPopoverContent } from './tttx-popover-content.js';
8
+ export { TttxStandaloneInput, defineCustomElement as defineCustomElementTttxStandaloneInput } from './tttx-standalone-input.js';
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.button{height:36px;padding:8px 16px;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button:hover{background:#f0f0f0}.button:active{background:#e3e3e3}.primary-blue{background:#1479c6;border:1px solid #1479c6}.primary-blue:hover{background:#1169ba}.primary-blue:active{background:#0951a8}.secondary-white{background:white;border:1px solid #212121}:host{display:inline-block}.spacingleft{margin-left:8px}.font-white{color:white}.font-black{color:#212121}";
3
+ const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.button{height:36px;padding:8px 16px;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button:hover{background:#f0f0f0}.button:active{background:#e3e3e3}.primary-blue{background:#1479c6;border:1px solid #1479c6;color:white}.primary-blue:hover{background:#1169ba}.primary-blue:active{background:#0951a8}.secondary-white{background:white;border:1px solid #212121}:host{display:inline-block}.spacingleft{margin-left:8px}.font-white{color:white}.font-black{color:#212121}";
4
4
 
5
5
  const TttxButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
6
  constructor() {
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- const tttxCheckboxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\";font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}.field{clear:both}.container{display:flex;flex-wrap:wrap;box-sizing:border-box;height:36px;border:1px solid #c8c8c8;border-radius:4px}.icon-left,.icon-right{flex-basis:24px}.icon-left span,.icon-right span{font-size:24px;line-height:24px;text-align:center;display:block;width:24px;height:24px;margin-top:4px}.icon-left span{margin-left:4px}.icon-right span{margin-right:4px}.input{flex-grow:1;border:none;outline:none;font-size:16px;padding:8px 16px;background-color:transparent}.iconleft .input{padding-left:4px}.iconright .input{padding-right:4px}.label{display:block;font-size:16px;height:18px;font-weight:600;color:#212121;font-size:16px;margin-bottom:4px;z-index:1}.disabled{background:#f0f0f0;color:#9e9e9e;border-color:#c8c8c8}.focused{border-color:#1479c6}.errormsg{height:16px;display:flex;justify-content:center;align-items:center;float:left;margin-bottom:16px;box-sizing:border-box;background-color:transparent;height:26px;font-size:14px;color:white;border-radius:none;z-index:2;color:#DC0000}.errormsg .validationicon{width:16px;height:16px;font-size:16px;margin-right:4px;vertical-align:middle;color:#DC0000}.danger{color:#DC0000}.optional{color:#757575;font-weight:normal}:host{display:block}.spacing{margin-bottom:16px}";
3
+ const tttxCheckboxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}.icon-left,.icon-right{flex-basis:24px}.icon-left span,.icon-right span{font-size:24px;line-height:24px;text-align:center;display:block;width:24px;height:24px;margin-top:4px}.icon-left span{margin-left:4px}.icon-right span{margin-right:4px}.icon-right{margin-top:5px;margin-right:4px}.icon-left{margin-top:5px;margin-left:4px}.iconleft .input{padding-left:4px}.iconright .input{padding-right:4px}.focused{border-color:#1479c6}.errormsg{display:flex;justify-content:center;align-items:center;float:left;margin-bottom:16px;box-sizing:border-box;background-color:transparent;height:26px;font-size:14px;border-radius:none;z-index:2;color:#dc0000}.errormsg .validationicon{width:16px;height:16px;font-size:16px;margin-right:4px;vertical-align:middle;color:#dc0000}.danger{color:#dc0000}.optional{color:#757575;font-weight:normal}label.inputBlock{display:block;position:relative;line-height:21px}label{font-weight:500;font-size:16px}input:not([type=submit]){font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}input.invalid:invalid,input.standalone.invalid{border:1px solid #dc0000}input~.errorBubble{min-height:27px;position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}input~.errorBubble:not(.visible){visibility:hidden}input~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}input.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}input:focus{border-color:#1479c6}:host{display:block}.spacing{margin-bottom:16px}";
4
4
 
5
5
  const TttxCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
6
  constructor() {
@@ -18,7 +18,7 @@ const TttxCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
18
18
  this.valueChanged.emit(target.checked);
19
19
  }
20
20
  render() {
21
- return (h(Host, null, h("div", { class: "field spacing" }, this.label && h("label", { class: "label" }, this.label, !this.required ? h("span", { class: "optional" }, " (optional)") : ''), h("input", { type: "checkbox", class: "input", onChange: event => this.handleClick(event), checked: this.value }))));
21
+ return (h(Host, null, h("div", { class: "field spacing" }, this.label && (h("label", { class: "label" }, this.label, !this.required ? h("span", { class: "optional" }, " (optional)") : '')), h("input", { type: "checkbox", class: "input", onChange: event => this.handleClick(event), checked: this.value }))));
22
22
  }
23
23
  static get style() { return tttxCheckboxCss; }
24
24
  }, [1, "tttx-checkbox", {
@@ -1,59 +1,187 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const tttxFormCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}.icon-left,.icon-right{flex-basis:24px}.icon-left span,.icon-right span{font-size:24px;line-height:24px;text-align:center;display:block;width:24px;height:24px;margin-top:4px}.icon-left span{margin-left:4px}.icon-right span{margin-right:4px}.icon-right{margin-top:5px;margin-right:4px}.icon-left{margin-top:5px;margin-left:4px}.iconleft .input{padding-left:4px}.iconright .input{padding-right:4px}.focused{border-color:#1479c6}.errormsg{display:flex;justify-content:center;align-items:center;float:left;margin-bottom:16px;box-sizing:border-box;background-color:transparent;height:26px;font-size:14px;border-radius:none;z-index:2;color:#dc0000}.errormsg .validationicon{width:16px;height:16px;font-size:16px;margin-right:4px;vertical-align:middle;color:#dc0000}.danger{color:#dc0000}.optional{color:#757575;font-weight:normal}label.inputBlock{display:block;position:relative;line-height:21px}label{font-weight:500;font-size:16px}input:not([type=submit]){font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}input.invalid:invalid,input.standalone.invalid{border:1px solid #dc0000}input~.errorBubble{min-height:27px;position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}input~.errorBubble:not(.visible){visibility:hidden}input~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}input.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}input:focus{border-color:#1479c6}.button{height:36px;padding:8px 16px;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button:hover{background:#f0f0f0}.button:active{background:#e3e3e3}.primary-blue{background:#1479c6;border:1px solid #1479c6;color:white}.primary-blue:hover{background:#1169ba}.primary-blue:active{background:#0951a8}.secondary-white{background:white;border:1px solid #212121}:host{display:block}fieldset{margin:0;padding:0;border:none}input[type=submit]{margin-left:auto}";
2
4
 
3
5
  const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
4
6
  constructor() {
5
7
  super();
6
8
  this.__registerHost();
7
9
  this.__attachShadow();
8
- this.formSubmit = createEvent(this, "formSubmit", 7);
9
- this.fetchFormData = () => {
10
- let validForm = true;
11
- const formData = {};
12
- const elements = this.el.querySelectorAll(`[${this.dataAttribute}]`);
13
- elements.forEach((element) => {
14
- const inputElement = element;
15
- validForm = validForm ? this.validateFormField(inputElement) : false;
16
- formData[inputElement.getAttribute(this.dataAttribute)] = inputElement.value;
17
- });
18
- return validForm ? formData : null;
19
- };
20
- this.dataAttribute = 'form-data';
21
- this.functionAttribute = 'function-data';
10
+ this.submitEvent = createEvent(this, "submitEvent", 7);
11
+ this.template = document.createElement('template');
12
+ this.formschema = undefined;
13
+ this.submitValue = undefined;
14
+ }
15
+ onFormSchemaChange(newValue) {
16
+ if (typeof newValue === 'string') {
17
+ this._formSchema = JSON.parse(newValue);
18
+ }
19
+ else {
20
+ this._formSchema = newValue;
21
+ }
22
22
  }
23
- validateFormField(element) {
24
- let isValid = true;
25
- const isRequired = element.hasAttribute("required");
26
- if (isRequired && !element.value) {
27
- // required and not set, show error
28
- element.setAttribute("showerrormsg", "true");
29
- isValid = false;
23
+ validityCheck(event) {
24
+ var _a, _b, _c, _d;
25
+ event.preventDefault();
26
+ const target = event.target;
27
+ let hasError = true;
28
+ let errorMessage = '';
29
+ // validity object on HTML5 inputs has the following options
30
+ // badInput
31
+ // customError
32
+ // patternMismatch
33
+ // rangeOverflow
34
+ // rangeUnderflow
35
+ // stepMismatch
36
+ // tooLong
37
+ // tooShort
38
+ // typeMismatch
39
+ // valid
40
+ // valueMissing
41
+ // customErrors can be set with
42
+ // target.setCustomValidity('custom error!');
43
+ // and cleared with
44
+ // target.setCustomValidity('');
45
+ if (target.validity.valueMissing) {
46
+ errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
47
+ }
48
+ else if (target.validity.patternMismatch) {
49
+ errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
50
+ }
51
+ else if (target.validity.badInput) {
52
+ // IE string in a number field
53
+ errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
54
+ }
55
+ else if (target.validity.rangeOverflow || target.validity.rangeUnderflow) {
56
+ // IE date or number is above or below value set in min or max tags
57
+ errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
58
+ }
59
+ else {
60
+ // no error
61
+ hasError = false;
62
+ }
63
+ if (hasError) {
64
+ target.className = 'invalid';
65
+ const errorIcon = document.createElement('span');
66
+ errorIcon.className = 'material-symbols-rounded';
67
+ errorIcon.textContent = 'warning';
68
+ target.parentElement.querySelector('.errorBubble').replaceChildren();
69
+ target.parentElement.querySelector('.errorBubble').append(errorIcon);
70
+ target.parentElement.querySelector('.errorBubble').append(errorMessage);
30
71
  }
31
72
  else {
32
- // required and set, ensure error does not show
33
- element.removeAttribute("showerrormsg");
73
+ target.className = '';
74
+ target.parentElement.querySelector('.errorBubble').replaceChildren();
34
75
  }
35
- return isValid;
36
76
  }
37
- componentDidLoad() {
38
- const elements = this.el.querySelectorAll(`[${this.functionAttribute}]`);
39
- elements.forEach((element) => {
40
- element.addEventListener('click', event => {
41
- event.preventDefault();
42
- const formData = this.fetchFormData();
43
- if (formData) {
44
- // only emit event if form data is valid
45
- this.formSubmit.emit(this.fetchFormData());
77
+ doSubmit(event) {
78
+ event.preventDefault();
79
+ const formData = new FormData(event.target);
80
+ // Key value pair matching the key names given by the JSON schema will be output line by line
81
+ // TODO: Emit an event so external components can handle the resulting form data
82
+ // let output = "";
83
+ // for (var [key, value] of formData.entries()) {
84
+ // output += `${key} -> ${value}\n`;
85
+ // }
86
+ // console.log(output);
87
+ this.submitEvent.emit(formData);
88
+ }
89
+ fieldsetChange(event) {
90
+ console.log(event.target.name + ' has changed');
91
+ // The correct input box will always be the target of the incoming event
92
+ // TODO: Emit an event so external components can change based on form values input
93
+ }
94
+ componentWillLoad() {
95
+ // set proper on initial render
96
+ this.onFormSchemaChange(this.formschema);
97
+ }
98
+ componentWillRender() {
99
+ this.template.content.replaceChildren(); // clear the template to account for a potential re-render scenario
100
+ this.populateFormFromSchema();
101
+ }
102
+ populateFormFromSchema() {
103
+ if (!this._formSchema)
104
+ return;
105
+ const properties = this._formSchema.properties;
106
+ const propertyKeys = Object.keys(properties);
107
+ propertyKeys.forEach(formKey => {
108
+ var _a, _b, _c;
109
+ const formItem = properties[formKey];
110
+ const formProperties = formItem.form;
111
+ const input = document.createElement('input');
112
+ input.name = formKey;
113
+ input.type = formProperties.type;
114
+ input.placeholder = (_a = formProperties.placeholder) !== null && _a !== void 0 ? _a : '';
115
+ input.autocomplete = 'off';
116
+ input.autocapitalize = 'off';
117
+ if (formProperties.validation) {
118
+ const validation = formProperties.validation;
119
+ if (validation.required) {
120
+ input.setAttribute('required', '');
121
+ input.setAttribute('data-required', (_b = validation.required.message) !== null && _b !== void 0 ? _b : '');
122
+ }
123
+ if (validation.pattern) {
124
+ input.setAttribute('pattern', validation.pattern.pattern);
125
+ input.setAttribute('data-pattern', (_c = validation.pattern.message) !== null && _c !== void 0 ? _c : '');
126
+ }
127
+ if (validation.badInput) {
128
+ input.setAttribute('data-badinput', validation.badInput.message);
129
+ }
130
+ if (validation.minmax) {
131
+ input.setAttribute('min', validation.minmax.min);
132
+ input.setAttribute('max', validation.minmax.max);
133
+ input.setAttribute('data-range', validation.minmax.message);
46
134
  }
47
- });
135
+ if (validation.maxlength) {
136
+ input.setAttribute('maxlength', validation.maxlength);
137
+ }
138
+ }
139
+ const errorBubble = document.createElement('div');
140
+ errorBubble.className = 'errorBubble';
141
+ const label = document.createElement('label');
142
+ label.className = 'inputBlock';
143
+ label.innerText = formProperties.label;
144
+ if (!formProperties.validation) {
145
+ const optionalSpan = document.createElement('span');
146
+ optionalSpan.className = 'optional';
147
+ optionalSpan.innerHTML = '&nbsp;(optional)';
148
+ label.appendChild(optionalSpan);
149
+ }
150
+ label.appendChild(input);
151
+ label.appendChild(errorBubble);
152
+ this.template.content.append(label);
153
+ });
154
+ const submitButton = document.createElement('input');
155
+ submitButton.type = 'submit';
156
+ submitButton.className = 'button primary-blue';
157
+ console.log(this.submitValue);
158
+ submitButton.value = 'Save';
159
+ this.template.content.append(submitButton);
160
+ }
161
+ componentDidRender() {
162
+ if (!this._formSchema)
163
+ return;
164
+ const formItems = this.template.content.cloneNode(true);
165
+ // bind to events here as you can't do it in a template in stencil
166
+ const properties = this._formSchema.properties;
167
+ const propertyKeys = Object.keys(properties);
168
+ propertyKeys.forEach(formKey => {
169
+ formItems.querySelector(`[name=${formKey}]`).oninvalid = this.validityCheck.bind(this);
170
+ formItems.querySelector(`[name=${formKey}]`).onblur = this.validityCheck.bind(this);
48
171
  });
172
+ // append to the fieldset
173
+ this.fieldset.appendChild(formItems);
49
174
  }
50
175
  render() {
51
- return (h("div", null, h("slot", null)));
176
+ return (h(Host, null, h("form", { onSubmit: this.doSubmit.bind(this) }, h("fieldset", { onChange: this.fieldsetChange, ref: el => (this.fieldset = el) }))));
52
177
  }
53
- get el() { return this; }
178
+ static get watchers() { return {
179
+ "formschema": ["onFormSchemaChange"]
180
+ }; }
181
+ static get style() { return tttxFormCss; }
54
182
  }, [1, "tttx-form", {
55
- "dataAttribute": [1, "data-attribute"],
56
- "functionAttribute": [1, "function-attribute"]
183
+ "formschema": [8],
184
+ "submitValue": [8, "submit-value"]
57
185
  }]);
58
186
  function defineCustomElement$1() {
59
187
  if (typeof customElements === "undefined") {
@@ -1797,7 +1797,7 @@ var createPopper = /*#__PURE__*/popperGenerator({
1797
1797
  defaultModifiers: defaultModifiers
1798
1798
  }); // eslint-disable-next-line import/no-unused-modules
1799
1799
 
1800
- const tttxIconCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\";font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}:host{display:block}.tooltip{background:#ffffff;color:#343434;font-weight:bold;padding:8px 16px;font-size:13px;border-radius:4px;box-shadow:0 0 5px 1px rgba(0, 0, 0, 0.3);display:none}.tooltip[data-show]{display:block}.arrow,.arrow::before{position:absolute;width:8px;height:8px;background:inherit}.arrow{visibility:hidden}.arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}.tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}.tooltip[data-popper-placement^=left]>.arrow{right:-4px}.tooltip[data-popper-placement^=right]>.arrow{left:-4px}.red{color:#DC0000}.orange{color:#F59500}.blue{color:#1479c6}.green{color:#A2BB31}.gray{color:#757575}.black{color:#212121}.clickable{cursor:pointer}";
1800
+ const tttxIconCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}:host{display:block}.tooltip{background:#ffffff;color:#343434;font-weight:bold;padding:8px 16px;font-size:13px;border-radius:4px;box-shadow:0 0 5px 1px rgba(0, 0, 0, 0.3);display:none}.tooltip[data-show]{display:block}.arrow,.arrow::before{position:absolute;width:8px;height:8px;background:inherit}.arrow{visibility:hidden}.arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}.tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}.tooltip[data-popper-placement^=left]>.arrow{right:-4px}.tooltip[data-popper-placement^=right]>.arrow{left:-4px}.red{color:#dc0000}.orange{color:#f59500}.blue{color:#1479c6}.green{color:#a2bb31}.gray{color:#757575}.black{color:#212121}.white{color:white}.clickable{cursor:pointer}";
1801
1801
 
1802
1802
  const TttxIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
1803
1803
  constructor() {