blob: b2eb9d484339030a2d9d73e2135aaced0c1402c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../settings_vars_css.html">
<link rel="import" href="../controls/settings_textarea.html">
<dom-module id="settings-address-edit-dialog">
<template>
<style include="cr-shared-style settings-shared md-select">
:host {
white-space: nowrap;
}
.address-row {
display: flex;
}
.address-column {
margin-inline-end: 16px;
width: calc((var(--settings-input-max-width) - 16px) / 2);
}
#select-row {
display: block;
/* Fix issue with focus animation making labels wiggle. */
transform: translate3d(0, 0, 0);
}
.md-select {
--md-select-width: var(--settings-input-max-width);
}
.long {
width: var(--settings-input-max-width);
}
cr-input {
--cr-input-error-display: none;
}
cr-input:not(.last-row),
settings-textarea,
.md-select {
margin-bottom: var(--cr-form-field-bottom-spacing);
}
#dialog::part(body-container) {
max-height: 450px;
}
@media all and (max-height: 714px) {
#dialog::part(body-container) {
max-height: 270px;
}
}
</style>
<cr-dialog id="dialog" close-text="$i18n{close}">
<div slot="title">[[title_]]</div>
<div slot="body">
<template is="dom-repeat" items="[[addressWrapper_]]">
<div class="address-row">
<template is="dom-repeat" items="[[item]]">
<template is="dom-if" if="[[item.isTextArea]]">
<settings-textarea label="[[item.component.fieldName]]"
value="{{item.value}}" on-value-changed="updateCanSave_"
class$="address-column [[long_(item)]]" autofocus
spellcheck="false">
</settings-textarea>
</template>
<template is="dom-if" if="[[!item.isTextArea]]">
<cr-input type="text" label="[[item.component.fieldName]]"
autofocus value="{{item.value}}" spellcheck="false"
on-value-changed="updateCanSave_"
class$="address-column [[long_(item)]]">
</cr-input>
</template>
</template>
</div>
</template>
<div id="select-row" class="address-row">
<label id="select-label" class="cr-form-field-label">
$i18n{addressCountry}
</label>
<select class="md-select" aria-labelledby="select-label"
value="[[countryCode_]]" on-change="onCountryChange_">
<option value=""></option>
<template is="dom-repeat" items="[[countries_]]">
<option value="[[getCode_(item)]]"
disabled="[[isDivision_(item)]]">
[[getName_(item)]]
</option>
</template>
</select>
</div>
<div class="address-row">
<cr-input id="phoneInput" type="text" label="$i18n{addressPhone}"
class="address-column last-row" on-value-changed="updateCanSave_"
value="{{phoneNumber_}}" spellcheck="false">
</cr-input>
<cr-input id="emailInput" type="text" label="$i18n{addressEmail}"
on-value-changed="updateCanSave_" value="{{email_}}"
class="address-column long last-row" spellcheck="false">
</cr-input>
</div>
</div>
<div slot="button-container">
<cr-button id="cancelButton" class="cancel-button"
on-click="onCancelTap_">
$i18n{cancel}
</cr-button>
<cr-button id="saveButton" class="action-button"
disabled="[[!canSave_]]" on-click="onSaveButtonTap_">
$i18n{save}
</cr-button>
</div>
</cr-dialog>
</template>
<script src="address_edit_dialog.js"></script>
</dom-module>
|