@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
package/readme.md CHANGED
@@ -1,86 +1,89 @@
1
- ## TTTX Library Vision
2
-
3
- - To create versioned components where each micro-frontend may use any version it chooses.
4
- - Why? - Our root frontend contains many micro-frontends. Each one might have a diffrent version of these components loaded at any time. We must not let a change in one MFE affect another MFE loaded at the same time.
5
- - To keep the components extremely lightweight, use as few dependencies as possible. Keep the individual components in the low KB, not the MB.
6
- - Why? - When there are multiple versions of the same component loaded, we need to keep them extremely lightweight. Most simple components can be executed in a few dozen KB.
7
- - No CSS frameworks. Use only the minimum styles to get the job done.
8
- - Why? - This means we can be sure that we only load code we are actually using.
9
- - No external styles. A component must style itself and be inside a shadow DOM so that styles from the external application cannot leak inside.
10
- - Why? - We cannot have any components being affected by the styles of the surrunding application. The component must be entirely self-contained.
11
- - No leaking styles. A component must not infect the application with its styles.
12
- - Why? - The same goes both ways, the component styles must not affect the surrounding application.
13
- - Create only components as we need them. YAGNI applies.
14
- - Why? - It's about Agile. We need to deliver value to the customer (our develoeprs) as soon as possible for their feedback, and so they can deliver value to their customer (our users). If a certain component is required, it will crop up, and then we will make it.
15
-
16
- ## Getting Started
17
-
18
- Pull down this repo and run:
19
-
20
- ```bash
21
- npm install
22
- npm start
23
- ```
24
-
25
- To build the component for production, run:
26
-
27
- ```bash
28
- npm run build
29
- ```
30
-
31
- To run the unit tests for the components, run:
32
-
33
- ```bash
34
- npm test
35
- ```
36
- To see the components in Storybook, run:
37
-
38
- ```
39
- npm run build
40
- npm run storybook
41
- ```
42
-
43
- Need help? Check out our [docs](https://stenciljs.com/docs/my-first-component).
44
-
45
- ## Naming Components
46
-
47
- When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
48
-
49
- Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix `ion`.
50
-
51
- We suggest: `<tttx-button>` for example.
52
-
53
- ## Testing Components
54
-
55
- Stencil uses a testing framework built using Jest and Puppeteer. It provides support for two types of test: Unit and End-to-End.
56
-
57
- You can find out more form their [docs](https://stenciljs.com/docs/testing-overview)
58
-
59
- For our purposes, if you are creating a component that consumes a devextreme component which is itself a container for other components (e.g. a devextreme toolbar that contains a devextreme button), you will want to create an End-to-End test for that.
60
-
61
- This is because the helper method that builds a test page in the unit tests mocks out HTML elements, and the mock class it provides doesn't define all the methods that devextreme uses when attaching the component to the container, which causes the render to fail. The End-to-End tests build the component in the browser, so we're able to render them there.
62
-
63
- ## Using this component
64
-
65
- There are three strategies we recommend for using web components built with Stencil.
66
-
67
- The first step for all three of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
68
-
69
- - First, you need to [sign up](https://www.npmjs.com/signup) for an npm account. You will also need to ask an organisation owner to add you as a member of the @3t-transform organisation.
70
- - Update the `version` in the package.json.
71
- - Publish the new version with `npm publish @3t-transform/threeteeui`
72
-
73
- ### Script tag
74
-
75
- - Put a script tag similar to this `<script type='module' src='https://unpkg.com/my-component@0.0.1/dist/my-component.esm.js'></script>` in the head of your index.html
76
- - Then you can use the element anywhere in your template, JSX, html etc
77
-
78
- ### Node Modules
79
- - Run `npm install my-component --save`
80
- - Put a script tag similar to this `<script type='module' src='node_modules/my-component/dist/my-component.esm.js'></script>` in the head of your index.html
81
- - Then you can use the element anywhere in your template, JSX, html etc
82
-
83
- ### In a stencil-starter app
84
- - Run `npm install my-component --save`
85
- - Add an import to the npm packages `import my-component;`
86
- - Then you can use the element anywhere in your template, JSX, html etc
1
+ ## TTTX Library Vision
2
+
3
+ - To create versioned components where each micro-frontend may use any version it chooses.
4
+ - Why? - Our root frontend contains many micro-frontends. Each one might have a diffrent version of these components loaded at any time. We must not let a change in one MFE affect another MFE loaded at the same time.
5
+ - To keep the components extremely lightweight, use as few dependencies as possible. Keep the individual components in the low KB, not the MB.
6
+ - Why? - When there are multiple versions of the same component loaded, we need to keep them extremely lightweight. Most simple components can be executed in a few dozen KB.
7
+ - No CSS frameworks. Use only the minimum styles to get the job done.
8
+ - Why? - This means we can be sure that we only load code we are actually using.
9
+ - No external styles. A component must style itself and be inside a shadow DOM so that styles from the external application cannot leak inside.
10
+ - Why? - We cannot have any components being affected by the styles of the surrunding application. The component must be entirely self-contained.
11
+ - No leaking styles. A component must not infect the application with its styles.
12
+ - Why? - The same goes both ways, the component styles must not affect the surrounding application.
13
+ - Create only components as we need them. YAGNI applies.
14
+ - Why? - It's about Agile. We need to deliver value to the customer (our develoeprs) as soon as possible for their feedback, and so they can deliver value to their customer (our users). If a certain component is required, it will crop up, and then we will make it.
15
+
16
+ ## Getting Started
17
+
18
+ Pull down this repo and run:
19
+
20
+ ```bash
21
+ npm install
22
+ npm start
23
+ ```
24
+
25
+ To build the component for production, run:
26
+
27
+ ```bash
28
+ npm run build
29
+ ```
30
+
31
+ To run the unit tests for the components, run:
32
+
33
+ ```bash
34
+ npm test
35
+ ```
36
+
37
+ To see the components in Storybook, run:
38
+
39
+ ```
40
+ npm run build
41
+ npm run storybook
42
+ ```
43
+
44
+ Need help? Check out our [docs](https://stenciljs.com/docs/my-first-component).
45
+
46
+ ## Naming Components
47
+
48
+ When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
49
+
50
+ Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix `ion`.
51
+
52
+ We suggest: `<tttx-button>` for example.
53
+
54
+ ## Testing Components
55
+
56
+ Stencil uses a testing framework built using Jest and Puppeteer. It provides support for two types of test: Unit and End-to-End.
57
+
58
+ You can find out more form their [docs](https://stenciljs.com/docs/testing-overview)
59
+
60
+ For our purposes, if you are creating a component that consumes a devextreme component which is itself a container for other components (e.g. a devextreme toolbar that contains a devextreme button), you will want to create an End-to-End test for that.
61
+
62
+ This is because the helper method that builds a test page in the unit tests mocks out HTML elements, and the mock class it provides doesn't define all the methods that devextreme uses when attaching the component to the container, which causes the render to fail. The End-to-End tests build the component in the browser, so we're able to render them there.
63
+
64
+ ## Using this component
65
+
66
+ There are three strategies we recommend for using web components built with Stencil.
67
+
68
+ The first step for all three of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
69
+
70
+ - First, you need to [sign up](https://www.npmjs.com/signup) for an npm account. You will also need to ask an organisation owner to add you as a member of the @3t-transform organisation.
71
+ - Update the `version` in the package.json.
72
+ - Publish the new version with `npm publish @3t-transform/threeteeui`
73
+
74
+ ### Script tag
75
+
76
+ - Put a script tag similar to this `<script type='module' src='https://unpkg.com/my-component@0.0.1/dist/my-component.esm.js'></script>` in the head of your index.html
77
+ - Then you can use the element anywhere in your template, JSX, html etc
78
+
79
+ ### Node Modules
80
+
81
+ - Run `npm install my-component --save`
82
+ - Put a script tag similar to this `<script type='module' src='node_modules/my-component/dist/my-component.esm.js'></script>` in the head of your index.html
83
+ - Then you can use the element anywhere in your template, JSX, html etc
84
+
85
+ ### In a stencil-starter app
86
+
87
+ - Run `npm install my-component --save`
88
+ - Add an import to the npm packages `import my-component;`
89
+ - Then you can use the element anywhere in your template, JSX, html etc
@@ -1,44 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-8a4cb9bc.js');
6
-
7
- const tttxInputCss = ".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}.errorstate{border-color:#DC0000}.icon-right{margin-top:5px;margin-right:4px}.icon-left{margin-top:5px;margin-left:4px}";
8
-
9
- const TttxInput = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.valueChanged = index.createEvent(this, "valueChanged", 7);
13
- this.handleFocus = () => {
14
- this.isfocused = true;
15
- };
16
- this.handleBlur = () => {
17
- this.isfocused = false;
18
- };
19
- this.isfocused = false;
20
- this.label = undefined;
21
- this.valid = undefined;
22
- this.showerrormsg = undefined;
23
- this.errormsg = undefined;
24
- this.value = undefined;
25
- this.type = 'text';
26
- this.placeholder = undefined;
27
- this.pattern = undefined;
28
- this.iconleft = undefined;
29
- this.iconright = undefined;
30
- this.required = undefined;
31
- }
32
- handleChange(event) {
33
- const target = event.target;
34
- this.value = target.value;
35
- this.valueChanged.emit(target.value);
36
- }
37
- render() {
38
- const inputClass = ['container', this.showerrormsg ? 'errorstate' : '', this.isfocused ? 'focused' : '', this.iconleft ? 'iconleft' : ''].join(' ');
39
- 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("div", { class: inputClass }, this.iconleft && (index.h("div", { class: "icon-left" }, index.h("tttx-icon", { icon: this.iconleft, colour: "grey" }))), index.h("input", { class: "input", onFocus: this.handleFocus.bind(this), onBlur: this.handleBlur.bind(this), type: this.type, placeholder: this.placeholder, value: this.value, onInput: event => this.handleChange(event) }), this.iconright && (index.h("div", { class: "icon-right" }, index.h("tttx-icon", { icon: this.iconright, colour: "grey" })))), this.showerrormsg && this.errormsg && index.h("div", { class: "errormsg" }, index.h("span", { class: "material-symbols-rounded validationicon" }, "warning"), " ", this.errormsg))));
40
- }
41
- };
42
- TttxInput.style = tttxInputCss;
43
-
44
- exports.tttx_input = TttxInput;
@@ -1,259 +0,0 @@
1
- import { Host, h } from '@stencil/core';
2
- export class TttxInput {
3
- constructor() {
4
- this.handleFocus = () => {
5
- this.isfocused = true;
6
- };
7
- this.handleBlur = () => {
8
- this.isfocused = false;
9
- };
10
- this.isfocused = false;
11
- this.label = undefined;
12
- this.valid = undefined;
13
- this.showerrormsg = undefined;
14
- this.errormsg = undefined;
15
- this.value = undefined;
16
- this.type = 'text';
17
- this.placeholder = undefined;
18
- this.pattern = undefined;
19
- this.iconleft = undefined;
20
- this.iconright = undefined;
21
- this.required = undefined;
22
- }
23
- handleChange(event) {
24
- const target = event.target;
25
- this.value = target.value;
26
- this.valueChanged.emit(target.value);
27
- }
28
- render() {
29
- const inputClass = ['container', this.showerrormsg ? 'errorstate' : '', this.isfocused ? 'focused' : '', this.iconleft ? 'iconleft' : ''].join(' ');
30
- 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("div", { class: inputClass }, this.iconleft && (h("div", { class: "icon-left" }, h("tttx-icon", { icon: this.iconleft, colour: "grey" }))), h("input", { class: "input", onFocus: this.handleFocus.bind(this), onBlur: this.handleBlur.bind(this), type: this.type, placeholder: this.placeholder, value: this.value, onInput: event => this.handleChange(event) }), this.iconright && (h("div", { class: "icon-right" }, h("tttx-icon", { icon: this.iconright, colour: "grey" })))), this.showerrormsg && this.errormsg && h("div", { class: "errormsg" }, h("span", { class: "material-symbols-rounded validationicon" }, "warning"), " ", this.errormsg))));
31
- }
32
- static get is() { return "tttx-input"; }
33
- static get encapsulation() { return "shadow"; }
34
- static get originalStyleUrls() {
35
- return {
36
- "$": ["tttx-input.scss"]
37
- };
38
- }
39
- static get styleUrls() {
40
- return {
41
- "$": ["tttx-input.css"]
42
- };
43
- }
44
- static get properties() {
45
- return {
46
- "label": {
47
- "type": "string",
48
- "mutable": false,
49
- "complexType": {
50
- "original": "string",
51
- "resolved": "string",
52
- "references": {}
53
- },
54
- "required": false,
55
- "optional": false,
56
- "docs": {
57
- "tags": [],
58
- "text": ""
59
- },
60
- "attribute": "label",
61
- "reflect": false
62
- },
63
- "valid": {
64
- "type": "boolean",
65
- "mutable": false,
66
- "complexType": {
67
- "original": "boolean",
68
- "resolved": "boolean",
69
- "references": {}
70
- },
71
- "required": false,
72
- "optional": false,
73
- "docs": {
74
- "tags": [],
75
- "text": ""
76
- },
77
- "attribute": "valid",
78
- "reflect": false
79
- },
80
- "showerrormsg": {
81
- "type": "boolean",
82
- "mutable": false,
83
- "complexType": {
84
- "original": "boolean",
85
- "resolved": "boolean",
86
- "references": {}
87
- },
88
- "required": false,
89
- "optional": false,
90
- "docs": {
91
- "tags": [],
92
- "text": ""
93
- },
94
- "attribute": "showerrormsg",
95
- "reflect": false
96
- },
97
- "errormsg": {
98
- "type": "string",
99
- "mutable": false,
100
- "complexType": {
101
- "original": "string",
102
- "resolved": "string",
103
- "references": {}
104
- },
105
- "required": false,
106
- "optional": false,
107
- "docs": {
108
- "tags": [],
109
- "text": ""
110
- },
111
- "attribute": "errormsg",
112
- "reflect": false
113
- },
114
- "value": {
115
- "type": "string",
116
- "mutable": true,
117
- "complexType": {
118
- "original": "string",
119
- "resolved": "string",
120
- "references": {}
121
- },
122
- "required": false,
123
- "optional": false,
124
- "docs": {
125
- "tags": [],
126
- "text": ""
127
- },
128
- "attribute": "value",
129
- "reflect": false
130
- },
131
- "type": {
132
- "type": "string",
133
- "mutable": false,
134
- "complexType": {
135
- "original": "string",
136
- "resolved": "string",
137
- "references": {}
138
- },
139
- "required": false,
140
- "optional": false,
141
- "docs": {
142
- "tags": [],
143
- "text": ""
144
- },
145
- "attribute": "type",
146
- "reflect": false,
147
- "defaultValue": "'text'"
148
- },
149
- "placeholder": {
150
- "type": "string",
151
- "mutable": false,
152
- "complexType": {
153
- "original": "string",
154
- "resolved": "string",
155
- "references": {}
156
- },
157
- "required": false,
158
- "optional": false,
159
- "docs": {
160
- "tags": [],
161
- "text": ""
162
- },
163
- "attribute": "placeholder",
164
- "reflect": false
165
- },
166
- "pattern": {
167
- "type": "string",
168
- "mutable": false,
169
- "complexType": {
170
- "original": "string",
171
- "resolved": "string",
172
- "references": {}
173
- },
174
- "required": false,
175
- "optional": false,
176
- "docs": {
177
- "tags": [],
178
- "text": ""
179
- },
180
- "attribute": "pattern",
181
- "reflect": false
182
- },
183
- "iconleft": {
184
- "type": "string",
185
- "mutable": false,
186
- "complexType": {
187
- "original": "string",
188
- "resolved": "string",
189
- "references": {}
190
- },
191
- "required": false,
192
- "optional": false,
193
- "docs": {
194
- "tags": [],
195
- "text": ""
196
- },
197
- "attribute": "iconleft",
198
- "reflect": false
199
- },
200
- "iconright": {
201
- "type": "string",
202
- "mutable": false,
203
- "complexType": {
204
- "original": "string",
205
- "resolved": "string",
206
- "references": {}
207
- },
208
- "required": false,
209
- "optional": false,
210
- "docs": {
211
- "tags": [],
212
- "text": ""
213
- },
214
- "attribute": "iconright",
215
- "reflect": false
216
- },
217
- "required": {
218
- "type": "boolean",
219
- "mutable": false,
220
- "complexType": {
221
- "original": "boolean",
222
- "resolved": "boolean",
223
- "references": {}
224
- },
225
- "required": false,
226
- "optional": false,
227
- "docs": {
228
- "tags": [],
229
- "text": ""
230
- },
231
- "attribute": "required",
232
- "reflect": false
233
- }
234
- };
235
- }
236
- static get states() {
237
- return {
238
- "isfocused": {}
239
- };
240
- }
241
- static get events() {
242
- return [{
243
- "method": "valueChanged",
244
- "name": "valueChanged",
245
- "bubbles": true,
246
- "cancelable": true,
247
- "composed": true,
248
- "docs": {
249
- "tags": [],
250
- "text": ""
251
- },
252
- "complexType": {
253
- "original": "string",
254
- "resolved": "string",
255
- "references": {}
256
- }
257
- }];
258
- }
259
- }
@@ -1,106 +0,0 @@
1
- import icons from '../../../icons';
2
- export default {
3
- title: 'Molecules/Text Input',
4
- component: 'tttx-input',
5
- argTypes: {
6
- iconleft: {
7
- options: icons,
8
- control: { type: 'select' },
9
- },
10
- iconright: {
11
- options: icons,
12
- control: { type: 'select' },
13
- },
14
- type: {
15
- options: ['text', 'password', 'email', 'number'],
16
- control: { type: 'radio' },
17
- },
18
- value: {
19
- control: { type: 'text' },
20
- },
21
- label: {
22
- control: { type: 'text' },
23
- },
24
- required: {
25
- control: { type: 'boolean' },
26
- },
27
- errormsg: {
28
- control: { type: 'text' },
29
- },
30
- showerrormsg: {
31
- control: { type: 'boolean' },
32
- },
33
- placeholder: {
34
- control: { type: 'text' },
35
- },
36
- },
37
- };
38
- const TemplateTextInput = ({ value, label, iconleft, iconright, type, required, errormsg, showerrormsg, placeholder }) => `
39
- <tttx-input
40
- placeholder="${placeholder}"
41
- iconleft="${iconleft || ''}"
42
- iconright="${iconright || ''}"
43
- value="${value}"
44
- label="${label}"
45
- type="${type}"
46
- errormsg="${errormsg}"
47
- ${required ? `required` : ''}
48
- ${showerrormsg ? `showerrormsg` : ''}
49
- ></tttx-input>
50
- `;
51
- export const TextInputBasic = TemplateTextInput.bind({});
52
- TextInputBasic.args = {
53
- value: 'Uh egg',
54
- label: 'Please tell me about your egg',
55
- iconleft: 'egg',
56
- type: 'text',
57
- errormsg: 'Incorrect egg, please egg again.',
58
- required: true,
59
- showerrormsg: true,
60
- placeholder: 'Please for the love of god tell me about your egg',
61
- };
62
- export const TextInputIconRight = TemplateTextInput.bind({});
63
- TextInputIconRight.args = {
64
- value: 'Uh egg',
65
- label: 'Please tell me about your egg',
66
- iconright: 'egg',
67
- type: 'text',
68
- errormsg: 'Incorrect egg, please egg again.',
69
- required: true,
70
- showerrormsg: true,
71
- placeholder: 'Please for the love of god tell me about your egg',
72
- };
73
- export const PasswordInputBasic = TemplateTextInput.bind({});
74
- PasswordInputBasic.args = {
75
- value: 'qwefdweferg',
76
- label: 'Input your Password',
77
- iconleft: 'lock',
78
- type: 'password',
79
- errormsg: 'Password is not strong enough',
80
- required: true,
81
- showerrormsg: true,
82
- placeholder: 'Your password',
83
- };
84
- export const EmailInputBasic = TemplateTextInput.bind({});
85
- EmailInputBasic.args = {
86
- value: 'email.address@website.com',
87
- label: 'Choose an email address',
88
- iconleft: 'mail',
89
- type: 'email',
90
- errormsg: 'This email smells funny',
91
- required: true,
92
- valid: false,
93
- showerrormsg: true,
94
- placeholder: 'Your email address',
95
- };
96
- export const NumberInputBasic = TemplateTextInput.bind({});
97
- NumberInputBasic.args = {
98
- value: '42069',
99
- label: 'What is your favourite number?',
100
- iconleft: '123',
101
- type: 'number',
102
- errormsg: 'This number feels wrong',
103
- required: true,
104
- showerrormsg: true,
105
- placeholder: 'Your favourite number',
106
- };
@@ -1,77 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$2 } from './tttx-icon2.js';
3
-
4
- const tttxInputCss = ".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}.errorstate{border-color:#DC0000}.icon-right{margin-top:5px;margin-right:4px}.icon-left{margin-top:5px;margin-left:4px}";
5
-
6
- const TttxInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.__attachShadow();
11
- this.valueChanged = createEvent(this, "valueChanged", 7);
12
- this.handleFocus = () => {
13
- this.isfocused = true;
14
- };
15
- this.handleBlur = () => {
16
- this.isfocused = false;
17
- };
18
- this.isfocused = false;
19
- this.label = undefined;
20
- this.valid = undefined;
21
- this.showerrormsg = undefined;
22
- this.errormsg = undefined;
23
- this.value = undefined;
24
- this.type = 'text';
25
- this.placeholder = undefined;
26
- this.pattern = undefined;
27
- this.iconleft = undefined;
28
- this.iconright = undefined;
29
- this.required = undefined;
30
- }
31
- handleChange(event) {
32
- const target = event.target;
33
- this.value = target.value;
34
- this.valueChanged.emit(target.value);
35
- }
36
- render() {
37
- const inputClass = ['container', this.showerrormsg ? 'errorstate' : '', this.isfocused ? 'focused' : '', this.iconleft ? 'iconleft' : ''].join(' ');
38
- 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("div", { class: inputClass }, this.iconleft && (h("div", { class: "icon-left" }, h("tttx-icon", { icon: this.iconleft, colour: "grey" }))), h("input", { class: "input", onFocus: this.handleFocus.bind(this), onBlur: this.handleBlur.bind(this), type: this.type, placeholder: this.placeholder, value: this.value, onInput: event => this.handleChange(event) }), this.iconright && (h("div", { class: "icon-right" }, h("tttx-icon", { icon: this.iconright, colour: "grey" })))), this.showerrormsg && this.errormsg && h("div", { class: "errormsg" }, h("span", { class: "material-symbols-rounded validationicon" }, "warning"), " ", this.errormsg))));
39
- }
40
- static get style() { return tttxInputCss; }
41
- }, [1, "tttx-input", {
42
- "label": [1],
43
- "valid": [4],
44
- "showerrormsg": [4],
45
- "errormsg": [1],
46
- "value": [1025],
47
- "type": [1],
48
- "placeholder": [1],
49
- "pattern": [1],
50
- "iconleft": [1],
51
- "iconright": [1],
52
- "required": [4],
53
- "isfocused": [32]
54
- }]);
55
- function defineCustomElement$1() {
56
- if (typeof customElements === "undefined") {
57
- return;
58
- }
59
- const components = ["tttx-input", "tttx-icon"];
60
- components.forEach(tagName => { switch (tagName) {
61
- case "tttx-input":
62
- if (!customElements.get(tagName)) {
63
- customElements.define(tagName, TttxInput$1);
64
- }
65
- break;
66
- case "tttx-icon":
67
- if (!customElements.get(tagName)) {
68
- defineCustomElement$2();
69
- }
70
- break;
71
- } });
72
- }
73
-
74
- const TttxInput = TttxInput$1;
75
- const defineCustomElement = defineCustomElement$1;
76
-
77
- export { TttxInput, defineCustomElement };