@povio/ui 2.2.9-rc.16 → 2.2.9-rc.18

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.
@@ -1,5 +1,5 @@
1
1
  import { CalendarDate, DateValue } from '@internationalized/date';
2
- import { Ref, FocusEvent } from 'react';
2
+ import { FocusEvent, Ref } from 'react';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  import { DatePickerStateOptions } from 'react-stately';
5
5
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
@@ -1,7 +1,8 @@
1
- import { CalendarIcon } from "../../../../assets/icons/Calendar.js";
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
- import { TodayIcon } from "../../../../assets/icons/Today.js";
4
3
  import { Calendar } from "../shared/Calendar.js";
4
+ import { datePickerInputContentRow } from "../shared/datePickerInput.cva.js";
5
+ import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
5
6
  import { DatePickerInput } from "../shared/DatePickerInput.js";
6
7
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
7
8
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
@@ -169,6 +170,7 @@ var DatePickerBase = (props) => {
169
170
  };
170
171
  var DatePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...props }) => {
171
172
  const ui = UIConfig.useConfig();
173
+ const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
172
174
  const { locale } = useLocale();
173
175
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
174
176
  const [shouldFocus, setShouldFocus] = useState(false);
@@ -212,6 +214,7 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...pr
212
214
  let isDisabled = !!props.isDisabled;
213
215
  if (isFormControlDisabled) isDisabled = true;
214
216
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
217
+ const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
215
218
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
216
219
  const showDropdown = !props.disableDropdown || disableManualEntry;
217
220
  const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDatePlaceholder(locale);
@@ -234,8 +237,9 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...pr
234
237
  placeholder: staticPlaceholder,
235
238
  displayValue,
236
239
  isEmpty: !displayValue,
237
- leadingVisual: todayIcon ? /* @__PURE__ */ jsx(TodayIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0,
238
- trailingVisual: showDropdown ? /* @__PURE__ */ jsx(CalendarIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
240
+ contentRowClassName: datePickerInputContentRowCva({ size }),
241
+ leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
242
+ trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0
239
243
  });
240
244
  }
241
245
  if ("formControl" in props && props.formControl) {
@@ -1,8 +1,9 @@
1
- import { CalendarIcon } from "../../../../assets/icons/Calendar.js";
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
2
2
  import { Typography } from "../../../text/Typography/Typography.js";
3
3
  import { UIConfig } from "../../../../config/uiConfig.context.js";
4
4
  import "../../../../config/i18n.js";
5
- import { TodayIcon } from "../../../../assets/icons/Today.js";
5
+ import { datePickerInputContentRow } from "../shared/datePickerInput.cva.js";
6
+ import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
6
7
  import { DatePickerInput } from "../shared/DatePickerInput.js";
7
8
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
8
9
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
@@ -545,6 +546,7 @@ var DateRangePickerBase = (props) => {
545
546
  };
546
547
  var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...props }) => {
547
548
  const ui = UIConfig.useConfig();
549
+ const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
548
550
  const { locale } = useLocale$1();
549
551
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
550
552
  const [shouldFocus, setShouldFocus] = useState(false);
@@ -610,6 +612,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
610
612
  let isDisabled = !!props.isDisabled;
611
613
  if (isFormControlDisabled) isDisabled = true;
612
614
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
615
+ const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
613
616
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
614
617
  const showDropdown = !props.disableDropdown || disableManualEntry;
615
618
  const defaultDatePlaceholder = DateTimeUtils.getDatePlaceholder(locale);
@@ -661,8 +664,9 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
661
664
  placeholder: staticPlaceholder,
662
665
  displayValue,
663
666
  isEmpty: !hasRangeValue,
664
- leadingVisual: todayIcon ? /* @__PURE__ */ jsx(TodayIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0,
665
- trailingVisual: showDropdown ? /* @__PURE__ */ jsx(CalendarIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
667
+ contentRowClassName: datePickerInputContentRowCva({ size }),
668
+ leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
669
+ trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0
666
670
  });
667
671
  }
668
672
  if ("formControl" in props && props.formControl) {
@@ -1,7 +1,8 @@
1
- import { DateTimeIcon } from "../../../../assets/icons/DateTime.js";
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
- import { TodayIcon } from "../../../../assets/icons/Today.js";
4
3
  import { Calendar } from "../shared/Calendar.js";
4
+ import { datePickerInputContentRow } from "../shared/datePickerInput.cva.js";
5
+ import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
5
6
  import { DatePickerInput } from "../shared/DatePickerInput.js";
6
7
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
7
8
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
@@ -189,6 +190,7 @@ var DateTimePickerBase = (props) => {
189
190
  };
190
191
  var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
191
192
  const ui = UIConfig.useConfig();
193
+ const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
192
194
  const { locale } = useLocale();
193
195
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
194
196
  const [shouldFocus, setShouldFocus] = useState(false);
@@ -225,6 +227,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
225
227
  let isDisabled = !!props.isDisabled;
226
228
  if (isFormControlDisabled) isDisabled = true;
227
229
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
230
+ const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
228
231
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
229
232
  const showDropdown = !props.disableDropdown || disableManualEntry;
230
233
  const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale);
@@ -247,8 +250,9 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
247
250
  placeholder: staticPlaceholder,
248
251
  displayValue,
249
252
  isEmpty: !displayValue,
250
- leadingVisual: todayIcon ? /* @__PURE__ */ jsx(TodayIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0,
251
- trailingVisual: showDropdown ? /* @__PURE__ */ jsx(DateTimeIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
253
+ contentRowClassName: datePickerInputContentRowCva({ size }),
254
+ leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
255
+ trailingContent: showDropdown ? ui.dateInput.dateTimeIcon : void 0
252
256
  });
253
257
  }
254
258
  if ("formControl" in props && props.formControl) {
@@ -1,4 +1,3 @@
1
- import { ClockIcon } from "../../../../assets/icons/Clock.js";
2
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
2
  import { TimePickerForm } from "../shared/TimePickerForm.js";
4
3
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
@@ -198,7 +197,7 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
198
197
  placeholder: staticPlaceholder,
199
198
  displayValue,
200
199
  isEmpty: !displayValue,
201
- trailingVisual: showDropdown ? /* @__PURE__ */ jsx(ClockIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
200
+ trailingContent: showDropdown ? ui.dateInput.timeIcon : void 0
202
201
  });
203
202
  }
204
203
  if ("formControl" in props && props.formControl) {
@@ -29,7 +29,7 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply,
29
29
  setToggleState("time");
30
30
  return;
31
31
  }
32
- onApply(resolvedDate);
32
+ if (datePickerState?.value && !setDateValueOnDateSelection) onApply(resolvedDate);
33
33
  };
34
34
  const getContent = () => {
35
35
  if (!toggleState) return /* @__PURE__ */ jsx(CalendarGrid, {
@@ -2,9 +2,9 @@ import { UIStyle } from "../../../../config/uiStyle.context.js";
2
2
  import { Typography } from "../../../text/Typography/Typography.js";
3
3
  import { UIConfig } from "../../../../config/uiConfig.context.js";
4
4
  import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
5
- import { TodayIcon } from "../../../../assets/icons/Today.js";
6
5
  import { DateField } from "./DateField.js";
7
6
  import { datePickerInputContentRow } from "./datePickerInput.cva.js";
7
+ import { getDatePickerTodayIcon } from "./datePickerTodayIcon.js";
8
8
  import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
9
9
  import { InputClear } from "../../shared/InputClear.js";
10
10
  import { inputBase, inputSize } from "../../shared/input.cva.js";
@@ -71,7 +71,7 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
71
71
  endFieldProps?.onBlur?.(null);
72
72
  };
73
73
  const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
74
- const todayIconComponent = todayIcon === true ? TodayIcon : todayIcon || null;
74
+ const todayIconComponent = getDatePickerTodayIcon(todayIcon);
75
75
  const pickerIcon = isDateTime ? uiConfig.dateInput.dateTimeIcon : uiConfig.dateInput.calendarIcon;
76
76
  return /* @__PURE__ */ jsxs("div", {
77
77
  ref: containerRef,
@@ -1,6 +1,6 @@
1
- import { ClockIcon } from "../../../../assets/icons/Clock.js";
2
1
  import { UIStyle } from "../../../../config/uiStyle.context.js";
3
2
  import { Typography } from "../../../text/Typography/Typography.js";
3
+ import { UIConfig } from "../../../../config/uiConfig.context.js";
4
4
  import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
5
5
  import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
6
6
  import { InputClear } from "../../shared/InputClear.js";
@@ -13,6 +13,7 @@ import { Button } from "react-aria-components";
13
13
  import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
14
14
  //#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
15
15
  var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
16
+ const uiConfig = UIConfig.useConfig();
16
17
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
17
18
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
18
19
  const { hoverProps, isHovered } = useHover({ isDisabled });
@@ -83,7 +84,7 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequ
83
84
  label: "",
84
85
  color: "secondary",
85
86
  onPress,
86
- icon: ClockIcon,
87
+ icon: uiConfig.dateInput.timeIcon,
87
88
  isDisabled,
88
89
  className: "border-0!"
89
90
  })]
@@ -0,0 +1,6 @@
1
+ import { FC, ReactElement, SVGProps } from 'react';
2
+ import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from './datePicker.types';
3
+ type TodayIconComponent = FC<SVGProps<SVGSVGElement>> | ReactElement;
4
+ export declare const getDatePickerTodayIcon: (todayIcon: DatePickerTodayIcon | undefined) => TodayIconComponent | null;
5
+ export declare const renderDatePickerTodayIcon: (todayIcon: DatePickerTodayIcon | undefined, size?: DatePickerTodayIconButtonSize, className?: string) => import("react/jsx-runtime").JSX.Element | undefined;
6
+ export {};
@@ -0,0 +1,20 @@
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
2
+ import { buttonIconSize } from "../../../buttons/Button/button.cva.js";
3
+ import { TodayIcon } from "../../../../assets/icons/Today.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { clsx } from "clsx";
6
+ import { isValidElement } from "react";
7
+ //#region src/components/inputs/DateTime/shared/datePickerTodayIcon.tsx
8
+ var getDatePickerTodayIcon = (todayIcon) => {
9
+ if (!todayIcon) return null;
10
+ return todayIcon === true ? TodayIcon : todayIcon;
11
+ };
12
+ var renderDatePickerTodayIcon = (todayIcon, size = "none", className) => {
13
+ const buttonIconSizeCva = UIStyle.useCva("button.iconSize", buttonIconSize);
14
+ const icon = getDatePickerTodayIcon(todayIcon);
15
+ if (!icon) return;
16
+ if (isValidElement(icon)) return icon;
17
+ return /* @__PURE__ */ jsx(icon, { className: clsx(buttonIconSizeCva({ size }), "text-interactive-text-secondary-idle", className) });
18
+ };
19
+ //#endregion
20
+ export { getDatePickerTodayIcon, renderDatePickerTodayIcon };
@@ -152,7 +152,7 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
152
152
  const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
153
153
  let isDisabled = !!props.isDisabled;
154
154
  if (isFormControlDisabled) isDisabled = true;
155
- const trailingVisual = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
155
+ const trailingContent = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
156
156
  props.unit && /* @__PURE__ */ jsx("span", {
157
157
  className: "text-label-2 text-text-default-3",
158
158
  children: props.unit
@@ -179,7 +179,7 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
179
179
  displayValue,
180
180
  isEmpty: !hasValue,
181
181
  leadingVisual: renderIconVisual(props.leadingIcon),
182
- trailingVisual
182
+ trailingContent
183
183
  });
184
184
  }
185
185
  if ("formControl" in props && props.formControl) {
@@ -152,7 +152,7 @@ var TextInput = ({ renderStaticInput, ...props }) => {
152
152
  const maskedPasswordValue = inputType === "password" && `${staticValue}`.length > 0 ? "•".repeat(`${staticValue}`.length) : staticValue;
153
153
  const displayValue = maskedPasswordValue == null ? "" : `${maskedPasswordValue}`;
154
154
  const hasValue = displayValue !== "";
155
- const trailingVisual = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
155
+ const trailingContent = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
156
156
  props.unit && /* @__PURE__ */ jsx("span", {
157
157
  className: "text-label-2 text-text-default-3",
158
158
  children: props.unit
@@ -179,7 +179,7 @@ var TextInput = ({ renderStaticInput, ...props }) => {
179
179
  displayValue,
180
180
  isEmpty: !hasValue,
181
181
  leadingVisual: renderIconVisual(props.leadingIcon),
182
- trailingVisual
182
+ trailingContent
183
183
  });
184
184
  }
185
185
  if ("formControl" in props && props.formControl) {
@@ -3,6 +3,7 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
3
3
  import { StaticInput } from "../../shared/StaticInput.js";
4
4
  import { SelectBase } from "../shared/SelectBase.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { clsx } from "clsx";
6
7
  import { isValidElement, useEffect, useRef, useState } from "react";
7
8
  import { mergeRefs } from "@react-aria/utils";
8
9
  import { Controller, useWatch } from "react-hook-form";
@@ -66,6 +67,7 @@ function Autocomplete({ renderStaticInput, ...props }) {
66
67
  const as = props.as ?? ui.input.as;
67
68
  let isDisabled = !!props.isDisabled;
68
69
  if (isFormControlDisabled) isDisabled = true;
70
+ 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;
69
71
  return /* @__PURE__ */ jsx(StaticInput, {
70
72
  ...props,
71
73
  onInteract: (focus) => {
@@ -75,13 +77,16 @@ function Autocomplete({ renderStaticInput, ...props }) {
75
77
  as,
76
78
  size: props.size ?? ui.input.size,
77
79
  variant: props.variant ?? ui.input.variant,
78
- isHeaderHidden: props.isHeaderHidden || as === "inline",
80
+ isHeaderHidden: props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
79
81
  hideLabel: props.hideLabel ?? ui.input.hideLabel,
80
82
  isDisabled,
83
+ className: clsx("w-full", props.containerClassName),
84
+ inputClassName: clsx(props.className, props.inputClassName),
81
85
  placeholder: as === "floating" ? "" : props.placeholder,
82
86
  displayValue,
83
87
  isEmpty: !displayValue,
84
- trailingVisual: /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: "size-6 shrink-0 text-interactive-text-secondary-idle" })
88
+ leadingContent: props.leadingContent,
89
+ trailingContent
85
90
  });
86
91
  }
87
92
  return /* @__PURE__ */ jsx(_Autocomplete, {
@@ -3,6 +3,7 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
3
3
  import { StaticInput } from "../../shared/StaticInput.js";
4
4
  import { SelectBase } from "../shared/SelectBase.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { clsx } from "clsx";
6
7
  import { isValidElement, useEffect, useRef, useState } from "react";
7
8
  import { mergeRefs } from "@react-aria/utils";
8
9
  import { Controller, useWatch } from "react-hook-form";
@@ -62,6 +63,7 @@ function Select({ renderStaticInput, ...props }) {
62
63
  const as = props.as ?? ui.input.as;
63
64
  let isDisabled = !!props.isDisabled;
64
65
  if (isFormControlDisabled) isDisabled = true;
66
+ 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;
65
67
  return /* @__PURE__ */ jsx(StaticInput, {
66
68
  ...props,
67
69
  onInteract: (focus) => {
@@ -71,13 +73,15 @@ function Select({ renderStaticInput, ...props }) {
71
73
  as,
72
74
  size: props.size ?? ui.input.size,
73
75
  variant: props.variant ?? ui.input.variant,
74
- isHeaderHidden: props.isHeaderHidden || as === "inline",
75
76
  hideLabel: props.hideLabel ?? ui.input.hideLabel,
76
77
  isDisabled,
78
+ className: clsx("w-full", props.containerClassName),
79
+ inputClassName: clsx(props.className, props.inputClassName),
77
80
  placeholder: as === "floating" ? "" : props.placeholder,
78
81
  displayValue,
79
82
  isEmpty: !displayValue,
80
- trailingVisual: /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: "size-6 shrink-0 text-interactive-text-secondary-idle" })
83
+ leadingContent: props.leadingContent,
84
+ trailingContent
81
85
  });
82
86
  }
83
87
  return /* @__PURE__ */ jsx(_Select, {
@@ -12,8 +12,10 @@ interface StaticInputProps extends FormFieldProps {
12
12
  displayValue?: ReactNode;
13
13
  isEmpty?: boolean;
14
14
  leadingVisual?: ReactNode;
15
- trailingVisual?: ReactNode;
15
+ leadingContent?: ReactNode;
16
+ trailingContent?: ReactNode;
17
+ contentRowClassName?: string;
16
18
  inputClassName?: string;
17
19
  }
18
- export declare const StaticInput: ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, trailingVisual, inputClassName, className, ...formFieldProps }: StaticInputProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const StaticInput: ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, leadingContent, trailingContent, contentRowClassName, inputClassName, className, ...formFieldProps }: StaticInputProps) => import("react/jsx-runtime").JSX.Element;
19
21
  export {};
@@ -5,7 +5,7 @@ import { FormField } from "../FormField/FormField.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { clsx } from "clsx";
7
7
  //#region src/components/inputs/shared/StaticInput.tsx
8
- var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, trailingVisual, inputClassName, className, ...formFieldProps }) => {
8
+ var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, leadingContent, trailingContent, contentRowClassName, inputClassName, className, ...formFieldProps }) => {
9
9
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
10
10
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
11
11
  let hasValue = !!displayValue;
@@ -30,37 +30,45 @@ var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placehol
30
30
  "data-is-disabled": formFieldProps.isDisabled || void 0,
31
31
  "data-has-selection": hasValue || void 0,
32
32
  "data-rac": "",
33
- className: clsx("group/static-input group/input-content group/select-content relative flex items-center justify-between gap-input-gap-input-text-to-elements", applyMinInputWidth && "min-w-input-width-min-width", inputBaseCva({
33
+ className: clsx("group/static-input group/input-content group/select-content relative flex items-center gap-input-gap-input-text-to-elements", applyMinInputWidth && "min-w-input-width-min-width", inputBaseCva({
34
34
  as,
35
35
  variant
36
36
  }), inputClassName),
37
- children: [/* @__PURE__ */ jsxs("div", {
38
- className: clsx(inputSizeCva({
39
- size,
40
- as
41
- }), "flex w-full items-center gap-input-gap-input-text-to-elements pr-0!"),
42
- children: [leadingVisual && /* @__PURE__ */ jsx("div", {
43
- className: "pointer-events-none shrink-0",
44
- children: leadingVisual
45
- }), /* @__PURE__ */ jsxs("div", {
46
- className: clsx("flex w-full truncate", as === "floating" && "flex-col", as === "filter" && "gap-input-gap-input-text-to-elements"),
47
- children: [as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
48
- as,
37
+ children: [/* @__PURE__ */ jsx("div", {
38
+ className: "flex w-full items-center gap-input-gap-input-text-to-elements",
39
+ children: /* @__PURE__ */ jsxs("div", {
40
+ className: clsx(inputSizeCva({
49
41
  size,
50
- label: formFieldProps.label,
51
- isRequired: formFieldProps.isRequired,
52
- isDisabled: formFieldProps.isDisabled
53
- }), /* @__PURE__ */ jsxs("div", {
54
- className: clsx("truncate", !hasValue && "text-text-default-3"),
55
- children: [staticDisplayContent, shouldRenderFloatingLineSpacer && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" })]
56
- })]
57
- })]
58
- }), trailingVisual && /* @__PURE__ */ jsx("div", {
42
+ as
43
+ }), "group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", contentRowClassName),
44
+ children: [
45
+ leadingVisual && /* @__PURE__ */ jsx("div", {
46
+ className: "pointer-events-none shrink-0",
47
+ children: leadingVisual
48
+ }),
49
+ as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
50
+ as,
51
+ size,
52
+ label: formFieldProps.label,
53
+ isRequired: formFieldProps.isRequired,
54
+ isDisabled: formFieldProps.isDisabled
55
+ }),
56
+ leadingContent && /* @__PURE__ */ jsx("div", {
57
+ className: "ml-input-side-default flex shrink-0 items-center",
58
+ children: leadingContent
59
+ }),
60
+ /* @__PURE__ */ jsxs("div", {
61
+ className: clsx("w-full truncate", !hasValue && "text-text-default-3"),
62
+ children: [staticDisplayContent, shouldRenderFloatingLineSpacer && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" })]
63
+ })
64
+ ]
65
+ })
66
+ }), trailingContent && /* @__PURE__ */ jsx("div", {
59
67
  className: clsx(inputSizeCva({
60
68
  size,
61
69
  as
62
70
  }), "pointer-events-none flex items-center gap-input-gap-trailing-elements py-0! pl-0!"),
63
- children: trailingVisual
71
+ children: trailingContent
64
72
  })]
65
73
  })
66
74
  });
@@ -37,6 +37,7 @@ export declare namespace UIConfig {
37
37
  dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "shouldForceLeadingZeros" | "disableManualEntry" | "autoFixYear"> & {
38
38
  calendarIcon?: ReactElement;
39
39
  dateTimeIcon?: ReactElement;
40
+ timeIcon?: ReactElement;
40
41
  setDateValueOnDateSelection?: boolean;
41
42
  };
42
43
  actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
@@ -1,4 +1,5 @@
1
1
  import { CalendarIcon } from "../assets/icons/Calendar.js";
2
+ import { ClockIcon } from "../assets/icons/Clock.js";
2
3
  import { DateTimeIcon } from "../assets/icons/DateTime.js";
3
4
  import { ObjectUtils } from "../utils/object.utils.js";
4
5
  import { useDeepCompareMemo } from "../hooks/useDeepCompare.js";
@@ -52,6 +53,7 @@ var UIConfig;
52
53
  autoFixYear: false,
53
54
  calendarIcon: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-5" }),
54
55
  dateTimeIcon: /* @__PURE__ */ jsx(DateTimeIcon, { className: "size-5" }),
56
+ timeIcon: /* @__PURE__ */ jsx(ClockIcon, { className: "size-6 text-interactive-text-secondary-idle" }),
55
57
  setDateValueOnDateSelection: false
56
58
  },
57
59
  actionModal: {
@@ -39,18 +39,23 @@ var DateTimeUtils;
39
39
  hourCycle: "h23",
40
40
  timeZone: "UTC"
41
41
  });
42
- const mapTypeToPlaceholder = (type) => {
42
+ const repeatLocalizedFieldLabel = (type, length, locale) => {
43
+ const placeholderChar = new Intl.DisplayNames(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
44
+ if (!placeholderChar) return null;
45
+ return placeholderChar.repeat(length);
46
+ };
47
+ const mapTypeToPlaceholder = (type, locale) => {
43
48
  switch (type) {
44
- case "day": return "dd";
45
- case "month": return "mm";
46
- case "year": return "yyyy";
47
- case "hour": return "hh";
48
- case "minute": return "mm";
49
+ case "day": return repeatLocalizedFieldLabel(type, 2, locale);
50
+ case "month": return repeatLocalizedFieldLabel(type, 2, locale);
51
+ case "year": return repeatLocalizedFieldLabel(type, 4, locale);
52
+ case "hour": return repeatLocalizedFieldLabel(type, 2, locale);
53
+ case "minute": return repeatLocalizedFieldLabel(type, 2, locale);
49
54
  default: return null;
50
55
  }
51
56
  };
52
57
  const formatPlaceholder = (formatter, sampleDate) => {
53
- return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type) ?? part.value).join("");
58
+ return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value.replace(/\s+/gu, "")).join("");
54
59
  };
55
60
  function getDatePlaceholder(locale) {
56
61
  return formatPlaceholder(getDatePlaceholderFormatter(locale), DATE_SAMPLE_DATE_UTC);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.16",
3
+ "version": "2.2.9-rc.18",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",