@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const SearchIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
3
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4
|
+
fill: "none",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
className: "fill-current",
|
|
7
|
+
...props,
|
|
8
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
9
|
+
fill: "currentColor",
|
|
10
|
+
d: "M9.712 16.212q-2.724 0-4.612-1.887T3.212 9.712q0-2.724 1.888-4.612t4.612-1.888q2.726 0 4.613 1.888t1.887 4.612a6.1 6.1 0 0 1-1.3 3.8l5.6 5.6a.95.95 0 0 1 .276.7.95.95 0 0 1-.276.7.95.95 0 0 1-.7.275.95.95 0 0 1-.7-.275l-5.6-5.6q-.75.6-1.725.95t-2.075.35m0-2q1.875 0 3.188-1.312t1.313-3.188T12.9 6.525 9.712 5.212 6.525 6.525 5.212 9.712 6.525 12.9t3.187 1.312"
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
export { SearchIcon };
|
|
@@ -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;
|
|
@@ -43,6 +43,7 @@ const MenuMobile = ({ trigger, items, onAction, ...props }) => {
|
|
|
43
43
|
onOpenChange: setIsOpen,
|
|
44
44
|
trigger,
|
|
45
45
|
isDismissable: true,
|
|
46
|
+
hideHeader: true,
|
|
46
47
|
children: () => /* @__PURE__ */ jsxs(Fragment, { children: [activeItem && /* @__PURE__ */ jsxs(Button, {
|
|
47
48
|
className: clsx(menuItemCva$1({
|
|
48
49
|
...props,
|
|
@@ -24,7 +24,7 @@ var CheckboxBase = (props) => {
|
|
|
24
24
|
"aria-errormessage": error || void 0,
|
|
25
25
|
"data-is-dirty": props.isDirty || void 0,
|
|
26
26
|
"data-is-required": props.isRequired || void 0,
|
|
27
|
-
className: clsx(checkboxIndicatorClass, className),
|
|
27
|
+
className: clsx("relative", checkboxIndicatorClass, className),
|
|
28
28
|
children: [/* @__PURE__ */ jsx(CheckboxCheckmark, {
|
|
29
29
|
variant,
|
|
30
30
|
...rest
|
|
@@ -35,6 +35,7 @@ const checkbox = cva([
|
|
|
35
35
|
const checkboxIndicatorClass = "group flex items-center gap-2";
|
|
36
36
|
const checkboxTypography = compoundMapper({ default: {
|
|
37
37
|
size: "label-1",
|
|
38
|
+
sizeMobile: "label-1",
|
|
38
39
|
variant: "default"
|
|
39
40
|
} });
|
|
40
41
|
const checkboxIcon = cva(["absolute hidden size-3"], {
|
|
@@ -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?: {
|
|
@@ -14,15 +14,15 @@ import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "rea
|
|
|
14
14
|
import { Button } from "react-aria-components";
|
|
15
15
|
import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
|
|
16
16
|
import { mergeRefs } from "@react-aria/utils";
|
|
17
|
+
import { useTranslation } from "react-i18next";
|
|
17
18
|
import { Controller } from "react-hook-form";
|
|
18
19
|
import { createCalendar, endOfMonth, endOfWeek, endOfYear, getLocalTimeZone, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
|
|
19
20
|
import { DateTime } from "luxon";
|
|
20
21
|
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
21
|
-
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,
|
|
@@ -9,8 +9,8 @@ import { ns } from "../../../../config/i18n.js";
|
|
|
9
9
|
import { Select } from "../../Selection/Select/Select.js";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useMemo } from "react";
|
|
12
|
-
import { useDateFormatter } from "@react-aria/i18n";
|
|
13
12
|
import { useTranslation } from "react-i18next";
|
|
13
|
+
import { useDateFormatter } from "@react-aria/i18n";
|
|
14
14
|
const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, isNextMonthDisabled, isNextYearDisabled, offset = { months: 0 }, onNavigate, maxDate, minDate }) => {
|
|
15
15
|
const { t } = useTranslation("ui");
|
|
16
16
|
const displayDate = state.visibleRange.start.add(offset);
|
|
@@ -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,12 @@
|
|
|
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
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { popover } from "../../../shared/popover.cva.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import clsx$1 from "clsx";
|
|
6
7
|
import { Dialog, Popover } from "react-aria-components";
|
|
7
8
|
const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen, triggerRef, dialogProps, onOpenChange }) => {
|
|
9
|
+
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
8
10
|
if (useBreakpoint("md")) {
|
|
9
11
|
if (!isOpen) return null;
|
|
10
12
|
return /* @__PURE__ */ jsx(Popover, {
|
|
@@ -17,7 +19,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
|
|
|
17
19
|
className: "outline-none!",
|
|
18
20
|
"aria-label": label,
|
|
19
21
|
children: /* @__PURE__ */ jsxs("div", {
|
|
20
|
-
className: "flex overflow-hidden
|
|
22
|
+
className: clsx$1(popoverCva({}), "flex overflow-hidden"),
|
|
21
23
|
children: [!hideSidebar && sidebar, /* @__PURE__ */ jsxs("div", {
|
|
22
24
|
className: "flex flex-1 flex-col justify-between",
|
|
23
25
|
children: [children, footer]
|
|
@@ -26,7 +28,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
|
|
|
26
28
|
})
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsxs(BottomSheet, {
|
|
30
32
|
label,
|
|
31
33
|
footer,
|
|
32
34
|
isOpen,
|
|
@@ -35,15 +37,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
|
|
|
35
37
|
isScrollable: true,
|
|
36
38
|
height: "auto",
|
|
37
39
|
isDismissable: true,
|
|
38
|
-
children:
|
|
39
|
-
/* @__PURE__ */ jsx(FormFieldHeader, {
|
|
40
|
-
label,
|
|
41
|
-
className: "mb-8! shrink-0 px-4 pt-3",
|
|
42
|
-
rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close })
|
|
43
|
-
}),
|
|
44
|
-
children,
|
|
45
|
-
!hideSidebar && sidebar
|
|
46
|
-
] })
|
|
40
|
+
children: [children, !hideSidebar && sidebar]
|
|
47
41
|
});
|
|
48
42
|
};
|
|
49
43
|
export { DateTimeDialog };
|
|
@@ -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 { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FieldValues } from 'react-hook-form';
|
|
2
2
|
import { FileUploadProps } from './fileUpload.types';
|
|
3
|
-
export type { FileUploadBaseProps, FileUploadError, FileUploadProps, FileUploadRequest, FileUploadResponse, FileUploadState, } from './fileUpload.types';
|
|
3
|
+
export type { DefaultFile, FileUploadBaseProps, FileUploadError, FileUploadProps, FileUploadRequest, FileUploadResponse, FileUploadState, } from './fileUpload.types';
|
|
4
4
|
export declare const FileUpload: <TFieldValues extends FieldValues = FieldValues>(props: FileUploadProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,13 +11,25 @@ import { clsx } from "clsx";
|
|
|
11
11
|
import { useCallback, useState } from "react";
|
|
12
12
|
import { DropZone } from "react-aria-components";
|
|
13
13
|
import { mergeRefs, useLabels } from "@react-aria/utils";
|
|
14
|
-
import { Controller } from "react-hook-form";
|
|
15
14
|
import { useTranslation } from "react-i18next";
|
|
15
|
+
import { Controller } from "react-hook-form";
|
|
16
16
|
var FileUploadBase = (props) => {
|
|
17
17
|
const { t } = useTranslation("ui");
|
|
18
|
-
const { ref: _ref, label, tooltipText, variant = "vertical", as = "button", helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, allowsMultiple = false, hideLabel, acceptedFileTypes, clearOnSuccess, emptyText = t(($) => $.ui.fileUpload.emptyText), uploadText = t(($) => $.ui.fileUpload.uploadText), browseText = t(($) => $.ui.fileUpload.browse), fileUpload, fileRemove, children, listRenderer, onInvalidFileType, ...rest } = props;
|
|
18
|
+
const { ref: _ref, label, tooltipText, variant = "vertical", as = "button", helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, allowsMultiple = false, hideLabel, acceptedFileTypes, clearOnSuccess, emptyText = t(($) => $.ui.fileUpload.emptyText), uploadText = t(($) => $.ui.fileUpload.uploadText), browseText = t(($) => $.ui.fileUpload.browse), fileUpload, fileRemove, children, listRenderer, onInvalidFileType, defaultState, ...rest } = props;
|
|
19
19
|
const ui = UIConfig.useConfig();
|
|
20
|
-
const
|
|
20
|
+
const getInitialState = () => {
|
|
21
|
+
if (props.value != null && props.value.length > 0) return props.value;
|
|
22
|
+
if (!defaultState?.length) return [];
|
|
23
|
+
const items = defaultState.map((item, index) => ({
|
|
24
|
+
state: "uploaded",
|
|
25
|
+
displayName: item.name,
|
|
26
|
+
displaySize: item.size,
|
|
27
|
+
displayType: item.type,
|
|
28
|
+
id: item.id ?? `default-${index}`
|
|
29
|
+
}));
|
|
30
|
+
return allowsMultiple ? items : items.slice(0, 1);
|
|
31
|
+
};
|
|
32
|
+
const [uploadState, setUploadState] = useState(getInitialState);
|
|
21
33
|
const formFieldProps = {
|
|
22
34
|
error,
|
|
23
35
|
label,
|
|
@@ -38,6 +38,12 @@ export interface FileUploadRequest {
|
|
|
38
38
|
method: string;
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
export interface DefaultFile {
|
|
42
|
+
name: string;
|
|
43
|
+
size: number;
|
|
44
|
+
type?: string;
|
|
45
|
+
id?: string;
|
|
46
|
+
}
|
|
41
47
|
export interface FileUploadCallbacks {
|
|
42
48
|
fileUpload?: (request: FileUploadRequest, file: File, options?: {
|
|
43
49
|
abortController?: AbortController;
|
|
@@ -53,7 +59,10 @@ export interface FileUploadCallbacks {
|
|
|
53
59
|
export type FileUploadError = ApplicationException<GeneralErrorCodes>;
|
|
54
60
|
export interface FileUploadState {
|
|
55
61
|
state: "idle" | "uploading" | "uploaded" | "error";
|
|
56
|
-
file
|
|
62
|
+
file?: File;
|
|
63
|
+
displayName?: string;
|
|
64
|
+
displaySize?: number;
|
|
65
|
+
displayType?: string;
|
|
57
66
|
src?: string;
|
|
58
67
|
id?: string;
|
|
59
68
|
progress?: number;
|
|
@@ -74,6 +83,7 @@ export type FileUploadBaseProps = {
|
|
|
74
83
|
uploadText?: string;
|
|
75
84
|
browseText?: string;
|
|
76
85
|
value?: FileUploadState[];
|
|
86
|
+
defaultState?: DefaultFile[];
|
|
77
87
|
clearOnSuccess?: boolean;
|
|
78
88
|
children?: (props: FileUploadContainerChildrenProps) => ReactNode;
|
|
79
89
|
listRenderer?: (props: FileUploadContainerChildrenProps) => ReactNode;
|
|
@@ -11,7 +11,7 @@ const FileCardList = ({ uploadState, as, isDisabled, className, onRemove, onCanc
|
|
|
11
11
|
isDisabled,
|
|
12
12
|
onRemove,
|
|
13
13
|
onCancel
|
|
14
|
-
}, state.file
|
|
14
|
+
}, state.file?.name ?? state.displayName ?? state.id ?? state.src))
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
export { FileCardList };
|
|
@@ -2,8 +2,8 @@ import { CloseIcon } from "../../../../assets/icons/Close.js";
|
|
|
2
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
3
|
import { Button as Button$1 } from "../../../buttons/Button/Button.js";
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
|
-
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
6
5
|
import { ns } from "../../../../config/i18n.js";
|
|
6
|
+
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
7
7
|
import { WarningFilledIcon } from "../../../../assets/icons/WarningFilled.js";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { clsx } from "clsx";
|
|
@@ -36,7 +36,7 @@ const FileUploadContentError = ({ variant, as, isDisabled, state, browseText, fi
|
|
|
36
36
|
size: "label-1",
|
|
37
37
|
as: "span",
|
|
38
38
|
className: clsx("self-stretch truncate text-text-default-1", { "text-center": variant === "vertical" }),
|
|
39
|
-
children: state.file.
|
|
39
|
+
children: state.file?.name ?? state.displayName ?? ""
|
|
40
40
|
}), /* @__PURE__ */ jsx(Typography, {
|
|
41
41
|
variant: "default",
|
|
42
42
|
size: singleFile ? "label-2" : "label-3",
|
|
@@ -2,8 +2,8 @@ import { CloseIcon } from "../../../../assets/icons/Close.js";
|
|
|
2
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
3
|
import { Button as Button$1 } from "../../../buttons/Button/Button.js";
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
|
-
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
6
5
|
import { ns } from "../../../../config/i18n.js";
|
|
6
|
+
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
7
7
|
import { FileUtils } from "../../../../utils/file.utils.js";
|
|
8
8
|
import { CheckCircleIcon } from "../../../../assets/icons/CheckCircle.js";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -37,13 +37,13 @@ const FileUploadContentFilled = ({ variant, as, isDisabled, state, browseText, f
|
|
|
37
37
|
size: "label-1",
|
|
38
38
|
as: "span",
|
|
39
39
|
className: "self-stretch truncate text-center text-text-default-1",
|
|
40
|
-
children: state.file.
|
|
40
|
+
children: state.file?.name ?? state.displayName ?? ""
|
|
41
41
|
}), /* @__PURE__ */ jsx(Typography, {
|
|
42
42
|
variant: "default",
|
|
43
43
|
size: singleFile ? "label-2" : "label-3",
|
|
44
44
|
as: "span",
|
|
45
45
|
className: "text-text-default-2",
|
|
46
|
-
children: FileUtils.
|
|
46
|
+
children: FileUtils.getFileDisplaySize(state)
|
|
47
47
|
})]
|
|
48
48
|
})]
|
|
49
49
|
}), /* @__PURE__ */ jsx("div", {
|
|
@@ -38,13 +38,13 @@ const FileUploadContentLoading = ({ index, variant, as, state, isDisabled, singl
|
|
|
38
38
|
size: "label-1",
|
|
39
39
|
as: "span",
|
|
40
40
|
className: "self-stretch truncate text-center text-text-default-1",
|
|
41
|
-
children: state.file.
|
|
41
|
+
children: state.file?.name ?? state.displayName ?? ""
|
|
42
42
|
}), /* @__PURE__ */ jsx(Typography, {
|
|
43
43
|
variant: "default",
|
|
44
44
|
size: singleFile ? "label-2" : "label-3",
|
|
45
45
|
as: "span",
|
|
46
46
|
className: "text-text-default-2",
|
|
47
|
-
children: FileUtils.
|
|
47
|
+
children: FileUtils.getFileDisplaySize(state)
|
|
48
48
|
})]
|
|
49
49
|
})]
|
|
50
50
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
3
|
import { Button as Button$1 } from "../../../buttons/Button/Button.js";
|
|
4
|
-
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
5
4
|
import { ns } from "../../../../config/i18n.js";
|
|
5
|
+
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
6
6
|
import { inputSize } from "../../shared/input.cva.js";
|
|
7
7
|
import { UploadIcon } from "../../../../assets/icons/Upload.js";
|
|
8
8
|
import { inputUploadButton, inputUploadDropZone } from "./inputUploadButton.cva.js";
|
|
@@ -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,5 +1,6 @@
|
|
|
1
1
|
import { FormFieldError } from "./FormFieldError.js";
|
|
2
2
|
import { FormFieldHeader } from "./FormFieldHeader.js";
|
|
3
|
+
import { FormFieldHelper } from "./FormFieldHelper.js";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
const FormField = ({ ref, as, label, tooltipText, helperText, isRequired, rightContent, isDisabled, error, hideLabel, headerClassName, errorClassName, children, className, labelProps, isHeaderHidden, tabIndex, onMouseEnter, onFocusCapture }) => {
|
|
5
6
|
const headerProps = {
|
|
@@ -13,6 +14,12 @@ const FormField = ({ ref, as, label, tooltipText, helperText, isRequired, rightC
|
|
|
13
14
|
className: headerClassName,
|
|
14
15
|
labelProps
|
|
15
16
|
};
|
|
17
|
+
const helperProps = {
|
|
18
|
+
helperText,
|
|
19
|
+
isDisabled,
|
|
20
|
+
isHidden: !["filter", "floating"].includes(as ?? ""),
|
|
21
|
+
hasError: !!error
|
|
22
|
+
};
|
|
16
23
|
const errorProps = {
|
|
17
24
|
error,
|
|
18
25
|
isDisabled,
|
|
@@ -28,6 +35,7 @@ const FormField = ({ ref, as, label, tooltipText, helperText, isRequired, rightC
|
|
|
28
35
|
children: [
|
|
29
36
|
!["filter", "floating"].includes(as ?? "") && /* @__PURE__ */ jsx(FormFieldHeader, { ...headerProps }),
|
|
30
37
|
children,
|
|
38
|
+
/* @__PURE__ */ jsx(FormFieldHelper, { ...helperProps }),
|
|
31
39
|
/* @__PURE__ */ jsx(FormFieldError, { ...errorProps })
|
|
32
40
|
]
|
|
33
41
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
|
-
import {
|
|
2
|
+
import { formFieldError } from "./formFieldError.cva.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
const FormFieldError = ({ error, isDisabled, isHidden, className }) => {
|
|
6
6
|
return /* @__PURE__ */ jsx("p", {
|
|
7
|
-
className: clsx(UIStyle.useCva("
|
|
7
|
+
className: clsx(UIStyle.useCva("formField.errorLabelCva", formFieldError)({ visible: !!error && !isDisabled && !isHidden }), className),
|
|
8
8
|
children: error
|
|
9
9
|
});
|
|
10
10
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface FormFieldHelperProps {
|
|
2
|
+
helperText?: string;
|
|
3
|
+
isDisabled?: boolean;
|
|
4
|
+
isHidden?: boolean;
|
|
5
|
+
hasError?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const FormFieldHelper: ({ helperText, isDisabled, isHidden, hasError, className }: FormFieldHelperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
|
+
import { formFieldHelper } from "./formFieldHelper.cva.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
const FormFieldHelper = ({ helperText, isDisabled, isHidden, hasError, className }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx("p", {
|
|
7
|
+
className: clsx(UIStyle.useCva("formField.helperLabelCva", formFieldHelper)({ visible: !!helperText && !isDisabled && !isHidden && !hasError }), className),
|
|
8
|
+
slot: "description",
|
|
9
|
+
children: helperText
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { FormFieldHelper };
|
|
@@ -13,6 +13,7 @@ const FormFieldLabel = ({ ref, as, label, isRequired, isDisabled, labelProps, cl
|
|
|
13
13
|
ref,
|
|
14
14
|
className: clsx(typographyCva({
|
|
15
15
|
size: "label-2",
|
|
16
|
+
sizeMobile: "label-2",
|
|
16
17
|
variant: "prominent-1",
|
|
17
18
|
...labelTypographyMap({ as })
|
|
18
19
|
}), labelBaseCva({ as }), className, labelProps?.className),
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const formFieldError: (props?: ({
|
|
3
|
+
visible?: boolean | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
+
export interface FormFieldErrorVariantProps extends VariantProps<typeof formFieldError> {
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const formFieldHelper: (props?: ({
|
|
3
|
+
visible?: boolean | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
+
export interface FormFieldHelperVariantProps extends VariantProps<typeof formFieldHelper> {
|
|
6
|
+
}
|
|
@@ -48,6 +48,7 @@ const InputContent = ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, un
|
|
|
48
48
|
unit && /* @__PURE__ */ jsx("span", {
|
|
49
49
|
className: typographyCva({
|
|
50
50
|
size: "label-2",
|
|
51
|
+
sizeMobile: "label-2",
|
|
51
52
|
variant: "prominent-1",
|
|
52
53
|
className: "text-text-default-3"
|
|
53
54
|
}),
|
|
@@ -4,7 +4,7 @@ import { CheckContent } from "../shared/CheckContent.js";
|
|
|
4
4
|
import { FormField } from "../FormField/FormField.js";
|
|
5
5
|
import { radio, radioIndicatorClass, radioTypography } from "./radio.cva.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import clsx
|
|
7
|
+
import { clsx } from "clsx";
|
|
8
8
|
import { Radio, RadioGroup } from "react-aria-components";
|
|
9
9
|
import { mergeRefs } from "@react-aria/utils";
|
|
10
10
|
import { Controller } from "react-hook-form";
|
|
@@ -36,10 +36,10 @@ var RadioGroupBase = (props) => {
|
|
|
36
36
|
children: /* @__PURE__ */ jsx(FormField, {
|
|
37
37
|
...formFieldProps,
|
|
38
38
|
children: /* @__PURE__ */ jsx("div", {
|
|
39
|
-
className: clsx
|
|
39
|
+
className: clsx("flex flex-col", inputClassName),
|
|
40
40
|
children: options.map((option) => /* @__PURE__ */ jsxs(Radio, {
|
|
41
41
|
value: option.value,
|
|
42
|
-
className: radioIndicatorClass,
|
|
42
|
+
className: clsx("relative", radioIndicatorClass),
|
|
43
43
|
children: [/* @__PURE__ */ jsx("div", { className: radioCva({
|
|
44
44
|
variant,
|
|
45
45
|
...rest
|
|
@@ -27,6 +27,7 @@ const radio = cva([
|
|
|
27
27
|
const radioIndicatorClass = "group flex items-center gap-2";
|
|
28
28
|
const radioTypography = compoundMapper({ default: {
|
|
29
29
|
size: "label-1",
|
|
30
|
+
sizeMobile: "label-1",
|
|
30
31
|
variant: "default"
|
|
31
32
|
} });
|
|
32
33
|
export { radio, radioIndicatorClass, radioTypography };
|
|
@@ -9,6 +9,7 @@ export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = Default
|
|
|
9
9
|
className?: string;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
hideDropdownIcon?: boolean;
|
|
12
|
+
hideSearchIcon?: boolean;
|
|
12
13
|
isSearchable?: boolean;
|
|
13
14
|
isClearable?: boolean;
|
|
14
15
|
isClientSearchDisabled?: boolean;
|
|
@@ -17,7 +17,8 @@ const SelectBase = (dProps) => {
|
|
|
17
17
|
isSearchable: dProps.isSearchable ?? ui.select.isSearchable,
|
|
18
18
|
selectedTagsType: dProps.selectedTagsType ?? ui.select.selectedTagsType,
|
|
19
19
|
ignoreTriggerWidth: dProps.virtualizerOptions || dProps.items.length > 100 ? false : dProps.ignoreTriggerWidth ?? false,
|
|
20
|
-
collapseAfter: dProps.collapseAfter ?? ui.select.collapseAfter
|
|
20
|
+
collapseAfter: dProps.collapseAfter ?? ui.select.collapseAfter,
|
|
21
|
+
hideSearchIcon: dProps.hideSearchIcon ?? ui.select.hideSearchIcon
|
|
21
22
|
};
|
|
22
23
|
const isDesktop = useBreakpoint("md");
|
|
23
24
|
return /* @__PURE__ */ jsx(SelectContext.Provider, {
|