@povio/ui 2.2.9-rc.25 → 2.2.9-rc.27

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 (38) 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.d.ts +2 -1
  5. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +34 -29
  6. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +2 -1
  7. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +33 -47
  8. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +2 -1
  9. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +35 -29
  10. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +29 -25
  11. package/dist/components/inputs/DateTime/shared/DateField.js +3 -10
  12. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -2
  13. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +51 -45
  14. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
  15. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
  16. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +1 -0
  17. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
  18. package/dist/components/inputs/DateTime/shared/dateSegment.utils.js +9 -0
  19. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
  20. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
  21. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +76 -0
  22. package/dist/components/inputs/Input/NumberInput/NumberInput.js +39 -40
  23. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +1 -1
  24. package/dist/components/inputs/Input/TextInput/TextInput.js +40 -40
  25. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +24 -15
  26. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -3
  27. package/dist/components/inputs/Selection/Select/QuerySelect.js +5 -34
  28. package/dist/components/inputs/Selection/Select/Select.js +27 -17
  29. package/dist/components/inputs/Skeleton/InputFrame.d.ts +54 -0
  30. package/dist/components/inputs/Skeleton/InputFrame.js +167 -0
  31. package/dist/components/inputs/shared/InputClear.d.ts +2 -1
  32. package/dist/components/inputs/shared/InputClear.js +13 -1
  33. package/dist/config/uiConfig.context.d.ts +1 -1
  34. package/dist/config/uiConfig.context.js +1 -0
  35. package/dist/index.js +1 -1
  36. package/dist/utils/date-time.utils.d.ts +7 -0
  37. package/dist/utils/date-time.utils.js +16 -0
  38. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'react';
2
2
  import { DatePickerAria } from 'react-aria';
3
- import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from './datePicker.types';
3
+ import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from './datePicker.types';
4
4
  import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
5
5
  import { InputVariantProps } from '../../shared/input.cva';
6
6
  export interface DatePickerInputHandle {
@@ -21,6 +21,7 @@ interface DatePickerInputProps extends InputVariantProps {
21
21
  headerProps?: FormFieldHeaderProps;
22
22
  todayIcon?: DatePickerTodayIcon;
23
23
  todayIconButtonSize?: DatePickerTodayIconButtonSize;
24
+ todayIconPlacement?: DatePickerTodayIconPlacement;
24
25
  isDirty?: boolean;
25
26
  isRequired?: boolean;
26
27
  disableManualEntry?: boolean;
@@ -29,5 +30,5 @@ interface DatePickerInputProps extends InputVariantProps {
29
30
  className?: string;
30
31
  onOpenDropdown?: () => void;
31
32
  }
32
- export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize, todayIconPlacement, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
33
34
  export {};
@@ -15,7 +15,7 @@ import { Button } from "react-aria-components";
15
15
  import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
16
16
  import { getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
17
17
  //#region src/components/inputs/DateTime/shared/DatePickerInput.tsx
18
- var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize = "none", isDirty, isRequired, disableManualEntry, autoFixYear = false, placeholder, className, onOpenDropdown, ...props }) => {
18
+ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize = "none", todayIconPlacement = "content", isDirty, isRequired, disableManualEntry, autoFixYear = false, placeholder, className, onOpenDropdown, ...props }) => {
19
19
  const uiConfig = UIConfig.useConfig();
20
20
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
21
21
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
@@ -72,6 +72,14 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
72
72
  };
73
73
  const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
74
74
  const todayIconComponent = getDatePickerTodayIcon(todayIcon);
75
+ const todayIconButton = todayIconComponent ? /* @__PURE__ */ jsx(InlineIconButton, {
76
+ label: "",
77
+ icon: todayIconComponent,
78
+ size: todayIconButtonSize,
79
+ onPress: onToday,
80
+ className: "relative z-1 !border-none"
81
+ }) : null;
82
+ const shouldRenderTodayIconWithFieldLabel = todayIconPlacement === "fieldLabel";
75
83
  const pickerIcon = isDateTime ? uiConfig.dateInput.dateTimeIcon : uiConfig.dateInput.calendarIcon;
76
84
  return /* @__PURE__ */ jsxs("div", {
77
85
  ref: containerRef,
@@ -101,50 +109,48 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
101
109
  size,
102
110
  as
103
111
  })),
104
- children: [as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
105
- as,
106
- ...headerProps
107
- }), /* @__PURE__ */ jsxs("div", {
108
- className: datePickerInputContentRowCva({ size }),
109
- children: [
110
- disableManualEntry && /* @__PURE__ */ jsx(Button, {
111
- onPress: onOpenDropdown,
112
- className: "absolute inset-0 z-0",
113
- isDisabled
114
- }),
115
- todayIconComponent && /* @__PURE__ */ jsx(InlineIconButton, {
116
- label: "",
117
- icon: todayIconComponent,
118
- size: todayIconButtonSize,
119
- onPress: onToday,
120
- className: "relative z-1 !border-none"
121
- }),
122
- disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
123
- size: "label-1",
124
- className: "text-text-default-3",
125
- children: placeholder
126
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DateField, {
127
- ref: dateFieldRef,
128
- ...fieldProps,
129
- isDisabled,
130
- isInvalid,
131
- onClearChange,
132
- hidePlaceholder,
133
- disableManualEntry
134
- }), endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [!((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", {
135
- className: clsx("pointer-events-none select-none", isDisabled && "text-interactive-text-secondary-disabled"),
136
- children: "–"
137
- }), /* @__PURE__ */ jsx(DateField, {
138
- ref: endDateFieldRef,
139
- ...endFieldProps,
140
- isDisabled,
141
- isInvalid,
142
- onClearChange,
143
- hidePlaceholder,
144
- disableManualEntry
145
- })] })] })
146
- ]
147
- })]
112
+ children: [
113
+ as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
114
+ as,
115
+ ...headerProps
116
+ }),
117
+ shouldRenderTodayIconWithFieldLabel && todayIconButton,
118
+ /* @__PURE__ */ jsxs("div", {
119
+ className: datePickerInputContentRowCva({ size }),
120
+ children: [
121
+ disableManualEntry && /* @__PURE__ */ jsx(Button, {
122
+ onPress: onOpenDropdown,
123
+ className: "absolute inset-0 z-0",
124
+ isDisabled
125
+ }),
126
+ !shouldRenderTodayIconWithFieldLabel && todayIconButton,
127
+ disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
128
+ size: "label-1",
129
+ className: "text-text-default-3",
130
+ children: placeholder
131
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DateField, {
132
+ ref: dateFieldRef,
133
+ ...fieldProps,
134
+ isDisabled,
135
+ isInvalid,
136
+ onClearChange,
137
+ hidePlaceholder,
138
+ disableManualEntry
139
+ }), endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [!((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", {
140
+ className: clsx("pointer-events-none select-none", isDisabled && "text-interactive-text-secondary-disabled"),
141
+ children: "–"
142
+ }), /* @__PURE__ */ jsx(DateField, {
143
+ ref: endDateFieldRef,
144
+ ...endFieldProps,
145
+ isDisabled,
146
+ isInvalid,
147
+ onClearChange,
148
+ hidePlaceholder,
149
+ disableManualEntry
150
+ })] })] })
151
+ ]
152
+ })
153
+ ]
148
154
  }), /* @__PURE__ */ jsxs("div", {
149
155
  className: clsx(inputSizeCva({
150
156
  size,
@@ -1,4 +1,5 @@
1
1
  import { DateFieldState, DateSegment } from '@react-stately/datepicker';
2
+ import { HTMLAttributes, ReactNode, Ref } from 'react';
2
3
  interface DateSegmentProps {
3
4
  state: DateFieldState;
4
5
  segment: DateSegment;
@@ -8,4 +9,17 @@ interface DateSegmentProps {
8
9
  }
9
10
  export declare const getPlaceholder: (segment: DateSegment) => string | null;
10
11
  export declare const DateSegmentItem: ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }: DateSegmentProps) => import("react/jsx-runtime").JSX.Element;
12
+ interface DateSegmentItemViewProps {
13
+ ref?: Ref<HTMLDivElement>;
14
+ segmentProps?: HTMLAttributes<HTMLDivElement>;
15
+ type?: DateSegment["type"];
16
+ text: ReactNode;
17
+ placeholder?: ReactNode;
18
+ isPlaceholder?: boolean;
19
+ isInputEmpty?: boolean;
20
+ isDisabled?: boolean;
21
+ timePickerOnly?: boolean;
22
+ hidePlaceholder?: boolean;
23
+ }
24
+ export declare const DateSegmentItemView: ({ ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder, }: DateSegmentItemViewProps) => import("react/jsx-runtime").JSX.Element;
11
25
  export {};
@@ -15,17 +15,30 @@ var getPlaceholder = (segment) => {
15
15
  var DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }) => {
16
16
  const ref = useRef(null);
17
17
  const { segmentProps } = useDateSegment(segment, state, ref);
18
- const isInputEmpty = !state.value;
18
+ return /* @__PURE__ */ jsx(DateSegmentItemView, {
19
+ ref,
20
+ segmentProps,
21
+ type: segment.type,
22
+ text: segment.text,
23
+ placeholder: getPlaceholder(segment),
24
+ isPlaceholder: segment.isPlaceholder,
25
+ isInputEmpty: !state.value,
26
+ isDisabled,
27
+ timePickerOnly,
28
+ hidePlaceholder
29
+ });
30
+ };
31
+ var DateSegmentItemView = ({ ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder }) => {
19
32
  return /* @__PURE__ */ jsx("div", {
20
33
  ...segmentProps,
21
34
  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"),
23
- children: /* @__PURE__ */ jsxs(Fragment, { children: [segment.isPlaceholder && /* @__PURE__ */ jsx("span", {
35
+ 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", type && ["hour", "dayPeriod"].includes(type) && !timePickerOnly && "ml-1", hidePlaceholder && "opacity-0"),
36
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [isPlaceholder && /* @__PURE__ */ jsx("span", {
24
37
  "aria-hidden": "true",
25
38
  className: "pointer-events-none",
26
- children: getPlaceholder(segment)
27
- }), segment.isPlaceholder ? "" : segment.text] })
39
+ children: placeholder
40
+ }), isPlaceholder ? "" : text] })
28
41
  });
29
42
  };
30
43
  //#endregion
31
- export { DateSegmentItem, getPlaceholder };
44
+ export { DateSegmentItem, DateSegmentItemView, getPlaceholder };
@@ -1,3 +1,4 @@
1
1
  import { IconButtonProps } from '../../../buttons/IconButton/IconButton';
2
2
  export type DatePickerTodayIcon = boolean | IconButtonProps["icon"];
3
3
  export type DatePickerTodayIconButtonSize = IconButtonProps["size"];
4
+ export type DatePickerTodayIconPlacement = "content" | "fieldLabel";
@@ -0,0 +1,2 @@
1
+ import { DateSegment } from '@react-stately/datepicker';
2
+ export declare const getTimeSegmentValue: (segment: DateSegment | undefined, fallbackValue?: number) => number;
@@ -0,0 +1,9 @@
1
+ //#region src/components/inputs/DateTime/shared/dateSegment.utils.ts
2
+ var getTimeSegmentValue = (segment, fallbackValue = 0) => {
3
+ if (!segment) return fallbackValue;
4
+ const parsedValue = Number.parseInt(segment.text, 10);
5
+ if (Number.isFinite(parsedValue)) return parsedValue;
6
+ return Number.isFinite(segment.value) ? segment.value ?? fallbackValue : fallbackValue;
7
+ };
8
+ //#endregion
9
+ export { getTimeSegmentValue };
@@ -0,0 +1,35 @@
1
+ import { CalendarDate } from '@internationalized/date';
2
+ import { DateValue, TimeValue } from 'react-aria';
3
+ interface StaticSegmentProps {
4
+ isDisabled?: boolean;
5
+ hidePlaceholder?: boolean;
6
+ }
7
+ interface StaticCalendarDateSegmentsProps extends StaticSegmentProps {
8
+ value?: CalendarDate | null;
9
+ locale: string;
10
+ placeholder?: string;
11
+ shouldForceLeadingZeros?: boolean;
12
+ }
13
+ interface StaticCalendarDateTimeSegmentsProps extends StaticSegmentProps {
14
+ value?: DateValue | null;
15
+ locale: string;
16
+ placeholder?: string;
17
+ shouldForceLeadingZeros?: boolean;
18
+ }
19
+ interface StaticDateRangeSegmentsProps extends StaticSegmentProps {
20
+ start?: CalendarDate | null;
21
+ end?: CalendarDate | null;
22
+ locale: string;
23
+ placeholder?: string;
24
+ shouldForceLeadingZeros?: boolean;
25
+ }
26
+ interface StaticTimeSegmentsProps extends StaticSegmentProps {
27
+ value?: TimeValue | null;
28
+ locale: string;
29
+ placeholder?: string;
30
+ }
31
+ export declare const getStaticCalendarDateSegments: ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticCalendarDateSegmentsProps) => import("react/jsx-runtime").JSX.Element;
32
+ export declare const getStaticCalendarDateTimeSegments: ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticCalendarDateTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const getStaticDateRangeSegments: ({ start, end, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticDateRangeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const getStaticTimeSegments: ({ value, locale, placeholder, isDisabled, hidePlaceholder, }: StaticTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
35
+ export {};
@@ -0,0 +1,76 @@
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: token.text,
60
+ placeholder: token.text,
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
+ //#endregion
76
+ 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,15 @@ 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,
91
82
  dataAttributes: {
92
83
  dataIsEmpty: isEmpty,
93
84
  dataIsFilled: !isEmpty,
@@ -99,8 +90,26 @@ function Autocomplete({ renderStaticInput, ...props }) {
99
90
  dataHasSelection: !isEmpty,
100
91
  dataHasSearch: false
101
92
  },
102
- leadingContent: props.leadingContent,
103
- trailingContent
93
+ renderStatic: true,
94
+ onStaticInteract: (focus) => {
95
+ setShouldFocus(focus);
96
+ setRenderInput(true);
97
+ },
98
+ as,
99
+ size: props.size ?? ui.input.size,
100
+ variant: props.variant ?? ui.input.variant,
101
+ actionContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
102
+ className: "ml-input-side-default flex shrink-0 items-center",
103
+ children: props.leadingContent
104
+ }),
105
+ trailingContent,
106
+ children: [isEmpty ? /* @__PURE__ */ jsx("span", {
107
+ className: "text-text-default-3",
108
+ children: placeholder
109
+ }) : displayValue, shouldRenderPlaceholderAfterValue && /* @__PURE__ */ jsx("div", {
110
+ className: "shrink-0 text-text-default-3",
111
+ children: props.placeholder
112
+ })]
104
113
  });
105
114
  }
106
115
  return /* @__PURE__ */ jsx(_Autocomplete, {