@povio/ui 2.2.1 → 2.2.3
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 +8 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +5 -6
- package/dist/components/Menu/MenuItem.js +1 -1
- package/dist/components/Menu/MenuMobile.js +2 -3
- package/dist/components/Menu/MenuPopover.js +8 -7
- package/dist/components/buttons/Button/Button.js +24 -8
- package/dist/components/buttons/PillButton/PillButton.js +2 -3
- package/dist/components/buttons/shared/ButtonContent.js +1 -1
- package/dist/components/inputs/Checkbox/Checkbox.js +2 -2
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +2 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +2 -6
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +3 -10
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +1 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +63 -78
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +33 -50
- package/dist/components/inputs/File/shared/InputUploadContent.js +2 -2
- package/dist/components/inputs/File/shared/InputUploadFilled.js +1 -1
- package/dist/components/inputs/FormField/FormField.js +1 -1
- package/dist/components/inputs/FormField/FormFieldError.js +4 -4
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -1
- package/dist/components/inputs/FormField/FormFieldLabel.js +14 -21
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +29 -26
- package/dist/components/inputs/Input/TextArea/TextArea.js +15 -7
- package/dist/components/inputs/Input/TextInput/TextInput.js +30 -27
- package/dist/components/inputs/Input/shared/InputContent.d.ts +2 -2
- package/dist/components/inputs/Input/shared/InputContent.js +53 -73
- package/dist/components/inputs/RadioGroup/RadioGroup.js +3 -4
- package/dist/components/inputs/Selection/shared/SelectBase.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +15 -4
- package/dist/components/inputs/Selection/shared/SelectInput.js +24 -41
- package/dist/components/inputs/Slider/Slider.js +1 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +9 -2
- package/dist/components/inputs/Toggle/Toggle.js +3 -4
- package/dist/components/inputs/shared/CheckContent.js +1 -1
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +2 -2
- package/dist/components/inputs/shared/input.cva.js +34 -25
- package/dist/components/inputs/shared/label.cva.js +10 -38
- package/dist/components/navigation/Accordion/Accordion.js +1 -1
- package/dist/components/navigation/Accordion/AccordionItem.js +9 -10
- package/dist/components/navigation/Stepper/Stepper.js +1 -1
- package/dist/components/navigation/Stepper/StepperItem.js +5 -6
- package/dist/components/navigation/Stepper/StepperSeparator.js +1 -1
- package/dist/components/outline.clsx.js +1 -1
- package/dist/components/overlays/ActionModal/ActionModal.d.ts +6 -1
- package/dist/components/overlays/ActionModal/ActionModal.js +7 -6
- package/dist/components/overlays/Modal/Modal.d.ts +2 -1
- package/dist/components/overlays/Modal/Modal.js +5 -5
- package/dist/components/overlays/Tooltip/Tooltip.js +4 -5
- package/dist/components/segment/Segment.js +1 -2
- package/dist/components/segment/SegmentItem.js +1 -1
- package/dist/components/status/Alert/Alert.js +3 -4
- package/dist/components/status/Toast/Toast.js +4 -5
- package/dist/components/table/Table.js +16 -11
- package/dist/components/text/Link/Link.js +1 -1
- package/dist/components/text/Tag/Tag.js +1 -1
- package/dist/components/text/Typography/Typography.d.ts +1 -1
- package/dist/components/text/Typography/Typography.js +1 -1
- package/dist/config/uiConfig.context.d.ts +4 -0
- package/dist/config/uiConfig.context.js +11 -0
- package/dist/config/uiStyle.context.d.ts +7 -3
- package/dist/config/uiStyle.context.js +13 -1
- package/dist/index.js +4 -4
- package/dist/tw-ui-plugin.d.ts +3 -0
- package/dist/tw-ui-plugin.js +21 -0
- package/dist/utils/compoundMapper.d.ts +1 -1
- package/package.json +27 -27
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
|
+
import { typography } from "../../text/Typography/typography.cva.js";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { clsx } from "clsx";
|
|
4
5
|
const FormFieldError = ({ error, isDisabled, isHidden, className }) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
-
className: clsx("text-text-error-1", !error || isDisabled || isHidden ? "sr-only" : "mt-1-5", className),
|
|
7
|
-
size: "label-3",
|
|
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),
|
|
8
8
|
children: error
|
|
9
9
|
});
|
|
10
10
|
};
|
|
@@ -8,5 +8,6 @@ export interface FormFieldLabelProps extends LabelBaseProps, InputSizeProps {
|
|
|
8
8
|
isDisabled?: boolean;
|
|
9
9
|
ref?: RefCallback<HTMLOrSVGElement>;
|
|
10
10
|
labelProps?: DOMAttributes<HTMLLabelElement>;
|
|
11
|
+
className?: string;
|
|
11
12
|
}
|
|
12
|
-
export declare const FormFieldLabel: ({ ref, as, label, isRequired, isDisabled, labelProps,
|
|
13
|
+
export declare const FormFieldLabel: ({ ref, as, label, isRequired, isDisabled, labelProps, className, }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
|
-
import {
|
|
3
|
-
import { inputSide } from "../shared/input.cva.js";
|
|
2
|
+
import { typography } from "../../text/Typography/typography.cva.js";
|
|
4
3
|
import { labelBase, labelTypography } from "../shared/label.cva.js";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { clsx } from "clsx";
|
|
7
6
|
import { Label } from "react-aria-components";
|
|
8
|
-
const FormFieldLabel = ({ ref, as, label, isRequired, isDisabled, labelProps,
|
|
9
|
-
const
|
|
10
|
-
const labelTypographyMap =
|
|
11
|
-
const labelBaseCva =
|
|
12
|
-
|
|
13
|
-
return /* @__PURE__ */ jsx(Label, {
|
|
7
|
+
const FormFieldLabel = ({ ref, as, label, isRequired, isDisabled, labelProps, className }) => {
|
|
8
|
+
const typographyCva = UIStyle.useCva("typography.cva", typography);
|
|
9
|
+
const labelTypographyMap = UIStyle.useMapper("label.typography", labelTypography);
|
|
10
|
+
const labelBaseCva = UIStyle.useCva("label.cva", labelBase);
|
|
11
|
+
return /* @__PURE__ */ jsxs(Label, {
|
|
14
12
|
...labelProps,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
as: "span",
|
|
13
|
+
ref,
|
|
14
|
+
className: clsx(typographyCva({
|
|
18
15
|
size: "label-2",
|
|
19
16
|
variant: "prominent-1",
|
|
20
|
-
...labelTypographyMap({ as })
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
className: clsx(!isDisabled && "text-text-error-1"),
|
|
27
|
-
children: "*"
|
|
28
|
-
})]
|
|
29
|
-
})
|
|
17
|
+
...labelTypographyMap({ as })
|
|
18
|
+
}), labelBaseCva({ as }), className, labelProps?.className),
|
|
19
|
+
children: [label, isRequired && /* @__PURE__ */ jsx("span", {
|
|
20
|
+
className: clsx(!isDisabled && "text-text-error-1"),
|
|
21
|
+
children: "*"
|
|
22
|
+
})]
|
|
30
23
|
});
|
|
31
24
|
};
|
|
32
25
|
export { FormFieldLabel };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
|
-
import {
|
|
3
|
+
import { inputBase } from "../../shared/input.cva.js";
|
|
3
4
|
import { FormField } from "../../FormField/FormField.js";
|
|
4
5
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
5
6
|
import { InputContent } from "../shared/InputContent.js";
|
|
@@ -13,7 +14,8 @@ import { Controller } from "react-hook-form";
|
|
|
13
14
|
import { useNumberFieldState } from "react-stately";
|
|
14
15
|
var NumberInputBase = (props) => {
|
|
15
16
|
const ui = UIConfig.useConfig();
|
|
16
|
-
const
|
|
17
|
+
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
18
|
+
const inputRef = useRef(null);
|
|
17
19
|
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, formatOptions = ui.numberInput.formatOptions, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, hideLabel = ui.input.hideLabel, isClearable = ui.input.isClearable, ...rest } = props;
|
|
18
20
|
const numberFieldRef = useRef(null);
|
|
19
21
|
const { isFocusVisible } = useFocusVisible();
|
|
@@ -80,30 +82,31 @@ var NumberInputBase = (props) => {
|
|
|
80
82
|
labelProps,
|
|
81
83
|
className: clsx("group w-full", className),
|
|
82
84
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
83
|
-
children: /* @__PURE__ */ jsx(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
85
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
86
|
+
className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
|
|
87
|
+
variant,
|
|
88
|
+
as,
|
|
89
|
+
...rest
|
|
90
|
+
}), inputClassName),
|
|
91
|
+
onClick: () => inputRef.current?.focus(),
|
|
92
|
+
children: /* @__PURE__ */ jsx(InputContent, {
|
|
93
|
+
...inputContentProps,
|
|
94
|
+
headerProps,
|
|
95
|
+
as,
|
|
96
|
+
size,
|
|
97
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
98
|
+
...inputProps,
|
|
99
|
+
ref: mergeRefs(ref, inputRef),
|
|
100
|
+
"data-is-dirty": isDirty || void 0,
|
|
101
|
+
"data-is-required": isRequired || void 0,
|
|
102
|
+
"data-is-empty": value === null || value === void 0 || void 0,
|
|
103
|
+
placeholder: as === "floating" ? "" : inputProps.placeholder,
|
|
104
|
+
className: "w-full outline-none",
|
|
105
|
+
onFocus: (e) => {
|
|
106
|
+
inputProps.onFocus?.(e);
|
|
107
|
+
if (isFocusVisible) e.target.select();
|
|
108
|
+
}
|
|
109
|
+
})
|
|
107
110
|
})
|
|
108
111
|
})
|
|
109
112
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
|
-
import { inputSize, useInputCva } from "../../shared/input.cva.js";
|
|
4
3
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
5
4
|
import { InputClear } from "../../shared/InputClear.js";
|
|
5
|
+
import { inputSide, inputSize, useInputCva } from "../../shared/input.cva.js";
|
|
6
6
|
import { FormField } from "../../FormField/FormField.js";
|
|
7
7
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -15,7 +15,8 @@ import { Controller } from "react-hook-form";
|
|
|
15
15
|
var TextAreaBase = (props) => {
|
|
16
16
|
const ui = UIConfig.useConfig();
|
|
17
17
|
const inputCva = useInputCva();
|
|
18
|
-
const inputSizeCva = UIStyle.
|
|
18
|
+
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
19
|
+
const inputSideCva = UIStyle.useCva("input.sideCva", inputSide);
|
|
19
20
|
const { ref, className, inputClassName, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, isClearable = ui.input.isClearable, ...rest } = props;
|
|
20
21
|
const textFieldRef = useRef(null);
|
|
21
22
|
const { labelProps, inputProps } = useTextField({
|
|
@@ -69,7 +70,11 @@ var TextAreaBase = (props) => {
|
|
|
69
70
|
children: [
|
|
70
71
|
as === "floating" && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
71
72
|
as,
|
|
72
|
-
...headerProps
|
|
73
|
+
...headerProps,
|
|
74
|
+
className: clsx(headerProps.className, inputSideCva({
|
|
75
|
+
size: "default",
|
|
76
|
+
type: "left"
|
|
77
|
+
}))
|
|
73
78
|
}),
|
|
74
79
|
/* @__PURE__ */ jsx(TextArea, {
|
|
75
80
|
...inputProps,
|
|
@@ -87,10 +92,13 @@ var TextAreaBase = (props) => {
|
|
|
87
92
|
}),
|
|
88
93
|
showClear && /* @__PURE__ */ jsx("span", {
|
|
89
94
|
className: clsx("absolute top-0 right-0", inputSizeCva({ size: "default" })),
|
|
90
|
-
children: /* @__PURE__ */ jsx(InputClear, {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
children: /* @__PURE__ */ jsx(InputClear, {
|
|
96
|
+
onClear: () => {
|
|
97
|
+
onChange?.("");
|
|
98
|
+
onBlur?.(null);
|
|
99
|
+
},
|
|
100
|
+
show: true
|
|
101
|
+
})
|
|
94
102
|
})
|
|
95
103
|
]
|
|
96
104
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
|
-
import {
|
|
3
|
+
import { inputBase } from "../../shared/input.cva.js";
|
|
3
4
|
import { FormField } from "../../FormField/FormField.js";
|
|
4
5
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
5
6
|
import { InputContent } from "../shared/InputContent.js";
|
|
@@ -12,7 +13,8 @@ import { mergeRefs } from "@react-aria/utils";
|
|
|
12
13
|
import { Controller } from "react-hook-form";
|
|
13
14
|
var TextInputBase = (props) => {
|
|
14
15
|
const ui = UIConfig.useConfig();
|
|
15
|
-
const
|
|
16
|
+
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
17
|
+
const inputRef = useRef(null);
|
|
16
18
|
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, ...rest } = props;
|
|
17
19
|
const textFieldRef = useRef(null);
|
|
18
20
|
const { isFocusVisible } = useFocusVisible();
|
|
@@ -72,31 +74,32 @@ var TextInputBase = (props) => {
|
|
|
72
74
|
labelProps,
|
|
73
75
|
className: clsx("group w-full", as === "inline" && "h-full", className),
|
|
74
76
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
75
|
-
children: /* @__PURE__ */ jsx(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
77
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
78
|
+
className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
|
|
79
|
+
variant,
|
|
80
|
+
as,
|
|
81
|
+
...rest
|
|
82
|
+
}), inputClassName),
|
|
83
|
+
onClick: () => inputRef.current?.focus(),
|
|
84
|
+
children: /* @__PURE__ */ jsx(InputContent, {
|
|
85
|
+
...inputContentProps,
|
|
86
|
+
headerProps,
|
|
87
|
+
as,
|
|
88
|
+
size,
|
|
89
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
90
|
+
...inputProps,
|
|
91
|
+
ref: mergeRefs(ref, inputRef),
|
|
92
|
+
"data-is-empty": value === "" || value === null || value === void 0 || void 0,
|
|
93
|
+
"data-is-dirty": isDirty || void 0,
|
|
94
|
+
"data-is-required": isRequired || void 0,
|
|
95
|
+
"data-is-disabled": isDisabled || void 0,
|
|
96
|
+
placeholder: as === "floating" ? "" : inputProps.placeholder,
|
|
97
|
+
className: "w-full outline-none",
|
|
98
|
+
onFocus: (e) => {
|
|
99
|
+
inputProps.onFocus?.(e);
|
|
100
|
+
if (isFocusVisible) e.target.select();
|
|
101
|
+
}
|
|
102
|
+
})
|
|
100
103
|
})
|
|
101
104
|
})
|
|
102
105
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC, FocusEvent, ReactElement, ReactNode, SVGProps } from 'react';
|
|
2
2
|
import { InlineIconButtonProps } from '../../../buttons/InlineIconButton/InlineIconButton';
|
|
3
3
|
import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
|
|
4
4
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
@@ -22,7 +22,7 @@ export interface InputContentProps {
|
|
|
22
22
|
headerProps?: FormFieldHeaderProps;
|
|
23
23
|
}
|
|
24
24
|
interface InputContentComponentProps extends InputContentProps, InputVariantProps {
|
|
25
|
-
children:
|
|
25
|
+
children: ReactNode;
|
|
26
26
|
}
|
|
27
27
|
export declare const InputContent: ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, unit, isLoading, isDisabled, action, isClearable, value, onChange, onBlur, children, headerProps, as, size, }: InputContentComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export {};
|
|
@@ -1,94 +1,74 @@
|
|
|
1
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
|
-
import {
|
|
2
|
+
import { typography } from "../../../text/Typography/typography.cva.js";
|
|
3
3
|
import { Loader } from "../../../status/Loader/Loader.js";
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
|
-
import { inputSide } from "../../shared/input.cva.js";
|
|
6
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
7
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
7
|
+
import { inputSize } from "../../shared/input.cva.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { clsx } from "clsx";
|
|
10
|
-
import { isValidElement
|
|
11
|
-
import useMeasure from "react-use-measure";
|
|
10
|
+
import { isValidElement } from "react";
|
|
12
11
|
const InputContent = ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, unit, isLoading, isDisabled, action, isClearable, value, onChange, onBlur, children, headerProps, as, size }) => {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const [trailingContentRef, { width: trailingWidth }] = useMeasure();
|
|
16
|
-
const [labelContentRef, { width: labelWidth }] = useMeasure();
|
|
12
|
+
const typographyCva = UIStyle.useCva("typography.cva", typography);
|
|
13
|
+
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
17
14
|
const isLeadingIconElement = LeadingIcon && isValidElement(LeadingIcon);
|
|
18
15
|
const isTrailingIconElement = TrailingIcon && isValidElement(TrailingIcon);
|
|
19
|
-
const showClear =
|
|
20
|
-
const style = useMemo(() => {
|
|
21
|
-
const leftPadding = as === "filter" ? labelWidth + leadingWidth : leadingWidth;
|
|
22
|
-
return {
|
|
23
|
-
paddingLeft: `calc(var(${inputSideCva({
|
|
24
|
-
size,
|
|
25
|
-
type: "var"
|
|
26
|
-
})}) + ${leftPadding}px + ${leftPadding > 0 ? "var(--spacing-2)" : "0px"})`,
|
|
27
|
-
paddingRight: `calc(var(${inputSideCva({
|
|
28
|
-
size,
|
|
29
|
-
type: "var"
|
|
30
|
-
})}) + ${trailingWidth}px + ${trailingWidth > 0 ? "var(--spacing-2)" : "0px"})`
|
|
31
|
-
};
|
|
32
|
-
}, [
|
|
33
|
-
leadingWidth,
|
|
34
|
-
trailingWidth,
|
|
35
|
-
labelWidth,
|
|
36
|
-
as,
|
|
37
|
-
size,
|
|
38
|
-
inputSideCva
|
|
39
|
-
]);
|
|
16
|
+
const showClear = value != null && value !== "" && !isDisabled;
|
|
40
17
|
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
-
className:
|
|
42
|
-
children: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
as
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
LeadingIcon && /* @__PURE__ */ jsx("div", {
|
|
50
|
-
ref: leadingContentRef,
|
|
51
|
-
className: clsx("absolute top-1/2 -translate-y-1/2", !isLeadingIconElement && "pointer-events-none", inputSideCva({
|
|
52
|
-
size,
|
|
53
|
-
type: "left"
|
|
54
|
-
})),
|
|
18
|
+
className: "flex w-full items-center gap-input-gap-input-text-to-elements",
|
|
19
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: clsx(inputSizeCva({
|
|
21
|
+
size,
|
|
22
|
+
as
|
|
23
|
+
}), "group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", as === "inline" && "h-full"),
|
|
24
|
+
children: [LeadingIcon && /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: clsx(!isLeadingIconElement && "pointer-events-none"),
|
|
55
26
|
children: isLeadingIconElement ? LeadingIcon : /* @__PURE__ */ jsx(LeadingIcon, { className: "size-6 text-interactive-text-secondary-idle" })
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
27
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: clsx("flex w-full", as === "floating" && "flex-col", as === "filter" && "gap-input-gap-input-text-to-elements"),
|
|
29
|
+
children: [as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
30
|
+
as,
|
|
60
31
|
size,
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
32
|
+
...headerProps
|
|
33
|
+
}), children]
|
|
34
|
+
})]
|
|
35
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: clsx(inputSizeCva({
|
|
37
|
+
size,
|
|
38
|
+
as
|
|
39
|
+
}), "flex items-center gap-input-gap-trailing-elements py-0! pl-0!", !isTrailingIconElement && !action && !(isClearable && showClear) && "pointer-events-none"),
|
|
40
|
+
children: [
|
|
41
|
+
isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
42
|
+
onClear: () => {
|
|
65
43
|
onChange?.("");
|
|
66
44
|
onBlur?.({ target: { value: "" } });
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
},
|
|
46
|
+
show: showClear
|
|
47
|
+
}),
|
|
48
|
+
unit && /* @__PURE__ */ jsx("span", {
|
|
49
|
+
className: typographyCva({
|
|
70
50
|
size: "label-2",
|
|
71
51
|
variant: "prominent-1",
|
|
72
|
-
className: "text-text-default-3"
|
|
73
|
-
children: unit
|
|
74
|
-
}),
|
|
75
|
-
isLoading && /* @__PURE__ */ jsx("div", {
|
|
76
|
-
className: "inline-flex",
|
|
77
|
-
children: /* @__PURE__ */ jsx(Loader, {})
|
|
78
|
-
}),
|
|
79
|
-
!isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
80
|
-
color: "secondary",
|
|
81
|
-
icon: action.icon,
|
|
82
|
-
isDisabled,
|
|
83
|
-
onPress: action.onClick,
|
|
84
|
-
excludeFromTabOrder: true,
|
|
85
|
-
label: action.altText,
|
|
86
|
-
className: action.className
|
|
52
|
+
className: "text-text-default-3"
|
|
87
53
|
}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
54
|
+
children: unit
|
|
55
|
+
}),
|
|
56
|
+
isLoading && /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: "inline-flex",
|
|
58
|
+
children: /* @__PURE__ */ jsx(Loader, {})
|
|
59
|
+
}),
|
|
60
|
+
!isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
61
|
+
color: "secondary",
|
|
62
|
+
icon: action.icon,
|
|
63
|
+
isDisabled,
|
|
64
|
+
onPress: action.onClick,
|
|
65
|
+
excludeFromTabOrder: true,
|
|
66
|
+
label: action.altText,
|
|
67
|
+
className: clsx("border-0!", action.className)
|
|
68
|
+
}),
|
|
69
|
+
!isLoading && !action && TrailingIcon && (isTrailingIconElement ? TrailingIcon : /* @__PURE__ */ jsx(TrailingIcon, { className: "size-6 text-interactive-text-secondary-idle" }))
|
|
70
|
+
]
|
|
71
|
+
})]
|
|
92
72
|
});
|
|
93
73
|
};
|
|
94
74
|
export { InputContent };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
|
-
import { CheckContent } from "../shared/CheckContent.js";
|
|
3
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
|
+
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";
|
|
@@ -10,9 +10,8 @@ import { mergeRefs } from "@react-aria/utils";
|
|
|
10
10
|
import { Controller } from "react-hook-form";
|
|
11
11
|
var RadioGroupBase = (props) => {
|
|
12
12
|
const ui = UIConfig.useConfig();
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const radioTypographyMap = uiStyle?.radio?.typography ?? radioTypography;
|
|
13
|
+
const radioCva = UIStyle.useCva("radio.cva", radio);
|
|
14
|
+
const radioTypographyMap = UIStyle.useMapper("radio.typography", radioTypography);
|
|
16
15
|
const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, variant = ui.radioGroup.variant, hideLabel = ui.radioGroup.hideLabel, ...rest } = props;
|
|
17
16
|
const formFieldProps = {
|
|
18
17
|
className,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useBreakpoint } from "../../../../hooks/useBreakpoint.js";
|
|
2
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
|
+
import { useBreakpoint } from "../../../../hooks/useBreakpoint.js";
|
|
3
3
|
import { SelectContext } from "./select.context.js";
|
|
4
4
|
import { SelectDesktop } from "./SelectDesktop.js";
|
|
5
5
|
import { SelectMobile } from "./SelectMobile.js";
|
|
@@ -6,11 +6,10 @@ import { SelectInput } from "./SelectInput.js";
|
|
|
6
6
|
import { SelectListBox } from "./SelectListBox.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { clsx } from "clsx";
|
|
9
|
-
import { Fragment as Fragment$1, useMemo, useRef } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { ComboBox, DialogTrigger, Popover } from "react-aria-components";
|
|
11
11
|
import { useLabel, usePreventScroll } from "react-aria";
|
|
12
12
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import useMeasure from "react-use-measure";
|
|
14
13
|
const SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }) => {
|
|
15
14
|
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, isSearchable, isClearable, isLoading, as, size, collapseAfter, selectedTagsType } = props;
|
|
16
15
|
const formFieldProps = {
|
|
@@ -29,9 +28,21 @@ const SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, i
|
|
|
29
28
|
const { labelProps, fieldProps } = useLabel({ label });
|
|
30
29
|
const triggerRef = useRef(null);
|
|
31
30
|
const closeComboBoxRef = useRef(null);
|
|
32
|
-
const
|
|
31
|
+
const wrapperRef = useRef(null);
|
|
32
|
+
const [popoverWidth, setPopoverWidth] = useState(void 0);
|
|
33
33
|
const { fieldState, isOpen, setIsOpen, onInputChange, onChange, onClear, onSelectAll, listItems, selectableListItems, selectedIds, isMultiple } = SelectContext.useSelect();
|
|
34
34
|
usePreventScroll({ isDisabled: !isOpen });
|
|
35
|
+
useLayoutEffect(() => {
|
|
36
|
+
if (!isOpen || !wrapperRef.current) return;
|
|
37
|
+
setPopoverWidth(wrapperRef.current.getBoundingClientRect().width);
|
|
38
|
+
const observer = new ResizeObserver((entries) => {
|
|
39
|
+
setPopoverWidth(entries[0].contentRect.width);
|
|
40
|
+
});
|
|
41
|
+
observer.observe(wrapperRef.current);
|
|
42
|
+
return () => {
|
|
43
|
+
observer.disconnect();
|
|
44
|
+
};
|
|
45
|
+
}, [isOpen]);
|
|
35
46
|
const onSelectionChange = (value) => {
|
|
36
47
|
if (!value) return;
|
|
37
48
|
if (value === "all-item-id") {
|
|
@@ -133,7 +144,7 @@ const SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, i
|
|
|
133
144
|
isOpen,
|
|
134
145
|
onOpenChange: setIsOpen,
|
|
135
146
|
className: "my-4 outline-none",
|
|
136
|
-
style: { width: !ignoreTriggerWidth ?
|
|
147
|
+
style: { width: !ignoreTriggerWidth ? popoverWidth : void 0 },
|
|
137
148
|
offset: 0,
|
|
138
149
|
children: /* @__PURE__ */ jsx(SelectListBox, {
|
|
139
150
|
...props,
|