@povio/ui 0.0.7 → 0.0.9
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/Calendar.js +1 -1
- package/dist/assets/icons/CheckCircle.js +3 -3
- package/dist/assets/icons/ChevronsLeft.js +11 -22
- package/dist/assets/icons/ChevronsRight.js +11 -22
- package/dist/assets/icons/DateTime.js +13 -6
- package/dist/assets/icons/Drag.js +1 -1
- package/dist/assets/icons/File.js +1 -1
- package/dist/assets/icons/Info.js +2 -4
- package/dist/assets/icons/Menu.js +1 -3
- package/dist/assets/icons/Send.js +1 -1
- package/dist/assets/icons/Upload.js +2 -2
- package/dist/assets/icons/{Warningfilled.js → WarningFilled.js} +1 -1
- package/dist/components/Menu/MenuPopover.js +1 -1
- package/dist/components/buttons/PillButton/pillButton.cva.js +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +7 -4
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +10 -4
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +7 -4
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +16 -5
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +3 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +30 -23
- package/dist/components/inputs/File/FileUpload.js +1 -1
- package/dist/components/inputs/File/InputUpload.js +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentError.js +1 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +10 -4
- package/dist/components/inputs/File/shared/InputUploadFilled.js +36 -22
- package/dist/components/inputs/File/shared/fileUpload.cva.js +3 -2
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +6 -5
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +3 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +8 -2
- package/dist/components/inputs/Input/TextArea/TextArea.js +6 -9
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -0
- package/dist/components/inputs/Input/TextInput/TextInput.js +26 -3
- package/dist/components/inputs/Input/shared/InputContent.js +67 -59
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/SelectBase.js +2 -1
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +84 -90
- package/dist/components/inputs/Selection/shared/SelectInputTags.d.ts +11 -0
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +22 -0
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +56 -45
- package/dist/components/inputs/Selection/shared/select.context.js +1 -0
- package/dist/components/inputs/Selection/shared/select.types.d.ts +8 -0
- package/dist/components/inputs/shared/InputClear.d.ts +3 -1
- package/dist/components/inputs/shared/InputClear.js +4 -3
- package/dist/components/inputs/shared/input.cva.js +18 -17
- package/dist/components/inputs/shared/label.cva.js +2 -2
- package/dist/components/overlays/BottomSheet/BottomSheet.js +17 -12
- package/dist/components/overlays/Tooltip/Tooltip.d.ts +4 -2
- package/dist/components/overlays/Tooltip/Tooltip.js +32 -6
- package/dist/components/overlays/Tooltip/tooltip.cva.d.ts +21 -0
- package/dist/components/overlays/Tooltip/tooltip.cva.js +60 -0
- package/dist/components/segment/Segment.js +8 -2
- package/dist/components/segment/SegmentItem.js +4 -2
- package/dist/components/table/CellText.js +2 -2
- package/dist/components/table/HeaderText.js +1 -1
- package/dist/components/table/Table.js +34 -16
- package/dist/components/table/table.cva.d.ts +7 -3
- package/dist/components/table/table.cva.js +37 -11
- package/dist/config/uiConfig.context.d.ts +3 -1
- package/dist/config/uiConfig.context.js +6 -1
- package/dist/config/uiStyle.context.d.ts +2 -1
- package/dist/helpers/dynamicColumns.js +2 -2
- package/dist/helpers/dynamicInputs.d.ts +2 -0
- package/dist/helpers/dynamicInputs.js +5 -3
- package/dist/hooks/useAutosave.js +4 -1
- package/dist/hooks/useTableColumnConfig.js +5 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.js +15 -11
- package/dist/utils/date-time.utils.js +12 -12
- package/dist/utils/dom.utils.js +2 -2
- package/dist/utils/file.utils.js +1 -1
- package/dist/utils/isEqual.js +2 -1
- package/dist/utils/object.utils.js +2 -2
- package/dist/utils/{rest/rest.utils.js → rest.utils.js} +1 -1
- package/dist/utils/vendor/acl/AclGuard.d.ts +8 -0
- package/dist/utils/vendor/acl/AclGuard.js +15 -0
- package/dist/utils/vendor/acl/Can.d.ts +9 -0
- package/dist/utils/vendor/acl/Can.js +18 -0
- package/dist/utils/vendor/acl/ability.context.d.ts +15 -0
- package/dist/utils/vendor/acl/ability.context.js +37 -0
- package/dist/utils/vendor/acl/appAbility.types.d.ts +3 -0
- package/dist/utils/vendor/auth/AuthGuard.d.ts +6 -0
- package/dist/utils/vendor/auth/AuthGuard.js +26 -0
- package/dist/utils/vendor/auth/auth.context.d.ts +21 -0
- package/dist/utils/vendor/auth/auth.context.js +36 -0
- package/dist/utils/vendor/auth/withPrivateAuthGuard.d.ts +6 -0
- package/dist/utils/vendor/auth/withPrivateAuthGuard.js +17 -0
- package/dist/utils/vendor/error-handling.js +1 -1
- package/dist/utils/{rest/rest-client.d.ts → vendor/rest-client.types.d.ts} +8 -14
- package/dist/utils/zod.utils.d.ts +2 -1
- package/package.json +2 -2
- package/dist/hooks/useSingletonMutation.d.ts +0 -4
- package/dist/hooks/useSingletonMutation.js +0 -27
- package/dist/utils/rest/interceptors/logging.interceptor.d.ts +0 -2
- package/dist/utils/rest/interceptors/logging.interceptor.js +0 -17
- package/dist/utils/rest/interceptors/response.interceptor.d.ts +0 -2
- package/dist/utils/rest/interceptors/response.interceptor.js +0 -25
- package/dist/utils/rest/rest-client.js +0 -62
- /package/dist/assets/icons/{Warningfilled.d.ts → WarningFilled.d.ts} +0 -0
- /package/dist/utils/{rest/rest.utils.d.ts → rest.utils.d.ts} +0 -0
- /package/dist/utils/{rest/interceptors → vendor}/rest-interceptor.d.ts +0 -0
- /package/dist/utils/{rest/interceptors → vendor}/rest-interceptor.js +0 -0
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
2
3
|
import { FileTrigger, DropZone } from "react-aria-components";
|
|
3
4
|
import { useTranslation } from "react-i18next";
|
|
4
5
|
import { UploadIcon } from "../../../../assets/icons/Upload.js";
|
|
5
6
|
import { Button } from "../../../buttons/Button/Button.js";
|
|
6
7
|
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
8
|
+
import { inputSize } from "../../shared/input.cva.js";
|
|
7
9
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
8
10
|
import { ns } from "../../../../config/i18n.js";
|
|
11
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
9
12
|
import { inputUploadButton, inputUploadDropZone } from "./inputUploadButton.cva.js";
|
|
10
13
|
const InputUploadContent = (props) => {
|
|
11
14
|
const { variant, isDisabled, error, ...rest } = props;
|
|
12
15
|
const { t } = useTranslation(ns);
|
|
16
|
+
const uiStyle = UIStyle.useConfig();
|
|
17
|
+
const inputSizeCva = uiStyle?.input?.sizeCva ?? inputSize;
|
|
13
18
|
return /* @__PURE__ */ jsx(FileTrigger, { ...rest, children: /* @__PURE__ */ jsxs(
|
|
14
19
|
"div",
|
|
15
20
|
{
|
|
@@ -26,7 +31,7 @@ const InputUploadContent = (props) => {
|
|
|
26
31
|
{
|
|
27
32
|
...rest,
|
|
28
33
|
isDisabled,
|
|
29
|
-
className: inputUploadDropZone({ variant }),
|
|
34
|
+
className: clsx(inputUploadDropZone({ variant }), inputSizeCva({ size: "default" })),
|
|
30
35
|
children: [
|
|
31
36
|
/* @__PURE__ */ jsx(
|
|
32
37
|
Typography,
|
|
@@ -34,7 +39,7 @@ const InputUploadContent = (props) => {
|
|
|
34
39
|
variant: "default",
|
|
35
40
|
size: "label-1",
|
|
36
41
|
as: "span",
|
|
37
|
-
className: "flex-fill select-none
|
|
42
|
+
className: "min-w-0 flex-fill select-none truncate text-text-default-3",
|
|
38
43
|
children: t(($) => $.ui.fileUpload.emptyText)
|
|
39
44
|
}
|
|
40
45
|
),
|
|
@@ -43,7 +48,7 @@ const InputUploadContent = (props) => {
|
|
|
43
48
|
{
|
|
44
49
|
isDisabled,
|
|
45
50
|
icon: UploadIcon,
|
|
46
|
-
className: "
|
|
51
|
+
className: "p-0!",
|
|
47
52
|
children: t(($) => $.ui.fileUpload.upload)
|
|
48
53
|
}
|
|
49
54
|
)
|
|
@@ -53,9 +58,10 @@ const InputUploadContent = (props) => {
|
|
|
53
58
|
variant !== "nested" && /* @__PURE__ */ jsx(
|
|
54
59
|
Button,
|
|
55
60
|
{
|
|
56
|
-
size: "
|
|
61
|
+
size: "m",
|
|
57
62
|
width: "hug",
|
|
58
63
|
isDisabled,
|
|
64
|
+
className: "truncate",
|
|
59
65
|
children: t(($) => $.ui.fileUpload.uploadFile)
|
|
60
66
|
}
|
|
61
67
|
)
|
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
2
3
|
import { CloseIcon } from "../../../../assets/icons/Close.js";
|
|
3
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
|
+
import { inputSize } from "../../shared/input.cva.js";
|
|
4
6
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
7
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
5
8
|
const InputUploadFilled = ({ files, onRemove, isDisabled }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
const uiStyle = UIStyle.useConfig();
|
|
10
|
+
const inputSizeCva = uiStyle?.input?.sizeCva ?? inputSize;
|
|
11
|
+
return /* @__PURE__ */ jsxs(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: clsx(
|
|
15
|
+
"flex items-center rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle",
|
|
16
|
+
inputSizeCva({ size: "default" })
|
|
17
|
+
),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
Typography,
|
|
21
|
+
{
|
|
22
|
+
variant: "default",
|
|
23
|
+
size: "label-1",
|
|
24
|
+
as: "span",
|
|
25
|
+
className: "flex-fill select-none truncate text-ellipsis text-text-default-1",
|
|
26
|
+
children: files.map((file) => file.name).join(", ")
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
InlineIconButton,
|
|
31
|
+
{
|
|
32
|
+
label: "Remove files",
|
|
33
|
+
color: "secondary",
|
|
34
|
+
icon: CloseIcon,
|
|
35
|
+
isDisabled,
|
|
36
|
+
onPress: onRemove
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
);
|
|
28
42
|
};
|
|
29
43
|
export {
|
|
30
44
|
InputUploadFilled
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import { clsx } from "clsx";
|
|
2
3
|
const fileUploadDropZoneBase = cva(["relative w-full rounded-input-rounding-default"], {
|
|
3
4
|
variants: {
|
|
4
5
|
variant: {
|
|
@@ -38,7 +39,7 @@ const fileUploadDropZoneBase = cva(["relative w-full rounded-input-rounding-defa
|
|
|
38
39
|
});
|
|
39
40
|
const fileUploadDropZone = (props) => {
|
|
40
41
|
const { className, ...rest } = props;
|
|
41
|
-
return
|
|
42
|
+
return clsx(fileUploadDropZoneBase(rest), className);
|
|
42
43
|
};
|
|
43
44
|
cva(["flex gap-3"], {
|
|
44
45
|
variants: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { cva
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import { clsx } from "clsx";
|
|
2
3
|
const inputUploadButtonBase = cva(
|
|
3
4
|
["flex w-full items-center justify-between gap-file-upload-input-gap-input-to-button-gap"],
|
|
4
5
|
{
|
|
@@ -15,11 +16,11 @@ const inputUploadButtonBase = cva(
|
|
|
15
16
|
);
|
|
16
17
|
const inputUploadButton = (props) => {
|
|
17
18
|
const { className, ...rest } = props;
|
|
18
|
-
return
|
|
19
|
+
return clsx(inputUploadButtonBase(rest), className);
|
|
19
20
|
};
|
|
20
21
|
const inputUploadDropZone = cva(
|
|
21
22
|
[
|
|
22
|
-
"flex-1",
|
|
23
|
+
"min-w-0 flex-1",
|
|
23
24
|
"flex items-center",
|
|
24
25
|
"group-data-[invalid]/input-upload:border group-data-[invalid]/input-upload:border-input-outlined-outline-error",
|
|
25
26
|
"data-[drop-target]:border-input-outlined-outline-hover",
|
|
@@ -29,10 +30,10 @@ const inputUploadDropZone = cva(
|
|
|
29
30
|
variants: {
|
|
30
31
|
variant: {
|
|
31
32
|
default: [
|
|
32
|
-
"rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle
|
|
33
|
+
"rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle"
|
|
33
34
|
],
|
|
34
35
|
nested: [
|
|
35
|
-
"rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle
|
|
36
|
+
"rounded-input-rounding-default border border-input-outlined-outline-idle border-solid bg-input-outlined-idle"
|
|
36
37
|
]
|
|
37
38
|
}
|
|
38
39
|
},
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DOMAttributes } from '@react-types/shared';
|
|
2
2
|
import { RefCallback } from 'react';
|
|
3
|
+
import { InputSizeProps } from '../shared/input.cva';
|
|
3
4
|
import { LabelBaseProps } from '../shared/label.cva';
|
|
4
|
-
export interface FormFieldLabelProps extends LabelBaseProps {
|
|
5
|
+
export interface FormFieldLabelProps extends LabelBaseProps, InputSizeProps {
|
|
5
6
|
label: string;
|
|
6
7
|
isRequired?: boolean;
|
|
7
8
|
isDisabled?: boolean;
|
|
8
9
|
ref?: RefCallback<HTMLOrSVGElement>;
|
|
9
10
|
labelProps?: DOMAttributes<HTMLLabelElement>;
|
|
10
11
|
}
|
|
11
|
-
export declare const FormFieldLabel: ({ ref, as, label, isRequired, isDisabled, labelProps }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const FormFieldLabel: ({ ref, as, label, isRequired, isDisabled, labelProps, size }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
3
|
import { Label } from "react-aria-components";
|
|
4
|
+
import { inputSide } from "../shared/input.cva.js";
|
|
4
5
|
import { labelTypography, labelBase } from "../shared/label.cva.js";
|
|
5
6
|
import { Typography } from "../../text/Typography/Typography.js";
|
|
6
7
|
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
7
|
-
const FormFieldLabel = ({ ref, as, label, isRequired, isDisabled, labelProps }) => {
|
|
8
|
+
const FormFieldLabel = ({ ref, as, label, isRequired, isDisabled, labelProps, size }) => {
|
|
8
9
|
const uiStyle = UIStyle.useConfig();
|
|
9
10
|
const labelTypographyMap = uiStyle?.label?.typography ?? labelTypography;
|
|
10
11
|
const labelBaseCva = uiStyle?.label?.cva ?? labelBase;
|
|
12
|
+
const inputSideCva = uiStyle?.input?.sideCva ?? inputSide;
|
|
11
13
|
return /* @__PURE__ */ jsx(Label, { ...labelProps, children: /* @__PURE__ */ jsxs(
|
|
12
14
|
Typography,
|
|
13
15
|
{
|
|
@@ -18,7 +20,11 @@ const FormFieldLabel = ({ ref, as, label, isRequired, isDisabled, labelProps })
|
|
|
18
20
|
variant: "prominent-1",
|
|
19
21
|
...labelTypographyMap({ as })
|
|
20
22
|
},
|
|
21
|
-
className: clsx(
|
|
23
|
+
className: clsx(
|
|
24
|
+
labelBaseCva({ as }),
|
|
25
|
+
as && ["filter", "floating"].includes(as) && inputSideCva({ size, type: "left" }),
|
|
26
|
+
labelProps?.className
|
|
27
|
+
),
|
|
22
28
|
children: [
|
|
23
29
|
label,
|
|
24
30
|
isRequired && /* @__PURE__ */ jsx("span", { className: clsx(!isDisabled && "text-text-error-1"), children: "*" })
|
|
@@ -8,11 +8,14 @@ import { Controller } from "react-hook-form";
|
|
|
8
8
|
import { FormField } from "../../FormField/FormField.js";
|
|
9
9
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
10
10
|
import { InputClear } from "../../shared/InputClear.js";
|
|
11
|
-
import { useInputCva } from "../../shared/input.cva.js";
|
|
11
|
+
import { useInputCva, inputSize } from "../../shared/input.cva.js";
|
|
12
12
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
13
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
13
14
|
const TextAreaBase = (props) => {
|
|
14
15
|
const ui = UIConfig.useConfig();
|
|
15
16
|
const inputCva = useInputCva();
|
|
17
|
+
const uiStyle = UIStyle.useConfig();
|
|
18
|
+
const inputSizeCva = uiStyle?.input?.sizeCva ?? inputSize;
|
|
16
19
|
const {
|
|
17
20
|
ref,
|
|
18
21
|
className,
|
|
@@ -72,7 +75,7 @@ const TextAreaBase = (props) => {
|
|
|
72
75
|
className: headerClassName,
|
|
73
76
|
labelProps
|
|
74
77
|
};
|
|
75
|
-
const showClear = isClearable && value
|
|
78
|
+
const showClear = isClearable && !!value;
|
|
76
79
|
return /* @__PURE__ */ jsx(
|
|
77
80
|
FormField,
|
|
78
81
|
{
|
|
@@ -107,13 +110,7 @@ const TextAreaBase = (props) => {
|
|
|
107
110
|
ref
|
|
108
111
|
}
|
|
109
112
|
),
|
|
110
|
-
showClear && /* @__PURE__ */ jsx(
|
|
111
|
-
InputClear,
|
|
112
|
-
{
|
|
113
|
-
onClear: () => onChange?.(""),
|
|
114
|
-
className: "absolute top-input-side-default right-input-side-default"
|
|
115
|
-
}
|
|
116
|
-
)
|
|
113
|
+
showClear && /* @__PURE__ */ jsx("span", { className: clsx("absolute top-0 right-0", inputSizeCva({ size: "default" })), children: /* @__PURE__ */ jsx(InputClear, { onClear: () => onChange?.("") }) })
|
|
117
114
|
]
|
|
118
115
|
}
|
|
119
116
|
)
|
|
@@ -11,6 +11,7 @@ interface TextInputBaseProps extends FormFieldProps, InputVariantProps, Omit<Inp
|
|
|
11
11
|
ref?: Ref<HTMLInputElement>;
|
|
12
12
|
inputClassName?: string;
|
|
13
13
|
type?: AllowedHTMLInputTypeAttribute;
|
|
14
|
+
todayIcon?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export interface TextInputProps extends TextInputBaseProps {
|
|
16
17
|
}
|
|
@@ -8,7 +8,24 @@ import { Controller } from "react-hook-form";
|
|
|
8
8
|
import { FormField } from "../../FormField/FormField.js";
|
|
9
9
|
import { InputContent } from "../shared/InputContent.js";
|
|
10
10
|
import { useInputCva } from "../../shared/input.cva.js";
|
|
11
|
+
import { Tooltip } from "../../../overlays/Tooltip/Tooltip.js";
|
|
11
12
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
13
|
+
const TooltipWrapper = (props) => {
|
|
14
|
+
if (props.as !== "inline") {
|
|
15
|
+
return props.children;
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
Tooltip,
|
|
19
|
+
{
|
|
20
|
+
text: props.error || void 0,
|
|
21
|
+
placement: "bottom",
|
|
22
|
+
color: "error",
|
|
23
|
+
hidden: !props.error,
|
|
24
|
+
isNonInteractiveTrigger: true,
|
|
25
|
+
children: /* @__PURE__ */ jsx("div", { children: props.children })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
12
29
|
const TextInputBase = (props) => {
|
|
13
30
|
const ui = UIConfig.useConfig();
|
|
14
31
|
const inputCva = useInputCva();
|
|
@@ -88,13 +105,19 @@ const TextInputBase = (props) => {
|
|
|
88
105
|
className: headerClassName,
|
|
89
106
|
labelProps
|
|
90
107
|
};
|
|
91
|
-
return /* @__PURE__ */ jsx(
|
|
108
|
+
return /* @__PURE__ */ jsx(TooltipWrapper, { ...props, children: /* @__PURE__ */ jsx(
|
|
92
109
|
FormField,
|
|
93
110
|
{
|
|
94
111
|
...formFieldProps,
|
|
95
112
|
as,
|
|
96
113
|
labelProps,
|
|
97
|
-
className: clsx(
|
|
114
|
+
className: clsx(
|
|
115
|
+
"group w-full",
|
|
116
|
+
{
|
|
117
|
+
"h-full": as === "inline"
|
|
118
|
+
},
|
|
119
|
+
className
|
|
120
|
+
),
|
|
98
121
|
children: /* @__PURE__ */ jsx(
|
|
99
122
|
InputContent,
|
|
100
123
|
{
|
|
@@ -115,7 +138,7 @@ const TextInputBase = (props) => {
|
|
|
115
138
|
}
|
|
116
139
|
)
|
|
117
140
|
}
|
|
118
|
-
);
|
|
141
|
+
) });
|
|
119
142
|
};
|
|
120
143
|
const TextInput = (props) => {
|
|
121
144
|
if ("formControl" in props && props.formControl) {
|
|
@@ -39,67 +39,75 @@ const InputContent = ({
|
|
|
39
39
|
paddingRight: `calc(var(${inputSideCva({ size, type: "var" })}) + ${trailingWidth}px + ${trailingWidth > 0 ? "var(--spacing-2)" : "0px"})`
|
|
40
40
|
};
|
|
41
41
|
}, [leadingWidth, trailingWidth, labelWidth, as, size, inputSideCva]);
|
|
42
|
-
return /* @__PURE__ */ jsxs(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
className: clsx(
|
|
57
|
-
"-translate-y-1/2 absolute top-1/2 left-input-side-default",
|
|
58
|
-
!isLeadingIconElement && "pointer-events-none",
|
|
59
|
-
inputSideCva({ size, type: "left" })
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: clsx("group/input-content relative", {
|
|
46
|
+
"h-full": as === "inline"
|
|
47
|
+
}),
|
|
48
|
+
children: [
|
|
49
|
+
as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(
|
|
50
|
+
FormFieldLabel,
|
|
51
|
+
{
|
|
52
|
+
ref: labelContentRef,
|
|
53
|
+
as,
|
|
54
|
+
...headerProps
|
|
55
|
+
}
|
|
60
56
|
),
|
|
61
|
-
children
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
children(style),
|
|
58
|
+
LeadingIcon && /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
ref: leadingContentRef,
|
|
62
|
+
className: clsx(
|
|
63
|
+
"-translate-y-1/2 absolute top-1/2",
|
|
64
|
+
!isLeadingIconElement && "pointer-events-none",
|
|
65
|
+
inputSideCva({ size, type: "left" })
|
|
66
|
+
),
|
|
67
|
+
children: isLeadingIconElement ? LeadingIcon : /* @__PURE__ */ jsx(LeadingIcon, { className: "size-6 text-interactive-text-secondary-idle" })
|
|
68
|
+
}
|
|
72
69
|
),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
70
|
+
/* @__PURE__ */ jsxs(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
ref: trailingContentRef,
|
|
74
|
+
className: clsx(
|
|
75
|
+
"-translate-y-1/2 absolute top-1/2 flex items-center gap-2",
|
|
76
|
+
!isTrailingIconElement && !action && !showClear && "pointer-events-none",
|
|
77
|
+
inputSideCva({ size, type: "right" })
|
|
78
|
+
),
|
|
79
|
+
children: [
|
|
80
|
+
showClear && /* @__PURE__ */ jsx(InputClear, { onClear: () => onChange?.("") }),
|
|
81
|
+
unit && /* @__PURE__ */ jsx(
|
|
82
|
+
Typography,
|
|
83
|
+
{
|
|
84
|
+
as: "span",
|
|
85
|
+
size: "label-2",
|
|
86
|
+
variant: "prominent-1",
|
|
87
|
+
className: "text-text-default-3",
|
|
88
|
+
children: unit
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
isLoading && /* @__PURE__ */ jsx("div", { className: "inline-flex", children: /* @__PURE__ */ jsx(Loader, {}) }),
|
|
92
|
+
!isLoading && action && /* @__PURE__ */ jsx(
|
|
93
|
+
InlineIconButton,
|
|
94
|
+
{
|
|
95
|
+
color: "secondary",
|
|
96
|
+
icon: action.icon,
|
|
97
|
+
isDisabled,
|
|
98
|
+
onPress: action.onClick,
|
|
99
|
+
excludeFromTabOrder: true,
|
|
100
|
+
label: action.altText,
|
|
101
|
+
className: action.className
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
!isLoading && !action && TrailingIcon && (isTrailingIconElement ? TrailingIcon : /* @__PURE__ */ jsx(TrailingIcon, { className: "size-6 text-interactive-text-secondary-idle" }))
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
103
111
|
};
|
|
104
112
|
export {
|
|
105
113
|
InputContent
|
|
@@ -2,9 +2,9 @@ import { ReactElement, Ref } from 'react';
|
|
|
2
2
|
import { AriaButtonProps } from 'react-aria';
|
|
3
3
|
import { Key } from 'react-aria-components';
|
|
4
4
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
5
|
-
import { DefaultInitialSelectItem, GroupedSelectProps, SelectAsyncProps, SelectItem, SelectNewItemProps } from './select.types';
|
|
5
|
+
import { DefaultInitialSelectItem, GroupedSelectProps, SelectAsyncProps, SelectItem, SelectNewItemProps, SelectVirtualizationProps } from './select.types';
|
|
6
6
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
7
|
-
export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = FormFieldProps & GroupedSelectProps<TKey, TInitialSelectItem> & SelectNewItemProps & SelectAsyncProps & InputVariantProps & Pick<AriaButtonProps, "onBlur"> & {
|
|
7
|
+
export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = FormFieldProps & GroupedSelectProps<TKey, TInitialSelectItem> & SelectNewItemProps & SelectAsyncProps & SelectVirtualizationProps & InputVariantProps & Pick<AriaButtonProps, "onBlur"> & {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
className?: string;
|
|
10
10
|
placeholder?: string;
|
|
@@ -17,6 +17,7 @@ export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = Default
|
|
|
17
17
|
inputClassName?: string;
|
|
18
18
|
containerClassName?: string;
|
|
19
19
|
customTrigger?: ReactElement;
|
|
20
|
+
selectedTagsType?: "tags" | "list";
|
|
20
21
|
onInputChange?: (value: string) => void;
|
|
21
22
|
onSearchChange?: (value: string) => void;
|
|
22
23
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
@@ -14,7 +14,8 @@ const SelectBase = (dProps) => {
|
|
|
14
14
|
size: dProps.size ?? ui.input.size,
|
|
15
15
|
hideLabel: dProps.hideLabel ?? ui.input.hideLabel,
|
|
16
16
|
isClearable: dProps.isClearable ?? ui.input.isClearable,
|
|
17
|
-
isSearchable: dProps.isSearchable ?? ui.select.isSearchable
|
|
17
|
+
isSearchable: dProps.isSearchable ?? ui.select.isSearchable,
|
|
18
|
+
selectedTagsType: dProps.selectedTagsType ?? ui.select.selectedTagsType
|
|
18
19
|
};
|
|
19
20
|
const isDesktop = useBreakpoint("md");
|
|
20
21
|
return /* @__PURE__ */ jsx(SelectContext.Provider, { ...props, children: isDesktop ? /* @__PURE__ */ jsx(SelectDesktop, { ...props }) : /* @__PURE__ */ jsx(SelectMobile, { ...props }) });
|
|
@@ -4,12 +4,12 @@ import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
|
|
|
4
4
|
import { SelectBaseProps } from './SelectBase';
|
|
5
5
|
import { SelectItem } from './select.types';
|
|
6
6
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
7
|
-
interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName"> {
|
|
7
|
+
interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType"> {
|
|
8
8
|
isInvalid?: boolean;
|
|
9
9
|
className?: string;
|
|
10
10
|
fieldProps?: AriaFieldProps;
|
|
11
11
|
headerProps?: FormFieldHeaderProps;
|
|
12
12
|
onCloseComboBox?: (state: ComboBoxState<SelectItem> | null) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, onCloseComboBox, onBlur, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, onCloseComboBox, onBlur, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|