@stencil-kit/core 0.0.1 → 0.0.2
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.
- package/dist/cjs/{index-BrMvRGjk.js → index-q0fPnkdL.js} +116 -4
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/my-alert.cjs.entry.js +35 -0
- package/dist/cjs/my-badge.cjs.entry.js +1 -1
- package/dist/cjs/my-button.cjs.entry.js +1 -1
- package/dist/cjs/my-card.cjs.entry.js +1 -1
- package/dist/cjs/my-component.cjs.entry.js +1 -1
- package/dist/cjs/my-dropdown.cjs.entry.js +45 -0
- package/dist/cjs/my-input.cjs.entry.js +28 -0
- package/dist/cjs/my-modal.cjs.entry.js +36 -0
- package/dist/cjs/stencil-library.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/my-alert/my-alert.css +96 -0
- package/dist/collection/components/my-alert/my-alert.js +122 -0
- package/dist/collection/components/my-dropdown/my-dropdown.css +111 -0
- package/dist/collection/components/my-dropdown/my-dropdown.js +198 -0
- package/dist/collection/components/my-input/my-input.css +58 -0
- package/dist/collection/components/my-input/my-input.js +204 -0
- package/dist/collection/components/my-modal/my-modal.css +88 -0
- package/dist/collection/components/my-modal/my-modal.js +119 -0
- package/dist/components/index.js +1 -1
- package/dist/components/my-alert.d.ts +11 -0
- package/dist/components/my-alert.js +1 -0
- package/dist/components/my-badge.js +1 -1
- package/dist/components/my-button.js +1 -1
- package/dist/components/my-card.js +1 -1
- package/dist/components/my-component.js +1 -1
- package/dist/components/my-dropdown.d.ts +11 -0
- package/dist/components/my-dropdown.js +1 -0
- package/dist/components/my-input.d.ts +11 -0
- package/dist/components/my-input.js +1 -0
- package/dist/components/my-modal.d.ts +11 -0
- package/dist/components/my-modal.js +1 -0
- package/dist/components/p-qbDrUNkY.js +1 -0
- package/dist/esm/{index-Bdf40fwG.js → index-Bvqd98ac.js} +116 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/my-alert.entry.js +33 -0
- package/dist/esm/my-badge.entry.js +1 -1
- package/dist/esm/my-button.entry.js +1 -1
- package/dist/esm/my-card.entry.js +1 -1
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/my-dropdown.entry.js +43 -0
- package/dist/esm/my-input.entry.js +26 -0
- package/dist/esm/my-modal.entry.js +34 -0
- package/dist/esm/stencil-library.js +3 -3
- package/dist/stencil-library/p-14e60a62.entry.js +1 -0
- package/dist/stencil-library/{p-2b74a573.entry.js → p-54490973.entry.js} +1 -1
- package/dist/stencil-library/p-6f9720d5.entry.js +1 -0
- package/dist/stencil-library/{p-fd06de5e.entry.js → p-8ece36c8.entry.js} +1 -1
- package/dist/stencil-library/p-9a704cf3.entry.js +1 -0
- package/dist/stencil-library/{p-ba774cf9.entry.js → p-9cb3a621.entry.js} +1 -1
- package/dist/stencil-library/p-Bvqd98ac.js +2 -0
- package/dist/stencil-library/p-ddb7d070.entry.js +1 -0
- package/dist/stencil-library/{p-b36446f6.entry.js → p-f8560476.entry.js} +1 -1
- package/dist/stencil-library/stencil-library.esm.js +1 -1
- package/dist/types/components/my-alert/my-alert.d.ts +11 -0
- package/dist/types/components/my-dropdown/my-dropdown.d.ts +19 -0
- package/dist/types/components/my-input/my-input.d.ts +13 -0
- package/dist/types/components/my-modal/my-modal.d.ts +10 -0
- package/dist/types/components.d.ts +299 -0
- package/package.json +2 -2
- package/dist/components/p-BJi3ojZX.js +0 -1
- package/dist/stencil-library/p-Bdf40fwG.js +0 -2
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class MyAlert {
|
|
3
|
+
type = 'info';
|
|
4
|
+
alertTitle = '';
|
|
5
|
+
dismissible = false;
|
|
6
|
+
dismissed = false;
|
|
7
|
+
myDismiss;
|
|
8
|
+
icons = {
|
|
9
|
+
success: '✓',
|
|
10
|
+
warning: '⚠',
|
|
11
|
+
error: '✕',
|
|
12
|
+
info: 'ℹ',
|
|
13
|
+
};
|
|
14
|
+
dismiss() {
|
|
15
|
+
this.dismissed = true;
|
|
16
|
+
this.myDismiss.emit();
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
if (this.dismissed)
|
|
20
|
+
return null;
|
|
21
|
+
return (h("div", { class: `alert alert--${this.type}`, role: "alert" }, h("span", { class: "alert-icon" }, this.icons[this.type]), h("div", { class: "alert-content" }, this.alertTitle && h("strong", { class: "alert-title" }, this.alertTitle), h("span", { class: "alert-message" }, h("slot", null))), this.dismissible && (h("button", { class: "alert-dismiss", onClick: () => this.dismiss() }, "\u2715"))));
|
|
22
|
+
}
|
|
23
|
+
static get is() { return "my-alert"; }
|
|
24
|
+
static get encapsulation() { return "shadow"; }
|
|
25
|
+
static get originalStyleUrls() {
|
|
26
|
+
return {
|
|
27
|
+
"$": ["my-alert.css"]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static get styleUrls() {
|
|
31
|
+
return {
|
|
32
|
+
"$": ["my-alert.css"]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static get properties() {
|
|
36
|
+
return {
|
|
37
|
+
"type": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"mutable": false,
|
|
40
|
+
"complexType": {
|
|
41
|
+
"original": "'success' | 'warning' | 'error' | 'info'",
|
|
42
|
+
"resolved": "\"error\" | \"info\" | \"success\" | \"warning\"",
|
|
43
|
+
"references": {}
|
|
44
|
+
},
|
|
45
|
+
"required": false,
|
|
46
|
+
"optional": false,
|
|
47
|
+
"docs": {
|
|
48
|
+
"tags": [],
|
|
49
|
+
"text": ""
|
|
50
|
+
},
|
|
51
|
+
"getter": false,
|
|
52
|
+
"setter": false,
|
|
53
|
+
"reflect": false,
|
|
54
|
+
"attribute": "type",
|
|
55
|
+
"defaultValue": "'info'"
|
|
56
|
+
},
|
|
57
|
+
"alertTitle": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"mutable": false,
|
|
60
|
+
"complexType": {
|
|
61
|
+
"original": "string",
|
|
62
|
+
"resolved": "string",
|
|
63
|
+
"references": {}
|
|
64
|
+
},
|
|
65
|
+
"required": false,
|
|
66
|
+
"optional": false,
|
|
67
|
+
"docs": {
|
|
68
|
+
"tags": [],
|
|
69
|
+
"text": ""
|
|
70
|
+
},
|
|
71
|
+
"getter": false,
|
|
72
|
+
"setter": false,
|
|
73
|
+
"reflect": false,
|
|
74
|
+
"attribute": "alert-title",
|
|
75
|
+
"defaultValue": "''"
|
|
76
|
+
},
|
|
77
|
+
"dismissible": {
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"mutable": false,
|
|
80
|
+
"complexType": {
|
|
81
|
+
"original": "boolean",
|
|
82
|
+
"resolved": "boolean",
|
|
83
|
+
"references": {}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": false,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": ""
|
|
90
|
+
},
|
|
91
|
+
"getter": false,
|
|
92
|
+
"setter": false,
|
|
93
|
+
"reflect": false,
|
|
94
|
+
"attribute": "dismissible",
|
|
95
|
+
"defaultValue": "false"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
static get states() {
|
|
100
|
+
return {
|
|
101
|
+
"dismissed": {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
static get events() {
|
|
105
|
+
return [{
|
|
106
|
+
"method": "myDismiss",
|
|
107
|
+
"name": "myDismiss",
|
|
108
|
+
"bubbles": true,
|
|
109
|
+
"cancelable": true,
|
|
110
|
+
"composed": true,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
},
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "void",
|
|
117
|
+
"resolved": "void",
|
|
118
|
+
"references": {}
|
|
119
|
+
}
|
|
120
|
+
}];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dropdown-wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 6px;
|
|
9
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dropdown-label {
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
color: #374151;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dropdown {
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dropdown-trigger {
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding: 10px 14px;
|
|
25
|
+
font-size: 15px;
|
|
26
|
+
border: 2px solid #d1d5db;
|
|
27
|
+
border-radius: 8px;
|
|
28
|
+
background: #fff;
|
|
29
|
+
color: #111827;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
36
|
+
text-align: left;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dropdown-trigger:hover:not(:disabled) {
|
|
41
|
+
border-color: #667eea;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dropdown--open .dropdown-trigger {
|
|
45
|
+
border-color: #667eea;
|
|
46
|
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dropdown--disabled .dropdown-trigger {
|
|
50
|
+
background: #f3f4f6;
|
|
51
|
+
color: #9ca3af;
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.dropdown-placeholder {
|
|
56
|
+
color: #9ca3af;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dropdown-arrow {
|
|
60
|
+
font-size: 11px;
|
|
61
|
+
color: #6b7280;
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.dropdown-menu {
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: calc(100% + 4px);
|
|
68
|
+
left: 0;
|
|
69
|
+
right: 0;
|
|
70
|
+
background: #fff;
|
|
71
|
+
border: 2px solid #667eea;
|
|
72
|
+
border-radius: 8px;
|
|
73
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
74
|
+
list-style: none;
|
|
75
|
+
margin: 0;
|
|
76
|
+
padding: 4px;
|
|
77
|
+
z-index: 100;
|
|
78
|
+
max-height: 240px;
|
|
79
|
+
overflow-y: auto;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dropdown-item {
|
|
83
|
+
padding: 10px 12px;
|
|
84
|
+
border-radius: 6px;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
font-size: 15px;
|
|
87
|
+
color: #111827;
|
|
88
|
+
transition: background 0.15s;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.dropdown-item:hover {
|
|
92
|
+
background: #f3f4f6;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dropdown-item--selected {
|
|
96
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
97
|
+
color: white;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.dropdown-item--selected:hover {
|
|
101
|
+
background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dropdown-wrapper--error .dropdown-trigger {
|
|
105
|
+
border-color: #ef4444;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.dropdown-error {
|
|
109
|
+
font-size: 13px;
|
|
110
|
+
color: #ef4444;
|
|
111
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class MyDropdown {
|
|
3
|
+
options = [];
|
|
4
|
+
value = '';
|
|
5
|
+
placeholder = 'Select an option';
|
|
6
|
+
label = '';
|
|
7
|
+
disabled = false;
|
|
8
|
+
error = '';
|
|
9
|
+
isOpen = false;
|
|
10
|
+
myChange;
|
|
11
|
+
get parsedOptions() {
|
|
12
|
+
if (typeof this.options === 'string') {
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(this.options);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return this.options;
|
|
21
|
+
}
|
|
22
|
+
get selectedLabel() {
|
|
23
|
+
const found = this.parsedOptions.find(o => o.value === this.value);
|
|
24
|
+
return found ? found.label : this.placeholder;
|
|
25
|
+
}
|
|
26
|
+
select(value) {
|
|
27
|
+
this.myChange.emit(value);
|
|
28
|
+
this.isOpen = false;
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return (h("div", { key: '2e99fe0d9bd2ee48e0827ddcb4feec85ad102b36', class: `dropdown-wrapper ${this.error ? 'dropdown-wrapper--error' : ''}` }, this.label && h("label", { key: 'c69f0dcc8c6f0cadd7e3896ebacd43a5dfdfccda', class: "dropdown-label" }, this.label), h("div", { key: '2f9e442f6a92be57ffe694dd9ec53586fbf548e0', class: `dropdown ${this.isOpen ? 'dropdown--open' : ''} ${this.disabled ? 'dropdown--disabled' : ''}` }, h("button", { key: '46d0696358cac16b51127cabb408a7290a54ea1a', class: "dropdown-trigger", disabled: this.disabled, onClick: () => !this.disabled && (this.isOpen = !this.isOpen) }, h("span", { key: '16acade80b5ff899084acbfb753ca869f9f5f237', class: !this.value ? 'dropdown-placeholder' : '' }, this.selectedLabel), h("span", { key: '426582643773176b7dbaeacc22b46b27ececa60b', class: "dropdown-arrow" }, this.isOpen ? '▲' : '▼')), this.isOpen && (h("ul", { key: 'f1cbe6f1af273ed5b3437985ecb5bd1ec73ca318', class: "dropdown-menu" }, this.parsedOptions.map(option => (h("li", { class: `dropdown-item ${option.value === this.value ? 'dropdown-item--selected' : ''}`, onClick: () => this.select(option.value) }, option.label)))))), this.error && h("span", { key: 'd14cac844bb832778afa7592869eb96dcfeb10a2', class: "dropdown-error" }, this.error)));
|
|
32
|
+
}
|
|
33
|
+
static get is() { return "my-dropdown"; }
|
|
34
|
+
static get encapsulation() { return "shadow"; }
|
|
35
|
+
static get originalStyleUrls() {
|
|
36
|
+
return {
|
|
37
|
+
"$": ["my-dropdown.css"]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
static get styleUrls() {
|
|
41
|
+
return {
|
|
42
|
+
"$": ["my-dropdown.css"]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static get properties() {
|
|
46
|
+
return {
|
|
47
|
+
"options": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "DropdownOption[] | string",
|
|
52
|
+
"resolved": "DropdownOption[] | string",
|
|
53
|
+
"references": {
|
|
54
|
+
"DropdownOption": {
|
|
55
|
+
"location": "local",
|
|
56
|
+
"path": "/Users/anis/Sites/designsystem/my-monorepo/packages/stencil-library/src/components/my-dropdown/my-dropdown.tsx",
|
|
57
|
+
"id": "src/components/my-dropdown/my-dropdown.tsx::DropdownOption"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": false,
|
|
62
|
+
"optional": false,
|
|
63
|
+
"docs": {
|
|
64
|
+
"tags": [],
|
|
65
|
+
"text": ""
|
|
66
|
+
},
|
|
67
|
+
"getter": false,
|
|
68
|
+
"setter": false,
|
|
69
|
+
"reflect": false,
|
|
70
|
+
"attribute": "options",
|
|
71
|
+
"defaultValue": "[]"
|
|
72
|
+
},
|
|
73
|
+
"value": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"mutable": false,
|
|
76
|
+
"complexType": {
|
|
77
|
+
"original": "string",
|
|
78
|
+
"resolved": "string",
|
|
79
|
+
"references": {}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": ""
|
|
86
|
+
},
|
|
87
|
+
"getter": false,
|
|
88
|
+
"setter": false,
|
|
89
|
+
"reflect": false,
|
|
90
|
+
"attribute": "value",
|
|
91
|
+
"defaultValue": "''"
|
|
92
|
+
},
|
|
93
|
+
"placeholder": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "string",
|
|
98
|
+
"resolved": "string",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": ""
|
|
106
|
+
},
|
|
107
|
+
"getter": false,
|
|
108
|
+
"setter": false,
|
|
109
|
+
"reflect": false,
|
|
110
|
+
"attribute": "placeholder",
|
|
111
|
+
"defaultValue": "'Select an option'"
|
|
112
|
+
},
|
|
113
|
+
"label": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"mutable": false,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "string",
|
|
118
|
+
"resolved": "string",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": ""
|
|
126
|
+
},
|
|
127
|
+
"getter": false,
|
|
128
|
+
"setter": false,
|
|
129
|
+
"reflect": false,
|
|
130
|
+
"attribute": "label",
|
|
131
|
+
"defaultValue": "''"
|
|
132
|
+
},
|
|
133
|
+
"disabled": {
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "boolean",
|
|
138
|
+
"resolved": "boolean",
|
|
139
|
+
"references": {}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": ""
|
|
146
|
+
},
|
|
147
|
+
"getter": false,
|
|
148
|
+
"setter": false,
|
|
149
|
+
"reflect": false,
|
|
150
|
+
"attribute": "disabled",
|
|
151
|
+
"defaultValue": "false"
|
|
152
|
+
},
|
|
153
|
+
"error": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "string",
|
|
158
|
+
"resolved": "string",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": ""
|
|
166
|
+
},
|
|
167
|
+
"getter": false,
|
|
168
|
+
"setter": false,
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"attribute": "error",
|
|
171
|
+
"defaultValue": "''"
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
static get states() {
|
|
176
|
+
return {
|
|
177
|
+
"isOpen": {}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
static get events() {
|
|
181
|
+
return [{
|
|
182
|
+
"method": "myChange",
|
|
183
|
+
"name": "myChange",
|
|
184
|
+
"bubbles": true,
|
|
185
|
+
"cancelable": true,
|
|
186
|
+
"composed": true,
|
|
187
|
+
"docs": {
|
|
188
|
+
"tags": [],
|
|
189
|
+
"text": ""
|
|
190
|
+
},
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "string",
|
|
193
|
+
"resolved": "string",
|
|
194
|
+
"references": {}
|
|
195
|
+
}
|
|
196
|
+
}];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.input-wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 6px;
|
|
9
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.input-label {
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
color: #374151;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.input-required {
|
|
19
|
+
color: #ef4444;
|
|
20
|
+
margin-left: 2px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.input-field {
|
|
24
|
+
padding: 10px 14px;
|
|
25
|
+
font-size: 15px;
|
|
26
|
+
border: 2px solid #d1d5db;
|
|
27
|
+
border-radius: 8px;
|
|
28
|
+
outline: none;
|
|
29
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
30
|
+
background: #fff;
|
|
31
|
+
color: #111827;
|
|
32
|
+
width: 100%;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input-field:focus {
|
|
37
|
+
border-color: #667eea;
|
|
38
|
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.input-field:disabled {
|
|
42
|
+
background: #f3f4f6;
|
|
43
|
+
color: #9ca3af;
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input-wrapper--error .input-field {
|
|
48
|
+
border-color: #ef4444;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.input-wrapper--error .input-field:focus {
|
|
52
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.input-error {
|
|
56
|
+
font-size: 13px;
|
|
57
|
+
color: #ef4444;
|
|
58
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class MyInput {
|
|
3
|
+
label = '';
|
|
4
|
+
placeholder = '';
|
|
5
|
+
value = '';
|
|
6
|
+
type = 'text';
|
|
7
|
+
error = '';
|
|
8
|
+
disabled = false;
|
|
9
|
+
required = false;
|
|
10
|
+
myChange;
|
|
11
|
+
myBlur;
|
|
12
|
+
render() {
|
|
13
|
+
return (h("div", { key: '9ee947b792e9829d2aa329b5314ea61515e460b1', class: `input-wrapper ${this.error ? 'input-wrapper--error' : ''}` }, this.label && (h("label", { key: 'f0e912275821438feb4518ed2618a49971625470', class: "input-label" }, this.label, this.required && h("span", { key: 'c7033d3974315c8fd4a25b7f408f263852b47920', class: "input-required" }, "*"))), h("input", { key: 'e5858925769f01801051fe54da86bd805b3594e2', class: "input-field", type: this.type, placeholder: this.placeholder, value: this.value, disabled: this.disabled, onInput: (e) => this.myChange.emit(e.target.value), onBlur: () => this.myBlur.emit() }), this.error && h("span", { key: 'f07db0cbdc2d9d91a48ea3cb67e74cc56f039ee6', class: "input-error" }, this.error)));
|
|
14
|
+
}
|
|
15
|
+
static get is() { return "my-input"; }
|
|
16
|
+
static get encapsulation() { return "shadow"; }
|
|
17
|
+
static get originalStyleUrls() {
|
|
18
|
+
return {
|
|
19
|
+
"$": ["my-input.css"]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
static get styleUrls() {
|
|
23
|
+
return {
|
|
24
|
+
"$": ["my-input.css"]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static get properties() {
|
|
28
|
+
return {
|
|
29
|
+
"label": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"mutable": false,
|
|
32
|
+
"complexType": {
|
|
33
|
+
"original": "string",
|
|
34
|
+
"resolved": "string",
|
|
35
|
+
"references": {}
|
|
36
|
+
},
|
|
37
|
+
"required": false,
|
|
38
|
+
"optional": false,
|
|
39
|
+
"docs": {
|
|
40
|
+
"tags": [],
|
|
41
|
+
"text": ""
|
|
42
|
+
},
|
|
43
|
+
"getter": false,
|
|
44
|
+
"setter": false,
|
|
45
|
+
"reflect": false,
|
|
46
|
+
"attribute": "label",
|
|
47
|
+
"defaultValue": "''"
|
|
48
|
+
},
|
|
49
|
+
"placeholder": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"mutable": false,
|
|
52
|
+
"complexType": {
|
|
53
|
+
"original": "string",
|
|
54
|
+
"resolved": "string",
|
|
55
|
+
"references": {}
|
|
56
|
+
},
|
|
57
|
+
"required": false,
|
|
58
|
+
"optional": false,
|
|
59
|
+
"docs": {
|
|
60
|
+
"tags": [],
|
|
61
|
+
"text": ""
|
|
62
|
+
},
|
|
63
|
+
"getter": false,
|
|
64
|
+
"setter": false,
|
|
65
|
+
"reflect": false,
|
|
66
|
+
"attribute": "placeholder",
|
|
67
|
+
"defaultValue": "''"
|
|
68
|
+
},
|
|
69
|
+
"value": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"mutable": false,
|
|
72
|
+
"complexType": {
|
|
73
|
+
"original": "string",
|
|
74
|
+
"resolved": "string",
|
|
75
|
+
"references": {}
|
|
76
|
+
},
|
|
77
|
+
"required": false,
|
|
78
|
+
"optional": false,
|
|
79
|
+
"docs": {
|
|
80
|
+
"tags": [],
|
|
81
|
+
"text": ""
|
|
82
|
+
},
|
|
83
|
+
"getter": false,
|
|
84
|
+
"setter": false,
|
|
85
|
+
"reflect": false,
|
|
86
|
+
"attribute": "value",
|
|
87
|
+
"defaultValue": "''"
|
|
88
|
+
},
|
|
89
|
+
"type": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "'text' | 'email' | 'password' | 'number' | 'tel'",
|
|
94
|
+
"resolved": "\"email\" | \"number\" | \"password\" | \"tel\" | \"text\"",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": ""
|
|
102
|
+
},
|
|
103
|
+
"getter": false,
|
|
104
|
+
"setter": false,
|
|
105
|
+
"reflect": false,
|
|
106
|
+
"attribute": "type",
|
|
107
|
+
"defaultValue": "'text'"
|
|
108
|
+
},
|
|
109
|
+
"error": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "string",
|
|
114
|
+
"resolved": "string",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": ""
|
|
122
|
+
},
|
|
123
|
+
"getter": false,
|
|
124
|
+
"setter": false,
|
|
125
|
+
"reflect": false,
|
|
126
|
+
"attribute": "error",
|
|
127
|
+
"defaultValue": "''"
|
|
128
|
+
},
|
|
129
|
+
"disabled": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "boolean",
|
|
134
|
+
"resolved": "boolean",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"getter": false,
|
|
144
|
+
"setter": false,
|
|
145
|
+
"reflect": false,
|
|
146
|
+
"attribute": "disabled",
|
|
147
|
+
"defaultValue": "false"
|
|
148
|
+
},
|
|
149
|
+
"required": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": ""
|
|
162
|
+
},
|
|
163
|
+
"getter": false,
|
|
164
|
+
"setter": false,
|
|
165
|
+
"reflect": false,
|
|
166
|
+
"attribute": "required",
|
|
167
|
+
"defaultValue": "false"
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
static get events() {
|
|
172
|
+
return [{
|
|
173
|
+
"method": "myChange",
|
|
174
|
+
"name": "myChange",
|
|
175
|
+
"bubbles": true,
|
|
176
|
+
"cancelable": true,
|
|
177
|
+
"composed": true,
|
|
178
|
+
"docs": {
|
|
179
|
+
"tags": [],
|
|
180
|
+
"text": ""
|
|
181
|
+
},
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "string",
|
|
184
|
+
"resolved": "string",
|
|
185
|
+
"references": {}
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
"method": "myBlur",
|
|
189
|
+
"name": "myBlur",
|
|
190
|
+
"bubbles": true,
|
|
191
|
+
"cancelable": true,
|
|
192
|
+
"composed": true,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": ""
|
|
196
|
+
},
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "void",
|
|
199
|
+
"resolved": "void",
|
|
200
|
+
"references": {}
|
|
201
|
+
}
|
|
202
|
+
}];
|
|
203
|
+
}
|
|
204
|
+
}
|