@povio/ui 2.2.8-rc → 2.2.8

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 (35) 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 +2 -56
  7. package/dist/components/inputs/File/InputUpload.js +5 -3
  8. package/dist/components/inputs/File/inputUpload.types.d.ts +4 -1
  9. package/dist/components/inputs/File/inputUpload.types.js +9 -0
  10. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +3 -1
  11. package/dist/components/inputs/File/shared/InputUploadContent.d.ts +2 -1
  12. package/dist/components/inputs/File/shared/InputUploadContent.js +4 -3
  13. package/dist/components/inputs/File/shared/InputUploadFilled.d.ts +3 -2
  14. package/dist/components/inputs/File/shared/InputUploadFilled.js +2 -2
  15. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -1
  16. package/dist/components/inputs/Input/NumberInput/NumberInput.js +8 -80
  17. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +0 -1
  18. package/dist/components/inputs/Input/TextInput/TextInput.js +8 -83
  19. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +2 -62
  20. package/dist/components/inputs/Selection/Select/Select.js +2 -63
  21. package/dist/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -1
  22. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +8 -4
  23. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +5 -3
  24. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +4 -2
  25. package/dist/components/inputs/Selection/shared/SelectMobile.js +2 -1
  26. package/dist/components/inputs/Selection/shared/selectItem.cva.d.ts +6 -0
  27. package/dist/components/inputs/Selection/shared/selectItem.cva.js +21 -0
  28. package/dist/config/uiConfig.context.d.ts +0 -1
  29. package/dist/config/uiConfig.context.js +0 -1
  30. package/dist/config/uiStyle.context.d.ts +4 -0
  31. package/dist/utils/date-time.utils.d.ts +0 -10
  32. package/dist/utils/date-time.utils.js +1 -82
  33. package/package.json +1 -1
  34. package/dist/components/inputs/shared/StaticInput.d.ts +0 -18
  35. package/dist/components/inputs/shared/StaticInput.js +0 -69
@@ -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.8",
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 };