@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
@@ -23,6 +23,7 @@ export type ButtonProps<IconOnly extends boolean = false> = ButtonVariantProps &
23
23
  noDisableWhenLoading?: boolean;
24
24
  iconClassName?: string;
25
25
  contentRef?: Ref<HTMLElement>;
26
+ staticRender?: boolean;
26
27
  };
27
- export declare const Button: <IconOnly extends boolean = false>({ icon: Icon, iconPosition, children, isLoading, className, link, iconClassName, noDisableWhenLoading, contentRef, ...props }: ButtonProps<IconOnly>) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const Button: <IconOnly extends boolean = false>({ icon: Icon, iconPosition, children, isLoading, className, link, iconClassName, noDisableWhenLoading, contentRef, staticRender, ...props }: ButtonProps<IconOnly>) => import("react/jsx-runtime").JSX.Element;
28
29
  export {};
@@ -7,10 +7,11 @@ import { jsx } from "react/jsx-runtime";
7
7
  import { clsx } from "clsx";
8
8
  import { Button, Link, ToggleButton } from "react-aria-components";
9
9
  //#region src/components/buttons/Button/Button.tsx
10
- var Button$1 = ({ icon: Icon, iconPosition, children, isLoading, className, link, iconClassName, noDisableWhenLoading, contentRef, ...props }) => {
10
+ var Button$1 = ({ icon: Icon, iconPosition, children, isLoading, className, link, iconClassName, noDisableWhenLoading, contentRef, staticRender, ...props }) => {
11
11
  const linkContext = LinkContext.useLinkContext();
12
12
  const uiConfig = UIConfig.useConfig();
13
- const { variant = uiConfig.button.variant, size = uiConfig.button.size } = props;
13
+ const variant = props.variant ?? uiConfig.button.variant;
14
+ const size = props.size ?? uiConfig.button.size;
14
15
  const buttonCva = UIStyle.useCva("button.cva", button);
15
16
  const buttonSizeCva = UIStyle.useCva("button.sizeCva", buttonSize);
16
17
  const buttonContentCva = UIStyle.useCva("button.contentCva", buttonContent);
@@ -22,45 +23,53 @@ var Button$1 = ({ icon: Icon, iconPosition, children, isLoading, className, link
22
23
  return Button;
23
24
  })();
24
25
  if (link && !link.to && link.href) link.to = link.href;
25
- return /* @__PURE__ */ jsx(Component, {
26
+ const resolvedClassName = clsx(buttonCva({
26
27
  ...props,
27
- ...link,
28
- isDisabled: props.isDisabled || isLoading && !noDisableWhenLoading,
29
- className: clsx(buttonCva({
28
+ variant,
29
+ size,
30
+ className
31
+ }), buttonSizeCva({
32
+ ...props,
33
+ variant,
34
+ size
35
+ }), buttonContentCva({
36
+ ...props,
37
+ variant,
38
+ size,
39
+ iconPosition: !Icon ? "none" : iconPosition
40
+ }));
41
+ const content = /* @__PURE__ */ jsx(ButtonContent, {
42
+ ref: contentRef,
43
+ isLoading,
44
+ icon: Icon,
45
+ text: children,
46
+ hideText: props.iconOnly,
47
+ iconPosition,
48
+ iconClassName: buttonIconSizeCva({
30
49
  ...props,
31
50
  variant,
32
51
  size,
33
- className
34
- }), buttonSizeCva({
52
+ className: iconClassName
53
+ }),
54
+ typography: typographyMap({
35
55
  ...props,
36
56
  variant,
37
57
  size
38
- }), buttonContentCva({
39
- ...props,
40
- variant,
41
- size,
42
- iconPosition: !Icon ? "none" : iconPosition
43
- })),
44
- children: /* @__PURE__ */ jsx(ButtonContent, {
45
- ref: contentRef,
46
- isLoading,
47
- icon: Icon,
48
- text: children,
49
- hideText: props.iconOnly,
50
- iconPosition,
51
- iconClassName: buttonIconSizeCva({
52
- ...props,
53
- variant,
54
- size,
55
- className: iconClassName
56
- }),
57
- typography: typographyMap({
58
- ...props,
59
- variant,
60
- size
61
- })
62
58
  })
63
59
  });
60
+ if (staticRender) return /* @__PURE__ */ jsx("div", {
61
+ "aria-label": props.iconOnly ? children : void 0,
62
+ "aria-disabled": props.isDisabled || void 0,
63
+ className: resolvedClassName,
64
+ children: content
65
+ });
66
+ return /* @__PURE__ */ jsx(Component, {
67
+ ...props,
68
+ ...link,
69
+ isDisabled: props.isDisabled || isLoading && !noDisableWhenLoading,
70
+ className: resolvedClassName,
71
+ children: content
72
+ });
64
73
  };
65
74
  //#endregion
66
75
  export { Button$1 as Button };
@@ -8,5 +8,6 @@ export interface InlineIconButtonProps extends Omit<AriaButtonProps, "children">
8
8
  link?: LinkNavigationProps;
9
9
  ref?: RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
10
10
  disableTooltip?: boolean;
11
+ staticRender?: boolean;
11
12
  }
12
13
  export declare const InlineIconButton: ({ label, size, ...props }: InlineIconButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,11 +6,12 @@ import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
6
6
  import { DatePickerInput } from "../shared/DatePickerInput.js";
7
7
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
8
8
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
9
+ import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
10
+ import { getStaticCalendarDateSegments } from "../shared/staticDateTimeSegments.js";
9
11
  import { FormField } from "../../FormField/FormField.js";
10
- import { StaticInput } from "../../shared/StaticInput.js";
11
12
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
12
14
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
13
- import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
16
  import { clsx } from "clsx";
16
17
  import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -208,51 +209,55 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...pr
208
209
  setShouldFocus(false);
209
210
  }, [renderInput, shouldFocus]);
210
211
  if (!renderInput) {
212
+ const dateValue = rawValue ? parseCalendarDate(rawValue) : null;
211
213
  const as = props.as ?? ui.input.as;
212
214
  const size = props.size ?? ui.input.size;
213
215
  const variant = props.variant ?? ui.input.variant;
214
216
  const hideLabel = props.hideLabel ?? ui.input.hideLabel;
215
217
  const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
216
- let isDisabled = !!props.isDisabled;
217
- if (isFormControlDisabled) isDisabled = true;
218
+ const isDisabled = isFormControlDisabled || !!props.isDisabled;
218
219
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
219
220
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
220
221
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
221
222
  const showDropdown = !props.disableDropdown || disableManualEntry;
222
- const staticDateValue = rawValue ? parseCalendarDate(rawValue) : null;
223
- const displayValue = staticDateValue ? DateTimeUtils.formatCalendarDateLocalized(staticDateValue, locale, { shouldForceLeadingZeros }) : "";
224
- const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros });
225
- return /* @__PURE__ */ jsx(StaticInput, {
223
+ const staticSegments = getStaticCalendarDateSegments({
224
+ value: dateValue,
225
+ locale,
226
+ placeholder: props.placeholder,
227
+ shouldForceLeadingZeros,
228
+ isDisabled,
229
+ hidePlaceholder: as === "floating" && !dateValue
230
+ });
231
+ return /* @__PURE__ */ jsx(InputFrame, {
226
232
  ...props,
227
- onInteract: (focus) => {
228
- setShouldFocus(focus);
229
- setRenderInput(true);
230
- },
231
- className: clsx("relative inline-flex w-full flex-col text-left", props.className),
232
- as,
233
- size,
234
- variant,
235
- applyMinInputWidth: true,
236
- hideLabel,
237
233
  isHeaderHidden,
234
+ hideLabel,
238
235
  isDisabled,
239
- placeholder: staticPlaceholder,
240
- displayValue,
241
- isEmpty: !displayValue,
236
+ className: clsx("relative inline-flex w-full flex-col text-left", props.className),
237
+ inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
238
+ contentWrapperClassName: datePickerInputContentRowCva({ size }),
239
+ labelPlacement: "content-row",
242
240
  dataAttributes: {
243
- dataIsEmpty: staticDateValue === null,
244
- dataIsFilled: staticDateValue !== null,
241
+ dataIsEmpty: dateValue === null,
242
+ dataIsFilled: dateValue !== null,
245
243
  dataIsDirty: props.isDirty,
246
244
  dataIsRequired: props.isRequired,
247
245
  dataIsDisabled: isDisabled,
248
246
  dataDisabled: isDisabled,
249
247
  dataInvalid: !!props.error,
250
- dataHasSelection: staticDateValue !== null
248
+ dataHasSelection: dateValue !== null
249
+ },
250
+ renderStatic: true,
251
+ onStaticInteract: (focus) => {
252
+ setShouldFocus(focus);
253
+ setRenderInput(true);
251
254
  },
252
- contentRowClassName: datePickerInputContentRowCva({ size }),
253
- leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
254
- leadingContentClassName: "ml-0!",
255
- trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0
255
+ as,
256
+ size,
257
+ variant,
258
+ actionContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
259
+ trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
260
+ children: staticSegments
256
261
  });
257
262
  }
258
263
  if ("formControl" in props && props.formControl) {
@@ -7,11 +7,12 @@ import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
7
7
  import { DatePickerInput } from "../shared/DatePickerInput.js";
8
8
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
9
9
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
10
+ import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
11
+ import { getStaticDateRangeSegments } from "../shared/staticDateTimeSegments.js";
10
12
  import { FormField } from "../../FormField/FormField.js";
11
- import { StaticInput } from "../../shared/StaticInput.js";
12
13
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
14
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
13
15
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
14
- import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
15
16
  import { RangeCalendar } from "../shared/RangeCalendar.js";
16
17
  import { jsx, jsxs } from "react/jsx-runtime";
17
18
  import { clsx } from "clsx";
@@ -606,59 +607,37 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
606
607
  setShouldFocus(false);
607
608
  }, [renderInput, shouldFocus]);
608
609
  if (!renderInput) {
610
+ const startDateValue = parseCalendarDate(rawValue?.start ?? null);
611
+ const endDateValue = parseCalendarDate(rawValue?.end ?? null);
612
+ const hasProvidedRangeValue = !!(rawValue?.start || rawValue?.end);
609
613
  const as = props.as ?? ui.input.as;
610
614
  const size = props.size ?? ui.input.size;
611
615
  const variant = props.variant ?? ui.input.variant;
612
616
  const hideLabel = props.hideLabel ?? ui.input.hideLabel;
613
617
  const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
614
- let isDisabled = !!props.isDisabled;
615
- if (isFormControlDisabled) isDisabled = true;
618
+ const isDisabled = isFormControlDisabled || !!props.isDisabled;
616
619
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
617
620
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
618
621
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
619
622
  const showDropdown = !props.disableDropdown || disableManualEntry;
620
- const defaultDatePlaceholder = DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros });
621
- const hasProvidedRangeValue = !!(rawValue?.start || rawValue?.end);
622
- const formatStaticDate = (value) => {
623
- if (!value) return "";
624
- const parsedDate = parseCalendarDate(value);
625
- if (!parsedDate) return "";
626
- return DateTimeUtils.formatCalendarDateLocalized(parsedDate, locale, { shouldForceLeadingZeros });
627
- };
628
- const start = formatStaticDate(rawValue?.start ?? null);
629
- const end = formatStaticDate(rawValue?.end ?? null);
630
- const displayValue = /* @__PURE__ */ jsxs("div", {
631
- className: datePickerInputContentRowCva({ size }),
632
- children: [
633
- /* @__PURE__ */ jsx("span", {
634
- className: rawValue?.start ? "" : "text-text-default-3",
635
- children: rawValue?.start ? start : defaultDatePlaceholder
636
- }),
637
- /* @__PURE__ */ jsx("span", {
638
- className: "pointer-events-none select-none",
639
- children: "–"
640
- }),
641
- /* @__PURE__ */ jsx("span", {
642
- className: rawValue?.end ? "" : "text-text-default-3",
643
- children: rawValue?.end ? end : defaultDatePlaceholder
644
- })
645
- ]
623
+ const staticSegments = getStaticDateRangeSegments({
624
+ start: startDateValue,
625
+ end: endDateValue,
626
+ locale,
627
+ placeholder: props.placeholder,
628
+ shouldForceLeadingZeros,
629
+ isDisabled,
630
+ hidePlaceholder: as === "floating" && !hasProvidedRangeValue
646
631
  });
647
- return /* @__PURE__ */ jsx(StaticInput, {
632
+ return /* @__PURE__ */ jsx(InputFrame, {
648
633
  ...props,
649
- onInteract: (focus) => {
650
- setShouldFocus(focus);
651
- setRenderInput(true);
652
- },
653
- className: clsx("relative inline-flex w-full flex-col text-left", props.className),
654
- as,
655
- size,
656
- variant,
657
- applyMinInputWidth: true,
658
- hideLabel,
659
634
  isHeaderHidden,
635
+ hideLabel,
660
636
  isDisabled,
661
- displayValue,
637
+ className: clsx("relative inline-flex w-full flex-col text-left", props.className),
638
+ inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
639
+ contentWrapperClassName: datePickerInputContentRowCva({ size }),
640
+ labelPlacement: "content-row",
662
641
  dataAttributes: {
663
642
  dataIsEmpty: !hasProvidedRangeValue,
664
643
  dataIsFilled: hasProvidedRangeValue,
@@ -669,10 +648,17 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
669
648
  dataInvalid: !!props.error,
670
649
  dataHasSelection: hasProvidedRangeValue
671
650
  },
672
- contentRowClassName: datePickerInputContentRowCva({ size }),
673
- leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
674
- leadingContentClassName: "ml-0!",
675
- trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0
651
+ renderStatic: true,
652
+ onStaticInteract: (focus) => {
653
+ setShouldFocus(focus);
654
+ setRenderInput(true);
655
+ },
656
+ as,
657
+ size,
658
+ variant,
659
+ actionContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
660
+ trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
661
+ children: staticSegments
676
662
  });
677
663
  }
678
664
  if ("formControl" in props && props.formControl) {
@@ -6,12 +6,14 @@ import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
6
6
  import { DatePickerInput } from "../shared/DatePickerInput.js";
7
7
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
8
8
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
9
+ import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
10
+ import { getStaticCalendarDateTimeSegments } from "../shared/staticDateTimeSegments.js";
9
11
  import { FormField } from "../../FormField/FormField.js";
10
- import { StaticInput } from "../../shared/StaticInput.js";
11
12
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
12
14
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
13
- import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { clsx } from "clsx";
15
17
  import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
16
18
  import { useDatePicker, useLocale } from "react-aria";
17
19
  import { mergeRefs } from "@react-aria/utils";
@@ -221,51 +223,55 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
221
223
  setShouldFocus(false);
222
224
  }, [renderInput, shouldFocus]);
223
225
  if (!renderInput) {
226
+ const dateTimeValue = rawValue ? parseDateValue(rawValue) : null;
224
227
  const as = props.as ?? ui.input.as;
225
228
  const size = props.size ?? ui.input.size;
226
229
  const variant = props.variant ?? ui.input.variant;
227
230
  const hideLabel = props.hideLabel ?? ui.input.hideLabel;
228
231
  const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
229
- let isDisabled = !!props.isDisabled;
230
- if (isFormControlDisabled) isDisabled = true;
232
+ const isDisabled = isFormControlDisabled || !!props.isDisabled;
231
233
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
232
234
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
233
235
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
234
236
  const showDropdown = !props.disableDropdown || disableManualEntry;
235
- const staticDateTimeValue = rawValue ? parseDateValue(rawValue) : null;
236
- const displayValue = staticDateTimeValue && "hour" in staticDateTimeValue ? DateTimeUtils.formatCalendarDateTimeLocalized(staticDateTimeValue, locale, { shouldForceLeadingZeros }) : "";
237
- const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale, { shouldForceLeadingZeros });
238
- return /* @__PURE__ */ jsx(StaticInput, {
237
+ const staticSegments = getStaticCalendarDateTimeSegments({
238
+ value: dateTimeValue,
239
+ locale,
240
+ placeholder: props.placeholder,
241
+ shouldForceLeadingZeros,
242
+ isDisabled,
243
+ hidePlaceholder: as === "floating" && !dateTimeValue
244
+ });
245
+ return /* @__PURE__ */ jsx(InputFrame, {
239
246
  ...props,
240
- onInteract: (focus) => {
241
- setShouldFocus(focus);
242
- setRenderInput(true);
243
- },
244
- className: props.className ? `relative inline-flex w-full flex-col text-left ${props.className}` : "relative inline-flex w-full flex-col text-left",
245
- as,
246
- size,
247
- variant,
248
- applyMinInputWidth: true,
249
- hideLabel,
250
247
  isHeaderHidden,
248
+ hideLabel,
251
249
  isDisabled,
252
- placeholder: staticPlaceholder,
253
- displayValue,
254
- isEmpty: !displayValue,
250
+ className: clsx("relative inline-flex w-full flex-col text-left", props.className),
251
+ inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
252
+ contentWrapperClassName: datePickerInputContentRowCva({ size }),
253
+ labelPlacement: "content-row",
255
254
  dataAttributes: {
256
- dataIsEmpty: staticDateTimeValue === null,
257
- dataIsFilled: staticDateTimeValue !== null,
255
+ dataIsEmpty: dateTimeValue === null,
256
+ dataIsFilled: dateTimeValue !== null,
258
257
  dataIsDirty: props.isDirty,
259
258
  dataIsRequired: props.isRequired,
260
259
  dataIsDisabled: isDisabled,
261
260
  dataDisabled: isDisabled,
262
261
  dataInvalid: !!props.error,
263
- dataHasSelection: staticDateTimeValue !== null
262
+ dataHasSelection: dateTimeValue !== null
264
263
  },
265
- contentRowClassName: datePickerInputContentRowCva({ size }),
266
- leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
267
- leadingContentClassName: "ml-0!",
268
- trailingContent: showDropdown ? ui.dateInput.dateTimeIcon : void 0
264
+ renderStatic: true,
265
+ onStaticInteract: (focus) => {
266
+ setShouldFocus(focus);
267
+ setRenderInput(true);
268
+ },
269
+ as,
270
+ size,
271
+ variant,
272
+ actionContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
273
+ trailingContent: showDropdown ? ui.dateInput.dateTimeIcon : void 0,
274
+ children: staticSegments
269
275
  });
270
276
  }
271
277
  if ("formControl" in props && props.formControl) {
@@ -2,11 +2,12 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
2
2
  import { TimePickerForm } from "../shared/TimePickerForm.js";
3
3
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
4
4
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
5
+ import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
6
+ import { getStaticTimeSegments } from "../shared/staticDateTimeSegments.js";
5
7
  import { FormField } from "../../FormField/FormField.js";
6
- import { StaticInput } from "../../shared/StaticInput.js";
7
8
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
9
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
8
10
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
9
- import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
10
11
  import { TimePickerInput } from "../shared/TimePickerInput.js";
11
12
  import { jsx, jsxs } from "react/jsx-runtime";
12
13
  import { clsx } from "clsx";
@@ -168,46 +169,50 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
168
169
  setShouldFocus(false);
169
170
  }, [renderInput, shouldFocus]);
170
171
  if (!renderInput) {
172
+ const timeValue = rawValue ? parseTimeValue(rawValue) : null;
171
173
  const as = props.as ?? ui.input.as;
172
174
  const size = props.size ?? ui.input.size;
173
175
  const variant = props.variant ?? ui.input.variant;
174
176
  const hideLabel = props.hideLabel ?? ui.input.hideLabel;
175
177
  const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
176
- let isDisabled = !!props.isDisabled;
177
- if (isFormControlDisabled) isDisabled = true;
178
+ const isDisabled = isFormControlDisabled || !!props.isDisabled;
178
179
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
179
180
  const showDropdown = !props.disableDropdown || disableManualEntry;
180
- const staticTimeValue = rawValue ? parseTimeValue(rawValue) : null;
181
- const displayValue = staticTimeValue ? DateTimeUtils.formatTimeLocalized(staticTimeValue, locale) : "";
182
- const staticPlaceholder = props.placeholder ?? DateTimeUtils.getTimePlaceholder(locale);
183
- return /* @__PURE__ */ jsx(StaticInput, {
181
+ const staticSegments = getStaticTimeSegments({
182
+ value: timeValue,
183
+ locale,
184
+ placeholder: props.placeholder,
185
+ isDisabled,
186
+ hidePlaceholder: as === "floating" && !timeValue
187
+ });
188
+ return /* @__PURE__ */ jsx(InputFrame, {
184
189
  ...props,
185
- onInteract: (focus) => {
186
- setShouldFocus(focus);
187
- setRenderInput(true);
188
- },
189
- className: clsx("relative inline-flex w-full flex-col text-left", props.className),
190
- as,
191
- size,
192
- variant,
193
- applyMinInputWidth: true,
194
- hideLabel,
195
190
  isHeaderHidden,
191
+ hideLabel,
196
192
  isDisabled,
197
- placeholder: staticPlaceholder,
198
- displayValue,
199
- isEmpty: !displayValue,
193
+ className: clsx("relative inline-flex w-full flex-col text-left", props.className),
194
+ inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
195
+ labelPlacement: "content-row",
200
196
  dataAttributes: {
201
- dataIsEmpty: staticTimeValue === null,
202
- dataIsFilled: staticTimeValue !== null,
197
+ dataIsEmpty: timeValue === null,
198
+ dataIsFilled: timeValue !== null,
203
199
  dataIsDirty: props.isDirty,
204
200
  dataIsRequired: props.isRequired,
205
201
  dataIsDisabled: isDisabled,
206
202
  dataDisabled: isDisabled,
207
203
  dataInvalid: !!props.error,
208
- dataHasSelection: staticTimeValue !== null
204
+ dataHasSelection: timeValue !== null
205
+ },
206
+ renderStatic: true,
207
+ onStaticInteract: (focus) => {
208
+ setShouldFocus(focus);
209
+ setRenderInput(true);
209
210
  },
210
- trailingContent: showDropdown ? ui.dateInput.timeIcon : void 0
211
+ as,
212
+ size,
213
+ variant,
214
+ trailingContent: showDropdown ? ui.dateInput.timeIcon : void 0,
215
+ children: staticSegments
211
216
  });
212
217
  }
213
218
  if ("formControl" in props && props.formControl) {
@@ -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,20 +1,21 @@
1
- import { UIStyle } from "../../../../config/uiStyle.context.js";
2
- import { buttonIconSize } from "../../../buttons/Button/button.cva.js";
1
+ import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
3
2
  import { TodayIcon } from "../../../../assets/icons/Today.js";
4
3
  import { jsx } from "react/jsx-runtime";
5
- import { clsx } from "clsx";
6
- import { isValidElement } from "react";
7
4
  //#region src/components/inputs/DateTime/shared/datePickerTodayIcon.tsx
8
5
  var getDatePickerTodayIcon = (todayIcon) => {
9
6
  if (!todayIcon) return null;
10
7
  return todayIcon === true ? TodayIcon : todayIcon;
11
8
  };
12
9
  var renderDatePickerTodayIcon = (todayIcon, size = "none", className) => {
13
- const buttonIconSizeCva = UIStyle.useCva("button.iconSize", buttonIconSize);
14
10
  const icon = getDatePickerTodayIcon(todayIcon);
15
11
  if (!icon) return;
16
- if (isValidElement(icon)) return icon;
17
- return /* @__PURE__ */ jsx(icon, { className: clsx(buttonIconSizeCva({ size }), "text-interactive-text-secondary-idle", className) });
12
+ return /* @__PURE__ */ jsx(InlineIconButton, {
13
+ label: "",
14
+ icon,
15
+ size,
16
+ staticRender: true,
17
+ className: className ?? "relative z-1 !border-none"
18
+ });
18
19
  };
19
20
  //#endregion
20
21
  export { getDatePickerTodayIcon, renderDatePickerTodayIcon };
@@ -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 {};