@povio/ui 2.2.5 → 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.
Files changed (58) hide show
  1. package/dist/assets/icons/Search.js +13 -0
  2. package/dist/components/Menu/MenuMobile.js +1 -0
  3. package/dist/components/inputs/Checkbox/Checkbox.js +1 -1
  4. package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -0
  5. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +1 -1
  6. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +1 -1
  7. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +3 -13
  8. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +1 -1
  9. package/dist/components/inputs/File/FileUpload.d.ts +1 -1
  10. package/dist/components/inputs/File/FileUpload.js +15 -3
  11. package/dist/components/inputs/File/fileUpload.types.d.ts +11 -1
  12. package/dist/components/inputs/File/shared/FileCardList.js +1 -1
  13. package/dist/components/inputs/File/shared/FileUploadContentError.js +2 -2
  14. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +3 -3
  15. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +2 -2
  16. package/dist/components/inputs/File/shared/InputUploadContent.js +1 -1
  17. package/dist/components/inputs/FormField/FormField.js +8 -0
  18. package/dist/components/inputs/FormField/FormFieldError.js +2 -2
  19. package/dist/components/inputs/FormField/FormFieldHelper.d.ts +8 -0
  20. package/dist/components/inputs/FormField/FormFieldHelper.js +12 -0
  21. package/dist/components/inputs/FormField/FormFieldLabel.js +1 -0
  22. package/dist/components/inputs/FormField/formFieldError.cva.d.ts +6 -0
  23. package/dist/components/inputs/FormField/formFieldError.cva.js +9 -0
  24. package/dist/components/inputs/FormField/formFieldHelper.cva.d.ts +6 -0
  25. package/dist/components/inputs/FormField/formFieldHelper.cva.js +9 -0
  26. package/dist/components/inputs/Input/shared/InputContent.js +1 -0
  27. package/dist/components/inputs/RadioGroup/RadioGroup.js +3 -3
  28. package/dist/components/inputs/RadioGroup/radio.cva.js +1 -0
  29. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -0
  30. package/dist/components/inputs/Selection/shared/SelectBase.js +2 -1
  31. package/dist/components/inputs/Selection/shared/SelectInput.js +1 -1
  32. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +1 -1
  33. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +1 -1
  34. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +1 -1
  35. package/dist/components/inputs/Selection/shared/SelectMobile.js +16 -12
  36. package/dist/components/inputs/Toggle/toggle.cva.js +1 -0
  37. package/dist/components/inputs/shared/CheckContent.js +1 -0
  38. package/dist/components/inputs/shared/label.cva.js +5 -0
  39. package/dist/components/overlays/BottomSheet/BottomSheet.d.ts +5 -0
  40. package/dist/components/overlays/BottomSheet/BottomSheet.js +20 -6
  41. package/dist/components/overlays/BottomSheet/BottomSheetHeader.d.ts +13 -0
  42. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +36 -0
  43. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +4 -9
  44. package/dist/components/table/CellText.d.ts +2 -1
  45. package/dist/components/table/CellText.js +16 -10
  46. package/dist/components/table/ColumnConfig.js +1 -1
  47. package/dist/components/table/HeaderText.d.ts +5 -2
  48. package/dist/components/table/HeaderText.js +15 -7
  49. package/dist/components/table/Table.js +1 -1
  50. package/dist/components/table/table.cva.d.ts +6 -0
  51. package/dist/components/table/table.cva.js +3 -1
  52. package/dist/config/uiConfig.context.d.ts +6 -2
  53. package/dist/config/uiConfig.context.js +16 -2
  54. package/dist/config/uiStyle.context.d.ts +9 -1
  55. package/dist/index.js +1 -1
  56. package/dist/utils/file.utils.d.ts +4 -0
  57. package/dist/utils/file.utils.js +7 -2
  58. 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 };
@@ -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"], {
@@ -14,11 +14,11 @@ 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();
@@ -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);
@@ -1,10 +1,8 @@
1
1
  import { UIStyle } from "../../../../config/uiStyle.context.js";
2
2
  import { BottomSheet } from "../../../overlays/BottomSheet/BottomSheet.js";
3
3
  import { useBreakpoint } from "../../../../hooks/useBreakpoint.js";
4
- import { FormFieldHeader } from "../../FormField/FormFieldHeader.js";
5
- import { FormFieldHeaderClose } from "../../FormField/FormFieldHeaderClose.js";
6
4
  import { popover } from "../../../shared/popover.cva.js";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
8
6
  import clsx$1 from "clsx";
9
7
  import { Dialog, Popover } from "react-aria-components";
10
8
  const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen, triggerRef, dialogProps, onOpenChange }) => {
@@ -30,7 +28,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
30
28
  })
31
29
  });
32
30
  }
33
- return /* @__PURE__ */ jsx(BottomSheet, {
31
+ return /* @__PURE__ */ jsxs(BottomSheet, {
34
32
  label,
35
33
  footer,
36
34
  isOpen,
@@ -39,15 +37,7 @@ const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen,
39
37
  isScrollable: true,
40
38
  height: "auto",
41
39
  isDismissable: true,
42
- children: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
43
- /* @__PURE__ */ jsx(FormFieldHeader, {
44
- label,
45
- className: "mb-list-height-title-bottom! shrink-0 px-4 pt-3",
46
- rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close })
47
- }),
48
- children,
49
- !hideSidebar && sidebar
50
- ] })
40
+ children: [children, !hideSidebar && sidebar]
51
41
  });
52
42
  };
53
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 [uploadState, setUploadState] = useState(props.value ?? []);
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: 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.name || state.id || state.src))
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.name
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.name
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.getCalculatedFileSize(state.file)
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.name
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.getCalculatedFileSize(state.file)
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,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 { typography } from "../../text/Typography/typography.cva.js";
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("typography.cva", typography)({ size: "label-3" }), "text-text-error-1", !error || isDisabled || isHidden ? "sr-only" : "mt-1-5", className),
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,9 @@
1
+ import { cva } from "class-variance-authority";
2
+ const formFieldError = cva("text-label-3 text-text-error-1", {
3
+ variants: { visible: {
4
+ true: "mt-1-5",
5
+ false: "sr-only"
6
+ } },
7
+ defaultVariants: { visible: false }
8
+ });
9
+ export { formFieldError };
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ import { cva } from "class-variance-authority";
2
+ const formFieldHelper = cva("text-label-3 text-text-default-2", {
3
+ variants: { visible: {
4
+ true: "mt-1-5",
5
+ false: "sr-only"
6
+ } },
7
+ defaultVariants: { visible: false }
8
+ });
9
+ export { formFieldHelper };
@@ -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$1 from "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$1("flex flex-col", inputClassName),
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, {
@@ -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: setIsOpen
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: setIsOpen,
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 ? /* @__PURE__ */ jsx(TextInput, {
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-1-5 px-4 pt-3"
96
- }) : /* @__PURE__ */ jsx(FormFieldHeader, {
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,
@@ -22,6 +22,7 @@ const toggle = cva(["h-6 w-10 rounded-full before:m-0-5 before:block before:aspe
22
22
  });
23
23
  const toggleTypography = compoundMapper({ default: {
24
24
  size: "label-1",
25
+ sizeMobile: "label-1",
25
26
  variant: "default"
26
27
  } });
27
28
  export { toggle, toggleTypography };
@@ -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>;
@@ -19,6 +22,8 @@ interface BottomSheetBaseProps {
19
22
  closeVelocityThreshold?: number;
20
23
  shouldCloseOnInteractOutside?: () => boolean;
21
24
  containerClassName?: string;
25
+ overlayClassName?: string;
26
+ headerTypography?: TypographyVariantProps;
22
27
  }
23
28
  export interface BottomSheetProps extends BottomSheetBaseProps {
24
29
  trigger?: ReactNode;
@@ -1,4 +1,5 @@
1
1
  import { UIConfig } from "../../../config/uiConfig.context.js";
2
+ import { BottomSheetHeader } from "./BottomSheetHeader.js";
2
3
  import { useStateAndRef } from "../../../hooks/useStateAndRef.js";
3
4
  import { DomUtils } from "../../../utils/dom.utils.js";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -6,7 +7,7 @@ import { clsx } from "clsx";
6
7
  import { useEffect, useMemo, useRef, useState } from "react";
7
8
  import { Dialog, DialogTrigger, Modal, ModalOverlay } from "react-aria-components";
8
9
  import { useResizeObserver, useViewportSize } from "@react-aria/utils";
9
- import { AnimatePresence, animate, motion, useMotionValue } from "motion/react";
10
+ import { AnimatePresence, animate, motion, useDragControls, useMotionValue } from "motion/react";
10
11
  var MotionModal = motion.create(Modal);
11
12
  var MotionModalOverlay = motion.create(ModalOverlay);
12
13
  var inertiaTransition = {
@@ -24,10 +25,12 @@ var staticTransition = {
24
25
  1
25
26
  ]
26
27
  };
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
+ 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 }) => {
28
29
  const uiConfig = UIConfig.useConfig();
29
30
  const closeDragThreshold = closeDragThresholdProp ?? uiConfig.bottomSheet.closeDragThreshold;
30
31
  const closeVelocityThreshold = closeVelocityThresholdProp ?? uiConfig.bottomSheet.closeVelocityThreshold;
32
+ const hideThumb = hideThumbProp ?? uiConfig.bottomSheet.hideThumb;
33
+ const headerTypography = headerTypographyProp ?? uiConfig.bottomSheet.headerTypography;
31
34
  const viewport = useViewportSize();
32
35
  const { sheetHeight, windowHeight } = useMemo(() => {
33
36
  return {
@@ -36,6 +39,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
36
39
  };
37
40
  }, [viewport.height, sheetMarginTop]);
38
41
  const y = useMotionValue(sheetHeight);
42
+ const dragControls = useDragControls();
39
43
  const closeVelocityRef = useRef(true);
40
44
  const overlayRef = useRef(null);
41
45
  const containerRef = useRef(null);
@@ -78,12 +82,12 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
78
82
  ref: overlayRef,
79
83
  shouldCloseOnInteractOutside,
80
84
  children: [/* @__PURE__ */ jsx(motion.div, {
81
- className: "pointer-events-none absolute inset-0 bg-support-overlay",
85
+ className: clsx("pointer-events-none absolute inset-0 bg-support-overlay", overlayClassName),
82
86
  animate: { opacity: 1 },
83
87
  initial: { opacity: 0 },
84
88
  exit: { opacity: 0 }
85
89
  }), /* @__PURE__ */ jsx(MotionModal, {
86
- isDismissable: true,
90
+ isDismissable,
87
91
  className: clsx("pointer-events-none flex h-full w-full flex-col items-stretch justify-end outline-none will-change-transform"),
88
92
  animate: {
89
93
  y: 0,
@@ -109,6 +113,8 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
109
113
  minHeight: "100%"
110
114
  },
111
115
  drag: "y",
116
+ dragListener: false,
117
+ dragControls,
112
118
  dragElastic: {
113
119
  top: 0,
114
120
  bottom: .5
@@ -157,10 +163,18 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
157
163
  ref: focusTrapRef,
158
164
  tabIndex: -1
159
165
  }),
160
- /* @__PURE__ */ jsx("div", {
166
+ /* @__PURE__ */ jsxs("div", {
161
167
  className: "flex max-h-full min-h-0 flex-col items-stretch",
162
168
  ref: containerRef,
163
- children: typeof children === "function" ? children(close) : 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]
164
178
  }),
165
179
  /* @__PURE__ */ jsx("div", {
166
180
  className: "shrink-0",
@@ -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,10 +1,8 @@
1
1
  import { UIStyle } from "../../../config/uiStyle.context.js";
2
2
  import { BottomSheet } from "../BottomSheet/BottomSheet.js";
3
3
  import { useBreakpoint } from "../../../hooks/useBreakpoint.js";
4
- import { FormFieldHeader } from "../../inputs/FormField/FormFieldHeader.js";
5
- import { FormFieldHeaderClose } from "../../inputs/FormField/FormFieldHeaderClose.js";
6
4
  import { popover } from "../../shared/popover.cva.js";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
8
6
  import { clsx } from "clsx";
9
7
  import { Dialog, DialogTrigger, Popover } from "react-aria-components";
10
8
  const ResponsivePopover = ({ trigger, isOpen, onOpenChange, children, popoverClassName, sheetLabel }) => {
@@ -15,14 +13,11 @@ const ResponsivePopover = ({ trigger, isOpen, onOpenChange, children, popoverCla
15
13
  trigger,
16
14
  height: "auto",
17
15
  isDismissable: true,
18
- children: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormFieldHeader, {
19
- label: sheetLabel,
20
- rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close }),
21
- className: "px-4 pt-3"
22
- }), /* @__PURE__ */ jsx("div", {
16
+ label: sheetLabel,
17
+ children: /* @__PURE__ */ jsx("div", {
23
18
  className: "p-4",
24
19
  children
25
- })] })
20
+ })
26
21
  });
27
22
  return /* @__PURE__ */ jsxs(DialogTrigger, {
28
23
  isOpen,
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties, FC, ReactNode } from 'react';
2
- export interface CellTextProps {
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
- import { clsx } from "clsx";
4
- const CellText = ({ children, style, className }) => /* @__PURE__ */ jsx(Typography, {
5
- variant: "default",
6
- size: "label-1",
7
- as: "span",
8
- className: clsx("block overflow-hidden text-ellipsis text-text-default-2", className),
9
- style,
10
- "data-rac": true,
11
- children
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
- export interface HeaderTextProps {
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 = ({ children }) => /* @__PURE__ */ jsx(Typography, {
4
- variant: "default",
5
- size: "label-1",
6
- as: "span",
7
- className: "overflow-hidden text-ellipsis px-table-cell-content-side-m py-table-cell-content-height-m text-text-default-1",
8
- children
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
- export { tableData, tableHeadData, tableHeadRow, tableRow };
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 };
@@ -10,6 +10,8 @@ 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
12
  import { BottomSheetProps } from '../components/overlays/BottomSheet/BottomSheet';
13
+ import { CellTextProps } from '../components/table/CellText';
14
+ import { HeaderTextProps } from '../components/table/HeaderText';
13
15
  export declare namespace UIConfig {
14
16
  type DeepRequired<T> = {
15
17
  [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
@@ -20,12 +22,14 @@ export declare namespace UIConfig {
20
22
  numberInput: Pick<NumberInputProps, "formatOptions">;
21
23
  radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel">;
22
24
  checkbox: Pick<CheckboxProps, "variant">;
23
- select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType">;
25
+ select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType" | "hideSearchIcon">;
24
26
  toggle: Pick<ToggleProps, "variant">;
25
27
  slider: Pick<SliderProps, "minValue" | "maxValue">;
26
28
  dateInput: Pick<DatePickerProps, "todayIcon" | "shouldForceLeadingZeros" | "disableManualEntry">;
27
29
  actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
28
- bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold">;
30
+ bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold" | "hideThumb" | "headerTypography">;
31
+ tableHeaderText: Pick<HeaderTextProps, "variant" | "size">;
32
+ tableCellText: Pick<CellTextProps, "variant" | "size">;
29
33
  }
30
34
  interface ProviderProps {
31
35
  config?: Partial<Options>;
@@ -29,7 +29,8 @@ let UIConfig;
29
29
  selectionMode: "single",
30
30
  isSearchable: false,
31
31
  selectedTagsType: "list",
32
- collapseAfter: 3
32
+ collapseAfter: 3,
33
+ hideSearchIcon: false
33
34
  },
34
35
  toggle: { variant: "default" },
35
36
  slider: {
@@ -50,7 +51,20 @@ let UIConfig;
50
51
  },
51
52
  bottomSheet: {
52
53
  closeDragThreshold: 100,
53
- closeVelocityThreshold: 200
54
+ closeVelocityThreshold: 200,
55
+ hideThumb: false,
56
+ headerTypography: {
57
+ size: "label-2",
58
+ variant: "prominent-1"
59
+ }
60
+ },
61
+ tableHeaderText: {
62
+ variant: "default",
63
+ size: "label-1"
64
+ },
65
+ tableCellText: {
66
+ variant: "default",
67
+ size: "label-1"
54
68
  }
55
69
  };
56
70
  const Context = createContext(DEFAULT_CONFIG);
@@ -4,6 +4,8 @@ import { BreadcrumbChevronVariantProps, BreadcrumbIconVariantProps, BreadcrumbIt
4
4
  import { ButtonVariantProps } from '../components/buttons/Button/button.cva';
5
5
  import { PillButtonVariants } from '../components/buttons/PillButton/pillButton.cva';
6
6
  import { CheckboxIconVariantProps, CheckboxVariantProps } from '../components/inputs/Checkbox/checkbox.cva';
7
+ import { FormFieldErrorVariantProps } from '../components/inputs/FormField/formFieldError.cva';
8
+ import { FormFieldHelperVariantProps } from '../components/inputs/FormField/formFieldHelper.cva';
7
9
  import { RadioVariantProps } from '../components/inputs/RadioGroup/radio.cva';
8
10
  import { InputBaseProps, InputSideProps, InputSizeProps } from '../components/inputs/shared/input.cva';
9
11
  import { LabelBaseProps } from '../components/inputs/shared/label.cva';
@@ -17,7 +19,7 @@ import { SegmentItemVariantProps, SegmentVariantProps } from '../components/segm
17
19
  import { PopoverVariantProps } from '../components/shared/popover.cva';
18
20
  import { AlertVariantProps } from '../components/status/Alert/alert.cva';
19
21
  import { ToastVariantProps } from '../components/status/Toast/toast.cva';
20
- import { TableDataVariantProps, TableHeadDataVariantProps, TableHeadRowVariantProps, TableRowVariantProps } from '../components/table/table.cva';
22
+ import { TableCellTextVariantProps, TableDataVariantProps, TableHeadDataVariantProps, TableHeadRowVariantProps, TableHeaderTextVariantProps, TableRowVariantProps } from '../components/table/table.cva';
21
23
  import { LinkVariantProps } from '../components/text/Link/link.cva';
22
24
  import { TagVariantProps } from '../components/text/Tag/tag.cva';
23
25
  import { TypographyVariantProps } from '../components/text/Typography/typography.cva';
@@ -86,6 +88,8 @@ export declare namespace UIStyle {
86
88
  headDataCva?: Cva<TableHeadDataVariantProps>;
87
89
  rowCva?: Cva<TableRowVariantProps>;
88
90
  dataCva?: Cva<TableDataVariantProps>;
91
+ headerTextCva?: Cva<TableHeaderTextVariantProps>;
92
+ cellTextCva?: Cva<TableCellTextVariantProps>;
89
93
  };
90
94
  tooltip: {
91
95
  cva?: Cva<TooltipVariantProps>;
@@ -139,6 +143,10 @@ export declare namespace UIStyle {
139
143
  popover: {
140
144
  cva?: Cva<PopoverVariantProps>;
141
145
  };
146
+ formField: {
147
+ errorLabelCva?: Cva<FormFieldErrorVariantProps>;
148
+ helperLabelCva?: Cva<FormFieldHelperVariantProps>;
149
+ };
142
150
  }
143
151
  interface ProviderProps {
144
152
  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 { ns, resources } from "./config/i18n.js";
58
59
  import { useStateAndRef } from "./hooks/useStateAndRef.js";
59
60
  import { DomUtils } from "./utils/dom.utils.js";
60
61
  import { BottomSheet } from "./components/overlays/BottomSheet/BottomSheet.js";
@@ -66,7 +67,6 @@ import { ToggleButton } from "./components/buttons/ToggleButton/ToggleButton.js"
66
67
  import { Checkbox } from "./components/inputs/Checkbox/Checkbox.js";
67
68
  import { useLongPressRepeat } from "./hooks/useLongPressRepeat.js";
68
69
  import { useScrollableListBox } from "./hooks/useScrollableListBox.js";
69
- import { ns, resources } from "./config/i18n.js";
70
70
  import { FormField } from "./components/inputs/FormField/FormField.js";
71
71
  import { DateTimeUtils } from "./utils/date-time.utils.js";
72
72
  import { DatePicker } from "./components/inputs/DateTime/DatePicker/DatePicker.js";
@@ -5,5 +5,9 @@ export declare namespace FileUtils {
5
5
  const downloadFile: (data: Blob | AxiosResponse<Blob>, fileName?: string, revokeTimeoutMs?: number) => void;
6
6
  const isFileTypeAccepted: (file: File, fileTypes?: readonly string[] | string[]) => boolean;
7
7
  const getCalculatedFileSize: (file?: File) => string;
8
+ const getFileDisplaySize: (state: {
9
+ file?: File;
10
+ displaySize?: number;
11
+ }) => string;
8
12
  const formatBytes: (size: number, decimals?: number) => string;
9
13
  }
@@ -26,14 +26,19 @@ let FileUtils;
26
26
  return file.name.toLowerCase().endsWith(type.toLowerCase());
27
27
  });
28
28
  };
29
- _FileUtils.getCalculatedFileSize = (file) => {
29
+ const getCalculatedFileSize = _FileUtils.getCalculatedFileSize = (file) => {
30
30
  if (!file) return "";
31
31
  if (file.size < 1024) return `${file.size} B`;
32
32
  if (file.size < 1024 * 1024) return `${(file.size / 1024).toFixed(2)} KB`;
33
33
  if (file.size < 1024 * 1024 * 1024) return `${(file.size / 1024 / 1024).toFixed(2)} MB`;
34
34
  return `${(file.size / 1024 / 1024 / 1024).toFixed(2)} GB`;
35
35
  };
36
- _FileUtils.formatBytes = (size, decimals = 2) => {
36
+ _FileUtils.getFileDisplaySize = (state) => {
37
+ if (state.file) return getCalculatedFileSize(state.file);
38
+ if (state.displaySize != null) return formatBytes(state.displaySize);
39
+ return "";
40
+ };
41
+ const formatBytes = _FileUtils.formatBytes = (size, decimals = 2) => {
37
42
  if (size < 1024) return `${size} B`;
38
43
  if (size < 1024 * 1024) return `${(size / 1024).toFixed(decimals)} KB`;
39
44
  if (size < 1024 * 1024 * 1024) return `${(size / 1024 / 1024).toFixed(decimals)} MB`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",