@skyscanner/backpack-web 38.1.1 → 38.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.
|
@@ -131,25 +131,9 @@ const BpkPopover = ({
|
|
|
131
131
|
children: target
|
|
132
132
|
});
|
|
133
133
|
const classNames = getClassName('bpk-popover', className);
|
|
134
|
-
const bodyClassNames = getClassName(
|
|
134
|
+
const bodyClassNames = getClassName(padded && 'bpk-popover__body--padded');
|
|
135
135
|
const labelId = `bpk-popover-label-${id}`;
|
|
136
136
|
const renderElement = typeof renderTarget === 'function' ? renderTarget() : renderTarget;
|
|
137
|
-
const closeButtonIconElement = /*#__PURE__*/_jsx(BpkCloseButton, {
|
|
138
|
-
label: closeButtonText || closeButtonLabel,
|
|
139
|
-
onClick: event => {
|
|
140
|
-
bindEventSource(EVENT_SOURCES.CLOSE_BUTTON, onClose, event);
|
|
141
|
-
setIsOpenState(false);
|
|
142
|
-
},
|
|
143
|
-
...closeButtonProps
|
|
144
|
-
});
|
|
145
|
-
const closeButtonTextElement = /*#__PURE__*/_jsx(BpkButtonLink, {
|
|
146
|
-
onClick: event => {
|
|
147
|
-
bindEventSource(EVENT_SOURCES.CLOSE_LINK, onClose, event);
|
|
148
|
-
setIsOpenState(false);
|
|
149
|
-
},
|
|
150
|
-
...closeButtonProps,
|
|
151
|
-
children: closeButtonText
|
|
152
|
-
});
|
|
153
137
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
154
138
|
children: [targetElement, isOpenState && /*#__PURE__*/_jsx(FloatingPortal, {
|
|
155
139
|
root: renderElement,
|
|
@@ -189,16 +173,28 @@ const BpkPopover = ({
|
|
|
189
173
|
id: labelId,
|
|
190
174
|
textStyle: TEXT_STYLES.label1,
|
|
191
175
|
children: label
|
|
192
|
-
}), "\xA0", closeButtonIcon ?
|
|
176
|
+
}), "\xA0", closeButtonIcon ? /*#__PURE__*/_jsx(BpkCloseButton, {
|
|
177
|
+
label: closeButtonText || closeButtonLabel,
|
|
178
|
+
onClick: event => {
|
|
179
|
+
bindEventSource(EVENT_SOURCES.CLOSE_BUTTON, onClose, event);
|
|
180
|
+
setIsOpenState(false);
|
|
181
|
+
},
|
|
182
|
+
...closeButtonProps
|
|
183
|
+
}) : closeButtonText && /*#__PURE__*/_jsx(BpkButtonLink, {
|
|
184
|
+
onClick: event => {
|
|
185
|
+
bindEventSource(EVENT_SOURCES.CLOSE_LINK, onClose, event);
|
|
186
|
+
setIsOpenState(false);
|
|
187
|
+
},
|
|
188
|
+
...closeButtonProps,
|
|
189
|
+
children: closeButtonText
|
|
190
|
+
})]
|
|
193
191
|
}) : /*#__PURE__*/_jsx("span", {
|
|
194
192
|
id: labelId,
|
|
195
193
|
className: getClassName('bpk-popover__label'),
|
|
196
194
|
children: label
|
|
197
|
-
}), /*#__PURE__*/
|
|
195
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
198
196
|
className: bodyClassNames,
|
|
199
|
-
children:
|
|
200
|
-
children: children
|
|
201
|
-
}), !labelAsTitle && closeButtonIcon && closeButtonIconElement]
|
|
197
|
+
children: children
|
|
202
198
|
}), actionText && onAction && /*#__PURE__*/_jsx("div", {
|
|
203
199
|
className: getClassName('bpk-popover__action'),
|
|
204
200
|
children: /*#__PURE__*/_jsx(BpkButtonLink, {
|
|
@@ -207,7 +203,14 @@ const BpkPopover = ({
|
|
|
207
203
|
})
|
|
208
204
|
}), !labelAsTitle && closeButtonText && /*#__PURE__*/_jsx("footer", {
|
|
209
205
|
className: getClassName('bpk-popover__footer'),
|
|
210
|
-
children:
|
|
206
|
+
children: /*#__PURE__*/_jsx(BpkButtonLink, {
|
|
207
|
+
onClick: event => {
|
|
208
|
+
bindEventSource(EVENT_SOURCES.CLOSE_LINK, onClose, event);
|
|
209
|
+
setIsOpenState(false);
|
|
210
|
+
},
|
|
211
|
+
...closeButtonProps,
|
|
212
|
+
children: closeButtonText
|
|
213
|
+
})
|
|
211
214
|
})]
|
|
212
215
|
})
|
|
213
216
|
})
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-popover{transition:opacity 200ms ease-in-out;outline:0;background-color:#fff;opacity:1;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}@media(min-width: 32.0625rem){.bpk-popover{max-width:32rem;transition:opacity 50ms ease-in-out}}.bpk-popover--appear{opacity:0}.bpk-popover--appear-active{opacity:1}.bpk-popover__arrow{width:1.5rem;height:1.5rem;fill:#fff}.bpk-popover__arrow[data-hide]{visibility:hidden}.bpk-popover__body
|
|
18
|
+
.bpk-popover{transition:opacity 200ms ease-in-out;outline:0;background-color:#fff;opacity:1;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}@media(min-width: 32.0625rem){.bpk-popover{max-width:32rem;transition:opacity 50ms ease-in-out}}.bpk-popover--appear{opacity:0}.bpk-popover--appear-active{opacity:1}.bpk-popover__arrow{width:1.5rem;height:1.5rem;fill:#fff}.bpk-popover__arrow[data-hide]{visibility:hidden}.bpk-popover__body--padded{padding:1rem}.bpk-popover__body--padded:not(:last-of-type){padding-bottom:0}.bpk-popover__header{display:flex;padding:1rem 1rem 0;justify-content:space-between}.bpk-popover__header~.bpk-popover__body--padded{padding-top:.5rem}.bpk-popover__label{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip:rect(0 0 0 0)}.bpk-popover__footer{padding:.5rem 1rem;text-align:right}html[dir=rtl] .bpk-popover__footer{text-align:left}.bpk-popover__action{padding:0 1rem 1rem 1rem}
|