From eb8b43d140ae4eb103729097df1f4d51e4a0f45e Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 13 Feb 2024 10:43:52 +0300 Subject: [PATCH] Migrated sidebar --- components/lib/theme/aura/index.js | 2 + components/lib/theme/aura/sidebar/index.js | 216 ++++++++++++++++++ .../lib/theme/aura/sidebar/package.json | 6 + 3 files changed, 224 insertions(+) create mode 100644 components/lib/theme/aura/sidebar/index.js create mode 100644 components/lib/theme/aura/sidebar/package.json diff --git a/components/lib/theme/aura/index.js b/components/lib/theme/aura/index.js index b6981189f..7a8a7314f 100644 --- a/components/lib/theme/aura/index.js +++ b/components/lib/theme/aura/index.js @@ -18,6 +18,7 @@ import progressbar from 'primevue/theme/aura/progressbar'; import progressspinner from 'primevue/theme/aura/progressspinner'; import scrollpanel from 'primevue/theme/aura/scrollpanel'; import scrolltop from 'primevue/theme/aura/scrolltop'; +import sidebar from 'primevue/theme/aura/sidebar'; import skeleton from 'primevue/theme/aura/skeleton'; import splitter from 'primevue/theme/aura/splitter'; import tabview from 'primevue/theme/aura/tabview'; @@ -155,6 +156,7 @@ export default { scrollpanel, scrolltop, skeleton, + sidebar, splitter, tabview, tag, diff --git a/components/lib/theme/aura/sidebar/index.js b/components/lib/theme/aura/sidebar/index.js new file mode 100644 index 000000000..bc42e4060 --- /dev/null +++ b/components/lib/theme/aura/sidebar/index.js @@ -0,0 +1,216 @@ +export default { + variables: { + colorScheme: { + light: { + root: { + background: '{surface.0}', + borderColor: '{surface.200}', + textColor: '{surface.700}' + }, + headerIcon: { + color: '{surface.500}', + colorHover: '{surface.600}', + backgroundHover: '{surface.100}' + } + }, + dark: { + root: { + background: '{surface.900}', + borderColor: '{surface.700}', + textColor: '{surface.0}' + }, + headerIcon: { + color: '{surface.400}', + colorHover: '{surface.300}', + backgroundHover: '{surface.800}' + } + } + } + }, + css: ` +.p-sidebar { + display: flex; + flex-direction: column; + pointer-events: auto; + transform: translate3d(0px, 0px, 0px); + position: relative; + transition: transform 0.3s; + background: var(--p-sidebar-background); + color: var(--p-sidebar-text-color); + border: 0 solid var(--p-sidebar-border-color); + box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); +} + +.p-sidebar-content { + overflow-y: auto; + flex-grow: 1; + padding: 0 1.125rem 1.125rem 1.125rem; +} + +.p-sidebar-header { + display: flex; + align-items: center; + justify-content: space-between; + flex-shrink: 0; + padding: 1.125rem; +} + +.p-sidebar-header-content { + font-weight: 600; + font-size: 1.25rem; +} + +.p-sidebar-icon { + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + position: relative; + width: 1.75rem; + height: 1.75rem; + color: var(--p-sidebar-header-icon-color); + border: 0 none; + background: transparent; + border-radius: 50%; + transition: background-color var(--p-transition-duration), color var(--p-transition-duration), outline-color var(--p-transition-duration); + outline-color: transparent; +} + +.p-sidebar-icon:enabled:hover { + background: var(--p-sidebar-header-icon-background-hover); + color: var(--p-sidebar-header-icon-color-hover); +} + +.p-sidebar-icon:focus-visible { + outline: var(--p-focus-ring-width) var(--p-focus-ring-style) var(--p-focus-ring-color); + outline-offset: var(--p-focus-ring-offset); +} + +.p-sidebar-full .p-sidebar { + transition: none; + transform: none; + width: 100vw !important; + height: 100vh !important; + max-height: 100%; + top: 0px !important; + left: 0px !important; + border-width: 1px; +} + +.p-sidebar-left .p-sidebar-enter-from, +.p-sidebar-left .p-sidebar-leave-to { + transform: translateX(-100%); +} + +.p-sidebar-right .p-sidebar-enter-from, +.p-sidebar-right .p-sidebar-leave-to { + transform: translateX(100%); +} + +.p-sidebar-top .p-sidebar-enter-from, +.p-sidebar-top .p-sidebar-leave-to { + transform: translateY(-100%); +} + +.p-sidebar-bottom .p-sidebar-enter-from, +.p-sidebar-bottom .p-sidebar-leave-to { + transform: translateY(100%); +} + +.p-sidebar-full .p-sidebar-enter-from, +.p-sidebar-full .p-sidebar-leave-to { + opacity: 0; +} + +.p-sidebar-full .p-sidebar-enter-active, +.p-sidebar-full .p-sidebar-leave-active { + transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1); +} + +.p-sidebar-left .p-sidebar { + width: 20rem; + height: 100%; + border-right-width: 1px; +} + +.p-sidebar-right .p-sidebar { + width: 20rem; + height: 100%; + border-left-width: 1px; +} + +.p-sidebar-top .p-sidebar { + height: 10rem; + width: 100%; + border-bottom-width: 1px; +} + +.p-sidebar-bottom .p-sidebar { + height: 10rem; + width: 100%; + border-top-width: 1px; +} + +.p-sidebar-left .p-sidebar-sm, +.p-sidebar-right .p-sidebar-sm { + width: 20rem; +} + +.p-sidebar-left .p-sidebar-md, +.p-sidebar-right .p-sidebar-md { + width: 40rem; +} + +.p-sidebar-left .p-sidebar-lg, +.p-sidebar-right .p-sidebar-lg { + width: 60rem; +} + +.p-sidebar-top .p-sidebar-sm, +.p-sidebar-bottom .p-sidebar-sm { + height: 10rem; +} + +.p-sidebar-top .p-sidebar-md, +.p-sidebar-bottom .p-sidebar-md { + height: 20rem; +} + +.p-sidebar-top .p-sidebar-lg, +.p-sidebar-bottom .p-sidebar-lg { + height: 30rem; +} + +.p-sidebar-left .p-sidebar-content, +.p-sidebar-right .p-sidebar-content, +.p-sidebar-top .p-sidebar-content, +.p-sidebar-bottom .p-sidebar-content { + width: 100%; + height: 100%; +} + +@media screen and (max-width: 64em) { + .p-sidebar-left .p-sidebar-lg, + .p-sidebar-left .p-sidebar-md, + .p-sidebar-right .p-sidebar-lg, + .p-sidebar-right .p-sidebar-md { + width: 20rem; + } +} + +.p-sidebar-mask { + display: none; + pointer-events: none; + background-color: transparent; + transition-property: background-color; +} + +.p-sidebar-mask.p-component-overlay { + pointer-events: auto; +} + +.p-sidebar-visible { + display: flex; +} +` +}; diff --git a/components/lib/theme/aura/sidebar/package.json b/components/lib/theme/aura/sidebar/package.json new file mode 100644 index 000000000..f8e9d7ae0 --- /dev/null +++ b/components/lib/theme/aura/sidebar/package.json @@ -0,0 +1,6 @@ +{ + "main": "./index.cjs.js", + "module": "./index.esm.js", + "unpkg": "./index.min.js", + "types": "./index.d.ts" +}