@povio/ui 2.3.0 → 2.3.2

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.
Files changed (28) hide show
  1. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -0
  2. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +1 -1
  3. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +1 -1
  4. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +1 -1
  5. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +1 -1
  6. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +2 -1
  7. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +1 -1
  8. package/dist/components/inputs/File/InputUpload.js +1 -1
  9. package/dist/components/inputs/File/shared/InputUploadFilled.js +1 -1
  10. package/dist/components/inputs/Input/NumberInput/NumberInput.js +14 -9
  11. package/dist/components/inputs/Input/TextArea/TextArea.js +1 -1
  12. package/dist/components/inputs/Input/TextInput/TextInput.js +4 -3
  13. package/dist/components/inputs/RadioGroup/RadioGroup.js +1 -0
  14. package/dist/components/inputs/Selection/shared/SelectDesktop.js +2 -2
  15. package/dist/components/inputs/Selection/shared/SelectInput.js +4 -4
  16. package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -2
  17. package/dist/components/inputs/Slider/Slider.js +1 -0
  18. package/dist/components/inputs/TextEditor/TextEditor.js +1 -1
  19. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  20. package/dist/components/inputs/shared/InputClear.js +4 -1
  21. package/dist/components/inputs/shared/input.cva.js +22 -10
  22. package/dist/components/inputs/shared/label.cva.js +2 -2
  23. package/dist/components/overlays/BottomSheet/BottomSheet.js +26 -2
  24. package/dist/config/uiConfig.context.d.ts +3 -1
  25. package/dist/config/uiConfig.context.js +2 -1
  26. package/dist/tw-ui-plugin.js +6 -1
  27. package/dist/utils/dom.utils.js +1 -1
  28. package/package.json +1 -1
@@ -22,6 +22,8 @@ var checkbox = cva([
22
22
  "group-selected:group-hover:border-interactive-contained-primary-hover",
23
23
  "group-selected:group-pressed:bg-interactive-contained-primary-pressed",
24
24
  "group-selected:group-pressed:border-interactive-contained-primary-pressed",
25
+ "group-selected:group-disabled:bg-interactive-contained-primary-disabled",
26
+ "group-selected:group-disabled:border-interactive-contained-primary-disabled",
25
27
  "group-indeterminate:border-interactive-contained-primary-idle",
26
28
  "group-indeterminate:bg-interactive-contained-primary-idle",
27
29
  "group-indeterminate:group-hover:bg-interactive-contained-primary-hover",
@@ -152,7 +152,7 @@ var DatePickerBase = (props) => {
152
152
  ...formFieldProps,
153
153
  as,
154
154
  labelProps,
155
- className: clsx("relative inline-flex w-full flex-col text-left", className),
155
+ className: clsx("group relative inline-flex w-full flex-col text-left", className),
156
156
  tabIndex: as === "inline" ? -1 : void 0,
157
157
  children: [/* @__PURE__ */ jsx(DatePickerInput, {
158
158
  ref: mergeRefs(ref, datePickerInputRef),
@@ -458,7 +458,7 @@ var DateRangePickerBase = (props) => {
458
458
  ...formFieldProps,
459
459
  as,
460
460
  labelProps,
461
- className: clsx("relative inline-flex w-full flex-col text-left", className),
461
+ className: clsx("group relative inline-flex w-full flex-col text-left", className),
462
462
  tabIndex: as === "inline" ? -1 : void 0,
463
463
  children: [/* @__PURE__ */ jsx(DatePickerInput, {
464
464
  ref: mergeRefs(ref, datePickerInputRef),
@@ -142,7 +142,7 @@ var DateTimePickerBase = (props) => {
142
142
  ...formFieldProps,
143
143
  as,
144
144
  labelProps,
145
- className: "relative inline-flex w-full flex-col text-left",
145
+ className: "group relative inline-flex w-full flex-col text-left",
146
146
  tabIndex: as === "inline" ? -1 : void 0,
147
147
  children: [/* @__PURE__ */ jsx(DatePickerInput, {
148
148
  ref: mergeRefs(ref, datePickerInputRef),
@@ -91,7 +91,7 @@ var TimePickerBase = (props) => {
91
91
  ...formFieldProps,
92
92
  as,
93
93
  labelProps,
94
- className: clsx("relative inline-flex w-full flex-col text-left", className),
94
+ className: clsx("group relative inline-flex w-full flex-col text-left", className),
95
95
  tabIndex: as === "inline" ? -1 : void 0,
96
96
  children: [/* @__PURE__ */ jsx(TimePickerInput, {
97
97
  ref: mergeRefs(ref, timeFieldRef),
@@ -108,7 +108,8 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
108
108
  icon: TodayIcon,
109
109
  size: "none",
110
110
  onPress: onToday,
111
- className: "relative z-1"
111
+ className: "relative z-1",
112
+ isDisabled
112
113
  }),
113
114
  disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
114
115
  size: "label-1",
@@ -19,7 +19,7 @@ var DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceho
19
19
  return /* @__PURE__ */ jsx("div", {
20
20
  ...segmentProps,
21
21
  ref,
22
- className: clsx("box-content rounded-input-rounding-default", isDisabled && "text-interactive-text-secondary-disabled", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", ["hour", "dayPeriod"].includes(segment.type) && !timePickerOnly && "ml-1", hidePlaceholder && "opacity-0"),
22
+ className: clsx("box-content rounded-input-rounding-default", isDisabled && isInputEmpty && "text-interactive-text-secondary-disabled", isDisabled && !isInputEmpty && "text-text-default-3", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", ["hour", "dayPeriod"].includes(segment.type) && !timePickerOnly && "ml-1", hidePlaceholder && "opacity-0"),
23
23
  children: /* @__PURE__ */ jsxs(Fragment, { children: [segment.isPlaceholder && /* @__PURE__ */ jsx("span", {
24
24
  "aria-hidden": "true",
25
25
  className: "pointer-events-none",
@@ -73,7 +73,7 @@ var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isR
73
73
  return /* @__PURE__ */ jsx(FormField, {
74
74
  ...formFieldProps,
75
75
  labelProps,
76
- className: clsx("w-full", className),
76
+ className: clsx("group w-full", className),
77
77
  children: files.length > 0 ? /* @__PURE__ */ jsx(InputUploadFilled, {
78
78
  files,
79
79
  onRemove: handleRemove,
@@ -13,7 +13,7 @@ var InputUploadFilled = ({ files, onRemove, isDisabled, size }) => {
13
13
  variant: "default",
14
14
  size: "label-1",
15
15
  as: "span",
16
- className: "flex-fill select-none truncate text-ellipsis text-text-default-1",
16
+ className: "flex-fill select-none truncate text-ellipsis text-text-default-1 input-disabled:text-text-default-3",
17
17
  children: files.map((file) => file.name).join(", ")
18
18
  }), /* @__PURE__ */ jsx(InlineIconButton, {
19
19
  label: "Remove files",
@@ -33,7 +33,8 @@ var NumberInputBase = (props) => {
33
33
  locale,
34
34
  formatOptions
35
35
  };
36
- const { labelProps, inputProps } = useNumberField(numberProps, useNumberFieldState(numberProps), numberFieldRef);
36
+ const state = useNumberFieldState(numberProps);
37
+ const { labelProps, inputProps } = useNumberField(numberProps, state, numberFieldRef);
37
38
  const formFieldProps = {
38
39
  error,
39
40
  label,
@@ -47,6 +48,10 @@ var NumberInputBase = (props) => {
47
48
  headerClassName,
48
49
  errorClassName
49
50
  };
51
+ const handleInputBlur = useCallback((e) => {
52
+ const target = numberFieldRef.current ?? e?.target;
53
+ onBlur?.({ target });
54
+ }, [onBlur]);
50
55
  const inputContentProps = {
51
56
  unit,
52
57
  isLoading,
@@ -55,12 +60,12 @@ var NumberInputBase = (props) => {
55
60
  leadingIcon,
56
61
  trailingIcon,
57
62
  isClearable,
58
- value,
59
- onChange: (val) => onChange?.(val === "" ? null : Number(val)),
60
- onBlur: useCallback((e) => {
61
- const target = numberFieldRef.current ?? e?.target;
62
- onBlur?.({ target });
63
- }, [onBlur])
63
+ onChange: (val) => {
64
+ if (val === "") state.setInputValue("");
65
+ onChange?.(val === "" ? null : Number(val));
66
+ },
67
+ value: state.inputValue,
68
+ onBlur: handleInputBlur
64
69
  };
65
70
  const headerProps = {
66
71
  label,
@@ -97,10 +102,10 @@ var NumberInputBase = (props) => {
97
102
  size,
98
103
  children: /* @__PURE__ */ jsx(Input, {
99
104
  ...inputProps,
100
- ref: mergeRefs(ref, inputRef),
105
+ ref: mergeRefs(ref, inputRef, numberFieldRef),
101
106
  "data-is-dirty": isDirty || void 0,
102
107
  "data-is-required": isRequired || void 0,
103
- "data-is-empty": value === null || value === void 0 || void 0,
108
+ "data-is-empty": state.inputValue === "" || state.inputValue === void 0 || state.inputValue === null || void 0,
104
109
  placeholder: as === "floating" ? "\xA0" : inputProps.placeholder,
105
110
  className: "w-full outline-none",
106
111
  onFocus: (e) => {
@@ -63,7 +63,7 @@ var TextAreaBase = (props) => {
63
63
  ...formFieldProps,
64
64
  as,
65
65
  labelProps,
66
- className: clsx("w-full", className),
66
+ className: clsx("group w-full", className),
67
67
  tabIndex: as === "inline" ? -1 : void 0,
68
68
  children: /* @__PURE__ */ jsxs("div", {
69
69
  className: "group/text-area relative h-full",
@@ -19,13 +19,14 @@ var TextInputBase = (props) => {
19
19
  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;
20
20
  const textFieldRef = useRef(null);
21
21
  const { isFocusVisible } = useFocusVisible();
22
+ const inputValue = value ?? "";
22
23
  const { labelProps, inputProps } = useTextField({
23
24
  ...rest,
24
25
  label,
25
26
  isDisabled,
26
27
  isInvalid: !!error,
27
28
  isRequired,
28
- value,
29
+ value: inputValue,
29
30
  onChange,
30
31
  onBlur
31
32
  }, textFieldRef);
@@ -50,7 +51,7 @@ var TextInputBase = (props) => {
50
51
  leadingIcon,
51
52
  trailingIcon,
52
53
  isClearable,
53
- value,
54
+ value: inputValue,
54
55
  onChange,
55
56
  onBlur
56
57
  };
@@ -90,7 +91,7 @@ var TextInputBase = (props) => {
90
91
  children: /* @__PURE__ */ jsx(Input, {
91
92
  ...inputProps,
92
93
  ref: mergeRefs(ref, inputRef),
93
- "data-is-empty": value === "" || value === null || value === void 0 || void 0,
94
+ "data-is-empty": inputValue === "" || void 0,
94
95
  "data-is-dirty": isDirty || void 0,
95
96
  "data-is-required": isRequired || void 0,
96
97
  "data-is-disabled": isDisabled || void 0,
@@ -34,6 +34,7 @@ var RadioGroupBase = (props) => {
34
34
  isInvalid: !!error,
35
35
  "data-is-dirty": isDirty || void 0,
36
36
  "data-is-required": isRequired || void 0,
37
+ className: "group",
37
38
  children: /* @__PURE__ */ jsx(FormField, {
38
39
  ...formFieldProps,
39
40
  children: /* @__PURE__ */ jsx("div", {
@@ -83,7 +83,7 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
83
83
  isDisabled,
84
84
  isInvalid: !!error,
85
85
  menuTrigger: "focus",
86
- className: clsx("w-full", containerClassName)
86
+ className: clsx("group w-full", containerClassName)
87
87
  };
88
88
  const headerProps = {
89
89
  label,
@@ -110,7 +110,7 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
110
110
  ...formFieldProps,
111
111
  ...!isSearchable && {
112
112
  labelProps,
113
- className: clsx("w-full", containerClassName)
113
+ className: clsx("group w-full", containerClassName)
114
114
  },
115
115
  as,
116
116
  ref: wrapperRef,
@@ -27,7 +27,7 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
27
27
  const { fieldState, isOpen, setIsOpen, listItems, selectedItems, onChange, onClear, onRemove, isMultiple, isLoading } = SelectContext.useSelect();
28
28
  const isEmpty = selectedItems.length === 0;
29
29
  const showTags = isMultiple && !isEmpty;
30
- const showClearButton = isClearable && isHovered && (selectedItems.length > 0 || isSearchable && fieldState.inputValue !== "");
30
+ const showClearButton = isClearable && (selectedItems.length > 0 || isSearchable && fieldState.inputValue !== "");
31
31
  const labelProps = useMemo(() => {
32
32
  const { labelProps: headerLabelProps } = headerProps ?? {};
33
33
  if (!(as && ["filter", "floating"].includes(as)) || isSearchable) return headerLabelProps;
@@ -104,7 +104,7 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
104
104
  ref: inputRef,
105
105
  placeholder: as === "floating" ? void 0 : placeholder,
106
106
  onBlur,
107
- className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", inputClassName),
107
+ className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3", "disabled:text-text-default-3 disabled:placeholder:text-interactive-text-secondary-disabled", inputClassName),
108
108
  onKeyDown,
109
109
  ...fieldProps
110
110
  })]
@@ -114,11 +114,11 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
114
114
  onPress: () => setIsOpen(!isOpen),
115
115
  onBlur,
116
116
  "data-type": "select-trigger",
117
- className: clsx("w-full truncate text-start outline-none disabled:text-interactive-text-secondary-disabled", showTags && "absolute inset-0 z-0"),
117
+ className: clsx("group/select-trigger w-full truncate text-start outline-none disabled:text-text-default-3", showTags && "absolute inset-0 z-0"),
118
118
  ...fieldProps,
119
119
  children: [(as === "floating" && isEmpty || isMultiple && !isEmpty) && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }), (isEmpty || !isMultiple) && (as !== "floating" || !isEmpty) && /* @__PURE__ */ jsxs(Typography, {
120
120
  size: "label-1",
121
- className: clsx("truncate empty:before:inline-block empty:before:content-['']", isEmpty && "text-text-default-3"),
121
+ className: clsx("truncate empty:before:inline-block empty:before:content-['']", isEmpty && "text-text-default-3 group-disabled/select-trigger:text-interactive-text-secondary-disabled"),
122
122
  children: [isEmpty && placeholder, !isEmpty && (showSelectionContent ? selectedItems[0].content : selectedItems[0].label)]
123
123
  })]
124
124
  })
@@ -56,7 +56,7 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
56
56
  ...formFieldProps,
57
57
  as,
58
58
  labelProps,
59
- className: clsx("w-full", containerClassName),
59
+ className: clsx("group w-full", containerClassName),
60
60
  children: /* @__PURE__ */ jsxs(DialogTrigger, {
61
61
  ...dialogTriggerProps,
62
62
  children: [customTrigger ? /* @__PURE__ */ jsx("div", {
@@ -103,7 +103,8 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
103
103
  inputClassName,
104
104
  className: "mb-list-height-title-bottom px-list-side-title",
105
105
  leadingIcon: !hideSearchIcon ? /* @__PURE__ */ jsx(SearchIcon, { className: "size-6" }) : void 0,
106
- size: "default"
106
+ size: "default",
107
+ isClearable
107
108
  }), /* @__PURE__ */ jsx(SelectListBox, {
108
109
  ...props,
109
110
  autoFocus: !isSearchable,
@@ -39,6 +39,7 @@ var SliderBase = (props) => {
39
39
  minValue,
40
40
  maxValue,
41
41
  isDisabled,
42
+ className: clsx("group", rest.className),
42
43
  children: /* @__PURE__ */ jsx(FormField, {
43
44
  ...formFieldProps,
44
45
  children: /* @__PURE__ */ jsxs("div", {
@@ -99,7 +99,7 @@ var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tool
99
99
  ref,
100
100
  as,
101
101
  labelProps,
102
- className: clsx("w-full", className),
102
+ className: clsx("group w-full", className),
103
103
  children: /* @__PURE__ */ jsxs("div", {
104
104
  className: clsx("group/text-editor relative", "h-full w-full rounded-sm border border-elevation-outline-default-2 border-solid bg-elevation-fill-default-1", uiOutlineClass, "focus-within:border focus-within:border-input-outlined-outline-active", "focus-visible:outline-interactive-contained-primary-focus", "hover:border hover:border-input-outlined-outline-hover"),
105
105
  "data-text-editor": true,
@@ -17,7 +17,8 @@ var toggle = cva(["h-6 w-10 rounded-full before:m-0-5 before:block before:aspect
17
17
  "group-disabled:before:bg-interactive-contained-secondary-on-disabled",
18
18
  "group-selected:before:bg-interactive-contained-primary-on-idle",
19
19
  "group-selected:group-hover:before:bg-interactive-contained-primary-on-hover",
20
- "group-selected:group-pressed:before:bg-interactive-contained-primary-on-pressed"
20
+ "group-selected:group-pressed:before:bg-interactive-contained-primary-on-pressed",
21
+ "group-selected:group-disabled:bg-interactive-contained-primary-disabled"
21
22
  ] } },
22
23
  defaultVariants: { variant: "default" }
23
24
  });
@@ -1,4 +1,5 @@
1
1
  import { CloseIcon } from "../../../assets/icons/Close.js";
2
+ import { UIConfig } from "../../../config/uiConfig.context.js";
2
3
  import { InlineIconButton } from "../../buttons/InlineIconButton/InlineIconButton.js";
3
4
  import "../../../config/i18n.js";
4
5
  import { jsx } from "react/jsx-runtime";
@@ -7,12 +8,14 @@ import { useTranslation } from "react-i18next";
7
8
  //#region src/components/inputs/shared/InputClear.tsx
8
9
  var InputClear = ({ onClear, className, style, show }) => {
9
10
  const { t } = useTranslation("ui");
11
+ const alwaysShowClear = UIConfig.useConfig().input.alwaysShowClear;
10
12
  return /* @__PURE__ */ jsx(InlineIconButton, {
11
13
  color: "secondary",
12
- className: clsx("invisible relative z-1 flex items-center", "group-focus-within:visible group-hover/date-picker-content:visible group-hover/select-content:visible group-hover/text-area:visible group-hover:visible", "border-0!", !show && "invisible!", className),
14
+ className: clsx("relative z-1 flex items-center", !alwaysShowClear && "md:invisible group-focus-within:visible group-hover/date-picker-content:visible group-hover/select-content:visible group-hover/text-area:visible group-hover:visible", "border-0!", !show && "invisible!", className),
13
15
  label: t(($) => $.ui.clearAlt),
14
16
  icon: CloseIcon,
15
17
  onPress: onClear,
18
+ onMouseDown: (e) => e.preventDefault(),
16
19
  excludeFromTabOrder: true,
17
20
  style
18
21
  });
@@ -35,9 +35,11 @@ var inputBase = cva([uiOutlineClass, "flex w-full not-[textarea]:truncate"], {
35
35
  "focus-within:border-input-outlined-outline-active focus-within:border-solid focus-within:bg-input-outlined-active focus-within:text-text-default-1",
36
36
  "invalid:border-input-outlined-outline-error invalid:border-solid invalid:bg-input-outlined-error invalid:text-text-default-1",
37
37
  "has-invalid:border-input-outlined-outline-error has-invalid:border-solid has-invalid:bg-input-outlined-error has-invalid:text-text-default-1",
38
- "disabled:border-input-outlined-outline-disabled disabled:border-solid disabled:bg-input-outlined-disabled disabled:text-text-default-1",
39
- "has-disabled:border-input-outlined-outline-disabled has-disabled:border-solid has-disabled:bg-input-outlined-disabled has-disabled:text-text-default-1",
38
+ "disabled:border-input-outlined-outline-disabled disabled:border-solid disabled:bg-input-outlined-disabled disabled:text-text-default-3",
39
+ "has-disabled:border-input-outlined-outline-disabled has-disabled:border-solid has-disabled:bg-input-outlined-disabled has-disabled:text-text-default-3",
40
40
  "placeholder:text-text-default-3",
41
+ "disabled:placeholder:text-interactive-text-secondary-disabled",
42
+ "has-disabled:placeholder:text-interactive-text-secondary-disabled",
41
43
  "focus-visible:outline-interactive-contained-primary-focus",
42
44
  "has-focus-visible:outline-interactive-contained-primary-focus"
43
45
  ]
@@ -51,9 +53,11 @@ var inputBase = cva([uiOutlineClass, "flex w-full not-[textarea]:truncate"], {
51
53
  "focus-within:border-input-filled-outline-active focus-within:border-solid focus-within:bg-input-filled-active focus-within:text-text-default-1",
52
54
  "invalid:border-input-filled-outline-error invalid:border-solid invalid:bg-input-filled-error invalid:text-text-default-1",
53
55
  "has-invalid:border-input-filled-outline-error has-invalid:border-solid has-invalid:bg-input-filled-error has-invalid:text-text-default-1",
54
- "disabled:bg-input-filled-disabled disabled:text-text-default-1",
55
- "has-disabled:bg-input-filled-disabled has-disabled:text-text-default-1",
56
+ "disabled:bg-input-filled-disabled disabled:text-text-default-3",
57
+ "has-disabled:bg-input-filled-disabled has-disabled:text-text-default-3",
56
58
  "placeholder:text-text-default-3",
59
+ "disabled:placeholder:text-interactive-text-secondary-disabled",
60
+ "has-disabled:placeholder:text-interactive-text-secondary-disabled",
57
61
  "focus-visible:outline-interactive-contained-primary-focus",
58
62
  "has-focus-visible:outline-interactive-contained-primary-focus"
59
63
  ]
@@ -67,9 +71,11 @@ var inputBase = cva([uiOutlineClass, "flex w-full not-[textarea]:truncate"], {
67
71
  "focus-within:border-input-outlined-outline-active focus-within:border-solid focus-within:bg-input-outlined-active focus-within:text-text-default-1",
68
72
  "invalid:border-input-outlined-outline-error invalid:border-solid invalid:bg-input-outlined-error invalid:text-text-default-1",
69
73
  "has-invalid:border-input-outlined-outline-error has-invalid:border-solid has-invalid:bg-input-outlined-error has-invalid:text-text-default-1",
70
- "disabled:border-input-outlined-outline-disabled disabled:border-solid disabled:bg-input-outlined-disabled disabled:text-text-default-1",
71
- "has-disabled:border-input-outlined-outline-disabled has-disabled:border-solid has-disabled:bg-input-outlined-disabled has-disabled:text-text-default-1",
74
+ "disabled:border-input-outlined-outline-disabled disabled:border-solid disabled:bg-input-outlined-disabled disabled:text-text-default-3",
75
+ "has-disabled:border-input-outlined-outline-disabled has-disabled:border-solid has-disabled:bg-input-outlined-disabled has-disabled:text-text-default-3",
72
76
  "placeholder:text-text-default-3",
77
+ "disabled:placeholder:text-interactive-text-secondary-disabled",
78
+ "has-disabled:placeholder:text-interactive-text-secondary-disabled",
73
79
  "focus-visible:outline-interactive-contained-primary-focus",
74
80
  "has-focus-visible:outline-interactive-contained-primary-focus"
75
81
  ]
@@ -83,9 +89,11 @@ var inputBase = cva([uiOutlineClass, "flex w-full not-[textarea]:truncate"], {
83
89
  "focus-within:border-input-outlined-outline-active focus-within:border-solid focus-within:bg-input-outlined-idle focus-within:text-text-default-1",
84
90
  "invalid:border-input-filled-outline-error invalid:border-solid invalid:bg-input-filled-error invalid:text-text-default-1",
85
91
  "has-invalid:border-input-filled-outline-error has-invalid:border-solid has-invalid:bg-input-filled-error has-invalid:text-text-default-1",
86
- "disabled:bg-input-filled-disabled disabled:text-text-default-1",
87
- "has-disabled:bg-input-filled-disabled has-disabled:text-text-default-1",
92
+ "disabled:bg-input-filled-disabled disabled:text-text-default-3",
93
+ "has-disabled:bg-input-filled-disabled has-disabled:text-text-default-3",
88
94
  "placeholder:text-text-default-3",
95
+ "disabled:placeholder:text-interactive-text-secondary-disabled",
96
+ "has-disabled:placeholder:text-interactive-text-secondary-disabled",
89
97
  "focus-visible:outline-interactive-contained-primary-focus",
90
98
  "has-focus-visible:outline-interactive-contained-primary-focus"
91
99
  ]
@@ -99,9 +107,11 @@ var inputBase = cva([uiOutlineClass, "flex w-full not-[textarea]:truncate"], {
99
107
  "focus-within:border-input-outlined-outline-active focus-within:border-solid focus-within:bg-input-outlined-active focus-within:text-text-default-1",
100
108
  "invalid:border-input-outlined-outline-error invalid:border-solid invalid:bg-input-outlined-error invalid:text-text-default-1",
101
109
  "has-invalid:border-input-outlined-outline-error has-invalid:border-solid has-invalid:bg-input-outlined-error has-invalid:text-text-default-1",
102
- "disabled:border-input-outlined-outline-disabled disabled:border-solid disabled:bg-input-outlined-disabled disabled:text-text-default-1",
103
- "has-disabled:border-input-outlined-outline-disabled has-disabled:border-solid has-disabled:bg-input-outlined-disabled has-disabled:text-text-default-1",
110
+ "disabled:border-input-outlined-outline-disabled disabled:border-solid disabled:bg-input-outlined-disabled disabled:text-text-default-3",
111
+ "has-disabled:border-input-outlined-outline-disabled has-disabled:border-solid has-disabled:bg-input-outlined-disabled has-disabled:text-text-default-3",
104
112
  "placeholder:text-text-default-3",
113
+ "disabled:placeholder:text-interactive-text-secondary-disabled",
114
+ "has-disabled:placeholder:text-interactive-text-secondary-disabled",
105
115
  "focus-visible:outline-interactive-contained-primary-focus",
106
116
  "has-focus-visible:outline-interactive-contained-primary-focus"
107
117
  ]
@@ -118,6 +128,8 @@ var inputBase = cva([uiOutlineClass, "flex w-full not-[textarea]:truncate"], {
118
128
  "disabled:bg-input-filled-disabled disabled:text-text-default-1",
119
129
  "has-disabled:bg-input-filled-disabled has-disabled:text-text-default-1",
120
130
  "placeholder:text-text-default-3",
131
+ "disabled:placeholder:text-interactive-text-secondary-disabled",
132
+ "has-disabled:placeholder:text-interactive-text-secondary-disabled",
121
133
  "focus-visible:outline-interactive-contained-primary-focus",
122
134
  "has-focus-visible:outline-interactive-contained-primary-focus"
123
135
  ]
@@ -3,8 +3,8 @@ import { cva } from "class-variance-authority";
3
3
  //#region src/components/inputs/shared/label.cva.ts
4
4
  var labelBase = cva("", {
5
5
  variants: { as: {
6
- default: ["flex items-start gap-1 text-text-default-1"],
7
- filter: ["text-text-default-1"],
6
+ default: ["flex items-start gap-1 text-text-default-1 input-disabled:text-text-default-3"],
7
+ filter: ["text-text-default-1 input-disabled:text-text-default-3"],
8
8
  inline: ["flex items-start gap-1 text-text-default-1"],
9
9
  floating: [
10
10
  "pointer-events-none",
@@ -26,6 +26,7 @@ var staticTransition = {
26
26
  1
27
27
  ]
28
28
  };
29
+ var KEYBOARD_INSET_THRESHOLD = 48;
29
30
  var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = true, isScrollable = true, height = "full", label, portalContainerRef, children, footer, hideHeader, hideThumb: hideThumbProp, sheetMarginTop = 96, sheetMarginBottom = 128, closeDragThreshold: closeDragThresholdProp, closeVelocityThreshold: closeVelocityThresholdProp, shouldCloseOnInteractOutside, containerClassName, overlayClassName, headerTypography: headerTypographyProp }) => {
30
31
  const uiConfig = UIConfig.useConfig();
31
32
  const closeDragThreshold = closeDragThresholdProp ?? uiConfig.bottomSheet.closeDragThreshold;
@@ -48,6 +49,27 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = tr
48
49
  const focusTrapRef = useRef(null);
49
50
  const [footerElement, footerRef, setFooterElement] = useStateAndRef(null);
50
51
  const [footerHeight, setFooterHeight] = useState(0);
52
+ const [keyboardInset, setKeyboardInset] = useState(0);
53
+ useEffect(() => {
54
+ if (!isOpen) {
55
+ setKeyboardInset(0);
56
+ return;
57
+ }
58
+ const vv = window.visualViewport;
59
+ if (!vv) return;
60
+ const update = () => {
61
+ const naturalHeight = vv.height * Math.max(vv.scale, 1);
62
+ const next = Math.max(0, window.innerHeight - naturalHeight);
63
+ setKeyboardInset(next > KEYBOARD_INSET_THRESHOLD ? Math.round(next) : 0);
64
+ };
65
+ update();
66
+ vv.addEventListener("resize", update);
67
+ vv.addEventListener("scroll", update);
68
+ return () => {
69
+ vv.removeEventListener("resize", update);
70
+ vv.removeEventListener("scroll", update);
71
+ };
72
+ }, [isOpen]);
51
73
  useEffect(() => {
52
74
  if (!footerElement) return;
53
75
  const onResize = () => {
@@ -77,6 +99,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = tr
77
99
  isOpen: true,
78
100
  UNSTABLE_portalContainer: portalContainerRef?.current,
79
101
  className: clsx("fixed top-0 left-0 z-10 w-screen h-dvh", containerClassName),
102
+ style: { "--bottom-sheet-keyboard-inset": `${keyboardInset}px` },
80
103
  onOpenChange,
81
104
  isDismissable,
82
105
  ref: overlayRef,
@@ -110,7 +133,8 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = tr
110
133
  transition: staticTransition,
111
134
  style: {
112
135
  y,
113
- minHeight: "100%"
136
+ height: "calc(100dvh - var(--bottom-sheet-keyboard-inset, 0px))",
137
+ minHeight: "calc(100dvh - var(--bottom-sheet-keyboard-inset, 0px))"
114
138
  },
115
139
  drag: "y",
116
140
  dragListener: false,
@@ -188,7 +212,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = tr
188
212
  initial: { opacity: 0 },
189
213
  exit: { opacity: 0 },
190
214
  ref: setFooterElement,
191
- className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-[100dvh] left-0 translate-y-[calc(-100%-var(--scroll-position,0px))]"),
215
+ className: clsx("pointer-events-auto absolute z-50 w-full bg-elevation-fill-default-2", "top-[calc(100dvh-var(--bottom-sheet-keyboard-inset,0))] left-0 translate-y-[calc(-100%-var(--scroll-position,0))]"),
192
216
  children: footer
193
217
  })
194
218
  ] })
@@ -19,7 +19,9 @@ export declare namespace UIConfig {
19
19
  [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
20
20
  };
21
21
  export interface Options {
22
- input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size">;
22
+ input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size"> & {
23
+ alwaysShowClear?: boolean;
24
+ };
23
25
  button: Pick<ButtonProps, "variant" | "size">;
24
26
  numberInput: Pick<NumberInputProps, "formatOptions">;
25
27
  radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel">;
@@ -11,7 +11,8 @@ var UIConfig;
11
11
  as: "default",
12
12
  size: "default",
13
13
  isClearable: false,
14
- hideLabel: false
14
+ hideLabel: false,
15
+ alwaysShowClear: false
15
16
  },
16
17
  button: {
17
18
  variant: "contained",
@@ -12,11 +12,16 @@ var uiPlugin = plugin(({ addVariant }) => {
12
12
  ].join(", "));
13
13
  addVariant("input-disabled", [
14
14
  "&:is(:where(.group\\/input-content):has(*:is(input:disabled)) *)",
15
+ "&:is(:where(.group):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):has([data-disabled]) *)",
17
19
  "&:is(:where(.group\\/text-area):has(*:is(textarea:disabled)) *)",
20
+ "&:is(:where(.group):has(*:is(textarea:disabled)) *)",
18
21
  "&:is(:where(.group\\/text-editor):where([data-rac])[data-disabled] *)",
19
- "&:is(:where(.group\\/date-picker-content):where([data-rac])[data-disabled] *)"
22
+ "&:is(:where(.group):where([data-rac])[data-disabled] *)",
23
+ "&:is(:where(.group\\/date-picker-content):where([data-rac])[data-disabled] *)",
24
+ "&:is(:where(.group):where([data-rac])[data-disabled] *)"
20
25
  ].join(", "));
21
26
  });
22
27
  //#endregion
@@ -9,7 +9,7 @@ var DomUtils;
9
9
  "image"
10
10
  ]);
11
11
  _DomUtils.isKeyboardInput = (elem) => {
12
- return elem.tagName === "INPUT" && !KEYBOARD_INPUTS.has(elem.type) || elem.hasAttribute("contenteditable");
12
+ return elem.tagName === "INPUT" && !KEYBOARD_INPUTS.has(elem.type) || elem.tagName === "TEXTAREA" || elem.hasAttribute("contenteditable");
13
13
  };
14
14
  _DomUtils.isKeyboardEvent = (event) => {
15
15
  return event.nativeEvent instanceof KeyboardEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",