@povio/ui 2.2.9-rc.26 → 2.2.9-rc.28

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 (25) hide show
  1. package/dist/components/buttons/Button/Button.d.ts +2 -1
  2. package/dist/components/buttons/Button/Button.js +41 -32
  3. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -0
  4. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +33 -28
  5. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +32 -46
  6. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +34 -28
  7. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +30 -25
  8. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
  9. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
  10. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +8 -7
  11. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
  12. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
  13. package/dist/components/inputs/Input/NumberInput/NumberInput.js +39 -40
  14. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +1 -1
  15. package/dist/components/inputs/Input/TextInput/TextInput.js +40 -40
  16. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +25 -15
  17. package/dist/components/inputs/Selection/Select/Select.js +28 -17
  18. package/dist/components/inputs/Skeleton/InputFrame.d.ts +56 -0
  19. package/dist/components/inputs/Skeleton/InputFrame.js +170 -0
  20. package/dist/components/inputs/shared/InputClear.d.ts +2 -1
  21. package/dist/components/inputs/shared/InputClear.js +13 -1
  22. package/dist/index.js +1 -1
  23. package/dist/utils/date-time.utils.d.ts +7 -0
  24. package/dist/utils/date-time.utils.js +16 -0
  25. package/package.json +1 -1
@@ -0,0 +1,80 @@
1
+ import { DateSegmentItemView } from "./DateSegmentItem.js";
2
+ import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/inputs/DateTime/shared/staticDateTimeSegments.tsx
5
+ var getStaticCalendarDateSegments = ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
6
+ const hasValue = !!value;
7
+ return renderStaticSegments(value ? DateTimeUtils.formatCalendarDateLocalized(value, locale, { shouldForceLeadingZeros }) : placeholder ?? DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros }), {
8
+ isPlaceholder: !hasValue,
9
+ isInputEmpty: !hasValue,
10
+ isDisabled,
11
+ hidePlaceholder
12
+ });
13
+ };
14
+ var getStaticCalendarDateTimeSegments = ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
15
+ const hasValue = !!(value && "hour" in value);
16
+ return renderStaticSegments(hasValue ? DateTimeUtils.formatCalendarDateTimeLocalized(value, locale, { shouldForceLeadingZeros }) : placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale, { shouldForceLeadingZeros }), {
17
+ isPlaceholder: !hasValue,
18
+ isInputEmpty: !hasValue,
19
+ isDisabled,
20
+ hidePlaceholder
21
+ });
22
+ };
23
+ var getStaticDateRangeSegments = ({ start, end, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
24
+ const defaultPlaceholder = placeholder ?? DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros });
25
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
26
+ renderStaticSegments(start ? DateTimeUtils.formatCalendarDateLocalized(start, locale, { shouldForceLeadingZeros }) : defaultPlaceholder, {
27
+ isPlaceholder: !start,
28
+ isInputEmpty: !start,
29
+ isDisabled,
30
+ hidePlaceholder: hidePlaceholder && !start
31
+ }),
32
+ /* @__PURE__ */ jsx("span", {
33
+ className: isDisabled ? "pointer-events-none select-none text-interactive-text-secondary-disabled" : "pointer-events-none select-none",
34
+ children: "–"
35
+ }),
36
+ renderStaticSegments(end ? DateTimeUtils.formatCalendarDateLocalized(end, locale, { shouldForceLeadingZeros }) : defaultPlaceholder, {
37
+ isPlaceholder: !end,
38
+ isInputEmpty: !end,
39
+ isDisabled,
40
+ hidePlaceholder: hidePlaceholder && !end
41
+ })
42
+ ] });
43
+ };
44
+ var getStaticTimeSegments = ({ value, locale, placeholder, isDisabled, hidePlaceholder }) => {
45
+ const hasValue = !!value;
46
+ return renderStaticSegments(value ? DateTimeUtils.formatTimeLocalized(value, locale) : placeholder ?? DateTimeUtils.getTimePlaceholder(locale), {
47
+ isPlaceholder: !hasValue,
48
+ isInputEmpty: !hasValue,
49
+ isDisabled,
50
+ hidePlaceholder,
51
+ timePickerOnly: true
52
+ });
53
+ };
54
+ var renderStaticSegments = (value, options) => {
55
+ return /* @__PURE__ */ jsx("div", {
56
+ className: "flex",
57
+ children: tokenizeStaticSegmentText(value).map((token, index) => /* @__PURE__ */ jsx(DateSegmentItemView, {
58
+ type: token.type,
59
+ text: getStaticSegmentText(token),
60
+ placeholder: getStaticSegmentText(token),
61
+ isPlaceholder: options.isPlaceholder && token.type !== "literal",
62
+ isInputEmpty: options.isInputEmpty,
63
+ isDisabled: options.isDisabled,
64
+ timePickerOnly: options.timePickerOnly,
65
+ hidePlaceholder: options.hidePlaceholder
66
+ }, index))
67
+ });
68
+ };
69
+ var tokenizeStaticSegmentText = (value) => {
70
+ return (value.match(/(\p{Letter}+|\p{Number}+|[^\p{Letter}\p{Number}]+)/gu) ?? [value]).map((text) => ({
71
+ text,
72
+ type: /^[^\p{Letter}\p{Number}]+$/u.test(text) ? "literal" : "day"
73
+ }));
74
+ };
75
+ var getStaticSegmentText = (token) => {
76
+ if (token.type !== "literal") return token.text;
77
+ return token.text.replaceAll(" ", "\xA0");
78
+ };
79
+ //#endregion
80
+ export { getStaticCalendarDateSegments, getStaticCalendarDateTimeSegments, getStaticDateRangeSegments, getStaticTimeSegments };
@@ -1,15 +1,14 @@
1
1
  import { UIStyle } from "../../../../config/uiStyle.context.js";
2
- import { Loader } from "../../../status/Loader/Loader.js";
3
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
4
3
  import { inputBase } from "../../shared/input.cva.js";
5
4
  import { FormField } from "../../FormField/FormField.js";
6
- import { StaticInput } from "../../shared/StaticInput.js";
7
5
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
6
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
8
7
  import { InputContent } from "../shared/InputContent.js";
9
8
  import { getStaticNumberDisplayValue } from "../shared/numberStatic.utils.js";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { jsx } from "react/jsx-runtime";
11
10
  import { clsx } from "clsx";
12
- import { isValidElement, useCallback, useEffect, useRef, useState } from "react";
11
+ import { useCallback, useEffect, useRef, useState } from "react";
13
12
  import { Input, useLocale } from "react-aria-components";
14
13
  import { useFocusVisible, useNumberField } from "react-aria";
15
14
  import { mergeRefs } from "@react-aria/utils";
@@ -121,11 +120,6 @@ var NumberInputBase = (props) => {
121
120
  })
122
121
  });
123
122
  };
124
- var renderIconVisual = (icon) => {
125
- if (!icon) return null;
126
- if (isValidElement(icon)) return icon;
127
- return /* @__PURE__ */ jsx(icon, { className: "size-6 text-interactive-text-secondary-idle" });
128
- };
129
123
  var NumberInput = ({ renderStaticInput, ...props }) => {
130
124
  const ui = UIConfig.useConfig();
131
125
  const { locale } = useLocale();
@@ -155,44 +149,49 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
155
149
  const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
156
150
  let isDisabled = !!props.isDisabled;
157
151
  if (isFormControlDisabled) isDisabled = true;
158
- const trailingContent = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
159
- props.unit && /* @__PURE__ */ jsx("span", {
160
- className: "text-label-2 text-text-default-3",
161
- children: props.unit
162
- }),
163
- props.isLoading && /* @__PURE__ */ jsx(Loader, {}),
164
- !props.isLoading && props.action && renderIconVisual(props.action.icon),
165
- !props.isLoading && !props.action && props.trailingIcon && renderIconVisual(props.trailingIcon)
166
- ] }) : void 0;
167
- return /* @__PURE__ */ jsx(StaticInput, {
152
+ const dataAttributes = {
153
+ dataIsEmpty: !hasValue,
154
+ dataIsFilled: hasValue,
155
+ dataIsDirty: props.isDirty,
156
+ dataIsRequired: props.isRequired,
157
+ dataIsDisabled: isDisabled,
158
+ dataDisabled: isDisabled,
159
+ dataInvalid: !!props.error,
160
+ dataHasSelection: hasValue
161
+ };
162
+ return /* @__PURE__ */ jsx(InputFrame, {
168
163
  ...props,
169
- onInteract: (focus) => {
164
+ isHeaderHidden,
165
+ hideLabel,
166
+ isDisabled,
167
+ className: clsx("group w-full", as === "inline" && "h-full", props.className),
168
+ dataAttributes,
169
+ renderStatic: true,
170
+ onStaticInteract: (focus) => {
170
171
  setShouldFocus(focus);
171
172
  setRenderInput(true);
172
173
  },
174
+ inputClassName: props.inputClassName,
173
175
  as,
174
176
  size,
175
177
  variant,
176
- hideLabel,
177
- isHeaderHidden,
178
- isDisabled,
179
- className: clsx("group w-full", as === "inline" && "h-full", props.className),
180
- inputClassName: props.inputClassName,
181
- placeholder: props.placeholder,
182
- displayValue,
183
- isEmpty: !hasValue,
184
- dataAttributes: {
185
- dataIsEmpty: !hasValue,
186
- dataIsFilled: hasValue,
187
- dataIsDirty: props.isDirty,
188
- dataIsRequired: props.isRequired,
189
- dataIsDisabled: props.isDisabled,
190
- dataDisabled: props.isDisabled,
191
- dataInvalid: !!props.error,
192
- dataHasSelection: hasValue
193
- },
194
- leadingVisual: renderIconVisual(props.leadingIcon),
195
- trailingContent
178
+ children: /* @__PURE__ */ jsx("input", {
179
+ ref: inputRef,
180
+ readOnly: true,
181
+ disabled: isDisabled,
182
+ tabIndex: -1,
183
+ value: displayValue,
184
+ placeholder: as === "floating" ? "" : props.placeholder,
185
+ className: "w-full bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled",
186
+ "data-is-empty": dataAttributes.dataIsEmpty || void 0,
187
+ "data-is-filled": dataAttributes.dataIsFilled || void 0,
188
+ "data-is-dirty": dataAttributes.dataIsDirty || void 0,
189
+ "data-is-required": dataAttributes.dataIsRequired || void 0,
190
+ "data-is-disabled": dataAttributes.dataIsDisabled || void 0,
191
+ "data-disabled": dataAttributes.dataDisabled || void 0,
192
+ "data-invalid": dataAttributes.dataInvalid || void 0,
193
+ "data-has-selection": dataAttributes.dataHasSelection || void 0
194
+ })
196
195
  });
197
196
  }
198
197
  if ("formControl" in props && props.formControl) {
@@ -4,9 +4,9 @@ import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
4
4
  import { InputClear } from "../../shared/InputClear.js";
5
5
  import { inputBase, inputSize } from "../../shared/input.cva.js";
6
6
  import { FormField } from "../../FormField/FormField.js";
7
- import { StaticInput } from "../../shared/StaticInput.js";
8
7
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
9
8
  import { getStaticNumberDisplayValue } from "../shared/numberStatic.utils.js";
9
+ import { StaticInput } from "../../shared/StaticInput.js";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { clsx } from "clsx";
12
12
  import { useEffect, useRef, useState } from "react";
@@ -1,14 +1,13 @@
1
1
  import { UIStyle } from "../../../../config/uiStyle.context.js";
2
- import { Loader } from "../../../status/Loader/Loader.js";
3
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
4
3
  import { inputBase } from "../../shared/input.cva.js";
5
4
  import { FormField } from "../../FormField/FormField.js";
6
- import { StaticInput } from "../../shared/StaticInput.js";
7
5
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
6
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
8
7
  import { InputContent } from "../shared/InputContent.js";
9
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { jsx } from "react/jsx-runtime";
10
9
  import { clsx } from "clsx";
11
- import { isValidElement, useEffect, useRef, useState } from "react";
10
+ import { useEffect, useRef, useState } from "react";
12
11
  import { Input } from "react-aria-components";
13
12
  import { useFocusVisible, useTextField } from "react-aria";
14
13
  import { mergeRefs } from "@react-aria/utils";
@@ -117,11 +116,6 @@ var TextInputBase = (props) => {
117
116
  })
118
117
  });
119
118
  };
120
- var renderIconVisual = (icon) => {
121
- if (!icon) return null;
122
- if (isValidElement(icon)) return icon;
123
- return /* @__PURE__ */ jsx(icon, { className: "size-6 text-interactive-text-secondary-idle" });
124
- };
125
119
  var TextInput = ({ renderStaticInput, ...props }) => {
126
120
  const ui = UIConfig.useConfig();
127
121
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
@@ -152,44 +146,50 @@ var TextInput = ({ renderStaticInput, ...props }) => {
152
146
  const maskedPasswordValue = inputType === "password" && `${staticValue}`.length > 0 ? "•".repeat(`${staticValue}`.length) : staticValue;
153
147
  const displayValue = maskedPasswordValue == null ? "" : `${maskedPasswordValue}`;
154
148
  const hasValue = displayValue !== "";
155
- const trailingContent = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
156
- props.unit && /* @__PURE__ */ jsx("span", {
157
- className: "text-label-2 text-text-default-3",
158
- children: props.unit
159
- }),
160
- props.isLoading && /* @__PURE__ */ jsx(Loader, {}),
161
- !props.isLoading && props.action && renderIconVisual(props.action.icon),
162
- !props.isLoading && !props.action && props.trailingIcon && renderIconVisual(props.trailingIcon)
163
- ] }) : void 0;
164
- return /* @__PURE__ */ jsx(StaticInput, {
149
+ const dataAttributes = {
150
+ dataIsEmpty: !hasValue,
151
+ dataIsFilled: hasValue,
152
+ dataIsDirty: props.isDirty,
153
+ dataIsRequired: props.isRequired,
154
+ dataIsDisabled: isDisabled,
155
+ dataDisabled: isDisabled,
156
+ dataInvalid: !!props.error,
157
+ dataHasSelection: hasValue
158
+ };
159
+ return /* @__PURE__ */ jsx(InputFrame, {
165
160
  ...props,
166
- onInteract: (focus) => {
161
+ isHeaderHidden,
162
+ hideLabel,
163
+ isDisabled,
164
+ className: clsx("group w-full", as === "inline" && "h-full", props.className),
165
+ dataAttributes,
166
+ renderStatic: true,
167
+ onStaticInteract: (focus) => {
167
168
  setShouldFocus(focus);
168
169
  setRenderInput(true);
169
170
  },
171
+ inputClassName: props.inputClassName,
170
172
  as,
171
173
  size,
172
174
  variant,
173
- hideLabel,
174
- isHeaderHidden,
175
- isDisabled,
176
- className: clsx("group w-full", as === "inline" && "h-full", props.className),
177
- inputClassName: props.inputClassName,
178
- placeholder: props.placeholder,
179
- displayValue,
180
- isEmpty: !hasValue,
181
- dataAttributes: {
182
- dataIsEmpty: !hasValue,
183
- dataIsFilled: hasValue,
184
- dataIsDirty: props.isDirty,
185
- dataIsRequired: props.isRequired,
186
- dataIsDisabled: isDisabled,
187
- dataDisabled: isDisabled,
188
- dataInvalid: !!props.error,
189
- dataHasSelection: hasValue
190
- },
191
- leadingVisual: renderIconVisual(props.leadingIcon),
192
- trailingContent
175
+ children: /* @__PURE__ */ jsx("input", {
176
+ ref: inputRef,
177
+ type: inputType === "hidden" ? "password" : inputType,
178
+ readOnly: true,
179
+ disabled: isDisabled,
180
+ tabIndex: -1,
181
+ value: displayValue,
182
+ placeholder: as === "floating" ? "" : props.placeholder,
183
+ className: "w-full bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled",
184
+ "data-is-empty": dataAttributes.dataIsEmpty || void 0,
185
+ "data-is-filled": dataAttributes.dataIsFilled || void 0,
186
+ "data-is-dirty": dataAttributes.dataIsDirty || void 0,
187
+ "data-is-required": dataAttributes.dataIsRequired || void 0,
188
+ "data-is-disabled": dataAttributes.dataIsDisabled || void 0,
189
+ "data-disabled": dataAttributes.dataDisabled || void 0,
190
+ "data-invalid": dataAttributes.dataInvalid || void 0,
191
+ "data-has-selection": dataAttributes.dataHasSelection || void 0
192
+ })
193
193
  });
194
194
  }
195
195
  if ("formControl" in props && props.formControl) {
@@ -1,6 +1,6 @@
1
1
  import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
- import { StaticInput } from "../../shared/StaticInput.js";
3
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
4
4
  import { SelectBase } from "../shared/SelectBase.js";
5
5
  import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -70,24 +70,16 @@ function Autocomplete({ renderStaticInput, ...props }) {
70
70
  selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
71
71
  });
72
72
  const trailingContent = props.trailingContent || !props.hideDropdownIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [props.trailingContent, !props.hideDropdownIcon ? /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: "size-6 shrink-0 text-interactive-text-secondary-idle" }) : void 0] }) : void 0;
73
- return /* @__PURE__ */ jsx(StaticInput, {
73
+ const placeholder = as === "floating" ? null : props.placeholder;
74
+ const shouldRenderPlaceholderAfterValue = mode !== "single" && props.placeholder && !isEmpty;
75
+ return /* @__PURE__ */ jsxs(InputFrame, {
74
76
  ...props,
75
- onInteract: (focus) => {
76
- setShouldFocus(focus);
77
- setRenderInput(true);
78
- },
79
- as,
80
- size: props.size ?? ui.input.size,
81
- variant: props.variant ?? ui.input.variant,
82
77
  isHeaderHidden: props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
83
78
  hideLabel: props.hideLabel ?? ui.input.hideLabel,
84
79
  isDisabled,
85
80
  className: clsx("w-full", props.containerClassName),
86
81
  inputClassName: clsx(props.className, props.inputClassName),
87
- placeholder: props.placeholder,
88
- showPlacholderIfFilled: mode !== "single",
89
- displayValue,
90
- isEmpty,
82
+ labelPlacement: "content-row",
91
83
  dataAttributes: {
92
84
  dataIsEmpty: isEmpty,
93
85
  dataIsFilled: !isEmpty,
@@ -99,8 +91,26 @@ function Autocomplete({ renderStaticInput, ...props }) {
99
91
  dataHasSelection: !isEmpty,
100
92
  dataHasSearch: false
101
93
  },
102
- leadingContent: props.leadingContent,
103
- trailingContent
94
+ renderStatic: true,
95
+ onStaticInteract: (focus) => {
96
+ setShouldFocus(focus);
97
+ setRenderInput(true);
98
+ },
99
+ as,
100
+ size: props.size ?? ui.input.size,
101
+ variant: props.variant ?? ui.input.variant,
102
+ actionContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
103
+ className: "ml-input-side-default flex shrink-0 items-center",
104
+ children: props.leadingContent
105
+ }),
106
+ trailingContent,
107
+ children: [isEmpty ? /* @__PURE__ */ jsx("span", {
108
+ className: "text-text-default-3",
109
+ children: placeholder
110
+ }) : displayValue, shouldRenderPlaceholderAfterValue && /* @__PURE__ */ jsx("div", {
111
+ className: "shrink-0 text-text-default-3",
112
+ children: props.placeholder
113
+ })]
104
114
  });
105
115
  }
106
116
  return /* @__PURE__ */ jsx(_Autocomplete, {
@@ -1,6 +1,6 @@
1
1
  import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
- import { StaticInput } from "../../shared/StaticInput.js";
3
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
4
4
  import { SelectBase } from "../shared/SelectBase.js";
5
5
  import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -67,25 +67,17 @@ function Select({ renderStaticInput, ...props }) {
67
67
  selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
68
68
  });
69
69
  const trailingContent = props.trailingContent || !props.hideDropdownIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [props.trailingContent, !props.hideDropdownIcon ? /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: `size-6 shrink-0 ${isDisabled ? "text-interactive-text-secondary-disabled" : "text-interactive-text-secondary-idle"}` }) : void 0] }) : void 0;
70
- return /* @__PURE__ */ jsx(StaticInput, {
70
+ const placeholder = as === "floating" ? null : props.placeholder;
71
+ const shouldRenderPlaceholderAfterValue = mode !== "single" && props.placeholder && !isEmpty;
72
+ return /* @__PURE__ */ jsxs(InputFrame, {
71
73
  ...props,
72
- onInteract: (focus) => {
73
- setShouldFocus(focus);
74
- setRenderInput(true);
75
- },
76
- as,
77
- typographySize: "label-1",
78
- size: props.size ?? ui.input.size,
79
- variant: props.variant ?? ui.input.variant,
80
74
  isHeaderHidden: props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
81
75
  hideLabel: props.hideLabel ?? ui.input.hideLabel,
82
76
  isDisabled,
83
77
  className: clsx("w-full", props.containerClassName),
84
78
  inputClassName: clsx(props.className, props.inputClassName),
85
- placeholder: props.placeholder,
86
- showPlacholderIfFilled: mode !== "single",
87
- displayValue,
88
- isEmpty,
79
+ typographySize: "label-1",
80
+ labelPlacement: "content-row",
89
81
  dataAttributes: {
90
82
  dataIsEmpty: isEmpty,
91
83
  dataIsFilled: !isEmpty,
@@ -97,9 +89,28 @@ function Select({ renderStaticInput, ...props }) {
97
89
  dataHasSelection: !isEmpty,
98
90
  dataHasSearch: false
99
91
  },
100
- leadingContent: props.leadingContent,
101
- hasClearIcon: isClearable,
102
- trailingContent
92
+ renderStatic: true,
93
+ onStaticInteract: (focus) => {
94
+ setShouldFocus(focus);
95
+ setRenderInput(true);
96
+ },
97
+ as,
98
+ size: props.size ?? ui.input.size,
99
+ variant: props.variant ?? ui.input.variant,
100
+ actionContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
101
+ className: "ml-input-side-default flex shrink-0 items-center",
102
+ children: props.leadingContent
103
+ }),
104
+ isClearable,
105
+ showClear: false,
106
+ trailingContent,
107
+ children: [isEmpty ? /* @__PURE__ */ jsx("span", {
108
+ className: "text-text-default-3",
109
+ children: placeholder
110
+ }) : displayValue, shouldRenderPlaceholderAfterValue && /* @__PURE__ */ jsx("div", {
111
+ className: "shrink-0 text-text-default-3",
112
+ children: props.placeholder
113
+ })]
103
114
  });
104
115
  }
105
116
  return /* @__PURE__ */ jsx(_Select, {
@@ -0,0 +1,56 @@
1
+ import { FC, ReactElement, ReactNode, Ref, SVGProps } from 'react';
2
+ import { InlineIconButtonProps } from '../../buttons/InlineIconButton/InlineIconButton';
3
+ import { FormFieldProps } from '../FormField/FormField';
4
+ import { FormFieldHeaderProps } from '../FormField/FormFieldHeader';
5
+ import { InputVariantProps } from '../shared/input.cva';
6
+ import { TypographyVariantProps } from '../../text/Typography/typography.cva';
7
+ type InputFrameIcon = FC<SVGProps<SVGSVGElement>> | ReactElement;
8
+ interface InputFrameAction {
9
+ icon: InlineIconButtonProps["icon"];
10
+ onClick: () => void;
11
+ altText: string;
12
+ className?: string;
13
+ }
14
+ interface InputFrameDataAttributes {
15
+ dataDisabled?: boolean;
16
+ dataHasSearch?: boolean;
17
+ dataHasSelection?: boolean;
18
+ dataInvalid?: boolean;
19
+ dataIsDirty?: boolean;
20
+ dataIsDisabled?: boolean;
21
+ dataIsEmpty?: boolean;
22
+ dataIsFilled?: boolean;
23
+ dataIsRequired?: boolean;
24
+ }
25
+ type InputFrameLabelPlacement = "content-wrapper" | "content-row";
26
+ export interface InputFrameProps extends InputVariantProps, Partial<FormFieldProps> {
27
+ ref?: Ref<HTMLDivElement>;
28
+ children: ReactNode;
29
+ formFieldRef?: Ref<HTMLDivElement>;
30
+ labelProps?: FormFieldHeaderProps["labelProps"];
31
+ headerProps?: FormFieldHeaderProps;
32
+ leadingContent?: ReactNode;
33
+ leadingIcon?: InputFrameIcon;
34
+ actionContent?: ReactNode;
35
+ trailingContent?: ReactNode;
36
+ trailingIcon?: InputFrameIcon;
37
+ trailingAction?: ReactNode;
38
+ unit?: string;
39
+ isLoading?: boolean;
40
+ action?: InputFrameAction;
41
+ isClearable?: boolean;
42
+ showClear?: boolean;
43
+ renderStatic?: boolean;
44
+ onStaticInteract?: (shouldFocus: boolean) => void;
45
+ clearClassName?: string;
46
+ onClear?: () => void;
47
+ dataAttributes?: InputFrameDataAttributes;
48
+ typographySize?: TypographyVariantProps["size"];
49
+ inputClassName?: string;
50
+ contentClassName?: string;
51
+ contentWrapperClassName?: string;
52
+ labelPlacement?: InputFrameLabelPlacement;
53
+ trailingClassName?: string;
54
+ }
55
+ export declare const InputFrame: ({ ref, children, formFieldRef, labelProps, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, inputClassName, contentClassName, contentWrapperClassName, labelPlacement, trailingClassName, variant, as, size, }: InputFrameProps) => import("react/jsx-runtime").JSX.Element;
56
+ export {};