Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forty-onions-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cube-dev/ui-kit': patch
---

Fix RangeSlider to avoid getting stuck at max or min values.
5 changes: 5 additions & 0 deletions .changeset/soft-laws-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cube-dev/ui-kit': patch
---

Fix Underlay's zIndex so modal dialogs can be stackable.
11 changes: 9 additions & 2 deletions src/components/fields/Slider/SliderThumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface SliderThumbProps extends AriaSliderThumbOptions {
}

export function SliderThumb(props: SliderThumbProps) {
let { state, inputRef, isDisabled } = props;
let { state, index, inputRef, isDisabled } = props;

const backupRef = useRef<HTMLInputElement>(null);

Expand All @@ -37,14 +37,21 @@ export function SliderThumb(props: SliderThumbProps) {

const { hoverProps, isHovered } = useHover({ isDisabled });

const isCollapsed = state.step === 2 && state.values[0] === state.values[1];
const isStuck =
state.values[index] === state.getThumbMaxValue(index) &&
state.values[index] === state.getThumbMinValue(index);

const mods = useMemo(() => {
return {
hovered: isHovered,
dragged: isDragging,
focused: !isDragging && isFocused,
disabled: isDisabled,
collapsed: isCollapsed,
stuck: isStuck,
};
}, [isHovered, isDragging, isFocused, isDisabled]);
}, [isHovered, isCollapsed, isStuck, isDragging, isFocused, isDisabled]);

return (
<SliderThumbElement
Expand Down
4 changes: 4 additions & 0 deletions src/components/fields/Slider/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const SliderThumbElement = tasty({
boxShadow: '@focus-shadow, @dragged-shadow, @drop-shadow',
radius: '50%',
transition: 'theme',
zIndex: {
'': 0,
'collapsed & !stuck': 1,
},

'@drop-shadow': '0px 2px 4px #dark.2',
'@focus-shadow': {
Expand Down
2 changes: 1 addition & 1 deletion src/components/overlays/Modal/Underlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const UnderlayElement = tasty({
right: 0,
bottom: 0,
left: 0,
zIndex: 9,
zIndex: 10,
transitionDelay: '0ms',
opacity: {
'': 0,
Expand Down
2 changes: 1 addition & 1 deletion src/components/portal/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { usePortal } from './usePortal';
* Portal will be rendered outside me!
*
* <Portal>
* <div>some content will be showed outside of parent container</div>
* <div>some content will be shown outside the parent container</div>
* </Portal>
* </div>
* ```
Expand Down
Loading