@3t-transform/threeteeui 0.0.22 → 0.0.23

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 (100) hide show
  1. package/dist/cjs/{index-bf777121.js → index-2943e8f8.js} +1 -122
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/tttx-button.cjs.entry.js +1 -1
  4. package/dist/cjs/tttx-icon.cjs.entry.js +1 -1
  5. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +8 -5
  6. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +1 -1
  7. package/dist/cjs/tttx-standalone-input.cjs.entry.js +2 -1
  8. package/dist/cjs/tttx.cjs.js +2 -2
  9. package/dist/collection/collection-manifest.json +1 -7
  10. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +7 -4
  11. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +1 -0
  12. package/dist/components/index.d.ts +0 -6
  13. package/dist/components/index.js +0 -6
  14. package/dist/components/tttx-button.js +54 -1
  15. package/dist/components/tttx-keyvalue-block.js +7 -4
  16. package/dist/components/tttx-loading-spinner.js +38 -1
  17. package/dist/components/tttx-standalone-input.js +1 -0
  18. package/dist/esm/{index-a05bd606.js → index-058a3cd0.js} +2 -122
  19. package/dist/esm/loader.js +3 -3
  20. package/dist/esm/tttx-button.entry.js +1 -1
  21. package/dist/esm/tttx-icon.entry.js +1 -1
  22. package/dist/esm/tttx-keyvalue-block.entry.js +8 -5
  23. package/dist/esm/tttx-loading-spinner.entry.js +1 -1
  24. package/dist/esm/tttx-standalone-input.entry.js +2 -1
  25. package/dist/esm/tttx.js +3 -3
  26. package/dist/tttx/{p-68ff0f39.entry.js → p-046868d9.entry.js} +1 -1
  27. package/dist/tttx/{p-93763d3c.entry.js → p-1adb2b75.entry.js} +1 -1
  28. package/dist/tttx/{p-a5808741.entry.js → p-495cf4b3.entry.js} +1 -1
  29. package/dist/tttx/p-a4d9929a.entry.js +1 -0
  30. package/dist/tttx/p-ad637dde.entry.js +1 -0
  31. package/dist/tttx/p-bbb7dbf7.js +2 -0
  32. package/dist/tttx/tttx.esm.js +1 -1
  33. package/dist/types/components.d.ts +0 -136
  34. package/package.json +2 -2
  35. package/dist/cjs/tttx-checkbox.cjs.entry.js +0 -28
  36. package/dist/cjs/tttx-form.cjs.entry.js +0 -374
  37. package/dist/cjs/tttx-input-calendar.cjs.entry.js +0 -125
  38. package/dist/cjs/tttx-list.cjs.entry.js +0 -198
  39. package/dist/cjs/tttx-popover-content.cjs.entry.js +0 -23
  40. package/dist/cjs/tttx-table.cjs.entry.js +0 -60
  41. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.css +0 -30
  42. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +0 -97
  43. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +0 -23
  44. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +0 -181
  45. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +0 -102
  46. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +0 -13
  47. package/dist/collection/components/molecules/tttx-form/tttx-form.css +0 -314
  48. package/dist/collection/components/molecules/tttx-form/tttx-form.js +0 -452
  49. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +0 -109
  50. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.css +0 -93
  51. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.js +0 -174
  52. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.js +0 -27
  53. package/dist/collection/components/molecules/tttx-list/tttx-list.css +0 -56
  54. package/dist/collection/components/molecules/tttx-list/tttx-list.js +0 -312
  55. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +0 -37
  56. package/dist/collection/components/molecules/tttx-table/tttx-table.css +0 -166
  57. package/dist/collection/components/molecules/tttx-table/tttx-table.js +0 -174
  58. package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +0 -81
  59. package/dist/components/tttx-button2.js +0 -56
  60. package/dist/components/tttx-checkbox.d.ts +0 -11
  61. package/dist/components/tttx-checkbox.js +0 -46
  62. package/dist/components/tttx-form.d.ts +0 -11
  63. package/dist/components/tttx-form.js +0 -391
  64. package/dist/components/tttx-input-calendar.d.ts +0 -11
  65. package/dist/components/tttx-input-calendar.js +0 -157
  66. package/dist/components/tttx-list.d.ts +0 -11
  67. package/dist/components/tttx-list.js +0 -225
  68. package/dist/components/tttx-loading-spinner2.js +0 -40
  69. package/dist/components/tttx-popover-content.d.ts +0 -11
  70. package/dist/components/tttx-popover-content.js +0 -6
  71. package/dist/components/tttx-popover-content2.js +0 -39
  72. package/dist/components/tttx-table.d.ts +0 -11
  73. package/dist/components/tttx-table.js +0 -91
  74. package/dist/esm/tttx-checkbox.entry.js +0 -24
  75. package/dist/esm/tttx-form.entry.js +0 -370
  76. package/dist/esm/tttx-input-calendar.entry.js +0 -121
  77. package/dist/esm/tttx-list.entry.js +0 -194
  78. package/dist/esm/tttx-popover-content.entry.js +0 -19
  79. package/dist/esm/tttx-table.entry.js +0 -56
  80. package/dist/tttx/p-037d286f.entry.js +0 -1
  81. package/dist/tttx/p-07b134af.js +0 -2
  82. package/dist/tttx/p-1b63f16a.entry.js +0 -1
  83. package/dist/tttx/p-45afb84c.entry.js +0 -1
  84. package/dist/tttx/p-46b5551e.entry.js +0 -1
  85. package/dist/tttx/p-9536b8c4.entry.js +0 -1
  86. package/dist/tttx/p-a92ca87e.entry.js +0 -1
  87. package/dist/tttx/p-a96ca037.entry.js +0 -1
  88. package/dist/tttx/p-f579ed1e.entry.js +0 -1
  89. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +0 -7
  90. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +0 -18
  91. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +0 -9
  92. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +0 -6
  93. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +0 -134
  94. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +0 -12
  95. package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.d.ts +0 -19
  96. package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.d.ts +0 -26
  97. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +0 -51
  98. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +0 -13
  99. package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +0 -15
  100. package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +0 -21
@@ -13,41 +13,18 @@ export namespace Components {
13
13
  "iconposition": 'left' | 'right';
14
14
  "notext": boolean;
15
15
  }
16
- interface TttxCheckbox {
17
- "label": string;
18
- "required": boolean;
19
- "value": boolean;
20
- }
21
- interface TttxForm {
22
- "formschema": any;
23
- "submitValue": any;
24
- }
25
16
  interface TttxIcon {
26
17
  "color": string;
27
18
  "icon": string;
28
19
  }
29
- interface TttxInputCalendar {
30
- "months": boolean;
31
- "years": boolean;
32
- }
33
20
  interface TttxKeyvalueBlock {
34
21
  "horizontal": boolean;
35
22
  "keyvalues": any | any[] | string;
36
23
  }
37
- interface TttxList {
38
- "name": string;
39
- "selectable": boolean;
40
- }
41
24
  interface TttxLoadingSpinner {
42
25
  "loadingMessage": boolean;
43
26
  "size": 'small' | 'large';
44
27
  }
45
- interface TttxPopoverContent {
46
- "body": string;
47
- "header": string;
48
- "linkcontext": string;
49
- "linktext": string;
50
- }
51
28
  interface TttxStandaloneInput {
52
29
  "autocomplete": 'off' | 'on';
53
30
  "checked": boolean;
@@ -83,33 +60,11 @@ export namespace Components {
83
60
  "type": string;
84
61
  "value": string | number;
85
62
  }
86
- interface TttxTable {
87
- "data": any[];
88
- "headers": any[];
89
- "loading": boolean;
90
- "selected": number;
91
- }
92
- }
93
- export interface TttxCheckboxCustomEvent<T> extends CustomEvent<T> {
94
- detail: T;
95
- target: HTMLTttxCheckboxElement;
96
- }
97
- export interface TttxFormCustomEvent<T> extends CustomEvent<T> {
98
- detail: T;
99
- target: HTMLTttxFormElement;
100
- }
101
- export interface TttxListCustomEvent<T> extends CustomEvent<T> {
102
- detail: T;
103
- target: HTMLTttxListElement;
104
63
  }
105
64
  export interface TttxStandaloneInputCustomEvent<T> extends CustomEvent<T> {
106
65
  detail: T;
107
66
  target: HTMLTttxStandaloneInputElement;
108
67
  }
109
- export interface TttxTableCustomEvent<T> extends CustomEvent<T> {
110
- detail: T;
111
- target: HTMLTttxTableElement;
112
- }
113
68
  declare global {
114
69
  interface HTMLTttxButtonElement extends Components.TttxButton, HTMLStencilElement {
115
70
  }
@@ -117,78 +72,36 @@ declare global {
117
72
  prototype: HTMLTttxButtonElement;
118
73
  new (): HTMLTttxButtonElement;
119
74
  };
120
- interface HTMLTttxCheckboxElement extends Components.TttxCheckbox, HTMLStencilElement {
121
- }
122
- var HTMLTttxCheckboxElement: {
123
- prototype: HTMLTttxCheckboxElement;
124
- new (): HTMLTttxCheckboxElement;
125
- };
126
- interface HTMLTttxFormElement extends Components.TttxForm, HTMLStencilElement {
127
- }
128
- var HTMLTttxFormElement: {
129
- prototype: HTMLTttxFormElement;
130
- new (): HTMLTttxFormElement;
131
- };
132
75
  interface HTMLTttxIconElement extends Components.TttxIcon, HTMLStencilElement {
133
76
  }
134
77
  var HTMLTttxIconElement: {
135
78
  prototype: HTMLTttxIconElement;
136
79
  new (): HTMLTttxIconElement;
137
80
  };
138
- interface HTMLTttxInputCalendarElement extends Components.TttxInputCalendar, HTMLStencilElement {
139
- }
140
- var HTMLTttxInputCalendarElement: {
141
- prototype: HTMLTttxInputCalendarElement;
142
- new (): HTMLTttxInputCalendarElement;
143
- };
144
81
  interface HTMLTttxKeyvalueBlockElement extends Components.TttxKeyvalueBlock, HTMLStencilElement {
145
82
  }
146
83
  var HTMLTttxKeyvalueBlockElement: {
147
84
  prototype: HTMLTttxKeyvalueBlockElement;
148
85
  new (): HTMLTttxKeyvalueBlockElement;
149
86
  };
150
- interface HTMLTttxListElement extends Components.TttxList, HTMLStencilElement {
151
- }
152
- var HTMLTttxListElement: {
153
- prototype: HTMLTttxListElement;
154
- new (): HTMLTttxListElement;
155
- };
156
87
  interface HTMLTttxLoadingSpinnerElement extends Components.TttxLoadingSpinner, HTMLStencilElement {
157
88
  }
158
89
  var HTMLTttxLoadingSpinnerElement: {
159
90
  prototype: HTMLTttxLoadingSpinnerElement;
160
91
  new (): HTMLTttxLoadingSpinnerElement;
161
92
  };
162
- interface HTMLTttxPopoverContentElement extends Components.TttxPopoverContent, HTMLStencilElement {
163
- }
164
- var HTMLTttxPopoverContentElement: {
165
- prototype: HTMLTttxPopoverContentElement;
166
- new (): HTMLTttxPopoverContentElement;
167
- };
168
93
  interface HTMLTttxStandaloneInputElement extends Components.TttxStandaloneInput, HTMLStencilElement {
169
94
  }
170
95
  var HTMLTttxStandaloneInputElement: {
171
96
  prototype: HTMLTttxStandaloneInputElement;
172
97
  new (): HTMLTttxStandaloneInputElement;
173
98
  };
174
- interface HTMLTttxTableElement extends Components.TttxTable, HTMLStencilElement {
175
- }
176
- var HTMLTttxTableElement: {
177
- prototype: HTMLTttxTableElement;
178
- new (): HTMLTttxTableElement;
179
- };
180
99
  interface HTMLElementTagNameMap {
181
100
  "tttx-button": HTMLTttxButtonElement;
182
- "tttx-checkbox": HTMLTttxCheckboxElement;
183
- "tttx-form": HTMLTttxFormElement;
184
101
  "tttx-icon": HTMLTttxIconElement;
185
- "tttx-input-calendar": HTMLTttxInputCalendarElement;
186
102
  "tttx-keyvalue-block": HTMLTttxKeyvalueBlockElement;
187
- "tttx-list": HTMLTttxListElement;
188
103
  "tttx-loading-spinner": HTMLTttxLoadingSpinnerElement;
189
- "tttx-popover-content": HTMLTttxPopoverContentElement;
190
104
  "tttx-standalone-input": HTMLTttxStandaloneInputElement;
191
- "tttx-table": HTMLTttxTableElement;
192
105
  }
193
106
  }
194
107
  declare namespace LocalJSX {
@@ -198,47 +111,18 @@ declare namespace LocalJSX {
198
111
  "iconposition"?: 'left' | 'right';
199
112
  "notext"?: boolean;
200
113
  }
201
- interface TttxCheckbox {
202
- "label"?: string;
203
- "onValueChanged"?: (event: TttxCheckboxCustomEvent<boolean>) => void;
204
- "required"?: boolean;
205
- "value"?: boolean;
206
- }
207
- interface TttxForm {
208
- "formschema"?: any;
209
- "onDataChanged"?: (event: TttxFormCustomEvent<{ name: string, value: any }>) => void;
210
- "onDataSubmitted"?: (event: TttxFormCustomEvent<FormData>) => void;
211
- "submitValue"?: any;
212
- }
213
114
  interface TttxIcon {
214
115
  "color"?: string;
215
116
  "icon"?: string;
216
117
  }
217
- interface TttxInputCalendar {
218
- "months"?: boolean;
219
- "years"?: boolean;
220
- }
221
118
  interface TttxKeyvalueBlock {
222
119
  "horizontal"?: boolean;
223
120
  "keyvalues"?: any | any[] | string;
224
121
  }
225
- interface TttxList {
226
- "name"?: string;
227
- "onListItemClick"?: (event: TttxListCustomEvent<any>) => void;
228
- "onListPaginate"?: (event: TttxListCustomEvent<any>) => void;
229
- "onListSelectedEvent"?: (event: TttxListCustomEvent<any>) => void;
230
- "selectable"?: boolean;
231
- }
232
122
  interface TttxLoadingSpinner {
233
123
  "loadingMessage"?: boolean;
234
124
  "size"?: 'small' | 'large';
235
125
  }
236
- interface TttxPopoverContent {
237
- "body"?: string;
238
- "header"?: string;
239
- "linkcontext"?: string;
240
- "linktext"?: string;
241
- }
242
126
  interface TttxStandaloneInput {
243
127
  "autocomplete"?: 'off' | 'on';
244
128
  "checked"?: boolean;
@@ -278,26 +162,12 @@ declare namespace LocalJSX {
278
162
  "type"?: string;
279
163
  "value"?: string | number;
280
164
  }
281
- interface TttxTable {
282
- "data"?: any[];
283
- "headers"?: any[];
284
- "loading"?: boolean;
285
- "onHeaderClicked"?: (event: TttxTableCustomEvent<any>) => void;
286
- "onRowSelected"?: (event: TttxTableCustomEvent<any>) => void;
287
- "selected"?: number;
288
- }
289
165
  interface IntrinsicElements {
290
166
  "tttx-button": TttxButton;
291
- "tttx-checkbox": TttxCheckbox;
292
- "tttx-form": TttxForm;
293
167
  "tttx-icon": TttxIcon;
294
- "tttx-input-calendar": TttxInputCalendar;
295
168
  "tttx-keyvalue-block": TttxKeyvalueBlock;
296
- "tttx-list": TttxList;
297
169
  "tttx-loading-spinner": TttxLoadingSpinner;
298
- "tttx-popover-content": TttxPopoverContent;
299
170
  "tttx-standalone-input": TttxStandaloneInput;
300
- "tttx-table": TttxTable;
301
171
  }
302
172
  }
303
173
  export { LocalJSX as JSX };
@@ -305,16 +175,10 @@ declare module "@stencil/core" {
305
175
  export namespace JSX {
306
176
  interface IntrinsicElements {
307
177
  "tttx-button": LocalJSX.TttxButton & JSXBase.HTMLAttributes<HTMLTttxButtonElement>;
308
- "tttx-checkbox": LocalJSX.TttxCheckbox & JSXBase.HTMLAttributes<HTMLTttxCheckboxElement>;
309
- "tttx-form": LocalJSX.TttxForm & JSXBase.HTMLAttributes<HTMLTttxFormElement>;
310
178
  "tttx-icon": LocalJSX.TttxIcon & JSXBase.HTMLAttributes<HTMLTttxIconElement>;
311
- "tttx-input-calendar": LocalJSX.TttxInputCalendar & JSXBase.HTMLAttributes<HTMLTttxInputCalendarElement>;
312
179
  "tttx-keyvalue-block": LocalJSX.TttxKeyvalueBlock & JSXBase.HTMLAttributes<HTMLTttxKeyvalueBlockElement>;
313
- "tttx-list": LocalJSX.TttxList & JSXBase.HTMLAttributes<HTMLTttxListElement>;
314
180
  "tttx-loading-spinner": LocalJSX.TttxLoadingSpinner & JSXBase.HTMLAttributes<HTMLTttxLoadingSpinnerElement>;
315
- "tttx-popover-content": LocalJSX.TttxPopoverContent & JSXBase.HTMLAttributes<HTMLTttxPopoverContentElement>;
316
181
  "tttx-standalone-input": LocalJSX.TttxStandaloneInput & JSXBase.HTMLAttributes<HTMLTttxStandaloneInputElement>;
317
- "tttx-table": LocalJSX.TttxTable & JSXBase.HTMLAttributes<HTMLTttxTableElement>;
318
182
  }
319
183
  }
320
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3t-transform/threeteeui",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "3t Design System",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "build": "stencil build --docs",
19
19
  "start": "stencil build --watch --serve",
20
20
  "test": "stencil test --spec --e2e",
21
- "coverage": "yarn test -- --coverage --no-cache",
21
+ "coverage": "yarn test --coverage --no-cache",
22
22
  "test.watch": "stencil test --spec --e2e --watchAll",
23
23
  "generate": "stencil generate",
24
24
  "storybook": "storybook dev -p 6006",
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-bf777121.js');
6
-
7
- 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}";
8
-
9
- const TttxCheckbox = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.valueChanged = index.createEvent(this, "valueChanged", 7);
13
- this.value = undefined;
14
- this.label = undefined;
15
- this.required = undefined;
16
- }
17
- handleClick(event) {
18
- const target = event.target;
19
- this.value = target.checked;
20
- this.valueChanged.emit(target.checked);
21
- }
22
- render() {
23
- return (index.h(index.Host, null, index.h("div", { class: "field spacing" }, this.label && (index.h("label", { class: "label" }, this.label, !this.required ? index.h("span", { class: "optional" }, " (optional)") : '')), index.h("input", { type: "checkbox", class: "input", onChange: event => this.handleClick(event), checked: this.value }))));
24
- }
25
- };
26
- TttxCheckbox.style = tttxCheckboxCss;
27
-
28
- exports.tttx_checkbox = TttxCheckbox;
@@ -1,374 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-bf777121.js');
6
-
7
- 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{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;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-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #D5D5D5}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #D5D5D5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:hover{background:#146EB3;border:1px solid #146EB3}.primary:active{background:#1464A2;border:1px solid #1464A2}.borderless{background:transparent;border:none;color:#212121}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.danger{background:#DC0000;border:1px solid #DC0000;color:white}.danger:hover{background:#C60000;border:1px solid #C60000}.danger:active{background:#B00000;border:1px solid #B00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}:host{display:block}fieldset{margin:0;padding:0;border:none}input[type=submit]{margin-left:auto}";
8
-
9
- const TttxForm = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.dataSubmitted = index.createEvent(this, "dataSubmitted", 7);
13
- this.dataChanged = index.createEvent(this, "dataChanged", 7);
14
- // Create a new template element using the HTMLTemplateElement interface.
15
- this.template = document.createElement('template');
16
- this.formschema = undefined;
17
- this.submitValue = undefined;
18
- }
19
- // This method is called whenever the "formschema" property changes
20
- onFormSchemaChange(newValue) {
21
- // Check if the new value is a string, indicating that it needs to be parsed
22
- if (typeof newValue === 'string') {
23
- // Parse the string and set the "_formSchema" property
24
- this._formSchema = JSON.parse(newValue);
25
- }
26
- else {
27
- // If the new value is already an object, set the "_formSchema" property directly
28
- this._formSchema = newValue;
29
- }
30
- }
31
- /**
32
- * Handles the focus event for a form field and emits a "dataChanged" event
33
- * to the parent component with the field name and its new value.
34
- *
35
- * @param {FocusEvent} event - The focus event triggered by the field.
36
- * @return {void}
37
- */
38
- fieldChanged(event) {
39
- // Extract the name and value of the field from the event
40
- const fieldName = event.target.name;
41
- const fieldValue = event.target.value;
42
- // Emit an event to signal that the field's data has changed
43
- this.dataChanged.emit({ name: fieldName, value: fieldValue });
44
- }
45
- /**
46
- * Validates the input field on focusout event by checking its validity state,
47
- * sets an error message if there's an issue, and emits a "dataChanged" event to
48
- * the parent component with the field name and its new value.
49
- *
50
- * @param {FocusEvent} event - The focusout event triggered by the input field.
51
- * @return {void}
52
- */
53
- validityCheck(event) {
54
- var _a, _b, _c, _d;
55
- event.preventDefault();
56
- const target = event.target;
57
- let hasError = true;
58
- let errorMessage = '';
59
- // validity object on HTML5 inputs has the following options
60
- // badInput
61
- // customError
62
- // patternMismatch
63
- // rangeOverflow
64
- // rangeUnderflow
65
- // stepMismatch
66
- // tooLong
67
- // tooShort
68
- // typeMismatch
69
- // valid
70
- // valueMissing
71
- // customErrors can be set with
72
- // target.setCustomValidity('custom error!');
73
- // and cleared with
74
- // target.setCustomValidity('');
75
- // Check the validity of the input field and set an error message if needed
76
- switch (true) {
77
- // The field is required, but has no value
78
- case target.validity.valueMissing:
79
- errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
80
- break;
81
- // The field's value does not match the expected pattern
82
- case target.validity.patternMismatch:
83
- errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
84
- break;
85
- // The field's value is not of the correct input type
86
- case target.validity.badInput:
87
- // IE string in a number field
88
- errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
89
- break;
90
- // The field's value is above or below the range set in the "min" and "max" attributes
91
- case target.validity.rangeOverflow || target.validity.rangeUnderflow:
92
- // IE date or number is above or below value set in min or max tags
93
- errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
94
- break;
95
- // No error detected
96
- default:
97
- hasError = false;
98
- }
99
- // Set the error state of the input field based on the error message and whether an error was detected
100
- this.setErrorState(target, hasError, errorMessage);
101
- }
102
- /**
103
- * Sets the error state of an input field by updating its class and error message.
104
- * If an error was detected, it sets the input field's class to "invalid" and
105
- * displays the error message in an error bubble. If no error was detected,
106
- * it removes the "invalid" class from the input field and clears the error bubble.
107
- *
108
- * @param {HTMLInputElement} target - The input field to update.
109
- * @param {boolean} hasError - Whether an error was detected in the field.
110
- * @param {string} errorMessage - The error message to display (if any).
111
- * @return {void}
112
- */
113
- setErrorState(target, hasError, errorMessage) {
114
- // Find the error bubble element for the input field
115
- const errorBubble = target.parentElement.querySelector('.errorBubble');
116
- // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
117
- if (hasError) {
118
- target.className = 'invalid';
119
- const errorIcon = this.createErrorIcon();
120
- errorBubble.replaceChildren(errorIcon, errorMessage);
121
- }
122
- // If no error was detected, remove the "invalid" class from the input field and clear the error bubble
123
- else {
124
- target.className = '';
125
- errorBubble.replaceChildren();
126
- }
127
- }
128
- // Create an error icon element to display in the error bubble of an input field
129
- createErrorIcon() {
130
- // Create a new <span> element to serve as the error icon
131
- const errorIcon = document.createElement('span');
132
- // Set the class of the error icon to a pre-defined CSS class that specifies the icon's appearance
133
- errorIcon.className = 'material-symbols-rounded';
134
- // Set the text content of the error icon to the word "warning"
135
- errorIcon.textContent = 'warning';
136
- // Return the error icon element
137
- return errorIcon;
138
- }
139
- /**
140
- * Submits the form data to the server.
141
- *
142
- * @param {SubmitEvent} event - The event object for the form submission.
143
- * @returns {void}
144
- *
145
- * @example
146
- * const form = document.getElementById('myForm');
147
- * form.addEventListener('submit', (event) => {
148
- * doSubmit(event);
149
- * });
150
- */
151
- doSubmit(event) {
152
- // prevent the form from submitting normally
153
- event.preventDefault();
154
- // create a new FormData object with the form data
155
- const formData = new FormData(event.target);
156
- // emit the form data through the `dataSubmitted` event
157
- this.dataSubmitted.emit(formData);
158
- }
159
- // This method is called before the component is loaded into the DOM
160
- componentWillLoad() {
161
- // Initialize the form schema by calling the "onFormSchemaChange" method with the current "formschema" property
162
- this.onFormSchemaChange(this.formschema);
163
- }
164
- // This method is called before the component is rendered
165
- componentWillRender() {
166
- // Clear the template to account for a potential re-render scenario
167
- this.template = document.createElement('template');
168
- // Populate the form from the form schema
169
- this.populateFormFromSchema();
170
- }
171
- /**
172
- * Creates a new HTMLInputElement with the specified name, type, and placeholder (if any),
173
- * and sets its autocomplete and autocapitalization properties to off.
174
- *
175
- * @param {string} formKey - The name of the input field, as specified in the form schema.
176
- * @param {Object} formProperties - An object containing additional properties for the input field, such as its type and placeholder value.
177
- * @param {string} formProperties.type - The type of the input field (e.g., "text", "email", "number", etc.).
178
- * @param {string} [formProperties.placeholder] - An optional placeholder value to display in the input field.
179
- * @return {HTMLInputElement} - The new input element.
180
- */
181
- createInput(formKey, formProperties) {
182
- var _a;
183
- // Create a new <input> element with the specified name and type
184
- const input = document.createElement('input');
185
- input.name = formKey;
186
- input.type = formProperties.type;
187
- // Set the placeholder attribute to the specified value (if any)
188
- input.placeholder = (_a = formProperties.placeholder) !== null && _a !== void 0 ? _a : '';
189
- // Disable autocomplete and autocapitalization
190
- input.autocomplete = 'off';
191
- input.autocapitalize = 'off';
192
- // Return the input element
193
- return input;
194
- }
195
- /**
196
- * Applies validation attributes to an input element based on the specified validation object.
197
- * If a certain property is present in the object, it will set the corresponding attribute on
198
- * the input element (e.g., "required" will set the "required" and "data-required" attributes,
199
- * "pattern" will set the "pattern" and "data-pattern" attributes, etc.).
200
- *
201
- * @param {HTMLInputElement} input - The input element to apply validation attributes to.
202
- * @param {Object} validation - An object containing the validation rules for the input field.
203
- * @param {Object} [validation.required] - An object containing a "message" property to display if the field is required.
204
- * @param {Object} [validation.pattern] - An object containing a "pattern" property to match against the field value, and a "message" property to display if the pattern doesn't match.
205
- * @param {Object} [validation.badInput] - An object containing a "message" property to display if the field value is invalid.
206
- * @param {Object} [validation.minmax] - An object containing "min" and "max" properties to validate the field value against, and a "message" property to display if the value is out of range.
207
- * @param {string} [validation.maxlength] - The maximum length of the input field.
208
- * @return {void}
209
- */
210
- applyValidation(input, validation) {
211
- var _a, _b;
212
- // If the "required" property is present, add the "required" attribute to the input element and
213
- // set its "data-required" attribute to the specified message (if any)
214
- if (validation.required) {
215
- input.setAttribute('required', '');
216
- input.setAttribute('data-required', (_a = validation.required.message) !== null && _a !== void 0 ? _a : '');
217
- }
218
- // If the "pattern" property is present, add the "pattern" attribute to the input element and set
219
- // its "data-pattern" attribute to the specified message (if any)
220
- if (validation.pattern) {
221
- input.setAttribute('pattern', validation.pattern.pattern);
222
- input.setAttribute('data-pattern', (_b = validation.pattern.message) !== null && _b !== void 0 ? _b : '');
223
- }
224
- // If the "badInput" property is present, set the input element's "data-badinput" attribute to
225
- // the specified message
226
- if (validation.badInput) {
227
- input.setAttribute('data-badinput', validation.badInput.message);
228
- }
229
- // If the "minmax" property is present, add the "min" and "max" attributes to the input element
230
- // and set its "data-range" attribute to the specified message (if any)
231
- if (validation.minmax) {
232
- input.setAttribute('min', validation.minmax.min);
233
- input.setAttribute('max', validation.minmax.max);
234
- input.setAttribute('data-range', validation.minmax.message);
235
- }
236
- // If the "maxlength" property is present, add the "maxlength" attribute to the input element
237
- if (validation.maxlength) {
238
- input.setAttribute('maxlength', validation.maxlength);
239
- }
240
- }
241
- // Create a new error bubble element
242
- createErrorBubble() {
243
- // Create a new <div> element with the "errorBubble" class
244
- const errorBubble = document.createElement('div');
245
- errorBubble.className = 'errorBubble';
246
- // Return the error bubble element
247
- return errorBubble;
248
- }
249
- /**
250
- * Creates a new <label> element with the "inputBlock" class and the specified label text,
251
- * and appends the input element and error bubble element to it. If the form property has
252
- * no validation object, it adds an "optional" span element to the label.
253
- *
254
- * @param {Object} formProperties - An object containing properties for the form field, including its label text and validation rules.
255
- * @param {HTMLInputElement} input - The input element to associate with the label.
256
- * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
257
- * @return {HTMLLabelElement} - The new label element.
258
- */
259
- createLabel(formProperties, input, errorBubble) {
260
- // Create a new <label> element with the "inputBlock" class and the specified text
261
- const label = document.createElement('label');
262
- label.className = 'inputBlock';
263
- label.innerText = formProperties.label;
264
- // If the form property has no validation object, add an "optional" span element to the label
265
- if (!formProperties.validation) {
266
- const optionalSpan = document.createElement('span');
267
- optionalSpan.className = 'optional';
268
- optionalSpan.innerHTML = '&nbsp;(optional)';
269
- label.appendChild(optionalSpan);
270
- }
271
- // Append the input element and error bubble element to the label
272
- label.appendChild(input);
273
- label.appendChild(errorBubble);
274
- // Return the label element
275
- return label;
276
- }
277
- /**
278
- * Creates a new <input> element with the "submit" type, the "primary-blue" class, and the
279
- * specified label text (i.e., "Save" by default), and returns the new submit button element.
280
- *
281
- * @return {HTMLInputElement} - The new submit button element.
282
- */
283
- createSubmitButton() {
284
- // Create a new <input> element with the "submit" type and the specified class and value
285
- const submitButton = document.createElement('input');
286
- submitButton.type = 'submit';
287
- submitButton.className = 'button primary-blue';
288
- submitButton.value = 'Save';
289
- // Return the submit button element
290
- return submitButton;
291
- }
292
- /**
293
- * Populates the form template with input fields and labels based on the properties of the
294
- * current form schema. For each property in the schema, it creates an input element, applies
295
- * any validation rules to it, creates an error bubble and label element, and appends them
296
- * to the form template. Finally, it creates and appends a submit button element to the form.
297
- *
298
- * @return {void}
299
- */
300
- populateFormFromSchema() {
301
- // If there is no form schema, return early
302
- if (!this._formSchema)
303
- return;
304
- // Get the properties of the form schema and their keys
305
- const properties = this._formSchema.properties;
306
- const propertyKeys = Object.keys(properties);
307
- // Loop through each property key and create an input, label, and error bubble for it
308
- propertyKeys.forEach(formKey => {
309
- const formItem = properties[formKey];
310
- const formProperties = formItem.form;
311
- const input = this.createInput(formKey, formProperties);
312
- // If the form property has validation, apply it to the input
313
- if (formProperties.validation) {
314
- this.applyValidation(input, formProperties.validation);
315
- }
316
- // Create an error bubble and label element for the input
317
- const errorBubble = this.createErrorBubble();
318
- const label = this.createLabel(formProperties, input, errorBubble);
319
- // Append the label element to the form template
320
- this.template.content.append(label);
321
- });
322
- // Create and append a submit button element to the form template
323
- const submitButton = this.createSubmitButton();
324
- this.template.content.append(submitButton);
325
- }
326
- /**
327
- * Clones the form template and binds event listeners to its input elements. First, it checks if
328
- * there is a form schema present. If so, it clones the template's content, binds events to form
329
- * input elements, and appends the cloned form elements to the fieldset. The event listeners include
330
- * "oninvalid" (to check input validity on submit), "onblur" (to check input validity on blur),
331
- * "onkeyup" (to handle changes in input fields), and "onchange" (to handle changes in select fields).
332
- *
333
- * @return {void}
334
- */
335
- componentDidRender() {
336
- // If there's no form schema, return
337
- if (!this._formSchema) {
338
- return;
339
- }
340
- // Clone the template's content and store it in a variable
341
- const formItems = this.template.content.cloneNode(true);
342
- // Bind event listeners to form elements
343
- const properties = this._formSchema.properties;
344
- const propertyKeys = Object.keys(properties);
345
- propertyKeys.forEach((formKey) => {
346
- const formInput = formItems.querySelector(`[name=${formKey}]`);
347
- // Bind events to form input elements
348
- formInput.oninvalid = this.validityCheck.bind(this);
349
- formInput.onblur = this.validityCheck.bind(this);
350
- formInput.onkeyup = this.fieldChanged.bind(this);
351
- formInput.onchange = this.fieldChanged.bind(this);
352
- });
353
- // Append the cloned form elements to the fieldset
354
- this.fieldset.appendChild(formItems);
355
- }
356
- /**
357
- * Renders the component's template as a form element with a fieldset container. The form's
358
- * "onSubmit" event is bound to the "doSubmit" function, which handles the form submission
359
- * and emits a "dataSubmitted" event with the form data. The fieldset element is assigned
360
- * to the "fieldset" instance variable using a ref, so it can be populated with form elements
361
- * later on.
362
- *
363
- * @return {JSX.Element} - The rendered form template as a JSX element.
364
- */
365
- render() {
366
- return (index.h(index.Host, null, index.h("form", { onSubmit: this.doSubmit.bind(this) }, index.h("fieldset", { ref: el => (this.fieldset = el) }))));
367
- }
368
- static get watchers() { return {
369
- "formschema": ["onFormSchemaChange"]
370
- }; }
371
- };
372
- TttxForm.style = tttxFormCss;
373
-
374
- exports.tttx_form = TttxForm;