@povio/ui 2.2.8-rc → 2.2.9-rc.1

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 (45) hide show
  1. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +2 -1
  2. package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
  3. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +3 -60
  4. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +3 -89
  5. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +3 -60
  6. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +5 -57
  7. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +1 -0
  8. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
  9. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +3 -1
  10. package/dist/components/inputs/File/InputUpload.js +5 -3
  11. package/dist/components/inputs/File/inputUpload.types.d.ts +4 -1
  12. package/dist/components/inputs/File/inputUpload.types.js +9 -0
  13. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +3 -1
  14. package/dist/components/inputs/File/shared/InputUploadContent.d.ts +2 -1
  15. package/dist/components/inputs/File/shared/InputUploadContent.js +4 -3
  16. package/dist/components/inputs/File/shared/InputUploadFilled.d.ts +3 -2
  17. package/dist/components/inputs/File/shared/InputUploadFilled.js +2 -2
  18. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -1
  19. package/dist/components/inputs/Input/NumberInput/NumberInput.js +9 -80
  20. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +0 -1
  21. package/dist/components/inputs/Input/TextInput/TextInput.js +9 -83
  22. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +4 -63
  23. package/dist/components/inputs/Selection/Select/Select.js +4 -64
  24. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +2 -0
  25. package/dist/components/inputs/Selection/shared/SelectBase.js +2 -1
  26. package/dist/components/inputs/Selection/shared/SelectDesktop.js +3 -1
  27. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  28. package/dist/components/inputs/Selection/shared/SelectInput.js +13 -3
  29. package/dist/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -1
  30. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +8 -4
  31. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +5 -3
  32. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +4 -2
  33. package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -2
  34. package/dist/components/inputs/Selection/shared/selectItem.cva.d.ts +6 -0
  35. package/dist/components/inputs/Selection/shared/selectItem.cva.js +21 -0
  36. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
  37. package/dist/components/inputs/TextEditor/TextEditor.js +7 -3
  38. package/dist/config/uiConfig.context.d.ts +1 -2
  39. package/dist/config/uiConfig.context.js +2 -2
  40. package/dist/config/uiStyle.context.d.ts +4 -0
  41. package/dist/utils/date-time.utils.d.ts +0 -10
  42. package/dist/utils/date-time.utils.js +1 -82
  43. package/package.json +1 -1
  44. package/dist/components/inputs/shared/StaticInput.d.ts +0 -18
  45. package/dist/components/inputs/shared/StaticInput.js +0 -69
@@ -1,13 +1,15 @@
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
1
2
  import "../../../../config/i18n.js";
2
3
  import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
3
4
  import { SelectContext } from "./select.context.js";
5
+ import { selectListBoxItemCva } from "./selectItem.cva.js";
4
6
  import { jsx, jsxs } from "react/jsx-runtime";
5
- import { clsx } from "clsx";
6
7
  import { useMemo, useRef } from "react";
7
8
  import { ListBoxItem } from "react-aria-components";
8
9
  import { useTranslation } from "react-i18next";
9
10
  //#region src/components/inputs/Selection/shared/SelectListBoxItem.tsx
10
11
  var SelectListBoxItem = ({ isSearchable, isNewItem, newItemRender, id, label, content, isDisabled }) => {
12
+ const selectListItemCva = UIStyle.useCva("select.listBoxItemCva", selectListBoxItemCva);
11
13
  const ref = useRef(null);
12
14
  const { t } = useTranslation("ui");
13
15
  const { selectedIds, isMultiple } = SelectContext.useSelect();
@@ -26,7 +28,10 @@ var SelectListBoxItem = ({ isSearchable, isNewItem, newItemRender, id, label, co
26
28
  id,
27
29
  textValue: label,
28
30
  isDisabled,
29
- className: clsx(selectListBoxItemClass, !isMultiple && "selected:bg-interactive-contained-primary-idle selected:text-interactive-contained-primary-on-idle", isNewItem ? "text-interactive-text-primary-idle" : "text-interactive-text-secondary-idle"),
31
+ className: selectListItemCva({
32
+ isSingle: !isMultiple,
33
+ isNewItem
34
+ }),
30
35
  children: [
31
36
  isMultiple && !isSearchable && /* @__PURE__ */ jsx(CheckboxCheckmark, {
32
37
  variant: "default",
@@ -45,6 +50,5 @@ var SelectListBoxItem = ({ isSearchable, isNewItem, newItemRender, id, label, co
45
50
  ]
46
51
  });
47
52
  };
48
- var selectListBoxItemClass = clsx("group flex cursor-pointer items-center gap-2 px-list-side-item-left py-list-height-item", "border-b border-b-elevation-outline-default-1 outline-none", "font-labels-default text-interactive-text-secondary-idle text-label-2", "hover:text-interactive-text-secondary-hover", "focus-visible:bg-interactive-contained-primary-focus focus-visible:text-interactive-text-secondary-idle-inverted", "disabled:cursor-default disabled:text-interactive-text-secondary-disabled");
49
53
  //#endregion
50
- export { SelectListBoxItem, selectListBoxItemClass };
54
+ export { SelectListBoxItem };
@@ -1,13 +1,15 @@
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
1
2
  import "../../../../config/i18n.js";
2
3
  import { CheckboxCheckmark } from "../../Checkbox/CheckboxCheckmark.js";
3
4
  import { SelectContext } from "./select.context.js";
4
- import { selectListBoxItemClass } from "./SelectListBoxItem.js";
5
+ import { selectListBoxItemCva } from "./selectItem.cva.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { useRef } from "react";
7
8
  import { ListBoxItem } from "react-aria-components";
8
9
  import { useTranslation } from "react-i18next";
9
10
  //#region src/components/inputs/Selection/shared/SelectListBoxItemSelectAll.tsx
10
11
  var SelectListBoxItemSelectAll = ({ id, label, isDisabled }) => {
12
+ const selectListItemCva = UIStyle.useCva("select.listBoxItemCva", selectListBoxItemCva);
11
13
  const ref = useRef(null);
12
14
  const { t } = useTranslation("ui");
13
15
  const { selectableListItems, selectedIds } = SelectContext.useSelect();
@@ -16,7 +18,7 @@ var SelectListBoxItemSelectAll = ({ id, label, isDisabled }) => {
16
18
  id,
17
19
  textValue: label || t(($) => $.ui.select.allOption),
18
20
  isDisabled,
19
- className: selectListBoxItemClass,
21
+ className: selectListItemCva({}),
20
22
  children: [/* @__PURE__ */ jsx("div", {
21
23
  className: "group",
22
24
  "data-rac": "",
@@ -24,7 +26,7 @@ var SelectListBoxItemSelectAll = ({ id, label, isDisabled }) => {
24
26
  "data-indeterminate": selectedIds.length > 0 && selectedIds.length < selectableListItems.length || void 0,
25
27
  children: /* @__PURE__ */ jsx(CheckboxCheckmark, {
26
28
  variant: "default",
27
- className: "group-focus-visible:!outline-none"
29
+ className: "group-focus-visible:outline-none!"
28
30
  })
29
31
  }), t(($) => $.ui.select.allOption)]
30
32
  });
@@ -1,7 +1,8 @@
1
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
1
2
  import { Loader } from "../../../status/Loader/Loader.js";
2
3
  import "../../../../config/i18n.js";
3
4
  import { SelectContext } from "./select.context.js";
4
- import { selectListBoxItemClass } from "./SelectListBoxItem.js";
5
+ import { selectListBoxItemCva } from "./selectItem.cva.js";
5
6
  import { useIntersectionObserver } from "../../../../hooks/useIntersectionObserver.js";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
  import { useCallback } from "react";
@@ -9,6 +10,7 @@ import { ListBoxItem } from "react-aria-components";
9
10
  import { useTranslation } from "react-i18next";
10
11
  //#region src/components/inputs/Selection/shared/SelectListBoxLoadingItem.tsx
11
12
  var SelectListBoxLoadingItem = ({ id, label, onLoadMore }) => {
13
+ const selectListItemCva = UIStyle.useCva("select.listBoxItemCva", selectListBoxItemCva);
12
14
  const { t } = useTranslation("ui");
13
15
  const { isDebouncing, isLoading, hasLoadMore } = SelectContext.useSelect();
14
16
  const { ref } = useIntersectionObserver({
@@ -26,7 +28,7 @@ var SelectListBoxLoadingItem = ({ id, label, onLoadMore }) => {
26
28
  id,
27
29
  textValue: label || t(($) => $.ui.loadingState.text),
28
30
  isDisabled: true,
29
- className: selectListBoxItemClass,
31
+ className: selectListItemCva({}),
30
32
  children: /* @__PURE__ */ jsx("div", {
31
33
  ref,
32
34
  className: "flex flex-1 justify-center text-interactive-text-primary-idle",
@@ -14,7 +14,7 @@ import { DialogTrigger } from "react-aria-components";
14
14
  import { useLabel } from "react-aria";
15
15
  //#region src/components/inputs/Selection/shared/SelectMobile.tsx
16
16
  var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }) => {
17
- const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, collapseAfter, selectedTagsType } = props;
17
+ const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, size, collapseAfter, selectedTagsType } = props;
18
18
  const formFieldProps = {
19
19
  error,
20
20
  label,
@@ -68,6 +68,7 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
68
68
  placeholder,
69
69
  variant,
70
70
  as,
71
+ size,
71
72
  isDisabled,
72
73
  isInvalid: !!error,
73
74
  className,
@@ -79,7 +80,9 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
79
80
  fieldProps,
80
81
  headerProps,
81
82
  collapseAfter,
82
- selectedTagsType
83
+ selectedTagsType,
84
+ isRequired,
85
+ isDirty
83
86
  }), /* @__PURE__ */ jsx(BottomSheet, {
84
87
  isOpen,
85
88
  onOpenChange: handleOpenChange,
@@ -0,0 +1,6 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export declare const selectListBoxItemCva: (props?: ({
3
+ isSingle?: boolean | null | undefined;
4
+ isNewItem?: boolean | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
+ export type SelectListBoxItemCva = VariantProps<typeof selectListBoxItemCva>;
@@ -0,0 +1,21 @@
1
+ import { cva } from "class-variance-authority";
2
+ //#region src/components/inputs/Selection/shared/selectItem.cva.ts
3
+ var selectListBoxItemCva = cva([
4
+ "group flex cursor-pointer items-center gap-2 px-list-side-item-left py-list-height-item",
5
+ "border-b border-b-elevation-outline-default-1 outline-none",
6
+ "font-labels-default text-label-2",
7
+ "hover:text-interactive-text-secondary-hover",
8
+ "focus-visible:bg-interactive-contained-primary-focus focus-visible:text-interactive-text-secondary-idle-inverted",
9
+ "disabled:cursor-default disabled:text-interactive-text-secondary-disabled"
10
+ ], {
11
+ variants: {
12
+ isSingle: { true: "selected:bg-interactive-contained-primary-idle selected:text-interactive-contained-primary-on-idle" },
13
+ isNewItem: {
14
+ true: "text-interactive-text-primary-idle",
15
+ false: "text-interactive-text-secondary-idle"
16
+ }
17
+ },
18
+ defaultVariants: { isNewItem: false }
19
+ });
20
+ //#endregion
21
+ export { selectListBoxItemCva };
@@ -15,6 +15,7 @@ export interface TextEditorBaseProps extends FormFieldProps {
15
15
  onBlur?: () => void;
16
16
  as?: "default" | "filter" | "floating" | "inline" | null;
17
17
  editorClassName?: string;
18
+ isDirty?: boolean;
18
19
  }
19
20
  export type TextEditorProps = TextEditorBaseProps;
20
21
  export type ControlledTextEditorProps<TFieldValues extends FieldValues> = ControlProps<TextEditorProps, TFieldValues>;
@@ -37,7 +37,7 @@ var extensions = [
37
37
  defaultProtocol: "https"
38
38
  })
39
39
  ];
40
- var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, value, className, editorClassName, onChange, onBlur }) => {
40
+ var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, value, className, editorClassName, isDirty, onChange, onBlur }) => {
41
41
  const contentRef = useRef(null);
42
42
  const { hoverProps, isHovered } = useHover({ isDisabled });
43
43
  const [isFocused, setIsFocused] = useState(false);
@@ -109,6 +109,8 @@ var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tool
109
109
  "data-focus-within": isFocused || void 0,
110
110
  "data-focus-visible": isFocused && isFocusVisible || void 0,
111
111
  "data-is-filled": !editor?.isEmpty,
112
+ "data-is-required": isRequired || void 0,
113
+ "data-is-dirty": isDirty || void 0,
112
114
  ...hoverProps,
113
115
  ...focusWithinProps,
114
116
  ...fieldProps,
@@ -136,13 +138,15 @@ var TextEditor = (props) => {
136
138
  return /* @__PURE__ */ jsx(Controller, {
137
139
  control: formControl.control,
138
140
  name: formControl.name,
139
- render: ({ field }) => /* @__PURE__ */ jsx(TextEditorBase, {
141
+ render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TextEditorBase, {
140
142
  ...innerProps,
141
143
  ref: mergeRefs(ref, field.ref),
142
144
  value: field.value,
143
145
  onChange: field.onChange,
144
146
  onBlur: field.onBlur,
145
- isDisabled: field.disabled || props.isDisabled
147
+ isDirty,
148
+ isDisabled: field.disabled || props.isDisabled,
149
+ error: props.error ?? error?.message
146
150
  })
147
151
  });
148
152
  }
@@ -19,13 +19,12 @@ export declare namespace UIConfig {
19
19
  [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
20
20
  };
21
21
  export interface Options {
22
- renderStaticInput: boolean;
23
22
  input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size">;
24
23
  button: Pick<ButtonProps, "variant" | "size">;
25
24
  numberInput: Pick<NumberInputProps, "formatOptions">;
26
25
  radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel">;
27
26
  checkbox: Pick<CheckboxProps, "variant">;
28
- select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType" | "hideSearchIcon">;
27
+ select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType" | "hideSearchIcon" | "fireBlurOnChange">;
29
28
  toggle: Pick<ToggleProps, "variant">;
30
29
  slider: Pick<SliderProps, "minValue" | "maxValue">;
31
30
  dateInput: Pick<DatePickerProps, "todayIcon" | "shouldForceLeadingZeros" | "disableManualEntry">;
@@ -6,7 +6,6 @@ import { createContext, use } from "react";
6
6
  var UIConfig;
7
7
  (function(_UIConfig) {
8
8
  const DEFAULT_CONFIG = {
9
- renderStaticInput: true,
10
9
  input: {
11
10
  variant: "outlined",
12
11
  as: "default",
@@ -32,7 +31,8 @@ var UIConfig;
32
31
  isSearchable: false,
33
32
  selectedTagsType: "list",
34
33
  collapseAfter: 3,
35
- hideSearchIcon: false
34
+ hideSearchIcon: false,
35
+ fireBlurOnChange: false
36
36
  },
37
37
  toggle: { variant: "default" },
38
38
  slider: {
@@ -24,6 +24,7 @@ import { LinkVariantProps } from '../components/text/Link/link.cva';
24
24
  import { TagVariantProps } from '../components/text/Tag/tag.cva';
25
25
  import { TypographyVariantProps } from '../components/text/Typography/typography.cva';
26
26
  import { CompoundMapper, ConfigSchema } from '../utils/compoundMapper';
27
+ import { SelectListBoxItemCva } from '../components/inputs/Selection/shared/selectItem.cva';
27
28
  export declare namespace UIStyle {
28
29
  export type Cva<T> = (props: (T & ClassProp) | ClassProp) => string;
29
30
  type OptionKey = {
@@ -147,6 +148,9 @@ export declare namespace UIStyle {
147
148
  errorLabelCva?: Cva<FormFieldErrorVariantProps>;
148
149
  helperLabelCva?: Cva<FormFieldHelperVariantProps>;
149
150
  };
151
+ select: {
152
+ listBoxItemCva?: Cva<SelectListBoxItemCva>;
153
+ };
150
154
  }
151
155
  interface ProviderProps {
152
156
  config?: Partial<Options>;
@@ -1,15 +1,5 @@
1
1
  import { CalendarDate, CalendarDateTime, DateValue, ZonedDateTime } from '@internationalized/date';
2
2
  export declare namespace DateTimeUtils {
3
- function getDatePlaceholder(locale?: string): string;
4
- function getTimePlaceholder(locale?: string): string;
5
- function getDateTimePlaceholder(locale?: string): string;
6
- function getDateRangePlaceholder(locale?: string): string;
7
- function formatCalendarDateLocalized(calendarDate: CalendarDate, locale?: string): string;
8
- function formatTimeLocalized(timeValue: {
9
- hour: number;
10
- minute: number;
11
- }, locale?: string): string;
12
- function formatCalendarDateTimeLocalized(calendarDateTime: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute">, locale?: string): string;
13
3
  function fromISOtoZonedDateTime(isoString: string): ZonedDateTime;
14
4
  function fromDateValueToISO(dateValue: DateValue): string;
15
5
  function fromLocalToZonedDateTime(date: Date): ZonedDateTime;
@@ -1,88 +1,7 @@
1
- import { CalendarDate, CalendarDateTime, DateFormatter, fromDate, getLocalTimeZone, parseAbsolute, parseAbsoluteToLocal } from "@internationalized/date";
1
+ import { CalendarDate, CalendarDateTime, fromDate, getLocalTimeZone, parseAbsolute, parseAbsoluteToLocal } from "@internationalized/date";
2
2
  //#region src/utils/date-time.utils.ts
3
3
  var DateTimeUtils;
4
4
  (function(_DateTimeUtils) {
5
- const DATE_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22));
6
- const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22, 13, 45));
7
- const getDatePlaceholderFormatter = (locale) => new Intl.DateTimeFormat(locale, {
8
- day: "2-digit",
9
- month: "2-digit",
10
- year: "numeric"
11
- });
12
- const getTimePlaceholderFormatter = (locale) => new Intl.DateTimeFormat(locale, {
13
- hour: "2-digit",
14
- minute: "2-digit",
15
- hourCycle: "h23"
16
- });
17
- const getResolvedLocale = (locale) => {
18
- if (locale) return locale;
19
- return new Intl.DateTimeFormat().resolvedOptions().locale;
20
- };
21
- const getDateFormatter = (locale) => new DateFormatter(getResolvedLocale(locale), {
22
- day: "2-digit",
23
- month: "2-digit",
24
- year: "numeric",
25
- timeZone: "UTC"
26
- });
27
- const getTimeFormatter = (locale) => new DateFormatter(getResolvedLocale(locale), {
28
- hour: "2-digit",
29
- minute: "2-digit",
30
- hourCycle: "h23",
31
- timeZone: "UTC"
32
- });
33
- const getDateTimeFormatter = (locale) => new DateFormatter(getResolvedLocale(locale), {
34
- day: "2-digit",
35
- month: "2-digit",
36
- year: "numeric",
37
- hour: "2-digit",
38
- minute: "2-digit",
39
- hourCycle: "h23",
40
- timeZone: "UTC"
41
- });
42
- const mapTypeToPlaceholder = (type) => {
43
- 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
- default: return null;
50
- }
51
- };
52
- const formatPlaceholder = (formatter, sampleDate) => {
53
- return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type) ?? part.value).join("");
54
- };
55
- function getDatePlaceholder(locale) {
56
- return formatPlaceholder(getDatePlaceholderFormatter(locale), DATE_SAMPLE_DATE_UTC);
57
- }
58
- _DateTimeUtils.getDatePlaceholder = getDatePlaceholder;
59
- function getTimePlaceholder(locale) {
60
- return formatPlaceholder(getTimePlaceholderFormatter(locale), TIME_SAMPLE_DATE_UTC);
61
- }
62
- _DateTimeUtils.getTimePlaceholder = getTimePlaceholder;
63
- function getDateTimePlaceholder(locale) {
64
- return `${getDatePlaceholder(locale)}, ${getTimePlaceholder(locale)}`;
65
- }
66
- _DateTimeUtils.getDateTimePlaceholder = getDateTimePlaceholder;
67
- function getDateRangePlaceholder(locale) {
68
- const datePlaceholder = getDatePlaceholder(locale);
69
- return `${datePlaceholder} – ${datePlaceholder}`;
70
- }
71
- _DateTimeUtils.getDateRangePlaceholder = getDateRangePlaceholder;
72
- function formatCalendarDateLocalized(calendarDate, locale) {
73
- return getDateFormatter(locale).format(calendarDate.toDate("UTC"));
74
- }
75
- _DateTimeUtils.formatCalendarDateLocalized = formatCalendarDateLocalized;
76
- function formatTimeLocalized(timeValue, locale) {
77
- const dateTime = new CalendarDateTime(2e3, 11, 22, timeValue.hour, timeValue.minute);
78
- return getTimeFormatter(locale).format(dateTime.toDate("UTC"));
79
- }
80
- _DateTimeUtils.formatTimeLocalized = formatTimeLocalized;
81
- function formatCalendarDateTimeLocalized(calendarDateTime, locale) {
82
- const normalizedValue = new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute);
83
- return getDateTimeFormatter(locale).format(normalizedValue.toDate("UTC"));
84
- }
85
- _DateTimeUtils.formatCalendarDateTimeLocalized = formatCalendarDateTimeLocalized;
86
5
  function fromISOtoZonedDateTime(isoString) {
87
6
  return parseAbsoluteToLocal(isoString);
88
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.8-rc",
3
+ "version": "2.2.9-rc.1",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,18 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { FormFieldProps } from '../FormField/FormField';
3
- import { TextInputProps } from '../Input/TextInput/TextInput';
4
- import { InputSizeProps, InputVariantProps } from './input.cva';
5
- interface StaticInputProps extends FormFieldProps {
6
- onInteract: (shouldFocus: boolean) => void;
7
- as?: TextInputProps["as"];
8
- size?: InputSizeProps["size"];
9
- variant?: InputVariantProps["variant"];
10
- placeholder?: ReactNode;
11
- displayValue?: ReactNode;
12
- isEmpty?: boolean;
13
- leadingVisual?: ReactNode;
14
- trailingVisual?: ReactNode;
15
- inputClassName?: string;
16
- }
17
- export declare const StaticInput: ({ onInteract, as, size, variant, placeholder, displayValue, isEmpty, leadingVisual, trailingVisual, inputClassName, className, ...formFieldProps }: StaticInputProps) => import("react/jsx-runtime").JSX.Element;
18
- export {};
@@ -1,69 +0,0 @@
1
- import { UIStyle } from "../../../config/uiStyle.context.js";
2
- import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
3
- import { inputBase, inputSize } from "./input.cva.js";
4
- import { FormField } from "../FormField/FormField.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { clsx } from "clsx";
7
- //#region src/components/inputs/shared/StaticInput.tsx
8
- var StaticInput = ({ onInteract, as, size, variant, placeholder, displayValue, isEmpty, leadingVisual, trailingVisual, inputClassName, className, ...formFieldProps }) => {
9
- const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
10
- const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
11
- let hasValue = !!displayValue;
12
- if (isEmpty != null) hasValue = !isEmpty;
13
- let staticDisplayContent = placeholder;
14
- if (hasValue) staticDisplayContent = displayValue;
15
- else if (as === "floating") staticDisplayContent = null;
16
- const shouldRenderFloatingLineSpacer = as === "floating" && !hasValue;
17
- return /* @__PURE__ */ jsx(FormField, {
18
- ...formFieldProps,
19
- as,
20
- className,
21
- onMouseEnter: () => onInteract(false),
22
- tabIndex: as === "inline" ? -1 : void 0,
23
- children: /* @__PURE__ */ jsxs("div", {
24
- tabIndex: formFieldProps.isDisabled ? -1 : 0,
25
- onFocus: () => onInteract(true),
26
- onClick: () => onInteract(true),
27
- onPointerDown: () => onInteract(true),
28
- "data-is-empty": !hasValue || void 0,
29
- "data-disabled": formFieldProps.isDisabled || void 0,
30
- "data-is-disabled": formFieldProps.isDisabled || void 0,
31
- "data-has-selection": hasValue || void 0,
32
- "data-rac": "",
33
- className: clsx("group/static-input group/input-content group/select-content relative flex min-w-input-width-min-width items-center justify-between gap-input-gap-input-text-to-elements", inputBaseCva({
34
- as,
35
- variant
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,
49
- 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", {
59
- className: clsx(inputSizeCva({
60
- size,
61
- as
62
- }), "pointer-events-none flex items-center gap-input-gap-trailing-elements py-0! pl-0!"),
63
- children: trailingVisual
64
- })]
65
- })
66
- });
67
- };
68
- //#endregion
69
- export { StaticInput };