@povio/ui 2.2.11 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/inputs/DateTime/shared/Calendar.js +26 -2
- package/dist/components/overlays/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/segment/Segment.js +2 -1
- package/dist/components/segment/SegmentItem.d.ts +1 -1
- package/dist/components/segment/SegmentItem.js +5 -2
- package/dist/components/segment/segment.types.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +11 -5
- package/package.json +3 -3
|
@@ -52,6 +52,30 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply,
|
|
|
52
52
|
}
|
|
53
53
|
setToggleState("year");
|
|
54
54
|
};
|
|
55
|
+
const handleHeaderMonthNavigation = (months) => {
|
|
56
|
+
if (toggleState) return;
|
|
57
|
+
if (!onMonthYearChange) return;
|
|
58
|
+
const focusedDate = props.state.focusedDate;
|
|
59
|
+
if (months === -1) {
|
|
60
|
+
onMonthYearChange(focusedDate.subtract({ months: 1 }));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
onMonthYearChange(focusedDate.add({ months: 1 }));
|
|
64
|
+
};
|
|
65
|
+
const headerPrevButtonProps = {
|
|
66
|
+
...prevButtonProps,
|
|
67
|
+
onPress: (event) => {
|
|
68
|
+
prevButtonProps.onPress?.(event);
|
|
69
|
+
handleHeaderMonthNavigation(-1);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const headerNextButtonProps = {
|
|
73
|
+
...nextButtonProps,
|
|
74
|
+
onPress: (event) => {
|
|
75
|
+
nextButtonProps.onPress?.(event);
|
|
76
|
+
handleHeaderMonthNavigation(1);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
55
79
|
const handleDateChange = () => {
|
|
56
80
|
if (includesTime && !datePickerState.value) setToggleState("time");
|
|
57
81
|
else onApply();
|
|
@@ -112,8 +136,8 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply,
|
|
|
112
136
|
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
113
137
|
calendarState: props.state,
|
|
114
138
|
datePickerState,
|
|
115
|
-
prevButtonProps,
|
|
116
|
-
nextButtonProps,
|
|
139
|
+
prevButtonProps: headerPrevButtonProps,
|
|
140
|
+
nextButtonProps: headerNextButtonProps,
|
|
117
141
|
includesTime,
|
|
118
142
|
hourCycle,
|
|
119
143
|
granularity,
|
|
@@ -188,7 +188,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = tr
|
|
|
188
188
|
initial: { opacity: 0 },
|
|
189
189
|
exit: { opacity: 0 },
|
|
190
190
|
ref: setFooterElement,
|
|
191
|
-
className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-
|
|
191
|
+
className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-[100dvh] left-0 translate-y-[calc(-100%-var(--scroll-position,0px))]"),
|
|
192
192
|
children: footer
|
|
193
193
|
})
|
|
194
194
|
] })
|
|
@@ -11,7 +11,7 @@ import { mergeRefs } from "@react-aria/utils";
|
|
|
11
11
|
import { Controller } from "react-hook-form";
|
|
12
12
|
import { useToggleGroupState } from "react-stately";
|
|
13
13
|
//#region src/components/segment/Segment.tsx
|
|
14
|
-
var SegmentBase = ({ className, items, error, onChange, value, defaultValue, ...rest }) => {
|
|
14
|
+
var SegmentBase = ({ className, items, error, onChange, value, defaultValue, segmentItemClassName, ...rest }) => {
|
|
15
15
|
const props = {
|
|
16
16
|
...rest,
|
|
17
17
|
defaultSelectedKeys: defaultValue ? Array.isArray(defaultValue) ? defaultValue : [defaultValue] : void 0,
|
|
@@ -49,6 +49,7 @@ var SegmentBase = ({ className, items, error, onChange, value, defaultValue, ...
|
|
|
49
49
|
style: { gridTemplateColumns },
|
|
50
50
|
children: items.map((item, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SegmentItem, {
|
|
51
51
|
...item,
|
|
52
|
+
className: clsx(item.className, segmentItemClassName),
|
|
52
53
|
isDisabled: item.isDisabled || props.isDisabled,
|
|
53
54
|
isSelected: state.selectedKeys.has(item.id),
|
|
54
55
|
onPress: () => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SegmentItem as SegmentItemProps } from './segment.types';
|
|
2
|
-
export declare const SegmentItem: ({ label, icon, id, isDisabled, ...props }: SegmentItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SegmentItem: ({ label, icon, id, isDisabled, className, ...props }: SegmentItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,14 +4,17 @@ import { segmentItemCva } from "./segment.cva.js";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { ToggleButton } from "react-aria-components";
|
|
6
6
|
//#region src/components/segment/SegmentItem.tsx
|
|
7
|
-
var SegmentItem = ({ label, icon, id, isDisabled, ...props }) => {
|
|
7
|
+
var SegmentItem = ({ label, icon, id, isDisabled, className, ...props }) => {
|
|
8
8
|
const IconComponent = icon;
|
|
9
9
|
const iconOnly = !!(icon && !label);
|
|
10
10
|
const segmentItemCva$1 = UIStyle.useCva("segment.itemCva", segmentItemCva);
|
|
11
11
|
return /* @__PURE__ */ jsxs(ToggleButton, {
|
|
12
12
|
...props,
|
|
13
13
|
id,
|
|
14
|
-
className: segmentItemCva$1({
|
|
14
|
+
className: segmentItemCva$1({
|
|
15
|
+
iconOnly,
|
|
16
|
+
className
|
|
17
|
+
}),
|
|
15
18
|
isDisabled,
|
|
16
19
|
children: [icon && /* @__PURE__ */ jsx(IconComponent, { className: "size-6" }), label && /* @__PURE__ */ jsx(Typography, {
|
|
17
20
|
size: "label-2",
|
|
@@ -30,6 +30,7 @@ export type SegmentProps<TKey extends Key = Key> = Omit<ToggleButtonGroupProps &
|
|
|
30
30
|
ref?: Ref<HTMLElement>;
|
|
31
31
|
items: SegmentItem<TKey>[];
|
|
32
32
|
className?: string;
|
|
33
|
+
segmentItemClassName?: string;
|
|
33
34
|
error?: string;
|
|
34
35
|
} & GroupedSegmentProps<TKey>;
|
|
35
36
|
export type ControlledSegmentProps<TFieldValues extends FieldValues, TKey extends Key = Key> = SegmentProps<TKey> & GroupedSegmentControlProps<TFieldValues, TKey>;
|
|
@@ -3,6 +3,6 @@ type UseIntersectionObserverProps = {
|
|
|
3
3
|
onIntersectionChange?: (entry: IntersectionObserverEntry) => void;
|
|
4
4
|
} & IntersectionObserverInit;
|
|
5
5
|
export declare const useIntersectionObserver: <T extends HTMLElement>({ onIntersection, onIntersectionChange, root, rootMargin, threshold, }: UseIntersectionObserverProps) => {
|
|
6
|
-
ref:
|
|
6
|
+
ref: (node: T | null) => void;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { useEffect,
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
//#region src/hooks/useIntersectionObserver.ts
|
|
3
3
|
var useIntersectionObserver = ({ onIntersection, onIntersectionChange, root, rootMargin, threshold }) => {
|
|
4
|
-
const
|
|
4
|
+
const [element, setElement] = useState(null);
|
|
5
|
+
const ref = useCallback((node) => {
|
|
6
|
+
setElement(node);
|
|
7
|
+
}, []);
|
|
5
8
|
useEffect(() => {
|
|
9
|
+
if (!element) return;
|
|
6
10
|
const observer = new IntersectionObserver((entries) => {
|
|
7
11
|
if (entries.some((entry) => entry.isIntersecting)) onIntersection?.();
|
|
8
12
|
onIntersectionChange?.(entries[0]);
|
|
@@ -11,13 +15,15 @@ var useIntersectionObserver = ({ onIntersection, onIntersectionChange, root, roo
|
|
|
11
15
|
rootMargin,
|
|
12
16
|
threshold
|
|
13
17
|
});
|
|
14
|
-
|
|
18
|
+
observer.observe(element);
|
|
15
19
|
return () => observer.disconnect();
|
|
16
20
|
}, [
|
|
17
|
-
|
|
21
|
+
element,
|
|
18
22
|
root,
|
|
19
23
|
onIntersection,
|
|
20
|
-
onIntersectionChange
|
|
24
|
+
onIntersectionChange,
|
|
25
|
+
rootMargin,
|
|
26
|
+
threshold
|
|
21
27
|
]);
|
|
22
28
|
return { ref };
|
|
23
29
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"react-responsive": "^10.0.1",
|
|
48
48
|
"react-stately": "^3.44.0",
|
|
49
49
|
"react-toastify": "^11.0.5",
|
|
50
|
-
"tailwindcss": "^4.2.
|
|
50
|
+
"tailwindcss": "^4.2.4",
|
|
51
51
|
"tailwindcss-react-aria-components": "^2.0.1",
|
|
52
|
-
"zod": "^4.3
|
|
52
|
+
"zod": "^4.4.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@casl/ability": "^6.7.3",
|