@povio/ui 2.2.9-rc.37 → 2.2.9-rc.39

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.
@@ -165,10 +165,12 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
165
165
  renderStatic: true,
166
166
  onStaticInteract: renderRealInput,
167
167
  inputClassName: props.inputClassName,
168
+ wrapContentAndTrailing: true,
168
169
  children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
169
170
  type: "text",
170
171
  ref: inputRef,
171
172
  disabled: isDisabled,
173
+ inputMode: "numeric",
172
174
  tabIndex: -1,
173
175
  value: displayValue,
174
176
  placeholder: as === "floating" ? "" : props.placeholder,
@@ -0,0 +1,4 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export declare const textAreaWrapper: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
3
+ export interface TextAreaWrapperVariantProps extends VariantProps<typeof textAreaWrapper> {
4
+ }
@@ -0,0 +1,5 @@
1
+ import { cva } from "class-variance-authority";
2
+ //#region src/components/inputs/Input/TextArea/TextArea.cva.ts
3
+ var textAreaWrapper = cva("group/text-area relative h-full");
4
+ //#endregion
5
+ export { textAreaWrapper };
@@ -5,6 +5,7 @@ import { InputClear } from "../../shared/InputClear.js";
5
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
+ import { textAreaWrapper } from "./TextArea.cva.js";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import { clsx } from "clsx";
10
11
  import { useRef } from "react";
@@ -18,6 +19,7 @@ var TextAreaBase = (props) => {
18
19
  const inputCva = useInputCva();
19
20
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
20
21
  const inputSideCva = UIStyle.useCva("input.sideCva", inputSide);
22
+ const textAreaWrapperCva = UIStyle.useCva("textArea.wrapperCva", textAreaWrapper);
21
23
  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;
22
24
  const textFieldRef = useRef(null);
23
25
  const { labelProps, inputProps } = useTextField({
@@ -66,7 +68,7 @@ var TextAreaBase = (props) => {
66
68
  className: clsx("w-full", className),
67
69
  tabIndex: as === "inline" ? -1 : void 0,
68
70
  children: /* @__PURE__ */ jsxs("div", {
69
- className: "group/text-area relative h-full",
71
+ className: textAreaWrapperCva({}),
70
72
  "data-text-area": true,
71
73
  children: [
72
74
  as === "floating" && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
@@ -160,6 +160,7 @@ var TextInput = ({ renderStaticInput, ...props }) => {
160
160
  renderStatic: true,
161
161
  onStaticInteract: renderRealInput,
162
162
  inputClassName: props.inputClassName,
163
+ wrapContentAndTrailing: true,
163
164
  children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
164
165
  ref: inputRef,
165
166
  type: inputType === "hidden" ? "password" : inputType,
@@ -5,7 +5,7 @@ import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
5
5
  import { inputBase, inputSize } from "../shared/input.cva.js";
6
6
  import { FormField } from "../FormField/FormField.js";
7
7
  import { TooltipWrapper } from "../shared/TooltipWrapper.js";
8
- import { radio, radioContentClassName, radioIndicatorClass, radioTypography } from "./radio.cva.js";
8
+ import { radio, radioContentClassName, radioContentRow, radioContentWrapper, radioIndicatorClass, radioTypography } from "./radio.cva.js";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { clsx } from "clsx";
11
11
  import { Radio, RadioGroup } from "react-aria-components";
@@ -16,6 +16,8 @@ import { Controller } from "react-hook-form";
16
16
  var RadioGroupBase = (props) => {
17
17
  const ui = UIConfig.useConfig();
18
18
  const radioCva = UIStyle.useCva("radio.cva", radio);
19
+ const radioContentWrapperCva = UIStyle.useCva("radio.contentWrapperCva", radioContentWrapper);
20
+ const radioContentRowCva = UIStyle.useCva("radio.contentRowCva", radioContentRow);
19
21
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
20
22
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
21
23
  const radioTypographyMap = UIStyle.useMapper("radio.typography", radioTypography);
@@ -97,26 +99,39 @@ var RadioGroupBase = (props) => {
97
99
  "data-has-selection": selectedValue != null && selectedValue !== "" ? true : void 0,
98
100
  "data-radio-group-content": "",
99
101
  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({
102
+ className: clsx(radioContentWrapperCva({
103
+ variant,
104
+ as,
105
+ hasInputFrame: shouldRenderInputFrame,
106
+ ...rest
107
+ }), shouldRenderInputFrame && inputSizeCva({
101
108
  as,
102
109
  size
103
- }))),
110
+ })),
104
111
  "data-is-dirty": isDirty || void 0,
105
112
  "data-is-required": isRequired || void 0,
106
113
  children: [as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
107
114
  as,
108
115
  size,
109
116
  ...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))]
117
+ }), /* @__PURE__ */ jsx("div", {
118
+ className: radioContentRowCva({
119
+ variant,
120
+ as,
121
+ hasInputFrame: shouldRenderInputFrame,
122
+ ...rest
123
+ }),
124
+ children: options.map((option) => /* @__PURE__ */ jsxs(Radio, {
125
+ value: option.value,
126
+ className: clsx("relative", radioIndicatorClass),
127
+ children: [/* @__PURE__ */ jsx("div", { className: radioClassName }), /* @__PURE__ */ jsx(CheckContent, {
128
+ typography: radioTypographyProps,
129
+ contentClassName: radioContentClassNameValue,
130
+ className: labelClassName,
131
+ children: option.label
132
+ })]
133
+ }, option.value))
134
+ })]
120
135
  })
121
136
  })
122
137
  })
@@ -5,6 +5,20 @@ export declare const radio: (props?: ({
5
5
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
6
  export interface RadioVariantProps extends VariantProps<typeof radio> {
7
7
  }
8
+ export declare const radioContentWrapper: (props?: ({
9
+ variant?: "default" | null | undefined;
10
+ as?: "filter" | "default" | "floating" | "inline" | null | undefined;
11
+ hasInputFrame?: boolean | null | undefined;
12
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
13
+ export interface RadioContentWrapperVariantProps extends VariantProps<typeof radioContentWrapper> {
14
+ }
15
+ export declare const radioContentRow: (props?: ({
16
+ variant?: "default" | null | undefined;
17
+ as?: "filter" | "default" | "floating" | "inline" | null | undefined;
18
+ hasInputFrame?: boolean | null | undefined;
19
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
20
+ export interface RadioContentRowVariantProps extends VariantProps<typeof radioContentRow> {
21
+ }
8
22
  export declare const radioIndicatorClass = "group flex items-center gap-2";
9
23
  export declare const radioTypography: (props: {
10
24
  variant?: "default" | null | undefined;
@@ -25,6 +25,46 @@ var radio = cva([
25
25
  ] } },
26
26
  defaultVariants: { variant: "default" }
27
27
  });
28
+ var radioContentWrapper = cva("relative flex", {
29
+ variants: {
30
+ variant: { default: "" },
31
+ as: {
32
+ default: "flex-col",
33
+ floating: "flex-col",
34
+ filter: "flex-row flex-wrap items-center gap-2",
35
+ inline: "flex-row flex-wrap items-center gap-2"
36
+ },
37
+ hasInputFrame: {
38
+ true: "gap-2",
39
+ false: ""
40
+ }
41
+ },
42
+ defaultVariants: {
43
+ variant: "default",
44
+ as: "default",
45
+ hasInputFrame: false
46
+ }
47
+ });
48
+ var radioContentRow = cva("flex", {
49
+ variants: {
50
+ variant: { default: "" },
51
+ as: {
52
+ default: "flex-col",
53
+ floating: "flex-col",
54
+ filter: "flex-row flex-wrap items-center gap-2",
55
+ inline: "flex-row flex-wrap items-center gap-2"
56
+ },
57
+ hasInputFrame: {
58
+ true: "gap-2",
59
+ false: ""
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ variant: "default",
64
+ as: "default",
65
+ hasInputFrame: false
66
+ }
67
+ });
28
68
  var radioIndicatorClass = "group flex items-center gap-2";
29
69
  var radioTypography = compoundMapper({ default: {
30
70
  size: "label-1",
@@ -33,4 +73,4 @@ var radioTypography = compoundMapper({ default: {
33
73
  } });
34
74
  var radioContentClassName = compoundMapper({ default: "text-text-default-2" });
35
75
  //#endregion
36
- export { radio, radioContentClassName, radioIndicatorClass, radioTypography };
76
+ export { radio, radioContentClassName, radioContentRow, radioContentWrapper, radioIndicatorClass, radioTypography };
@@ -69,6 +69,7 @@ export interface InputFrameProps extends InputVariantProps, Partial<FormFieldPro
69
69
  inputClassName?: string;
70
70
  contentClassName?: string;
71
71
  contentWrapperClassName?: string;
72
+ wrapContentAndTrailing?: boolean;
72
73
  labelPlacement?: InputFrameLabelPlacement;
73
74
  trailingClassName?: string;
74
75
  }
@@ -8,7 +8,7 @@ import { InputClear } from "../shared/InputClear.js";
8
8
  import { inputBase, inputContentWrapper, inputSize } from "../shared/input.cva.js";
9
9
  import { FormField } from "../FormField/FormField.js";
10
10
  import { TooltipWrapper } from "../shared/TooltipWrapper.js";
11
- import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { clsx } from "clsx";
13
13
  import { isValidElement, useId } from "react";
14
14
  //#region src/components/inputs/Skeleton/InputFrame.tsx
@@ -19,7 +19,7 @@ var InputFrame = (props) => {
19
19
  const inputContentWrapperCva = UIStyle.useCva("input.contentWrapperCva", inputContentWrapper);
20
20
  const typographyCva = UIStyle.useCva("typography.cva", typography);
21
21
  const generatedInputId = useId();
22
- const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, labelPlacement = "content-wrapper", trailingClassName, onMouseEnter, onFocusCapture, variant: variantProp, as: asProp, size: sizeProp } = props;
22
+ const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, wrapContentAndTrailing, labelPlacement = "content-wrapper", trailingClassName, onMouseEnter, onFocusCapture, variant: variantProp, as: asProp, size: sizeProp } = props;
23
23
  const as = asProp ?? ui.input.as;
24
24
  const size = sizeProp ?? ui.input.size;
25
25
  const variant = variantProp ?? ui.input.variant;
@@ -70,6 +70,75 @@ var InputFrame = (props) => {
70
70
  ...resolvedHeaderProps
71
71
  }) : null;
72
72
  const resolvedContentWrapperClassName = contentWrapperClassName ?? inputContentWrapperCva({ as });
73
+ const contentRow = /* @__PURE__ */ jsxs("div", {
74
+ className: clsx("group/input-frame flex min-w-0 w-full items-center gap-input-gap-input-text-to-elements pr-0!", as === "inline" && "h-full", inputSizeCva({
75
+ size,
76
+ as
77
+ }), typographySize && typographyCva({ size: typographySize }), contentClassName),
78
+ children: [
79
+ leadingContent,
80
+ leadingIcon && /* @__PURE__ */ jsx("div", {
81
+ className: clsx(!isLeadingIconElement && "pointer-events-none"),
82
+ children: renderIconVisual(leadingIcon)
83
+ }),
84
+ labelPlacement === "content-row" && labelContent,
85
+ actionContentPlacement === "content-row" && actionContent,
86
+ /* @__PURE__ */ jsxs("div", {
87
+ className: resolvedContentWrapperClassName,
88
+ children: [
89
+ labelPlacement === "content-wrapper" && labelContent,
90
+ actionContentPlacement === "content-wrapper" && actionContent,
91
+ typeof children === "function" ? children({
92
+ ...dataAttributeProps,
93
+ id: inputId
94
+ }) : children
95
+ ]
96
+ })
97
+ ]
98
+ });
99
+ const trailingRow = hasTrailingContent ? /* @__PURE__ */ jsxs("div", {
100
+ className: clsx("flex items-center gap-input-gap-trailing-elements py-0! pl-0!", inputSizeCva({
101
+ size,
102
+ as
103
+ }), !isTrailingInteractive && "pointer-events-none", trailingClassName),
104
+ children: [
105
+ hasClear && /* @__PURE__ */ jsx(InputClear, {
106
+ onClear: () => onClear?.(),
107
+ className: clearClassName,
108
+ show: !!showClear,
109
+ renderStatic
110
+ }),
111
+ trailingContent,
112
+ unit && /* @__PURE__ */ jsx("span", {
113
+ className: typographyCva({
114
+ size: "label-2",
115
+ sizeMobile: "label-2",
116
+ variant: "prominent-1",
117
+ className: "text-text-default-3"
118
+ }),
119
+ children: unit
120
+ }),
121
+ isLoading && /* @__PURE__ */ jsx("div", {
122
+ className: "inline-flex",
123
+ children: /* @__PURE__ */ jsx(Loader, {})
124
+ }),
125
+ !isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
126
+ color: "secondary",
127
+ icon: action.icon,
128
+ isDisabled,
129
+ onPress: action.onClick,
130
+ excludeFromTabOrder: true,
131
+ label: action.altText,
132
+ className: clsx("border-0!", action.className)
133
+ }),
134
+ !isLoading && !action && trailingIcon && renderIconVisual(trailingIcon),
135
+ trailingAction
136
+ ]
137
+ }) : null;
138
+ const inputFrameContent = wrapContentAndTrailing ? /* @__PURE__ */ jsxs("div", {
139
+ className: "flex w-full items-center gap-input-gap-input-text-to-elements",
140
+ children: [contentRow, trailingRow]
141
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [contentRow, trailingRow] });
73
142
  return /* @__PURE__ */ jsx(TooltipWrapper, {
74
143
  as,
75
144
  error,
@@ -89,7 +158,7 @@ var InputFrame = (props) => {
89
158
  onFocusCapture?.(event);
90
159
  if (renderStatic) onStaticInteract?.(true);
91
160
  },
92
- children: /* @__PURE__ */ jsxs("div", {
161
+ children: /* @__PURE__ */ jsx("div", {
93
162
  ref,
94
163
  ...dataAttributeProps,
95
164
  className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
@@ -107,70 +176,7 @@ var InputFrame = (props) => {
107
176
  if (renderStatic) onStaticInteract?.(true);
108
177
  },
109
178
  "data-rac": "",
110
- children: [/* @__PURE__ */ jsxs("div", {
111
- className: clsx("group/input-frame flex min-w-0 w-full items-center gap-input-gap-input-text-to-elements pr-0!", as === "inline" && "h-full", inputSizeCva({
112
- size,
113
- as
114
- }), typographySize && typographyCva({ size: typographySize }), contentClassName),
115
- children: [
116
- leadingContent,
117
- leadingIcon && /* @__PURE__ */ jsx("div", {
118
- className: clsx(!isLeadingIconElement && "pointer-events-none"),
119
- children: renderIconVisual(leadingIcon)
120
- }),
121
- labelPlacement === "content-row" && labelContent,
122
- actionContentPlacement === "content-row" && actionContent,
123
- /* @__PURE__ */ jsxs("div", {
124
- className: resolvedContentWrapperClassName,
125
- children: [
126
- labelPlacement === "content-wrapper" && labelContent,
127
- actionContentPlacement === "content-wrapper" && actionContent,
128
- typeof children === "function" ? children({
129
- ...dataAttributeProps,
130
- id: inputId
131
- }) : children
132
- ]
133
- })
134
- ]
135
- }), hasTrailingContent && /* @__PURE__ */ jsxs("div", {
136
- className: clsx("flex items-center gap-input-gap-trailing-elements py-0! pl-0!", inputSizeCva({
137
- size,
138
- as
139
- }), !isTrailingInteractive && "pointer-events-none", trailingClassName),
140
- children: [
141
- hasClear && /* @__PURE__ */ jsx(InputClear, {
142
- onClear: () => onClear?.(),
143
- className: clearClassName,
144
- show: !!showClear,
145
- renderStatic
146
- }),
147
- trailingContent,
148
- unit && /* @__PURE__ */ jsx("span", {
149
- className: typographyCva({
150
- size: "label-2",
151
- sizeMobile: "label-2",
152
- variant: "prominent-1",
153
- className: "text-text-default-3"
154
- }),
155
- children: unit
156
- }),
157
- isLoading && /* @__PURE__ */ jsx("div", {
158
- className: "inline-flex",
159
- children: /* @__PURE__ */ jsx(Loader, {})
160
- }),
161
- !isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
162
- color: "secondary",
163
- icon: action.icon,
164
- isDisabled,
165
- onPress: action.onClick,
166
- excludeFromTabOrder: true,
167
- label: action.altText,
168
- className: clsx("border-0!", action.className)
169
- }),
170
- !isLoading && !action && trailingIcon && renderIconVisual(trailingIcon),
171
- trailingAction
172
- ]
173
- })]
179
+ children: inputFrameContent
174
180
  })
175
181
  })
176
182
  });
@@ -8,7 +8,8 @@ import { DatePickerInputContentRowProps } from '../components/inputs/DateTime/sh
8
8
  import { FormFieldErrorVariantProps } from '../components/inputs/FormField/formFieldError.cva';
9
9
  import { FormFieldHeaderVariantProps } from '../components/inputs/FormField/formFieldHeader.cva';
10
10
  import { FormFieldHelperVariantProps } from '../components/inputs/FormField/formFieldHelper.cva';
11
- import { RadioVariantProps } from '../components/inputs/RadioGroup/radio.cva';
11
+ import { TextAreaWrapperVariantProps } from '../components/inputs/Input/TextArea/TextArea.cva';
12
+ import { RadioContentRowVariantProps, RadioContentWrapperVariantProps, RadioVariantProps } from '../components/inputs/RadioGroup/radio.cva';
12
13
  import { SelectPopoverCva } from '../components/inputs/Selection/shared/selectDesktop.cva';
13
14
  import { SelectListBoxItemCva } from '../components/inputs/Selection/shared/selectItem.cva';
14
15
  import { InputBaseProps, InputClearClassProps, InputContentWrapperProps, InputSideProps, InputSizeProps } from '../components/inputs/shared/input.cva';
@@ -54,6 +55,8 @@ export declare namespace UIStyle {
54
55
  };
55
56
  radio: {
56
57
  cva?: Cva<RadioVariantProps>;
58
+ contentWrapperCva?: Cva<RadioContentWrapperVariantProps>;
59
+ contentRowCva?: Cva<RadioContentRowVariantProps>;
57
60
  typography?: CompoundMapper<TypographyVariantProps, RadioVariantProps>;
58
61
  contentClassName?: CompoundMapper<string, RadioVariantProps>;
59
62
  };
@@ -75,6 +78,9 @@ export declare namespace UIStyle {
75
78
  sizeCva?: Cva<InputSizeProps>;
76
79
  sideCva?: Cva<InputSideProps>;
77
80
  };
81
+ textArea: {
82
+ wrapperCva?: Cva<TextAreaWrapperVariantProps>;
83
+ };
78
84
  tooltipWrapper: {
79
85
  triggerCva?: Cva<TooltipWrapperTriggerVariantProps>;
80
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.37",
3
+ "version": "2.2.9-rc.39",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",