Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Commit da4a3ed

Browse files
fix/fixed popover z-index
1 parent 302bea8 commit da4a3ed

File tree

8 files changed

+89
-50
lines changed

8 files changed

+89
-50
lines changed

src/components/ComboboxBase/ComboboxBase.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
2-
<fd-popover ref="popover" adjustsBodyWidth placement="bottom-start">
2+
<fd-popover
3+
ref="popover"
4+
body-size-mode="equal-trigger"
5+
placement="bottom-start"
6+
>
37
<template #control="{ hide, show, toggle }">
48
<div class="fd-combobox-control">
59
<fd-input-group :compact="compact">

src/components/Popover/Popover.vue

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
<k-pop
33
class="fd-popover"
44
ref="kpop"
5-
arrowClass="fd-popover__arrow"
6-
:portalId="$fdDefaultPortalId"
7-
:bodyClass="fdBodyClass"
5+
arrow-class="fd-popover__arrow"
6+
:defaultBodyZIndex="defaultBodyZIndex"
7+
:portal-id="$fdDefaultPortalId"
8+
:body-class="fdBodyClass"
89
:placement="placement"
910
:with-arrow="withArrow"
10-
:adjustsBodyWidth="adjustsBodyWidth"
11+
:body-size-mode="bodySizeMode"
1112
v-bind="$attrs"
1213
v-on="$listeners"
1314
>
@@ -32,7 +33,9 @@
3233
import { Uid } from "./../../mixins";
3334
import KPop from "@ckienle/k-pop";
3435
import FdOnClickOutside from "./../$Support/on-click-outside.vue";
36+
import * as BodySizeMode from "./body-size-mode";
3537
38+
// The popover is a wrapping component that renders a control and can display a popover that is attached to the control.
3639
export default {
3740
name: "FdPopover",
3841
components: { FdOnClickOutside, KPop },
@@ -77,11 +80,42 @@ export default {
7780
}
7881
},
7982
props: {
80-
adjustsBodyWidth: { type: Boolean, default: false },
81-
ignoredElements: { type: Function, default: () => [] },
82-
withArrow: Boolean,
83+
// Default z-index that should be used for the popover body.
84+
defaultBodyZIndex: {
85+
type: Number,
86+
// `1000`
87+
default: 1000
88+
},
89+
// Use a custom body size mode. For details please refer to the [K-Pop](https://christiankienle.github.io/k-pop/examples/#body-size-modes) documentation.
90+
bodySizeMode: {
91+
// Possible Values: `auto` / `equal-trigger` / `at-least-trigger`
92+
type: String,
93+
validator: BodySizeMode.isValid,
94+
// `auto`
95+
default: BodySizeMode.defaultMode
96+
},
97+
adjustsBodyWidth: {
98+
type: Boolean,
99+
default: false
100+
},
101+
// Customize elements that can be interacted with, without the popover being dismissed.
102+
ignoredElements: {
103+
// A function that returns an array of `Element`s that should be ignored:
104+
// Signature: `() => Element[]`
105+
type: Function,
106+
// By default no elements are ignored: `() => []`
107+
default: () => []
108+
},
109+
// Whether or not the popover body has an arrow pointing to the control.
110+
withArrow: {
111+
type: Boolean,
112+
// `false` – no arrow is created by default
113+
default: false
114+
},
115+
// Set the placement of the popover body. This is passed – as is – to Popper.js. This means that all [Popper.js placements](https://popper.js.org/popper-documentation.html#Popper.placements) can be used.
83116
placement: {
84117
type: String,
118+
// `bottom`
85119
default: "bottom"
86120
}
87121
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export const AUTO = "auto";
2+
export const EQUALS_TRIGGER = "equal-trigger";
3+
export const AT_LEAST_TRIGGER = "at-least-trigger";
4+
5+
export const all = [
6+
AUTO, // default
7+
EQUALS_TRIGGER,
8+
AT_LEAST_TRIGGER
9+
];
10+
11+
export const isValid = value => all.indexOf(value) >= 0;
12+
export const defaultMode = AUTO;

src/components/TimePicker/TimePicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="fd-time-picker">
3-
<fd-popover adjustsBodyWidth placement="bottom-start">
3+
<fd-popover body-size-mode="equal-trigger" placement="bottom-start">
44
<template #control="{toggle, show, hide}">
55
<fd-input-group :compact="compact">
66
<template #input>

src/docs/components/CodeView.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,9 @@ pre[class*="language-"] {
9595
background-color: white;
9696
}
9797
98-
:not(pre) > code[class*="language-"],
99-
pre[class*="language-"] {
100-
}
101-
10298
/* Inline code */
10399
:not(pre) > code[class*="language-"] {
104100
padding: 0.2em;
105-
padding-top: 1px;
106-
padding-bottom: 1px;
107101
background-color: white;
108102
border: 0px solid white;
109103
}

src/docs/components/ComponentExample.vue

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
<div v-if="docs !== ''" class="docs rendered-markdown" v-html="docs" />
1616
<FdPanel condensed condensedFooter>
17-
<div v-if="tip" class="tip">
18-
<div class="tip-title">TIP</div>
19-
<div class="tip-body" v-html="tip" />
20-
</div>
17+
<d-tip title="TIP" :content="tip" v-if="tip">
18+
{{ tip }}
19+
</d-tip>
2120
<div class="component">
2221
<div
2322
v-if="fullscreenOnly"
@@ -33,13 +32,9 @@
3332
Show Demo
3433
</FdButton>
3534
</div>
36-
<component
37-
v-else
38-
:class="
39-
condensed ? 'component__condensed' : 'component__default-margin'
40-
"
41-
:is="component"
42-
/>
35+
<div v-else class="component__default-margin">
36+
<component :is="component" />
37+
</div>
4338
</div>
4439
<div slot="footer" class="footer">
4540
<div
@@ -130,20 +125,6 @@ export default {
130125
outline: 0
131126
&:hover
132127
color: blue
133-
.tip
134-
background-color: red
135-
border-left: 0.5rem solid #42b983
136-
background-color: #f3f5f7
137-
padding: 10px
138-
border-bottom: 1px solid #ebebeb
139-
.tip-title
140-
font-weight: 600
141-
font-size: 16px
142-
line-height: 1.7
143-
padding-left: 20px
144-
.tip-body
145-
font-size: 16px
146-
padding: 20px
147128
.fullscreen-demo-button
148129
display: inline-block
149130
float: right
@@ -158,9 +139,8 @@ export default {
158139
.docs
159140
font-size: 1.2em
160141
margin-bottom: 12px
161-
162142
.codeContainer
163143
background-color: white
164144
border-top: 1px solid #eeeeef
165-
padding: 10px
145+
padding: 30px
166146
</style>

src/docs/components/Tip.vue

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
<template>
2-
<div class="tip">
3-
<slot />
2+
<div class="fdd-tip">
3+
<div class="fdd-tip__title">{{ title }}</div>
4+
<div class="fdd-tip__body" v-html="content" />
45
</div>
56
</template>
67

78
<script>
8-
export default {};
9+
export default {
10+
props: {
11+
title: String,
12+
content: String
13+
}
14+
};
915
</script>
1016

1117
<style lang="scss">
12-
.tip {
18+
.fdd-tip {
19+
&__title {
20+
font-weight: 600;
21+
font-size: 16px;
22+
line-height: 1.7;
23+
}
24+
&__body {
25+
font-size: 16px;
26+
}
1327
color: darken(desaturate(#f2f7ff, 50%), 60%);
1428
border-left: 0.3rem solid darken(desaturate(#f2f7ff, 50%), 60%);
1529
margin-top: 20px;
16-
margin-bottom: 20px;
30+
margin-bottom: 0;
1731
margin-left: 0;
1832
margin-right: 0;
19-
padding: 20px;
33+
padding: 30px;
2034
background-color: #f2f7ff;
2135
font-size: 16px;
2236
line-height: 29px;
23-
p {
37+
code {
2438
color: darken(desaturate(#f2f7ff, 50%), 60%);
39+
font-weight: 700;
2540
margin-block-end: 0;
2641
margin-block-start: 0;
2742
}

src/docs/components/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export { default as ExpandTransition } from "./ExpandTransition.vue";
1414
export { default as Tip } from "./Tip.vue";
1515

1616
export const registerComponents = vue => {
17-
vue.component("Tip", Tip);
17+
vue.component("d-tip", Tip);
1818
vue.component("component-api-link", ComponentApiLink);
1919
vue.component("d-markdown", DMarkdown);
2020
vue.component("ExpandTransition", ExpandTransition);

0 commit comments

Comments
 (0)