-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP panel resize #322
Draft
ext
wants to merge
33
commits into
main
Choose a base branch
from
feature/resize
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WIP panel resize #322
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
8dab553
feat: new component `FResize` (refs SFKUI-6500)
ext 6e1f7fa
refactor: do not merge (refs SFKUI-6500)
ext 57cb84a
fixup! feat: new component `FResize` (refs SFKUI-6500)
ext 47e1f9c
fixup! fixup! feat: new component `FResize` (refs SFKUI-6500)
ext 5765ed7
fixup! fixup! fixup! feat: new component `FResize` (refs SFKUI-6500)
ext 9da8ffe
fixup! fixup! fixup! fixup! feat: new component `FResize` (refs SFKUI…
ext 97c3df3
fixup! fixup! fixup! fixup! fixup! feat: new component `FResize` (ref…
ext 630a137
fixup! fixup! fixup! fixup! fixup! fixup! feat: new component `FResiz…
ext 070c220
fixup! refactor: do not merge (refs SFKUI-6500)
ext edbedf7
fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: new component …
ext 326ddb7
fixup! fixup! refactor: do not merge (refs SFKUI-6500)
ext 7e34898
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: new com…
ext e7d2012
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: …
ext b339f52
fixup! fixup! fixup! refactor: do not merge (refs SFKUI-6500)
ext 4a0f9b7
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 94abf6a
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 501a8de
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext c497066
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 4450a7c
fixup! fixup! fixup! fixup! refactor: do not merge (refs SFKUI-6500)
ext b3d67d1
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext d8a325d
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext d75e8f4
fixup! fixup! fixup! fixup! fixup! refactor: do not merge (refs SFKUI…
ext bcd1152
fixup! fixup! fixup! fixup! fixup! fixup! refactor: do not merge (ref…
ext a51d8d1
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext a1a8c2d
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext cf60694
fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor: do not mer…
ext 0a4e8e3
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 50e60be
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor: do …
ext 6a07b8e
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 7dd94da
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 7c3fda9
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext 4ad34ee
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refact…
ext 2c201d9
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,160 @@ | ||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { IResizePane, FPageLayout, FFieldset, FCheckboxField } from "@fkui/vue"; | ||
|
||
const disabled = ref(false); | ||
const enableLeft = ref(true); | ||
const enableRight = ref(true); | ||
const enableTop = ref(true); | ||
const enableBottom = ref(true); | ||
</script> | ||
|
||
<template> | ||
<router-view /> | ||
<f-page-layout layout="three-column"> | ||
<template #header> | ||
<header v-if="enableTop"> | ||
<i-resize-pane :disabled min="100px" max="200px" initial="100%"> | ||
<template #default="bindings"> | ||
<h2>Sidhuvud</h2> | ||
<p>lorem ipsum dolor sit amet</p> | ||
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre> | ||
</template> | ||
</i-resize-pane> | ||
</header> | ||
</template> | ||
|
||
<template #left> | ||
<template v-if="enableLeft"> | ||
<i-resize-pane :disabled min="25%" max="40%" initial="400px"> | ||
Check failure on line 28 in internal/vue-sandbox/src/App.vue
|
||
<template #default="bindings"> | ||
<h2>Vänsterpanel</h2> | ||
<p>lorem ipsum dolor sit amet</p> | ||
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre> | ||
</template> | ||
</i-resize-pane> | ||
</template> | ||
</template> | ||
|
||
<template #right> | ||
<template v-if="enableRight"> | ||
<i-resize-pane :disabled min="25%" max="40%" initial="400px"> | ||
Check failure on line 40 in internal/vue-sandbox/src/App.vue
|
||
<template #default="bindings"> | ||
<h2>Högerpanel</h2> | ||
<p>Lorem ipsum dolor sit amet</p> | ||
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre> | ||
</template> | ||
</i-resize-pane> | ||
</template> | ||
</template> | ||
|
||
<template #content> | ||
<main> | ||
<h1>Lorem ipsum</h1> | ||
<p>Dolor sit amet.</p> | ||
<h3>Inställningar</h3> | ||
<f-fieldset> | ||
<template #label>Areas</template> | ||
<template #default> | ||
<f-checkbox-field v-model="enableTop" :value="true"> | ||
<template #default>Header</template> | ||
</f-checkbox-field> | ||
<f-checkbox-field v-model="enableLeft" :value="true"> | ||
<template #default>Left panel</template> | ||
</f-checkbox-field> | ||
<f-checkbox-field v-model="enableRight" :value="true"> | ||
<template #default>Right panel</template> | ||
</f-checkbox-field> | ||
<f-checkbox-field v-model="enableBottom" :value="true"> | ||
<template #default>Bottom</template> | ||
</f-checkbox-field> | ||
</template> | ||
</f-fieldset> | ||
<f-fieldset> | ||
<template #label>Settings</template> | ||
<template #default> | ||
<f-checkbox-field v-model="disabled" :value="true"> | ||
<template #default>Disabled</template> | ||
</f-checkbox-field> | ||
</template> | ||
</f-fieldset> | ||
<h3>Begränsa storlek</h3> | ||
<p> | ||
Attributen <code>min=".."</code> och <code>max=".."</code> anger minsta respektive största storleken | ||
en yta kan få. Båda kan sättas antingen till ett eller flera värden. | ||
</p> | ||
<ul> | ||
<li> | ||
Om <code>min</code> utelämnas är default <code>0</code>, effektivt sett ingen nedgre gräns för | ||
minsta storlek. | ||
</li> | ||
<li> | ||
Om <code>max</code> utelämnas är default fönstrets totala storlek, effektivt sett ingen övre | ||
gränst för största storlek. | ||
</li> | ||
</ul> | ||
<p> | ||
Värden kan vara i pixlar (<code>px</code>) eller procent (<code>%</code>). För att sätta flera | ||
värden använd ett kommatecken <code>,</code> som separator. | ||
</p> | ||
<ul> | ||
<li><code>200px</code> - min/max storlek satt till exakt 200px.</li> | ||
<li><code>25%</code> - min/max storlek satt till 25% av fönstrets storlek.</li> | ||
<li><code>200px, 25%</code> - min/max storlek satt till minsta/största av 200px eller 25%.</li> | ||
</ul> | ||
<p> | ||
<strong>Notera!</strong> Storlekarna i debug-utskrift inkluderar storleken på handtaget man drar i. | ||
Just nu idag är den 4px så sätter man <code>min</code> till <code>200px</code> rapporteras det som | ||
<code>204px</code> dvs <code>200px + 4px</code>. Det är förväntat beteende. | ||
</p> | ||
<h3>Tangentbord</h3> | ||
<ul> | ||
<li><kbd>Vänster</kbd> ökar/minskar en vertikal panel.</li> | ||
<li><kbd>Höger</kbd> ökar/minskar en vertikal panel.</li> | ||
<li><kbd>Upp</kbd> ökar/minskar en horizontal panel.</li> | ||
<li><kbd>Ner</kbd> ökar/minskar en horizontal panel.</li> | ||
<li><kbd>Home</kbd> minskar ytan till minsta möjliga.</li> | ||
<li><kbd>End</kbd> ökar ytan till största möjliga.</li> | ||
</ul> | ||
</main> | ||
</template> | ||
|
||
<template #footer> | ||
<footer v-if="enableBottom"> | ||
<i-resize-pane :disabled min="100px" max="200px" initial="100%"> | ||
<template #default="bindings"> | ||
<h2>Sidfot</h2> | ||
<p>lorem ipsum dolor sit amet</p> | ||
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre> | ||
</template> | ||
</i-resize-pane> | ||
</footer> | ||
</template> | ||
</f-page-layout> | ||
</template> | ||
|
||
<style> | ||
body { | ||
background: #eee; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
main { | ||
padding: 1rem; | ||
} | ||
|
||
.container { | ||
background: #fff; | ||
} | ||
|
||
.resize { | ||
background: rgb(144, 255, 255); | ||
} | ||
|
||
kbd { | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
padding: 0.25rem; | ||
background: #fff; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
@use "calendar/calendar"; | ||
@use "popup/popup"; | ||
@use "popupError/popuperror"; | ||
@use "resize-panel/all"; |
2 changes: 2 additions & 0 deletions
2
packages/design/src/internal-components/resize-panel/_all.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@use "i-resize-handle"; | ||
@use "i-resize-pane"; |
97 changes: 97 additions & 0 deletions
97
packages/design/src/internal-components/resize-panel/_i-resize-handle.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
@use "variables" as *; | ||
|
||
$handle-offset: ($handle-size + $handle-expand) * 0.5; | ||
|
||
.resize__handle { | ||
flex: 0 0 $handle-size; | ||
background: $handle-background; | ||
touch-action: none; | ||
user-select: none; | ||
z-index: 1; | ||
position: relative; | ||
transition: z-index 0s $transition-duration; | ||
|
||
@media (forced-colors: active) { | ||
background: CanvasText; | ||
} | ||
|
||
&[aria-orientation="horizontal"] { | ||
cursor: row-resize; | ||
height: $handle-size; | ||
|
||
&::before { | ||
inset: (-$handle-expand) 0; | ||
} | ||
} | ||
|
||
&[aria-orientation="vertical"] { | ||
cursor: col-resize; | ||
width: $handle-size; | ||
|
||
&::before { | ||
inset: 0 (-$handle-expand); | ||
} | ||
} | ||
|
||
&::before { | ||
content: ""; | ||
pointer-events: none; | ||
position: absolute; | ||
background-color: transparent; | ||
transition: background-color $transition-duration ease-in; | ||
} | ||
|
||
&:focus::before, | ||
&:hover::before, | ||
&.drag::before { | ||
background-color: $handle-highlight; | ||
transition-delay: $transition-delay; | ||
|
||
@media (forced-colors: active) { | ||
background-color: Highlight; | ||
} | ||
} | ||
|
||
/* disable regular focus indicator as this component has its own */ | ||
&:focus { | ||
outline: none; | ||
box-shadow: none; | ||
} | ||
|
||
/* when focus by keyboard we dont want the delay or transition */ | ||
&:focus::before { | ||
transition: none; | ||
} | ||
|
||
/* as the handle area expand we increase z-index for the handle to make sure it covers other separators */ | ||
&:hover, | ||
&:focus, | ||
&.drag { | ||
z-index: 2; | ||
transition: z-index 0s 0s; | ||
} | ||
|
||
&.disabled { | ||
cursor: auto; | ||
|
||
&::before { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
.resize--left .resize__handle { | ||
left: $handle-offset; | ||
} | ||
|
||
.resize--right .resize__handle { | ||
right: $handle-offset; | ||
} | ||
|
||
.resize--top .resize__handle { | ||
top: $handle-offset; | ||
} | ||
|
||
.resize--bottom .resize__handle { | ||
bottom: $handle-offset; | ||
} |
49 changes: 49 additions & 0 deletions
49
packages/design/src/internal-components/resize-panel/_i-resize-pane.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@use "variables" as *; | ||
|
||
.resize { | ||
flex-grow: 1; | ||
display: flex; | ||
align-items: stretch; | ||
|
||
&--left { | ||
flex-direction: row; | ||
width: var(--size); | ||
} | ||
|
||
&--right { | ||
flex-direction: row-reverse; | ||
width: var(--size); | ||
} | ||
|
||
&--top { | ||
flex-direction: column; | ||
height: var(--size); | ||
} | ||
|
||
&--bottom { | ||
flex-direction: column-reverse; | ||
height: var(--size); | ||
} | ||
|
||
&__content { | ||
flex: 1 1 auto; | ||
overflow: auto; | ||
box-sizing: border-box; | ||
} | ||
|
||
&--left, | ||
&--right { | ||
.resize__content { | ||
min-width: calc(var(--min) - $handle-size); | ||
max-width: calc(var(--max) - $handle-size); | ||
} | ||
} | ||
|
||
&--top, | ||
&--bottom { | ||
.resize__content { | ||
min-height: calc(var(--min) - $handle-size); | ||
max-height: calc(var(--max) - $handle-size); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/design/src/internal-components/resize-panel/_variables.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* background color */ | ||
$handle-background: #ccc; | ||
|
||
/* highlight color */ | ||
$handle-highlight: hotpink; | ||
|
||
/* the width of the handle */ | ||
$handle-size: 4px; | ||
|
||
/* how much extra space the handle occupies when hovering */ | ||
$handle-expand: 2px; | ||
|
||
/* how long before visually indicating the hover state */ | ||
$transition-delay: 400ms; | ||
|
||
/* how long the animation for the visual indicator is */ | ||
$transition-duration: 200ms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Denna ska återställas innan merge