@povio/ui 2.2.9-rc.34 → 2.2.9-rc.35
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/components/inputs/Input/NumberInput/NumberInput.js +3 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +79 -21
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +5 -1
- package/dist/tw-ui-plugin.js +2 -0
- package/package.json +1 -1
|
@@ -97,6 +97,8 @@ var NumberInputBase = (props) => {
|
|
|
97
97
|
...rest
|
|
98
98
|
}), inputClassName),
|
|
99
99
|
onClick: () => inputRef.current?.focus(),
|
|
100
|
+
"data-is-empty": value === null || value === void 0 || void 0,
|
|
101
|
+
"data-is-required": isRequired || void 0,
|
|
100
102
|
children: /* @__PURE__ */ jsx(InputContent, {
|
|
101
103
|
...inputContentProps,
|
|
102
104
|
headerProps,
|
|
@@ -164,6 +166,7 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
|
|
|
164
166
|
onStaticInteract: renderRealInput,
|
|
165
167
|
inputClassName: props.inputClassName,
|
|
166
168
|
children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
|
|
169
|
+
type: "number",
|
|
167
170
|
ref: inputRef,
|
|
168
171
|
disabled: isDisabled,
|
|
169
172
|
tabIndex: -1,
|
|
@@ -4,7 +4,8 @@ import { FieldValues } from 'react-hook-form';
|
|
|
4
4
|
import { FormFieldProps } from '../FormField/FormField';
|
|
5
5
|
import { RadioVariantProps } from './radio.cva';
|
|
6
6
|
import { ControlProps } from '../shared/form.types';
|
|
7
|
-
|
|
7
|
+
import { InputVariantProps } from '../shared/input.cva';
|
|
8
|
+
interface RadioGroupBaseProps extends Omit<FormFieldProps, "variant">, RadioVariantProps, Omit<InputVariantProps, "variant">, Omit<AriaRadioGroupProps, "className"> {
|
|
8
9
|
ref?: Ref<HTMLDivElement>;
|
|
9
10
|
options: {
|
|
10
11
|
label: string | ReactElement;
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
3
|
import { CheckContent } from "../shared/CheckContent.js";
|
|
4
|
+
import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
|
|
5
|
+
import { inputBase, inputSize } from "../shared/input.cva.js";
|
|
4
6
|
import { FormField } from "../FormField/FormField.js";
|
|
7
|
+
import { TooltipWrapper } from "../shared/TooltipWrapper.js";
|
|
5
8
|
import { radio, radioContentClassName, radioIndicatorClass, radioTypography } from "./radio.cva.js";
|
|
6
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
10
|
import { clsx } from "clsx";
|
|
8
11
|
import { Radio, RadioGroup } from "react-aria-components";
|
|
12
|
+
import { useLabel } from "react-aria";
|
|
9
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
10
14
|
import { Controller } from "react-hook-form";
|
|
11
15
|
//#region src/components/inputs/RadioGroup/RadioGroup.tsx
|
|
12
16
|
var RadioGroupBase = (props) => {
|
|
13
17
|
const ui = UIConfig.useConfig();
|
|
14
18
|
const radioCva = UIStyle.useCva("radio.cva", radio);
|
|
19
|
+
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
20
|
+
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
15
21
|
const radioTypographyMap = UIStyle.useMapper("radio.typography", radioTypography);
|
|
16
22
|
const radioContentClassNameMap = UIStyle.useMapper("radio.contentClassName", radioContentClassName);
|
|
17
|
-
const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options,
|
|
23
|
+
const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, value, defaultValue, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
|
|
24
|
+
const as = asProp ?? ui.input.as;
|
|
25
|
+
const size = sizeProp ?? ui.input.size;
|
|
26
|
+
const variant = variantProp ?? ui.radioGroup.variant;
|
|
27
|
+
const hideLabel = hideLabelProp ?? ui.radioGroup.hideLabel;
|
|
18
28
|
const radioClassName = radioCva({
|
|
19
29
|
variant,
|
|
20
30
|
...rest
|
|
@@ -35,32 +45,80 @@ var RadioGroupBase = (props) => {
|
|
|
35
45
|
helperText,
|
|
36
46
|
isRequired,
|
|
37
47
|
rightContent,
|
|
38
|
-
isHeaderHidden,
|
|
48
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
39
49
|
hideLabel,
|
|
40
50
|
isDisabled,
|
|
41
51
|
headerClassName,
|
|
42
52
|
errorClassName
|
|
43
53
|
};
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
const { labelProps, fieldProps } = useLabel({ label });
|
|
55
|
+
const headerProps = {
|
|
56
|
+
label,
|
|
57
|
+
tooltipText,
|
|
58
|
+
helperText,
|
|
59
|
+
isRequired,
|
|
60
|
+
rightContent,
|
|
61
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
46
62
|
isDisabled,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
className: headerClassName,
|
|
64
|
+
labelProps
|
|
65
|
+
};
|
|
66
|
+
const selectedValue = value ?? defaultValue;
|
|
67
|
+
const shouldRenderInputFrame = as !== "default";
|
|
68
|
+
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
69
|
+
as,
|
|
70
|
+
error,
|
|
71
|
+
triggerTabIndex: as === "inline" ? -1 : void 0,
|
|
72
|
+
children: /* @__PURE__ */ jsx(RadioGroup, {
|
|
73
|
+
...rest,
|
|
74
|
+
...fieldProps,
|
|
75
|
+
ref,
|
|
76
|
+
value,
|
|
77
|
+
defaultValue,
|
|
78
|
+
isDisabled,
|
|
79
|
+
isInvalid: !!error,
|
|
80
|
+
"data-is-dirty": isDirty || void 0,
|
|
81
|
+
"data-is-required": isRequired || void 0,
|
|
82
|
+
children: /* @__PURE__ */ jsx(FormField, {
|
|
83
|
+
...formFieldProps,
|
|
84
|
+
as,
|
|
85
|
+
labelProps,
|
|
86
|
+
className: clsx("w-full", as === "inline" && "h-full", className),
|
|
87
|
+
tabIndex: as === "inline" ? -1 : void 0,
|
|
88
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
89
|
+
className: clsx("group/radio-group-content relative", shouldRenderInputFrame && inputBaseCva({
|
|
90
|
+
variant: ui.input.variant,
|
|
91
|
+
as
|
|
92
|
+
}), inputClassName),
|
|
93
|
+
"data-rac": "",
|
|
94
|
+
"data-disabled": isDisabled || void 0,
|
|
95
|
+
"data-is-disabled": isDisabled || void 0,
|
|
96
|
+
"data-invalid": !!error || void 0,
|
|
97
|
+
"data-has-selection": selectedValue != null && selectedValue !== "" ? true : void 0,
|
|
98
|
+
"data-radio-group-content": "",
|
|
99
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: clsx("relative flex", as === "inline" || as === "filter" ? "flex-row flex-wrap items-center gap-2" : "flex-col", shouldRenderInputFrame && clsx("gap-2", inputSizeCva({
|
|
101
|
+
as,
|
|
102
|
+
size
|
|
103
|
+
}))),
|
|
104
|
+
"data-is-dirty": isDirty || void 0,
|
|
105
|
+
"data-is-required": isRequired || void 0,
|
|
106
|
+
children: [as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
107
|
+
as,
|
|
108
|
+
size,
|
|
109
|
+
...headerProps
|
|
110
|
+
}), options.map((option) => /* @__PURE__ */ jsxs(Radio, {
|
|
111
|
+
value: option.value,
|
|
112
|
+
className: clsx("relative", radioIndicatorClass),
|
|
113
|
+
children: [/* @__PURE__ */ jsx("div", { className: radioClassName }), /* @__PURE__ */ jsx(CheckContent, {
|
|
114
|
+
typography: radioTypographyProps,
|
|
115
|
+
contentClassName: radioContentClassNameValue,
|
|
116
|
+
className: labelClassName,
|
|
117
|
+
children: option.label
|
|
118
|
+
})]
|
|
119
|
+
}, option.value))]
|
|
120
|
+
})
|
|
121
|
+
})
|
|
64
122
|
})
|
|
65
123
|
})
|
|
66
124
|
});
|
|
@@ -21,12 +21,16 @@ var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, leadingCo
|
|
|
21
21
|
onChange?.(value);
|
|
22
22
|
props.onBlur?.({ target: { value: null } });
|
|
23
23
|
};
|
|
24
|
+
const handleSearchChange = (value) => {
|
|
25
|
+
setSearch(value);
|
|
26
|
+
handleEnableQuery();
|
|
27
|
+
};
|
|
24
28
|
const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
|
|
25
29
|
return /* @__PURE__ */ jsx(Autocomplete, {
|
|
26
30
|
...autocompleteProps,
|
|
27
31
|
items,
|
|
28
32
|
totalItems,
|
|
29
|
-
onSearchChange:
|
|
33
|
+
onSearchChange: handleSearchChange,
|
|
30
34
|
isClientSearchDisabled: true,
|
|
31
35
|
isLoading,
|
|
32
36
|
onChange: handleChange,
|
package/dist/tw-ui-plugin.js
CHANGED
|
@@ -7,6 +7,7 @@ var uiPlugin = plugin(({ addVariant }) => {
|
|
|
7
7
|
"&:is(:where(.group\\/select-content)[data-has-selection] *)",
|
|
8
8
|
"&:is(:where(.group\\/select-content)[data-has-search] *)",
|
|
9
9
|
"&:is(:where(.group\\/select-content)[data-searchable-focus-within] *)",
|
|
10
|
+
"&:is(:where(.group\\/radio-group-content)[data-radio-group-content] *)",
|
|
10
11
|
"&:is(:where(.group\\/date-picker-content)[data-has-selection] *)",
|
|
11
12
|
"&:is(:where(.group\\/date-picker-content)[data-focus-within] *)"
|
|
12
13
|
].join(", "));
|
|
@@ -14,6 +15,7 @@ var uiPlugin = plugin(({ addVariant }) => {
|
|
|
14
15
|
"&:is(:where(.group\\/input-content):has(*:is(input:disabled)) *)",
|
|
15
16
|
"&:is(:where(.group\\/select-content)[data-disabled] *)",
|
|
16
17
|
"&:is(:where(.group\\/select-content):has(*:is(input:disabled)) *)",
|
|
18
|
+
"&:is(:where(.group\\/radio-group-content)[data-disabled] *)",
|
|
17
19
|
"&:is(:where(.group\\/text-area):has(*:is(textarea:disabled)) *)",
|
|
18
20
|
"&:is(:where(.group\\/text-editor):where([data-rac])[data-disabled] *)",
|
|
19
21
|
"&:is(:where(.group\\/date-picker-content):where([data-rac])[data-disabled] *)"
|