@povio/ui 2.1.26 → 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/Button.js CHANGED
@@ -34,7 +34,7 @@ const Button$1 = ({ icon: Icon, iconPosition, children, isLoading, className, li
34
34
  children: /* @__PURE__ */ jsx(ButtonContent, {
35
35
  isLoading,
36
36
  icon: Icon,
37
- text: children,
37
+ content: children,
38
38
  ref: onContentRef,
39
39
  hideText: props.iconOnly,
40
40
  iconPosition,
@@ -4,7 +4,7 @@ import { Typography } from "./Typography.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { clsx } from "clsx";
6
6
  import { isValidElement } from "react";
7
- const ButtonContent = ({ ref, text, isLoading, className, icon: Icon, iconClassName, hideText, iconPosition, typography }) => {
7
+ const ButtonContent = ({ ref, content, isLoading, className, icon: Icon, iconClassName, hideText, iconPosition, typography }) => {
8
8
  let iconOrLoader = null;
9
9
  if (isLoading) iconOrLoader = /* @__PURE__ */ jsx(Loader, { className: "shrink-0" });
10
10
  else if (Icon) if (isValidElement(Icon)) iconOrLoader = Icon;
@@ -21,7 +21,7 @@ const ButtonContent = ({ ref, text, isLoading, className, icon: Icon, iconClassN
21
21
  ...typography,
22
22
  className: clsx("hyphens-auto md:truncate", hideText && "sr-only"),
23
23
  ref,
24
- children: text
24
+ children: content
25
25
  })]
26
26
  });
27
27
  };
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,
@@ -23,7 +23,7 @@ const PillButton = ({ children, dismissable, toggle, icon, iconPosition,...props
23
23
  className: props.className
24
24
  }),
25
25
  children: /* @__PURE__ */ jsx(ButtonContent, {
26
- text: children,
26
+ content: children,
27
27
  ref: onContentRef,
28
28
  icon: dismissable ? CloseIcon : icon,
29
29
  iconPosition: dismissable ? "right" : iconPosition,
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,4 +1,4 @@
1
- import { FC, ReactElement, SVGProps } from 'react';
1
+ import { FC, ReactElement, ReactNode, SVGProps } from 'react';
2
2
  import { ButtonProps as AriaButtonProps, ToggleButtonProps as AriaToggleButtonProps } from 'react-aria-components';
3
3
  import { ButtonContentVariantProps } from '../shared/buttonContent.cva';
4
4
  import { LinkNavigationProps } from '../../text/Link/Link';
@@ -17,7 +17,7 @@ type ToggleButtonProps = {
17
17
  isSelected?: boolean;
18
18
  } & AriaToggleButtonProps);
19
19
  export type ButtonProps<IconOnly extends boolean = false> = ButtonVariantProps & ButtonContentVariantProps & AriaButtonProps & ButtonIconProps<IconOnly> & ToggleButtonProps & {
20
- children: string;
20
+ children: ReactNode;
21
21
  isLoading?: boolean;
22
22
  link?: LinkNavigationProps;
23
23
  noDisableWhenLoading?: boolean;
@@ -1,9 +1,9 @@
1
- import { FC, SVGProps } from 'react';
1
+ import { FC, ReactNode, SVGProps } from 'react';
2
2
  import { ButtonProps as AriaButtonProps, ToggleButtonProps as AriaToggleButtonProps } from 'react-aria-components';
3
3
  import { PillButtonVariants } from './pillButton.cva';
4
4
  import { ButtonContentVariantProps } from '../shared/buttonContent.cva';
5
5
  export interface PillButtonProps extends AriaButtonProps, Omit<AriaToggleButtonProps, keyof AriaButtonProps>, ButtonContentVariantProps, PillButtonVariants {
6
- children: string;
6
+ children: ReactNode;
7
7
  dismissable?: boolean;
8
8
  toggle?: boolean;
9
9
  icon?: FC<SVGProps<SVGSVGElement>>;
@@ -1,10 +1,11 @@
1
+ import { ReactNode } from 'react';
1
2
  import { ButtonProps as AriaButtonProps } from 'react-aria-components';
2
3
  import { ButtonIconProps } from '../Button/Button';
3
4
  import { ButtonVariantProps } from '../Button/button.cva';
4
5
  import { ButtonContentVariantProps } from '../shared/buttonContent.cva';
5
6
  import { LinkNavigationProps } from '../../text/Link/Link';
6
7
  export type TextButtonProps = Omit<ButtonVariantProps, "variant"> & ButtonContentVariantProps & AriaButtonProps & ButtonIconProps<true | false> & {
7
- children: string;
8
+ children: ReactNode;
8
9
  isLoading?: boolean;
9
10
  link?: LinkNavigationProps;
10
11
  disableTooltip?: boolean;
@@ -1,9 +1,10 @@
1
+ import { ReactNode } from 'react';
1
2
  import { ToggleButtonProps as AriaToggleButtonProps } from 'react-aria-components';
2
3
  import { ButtonIconProps } from '../Button/Button';
3
4
  import { ButtonVariantProps } from '../Button/button.cva';
4
5
  import { ButtonContentVariantProps } from '../shared/buttonContent.cva';
5
6
  export type ToggleButtonProps = ButtonVariantProps & ButtonContentVariantProps & AriaToggleButtonProps & ButtonIconProps<true | false> & {
6
- children: string;
7
+ children: ReactNode;
7
8
  disableTooltip?: boolean;
8
9
  };
9
10
  export declare const ToggleButton: ({ children, ...props }: ToggleButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
- import { FC, ReactElement, Ref, SVGProps } from 'react';
1
+ import { FC, ReactElement, ReactNode, Ref, SVGProps } from 'react';
2
2
  import { ButtonVariantProps } from '../Button/button.cva';
3
3
  import { ButtonContentVariantProps } from './buttonContent.cva';
4
4
  import { TypographyVariantProps } from '../../text/Typography/typography.cva';
5
5
  interface ButtonContentProps extends ButtonContentVariantProps, Pick<ButtonVariantProps, "size"> {
6
6
  ref?: Ref<HTMLHeadingElement>;
7
- text: string;
7
+ content: ReactNode;
8
8
  isLoading?: boolean;
9
9
  className?: string;
10
10
  icon?: FC<SVGProps<SVGSVGElement>> | ReactElement;
@@ -12,5 +12,5 @@ interface ButtonContentProps extends ButtonContentVariantProps, Pick<ButtonVaria
12
12
  hideText?: boolean;
13
13
  typography?: TypographyVariantProps;
14
14
  }
15
- export declare const ButtonContent: ({ ref, text, isLoading, className, icon: Icon, iconClassName, hideText, iconPosition, typography, }: ButtonContentProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const ButtonContent: ({ ref, content, isLoading, className, icon: Icon, iconClassName, hideText, iconPosition, typography, }: ButtonContentProps) => import("react/jsx-runtime").JSX.Element;
16
16
  export {};
@@ -1,6 +1,6 @@
1
- import { JSX, Ref } from 'react';
1
+ import { JSX, ReactNode, Ref } from 'react';
2
2
  export interface TooltipEllipsisProps {
3
- text: string;
3
+ text: ReactNode;
4
4
  children: (ref: Ref<HTMLHeadingElement> | undefined) => JSX.Element;
5
5
  isDisabled?: boolean;
6
6
  }
@@ -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.26",
3
+ "version": "2.1.28",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",