@povio/ui 2.2.3 → 2.2.5
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/Menu/Menu.d.ts +2 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +3 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +2 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +3 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +4 -5
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +6 -2
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +4 -1
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +4 -1
- package/dist/components/overlays/BottomSheet/BottomSheet.d.ts +4 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.js +37 -19
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +4 -1
- package/dist/components/shared/popover.cva.d.ts +4 -0
- package/dist/components/shared/popover.cva.js +3 -0
- package/dist/config/uiConfig.context.d.ts +2 -0
- package/dist/config/uiConfig.context.js +4 -0
- package/dist/config/uiStyle.context.d.ts +4 -0
- package/dist/index.js +1 -1
- package/package.json +57 -19
- package/dist/_virtual/rolldown:runtime.js +0 -31
- package/dist/node_modules/.pnpm/motion@12.23.28_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/motion/dist/es/react.js +0 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { Placement } from 'react-aria';
|
|
2
3
|
import { Key, MenuItemProps } from 'react-aria-components';
|
|
3
4
|
import { MenuCvaVariantProps, MenuItemVariantProps, MenuPopoverVariantProps, MenuPopoverWrapperVariantProps } from './menu.cva';
|
|
4
5
|
export interface MenuItem extends Omit<MenuItemProps, "aria-label" | "textValue" | "children">, MenuItemVariantProps, MenuCvaVariantProps, MenuPopoverVariantProps, MenuPopoverWrapperVariantProps {
|
|
@@ -10,6 +11,7 @@ export interface MenuProps {
|
|
|
10
11
|
trigger: ReactElement;
|
|
11
12
|
items: MenuItem[];
|
|
12
13
|
closeDelay?: number;
|
|
14
|
+
placement?: Placement;
|
|
13
15
|
onAction?: (key: Key, e: any) => void;
|
|
14
16
|
}
|
|
15
17
|
export declare const Menu: (props: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,6 +15,7 @@ interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Da
|
|
|
15
15
|
isDirty?: boolean;
|
|
16
16
|
disableManualEntry?: boolean;
|
|
17
17
|
placeholder?: string;
|
|
18
|
+
inputClassName?: string;
|
|
18
19
|
}
|
|
19
20
|
export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
20
21
|
value?: string | null;
|
|
@@ -17,7 +17,7 @@ import { DateTime } from "luxon";
|
|
|
17
17
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
18
18
|
var DatePickerBase = (props) => {
|
|
19
19
|
const ui = UIConfig.useConfig();
|
|
20
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, placeholder, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
20
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, placeholder, inputClassName, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
21
21
|
const formFieldProps = {
|
|
22
22
|
error,
|
|
23
23
|
label,
|
|
@@ -126,7 +126,8 @@ var DatePickerBase = (props) => {
|
|
|
126
126
|
headerProps,
|
|
127
127
|
todayIcon,
|
|
128
128
|
onOpenDropdown: () => state.toggle(),
|
|
129
|
-
placeholder
|
|
129
|
+
placeholder,
|
|
130
|
+
className: inputClassName
|
|
130
131
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
131
132
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
132
133
|
isDisabled,
|
|
@@ -17,6 +17,7 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
|
|
|
17
17
|
isDirty?: boolean;
|
|
18
18
|
disableManualEntry?: boolean;
|
|
19
19
|
placeholder?: string;
|
|
20
|
+
inputClassName?: string;
|
|
20
21
|
}
|
|
21
22
|
export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
22
23
|
value?: {
|
|
@@ -22,7 +22,7 @@ import { useTranslation } from "react-i18next";
|
|
|
22
22
|
var DateRangePickerBase = (props) => {
|
|
23
23
|
const ui = UIConfig.useConfig();
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, hideSidebar, placeholder, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
25
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
26
26
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
27
27
|
const datePickerInputRef = useRef(null);
|
|
28
28
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
@@ -477,6 +477,7 @@ var DateRangePickerBase = (props) => {
|
|
|
477
477
|
isDirty,
|
|
478
478
|
disableManualEntry,
|
|
479
479
|
placeholder,
|
|
480
|
+
className: inputClassName,
|
|
480
481
|
onOpenDropdown: () => state.toggle()
|
|
481
482
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
482
483
|
hideSidebar,
|
|
@@ -15,6 +15,7 @@ interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omi
|
|
|
15
15
|
isDirty?: boolean;
|
|
16
16
|
disableManualEntry?: boolean;
|
|
17
17
|
placeholder?: string;
|
|
18
|
+
inputClassName?: string;
|
|
18
19
|
}
|
|
19
20
|
export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "value" | "onChange"> {
|
|
20
21
|
value?: string | null;
|
|
@@ -15,7 +15,7 @@ import { Time, createCalendar, getLocalTimeZone, now, toCalendarDateTime, today
|
|
|
15
15
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
16
16
|
var DateTimePickerBase = (props) => {
|
|
17
17
|
const ui = UIConfig.useConfig();
|
|
18
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, isTimeOptional, placeholder, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
18
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
19
19
|
const formFieldProps = {
|
|
20
20
|
error,
|
|
21
21
|
label,
|
|
@@ -147,7 +147,8 @@ var DateTimePickerBase = (props) => {
|
|
|
147
147
|
isRequired,
|
|
148
148
|
disableManualEntry,
|
|
149
149
|
placeholder,
|
|
150
|
-
onOpenDropdown: () => state.toggle()
|
|
150
|
+
onOpenDropdown: () => state.toggle(),
|
|
151
|
+
className: inputClassName
|
|
151
152
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
152
153
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
153
154
|
isDisabled,
|
|
@@ -23,7 +23,8 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
23
23
|
isRequired?: boolean;
|
|
24
24
|
disableManualEntry?: boolean;
|
|
25
25
|
placeholder?: string;
|
|
26
|
+
className?: string;
|
|
26
27
|
onOpenDropdown?: () => void;
|
|
27
28
|
}
|
|
28
|
-
export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, onOpenDropdown, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, className, onOpenDropdown, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
export {};
|
|
@@ -15,7 +15,7 @@ import { useCallback, useImperativeHandle, useRef, useState } from "react";
|
|
|
15
15
|
import { Button } from "react-aria-components";
|
|
16
16
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
17
17
|
import { getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
18
|
-
const DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, onOpenDropdown, ...props }) => {
|
|
18
|
+
const DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, className, onOpenDropdown, ...props }) => {
|
|
19
19
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
20
20
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
21
21
|
const [canClear, setCanClear] = useState(false);
|
|
@@ -65,12 +65,11 @@ const DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, butto
|
|
|
65
65
|
const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
|
|
66
66
|
return /* @__PURE__ */ jsxs("div", {
|
|
67
67
|
ref: containerRef,
|
|
68
|
-
className: inputBaseCva({
|
|
68
|
+
className: clsx(inputBaseCva({
|
|
69
69
|
variant,
|
|
70
70
|
as,
|
|
71
|
-
...props
|
|
72
|
-
|
|
73
|
-
}),
|
|
71
|
+
...props
|
|
72
|
+
}), "group/date-picker-content relative flex min-w-input-width-min-width items-center justify-between gap-2", className),
|
|
74
73
|
"data-rac": "",
|
|
75
74
|
"data-datetime-input": "",
|
|
76
75
|
"data-hovered": isHovered || void 0,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import { BottomSheet } from "../../../overlays/BottomSheet/BottomSheet.js";
|
|
2
3
|
import { useBreakpoint } from "../../../../hooks/useBreakpoint.js";
|
|
3
4
|
import { FormFieldHeader } from "../../FormField/FormFieldHeader.js";
|
|
4
5
|
import { FormFieldHeaderClose } from "../../FormField/FormFieldHeaderClose.js";
|
|
6
|
+
import { popover } from "../../../shared/popover.cva.js";
|
|
5
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import clsx$1 from "clsx";
|
|
6
9
|
import { Dialog, Popover } from "react-aria-components";
|
|
7
10
|
const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen, triggerRef, dialogProps, onOpenChange }) => {
|
|
11
|
+
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
8
12
|
if (useBreakpoint("md")) {
|
|
9
13
|
if (!isOpen) return null;
|
|
10
14
|
return /* @__PURE__ */ jsx(Popover, {
|
|
@@ -17,7 +21,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
|
|
|
17
21
|
className: "outline-none!",
|
|
18
22
|
"aria-label": label,
|
|
19
23
|
children: /* @__PURE__ */ jsxs("div", {
|
|
20
|
-
className: "flex overflow-hidden
|
|
24
|
+
className: clsx$1(popoverCva({}), "flex overflow-hidden"),
|
|
21
25
|
children: [!hideSidebar && sidebar, /* @__PURE__ */ jsxs("div", {
|
|
22
26
|
className: "flex flex-1 flex-col justify-between",
|
|
23
27
|
children: [children, footer]
|
|
@@ -38,7 +42,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
|
|
|
38
42
|
children: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
43
|
/* @__PURE__ */ jsx(FormFieldHeader, {
|
|
40
44
|
label,
|
|
41
|
-
className: "mb-
|
|
45
|
+
className: "mb-list-height-title-bottom! shrink-0 px-4 pt-3",
|
|
42
46
|
rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close })
|
|
43
47
|
}),
|
|
44
48
|
children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { clsx } from "clsx";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
|
-
const fileUploadDropZoneBase = cva(["relative w-full rounded-
|
|
3
|
+
const fileUploadDropZoneBase = cva(["relative w-full rounded-file-upload-container-rounding-default"], {
|
|
4
4
|
variants: {
|
|
5
5
|
variant: {
|
|
6
6
|
vertical: ["flex-col justify-center"],
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
|
+
import { popover } from "../../../shared/popover.cva.js";
|
|
1
3
|
import { FormField } from "../../FormField/FormField.js";
|
|
2
4
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
3
5
|
import { SelectAllItemId } from "./useSelectItems.js";
|
|
@@ -12,6 +14,7 @@ import { useLabel, usePreventScroll } from "react-aria";
|
|
|
12
14
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
15
|
const SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }) => {
|
|
14
16
|
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, isSearchable, isClearable, isLoading, as, size, collapseAfter, selectedTagsType } = props;
|
|
17
|
+
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
15
18
|
const formFieldProps = {
|
|
16
19
|
error,
|
|
17
20
|
label,
|
|
@@ -148,7 +151,7 @@ const SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, i
|
|
|
148
151
|
offset: 0,
|
|
149
152
|
children: /* @__PURE__ */ jsx(SelectListBox, {
|
|
150
153
|
...props,
|
|
151
|
-
className: "max-h-80!
|
|
154
|
+
className: clsx(popoverCva({}), "max-h-80! [scrollbar-width:thin]"),
|
|
152
155
|
autoFocus: !isSearchable
|
|
153
156
|
})
|
|
154
157
|
})]
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
|
|
2
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
3
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
4
|
import { useInputCva } from "../../shared/input.cva.js";
|
|
5
|
+
import { popover } from "../../../shared/popover.cva.js";
|
|
4
6
|
import { ColorPicker } from "./ColorPicker.js";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
import { clsx } from "clsx";
|
|
@@ -8,6 +10,7 @@ import { useState } from "react";
|
|
|
8
10
|
import { Button, Dialog, DialogTrigger, Popover } from "react-aria-components";
|
|
9
11
|
const ColorPickerDropdown = ({ colors, value, onChange, isDisabled, children }) => {
|
|
10
12
|
const inputCva = useInputCva();
|
|
13
|
+
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
11
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
12
15
|
const handleChange = (color) => {
|
|
13
16
|
onChange(color);
|
|
@@ -37,7 +40,7 @@ const ColorPickerDropdown = ({ colors, value, onChange, isDisabled, children })
|
|
|
37
40
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
38
41
|
className: "outline-none",
|
|
39
42
|
children: /* @__PURE__ */ jsx("div", {
|
|
40
|
-
className: clsx("flex justify-center overflow-hidden p-2
|
|
43
|
+
className: clsx(popoverCva({}), "flex justify-center overflow-hidden p-2"),
|
|
41
44
|
children: /* @__PURE__ */ jsx(ColorPicker, {
|
|
42
45
|
colors,
|
|
43
46
|
value,
|
|
@@ -13,6 +13,10 @@ interface BottomSheetBaseProps {
|
|
|
13
13
|
footer?: ReactNode;
|
|
14
14
|
sheetMarginTop?: number;
|
|
15
15
|
sheetMarginBottom?: number;
|
|
16
|
+
/** Min downward drag distance (px) to allow close on release. Increase to require a longer drag. */
|
|
17
|
+
closeDragThreshold?: number;
|
|
18
|
+
/** Min downward velocity to close on flick. Increase to require a more intentional swipe. */
|
|
19
|
+
closeVelocityThreshold?: number;
|
|
16
20
|
shouldCloseOnInteractOutside?: () => boolean;
|
|
17
21
|
containerClassName?: string;
|
|
18
22
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
2
|
+
import { useStateAndRef } from "../../../hooks/useStateAndRef.js";
|
|
2
3
|
import { DomUtils } from "../../../utils/dom.utils.js";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { clsx } from "clsx";
|
|
5
6
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
6
7
|
import { Dialog, DialogTrigger, Modal, ModalOverlay } from "react-aria-components";
|
|
7
8
|
import { useResizeObserver, useViewportSize } from "@react-aria/utils";
|
|
9
|
+
import { AnimatePresence, animate, motion, useMotionValue } from "motion/react";
|
|
8
10
|
var MotionModal = motion.create(Modal);
|
|
9
11
|
var MotionModalOverlay = motion.create(ModalOverlay);
|
|
10
12
|
var inertiaTransition = {
|
|
@@ -22,7 +24,10 @@ var staticTransition = {
|
|
|
22
24
|
1
|
|
23
25
|
]
|
|
24
26
|
};
|
|
25
|
-
var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = false, isScrollable = true, height = "full", label, portalContainerRef, children, footer, sheetMarginTop = 96, sheetMarginBottom = 128, shouldCloseOnInteractOutside, containerClassName }) => {
|
|
27
|
+
var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = false, isScrollable = true, height = "full", label, portalContainerRef, children, footer, sheetMarginTop = 96, sheetMarginBottom = 128, closeDragThreshold: closeDragThresholdProp, closeVelocityThreshold: closeVelocityThresholdProp, shouldCloseOnInteractOutside, containerClassName }) => {
|
|
28
|
+
const uiConfig = UIConfig.useConfig();
|
|
29
|
+
const closeDragThreshold = closeDragThresholdProp ?? uiConfig.bottomSheet.closeDragThreshold;
|
|
30
|
+
const closeVelocityThreshold = closeVelocityThresholdProp ?? uiConfig.bottomSheet.closeVelocityThreshold;
|
|
26
31
|
const viewport = useViewportSize();
|
|
27
32
|
const { sheetHeight, windowHeight } = useMemo(() => {
|
|
28
33
|
return {
|
|
@@ -30,20 +35,26 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
30
35
|
windowHeight: Math.max(window.innerHeight, viewport.height) - sheetMarginTop
|
|
31
36
|
};
|
|
32
37
|
}, [viewport.height, sheetMarginTop]);
|
|
33
|
-
const y =
|
|
38
|
+
const y = useMotionValue(sheetHeight);
|
|
34
39
|
const closeVelocityRef = useRef(true);
|
|
35
40
|
const overlayRef = useRef(null);
|
|
36
41
|
const containerRef = useRef(null);
|
|
37
42
|
const dialogRef = useRef(null);
|
|
38
|
-
const footerRef = useRef(null);
|
|
39
43
|
const focusTrapRef = useRef(null);
|
|
44
|
+
const [footerElement, footerRef, setFooterElement] = useStateAndRef(null);
|
|
40
45
|
const [footerHeight, setFooterHeight] = useState(0);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onResize
|
|
44
|
-
setFooterHeight(
|
|
45
|
-
}
|
|
46
|
-
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!footerElement) return;
|
|
48
|
+
const onResize = () => {
|
|
49
|
+
setFooterHeight(footerElement.offsetHeight || 0);
|
|
50
|
+
};
|
|
51
|
+
onResize();
|
|
52
|
+
const observer = new ResizeObserver(onResize);
|
|
53
|
+
observer.observe(footerElement);
|
|
54
|
+
return () => {
|
|
55
|
+
observer.disconnect();
|
|
56
|
+
};
|
|
57
|
+
}, [footerElement]);
|
|
47
58
|
const oldHeightRef = useRef(0);
|
|
48
59
|
useResizeObserver({
|
|
49
60
|
ref: dialogRef,
|
|
@@ -53,11 +64,11 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
53
64
|
oldHeightRef.current = rect.height;
|
|
54
65
|
if (y.get() < 0) {
|
|
55
66
|
y.stop();
|
|
56
|
-
|
|
67
|
+
animate(y, 0);
|
|
57
68
|
}
|
|
58
69
|
}
|
|
59
70
|
});
|
|
60
|
-
return /* @__PURE__ */ jsx(
|
|
71
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxs(MotionModalOverlay, {
|
|
61
72
|
isOpen: true,
|
|
62
73
|
UNSTABLE_portalContainer: portalContainerRef?.current,
|
|
63
74
|
className: clsx("fixed top-0 left-0 z-10 w-screen", containerClassName),
|
|
@@ -118,12 +129,16 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
118
129
|
},
|
|
119
130
|
onDragEnd: (e, { velocity }) => {
|
|
120
131
|
containerRef.current?.style.removeProperty("pointer-events");
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
132
|
+
const yValue = y.get();
|
|
133
|
+
if (yValue > 0) {
|
|
134
|
+
const dragPastThreshold = yValue > closeDragThreshold;
|
|
135
|
+
if (closeVelocityRef.current && velocity.y > closeVelocityThreshold || dragPastThreshold) onOpenChange?.(false);
|
|
136
|
+
else animate(y, 0, {
|
|
137
|
+
...inertiaTransition,
|
|
138
|
+
min: 0,
|
|
139
|
+
max: 0
|
|
140
|
+
});
|
|
141
|
+
}
|
|
127
142
|
},
|
|
128
143
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
129
144
|
className: "relative flex min-h-0 flex-1 flex-col items-stretch outline-none",
|
|
@@ -155,7 +170,10 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
155
170
|
]
|
|
156
171
|
}),
|
|
157
172
|
footer && /* @__PURE__ */ jsx(motion.div, {
|
|
158
|
-
|
|
173
|
+
animate: { opacity: 1 },
|
|
174
|
+
initial: { opacity: 0 },
|
|
175
|
+
exit: { opacity: 0 },
|
|
176
|
+
ref: setFooterElement,
|
|
159
177
|
className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-(--visual-viewport-height) left-0 translate-y-[calc(-100%-var(--scroll-position,0px))]"),
|
|
160
178
|
children: footer
|
|
161
179
|
})
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
1
2
|
import { BottomSheet } from "../BottomSheet/BottomSheet.js";
|
|
2
3
|
import { useBreakpoint } from "../../../hooks/useBreakpoint.js";
|
|
3
4
|
import { FormFieldHeader } from "../../inputs/FormField/FormFieldHeader.js";
|
|
4
5
|
import { FormFieldHeaderClose } from "../../inputs/FormField/FormFieldHeaderClose.js";
|
|
6
|
+
import { popover } from "../../shared/popover.cva.js";
|
|
5
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
import { clsx } from "clsx";
|
|
7
9
|
import { Dialog, DialogTrigger, Popover } from "react-aria-components";
|
|
8
10
|
const ResponsivePopover = ({ trigger, isOpen, onOpenChange, children, popoverClassName, sheetLabel }) => {
|
|
11
|
+
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
9
12
|
if (!useBreakpoint("md")) return /* @__PURE__ */ jsx(BottomSheet, {
|
|
10
13
|
isOpen,
|
|
11
14
|
onOpenChange,
|
|
@@ -31,7 +34,7 @@ const ResponsivePopover = ({ trigger, isOpen, onOpenChange, children, popoverCla
|
|
|
31
34
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
32
35
|
className: "outline-none",
|
|
33
36
|
children: /* @__PURE__ */ jsx("div", {
|
|
34
|
-
className: clsx("overflow-hidden p-2
|
|
37
|
+
className: clsx(popoverCva({}), "overflow-hidden p-2"),
|
|
35
38
|
children
|
|
36
39
|
})
|
|
37
40
|
})
|
|
@@ -9,6 +9,7 @@ import { SelectBaseProps } from '../components/inputs/Selection/shared/SelectBas
|
|
|
9
9
|
import { SliderProps } from '../components/inputs/Slider/Slider';
|
|
10
10
|
import { ToggleProps } from '../components/inputs/Toggle/Toggle';
|
|
11
11
|
import { ActionModalProps } from '../components/overlays/ActionModal/ActionModal';
|
|
12
|
+
import { BottomSheetProps } from '../components/overlays/BottomSheet/BottomSheet';
|
|
12
13
|
export declare namespace UIConfig {
|
|
13
14
|
type DeepRequired<T> = {
|
|
14
15
|
[P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
|
|
@@ -24,6 +25,7 @@ export declare namespace UIConfig {
|
|
|
24
25
|
slider: Pick<SliderProps, "minValue" | "maxValue">;
|
|
25
26
|
dateInput: Pick<DatePickerProps, "todayIcon" | "shouldForceLeadingZeros" | "disableManualEntry">;
|
|
26
27
|
actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
|
|
28
|
+
bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold">;
|
|
27
29
|
}
|
|
28
30
|
interface ProviderProps {
|
|
29
31
|
config?: Partial<Options>;
|
|
@@ -14,6 +14,7 @@ import { StepperIconVariantProps, StepperItemVariantProps, StepperNumberVariantP
|
|
|
14
14
|
import { ModalVariantProps } from '../components/overlays/Modal/modal.cva';
|
|
15
15
|
import { TooltipPointerHorizontalVariantProps, TooltipPointerVerticalVariantProps, TooltipTextVariantProps, TooltipVariantProps } from '../components/overlays/Tooltip/tooltip.cva';
|
|
16
16
|
import { SegmentItemVariantProps, SegmentVariantProps } from '../components/segment/segment.cva';
|
|
17
|
+
import { PopoverVariantProps } from '../components/shared/popover.cva';
|
|
17
18
|
import { AlertVariantProps } from '../components/status/Alert/alert.cva';
|
|
18
19
|
import { ToastVariantProps } from '../components/status/Toast/toast.cva';
|
|
19
20
|
import { TableDataVariantProps, TableHeadDataVariantProps, TableHeadRowVariantProps, TableRowVariantProps } from '../components/table/table.cva';
|
|
@@ -135,6 +136,9 @@ export declare namespace UIStyle {
|
|
|
135
136
|
chevronCva?: Cva<BreadcrumbChevronVariantProps>;
|
|
136
137
|
iconCva?: Cva<BreadcrumbIconVariantProps>;
|
|
137
138
|
};
|
|
139
|
+
popover: {
|
|
140
|
+
cva?: Cva<PopoverVariantProps>;
|
|
141
|
+
};
|
|
138
142
|
}
|
|
139
143
|
interface ProviderProps {
|
|
140
144
|
config?: Partial<Options>;
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ import { Button } from "./components/buttons/Button/Button.js";
|
|
|
55
55
|
import { IconButton } from "./components/buttons/IconButton/IconButton.js";
|
|
56
56
|
import { InlineIconButton } from "./components/buttons/InlineIconButton/InlineIconButton.js";
|
|
57
57
|
import { PillButton } from "./components/buttons/PillButton/PillButton.js";
|
|
58
|
+
import { useStateAndRef } from "./hooks/useStateAndRef.js";
|
|
58
59
|
import { DomUtils } from "./utils/dom.utils.js";
|
|
59
60
|
import { BottomSheet } from "./components/overlays/BottomSheet/BottomSheet.js";
|
|
60
61
|
import { useBreakpoint } from "./hooks/useBreakpoint.js";
|
|
@@ -130,7 +131,6 @@ import { useForm } from "./hooks/useForm.js";
|
|
|
130
131
|
import { useFormAutosave } from "./hooks/useFormAutosave.js";
|
|
131
132
|
import { usePagination } from "./hooks/usePagination.js";
|
|
132
133
|
import { useSorting } from "./hooks/useSorting.js";
|
|
133
|
-
import { useStateAndRef } from "./hooks/useStateAndRef.js";
|
|
134
134
|
import { useTableColumnConfig } from "./hooks/useTableColumnConfig.js";
|
|
135
135
|
import { ArrayUtils } from "./utils/array.utils.js";
|
|
136
136
|
import { QueriesUtils } from "./utils/queries.utils.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,24 +15,6 @@
|
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://povio.com",
|
|
17
17
|
"license": "UNLICENSED",
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"@casl/ability": "^6.7.3",
|
|
20
|
-
"@casl/react": "^5.0.0",
|
|
21
|
-
"@tiptap/core": "^3.19.0",
|
|
22
|
-
"@tiptap/extension-color": "^3.19.0",
|
|
23
|
-
"@tiptap/extension-heading": "^3.19.0",
|
|
24
|
-
"@tiptap/extension-highlight": "^3.19.0",
|
|
25
|
-
"@tiptap/extension-link": "^3.19.0",
|
|
26
|
-
"@tiptap/extension-placeholder": "^3.19.0",
|
|
27
|
-
"@tiptap/extension-text-align": "^3.19.0",
|
|
28
|
-
"@tiptap/extension-text-style": "^3.19.0",
|
|
29
|
-
"@tiptap/extension-underline": "^3.19.0",
|
|
30
|
-
"@tiptap/pm": "^3.19.0",
|
|
31
|
-
"@tiptap/react": "^3.19.0",
|
|
32
|
-
"@tiptap/starter-kit": "^3.19.0",
|
|
33
|
-
"react": "^19.1.0",
|
|
34
|
-
"react-dom": "^19.1.0"
|
|
35
|
-
},
|
|
36
18
|
"dependencies": {
|
|
37
19
|
"@dnd-kit/core": "^6.3.1",
|
|
38
20
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
@@ -68,5 +50,61 @@
|
|
|
68
50
|
"tailwindcss": "^4.1.18",
|
|
69
51
|
"tailwindcss-react-aria-components": "^2.0.1",
|
|
70
52
|
"zod": "^4.3.5"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@casl/ability": "^6.7.3",
|
|
56
|
+
"@casl/react": "^5.0.0",
|
|
57
|
+
"@tiptap/core": "^3.19.0",
|
|
58
|
+
"@tiptap/extension-color": "^3.19.0",
|
|
59
|
+
"@tiptap/extension-heading": "^3.19.0",
|
|
60
|
+
"@tiptap/extension-highlight": "^3.19.0",
|
|
61
|
+
"@tiptap/extension-link": "^3.19.0",
|
|
62
|
+
"@tiptap/extension-placeholder": "^3.19.0",
|
|
63
|
+
"@tiptap/extension-text-align": "^3.19.0",
|
|
64
|
+
"@tiptap/extension-text-style": "^3.19.0",
|
|
65
|
+
"@tiptap/extension-underline": "^3.19.0",
|
|
66
|
+
"@tiptap/pm": "^3.19.0",
|
|
67
|
+
"@tiptap/react": "^3.19.0",
|
|
68
|
+
"@tiptap/starter-kit": "^3.19.0",
|
|
69
|
+
"react": "^19.1.0",
|
|
70
|
+
"react-dom": "^19.1.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"@tiptap/core": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"@tiptap/extension-color": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"@tiptap/extension-heading": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"@tiptap/extension-highlight": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@tiptap/extension-link": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@tiptap/extension-placeholder": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"@tiptap/extension-text-align": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@tiptap/extension-text-style": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@tiptap/extension-underline": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@tiptap/pm": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"@tiptap/react": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"@tiptap/starter-kit": {
|
|
107
|
+
"optional": true
|
|
108
|
+
}
|
|
71
109
|
}
|
|
72
110
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (all, symbols) => {
|
|
6
|
-
let target = {};
|
|
7
|
-
for (var name in all) __defProp(target, name, {
|
|
8
|
-
get: all[name],
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
12
|
-
return target;
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
16
|
-
key = keys[i];
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
-
get: ((k) => from[k]).bind(null, key),
|
|
19
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
25
|
-
if (symbols) {
|
|
26
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
27
|
-
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
28
|
-
}
|
|
29
|
-
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
30
|
-
};
|
|
31
|
-
export { __export, __reExport };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { __export, __reExport } from "../../../../../../../_virtual/rolldown:runtime.js";
|
|
2
|
-
import { m, motion } from "framer-motion";
|
|
3
|
-
export * from "framer-motion";
|
|
4
|
-
var react_exports = /* @__PURE__ */ __export({
|
|
5
|
-
m: () => m,
|
|
6
|
-
motion: () => motion
|
|
7
|
-
}, 1);
|
|
8
|
-
import * as import_framer_motion from "framer-motion";
|
|
9
|
-
__reExport(react_exports, import_framer_motion, void 0, 1);
|
|
10
|
-
export { motion, react_exports };
|