@povio/ui 2.2.7 → 2.2.8
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/README.md +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +2 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +5 -3
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +4 -5
- package/dist/components/inputs/File/InputUpload.js +5 -3
- package/dist/components/inputs/File/inputUpload.types.d.ts +4 -1
- package/dist/components/inputs/File/inputUpload.types.js +9 -0
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +3 -1
- package/dist/components/inputs/File/shared/InputUploadContent.d.ts +2 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +4 -3
- package/dist/components/inputs/File/shared/InputUploadFilled.d.ts +3 -2
- package/dist/components/inputs/File/shared/InputUploadFilled.js +2 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +1 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +8 -4
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +5 -3
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +4 -2
- package/dist/components/inputs/Selection/shared/SelectMobile.js +2 -1
- package/dist/components/inputs/Selection/shared/selectItem.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectItem.cva.js +21 -0
- package/dist/config/uiStyle.context.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ This is required for buttons to behave as expected. It is based on [Tailwind Upg
|
|
|
31
31
|
|
|
32
32
|
In order for Tailwind to also compile classes for @povio/ui package, you need to include @source directive in Tailwind config.
|
|
33
33
|
In your globals.css add (make sure path is correct):
|
|
34
|
+
|
|
34
35
|
```css
|
|
35
36
|
@source "../../node_modules/@povio/ui/dist";
|
|
36
37
|
```
|
|
@@ -42,6 +43,7 @@ We are using `react-aria-components` for our UI components including their plugi
|
|
|
42
43
|
### Custom Tailwind plugin
|
|
43
44
|
|
|
44
45
|
We also use a custom tailwind plugin to shorten some selectors inside the @povio/ui package. Install it by adding the following line to your `base.css`.
|
|
46
|
+
|
|
45
47
|
```css
|
|
46
48
|
@plugin "@povio/ui/tw-ui-plugin";
|
|
47
49
|
```
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FC, SVGProps } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
|
+
import { LinkNavigationProps } from '../text/Link/Link';
|
|
3
4
|
export interface BreadcrumbItem {
|
|
4
5
|
id: Key;
|
|
5
6
|
label: string;
|
|
6
|
-
|
|
7
|
+
link?: LinkNavigationProps;
|
|
7
8
|
icon?: FC<SVGProps<SVGSVGElement>>;
|
|
8
9
|
}
|
|
9
10
|
export interface BreadcrumbsProps {
|
|
@@ -37,7 +37,7 @@ var Breadcrumbs$1 = ({ items, className, onAction, iconOnly = false }) => {
|
|
|
37
37
|
const lastItem = items[items.length - 1];
|
|
38
38
|
const LinkComponent = LinkContext.useLinkContext()?.LinkComponent ?? Link;
|
|
39
39
|
const renderBreadcrumbLink = (item, isCurrent, iconOnly) => /* @__PURE__ */ jsxs(LinkComponent, {
|
|
40
|
-
|
|
40
|
+
...item.link,
|
|
41
41
|
className: breadcrumbItem$1({ isCurrent }),
|
|
42
42
|
children: [item.icon && /* @__PURE__ */ jsx(item.icon, {
|
|
43
43
|
className: breadcrumbIconCva({}),
|
|
@@ -52,7 +52,7 @@ var Breadcrumbs$1 = ({ items, className, onAction, iconOnly = false }) => {
|
|
|
52
52
|
const menuItems = hiddenItems.map((item) => ({
|
|
53
53
|
id: item.id,
|
|
54
54
|
label: item.label,
|
|
55
|
-
|
|
55
|
+
link: item.link
|
|
56
56
|
}));
|
|
57
57
|
const renderEllipsis = () => /* @__PURE__ */ jsx(MenuDesktop, {
|
|
58
58
|
trigger: /* @__PURE__ */ jsx(Tooltip$1, {
|
|
@@ -12,6 +12,7 @@ interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Ar
|
|
|
12
12
|
isDirty?: boolean;
|
|
13
13
|
disableManualEntry?: boolean;
|
|
14
14
|
placeholder?: string;
|
|
15
|
+
inputClassName?: string;
|
|
15
16
|
}
|
|
16
17
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|
|
17
18
|
value?: string | null;
|
|
@@ -7,6 +7,7 @@ import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
|
7
7
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
8
8
|
import { TimePickerInput } from "../shared/TimePickerInput.js";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { clsx } from "clsx";
|
|
10
11
|
import { useEffect, useRef, useState } from "react";
|
|
11
12
|
import { useLocale, useTimeField } from "react-aria";
|
|
12
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
@@ -17,7 +18,7 @@ import { useTimeFieldState } from "react-stately";
|
|
|
17
18
|
//#region src/components/inputs/DateTime/TimePicker/TimePicker.tsx
|
|
18
19
|
var TimePickerBase = (props) => {
|
|
19
20
|
const ui = UIConfig.useConfig();
|
|
20
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, placeholder, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, hideLabel = ui.input.hideLabel, isClearable = ui.input.isClearable, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
21
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, placeholder, className, inputClassName, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, hideLabel = ui.input.hideLabel, isClearable = ui.input.isClearable, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
|
|
21
22
|
const formFieldProps = {
|
|
22
23
|
error,
|
|
23
24
|
label,
|
|
@@ -90,7 +91,7 @@ var TimePickerBase = (props) => {
|
|
|
90
91
|
...formFieldProps,
|
|
91
92
|
as,
|
|
92
93
|
labelProps,
|
|
93
|
-
className: "relative inline-flex w-full flex-col text-left",
|
|
94
|
+
className: clsx("relative inline-flex w-full flex-col text-left", className),
|
|
94
95
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
95
96
|
children: [/* @__PURE__ */ jsx(TimePickerInput, {
|
|
96
97
|
ref: mergeRefs(ref, timeFieldRef),
|
|
@@ -107,7 +108,8 @@ var TimePickerBase = (props) => {
|
|
|
107
108
|
isClearable,
|
|
108
109
|
headerProps,
|
|
109
110
|
disableManualEntry,
|
|
110
|
-
placeholder
|
|
111
|
+
placeholder,
|
|
112
|
+
className: inputClassName
|
|
111
113
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
112
114
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
113
115
|
isDisabled,
|
|
@@ -15,7 +15,8 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
15
15
|
isClearable?: boolean;
|
|
16
16
|
disableManualEntry?: boolean;
|
|
17
17
|
placeholder?: string;
|
|
18
|
+
className?: string;
|
|
18
19
|
onPress: () => void;
|
|
19
20
|
}
|
|
20
|
-
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -12,7 +12,7 @@ import { useState } from "react";
|
|
|
12
12
|
import { Button } from "react-aria-components";
|
|
13
13
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
14
14
|
//#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
|
|
15
|
-
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, onPress, ...props }) => {
|
|
15
|
+
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
16
16
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
17
17
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
18
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
@@ -23,12 +23,11 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInva
|
|
|
23
23
|
const canClear = state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false);
|
|
24
24
|
return /* @__PURE__ */ jsxs("div", {
|
|
25
25
|
ref,
|
|
26
|
-
className: inputBaseCva({
|
|
26
|
+
className: clsx(inputBaseCva({
|
|
27
27
|
variant,
|
|
28
28
|
as,
|
|
29
|
-
...props
|
|
30
|
-
|
|
31
|
-
}),
|
|
29
|
+
...props
|
|
30
|
+
}), "group/date-picker-content relative min-w-input-width-min-width", "flex items-center justify-between gap-input-gap-input-text-to-elements", className),
|
|
32
31
|
"data-rac": "",
|
|
33
32
|
"data-datetime-input": "",
|
|
34
33
|
"data-hovered": isHovered || void 0,
|
|
@@ -9,7 +9,7 @@ import { useState } from "react";
|
|
|
9
9
|
import { mergeRefs, useLabels } from "@react-aria/utils";
|
|
10
10
|
import { Controller } from "react-hook-form";
|
|
11
11
|
//#region src/components/inputs/File/InputUpload.tsx
|
|
12
|
-
var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, onChange, onInvalidFileType, value, defaultValue, allowsMultiple = false, hideLabel, acceptedFileTypes, ...rest }) => {
|
|
12
|
+
var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, onChange, onInvalidFileType, value, defaultValue, allowsMultiple = false, hideLabel, acceptedFileTypes, size, ...rest }) => {
|
|
13
13
|
const ui = UIConfig.useConfig();
|
|
14
14
|
const [internalFiles, setInternalFiles] = useState(() => {
|
|
15
15
|
if (value !== void 0) {
|
|
@@ -77,7 +77,8 @@ var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isR
|
|
|
77
77
|
children: files.length > 0 ? /* @__PURE__ */ jsx(InputUploadFilled, {
|
|
78
78
|
files,
|
|
79
79
|
onRemove: handleRemove,
|
|
80
|
-
isDisabled
|
|
80
|
+
isDisabled,
|
|
81
|
+
size
|
|
81
82
|
}) : /* @__PURE__ */ jsx(InputUploadContent, {
|
|
82
83
|
...rest,
|
|
83
84
|
label,
|
|
@@ -87,7 +88,8 @@ var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isR
|
|
|
87
88
|
variant,
|
|
88
89
|
isDisabled,
|
|
89
90
|
onSelect: handleSelect,
|
|
90
|
-
onDrop: handleDrop
|
|
91
|
+
onDrop: handleDrop,
|
|
92
|
+
size
|
|
91
93
|
})
|
|
92
94
|
});
|
|
93
95
|
};
|
|
@@ -4,6 +4,8 @@ import { FieldValues } from 'react-hook-form';
|
|
|
4
4
|
import { FormFieldProps } from '../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../shared/form.types';
|
|
6
6
|
import { InputUploadButtonProps } from './shared/inputUploadButton.cva';
|
|
7
|
+
import { InputSizeProps } from '../shared/input.cva';
|
|
8
|
+
import { ButtonVariantProps } from '../../buttons/Button/button.cva.js';
|
|
7
9
|
export interface SingleFileUploadProps {
|
|
8
10
|
allowsMultiple?: false;
|
|
9
11
|
value?: File | null;
|
|
@@ -30,5 +32,6 @@ export type InputUploadBaseProps = {
|
|
|
30
32
|
className?: string;
|
|
31
33
|
placeholder?: string;
|
|
32
34
|
buttonText?: string;
|
|
33
|
-
} & FormFieldProps & InputUploadButtonProps & Omit<FileTriggerProps, "children" | "onSelect" | "allowsMultiple"> & Omit<DropZoneProps, "children" | "onDrop"> & GroupedFileUploadProps
|
|
35
|
+
} & FormFieldProps & InputUploadButtonProps & Omit<FileTriggerProps, "children" | "onSelect" | "allowsMultiple"> & Omit<DropZoneProps, "children" | "onDrop"> & GroupedFileUploadProps & Pick<InputSizeProps, "size">;
|
|
34
36
|
export type InputUploadProps<TFieldValues extends FieldValues = FieldValues> = InputUploadBaseProps & GroupedFileUploadControlProps<TFieldValues>;
|
|
37
|
+
export declare const inputButtonSizeMapping: Record<NonNullable<InputSizeProps["size"]>, ButtonVariantProps["size"]>;
|
|
@@ -97,12 +97,14 @@ var FileUploadContentFilled = ({ variant, as, isDisabled, state, browseText, fil
|
|
|
97
97
|
onPress: () => {
|
|
98
98
|
onRemove(state.id ?? "");
|
|
99
99
|
},
|
|
100
|
-
icon: CloseIcon
|
|
100
|
+
icon: CloseIcon,
|
|
101
|
+
isDisabled
|
|
101
102
|
}) : /* @__PURE__ */ jsx(TextButton, {
|
|
102
103
|
color: "secondary",
|
|
103
104
|
onPress: () => {
|
|
104
105
|
onRemove(state.id ?? "");
|
|
105
106
|
},
|
|
107
|
+
isDisabled,
|
|
106
108
|
children: t(($) => $.ui.fileUpload.removeFile)
|
|
107
109
|
})]
|
|
108
110
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DropZoneProps, FileTriggerProps } from 'react-aria-components';
|
|
2
2
|
import { InputUploadBaseProps } from '../inputUpload.types';
|
|
3
|
-
|
|
3
|
+
import { InputSizeProps } from '../../shared/input.cva';
|
|
4
|
+
interface InputUploadContentProps extends Omit<InputUploadBaseProps, "ref">, Pick<InputSizeProps, "size"> {
|
|
4
5
|
onSelect: FileTriggerProps["onSelect"];
|
|
5
6
|
onDrop: DropZoneProps["onDrop"];
|
|
6
7
|
}
|
|
@@ -5,6 +5,7 @@ import "../../../../config/i18n.js";
|
|
|
5
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
|
+
import { inputButtonSizeMapping } from "../inputUpload.types.js";
|
|
8
9
|
import { inputUploadButton, inputUploadDropZone } from "./inputUploadButton.cva.js";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { clsx } from "clsx";
|
|
@@ -12,7 +13,7 @@ import { DropZone, FileTrigger } from "react-aria-components";
|
|
|
12
13
|
import { useTranslation } from "react-i18next";
|
|
13
14
|
//#region src/components/inputs/File/shared/InputUploadContent.tsx
|
|
14
15
|
var InputUploadContent = (props) => {
|
|
15
|
-
const { variant, isDisabled, error, placeholder, buttonText, ...rest } = props;
|
|
16
|
+
const { variant, isDisabled, error, placeholder, buttonText, size, ...rest } = props;
|
|
16
17
|
const { t } = useTranslation("ui");
|
|
17
18
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
19
|
return /* @__PURE__ */ jsx(FileTrigger, {
|
|
@@ -28,7 +29,7 @@ var InputUploadContent = (props) => {
|
|
|
28
29
|
children: [/* @__PURE__ */ jsxs(DropZone, {
|
|
29
30
|
...rest,
|
|
30
31
|
isDisabled,
|
|
31
|
-
className: clsx(inputUploadDropZone({ variant }), inputSizeCva({ size
|
|
32
|
+
className: clsx(inputUploadDropZone({ variant }), inputSizeCva({ size })),
|
|
32
33
|
children: [/* @__PURE__ */ jsx(Typography, {
|
|
33
34
|
variant: "default",
|
|
34
35
|
size: "label-1",
|
|
@@ -41,7 +42,7 @@ var InputUploadContent = (props) => {
|
|
|
41
42
|
children: buttonText ?? t(($) => $.ui.fileUpload.upload)
|
|
42
43
|
})]
|
|
43
44
|
}), variant !== "nested" && /* @__PURE__ */ jsx(Button$1, {
|
|
44
|
-
size: "
|
|
45
|
+
size: inputButtonSizeMapping[size ?? "default"],
|
|
45
46
|
width: "hug",
|
|
46
47
|
isDisabled,
|
|
47
48
|
className: "truncate",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { InputSizeProps } from '../../shared/input.cva';
|
|
2
|
+
interface InputUploadFilledProps extends Pick<InputSizeProps, "size"> {
|
|
2
3
|
files: File[];
|
|
3
4
|
onRemove: () => void;
|
|
4
5
|
isDisabled?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const InputUploadFilled: ({ files, onRemove, isDisabled }: InputUploadFilledProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const InputUploadFilled: ({ files, onRemove, isDisabled, size }: InputUploadFilledProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -6,9 +6,9 @@ import { inputSize } from "../../shared/input.cva.js";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
//#region src/components/inputs/File/shared/InputUploadFilled.tsx
|
|
9
|
-
var InputUploadFilled = ({ files, onRemove, isDisabled }) => {
|
|
9
|
+
var InputUploadFilled = ({ files, onRemove, isDisabled, size }) => {
|
|
10
10
|
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
-
className: clsx("flex items-center rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle", UIStyle.useCva("input.sizeCva", inputSize)({ size
|
|
11
|
+
className: clsx("flex items-center rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle", UIStyle.useCva("input.sizeCva", inputSize)({ size })),
|
|
12
12
|
children: [/* @__PURE__ */ jsx(Typography, {
|
|
13
13
|
variant: "default",
|
|
14
14
|
size: "label-1",
|
|
@@ -101,7 +101,7 @@ var NumberInputBase = (props) => {
|
|
|
101
101
|
"data-is-dirty": isDirty || void 0,
|
|
102
102
|
"data-is-required": isRequired || void 0,
|
|
103
103
|
"data-is-empty": value === null || value === void 0 || void 0,
|
|
104
|
-
placeholder: as === "floating" ? "" : inputProps.placeholder,
|
|
104
|
+
placeholder: as === "floating" ? "\xA0" : inputProps.placeholder,
|
|
105
105
|
className: "w-full outline-none",
|
|
106
106
|
onFocus: (e) => {
|
|
107
107
|
inputProps.onFocus?.(e);
|
|
@@ -94,7 +94,7 @@ var TextInputBase = (props) => {
|
|
|
94
94
|
"data-is-dirty": isDirty || void 0,
|
|
95
95
|
"data-is-required": isRequired || void 0,
|
|
96
96
|
"data-is-disabled": isDisabled || void 0,
|
|
97
|
-
placeholder: as === "floating" ? "" : inputProps.placeholder,
|
|
97
|
+
placeholder: as === "floating" ? "\xA0" : inputProps.placeholder,
|
|
98
98
|
className: "w-full outline-none",
|
|
99
99
|
onFocus: (e) => {
|
|
100
100
|
inputProps.onFocus?.(e);
|
|
@@ -4,5 +4,4 @@ interface SelectListBoxItemProps extends Pick<SelectBaseProps, "isSearchable" |
|
|
|
4
4
|
isNewItem?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare const SelectListBoxItem: ({ isSearchable, isNewItem, newItemRender, id, label, content, isDisabled, }: SelectListBoxItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare const selectListBoxItemClass: string;
|
|
8
7
|
export {};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import "../../../../config/i18n.js";
|
|
2
3
|
import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
|
|
3
4
|
import { SelectContext } from "./select.context.js";
|
|
5
|
+
import { selectListBoxItemCva } from "./selectItem.cva.js";
|
|
4
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { clsx } from "clsx";
|
|
6
7
|
import { useMemo, useRef } from "react";
|
|
7
8
|
import { ListBoxItem } from "react-aria-components";
|
|
8
9
|
import { useTranslation } from "react-i18next";
|
|
9
10
|
//#region src/components/inputs/Selection/shared/SelectListBoxItem.tsx
|
|
10
11
|
var SelectListBoxItem = ({ isSearchable, isNewItem, newItemRender, id, label, content, isDisabled }) => {
|
|
12
|
+
const selectListItemCva = UIStyle.useCva("select.listBoxItemCva", selectListBoxItemCva);
|
|
11
13
|
const ref = useRef(null);
|
|
12
14
|
const { t } = useTranslation("ui");
|
|
13
15
|
const { selectedIds, isMultiple } = SelectContext.useSelect();
|
|
@@ -26,7 +28,10 @@ var SelectListBoxItem = ({ isSearchable, isNewItem, newItemRender, id, label, co
|
|
|
26
28
|
id,
|
|
27
29
|
textValue: label,
|
|
28
30
|
isDisabled,
|
|
29
|
-
className:
|
|
31
|
+
className: selectListItemCva({
|
|
32
|
+
isSingle: !isMultiple,
|
|
33
|
+
isNewItem
|
|
34
|
+
}),
|
|
30
35
|
children: [
|
|
31
36
|
isMultiple && !isSearchable && /* @__PURE__ */ jsx(CheckboxCheckmark, {
|
|
32
37
|
variant: "default",
|
|
@@ -45,6 +50,5 @@ var SelectListBoxItem = ({ isSearchable, isNewItem, newItemRender, id, label, co
|
|
|
45
50
|
]
|
|
46
51
|
});
|
|
47
52
|
};
|
|
48
|
-
var selectListBoxItemClass = clsx("group flex cursor-pointer items-center gap-2 px-list-side-item-left py-list-height-item", "border-b border-b-elevation-outline-default-1 outline-none", "font-labels-default text-interactive-text-secondary-idle text-label-2", "hover:text-interactive-text-secondary-hover", "focus-visible:bg-interactive-contained-primary-focus focus-visible:text-interactive-text-secondary-idle-inverted", "disabled:cursor-default disabled:text-interactive-text-secondary-disabled");
|
|
49
53
|
//#endregion
|
|
50
|
-
export { SelectListBoxItem
|
|
54
|
+
export { SelectListBoxItem };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import "../../../../config/i18n.js";
|
|
2
3
|
import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
|
|
3
4
|
import { SelectContext } from "./select.context.js";
|
|
4
|
-
import {
|
|
5
|
+
import { selectListBoxItemCva } from "./selectItem.cva.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { useRef } from "react";
|
|
7
8
|
import { ListBoxItem } from "react-aria-components";
|
|
8
9
|
import { useTranslation } from "react-i18next";
|
|
9
10
|
//#region src/components/inputs/Selection/shared/SelectListBoxItemSelectAll.tsx
|
|
10
11
|
var SelectListBoxItemSelectAll = ({ id, label, isDisabled }) => {
|
|
12
|
+
const selectListItemCva = UIStyle.useCva("select.listBoxItemCva", selectListBoxItemCva);
|
|
11
13
|
const ref = useRef(null);
|
|
12
14
|
const { t } = useTranslation("ui");
|
|
13
15
|
const { selectableListItems, selectedIds } = SelectContext.useSelect();
|
|
@@ -16,7 +18,7 @@ var SelectListBoxItemSelectAll = ({ id, label, isDisabled }) => {
|
|
|
16
18
|
id,
|
|
17
19
|
textValue: label || t(($) => $.ui.select.allOption),
|
|
18
20
|
isDisabled,
|
|
19
|
-
className:
|
|
21
|
+
className: selectListItemCva({}),
|
|
20
22
|
children: [/* @__PURE__ */ jsx("div", {
|
|
21
23
|
className: "group",
|
|
22
24
|
"data-rac": "",
|
|
@@ -24,7 +26,7 @@ var SelectListBoxItemSelectAll = ({ id, label, isDisabled }) => {
|
|
|
24
26
|
"data-indeterminate": selectedIds.length > 0 && selectedIds.length < selectableListItems.length || void 0,
|
|
25
27
|
children: /* @__PURE__ */ jsx(CheckboxCheckmark, {
|
|
26
28
|
variant: "default",
|
|
27
|
-
className: "group-focus-visible
|
|
29
|
+
className: "group-focus-visible:outline-none!"
|
|
28
30
|
})
|
|
29
31
|
}), t(($) => $.ui.select.allOption)]
|
|
30
32
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import { Loader } from "../../../status/Loader/Loader.js";
|
|
2
3
|
import "../../../../config/i18n.js";
|
|
3
4
|
import { SelectContext } from "./select.context.js";
|
|
4
|
-
import {
|
|
5
|
+
import { selectListBoxItemCva } from "./selectItem.cva.js";
|
|
5
6
|
import { useIntersectionObserver } from "../../../../hooks/useIntersectionObserver.js";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { useCallback } from "react";
|
|
@@ -9,6 +10,7 @@ import { ListBoxItem } from "react-aria-components";
|
|
|
9
10
|
import { useTranslation } from "react-i18next";
|
|
10
11
|
//#region src/components/inputs/Selection/shared/SelectListBoxLoadingItem.tsx
|
|
11
12
|
var SelectListBoxLoadingItem = ({ id, label, onLoadMore }) => {
|
|
13
|
+
const selectListItemCva = UIStyle.useCva("select.listBoxItemCva", selectListBoxItemCva);
|
|
12
14
|
const { t } = useTranslation("ui");
|
|
13
15
|
const { isDebouncing, isLoading, hasLoadMore } = SelectContext.useSelect();
|
|
14
16
|
const { ref } = useIntersectionObserver({
|
|
@@ -26,7 +28,7 @@ var SelectListBoxLoadingItem = ({ id, label, onLoadMore }) => {
|
|
|
26
28
|
id,
|
|
27
29
|
textValue: label || t(($) => $.ui.loadingState.text),
|
|
28
30
|
isDisabled: true,
|
|
29
|
-
className:
|
|
31
|
+
className: selectListItemCva({}),
|
|
30
32
|
children: /* @__PURE__ */ jsx("div", {
|
|
31
33
|
ref,
|
|
32
34
|
className: "flex flex-1 justify-center text-interactive-text-primary-idle",
|
|
@@ -14,7 +14,7 @@ import { DialogTrigger } from "react-aria-components";
|
|
|
14
14
|
import { useLabel } from "react-aria";
|
|
15
15
|
//#region src/components/inputs/Selection/shared/SelectMobile.tsx
|
|
16
16
|
var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }) => {
|
|
17
|
-
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, collapseAfter, selectedTagsType } = props;
|
|
17
|
+
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, size, collapseAfter, selectedTagsType } = props;
|
|
18
18
|
const formFieldProps = {
|
|
19
19
|
error,
|
|
20
20
|
label,
|
|
@@ -68,6 +68,7 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
|
|
|
68
68
|
placeholder,
|
|
69
69
|
variant,
|
|
70
70
|
as,
|
|
71
|
+
size,
|
|
71
72
|
isDisabled,
|
|
72
73
|
isInvalid: !!error,
|
|
73
74
|
className,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const selectListBoxItemCva: (props?: ({
|
|
3
|
+
isSingle?: boolean | null | undefined;
|
|
4
|
+
isNewItem?: boolean | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export type SelectListBoxItemCva = VariantProps<typeof selectListBoxItemCva>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
//#region src/components/inputs/Selection/shared/selectItem.cva.ts
|
|
3
|
+
var selectListBoxItemCva = cva([
|
|
4
|
+
"group flex cursor-pointer items-center gap-2 px-list-side-item-left py-list-height-item",
|
|
5
|
+
"border-b border-b-elevation-outline-default-1 outline-none",
|
|
6
|
+
"font-labels-default text-label-2",
|
|
7
|
+
"hover:text-interactive-text-secondary-hover",
|
|
8
|
+
"focus-visible:bg-interactive-contained-primary-focus focus-visible:text-interactive-text-secondary-idle-inverted",
|
|
9
|
+
"disabled:cursor-default disabled:text-interactive-text-secondary-disabled"
|
|
10
|
+
], {
|
|
11
|
+
variants: {
|
|
12
|
+
isSingle: { true: "selected:bg-interactive-contained-primary-idle selected:text-interactive-contained-primary-on-idle" },
|
|
13
|
+
isNewItem: {
|
|
14
|
+
true: "text-interactive-text-primary-idle",
|
|
15
|
+
false: "text-interactive-text-secondary-idle"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: { isNewItem: false }
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { selectListBoxItemCva };
|
|
@@ -24,6 +24,7 @@ import { LinkVariantProps } from '../components/text/Link/link.cva';
|
|
|
24
24
|
import { TagVariantProps } from '../components/text/Tag/tag.cva';
|
|
25
25
|
import { TypographyVariantProps } from '../components/text/Typography/typography.cva';
|
|
26
26
|
import { CompoundMapper, ConfigSchema } from '../utils/compoundMapper';
|
|
27
|
+
import { SelectListBoxItemCva } from '../components/inputs/Selection/shared/selectItem.cva';
|
|
27
28
|
export declare namespace UIStyle {
|
|
28
29
|
export type Cva<T> = (props: (T & ClassProp) | ClassProp) => string;
|
|
29
30
|
type OptionKey = {
|
|
@@ -147,6 +148,9 @@ export declare namespace UIStyle {
|
|
|
147
148
|
errorLabelCva?: Cva<FormFieldErrorVariantProps>;
|
|
148
149
|
helperLabelCva?: Cva<FormFieldHelperVariantProps>;
|
|
149
150
|
};
|
|
151
|
+
select: {
|
|
152
|
+
listBoxItemCva?: Cva<SelectListBoxItemCva>;
|
|
153
|
+
};
|
|
150
154
|
}
|
|
151
155
|
interface ProviderProps {
|
|
152
156
|
config?: Partial<Options>;
|