@sankhyalabs/ezui 1.1.4 → 1.1.8
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/README.md +72 -72
- package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-28b290cb.js} +382 -369
- package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
- package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
- package/dist/cjs/ez-button_14.cjs.entry.js +3341 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
- package/dist/cjs/ez-modal.cjs.entry.js +115 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
- package/dist/cjs/ezui.cjs.js +19 -0
- package/dist/cjs/form-metadata.cjs.entry.js +74 -0
- package/dist/cjs/index-9403fe8f.js +1322 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
- package/dist/collection/components/ez-button/ez-button.css +94 -0
- package/dist/collection/components/ez-button/ez-button.js +125 -0
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
- package/dist/collection/components/ez-check/ez-check.css +266 -0
- package/dist/collection/components/ez-check/ez-check.js +168 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
- package/dist/collection/components/ez-form/ez-form.css +19 -0
- package/dist/collection/components/ez-form/ez-form.js +368 -0
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +207 -0
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
- package/dist/collection/components/ez-icon/ez-icon.css +37 -0
- package/dist/collection/components/ez-icon/ez-icon.js +56 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
- package/dist/collection/components/ez-modal/ez-modal.css +87 -0
- package/dist/collection/components/ez-modal/ez-modal.js +224 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
- package/dist/collection/components/ez-popover/ez-popover.css +39 -0
- package/dist/collection/components/ez-popover/ez-popover.js +323 -0
- package/dist/collection/components/ez-search/ez-search.css +296 -0
- package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
- package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
- package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/servidor.js +101 -0
- package/dist/collection/utils/FloatingManager.js +16 -0
- package/dist/collection/utils/utils.js +6 -0
- package/dist/custom-elements/index.js +5071 -0
- package/dist/esm/DataUnit-69e518fa.js +378 -0
- package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
- package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
- package/dist/esm/ez-button_14.entry.js +3324 -0
- package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
- package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
- package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
- package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
- package/dist/esm/ezui.js +17 -0
- package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
- package/dist/esm/index-95bb3fd9.js +1293 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/ezui/ezui.esm.js +1 -122
- package/dist/ezui/index.esm.js +0 -1
- package/dist/ezui/p-10ef58b3.js +1 -0
- package/dist/ezui/p-185c57f4.js +1 -0
- package/dist/ezui/p-22b82efb.entry.js +1 -0
- package/dist/ezui/p-77fdb4fd.entry.js +1 -0
- package/dist/ezui/p-9dfccb16.js +1 -0
- package/dist/ezui/p-b0974f4f.entry.js +1 -0
- package/dist/ezui/p-db11c600.entry.js +1 -0
- package/dist/ezui/p-dd4331b7.entry.js +1 -0
- package/dist/ezui/p-f6fd31ab.entry.js +1 -0
- package/dist/ezui/p-fa260f22.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +31 -27
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/components.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +13 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +114 -114
- package/react/components.d.ts +22 -0
- package/react/components.js +25 -0
- package/react/components.js.map +1 -0
- package/react/react-component-lib/createComponent.d.ts +10 -0
- package/react/react-component-lib/createComponent.js +59 -0
- package/react/react-component-lib/createComponent.js.map +1 -0
- package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
- package/react/react-component-lib/createOverlayComponent.js +89 -0
- package/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/react/react-component-lib/index.d.ts +2 -0
- package/react/react-component-lib/index.js +3 -0
- package/react/react-component-lib/index.js.map +1 -0
- package/react/react-component-lib/interfaces.d.ts +29 -0
- package/react/react-component-lib/interfaces.js +1 -0
- package/react/react-component-lib/interfaces.js.map +1 -0
- package/react/react-component-lib/utils/attachProps.d.ts +12 -0
- package/react/react-component-lib/utils/attachProps.js +96 -0
- package/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/react/react-component-lib/utils/case.d.ts +2 -0
- package/react/react-component-lib/utils/case.js +7 -0
- package/react/react-component-lib/utils/case.js.map +1 -0
- package/react/react-component-lib/utils/dev.d.ts +2 -0
- package/react/react-component-lib/utils/dev.js +13 -0
- package/react/react-component-lib/utils/dev.js.map +1 -0
- package/react/react-component-lib/utils/index.d.ts +7 -0
- package/react/react-component-lib/utils/index.js +21 -0
- package/react/react-component-lib/utils/index.js.map +1 -0
- package/dist/ezui/app-globals-0f993ce5.js +0 -3
- package/dist/ezui/css-shim-003e9264.js +0 -4
- package/dist/ezui/dom-1b195079.js +0 -73
- package/dist/ezui/ez-button.entry.js +0 -47
- package/dist/ezui/ez-calendar.entry.js +0 -102
- package/dist/ezui/ez-check.entry.js +0 -62
- package/dist/ezui/ez-collapsable-box.entry.js +0 -32
- package/dist/ezui/ez-combo-box.entry.js +0 -181
- package/dist/ezui/ez-date-input.entry.js +0 -77
- package/dist/ezui/ez-form.entry.js +0 -1907
- package/dist/ezui/ez-icon.entry.js +0 -17
- package/dist/ezui/ez-popover.entry.js +0 -112
- package/dist/ezui/ez-text-area.entry.js +0 -105
- package/dist/ezui/ez-text-input.entry.js +0 -202
- package/dist/ezui/index-39044be2.js +0 -2832
- package/dist/ezui/place-holder.entry.js +0 -15
- package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { FloatingManager } from '@sankhyalabs/core';
|
|
2
|
+
import { Component, forceUpdate, h, Prop, Method, Event, Watch } from '@stencil/core';
|
|
3
|
+
export class EzCalendar {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._firstRender = true;
|
|
6
|
+
this._todayLabel = 'Hoje';
|
|
7
|
+
this._weekDayLabels = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];
|
|
8
|
+
this._monthLabels = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];
|
|
9
|
+
/**
|
|
10
|
+
* A data selecionada no calendário
|
|
11
|
+
*/
|
|
12
|
+
this.value = new Date();
|
|
13
|
+
/**
|
|
14
|
+
* No modo floating o calendário só se tornará visível
|
|
15
|
+
* quando o método show() for acionado.
|
|
16
|
+
*/
|
|
17
|
+
this.floating = false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Usado no modo floating. Faz com que o componente seja exibido.
|
|
21
|
+
* É possível determinar ajustes de posicionamento através dos parâmetros
|
|
22
|
+
* top, left, bottom e right. Esses parâmetros devem ser informados como
|
|
23
|
+
* strings no formato css.
|
|
24
|
+
*/
|
|
25
|
+
async show(top, left, bottom, right) {
|
|
26
|
+
if (this.floating) {
|
|
27
|
+
this._floatingID = FloatingManager.float(this._box, this._container, { autoClose: true, top, left, bottom, right });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
32
|
+
*/
|
|
33
|
+
async hide() {
|
|
34
|
+
if (this._floatingID !== undefined) {
|
|
35
|
+
FloatingManager.close(this._floatingID);
|
|
36
|
+
this._floatingID = undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
valueChanged() {
|
|
40
|
+
if (this.value) {
|
|
41
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
42
|
+
this._currentPosition.setDate(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
getMonthLabel() {
|
|
46
|
+
return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
|
|
47
|
+
}
|
|
48
|
+
isSelectedDate(d) {
|
|
49
|
+
if (this.value) {
|
|
50
|
+
return this.value.getDate() == d.getDate() && this.value.getMonth() == d.getMonth() && this.value.getFullYear() == d.getFullYear();
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
changeMonth(offset) {
|
|
55
|
+
this._currentPosition.setMonth(this._currentPosition.getMonth() + offset);
|
|
56
|
+
forceUpdate(this);
|
|
57
|
+
}
|
|
58
|
+
selectDate(d) {
|
|
59
|
+
this.value = d;
|
|
60
|
+
this.ezChange.emit();
|
|
61
|
+
}
|
|
62
|
+
componentDidRender() {
|
|
63
|
+
if (this.floating && this._firstRender) {
|
|
64
|
+
this._box.remove();
|
|
65
|
+
this._firstRender = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
if (this._currentPosition == null) {
|
|
70
|
+
this._currentPosition = new Date();
|
|
71
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
72
|
+
this._currentPosition.setDate(1);
|
|
73
|
+
}
|
|
74
|
+
const firstDate = new Date();
|
|
75
|
+
firstDate.setTime(this._currentPosition.getTime());
|
|
76
|
+
firstDate.setDate(1 - firstDate.getDay());
|
|
77
|
+
return (h("section", { ref: elem => this._container = elem },
|
|
78
|
+
h("div", { class: "calendar", ref: elem => this._box = elem },
|
|
79
|
+
h("div", { class: "calendar__header" },
|
|
80
|
+
h("button", { class: "calendar__btn-previous", onClick: () => this.changeMonth(-1) }),
|
|
81
|
+
h("label", { class: "calendar__lbl-month" }, this.getMonthLabel()),
|
|
82
|
+
h("button", { class: "calendar__btn-next", onClick: () => this.changeMonth(1) })),
|
|
83
|
+
h("div", { class: "calendar__body" },
|
|
84
|
+
h("div", { class: "calendar__line" }, this._weekDayLabels.map(day => h("div", { class: "calendar__cell calendar__cell--unselectable" }, day))),
|
|
85
|
+
[0, 7, 14, 21, 28, 35].map(offset => h("div", { class: "calendar__line" }, [0, 1, 2, 3, 4, 5, 6].map(index => {
|
|
86
|
+
const date = new Date();
|
|
87
|
+
date.setTime(firstDate.getTime());
|
|
88
|
+
date.setDate(date.getDate() + offset + index);
|
|
89
|
+
let classNames = "calendar__cell";
|
|
90
|
+
if (this._currentPosition.getMonth() != date.getMonth()) {
|
|
91
|
+
classNames += " calendar__cell--secondary";
|
|
92
|
+
}
|
|
93
|
+
else if (this.isSelectedDate(date)) {
|
|
94
|
+
classNames += " calendar__cell--selected";
|
|
95
|
+
}
|
|
96
|
+
return h("div", { class: classNames, onClick: () => this.selectDate(date) }, date.getDate());
|
|
97
|
+
})))),
|
|
98
|
+
h("div", { class: "calendar__footer" },
|
|
99
|
+
h("button", { class: "calendar__btn-today", onClick: () => this.selectDate(new Date()) }, this._todayLabel)))));
|
|
100
|
+
}
|
|
101
|
+
static get is() { return "ez-calendar"; }
|
|
102
|
+
static get encapsulation() { return "shadow"; }
|
|
103
|
+
static get originalStyleUrls() { return {
|
|
104
|
+
"$": ["ez-calendar.css"]
|
|
105
|
+
}; }
|
|
106
|
+
static get styleUrls() { return {
|
|
107
|
+
"$": ["ez-calendar.css"]
|
|
108
|
+
}; }
|
|
109
|
+
static get properties() { return {
|
|
110
|
+
"value": {
|
|
111
|
+
"type": "unknown",
|
|
112
|
+
"mutable": true,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "Date",
|
|
115
|
+
"resolved": "Date",
|
|
116
|
+
"references": {
|
|
117
|
+
"Date": {
|
|
118
|
+
"location": "global"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": "A data selecionada no calend\u00E1rio"
|
|
127
|
+
},
|
|
128
|
+
"defaultValue": "new Date()"
|
|
129
|
+
},
|
|
130
|
+
"floating": {
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "boolean",
|
|
135
|
+
"resolved": "boolean",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "No modo floating o calend\u00E1rio s\u00F3 se tornar\u00E1 vis\u00EDvel\nquando o m\u00E9todo show() for acionado."
|
|
143
|
+
},
|
|
144
|
+
"attribute": "floating",
|
|
145
|
+
"reflect": true,
|
|
146
|
+
"defaultValue": "false"
|
|
147
|
+
}
|
|
148
|
+
}; }
|
|
149
|
+
static get events() { return [{
|
|
150
|
+
"method": "ezChange",
|
|
151
|
+
"name": "ezChange",
|
|
152
|
+
"bubbles": true,
|
|
153
|
+
"cancelable": true,
|
|
154
|
+
"composed": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": "Quando o usu\u00E1rio escolhe uma data, esse evento \u00E9 emitido."
|
|
158
|
+
},
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "string",
|
|
161
|
+
"resolved": "string",
|
|
162
|
+
"references": {}
|
|
163
|
+
}
|
|
164
|
+
}]; }
|
|
165
|
+
static get methods() { return {
|
|
166
|
+
"show": {
|
|
167
|
+
"complexType": {
|
|
168
|
+
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
169
|
+
"parameters": [{
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
}, {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": ""
|
|
175
|
+
}, {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": ""
|
|
178
|
+
}, {
|
|
179
|
+
"tags": [],
|
|
180
|
+
"text": ""
|
|
181
|
+
}],
|
|
182
|
+
"references": {
|
|
183
|
+
"Promise": {
|
|
184
|
+
"location": "global"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"return": "Promise<void>"
|
|
188
|
+
},
|
|
189
|
+
"docs": {
|
|
190
|
+
"text": "Usado no modo floating. Faz com que o componente seja exibido.\n\u00C9 poss\u00EDvel determinar ajustes de posicionamento atrav\u00E9s dos par\u00E2metros\ntop, left, bottom e right. Esses par\u00E2metros devem ser informados como\nstrings no formato css.",
|
|
191
|
+
"tags": []
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"hide": {
|
|
195
|
+
"complexType": {
|
|
196
|
+
"signature": "() => Promise<void>",
|
|
197
|
+
"parameters": [],
|
|
198
|
+
"references": {
|
|
199
|
+
"Promise": {
|
|
200
|
+
"location": "global"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"return": "Promise<void>"
|
|
204
|
+
},
|
|
205
|
+
"docs": {
|
|
206
|
+
"text": "Usado no modo floating. Faz com que o componente seja ocultado.",
|
|
207
|
+
"tags": []
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}; }
|
|
211
|
+
static get watchers() { return [{
|
|
212
|
+
"propName": "value",
|
|
213
|
+
"methodName": "valueChanged"
|
|
214
|
+
}]; }
|
|
215
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
|
|
3
|
+
/***************
|
|
4
|
+
Regular mode
|
|
5
|
+
***************/
|
|
6
|
+
/*dimensions */
|
|
7
|
+
/*@doc Define a largura do box do checkbox */
|
|
8
|
+
--chk--box--width: 18px;
|
|
9
|
+
/*@doc Define a altura do box do checkbox */
|
|
10
|
+
--chk--box--height: 18px;
|
|
11
|
+
--chk--width: calc(var(--chk--box--width) + 14px);
|
|
12
|
+
--chk--height: calc(var(--chk--box--width) + 14px);
|
|
13
|
+
|
|
14
|
+
/*general*/
|
|
15
|
+
--chk--border-radius: var(--border--radius-small);
|
|
16
|
+
|
|
17
|
+
/*box*/
|
|
18
|
+
--chk--checked--background-color: var(--color--primary-200);
|
|
19
|
+
--chk--focus--background-color: var(--color--strokes, #FFFFFF);
|
|
20
|
+
--chk--hover--background-color: var(--background--medium);
|
|
21
|
+
--chk--checked--disabled--background-color: var(--color--disable-secondary);
|
|
22
|
+
|
|
23
|
+
--chk--border: var(--border--medium) var(--title--primary);
|
|
24
|
+
--chk--disabled--border: var(--border--medium) var(--color--strokes);
|
|
25
|
+
--chk--checked--border: var(--border--medium) var(--color--primary);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
--chk--checked--hover--background-color: var(--color--primary-200);
|
|
29
|
+
--chk--checked--focus--background-color: var(--color--primary-300, #FFFFFF);
|
|
30
|
+
|
|
31
|
+
/*check*/
|
|
32
|
+
--chk--check--clip-path: polygon(40% 70%, 46% 73%, 51% 71%, 93% 21%, 93% 16%, 83% 8%, 76% 9%, 47% 45%, 43% 44%, 38% 39%, 30% 37%, 22% 47%, 23% 54%, 40% 70%);
|
|
33
|
+
--chk--check--background-color: var(--color--primary);
|
|
34
|
+
--chk--check--disabled--background-color: var(--color--strokes);
|
|
35
|
+
|
|
36
|
+
/***************
|
|
37
|
+
Switch mode
|
|
38
|
+
***************/
|
|
39
|
+
/*dimensions */
|
|
40
|
+
--swt--slider--width: 34px;
|
|
41
|
+
--swt--slider--height: 14px;
|
|
42
|
+
--swt--pin--width: 20px;
|
|
43
|
+
--swt--pin--height: 20px;
|
|
44
|
+
--swt--focus--width: 32px;
|
|
45
|
+
--swt--focus--height: 32px;
|
|
46
|
+
|
|
47
|
+
/*background*/
|
|
48
|
+
--swt--background-color: var(--color--strokes);
|
|
49
|
+
--swt--disabled--background-color: var(--color--disable-secondary);
|
|
50
|
+
--swt--checked--background-color: var(--color--primary-300);
|
|
51
|
+
|
|
52
|
+
/*pin*/
|
|
53
|
+
--swt--pin--background-color: var(--background--xlight);
|
|
54
|
+
--swt--pin--disabled--background-color: var(--color--disable-secondary);
|
|
55
|
+
--swt--pin--checked--background-color: var(--color--primary);
|
|
56
|
+
--swt--pin--checked--disabled--background-color: #E8F7F4;
|
|
57
|
+
--swt--pin--focus--background-color: var(--text--disable);
|
|
58
|
+
--swt--pin--checked--focus--background-color: var(--color--primary);
|
|
59
|
+
|
|
60
|
+
/***************
|
|
61
|
+
host style
|
|
62
|
+
***************/
|
|
63
|
+
/*private*/
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/******** REGULAR MODE ********/
|
|
68
|
+
/*---------------------------unchecked------------------------------*/
|
|
69
|
+
input.regularMode {
|
|
70
|
+
/*private*/
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-wrap: wrap;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
-webkit-appearance: none;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
|
|
80
|
+
/*public*/
|
|
81
|
+
width: var(--chk--width);
|
|
82
|
+
height: var(--chk--height);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
input.regularMode:enabled:hover{
|
|
87
|
+
/*public*/
|
|
88
|
+
background-color: var(--chk--hover--background-color);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input.regularMode:enabled:focus{
|
|
92
|
+
/*private*/
|
|
93
|
+
outline: none;
|
|
94
|
+
|
|
95
|
+
/*public*/
|
|
96
|
+
background-color: var(--chk--focus--background-color);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
input.regularMode:disabled{
|
|
100
|
+
/*private*/
|
|
101
|
+
cursor: auto;
|
|
102
|
+
background: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
input.regularMode::before{
|
|
106
|
+
/*private*/
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
content: "";
|
|
109
|
+
display: block;
|
|
110
|
+
|
|
111
|
+
/*public*/
|
|
112
|
+
width: var(--chk--box--width);
|
|
113
|
+
height: var(--chk--box--height);
|
|
114
|
+
border-radius: var(--chk--border-radius);
|
|
115
|
+
border: var(--chk--border);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
input.regularMode:disabled::before{
|
|
119
|
+
/*public*/
|
|
120
|
+
border: var(--chk--disabled--border);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/*-------------------------------checked---------------------------------*/
|
|
124
|
+
input.regularMode:checked:enabled:hover{
|
|
125
|
+
/*public*/
|
|
126
|
+
background-color: var(--chk--checked--hover--background-color);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
input.regularMode:checked:enabled:focus{
|
|
130
|
+
/*public*/
|
|
131
|
+
background-color: var(--chk--checked--focus--background-color);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
input.regularMode:checked::before{
|
|
135
|
+
/*public*/
|
|
136
|
+
border: var(--chk--checked--border);
|
|
137
|
+
background-color: var(--chk--checked--background-color);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
input.regularMode:checked:disabled:before{
|
|
141
|
+
/*public*/
|
|
142
|
+
border: var(--chk--disabled--border);
|
|
143
|
+
background-color: var(--chk--checked--disabled--background-color);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
input.regularMode:checked::after{
|
|
147
|
+
/*private*/
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-wrap: wrap;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
content: "";
|
|
153
|
+
position: absolute;
|
|
154
|
+
margin-top: 3px;
|
|
155
|
+
margin-left: -1px;
|
|
156
|
+
width: 12px;
|
|
157
|
+
height: 12px;
|
|
158
|
+
background-color: var(--chk--check--background-color);
|
|
159
|
+
|
|
160
|
+
/*public*/
|
|
161
|
+
clip-path: var(--chk--check--clip-path);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
input.regularMode:checked:disabled::after{
|
|
165
|
+
/*public*/
|
|
166
|
+
background-color: var(--chk--check--disabled--background-color);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/******** SWITCH MODE ********/
|
|
170
|
+
/*-------------------------------OFF---------------------------------*/
|
|
171
|
+
input.switchMode{
|
|
172
|
+
/*private*/
|
|
173
|
+
appearance: none;
|
|
174
|
+
position: relative;
|
|
175
|
+
outline: none;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
border-radius: 20px;
|
|
178
|
+
border: none;
|
|
179
|
+
transition: background-color var(--transition);
|
|
180
|
+
|
|
181
|
+
/*public*/
|
|
182
|
+
width: var(--swt--slider--width);
|
|
183
|
+
height: var(--swt--slider--height);
|
|
184
|
+
background-color: var(--swt--background-color);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
input.switchMode:disabled{
|
|
188
|
+
/*public*/
|
|
189
|
+
background-color:var(--swt--disabled--background-color);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
input.switchMode::after{
|
|
193
|
+
/*private*/
|
|
194
|
+
content: "";
|
|
195
|
+
display: block;
|
|
196
|
+
position: absolute;
|
|
197
|
+
box-shadow: var(--shadow);
|
|
198
|
+
transition: transform var(--transition);
|
|
199
|
+
transition: background-color var(--transition);
|
|
200
|
+
transform: translateY(-3px);
|
|
201
|
+
border-radius: 50%;
|
|
202
|
+
|
|
203
|
+
/*public*/
|
|
204
|
+
width: var(--swt--pin--width);
|
|
205
|
+
height: var(--swt--pin--height);
|
|
206
|
+
background-color: var(--swt--pin--background-color);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
input.switchMode:disabled::after{
|
|
210
|
+
/*public*/
|
|
211
|
+
background-color: var(--swt--pin--disabled--background-color);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/*-------------------------------ON---------------------------------*/
|
|
215
|
+
input.switchMode:checked{
|
|
216
|
+
/*private*/
|
|
217
|
+
transition: background-color var(--transition);
|
|
218
|
+
|
|
219
|
+
/*public*/
|
|
220
|
+
background-color: var(--swt--checked--background-color);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
input.switchMode::before{
|
|
224
|
+
/*private*/
|
|
225
|
+
display: block;
|
|
226
|
+
content: "";
|
|
227
|
+
display: block;
|
|
228
|
+
position: absolute;
|
|
229
|
+
border-radius: 50%;
|
|
230
|
+
opacity: 0;
|
|
231
|
+
|
|
232
|
+
/*public*/
|
|
233
|
+
width: var(--swt--focus--width);
|
|
234
|
+
height: var(--swt--focus--height);
|
|
235
|
+
top: calc((var(--swt--slider--height) - var(--swt--focus--height)) / 2);
|
|
236
|
+
left: calc((var(--swt--pin--width) - var(--swt--focus--width))/2);
|
|
237
|
+
background-color: var(--swt--pin--focus--background-color);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
input.switchMode:focus::before{
|
|
241
|
+
/*private*/
|
|
242
|
+
opacity: 0.24;
|
|
243
|
+
transition: opacity var(--transition);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
input.switchMode:checked:focus::before{
|
|
247
|
+
/*private*/
|
|
248
|
+
background-color: var(--swt--pin--checked--focus--background-color);
|
|
249
|
+
transform: translateX(calc(var(--swt--slider--width) - var(--swt--pin--width)));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
input.switchMode:checked::after{
|
|
253
|
+
/*private*/
|
|
254
|
+
transition: transform var(--transition);
|
|
255
|
+
transition: background-color var(--transition);
|
|
256
|
+
transform: translateX(calc(var(--swt--slider--width) - var(--swt--pin--width))) translateY(-3px);
|
|
257
|
+
box-shadow: var(--shadow);
|
|
258
|
+
|
|
259
|
+
/*public*/
|
|
260
|
+
background-color: var(--swt--pin--checked--background-color);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
input.switchMode:checked:disabled::after{
|
|
264
|
+
/*public*/
|
|
265
|
+
background-color: var(--swt--pin--checked--disabled--background-color);
|
|
266
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Component, Prop, h, Watch, Method, Event } from '@stencil/core';
|
|
2
|
+
export class EzCheck {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Deixa o campo disponível ou não interagir com o usuário.
|
|
6
|
+
*/
|
|
7
|
+
this.enabled = true;
|
|
8
|
+
/**
|
|
9
|
+
* Existem dois modos de visualização: regular e switch.
|
|
10
|
+
* Se esta propriedade for omitida, o componete assume o formato "regular";
|
|
11
|
+
* No modo "regular" a visualização é a tradicional de uma caixinha marcada/desmarcada.
|
|
12
|
+
* No modo "switch" o campo tem uma interface em formato de um pino liga/desliga.
|
|
13
|
+
*/
|
|
14
|
+
this.mode = "regular";
|
|
15
|
+
}
|
|
16
|
+
adjustMode() {
|
|
17
|
+
if (this.mode === "switch") {
|
|
18
|
+
this._inputElem.classList.remove("regularMode");
|
|
19
|
+
this._inputElem.classList.add("switchMode");
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this._inputElem.classList.remove("switchMode");
|
|
23
|
+
this._inputElem.classList.add("regularMode");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//---------------------------------------------
|
|
27
|
+
// Public methods
|
|
28
|
+
//---------------------------------------------
|
|
29
|
+
/**
|
|
30
|
+
* Devolve o modo escolhido para o componente
|
|
31
|
+
*/
|
|
32
|
+
async getMode() {
|
|
33
|
+
return this.mode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Faz o foco no componente de input
|
|
37
|
+
*/
|
|
38
|
+
async setFocus() {
|
|
39
|
+
this._inputElem.focus();
|
|
40
|
+
}
|
|
41
|
+
componentDidLoad() {
|
|
42
|
+
this.adjustMode();
|
|
43
|
+
}
|
|
44
|
+
changeValue() {
|
|
45
|
+
this.value = !this.value;
|
|
46
|
+
this.valueChange.emit();
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
return (h("input", { type: "checkbox", class: "regularMode", checked: this.value === true, onChange: () => { this.changeValue(); }, disabled: !this.enabled, ref: (el) => this._inputElem = el }));
|
|
50
|
+
}
|
|
51
|
+
static get is() { return "ez-check"; }
|
|
52
|
+
static get encapsulation() { return "shadow"; }
|
|
53
|
+
static get originalStyleUrls() { return {
|
|
54
|
+
"$": ["ez-check.css"]
|
|
55
|
+
}; }
|
|
56
|
+
static get styleUrls() { return {
|
|
57
|
+
"$": ["ez-check.css"]
|
|
58
|
+
}; }
|
|
59
|
+
static get properties() { return {
|
|
60
|
+
"value": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"mutable": true,
|
|
63
|
+
"complexType": {
|
|
64
|
+
"original": "boolean",
|
|
65
|
+
"resolved": "boolean",
|
|
66
|
+
"references": {}
|
|
67
|
+
},
|
|
68
|
+
"required": false,
|
|
69
|
+
"optional": false,
|
|
70
|
+
"docs": {
|
|
71
|
+
"tags": [],
|
|
72
|
+
"text": "Como se trata de um componente bin\u00E1rio, o valor alterna entre true e false (marcado / desmarcado)"
|
|
73
|
+
},
|
|
74
|
+
"attribute": "value",
|
|
75
|
+
"reflect": true
|
|
76
|
+
},
|
|
77
|
+
"enabled": {
|
|
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": "Deixa o campo dispon\u00EDvel ou n\u00E3o interagir com o usu\u00E1rio."
|
|
90
|
+
},
|
|
91
|
+
"attribute": "enabled",
|
|
92
|
+
"reflect": true,
|
|
93
|
+
"defaultValue": "true"
|
|
94
|
+
},
|
|
95
|
+
"mode": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "string",
|
|
100
|
+
"resolved": "string",
|
|
101
|
+
"references": {}
|
|
102
|
+
},
|
|
103
|
+
"required": false,
|
|
104
|
+
"optional": false,
|
|
105
|
+
"docs": {
|
|
106
|
+
"tags": [],
|
|
107
|
+
"text": "Existem dois modos de visualiza\u00E7\u00E3o: regular e switch.\nSe esta propriedade for omitida, o componete assume o formato \"regular\";\nNo modo \"regular\" a visualiza\u00E7\u00E3o \u00E9 a tradicional de uma caixinha marcada/desmarcada.\nNo modo \"switch\" o campo tem uma interface em formato de um pino liga/desliga."
|
|
108
|
+
},
|
|
109
|
+
"attribute": "mode",
|
|
110
|
+
"reflect": true,
|
|
111
|
+
"defaultValue": "\"regular\""
|
|
112
|
+
}
|
|
113
|
+
}; }
|
|
114
|
+
static get events() { return [{
|
|
115
|
+
"method": "valueChange",
|
|
116
|
+
"name": "valueChange",
|
|
117
|
+
"bubbles": true,
|
|
118
|
+
"cancelable": true,
|
|
119
|
+
"composed": true,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": ""
|
|
123
|
+
},
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "string",
|
|
126
|
+
"resolved": "string",
|
|
127
|
+
"references": {}
|
|
128
|
+
}
|
|
129
|
+
}]; }
|
|
130
|
+
static get methods() { return {
|
|
131
|
+
"getMode": {
|
|
132
|
+
"complexType": {
|
|
133
|
+
"signature": "() => Promise<string>",
|
|
134
|
+
"parameters": [],
|
|
135
|
+
"references": {
|
|
136
|
+
"Promise": {
|
|
137
|
+
"location": "global"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"return": "Promise<string>"
|
|
141
|
+
},
|
|
142
|
+
"docs": {
|
|
143
|
+
"text": "Devolve o modo escolhido para o componente",
|
|
144
|
+
"tags": []
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"setFocus": {
|
|
148
|
+
"complexType": {
|
|
149
|
+
"signature": "() => Promise<void>",
|
|
150
|
+
"parameters": [],
|
|
151
|
+
"references": {
|
|
152
|
+
"Promise": {
|
|
153
|
+
"location": "global"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"return": "Promise<void>"
|
|
157
|
+
},
|
|
158
|
+
"docs": {
|
|
159
|
+
"text": "Faz o foco no componente de input",
|
|
160
|
+
"tags": []
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}; }
|
|
164
|
+
static get watchers() { return [{
|
|
165
|
+
"propName": "mode",
|
|
166
|
+
"methodName": "adjustMode"
|
|
167
|
+
}]; }
|
|
168
|
+
}
|