From 4813411e0454d9765c73bbafa9c384089954901b Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Sat, 17 Feb 2024 02:17:26 +0300 Subject: [PATCH] Migrated Slider --- components/lib/theme/aura/index.js | 2 + components/lib/theme/aura/slider/index.js | 113 ++++++++++++++++++ components/lib/theme/aura/slider/package.json | 6 + 3 files changed, 121 insertions(+) create mode 100644 components/lib/theme/aura/slider/index.js create mode 100644 components/lib/theme/aura/slider/package.json diff --git a/components/lib/theme/aura/index.js b/components/lib/theme/aura/index.js index b238b3809..2a31c9d8a 100644 --- a/components/lib/theme/aura/index.js +++ b/components/lib/theme/aura/index.js @@ -39,6 +39,7 @@ 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 slider from 'primevue/theme/aura/slider'; import speeddial from 'primevue/theme/aura/speeddial'; import splitbutton from 'primevue/theme/aura/splitbutton'; import splitter from 'primevue/theme/aura/splitter'; @@ -213,6 +214,7 @@ export default { scrolltop, skeleton, sidebar, + slider, speeddial, splitter, splitbutton, diff --git a/components/lib/theme/aura/slider/index.js b/components/lib/theme/aura/slider/index.js new file mode 100644 index 000000000..3cb607c41 --- /dev/null +++ b/components/lib/theme/aura/slider/index.js @@ -0,0 +1,113 @@ +export default { + variables: { + colorScheme: { + light: { + track: { + background: '{surface.200}' + }, + handle: { + background: '{surface.200}', + backgroundHover: '{surface.200}', + contentBackground: '{surface.0}' + }, + range: { + background: '{primary.color}' + } + }, + dark: { + track: { + background: '{surface.700}' + }, + handle: { + background: '{surface.700}', + backgroundHover: '{surface.700}', + contentBackground: '{surface.950}' + }, + range: { + background: '{primary.color}' + } + } + } + }, + css: ` +.p-slider { + position: relative; + background: var(--p-slider-track-background); + border-radius: var(--p-rounded-base); +} + +.p-slider-handle { + cursor: grab; + touch-action: none; + display: flex; + justify-content: center; + align-items: center; + height: 20px; + width: 20px; + background: var(--p-slider-handle-background); + border: 0 none; + border-radius: 50%; + transition: background-color var(--p-transition-duration), color var(--p-transition-duration), border-color var(--p-transition-duration), box-shadow var(--p-transition-duration), outline-color var(--p-transition-duration); + outline-color: transparent; +} + +.p-slider-handle::before { + content: ""; + width: 16px; + height: 16px; + display: block; + background-color: var(--p-slider-handle-content-background); + border-radius: 50%; + box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.08), 0px 1px 1px 0px rgba(0, 0, 0, 0.14); +} + +.p-slider:not(.p-disabled) .p-slider-handle:hover { + background: var(--p-slider-handle-background-hover); + border-color: transparent; +} + +.p-slider-handle:focus-visible { + outline: var(--p-focus-ring-width) var(--p-focus-ring-style) var(--p-focus-ring-color); + outline-offset: 0; +} + +.p-slider-range { + display: block; + background: var(--p-slider-range-background); + border-radius: var(--p-rounded-base); +} + +.p-slider.p-slider-horizontal { + height: 3px; +} + +.p-slider-horizontal .p-slider-range { + top: 0; + left: 0; + height: 100%; +} + +.p-slider-horizontal .p-slider-handle { + top: 50%; + margin-top: -10px; + margin-left: -10px; +} + +.p-slider-vertical { + height: 100px; + width: 3px; +} + +.p-slider-vertical .p-slider-handle { + left: 50%; + margin-left: -10px; + margin-bottom: -10px; +} + +.p-slider-vertical .p-slider-range { + bottom: 0; + left: 0; + width: 100%; +} +` +}; diff --git a/components/lib/theme/aura/slider/package.json b/components/lib/theme/aura/slider/package.json new file mode 100644 index 000000000..f8e9d7ae0 --- /dev/null +++ b/components/lib/theme/aura/slider/package.json @@ -0,0 +1,6 @@ +{ + "main": "./index.cjs.js", + "module": "./index.esm.js", + "unpkg": "./index.min.js", + "types": "./index.d.ts" +}