@operato/contact 1.1.77 → 1.2.0

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 (39) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +4 -4
  4. package/dist/src/OxContact copy.d.ts +0 -38
  5. package/dist/src/OxContact copy.js +0 -194
  6. package/dist/src/OxContact copy.js.map +0 -1
  7. package/dist/src/OxContact.d.ts +0 -38
  8. package/dist/src/OxContact.js +0 -67
  9. package/dist/src/OxContact.js.map +0 -1
  10. package/dist/src/OxContactEdit.d.ts +0 -18
  11. package/dist/src/OxContactEdit.js +0 -235
  12. package/dist/src/OxContactEdit.js.map +0 -1
  13. package/dist/src/OxContactView copy.d.ts +0 -35
  14. package/dist/src/OxContactView copy.js +0 -143
  15. package/dist/src/OxContactView copy.js.map +0 -1
  16. package/dist/src/OxContactView.d.ts +0 -7
  17. package/dist/src/OxContactView.js +0 -138
  18. package/dist/src/OxContactView.js.map +0 -1
  19. package/dist/src/ox-contact copy.d.ts +0 -38
  20. package/dist/src/ox-contact copy.js +0 -67
  21. package/dist/src/ox-contact copy.js.map +0 -1
  22. package/dist/src/ox-contact-edit copy.d.ts +0 -1
  23. package/dist/src/ox-contact-edit copy.js +0 -3
  24. package/dist/src/ox-contact-edit copy.js.map +0 -1
  25. package/dist/src/ox-pfp-editor copy.d.ts +0 -11
  26. package/dist/src/ox-pfp-editor copy.js +0 -71
  27. package/dist/src/ox-pfp-editor copy.js.map +0 -1
  28. package/dist/src/ox-pfp-editor.d.ts +0 -20
  29. package/dist/src/ox-pfp-editor.js +0 -165
  30. package/dist/src/ox-pfp-editor.js.map +0 -1
  31. package/dist/src/ox-pfp-viewer.d.ts +0 -14
  32. package/dist/src/ox-pfp-viewer.js +0 -63
  33. package/dist/src/ox-pfp-viewer.js.map +0 -1
  34. package/dist/stories/index.stories copy.d.ts +0 -24
  35. package/dist/stories/index.stories copy.js +0 -79
  36. package/dist/stories/index.stories copy.js.map +0 -1
  37. package/dist/stories/index.stories.d.ts +0 -24
  38. package/dist/stories/index.stories.js +0 -79
  39. package/dist/stories/index.stories.js.map +0 -1
@@ -1,18 +0,0 @@
1
- import '@material/mwc-icon-button';
2
- import { LitElement, PropertyValues } from 'lit';
3
- import { Contact, ContactItem } from './OxContact';
4
- export declare class OxContactEdit extends LitElement {
5
- static styles: import("lit").CSSResult[];
6
- contact: Contact;
7
- private stageContact;
8
- note: HTMLTextAreaElement;
9
- fields: NodeListOf<HTMLDivElement>;
10
- render(): import("lit-html").TemplateResult<1>;
11
- updated(changes: PropertyValues<this>): void;
12
- buildItems(): ContactItem[];
13
- buildStageContact(): void;
14
- onChangeItem(e: Event, item: ContactItem): void;
15
- onSave(): void;
16
- onCancel(): void;
17
- onReset(): void;
18
- }
@@ -1,235 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import '@material/mwc-icon-button';
3
- import { html, css, LitElement } from 'lit';
4
- import { property, state, query, queryAll } from 'lit/decorators.js';
5
- import { ContactField } from './OxContact';
6
- import { ScrollbarStyles } from '@operato/styles';
7
- export class OxContactEdit extends LitElement {
8
- constructor() {
9
- super(...arguments);
10
- this.contact = {};
11
- this.stageContact = JSON.parse(JSON.stringify(this.contact));
12
- }
13
- render() {
14
- var _a;
15
- const { items = [], note } = this.stageContact || {};
16
- var sorted = {};
17
- items.forEach(item => {
18
- if (!sorted[item.type]) {
19
- sorted[item.type] = [item];
20
- }
21
- else {
22
- sorted[item.type].push(item);
23
- }
24
- });
25
- const names = [...(sorted[ContactField.Name] || [{ type: ContactField.Name, label: 'name', value: '' }])];
26
- const companies = [
27
- ...(sorted[ContactField.Company] || [{ type: ContactField.Company, label: 'company', value: '' }])
28
- ];
29
- return html `
30
- <div name>
31
- <div monogram>${(_a = names[0]) === null || _a === void 0 ? void 0 : _a.value.replace(/\s/g, '').slice(0, 2)}</div>
32
- <div name-content>
33
- ${names.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} field>
34
- <span>name</span>
35
- <input type="hidden" .value=${item.label} data-item="label" disabled />
36
- <input type="text" .value=${item.value} data-item="value" />
37
- </div>`)}
38
- ${companies.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} field>
39
- <span>company</span>
40
- <input type="hidden" .value=${item.label} data-item="label" disabled />
41
- <input type="text" .value=${item.value} data-item="value" />
42
- </div>`)}
43
- </div>
44
- </div>
45
- ${['email', 'phone', 'address'].map(type => {
46
- var items = [...(sorted[type] || []), { type: type, label: 'work', value: '' }];
47
- return html `
48
- <div data-type=${type}>
49
- ${type}
50
- ${items.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} field>
51
- ${item.value
52
- ? html `<mwc-icon-button icon="cancel"></mwc-icon-button>`
53
- : html `<mwc-icon-button></mwc-icon-button>`}
54
- <select .value=${item.label} data-item="label">
55
- ${['home', 'work', 'other', 'mobile'].map(option => html ` <option value=${option} ?selected=${option === item.label}>${option}</option>`)}
56
- </select>
57
- <input type="text" .value=${item.value} data-item="value" />
58
- </div>`)}
59
- </div>
60
- `;
61
- })}
62
- <div note>
63
- note
64
- <textarea id="note" .value=${note || ''} @change=${() => this.buildStageContact()}></textarea>
65
- </div>
66
-
67
- <div buttons>
68
- <button value="Done" @click=${() => this.onSave()}>Done</button>
69
- <button value="Cancel" @click=${() => this.onCancel()}>Cancel</button>
70
- <button value="Reset" @click=${() => this.onReset()}>Reset</button>
71
- </div>
72
- `;
73
- }
74
- updated(changes) {
75
- if (changes.has('contact')) {
76
- this.stageContact = JSON.parse(JSON.stringify(this.contact));
77
- }
78
- }
79
- buildItems() {
80
- const items = [];
81
- this.fields.forEach(fieldElement => {
82
- const item = fieldElement.item;
83
- if (item.value) {
84
- items.push(item);
85
- }
86
- });
87
- return items;
88
- }
89
- buildStageContact() {
90
- this.stageContact = {
91
- ...this.stageContact,
92
- note: this.note.value,
93
- items: this.buildItems()
94
- };
95
- }
96
- onChangeItem(e, item) {
97
- const target = e.currentTarget;
98
- const labelElement = target.querySelector('[data-item="label"');
99
- const valueElement = target.querySelector('[data-item="value"');
100
- item.label = labelElement.value;
101
- item.value = valueElement.value;
102
- if (e.target === valueElement || item.value) {
103
- this.buildStageContact();
104
- }
105
- }
106
- onSave() {
107
- this.buildStageContact();
108
- this.dispatchEvent(new CustomEvent('edit-done', {
109
- detail: this.stageContact
110
- }));
111
- }
112
- onCancel() {
113
- this.dispatchEvent(new CustomEvent('edit-cancel', {
114
- detail: this.stageContact
115
- }));
116
- }
117
- onReset() {
118
- this.buildStageContact();
119
- this.stageContact = JSON.parse(JSON.stringify(this.contact));
120
- }
121
- }
122
- OxContactEdit.styles = [
123
- ScrollbarStyles,
124
- css `
125
- :host {
126
- display: block;
127
- padding: 25px;
128
-
129
- --mdc-icon-button-size: 16px;
130
- --mdc-icon-size: 16px;
131
- }
132
-
133
- :host > div {
134
- padding: 10px 0;
135
- display: block;
136
- border-bottom: 1px solid blue;
137
- }
138
-
139
- :host > div > div {
140
- padding: 4px 0;
141
- box-sizing: border-box;
142
-
143
- display: flex;
144
- flex-direction: row;
145
- gap: 10px;
146
- }
147
-
148
- :host > div > div:hover {
149
- position: relative;
150
- }
151
-
152
- [data-item='label'] {
153
- width: 100px;
154
- text-align: right;
155
- }
156
-
157
- [data-item='value'] {
158
- flex: 1;
159
- }
160
-
161
- :host > div[name] {
162
- display: flex;
163
- align-items: center;
164
- gap: 10px;
165
- font-weight: bold;
166
- font-size: 1.4em;
167
- }
168
-
169
- :host > div[name] > [monogram] {
170
- display: inline-block;
171
- width: 100px;
172
- height: 100px;
173
- line-height: 100px;
174
- border-radius: 999px;
175
- border: 1px solid darkgray;
176
- box-sizing: border-box;
177
- padding: 0;
178
- font-size: 40px;
179
- font-family: system-ui;
180
- overflow: hidden;
181
- text-align: center;
182
- vertical-align: center;
183
- background-color: gray;
184
- color: white;
185
- text-transform: uppercase;
186
- }
187
-
188
- :host > div[name] > div[name-content] {
189
- flex: 1;
190
-
191
- display: flex;
192
- flex-direction: column;
193
- }
194
-
195
- div[field] {
196
- display: flex;
197
- flex-direction: row;
198
- align-items: center;
199
- gap: 10px;
200
- }
201
-
202
- div[field] > span {
203
- width: 100px;
204
- text-align: right;
205
- }
206
-
207
- div[field] > input {
208
- flex: 1;
209
- }
210
-
211
- textarea {
212
- width: 100%;
213
- height: 100px;
214
- }
215
-
216
- div[buttons] {
217
- display: flex;
218
- flex-direction: row-reverse;
219
- gap: 10px;
220
- }
221
- `
222
- ];
223
- __decorate([
224
- property({ type: Object })
225
- ], OxContactEdit.prototype, "contact", void 0);
226
- __decorate([
227
- state()
228
- ], OxContactEdit.prototype, "stageContact", void 0);
229
- __decorate([
230
- query('#note')
231
- ], OxContactEdit.prototype, "note", void 0);
232
- __decorate([
233
- queryAll('[field]')
234
- ], OxContactEdit.prototype, "fields", void 0);
235
- //# sourceMappingURL=OxContactEdit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OxContactEdit.js","sourceRoot":"","sources":["../../src/OxContactEdit.ts"],"names":[],"mappings":";AAAA,OAAO,2BAA2B,CAAA;AAElC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAW,YAAY,EAAe,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,OAAO,aAAc,SAAQ,UAAU;IAA7C;;QAuG8B,YAAO,GAAY,EAAE,CAAA;QAEhC,iBAAY,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IA6InF,CAAC;IAxIC,MAAM;;QACJ,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,YA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QACJ,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAExB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,WAAW,EAAE;YAC3B,MAAM,EAAE,IAAI,CAAC,YAAY;SAC1B,CAAC,CACH,CAAA;IACH,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,aAAa,EAAE;YAC7B,MAAM,EAAE,IAAI,CAAC,YAAY;SAC1B,CAAC,CACH,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAExB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9D,CAAC;;AApPM,oBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiGF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB;AAExC;IAAR,KAAK,EAAE;mDAAyE;AAEjE;IAAf,KAAK,CAAC,OAAO,CAAC;2CAA2B;AACrB;IAApB,QAAQ,CAAC,SAAS,CAAC;6CAAoC","sourcesContent":["import '@material/mwc-icon-button'\n\nimport { html, css, LitElement, PropertyValues } from 'lit'\nimport { property, state, query, queryAll } from 'lit/decorators.js'\nimport { Contact, ContactField, ContactItem } from './OxContact'\nimport { ScrollbarStyles } from '@operato/styles'\n\nexport class OxContactEdit extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: block;\n padding: 25px;\n\n --mdc-icon-button-size: 16px;\n --mdc-icon-size: 16px;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host > div[name] > [monogram] {\n display: inline-block;\n width: 100px;\n height: 100px;\n line-height: 100px;\n border-radius: 999px;\n border: 1px solid darkgray;\n box-sizing: border-box;\n padding: 0;\n font-size: 40px;\n font-family: system-ui;\n overflow: hidden;\n text-align: center;\n vertical-align: center;\n background-color: gray;\n color: white;\n text-transform: uppercase;\n }\n\n :host > div[name] > div[name-content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n div[field] {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 10px;\n }\n\n div[field] > span {\n width: 100px;\n text-align: right;\n }\n\n div[field] > input {\n flex: 1;\n }\n\n textarea {\n width: 100%;\n height: 100px;\n }\n\n div[buttons] {\n display: flex;\n flex-direction: row-reverse;\n gap: 10px;\n }\n `\n ]\n\n @property({ type: Object }) contact: Contact = {}\n\n @state() private stageContact: Contact = JSON.parse(JSON.stringify(this.contact))\n\n @query('#note') note!: HTMLTextAreaElement\n @queryAll('[field]') fields!: NodeListOf<HTMLDivElement>\n\n render() {\n const { items = [], note } = this.stageContact || {}\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n const names = [...(sorted[ContactField.Name] || [{ type: ContactField.Name, label: 'name', value: '' }])]\n const companies = [\n ...(sorted[ContactField.Company] || [{ type: ContactField.Company, label: 'company', value: '' }])\n ]\n\n return html`\n <div name>\n <div monogram>${names[0]?.value.replace(/\\s/g, '').slice(0, 2)}</div>\n <div name-content>\n ${names.map(\n item => html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} field>\n <span>name</span>\n <input type=\"hidden\" .value=${item.label} data-item=\"label\" disabled />\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n ${companies.map(\n item => html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} field>\n <span>company</span>\n <input type=\"hidden\" .value=${item.label} data-item=\"label\" disabled />\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n </div>\n </div>\n ${['email', 'phone', 'address'].map(type => {\n var items = [...(sorted[type] || []), { type: type as ContactField, label: 'work', value: '' }]\n\n return html`\n <div data-type=${type}>\n ${type}\n ${items.map(\n item =>\n html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} field>\n ${item.value\n ? html`<mwc-icon-button icon=\"cancel\"></mwc-icon-button>`\n : html`<mwc-icon-button></mwc-icon-button>`}\n <select .value=${item.label} data-item=\"label\">\n ${['home', 'work', 'other', 'mobile'].map(\n option => html` <option value=${option} ?selected=${option === item.label}>${option}</option>`\n )}\n </select>\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n </div>\n `\n })}\n <div note>\n note\n <textarea id=\"note\" .value=${note || ''} @change=${() => this.buildStageContact()}></textarea>\n </div>\n\n <div buttons>\n <button value=\"Done\" @click=${() => this.onSave()}>Done</button>\n <button value=\"Cancel\" @click=${() => this.onCancel()}>Cancel</button>\n <button value=\"Reset\" @click=${() => this.onReset()}>Reset</button>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('contact')) {\n this.stageContact = JSON.parse(JSON.stringify(this.contact))\n }\n }\n\n buildItems() {\n const items: ContactItem[] = []\n\n this.fields.forEach(fieldElement => {\n const item = (fieldElement as any).item\n if (item.value) {\n items.push(item)\n }\n })\n\n return items\n }\n\n buildStageContact() {\n this.stageContact = {\n ...this.stageContact,\n note: this.note.value,\n items: this.buildItems()\n }\n }\n\n onChangeItem(e: Event, item: ContactItem) {\n const target = e.currentTarget as HTMLElement\n const labelElement = target.querySelector('[data-item=\"label\"') as HTMLSelectElement\n const valueElement = target.querySelector('[data-item=\"value\"') as HTMLInputElement\n\n item.label = labelElement.value\n item.value = valueElement.value\n\n if (e.target === valueElement || item.value) {\n this.buildStageContact()\n }\n }\n\n onSave() {\n this.buildStageContact()\n\n this.dispatchEvent(\n new CustomEvent('edit-done', {\n detail: this.stageContact\n })\n )\n }\n\n onCancel() {\n this.dispatchEvent(\n new CustomEvent('edit-cancel', {\n detail: this.stageContact\n })\n )\n }\n\n onReset() {\n this.buildStageContact()\n\n this.stageContact = JSON.parse(JSON.stringify(this.contact))\n }\n}\n"]}
@@ -1,35 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare enum ContactField {
3
- Name = "name",
4
- JobTitle = "job-title",
5
- Phone = "phone",
6
- Address = "address",
7
- Email = "email",
8
- Birthday = "birthday",
9
- Profile = "profile",
10
- Picture = "picture",
11
- Department = "department",
12
- Company = "company",
13
- Homepage = "homepage"
14
- }
15
- export declare enum ContactLabel {
16
- home = "home",
17
- work = "work",
18
- other = "other",
19
- mobile = "mobile"
20
- }
21
- export type ContactItem = {
22
- id?: string;
23
- type: ContactField;
24
- label: string;
25
- value: string;
26
- };
27
- export type Contact = {
28
- items?: ContactItem[];
29
- note?: string;
30
- };
31
- export declare class OxContactView extends LitElement {
32
- static styles: import("lit").CSSResult;
33
- contact: Contact;
34
- render(): import("lit-html").TemplateResult<1>;
35
- }
@@ -1,143 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { html, css, LitElement } from 'lit';
3
- import { property } from 'lit/decorators.js';
4
- export var ContactField;
5
- (function (ContactField) {
6
- ContactField["Name"] = "name";
7
- ContactField["JobTitle"] = "job-title";
8
- ContactField["Phone"] = "phone";
9
- ContactField["Address"] = "address";
10
- ContactField["Email"] = "email";
11
- ContactField["Birthday"] = "birthday";
12
- ContactField["Profile"] = "profile";
13
- ContactField["Picture"] = "picture";
14
- ContactField["Department"] = "department";
15
- ContactField["Company"] = "company";
16
- ContactField["Homepage"] = "homepage";
17
- })(ContactField || (ContactField = {}));
18
- export var ContactLabel;
19
- (function (ContactLabel) {
20
- ContactLabel["home"] = "home";
21
- ContactLabel["work"] = "work";
22
- ContactLabel["other"] = "other";
23
- ContactLabel["mobile"] = "mobile";
24
- })(ContactLabel || (ContactLabel = {}));
25
- export class OxContactView extends LitElement {
26
- constructor() {
27
- super(...arguments);
28
- this.contact = {};
29
- }
30
- render() {
31
- var _a;
32
- const { items = [], note } = this.contact;
33
- var sorted = {};
34
- items.forEach(item => {
35
- if (!sorted[item.type]) {
36
- sorted[item.type] = [item];
37
- }
38
- else {
39
- sorted[item.type].push(item);
40
- }
41
- });
42
- const names = sorted[ContactField.Name];
43
- return html `
44
- <div name>
45
- <div monogram>${(_a = names[0]) === null || _a === void 0 ? void 0 : _a.value.replace(/\s/g, '').slice(0, 2)}</div>
46
- ${names.map(item => html `<div>
47
- <span data-item="value">${item.value}</span>
48
- </div>`)}
49
- </div>
50
- ${['email', 'phone', 'address', 'company', 'etc']
51
- .map(type => sorted[type])
52
- .filter(items => items && items.length > 0)
53
- .map(items => html `<div data-type=${items[0].type}>
54
- ${items.map(item => html `<div>
55
- <label data-item="label">${item.label}</label>
56
- <span data-item="value">${item.value}</span>
57
- </div>`)}
58
- </div>`)}
59
- <div note>${note || ''}</div>
60
- `;
61
- }
62
- }
63
- OxContactView.styles = css `
64
- :host {
65
- display: block;
66
- padding: 25px;
67
- }
68
-
69
- :host > div {
70
- padding: 10px 0;
71
- display: block;
72
- border-bottom: 1px solid blue;
73
- }
74
-
75
- :host > div > div {
76
- padding: 4px 0;
77
- box-sizing: border-box;
78
-
79
- display: flex;
80
- flex-direction: row;
81
- gap: 10px;
82
- }
83
-
84
- :host > div > div:hover {
85
- position: relative;
86
- }
87
-
88
- :host > div > div:hover::before {
89
- font-family: 'Material Icons';
90
- content: 'edit';
91
- display: block;
92
- position: absolute;
93
- text-align: left;
94
- line-height: 24px;
95
- top: 0;
96
- right: 0;
97
- width: 100%;
98
- height: 100%;
99
- opacity: 0.5;
100
- background-image: linear-gradient(var(--primary-color, gray), var(--primary-color, gray));
101
- z-index: -1;
102
- }
103
-
104
- [data-item='label'] {
105
- width: 100px;
106
- text-align: right;
107
- }
108
-
109
- [data-item='value'] {
110
- flex: 1;
111
- }
112
-
113
- :host > div[name] {
114
- display: flex;
115
- align-items: center;
116
- gap: 10px;
117
- font-weight: bold;
118
- font-size: 1.4em;
119
- }
120
-
121
- :host > div[name] > [monogram] {
122
- display: inline-block;
123
- width: 100px;
124
- height: 100px;
125
- line-height: 100px;
126
- border-radius: 999px;
127
- border: 1px solid darkgray;
128
- box-sizing: border-box;
129
- padding: 0;
130
- font-size: 40px;
131
- font-family: system-ui;
132
- overflow: hidden;
133
- text-align: center;
134
- vertical-align: center;
135
- background-color: gray;
136
- color: white;
137
- text-transform: uppercase;
138
- }
139
- `;
140
- __decorate([
141
- property({ type: Object })
142
- ], OxContactView.prototype, "contact", void 0);
143
- //# sourceMappingURL=OxContactView%20copy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OxContactView copy.js","sourceRoot":"","sources":["../../src/OxContactView copy.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAEnD,MAAM,CAAN,IAAY,YAYX;AAZD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,mCAAmB,CAAA;IACnB,qCAAqB,CAAA;AACvB,CAAC,EAZW,YAAY,KAAZ,YAAY,QAYvB;AAED,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,6BAAa,CAAA;I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AAI,CAAA,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;cACxC,KAAK,CAAC,GAAG,CACT,IAAI,CAAC,EAAE,CACL,IAAI,CAAA;6CACyB,IAAI,CAAC,KAAK;4CACX,IAAI,CAAC,KAAK;uBAC/B,CACV;iBACI,CACR;kBACS,IAAI,IAAI,EAAE;KACvB,CAAA;IACH,CAAC;;AAxHM,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4ElB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nexport enum ContactField {\n Name = 'name',\n JobTitle = 'job-title',\n Phone = 'phone',\n Address = 'address',\n Email = 'email',\n Birthday = 'birthday',\n Profile = 'profile',\n Picture = 'picture',\n Department = 'department',\n Company = 'company',\n Homepage = 'homepage'\n}\n\nexport enum ContactLabel {\n home = 'home',\n work = 'work',\n other = 'other',\n mobile = 'mobile'\n}\n\nexport type ContactItem = {\n id?: string\n type: ContactField\n label: string\n value: string\n}\n\nexport type Contact = {\n items?: ContactItem[]\n note?: string\n}\n\nexport class OxContactView extends LitElement {\n static styles = css`\n :host {\n display: block;\n padding: 25px;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n :host > div > div:hover::before {\n font-family: 'Material Icons';\n content: 'edit';\n display: block;\n position: absolute;\n text-align: left;\n line-height: 24px;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n opacity: 0.5;\n background-image: linear-gradient(var(--primary-color, gray), var(--primary-color, gray));\n z-index: -1;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host > div[name] > [monogram] {\n display: inline-block;\n width: 100px;\n height: 100px;\n line-height: 100px;\n border-radius: 999px;\n border: 1px solid darkgray;\n box-sizing: border-box;\n padding: 0;\n font-size: 40px;\n font-family: system-ui;\n overflow: hidden;\n text-align: center;\n vertical-align: center;\n background-color: gray;\n color: white;\n text-transform: uppercase;\n }\n `\n\n @property({ type: Object }) contact: Contact = {}\n\n render() {\n const { items = [], note } = this.contact\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n const names = sorted[ContactField.Name]\n\n return html`\n <div name>\n <div monogram>${names[0]?.value.replace(/\\s/g, '').slice(0, 2)}</div>\n ${names.map(\n item =>\n html`<div>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>\n ${['email', 'phone', 'address', 'company', 'etc']\n .map(type => sorted[type])\n .filter(items => items && items.length > 0)\n .map(\n items => html`<div data-type=${items[0].type}>\n ${items.map(\n item =>\n html`<div>\n <label data-item=\"label\">${item.label}</label>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>`\n )}\n <div note>${note || ''}</div>\n `\n }\n}\n"]}
@@ -1,7 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { Contact } from './OxContact';
3
- export declare class OxContactView extends LitElement {
4
- static styles: import("lit").CSSResult;
5
- contact: Contact;
6
- render(): import("lit-html").TemplateResult<1>;
7
- }
@@ -1,138 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { html, css, LitElement } from 'lit';
3
- import { property } from 'lit/decorators.js';
4
- import { ContactField } from './OxContact';
5
- export class OxContactView extends LitElement {
6
- constructor() {
7
- super(...arguments);
8
- this.contact = {};
9
- }
10
- render() {
11
- var _a;
12
- const { items = [], note } = this.contact;
13
- var sorted = {};
14
- items.forEach(item => {
15
- if (!sorted[item.type]) {
16
- sorted[item.type] = [item];
17
- }
18
- else {
19
- sorted[item.type].push(item);
20
- }
21
- });
22
- const names = sorted[ContactField.Name] || [];
23
- const companies = sorted[ContactField.Company] || [];
24
- return html `
25
- <div name>
26
- <div monogram>${(_a = names[0]) === null || _a === void 0 ? void 0 : _a.value.replace(/\s/g, '').slice(0, 2)}</div>
27
- <div name-content>
28
- ${names.map(item => html `<div>
29
- <span data-item="value">${item.value}</span>
30
- </div>`)}
31
- ${companies.map(item => html `<div>
32
- <span data-item="value">${item.value}</span>
33
- </div>`)}
34
- </div>
35
- </div>
36
- ${['email', 'phone', 'address', 'company', 'etc']
37
- .map(type => sorted[type])
38
- .filter(items => items && items.length > 0)
39
- .map(items => html `<div data-type=${items[0].type}>
40
- ${items[0].type}
41
- ${items.map(item => html `<div>
42
- <label data-item="label">${item.label}</label>
43
- <span data-item="value">${item.value}</span>
44
- </div>`)}
45
- </div>`)}
46
- <div note>
47
- note
48
- <div>${note || ''}</div>
49
- </div>
50
- `;
51
- }
52
- }
53
- OxContactView.styles = css `
54
- :host {
55
- display: block;
56
- }
57
-
58
- :host > div {
59
- padding: 10px 0;
60
- display: block;
61
- border-bottom: 1px solid blue;
62
- }
63
-
64
- :host > div > div {
65
- padding: 4px 0;
66
- box-sizing: border-box;
67
-
68
- display: flex;
69
- flex-direction: row;
70
- gap: 10px;
71
- }
72
-
73
- :host > div > div:hover {
74
- position: relative;
75
- }
76
-
77
- :host > div > div:hover::before {
78
- content: '';
79
- display: block;
80
- position: absolute;
81
- text-align: left;
82
- line-height: 24px;
83
- top: 0;
84
- right: 0;
85
- width: 100%;
86
- height: 100%;
87
- opacity: 0.3;
88
- background-image: linear-gradient(var(--primary-color, gray), var(--primary-color, gray));
89
- z-index: -1;
90
- }
91
-
92
- [data-item='label'] {
93
- width: 100px;
94
- text-align: right;
95
- }
96
-
97
- [data-item='value'] {
98
- flex: 1;
99
- }
100
-
101
- :host > div[name] {
102
- display: flex;
103
- align-items: center;
104
- gap: 10px;
105
- font-weight: bold;
106
- font-size: 1.4em;
107
- }
108
-
109
- :host > div[name] > [monogram] {
110
- display: inline-block;
111
- width: 100px;
112
- height: 100px;
113
- line-height: 100px;
114
- border-radius: 999px;
115
- border: 1px solid darkgray;
116
- box-sizing: border-box;
117
- padding: 0;
118
- font-size: 40px;
119
- font-family: system-ui;
120
- overflow: hidden;
121
- text-align: center;
122
- vertical-align: center;
123
- background-color: gray;
124
- color: white;
125
- text-transform: uppercase;
126
- }
127
-
128
- :host > div[name] > div[name-content] {
129
- flex: 1;
130
-
131
- display: flex;
132
- flex-direction: column;
133
- }
134
- `;
135
- __decorate([
136
- property({ type: Object })
137
- ], OxContactView.prototype, "contact", void 0);
138
- //# sourceMappingURL=OxContactView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OxContactView.js","sourceRoot":"","sources":["../../src/OxContactView.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAW,YAAY,EAAe,MAAM,aAAa,CAAA;AAEhE,MAAM,OAAO,aAAc,SAAQ,UAAU;IAA7C;;QAoF8B,YAAO,GAAY,EAAE,CAAA;IAwDnD,CAAC;IAtDC,MAAM;;QACJ,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QACzC,IAAI,MAAM,GAAsC,EAAE,CAAA;QAElD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,EAAE;gBAChC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,C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GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { Contact, ContactField, ContactItem } from './OxContact'\n\nexport class OxContactView extends LitElement {\n static styles = css`\n :host {\n display: block;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n :host > div > div:hover::before {\n content: '';\n display: block;\n position: absolute;\n text-align: left;\n line-height: 24px;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n opacity: 0.3;\n background-image: linear-gradient(var(--primary-color, gray), var(--primary-color, gray));\n z-index: -1;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host > div[name] > [monogram] {\n display: inline-block;\n width: 100px;\n height: 100px;\n line-height: 100px;\n border-radius: 999px;\n border: 1px solid darkgray;\n box-sizing: border-box;\n padding: 0;\n font-size: 40px;\n font-family: system-ui;\n overflow: hidden;\n text-align: center;\n vertical-align: center;\n background-color: gray;\n color: white;\n text-transform: uppercase;\n }\n\n :host > div[name] > div[name-content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n `\n\n @property({ type: Object }) contact: Contact = {}\n\n render() {\n const { items = [], note } = this.contact\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n const names = sorted[ContactField.Name] || []\n const companies = sorted[ContactField.Company] || []\n\n return html`\n <div name>\n <div monogram>${names[0]?.value.replace(/\\s/g, '').slice(0, 2)}</div>\n <div name-content>\n ${names.map(\n item =>\n html`<div>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n ${companies.map(\n item =>\n html`<div>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>\n </div>\n ${['email', 'phone', 'address', 'company', 'etc']\n .map(type => sorted[type])\n .filter(items => items && items.length > 0)\n .map(\n items => html`<div data-type=${items[0].type}>\n ${items[0].type}\n ${items.map(\n item =>\n html`<div>\n <label data-item=\"label\">${item.label}</label>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>`\n )}\n <div note>\n note\n <div>${note || ''}</div>\n </div>\n `\n }\n}\n"]}
@@ -1,38 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import './ox-contact-edit';
3
- import './ox-contact-view';
4
- export declare enum ContactField {
5
- Name = "name",
6
- JobTitle = "job-title",
7
- Phone = "phone",
8
- Address = "address",
9
- Email = "email",
10
- Birthday = "birthday",
11
- Profile = "profile",
12
- Picture = "picture",
13
- Department = "department",
14
- Company = "company",
15
- Homepage = "homepage"
16
- }
17
- export declare enum ContactLabel {
18
- home = "home",
19
- work = "work",
20
- other = "other",
21
- mobile = "mobile"
22
- }
23
- export type ContactItem = {
24
- id?: string;
25
- type: ContactField;
26
- label: string;
27
- value: string;
28
- };
29
- export type Contact = {
30
- items?: ContactItem[];
31
- note?: string;
32
- };
33
- export declare class OxContact extends LitElement {
34
- static styles: import("lit").CSSResult;
35
- contact: Contact;
36
- editMode?: boolean;
37
- render(): import("lit-html").TemplateResult<1>;
38
- }