@povio/ui 2.1.27 → 2.1.28

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/Calendar2.js CHANGED
@@ -10,6 +10,30 @@ import { useCalendar } from "@react-aria/calendar";
10
10
  const Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply, onMonthYearChange,...props }) => {
11
11
  const [toggleState, setToggleState] = useState(null);
12
12
  const { calendarProps, prevButtonProps, nextButtonProps } = useCalendar(props.calendarProps, props.state);
13
+ const handleHeaderMonthNavigation = (months) => {
14
+ if (toggleState) return;
15
+ if (!onMonthYearChange) return;
16
+ const focusedDate = props.state.focusedDate;
17
+ if (months === -1) {
18
+ onMonthYearChange(focusedDate.subtract({ months: 1 }));
19
+ return;
20
+ }
21
+ onMonthYearChange(focusedDate.add({ months: 1 }));
22
+ };
23
+ const headerPrevButtonProps = {
24
+ ...prevButtonProps,
25
+ onPress: (event) => {
26
+ prevButtonProps.onPress?.(event);
27
+ handleHeaderMonthNavigation(-1);
28
+ }
29
+ };
30
+ const headerNextButtonProps = {
31
+ ...nextButtonProps,
32
+ onPress: (event) => {
33
+ nextButtonProps.onPress?.(event);
34
+ handleHeaderMonthNavigation(1);
35
+ }
36
+ };
13
37
  const handleDateChange = () => {
14
38
  if (includesTime && !datePickerState.value) setToggleState("time");
15
39
  else onApply();
@@ -41,8 +65,8 @@ const Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply
41
65
  children: [/* @__PURE__ */ jsx(CalendarHeader, {
42
66
  calendarState: props.state,
43
67
  datePickerState,
44
- prevButtonProps,
45
- nextButtonProps,
68
+ prevButtonProps: headerPrevButtonProps,
69
+ nextButtonProps: headerNextButtonProps,
46
70
  includesTime,
47
71
  hourCycle,
48
72
  toggleState,
package/dist/Segment.js CHANGED
@@ -10,7 +10,7 @@ import { useToggleButtonGroup } from "react-aria";
10
10
  import { mergeRefs } from "@react-aria/utils";
11
11
  import { Controller } from "react-hook-form";
12
12
  import { useToggleGroupState } from "react-stately";
13
- var SegmentBase = ({ className, items, error, onChange, value, defaultValue,...rest }) => {
13
+ var SegmentBase = ({ className, items, error, onChange, value, defaultValue, segmentItemClassName,...rest }) => {
14
14
  const props = {
15
15
  ...rest,
16
16
  defaultSelectedKeys: defaultValue ? Array.isArray(defaultValue) ? defaultValue : [defaultValue] : void 0,
@@ -49,6 +49,7 @@ var SegmentBase = ({ className, items, error, onChange, value, defaultValue,...r
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: () => {
@@ -3,14 +3,17 @@ import { Typography } from "./Typography.js";
3
3
  import { segmentItemCva } from "./segment.cva.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { ToggleButton } from "react-aria-components";
6
- const SegmentItem = ({ label, icon, id, isDisabled,...props }) => {
6
+ const SegmentItem = ({ label, icon, id, isDisabled, className,...props }) => {
7
7
  const IconComponent = icon;
8
8
  const iconOnly = !!(icon && !label);
9
9
  const segmentItemCva$1 = UIStyle.useConfig()?.segment?.itemCva ?? segmentItemCva;
10
10
  return /* @__PURE__ */ jsxs(ToggleButton, {
11
11
  ...props,
12
12
  id,
13
- className: segmentItemCva$1({ iconOnly }),
13
+ className: segmentItemCva$1({
14
+ iconOnly,
15
+ className
16
+ }),
14
17
  isDisabled,
15
18
  children: [icon && /* @__PURE__ */ jsx(IconComponent, { className: "size-6" }), label && /* @__PURE__ */ jsx(Typography, {
16
19
  size: "label-2",
@@ -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;
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.1.27",
3
+ "version": "2.1.28",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",