@povio/ui 2.2.4 → 2.2.6
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/assets/icons/Search.js +13 -0
- package/dist/components/Menu/Menu.d.ts +2 -0
- package/dist/components/Menu/MenuMobile.js +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -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 +3 -2
- 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/CalendarSelectHeader.js +1 -1
- 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 +8 -14
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +1 -1
- package/dist/components/inputs/File/FileUpload.d.ts +1 -1
- package/dist/components/inputs/File/FileUpload.js +15 -3
- package/dist/components/inputs/File/fileUpload.types.d.ts +11 -1
- package/dist/components/inputs/File/shared/FileCardList.js +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentError.js +2 -2
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +3 -3
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +2 -2
- package/dist/components/inputs/File/shared/InputUploadContent.js +1 -1
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
- package/dist/components/inputs/FormField/FormField.js +8 -0
- package/dist/components/inputs/FormField/FormFieldError.js +2 -2
- package/dist/components/inputs/FormField/FormFieldHelper.d.ts +8 -0
- package/dist/components/inputs/FormField/FormFieldHelper.js +12 -0
- package/dist/components/inputs/FormField/FormFieldLabel.js +1 -0
- package/dist/components/inputs/FormField/formFieldError.cva.d.ts +6 -0
- package/dist/components/inputs/FormField/formFieldError.cva.js +9 -0
- package/dist/components/inputs/FormField/formFieldHelper.cva.d.ts +6 -0
- package/dist/components/inputs/FormField/formFieldHelper.cva.js +9 -0
- package/dist/components/inputs/Input/shared/InputContent.js +1 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/inputs/RadioGroup/radio.cva.js +1 -0
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/SelectBase.js +2 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +4 -1
- package/dist/components/inputs/Selection/shared/SelectInput.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +16 -12
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +4 -1
- package/dist/components/inputs/Toggle/toggle.cva.js +1 -0
- package/dist/components/inputs/shared/CheckContent.js +1 -0
- package/dist/components/inputs/shared/label.cva.js +5 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.d.ts +9 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.js +52 -20
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.d.ts +13 -0
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +36 -0
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +8 -10
- package/dist/components/shared/popover.cva.d.ts +4 -0
- package/dist/components/shared/popover.cva.js +3 -0
- package/dist/components/table/CellText.d.ts +2 -1
- package/dist/components/table/CellText.js +16 -10
- package/dist/components/table/ColumnConfig.js +1 -1
- package/dist/components/table/HeaderText.d.ts +5 -2
- package/dist/components/table/HeaderText.js +15 -7
- package/dist/components/table/Table.js +1 -1
- package/dist/components/table/table.cva.d.ts +6 -0
- package/dist/components/table/table.cva.js +3 -1
- package/dist/config/uiConfig.context.d.ts +7 -1
- package/dist/config/uiConfig.context.js +19 -1
- package/dist/config/uiStyle.context.d.ts +13 -1
- package/dist/index.js +2 -2
- package/dist/utils/file.utils.d.ts +4 -0
- package/dist/utils/file.utils.js +7 -2
- package/package.json +1 -1
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
|
|
2
2
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
3
3
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
4
|
-
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
5
4
|
import { ns } from "../../../../config/i18n.js";
|
|
5
|
+
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
7
7
|
import { inputBase, inputSize } from "../../shared/input.cva.js";
|
|
8
8
|
import { SelectInputTags } from "./SelectInputTags.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
|
|
2
1
|
import { ns } from "../../../../config/i18n.js";
|
|
2
|
+
import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
|
|
3
3
|
import { SelectContext } from "./select.context.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { clsx } from "clsx";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
|
|
2
1
|
import { ns } from "../../../../config/i18n.js";
|
|
2
|
+
import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
|
|
3
3
|
import { SelectContext } from "./select.context.js";
|
|
4
4
|
import { selectListBoxItemClass } from "./SelectListBoxItem.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
2
1
|
import { ns } from "../../../../config/i18n.js";
|
|
2
|
+
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
3
3
|
import { SelectContext } from "./select.context.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { clsx } from "clsx";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BottomSheet } from "../../../overlays/BottomSheet/BottomSheet.js";
|
|
2
|
-
import { FormFieldHeader } from "../../FormField/FormFieldHeader.js";
|
|
3
|
-
import { FormFieldHeaderClose } from "../../FormField/FormFieldHeaderClose.js";
|
|
4
2
|
import { FormField } from "../../FormField/FormField.js";
|
|
5
3
|
import { SelectContext } from "./select.context.js";
|
|
6
4
|
import { SelectInput } from "./SelectInput.js";
|
|
7
5
|
import { SelectListBox } from "./SelectListBox.js";
|
|
6
|
+
import { SearchIcon } from "../../../../assets/icons/Search.js";
|
|
7
|
+
import { FormFieldHeaderClose } from "../../FormField/FormFieldHeaderClose.js";
|
|
8
8
|
import { TextInput } from "../../Input/TextInput/TextInput.js";
|
|
9
9
|
import { SelectListBoxSelectionBar } from "./SelectListBoxSelectionBar.js";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -13,7 +13,7 @@ import { useRef } from "react";
|
|
|
13
13
|
import { DialogTrigger } from "react-aria-components";
|
|
14
14
|
import { useLabel } from "react-aria";
|
|
15
15
|
const SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }) => {
|
|
16
|
-
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, isSearchable, isClearable, as, collapseAfter, selectedTagsType } = props;
|
|
16
|
+
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, collapseAfter, selectedTagsType } = props;
|
|
17
17
|
const formFieldProps = {
|
|
18
18
|
error,
|
|
19
19
|
label,
|
|
@@ -41,9 +41,15 @@ const SelectMobile = ({ ref, error, showSelectionContent, inputClassName, contai
|
|
|
41
41
|
};
|
|
42
42
|
const { fieldState, isOpen, setIsOpen, onInputChange, isMultiple } = SelectContext.useSelect();
|
|
43
43
|
const searchInputRef = useRef(null);
|
|
44
|
+
const onBlurRef = useRef(onBlur);
|
|
45
|
+
onBlurRef.current = onBlur;
|
|
46
|
+
const handleOpenChange = (open) => {
|
|
47
|
+
if (!open) onBlurRef.current?.({});
|
|
48
|
+
setIsOpen(open);
|
|
49
|
+
};
|
|
44
50
|
const dialogTriggerProps = {
|
|
45
51
|
isOpen,
|
|
46
|
-
onOpenChange:
|
|
52
|
+
onOpenChange: handleOpenChange
|
|
47
53
|
};
|
|
48
54
|
return /* @__PURE__ */ jsx(FormField, {
|
|
49
55
|
...formFieldProps,
|
|
@@ -68,23 +74,24 @@ const SelectMobile = ({ ref, error, showSelectionContent, inputClassName, contai
|
|
|
68
74
|
isSearchable: false,
|
|
69
75
|
isClearable,
|
|
70
76
|
showSelectionContent,
|
|
71
|
-
onBlur,
|
|
77
|
+
onBlur: void 0,
|
|
72
78
|
fieldProps,
|
|
73
79
|
headerProps,
|
|
74
80
|
collapseAfter,
|
|
75
81
|
selectedTagsType
|
|
76
82
|
}), /* @__PURE__ */ jsx(BottomSheet, {
|
|
77
83
|
isOpen,
|
|
78
|
-
onOpenChange:
|
|
84
|
+
onOpenChange: handleOpenChange,
|
|
79
85
|
onStateChange: (state) => {
|
|
80
86
|
if (state === "opened") searchInputRef.current?.focus();
|
|
81
87
|
},
|
|
82
88
|
label,
|
|
83
89
|
footer: isMultiple && /* @__PURE__ */ jsx(SelectListBoxSelectionBar, {}),
|
|
84
90
|
isDismissable: true,
|
|
91
|
+
hideHeader: isSearchable,
|
|
85
92
|
children: (close) => /* @__PURE__ */ jsxs("div", {
|
|
86
93
|
className: "flex max-h-full flex-col overflow-hidden",
|
|
87
|
-
children: [isSearchable
|
|
94
|
+
children: [isSearchable && /* @__PURE__ */ jsx(TextInput, {
|
|
88
95
|
ref: searchInputRef,
|
|
89
96
|
label,
|
|
90
97
|
placeholder,
|
|
@@ -92,11 +99,8 @@ const SelectMobile = ({ ref, error, showSelectionContent, inputClassName, contai
|
|
|
92
99
|
onChange: onInputChange,
|
|
93
100
|
rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close }),
|
|
94
101
|
inputClassName,
|
|
95
|
-
className: "mb-
|
|
96
|
-
|
|
97
|
-
label,
|
|
98
|
-
rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close }),
|
|
99
|
-
className: "mb-1-5! px-4 pt-3"
|
|
102
|
+
className: "mb-list-height-title-bottom px-list-side-title",
|
|
103
|
+
leadingIcon: !hideSearchIcon ? /* @__PURE__ */ jsx(SearchIcon, { className: "size-6" }) : void 0
|
|
100
104
|
}), /* @__PURE__ */ jsx(SelectListBox, {
|
|
101
105
|
...props,
|
|
102
106
|
autoFocus: !isSearchable,
|
|
@@ -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,
|
|
@@ -6,6 +6,7 @@ const CheckContent = ({ children, className, ...props }) => {
|
|
|
6
6
|
return /* @__PURE__ */ jsx("div", {
|
|
7
7
|
className: clsx$1(UIStyle.useCva("typography.cva", typography)({
|
|
8
8
|
size: "label-1",
|
|
9
|
+
sizeMobile: "label-1",
|
|
9
10
|
variant: "default",
|
|
10
11
|
...props.typography,
|
|
11
12
|
className: "text-text-default-2"
|
|
@@ -30,6 +30,7 @@ const labelTypography = compoundMapper({
|
|
|
30
30
|
as: "default",
|
|
31
31
|
value: {
|
|
32
32
|
size: "label-2",
|
|
33
|
+
sizeMobile: "label-2",
|
|
33
34
|
variant: "prominent-1"
|
|
34
35
|
}
|
|
35
36
|
},
|
|
@@ -37,6 +38,7 @@ const labelTypography = compoundMapper({
|
|
|
37
38
|
as: "filter",
|
|
38
39
|
value: {
|
|
39
40
|
size: "label-1",
|
|
41
|
+
sizeMobile: "label-1",
|
|
40
42
|
variant: "default"
|
|
41
43
|
}
|
|
42
44
|
},
|
|
@@ -44,6 +46,7 @@ const labelTypography = compoundMapper({
|
|
|
44
46
|
as: "inline",
|
|
45
47
|
value: {
|
|
46
48
|
size: "label-2",
|
|
49
|
+
sizeMobile: "label-2",
|
|
47
50
|
variant: "prominent-1"
|
|
48
51
|
}
|
|
49
52
|
},
|
|
@@ -51,12 +54,14 @@ const labelTypography = compoundMapper({
|
|
|
51
54
|
as: "floating",
|
|
52
55
|
value: {
|
|
53
56
|
size: "label-1",
|
|
57
|
+
sizeMobile: "label-1",
|
|
54
58
|
variant: "default"
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
],
|
|
58
62
|
default: {
|
|
59
63
|
size: "label-2",
|
|
64
|
+
sizeMobile: "label-2",
|
|
60
65
|
variant: "prominent-1"
|
|
61
66
|
},
|
|
62
67
|
defaultVariants: { as: "default" }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { TypographyVariantProps } from '../../text/Typography/typography.cva';
|
|
2
3
|
type BottomSheetState = "closed" | "opening" | "opened" | "closing";
|
|
3
4
|
interface BottomSheetBaseProps {
|
|
4
5
|
isOpen?: boolean;
|
|
@@ -6,6 +7,8 @@ interface BottomSheetBaseProps {
|
|
|
6
7
|
onStateChange?: (state: BottomSheetState) => void;
|
|
7
8
|
isDismissable?: boolean;
|
|
8
9
|
isScrollable?: boolean;
|
|
10
|
+
hideHeader?: boolean;
|
|
11
|
+
hideThumb?: boolean;
|
|
9
12
|
height?: "auto" | "full";
|
|
10
13
|
label?: string;
|
|
11
14
|
portalContainerRef?: RefObject<HTMLElement>;
|
|
@@ -13,8 +16,14 @@ interface BottomSheetBaseProps {
|
|
|
13
16
|
footer?: ReactNode;
|
|
14
17
|
sheetMarginTop?: number;
|
|
15
18
|
sheetMarginBottom?: number;
|
|
19
|
+
/** Min downward drag distance (px) to allow close on release. Increase to require a longer drag. */
|
|
20
|
+
closeDragThreshold?: number;
|
|
21
|
+
/** Min downward velocity to close on flick. Increase to require a more intentional swipe. */
|
|
22
|
+
closeVelocityThreshold?: number;
|
|
16
23
|
shouldCloseOnInteractOutside?: () => boolean;
|
|
17
24
|
containerClassName?: string;
|
|
25
|
+
overlayClassName?: string;
|
|
26
|
+
headerTypography?: TypographyVariantProps;
|
|
18
27
|
}
|
|
19
28
|
export interface BottomSheetProps extends BottomSheetBaseProps {
|
|
20
29
|
trigger?: ReactNode;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
2
|
+
import { BottomSheetHeader } from "./BottomSheetHeader.js";
|
|
3
|
+
import { useStateAndRef } from "../../../hooks/useStateAndRef.js";
|
|
1
4
|
import { DomUtils } from "../../../utils/dom.utils.js";
|
|
2
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
6
|
import { clsx } from "clsx";
|
|
4
7
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
8
|
import { Dialog, DialogTrigger, Modal, ModalOverlay } from "react-aria-components";
|
|
6
9
|
import { useResizeObserver, useViewportSize } from "@react-aria/utils";
|
|
7
|
-
import { AnimatePresence, animate, motion, useMotionValue } from "motion/react";
|
|
10
|
+
import { AnimatePresence, animate, motion, useDragControls, useMotionValue } from "motion/react";
|
|
8
11
|
var MotionModal = motion.create(Modal);
|
|
9
12
|
var MotionModalOverlay = motion.create(ModalOverlay);
|
|
10
13
|
var inertiaTransition = {
|
|
@@ -22,7 +25,12 @@ var staticTransition = {
|
|
|
22
25
|
1
|
|
23
26
|
]
|
|
24
27
|
};
|
|
25
|
-
var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable =
|
|
28
|
+
var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = true, isScrollable = true, height = "full", label, portalContainerRef, children, footer, hideHeader, hideThumb: hideThumbProp, sheetMarginTop = 96, sheetMarginBottom = 128, closeDragThreshold: closeDragThresholdProp, closeVelocityThreshold: closeVelocityThresholdProp, shouldCloseOnInteractOutside, containerClassName, overlayClassName, headerTypography: headerTypographyProp }) => {
|
|
29
|
+
const uiConfig = UIConfig.useConfig();
|
|
30
|
+
const closeDragThreshold = closeDragThresholdProp ?? uiConfig.bottomSheet.closeDragThreshold;
|
|
31
|
+
const closeVelocityThreshold = closeVelocityThresholdProp ?? uiConfig.bottomSheet.closeVelocityThreshold;
|
|
32
|
+
const hideThumb = hideThumbProp ?? uiConfig.bottomSheet.hideThumb;
|
|
33
|
+
const headerTypography = headerTypographyProp ?? uiConfig.bottomSheet.headerTypography;
|
|
26
34
|
const viewport = useViewportSize();
|
|
27
35
|
const { sheetHeight, windowHeight } = useMemo(() => {
|
|
28
36
|
return {
|
|
@@ -31,19 +39,26 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
31
39
|
};
|
|
32
40
|
}, [viewport.height, sheetMarginTop]);
|
|
33
41
|
const y = useMotionValue(sheetHeight);
|
|
42
|
+
const dragControls = useDragControls();
|
|
34
43
|
const closeVelocityRef = useRef(true);
|
|
35
44
|
const overlayRef = useRef(null);
|
|
36
45
|
const containerRef = useRef(null);
|
|
37
46
|
const dialogRef = useRef(null);
|
|
38
|
-
const footerRef = useRef(null);
|
|
39
47
|
const focusTrapRef = useRef(null);
|
|
48
|
+
const [footerElement, footerRef, setFooterElement] = useStateAndRef(null);
|
|
40
49
|
const [footerHeight, setFooterHeight] = useState(0);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onResize
|
|
44
|
-
setFooterHeight(
|
|
45
|
-
}
|
|
46
|
-
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!footerElement) return;
|
|
52
|
+
const onResize = () => {
|
|
53
|
+
setFooterHeight(footerElement.offsetHeight || 0);
|
|
54
|
+
};
|
|
55
|
+
onResize();
|
|
56
|
+
const observer = new ResizeObserver(onResize);
|
|
57
|
+
observer.observe(footerElement);
|
|
58
|
+
return () => {
|
|
59
|
+
observer.disconnect();
|
|
60
|
+
};
|
|
61
|
+
}, [footerElement]);
|
|
47
62
|
const oldHeightRef = useRef(0);
|
|
48
63
|
useResizeObserver({
|
|
49
64
|
ref: dialogRef,
|
|
@@ -67,12 +82,12 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
67
82
|
ref: overlayRef,
|
|
68
83
|
shouldCloseOnInteractOutside,
|
|
69
84
|
children: [/* @__PURE__ */ jsx(motion.div, {
|
|
70
|
-
className: "pointer-events-none absolute inset-0 bg-support-overlay",
|
|
85
|
+
className: clsx("pointer-events-none absolute inset-0 bg-support-overlay", overlayClassName),
|
|
71
86
|
animate: { opacity: 1 },
|
|
72
87
|
initial: { opacity: 0 },
|
|
73
88
|
exit: { opacity: 0 }
|
|
74
89
|
}), /* @__PURE__ */ jsx(MotionModal, {
|
|
75
|
-
isDismissable
|
|
90
|
+
isDismissable,
|
|
76
91
|
className: clsx("pointer-events-none flex h-full w-full flex-col items-stretch justify-end outline-none will-change-transform"),
|
|
77
92
|
animate: {
|
|
78
93
|
y: 0,
|
|
@@ -98,6 +113,8 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
98
113
|
minHeight: "100%"
|
|
99
114
|
},
|
|
100
115
|
drag: "y",
|
|
116
|
+
dragListener: false,
|
|
117
|
+
dragControls,
|
|
101
118
|
dragElastic: {
|
|
102
119
|
top: 0,
|
|
103
120
|
bottom: .5
|
|
@@ -118,12 +135,16 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
118
135
|
},
|
|
119
136
|
onDragEnd: (e, { velocity }) => {
|
|
120
137
|
containerRef.current?.style.removeProperty("pointer-events");
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
const yValue = y.get();
|
|
139
|
+
if (yValue > 0) {
|
|
140
|
+
const dragPastThreshold = yValue > closeDragThreshold;
|
|
141
|
+
if (closeVelocityRef.current && velocity.y > closeVelocityThreshold || dragPastThreshold) onOpenChange?.(false);
|
|
142
|
+
else animate(y, 0, {
|
|
143
|
+
...inertiaTransition,
|
|
144
|
+
min: 0,
|
|
145
|
+
max: 0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
127
148
|
},
|
|
128
149
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
129
150
|
className: "relative flex min-h-0 flex-1 flex-col items-stretch outline-none",
|
|
@@ -142,10 +163,18 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
142
163
|
ref: focusTrapRef,
|
|
143
164
|
tabIndex: -1
|
|
144
165
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ jsxs("div", {
|
|
146
167
|
className: "flex max-h-full min-h-0 flex-col items-stretch",
|
|
147
168
|
ref: containerRef,
|
|
148
|
-
children:
|
|
169
|
+
children: [/* @__PURE__ */ jsx(BottomSheetHeader, {
|
|
170
|
+
label,
|
|
171
|
+
dragControls,
|
|
172
|
+
onClose: close,
|
|
173
|
+
isDismissable,
|
|
174
|
+
hideHeader,
|
|
175
|
+
hideThumb,
|
|
176
|
+
headerTypography
|
|
177
|
+
}), typeof children === "function" ? children(close) : children]
|
|
149
178
|
}),
|
|
150
179
|
/* @__PURE__ */ jsx("div", {
|
|
151
180
|
className: "shrink-0",
|
|
@@ -155,7 +184,10 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
155
184
|
]
|
|
156
185
|
}),
|
|
157
186
|
footer && /* @__PURE__ */ jsx(motion.div, {
|
|
158
|
-
|
|
187
|
+
animate: { opacity: 1 },
|
|
188
|
+
initial: { opacity: 0 },
|
|
189
|
+
exit: { opacity: 0 },
|
|
190
|
+
ref: setFooterElement,
|
|
159
191
|
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
192
|
children: footer
|
|
161
193
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DragControls } from 'motion/react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { TypographyVariantProps } from '../../text/Typography/typography.cva';
|
|
4
|
+
export interface BottomSheetHeaderProps {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
isDismissable?: boolean;
|
|
7
|
+
dragControls?: DragControls;
|
|
8
|
+
hideHeader?: boolean;
|
|
9
|
+
hideThumb?: boolean;
|
|
10
|
+
headerTypography?: TypographyVariantProps;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const BottomSheetHeader: ({ label, dragControls, isDismissable, hideThumb, hideHeader, headerTypography, onClose, }: BottomSheetHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CloseIcon } from "../../../assets/icons/Close.js";
|
|
2
|
+
import { Typography } from "../../text/Typography/Typography.js";
|
|
3
|
+
import { ns } from "../../../config/i18n.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { Button } from "react-aria-components";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
8
|
+
const BottomSheetHeader = ({ label, dragControls, isDismissable, hideThumb, hideHeader, headerTypography, onClose }) => {
|
|
9
|
+
const { t } = useTranslation("ui");
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: clsx("pb-list-height-title-bottom", !isDismissable && "pt-list-height-title-top"),
|
|
12
|
+
children: [isDismissable && !hideThumb && /* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: "flex shrink-0 cursor-grab touch-none justify-center px-list-side-title pt-list-height-title-top pb-2-5",
|
|
14
|
+
onPointerDown: (e) => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
dragControls?.start(e);
|
|
17
|
+
},
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-1 w-16 shrink-0 rounded-full bg-elevation-fill-default-3" })
|
|
20
|
+
}), !hideHeader && /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "flex justify-between px-list-side-title",
|
|
22
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
23
|
+
size: "label-2",
|
|
24
|
+
variant: "prominent-1",
|
|
25
|
+
...headerTypography,
|
|
26
|
+
children: label
|
|
27
|
+
}), onClose && isDismissable && /* @__PURE__ */ jsx(Button, {
|
|
28
|
+
onPress: onClose,
|
|
29
|
+
"aria-label": t(($) => $.ui.closeAlt),
|
|
30
|
+
className: "-m-2 shrink-0 p-2 text-interactive-text-secondary-idle focus-visible:outline-interactive-text-secondary-focus",
|
|
31
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "size-6" })
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export { BottomSheetHeader };
|
|
@@ -1,25 +1,23 @@
|
|
|
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
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { popover } from "../../shared/popover.cva.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { Dialog, DialogTrigger, Popover } from "react-aria-components";
|
|
8
8
|
const ResponsivePopover = ({ trigger, isOpen, onOpenChange, children, popoverClassName, sheetLabel }) => {
|
|
9
|
+
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
9
10
|
if (!useBreakpoint("md")) return /* @__PURE__ */ jsx(BottomSheet, {
|
|
10
11
|
isOpen,
|
|
11
12
|
onOpenChange,
|
|
12
13
|
trigger,
|
|
13
14
|
height: "auto",
|
|
14
15
|
isDismissable: true,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close }),
|
|
18
|
-
className: "px-4 pt-3"
|
|
19
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
16
|
+
label: sheetLabel,
|
|
17
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
20
18
|
className: "p-4",
|
|
21
19
|
children
|
|
22
|
-
})
|
|
20
|
+
})
|
|
23
21
|
});
|
|
24
22
|
return /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
25
23
|
isOpen,
|
|
@@ -31,7 +29,7 @@ const ResponsivePopover = ({ trigger, isOpen, onOpenChange, children, popoverCla
|
|
|
31
29
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
32
30
|
className: "outline-none",
|
|
33
31
|
children: /* @__PURE__ */ jsx("div", {
|
|
34
|
-
className: clsx("overflow-hidden p-2
|
|
32
|
+
className: clsx(popoverCva({}), "overflow-hidden p-2"),
|
|
35
33
|
children
|
|
36
34
|
})
|
|
37
35
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import { TypographyProps } from '../text/Typography/Typography';
|
|
3
|
+
export interface CellTextProps extends Partial<Pick<TypographyProps, "variant" | "size">> {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
className?: string;
|
|
5
6
|
style?: CSSProperties;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
1
2
|
import { Typography } from "../text/Typography/Typography.js";
|
|
3
|
+
import { UIConfig } from "../../config/uiConfig.context.js";
|
|
4
|
+
import { tableCellText } from "./table.cva.js";
|
|
2
5
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
variant
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const CellText = (props) => {
|
|
7
|
+
const uiConfig = UIConfig.useConfig();
|
|
8
|
+
const { variant = uiConfig.tableCellText.variant, size = uiConfig.tableCellText.size, children, style, className } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(Typography, {
|
|
10
|
+
className: UIStyle.useCva("table.cellTextCva", tableCellText)({ className }),
|
|
11
|
+
as: "span",
|
|
12
|
+
variant,
|
|
13
|
+
size,
|
|
14
|
+
style,
|
|
15
|
+
"data-rac": true,
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
};
|
|
13
19
|
export { CellText };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Typography } from "../text/Typography/Typography.js";
|
|
2
|
-
import { Checkbox } from "../inputs/Checkbox/Checkbox.js";
|
|
3
2
|
import { ns } from "../../config/i18n.js";
|
|
3
|
+
import { Checkbox } from "../inputs/Checkbox/Checkbox.js";
|
|
4
4
|
import { Modal } from "../overlays/Modal/Modal.js";
|
|
5
5
|
import { Table } from "./Table.js";
|
|
6
6
|
import { useTranslationMemo } from "../../hooks/useTranslationMemo.js";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
|
|
1
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
import { TypographyProps } from '../text/Typography/Typography';
|
|
3
|
+
export interface HeaderTextProps extends Partial<Pick<TypographyProps, "variant" | "size">> {
|
|
3
4
|
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
4
7
|
}
|
|
5
8
|
export declare const HeaderText: FC<HeaderTextProps>;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
1
2
|
import { Typography } from "../text/Typography/Typography.js";
|
|
3
|
+
import { UIConfig } from "../../config/uiConfig.context.js";
|
|
4
|
+
import { tableHeaderText } from "./table.cva.js";
|
|
2
5
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
const HeaderText = (
|
|
4
|
-
|
|
5
|
-
size
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const HeaderText = (props) => {
|
|
7
|
+
const uiConfig = UIConfig.useConfig();
|
|
8
|
+
const { variant = uiConfig.tableHeaderText.variant, size = uiConfig.tableHeaderText.size, children, style, className } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(Typography, {
|
|
10
|
+
className: UIStyle.useCva("table.headerTextCva", tableHeaderText)({ className }),
|
|
11
|
+
as: "span",
|
|
12
|
+
variant,
|
|
13
|
+
size,
|
|
14
|
+
style,
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
};
|
|
10
18
|
export { HeaderText };
|
|
@@ -3,11 +3,11 @@ import { ChevronUpIcon } from "../../assets/icons/ChevronUp.js";
|
|
|
3
3
|
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
4
4
|
import { InlineIconButton } from "../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
5
|
import { useIntersectionObserver } from "../../hooks/useIntersectionObserver.js";
|
|
6
|
+
import { tableData, tableHeadData, tableHeadRow, tableRow } from "./table.cva.js";
|
|
6
7
|
import { CellText } from "./CellText.js";
|
|
7
8
|
import { DragIndicatorIcon } from "../../assets/icons/DragIndicator.js";
|
|
8
9
|
import { HeaderText } from "./HeaderText.js";
|
|
9
10
|
import { useTableNav } from "../../hooks/useTableNav.js";
|
|
10
|
-
import { tableData, tableHeadData, tableHeadRow, tableRow } from "./table.cva.js";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
@@ -17,3 +17,9 @@ export declare const tableData: (props?: ({
|
|
|
17
17
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
18
18
|
export interface TableDataVariantProps extends VariantProps<typeof tableData> {
|
|
19
19
|
}
|
|
20
|
+
export declare const tableHeaderText: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
21
|
+
export interface TableHeaderTextVariantProps extends VariantProps<typeof tableHeaderText> {
|
|
22
|
+
}
|
|
23
|
+
export declare const tableCellText: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
24
|
+
export interface TableCellTextVariantProps extends VariantProps<typeof tableCellText> {
|
|
25
|
+
}
|
|
@@ -32,4 +32,6 @@ const tableData = cva([
|
|
|
32
32
|
} },
|
|
33
33
|
defaultVariants: { hasRightBorder: true }
|
|
34
34
|
});
|
|
35
|
-
|
|
35
|
+
const tableHeaderText = cva(["overflow-hidden text-ellipsis px-table-cell-content-side-m py-table-cell-content-height-m text-text-default-1"]);
|
|
36
|
+
const tableCellText = cva(["block overflow-hidden text-ellipsis text-text-default-2"]);
|
|
37
|
+
export { tableCellText, tableData, tableHeadData, tableHeadRow, tableHeaderText, tableRow };
|