@povio/ui 2.1.4 → 2.1.6

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.
@@ -10,7 +10,7 @@ const CheckboxCheckmarkIcon = (props) => /* @__PURE__ */ jsx(
10
10
  children: /* @__PURE__ */ jsx(
11
11
  "path",
12
12
  {
13
- stroke: "#F8F8FA",
13
+ stroke: "currentColor",
14
14
  strokeLinecap: "round",
15
15
  strokeLinejoin: "round",
16
16
  strokeWidth: 2,
@@ -10,7 +10,7 @@ const CheckboxIndeterminateIcon = (props) => /* @__PURE__ */ jsx(
10
10
  children: /* @__PURE__ */ jsx(
11
11
  "path",
12
12
  {
13
- stroke: "#F8F8FA",
13
+ stroke: "currentColor",
14
14
  strokeLinecap: "round",
15
15
  strokeLinejoin: "round",
16
16
  strokeWidth: 2,
@@ -10,7 +10,7 @@ const DragIcon = (props) => /* @__PURE__ */ jsx(
10
10
  children: /* @__PURE__ */ jsx(
11
11
  "path",
12
12
  {
13
- fill: "#6D7688",
13
+ fill: "currentColor",
14
14
  d: "M9 19.615q-.666 0-1.14-.474A1.56 1.56 0 0 1 7.384 18q0-.666.474-1.14A1.56 1.56 0 0 1 9 16.384q.666 0 1.14.474.475.475.475 1.141t-.474 1.14A1.56 1.56 0 0 1 9 19.616m6 0q-.666 0-1.14-.474A1.56 1.56 0 0 1 13.384 18q0-.666.474-1.14A1.56 1.56 0 0 1 15 16.384q.666 0 1.14.474.475.475.475 1.141t-.474 1.14a1.56 1.56 0 0 1-1.141.475m-6-6q-.666 0-1.14-.474A1.56 1.56 0 0 1 7.384 12q0-.666.474-1.14A1.56 1.56 0 0 1 9 10.384q.666 0 1.14.474.475.475.475 1.141t-.474 1.14A1.56 1.56 0 0 1 9 13.616m6 0q-.666 0-1.14-.474A1.56 1.56 0 0 1 13.384 12q0-.666.474-1.14A1.56 1.56 0 0 1 15 10.384q.666 0 1.14.474.475.475.475 1.141t-.474 1.14a1.56 1.56 0 0 1-1.141.475m-6-6q-.666 0-1.14-.474A1.56 1.56 0 0 1 7.384 6q0-.666.474-1.14A1.56 1.56 0 0 1 9 4.384q.666 0 1.14.474.475.475.475 1.141t-.474 1.14A1.56 1.56 0 0 1 9 7.616m6 0q-.666 0-1.14-.474A1.56 1.56 0 0 1 13.384 6q0-.666.474-1.14A1.56 1.56 0 0 1 15 4.384q.666 0 1.14.474.475.475.475 1.141t-.474 1.14A1.56 1.56 0 0 1 15 7.616"
15
15
  }
16
16
  )
@@ -7,14 +7,14 @@ const checkbox = cva(
7
7
  variants: {
8
8
  variant: {
9
9
  default: [
10
- "m-1 border-interactive-contained-secondary-idle",
10
+ "m-1 border-interactive-outlined-secondary-on-idle",
11
11
  "text-interactive-contained-primary-on-idle",
12
12
  "group-hover:text-interactive-contained-primary-on-hover",
13
13
  "group-pressed:text-interactive-contained-primary-on-pressed",
14
14
  "group-disabled:text-interactive-contained-primary-on-disabled",
15
- "group-disabled:border-interactive-contained-secondary-disabled",
16
- "group-hover:border-interactive-contained-secondary-hover",
17
- "group-pressed:border-interactive-contained-secondary-pressed",
15
+ "group-disabled:border-interactive-outlined-secondary-on-disabled",
16
+ "group-hover:border-interactive-outlined-secondary-on-hover",
17
+ "group-pressed:border-interactive-outlined-secondary-on-pressed",
18
18
  "group-selected:border-interactive-contained-primary-idle",
19
19
  "group-selected:bg-interactive-contained-primary-idle",
20
20
  "group-selected:group-hover:bg-interactive-contained-primary-hover",
@@ -27,7 +27,7 @@ const checkbox = cva(
27
27
  "group-indeterminate:group-hover:border-interactive-contained-primary-hover",
28
28
  "group-indeterminate:group-pressed:bg-interactive-contained-primary-pressed",
29
29
  "group-indeterminate:group-pressed:border-interactive-contained-primary-pressed",
30
- "group-invalid:border-interactive-contained-error-idle",
30
+ "group-invalid:border-interactive-outlined-error-on-idle",
31
31
  "group-focus-visible:outline-interactive-contained-primary-focus"
32
32
  ]
33
33
  }
@@ -153,6 +153,7 @@ const DatePickerBase = (props) => {
153
153
  footer: /* @__PURE__ */ jsx(
154
154
  DateTimeDialogFooter,
155
155
  {
156
+ isDisabled,
156
157
  isValid: !dialogState.isInvalid && !!dialogState.value,
157
158
  onTodayPress,
158
159
  onApply
@@ -555,6 +555,7 @@ const DateRangePickerBase = (props) => {
555
555
  footer: /* @__PURE__ */ jsx(
556
556
  DateTimeDialogFooter,
557
557
  {
558
+ isDisabled,
558
559
  isValid: !dialogState.isInvalid && !!dialogState.value,
559
560
  onTodayPress,
560
561
  onApply
@@ -176,6 +176,7 @@ const DateTimePickerBase = (props) => {
176
176
  footer: /* @__PURE__ */ jsx(
177
177
  DateTimeDialogFooter,
178
178
  {
179
+ isDisabled,
179
180
  isValid: !dialogState.isInvalid && !!dialogState.value,
180
181
  onTodayPress,
181
182
  onApply
@@ -162,6 +162,7 @@ const TimePickerBase = (props) => {
162
162
  footer: /* @__PURE__ */ jsx(
163
163
  DateTimeDialogFooter,
164
164
  {
165
+ isDisabled,
165
166
  onApply,
166
167
  isValid: !dialogState.isInvalid && !!dialogState.value
167
168
  }
@@ -136,7 +136,7 @@ const DatePickerInput = ({
136
136
  }
137
137
  ),
138
138
  endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [
139
- !((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", { className: "select-none", children: "–" }),
139
+ !((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", { className: clsx("select-none", isDisabled && "text-interactive-text-secondary-disabled"), children: "–" }),
140
140
  /* @__PURE__ */ jsx(
141
141
  DateField,
142
142
  {
@@ -1,7 +1,8 @@
1
1
  interface DatePickerFooterProps {
2
2
  isValid?: boolean;
3
+ isDisabled?: boolean;
3
4
  onTodayPress?: () => void;
4
5
  onApply: () => void;
5
6
  }
6
- export declare const DateTimeDialogFooter: ({ isValid, onTodayPress, onApply }: DatePickerFooterProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const DateTimeDialogFooter: ({ isValid, isDisabled, onTodayPress, onApply, }: DatePickerFooterProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -3,7 +3,12 @@ import { clsx } from "clsx";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { TextButton } from "../../../buttons/TextButton/TextButton.js";
5
5
  import { ns } from "../../../../config/i18n.js";
6
- const DateTimeDialogFooter = ({ isValid = true, onTodayPress, onApply }) => {
6
+ const DateTimeDialogFooter = ({
7
+ isValid = true,
8
+ isDisabled = false,
9
+ onTodayPress,
10
+ onApply
11
+ }) => {
7
12
  const { t } = useTranslation(ns);
8
13
  return /* @__PURE__ */ jsxs(
9
14
  "footer",
@@ -18,6 +23,7 @@ const DateTimeDialogFooter = ({ isValid = true, onTodayPress, onApply }) => {
18
23
  {
19
24
  type: "button",
20
25
  color: "primary",
26
+ isDisabled,
21
27
  onPress: onTodayPress,
22
28
  children: t(($) => $.ui.datePicker.today)
23
29
  }
@@ -12,10 +12,10 @@ const radio = cva(
12
12
  variants: {
13
13
  variant: {
14
14
  default: [
15
- "border-interactive-contained-secondary-idle",
16
- "group-disabled:border-interactive-contained-secondary-disabled",
17
- "group-hover:border-interactive-contained-secondary-hover",
18
- "group-pressed:border-interactive-contained-secondary-pressed",
15
+ "border-interactive-outlined-secondary-on-idle",
16
+ "group-disabled:border-interactive-outlined-secondary-on-disabled",
17
+ "group-hover:border-interactive-outlined-secondary-on-hover",
18
+ "group-pressed:border-interactive-outlined-secondary-on-pressed",
19
19
  "group-selected:border-interactive-contained-primary-idle",
20
20
  "group-selected:bg-interactive-contained-primary-idle",
21
21
  "group-selected:group-hover:bg-interactive-contained-primary-hover",
@@ -30,7 +30,7 @@ const radio = cva(
30
30
  "group-indeterminate:group-hover:border-interactive-contained-primary-hover",
31
31
  "group-indeterminate:group-pressed:bg-interactive-contained-primary-pressed",
32
32
  "group-indeterminate:group-pressed:border-interactive-contained-primary-pressed",
33
- "group-invalid:border-interactive-contained-error-idle",
33
+ "group-invalid:border-interactive-outlined-error-on-idle",
34
34
  "group-focus-visible:outline-interactive-contained-primary-focus",
35
35
  "before:bg-interactive-contained-primary-on-idle",
36
36
  "group-hover:before:bg-interactive-contained-primary-on-hover",
@@ -32,7 +32,7 @@ const ActionModal = ({
32
32
  size: "title-5",
33
33
  variant: "prominent-1",
34
34
  as: "h2",
35
- className: textAlignClass,
35
+ className: clsx("text-text-default-1", textAlignClass),
36
36
  children: heading
37
37
  }
38
38
  ),
@@ -40,7 +40,7 @@ const ActionModal = ({
40
40
  Typography,
41
41
  {
42
42
  size: "body-3",
43
- className: textAlignClass,
43
+ className: clsx("text-text-default-1", textAlignClass),
44
44
  children: description
45
45
  }
46
46
  )
@@ -4,8 +4,9 @@ import { useFocusable } from "react-aria";
4
4
  import { TooltipTrigger, Tooltip as Tooltip$1, OverlayArrow } from "react-aria-components";
5
5
  import { PointerHorizontalIcon } from "../../../assets/icons/PointerHorizontal.js";
6
6
  import { PointerVerticalIcon } from "../../../assets/icons/PointerVertical.js";
7
- import { tooltipCva, tooltipPointerHorizontalCva, tooltipPointerVerticalCva, tooltipTextCva } from "./tooltip.cva.js";
7
+ import { tooltipCva, tooltipTextCva, tooltipPointerHorizontalCva, tooltipPointerVerticalCva } from "./tooltip.cva.js";
8
8
  import { Typography } from "../../text/Typography/Typography.js";
9
+ import { UIStyle } from "../../../config/uiStyle.context.js";
9
10
  const CustomTrigger = ({ children, className }) => {
10
11
  const ref = useRef(null);
11
12
  const { focusableProps } = useFocusable({}, ref);
@@ -31,6 +32,9 @@ const Tooltip = ({
31
32
  triggerClassName,
32
33
  ...tooltipProps
33
34
  }) => {
35
+ const uiStyle = UIStyle.useConfig();
36
+ const tooltipCva$1 = uiStyle?.tooltip?.cva ?? tooltipCva;
37
+ const tooltipTextCva$1 = uiStyle?.tooltip?.textCva ?? tooltipTextCva;
34
38
  const Trigger = isNonInteractiveTrigger ? CustomTrigger : Fragment;
35
39
  return /* @__PURE__ */ jsxs(
36
40
  TooltipTrigger,
@@ -51,7 +55,7 @@ const Tooltip = ({
51
55
  /* @__PURE__ */ jsxs(
52
56
  Tooltip$1,
53
57
  {
54
- className: tooltipCva({ color }),
58
+ className: tooltipCva$1({ color }),
55
59
  ...tooltipProps,
56
60
  offset: 13,
57
61
  children: [
@@ -64,7 +68,7 @@ const Tooltip = ({
64
68
  {
65
69
  size: "body-4",
66
70
  variant: "prominent-1",
67
- className: tooltipTextCva({ color }),
71
+ className: tooltipTextCva$1({ color }),
68
72
  children: text
69
73
  }
70
74
  )
@@ -7,7 +7,7 @@ const CellText = ({ children, style, className }) => /* @__PURE__ */ jsx(
7
7
  variant: "default",
8
8
  size: "label-1",
9
9
  as: "span",
10
- className: clsx("block overflow-hidden text-ellipsis px-2 py-1-5 text-text-default-2", className),
10
+ className: clsx("block overflow-hidden text-ellipsis text-text-default-2", className),
11
11
  style,
12
12
  "data-rac": true,
13
13
  children
@@ -6,7 +6,7 @@ const tableRow = cva(
6
6
  "disabled:opacity-50",
7
7
  "selected:bg-elevation-fill-default-2",
8
8
  "hover:selected:bg-interactive-subtle-secondary-hover",
9
- "clickable:cursor-pointer",
9
+ "data-clickable:cursor-pointer",
10
10
  "focus-within:bg-elevation-fill-default-2"
11
11
  ],
12
12
  {
@@ -37,7 +37,7 @@ const tableHeadData = cva(
37
37
  );
38
38
  const tableData = cva(
39
39
  [
40
- "relative h-0-5 overflow-hidden text-ellipsis whitespace-nowrap border-t border-t-transparent px-2 py-2",
40
+ "relative h-0-5 overflow-hidden text-ellipsis whitespace-nowrap border-t border-t-transparent px-2",
41
41
  "border-b border-b-elevation-outline-default-1",
42
42
  "has-[*>[data-hovered]:not([data-disabled])]:hover:border-b-input-outlined-outline-hover",
43
43
  "has-[*>[data-invalid]]:border-b-input-outlined-outline-error!",
@@ -45,8 +45,12 @@ var ThemeContext;
45
45
  document.documentElement.classList.remove("dark");
46
46
  if ((!theme || theme === "system") && systemTheme === "dark" || theme === "dark") {
47
47
  document.documentElement.classList.add("dark");
48
+ document.documentElement.style.colorScheme = "dark";
48
49
  } else if (theme === "light") {
49
50
  document.documentElement.classList.add("light");
51
+ document.documentElement.style.colorScheme = "light";
52
+ } else {
53
+ document.documentElement.style.colorScheme = "light";
50
54
  }
51
55
  }, [theme, systemTheme]);
52
56
  const contextValue = useMemo(
@@ -7,6 +7,7 @@ import { RadioVariantProps } from '../components/inputs/RadioGroup/radio.cva';
7
7
  import { InputBaseProps, InputSideProps, InputSizeProps } from '../components/inputs/shared/input.cva';
8
8
  import { LabelBaseProps } from '../components/inputs/shared/label.cva';
9
9
  import { ToggleVariantProps } from '../components/inputs/Toggle/toggle.cva';
10
+ import { TooltipTextVariantProps, TooltipVariantProps } from '../components/overlays/Tooltip/tooltip.cva';
10
11
  import { AlertVariantProps } from '../components/status/Alert/alert.cva';
11
12
  import { ToastVariantProps } from '../components/status/Toast/toast.cva';
12
13
  import { TableDataVariantProps, TableHeadDataVariantProps, TableHeadRowVariantProps, TableRowVariantProps } from '../components/table/table.cva';
@@ -75,6 +76,10 @@ export declare namespace UIStyle {
75
76
  rowCva?: Cva<TableRowVariantProps>;
76
77
  dataCva?: Cva<TableDataVariantProps>;
77
78
  };
79
+ tooltip: {
80
+ cva?: Cva<TooltipVariantProps>;
81
+ textCva?: Cva<TooltipTextVariantProps>;
82
+ };
78
83
  }
79
84
  interface ProviderProps {
80
85
  config?: Partial<Options>;
@@ -1,3 +1,5 @@
1
+ import { ToRelativeOptions } from 'luxon';
1
2
  export declare namespace DateUtils {
2
3
  function formatDate(date: Date, format?: string): string;
4
+ function formatRelativeTime(date: Date | string, options?: ToRelativeOptions): string;
3
5
  }
@@ -2,10 +2,21 @@ import { DateTime } from "luxon";
2
2
  var DateUtils;
3
3
  ((DateUtils2) => {
4
4
  const DATE_FORMAT = "dd/MM/yyyy";
5
+ const DATETIME_FORMAT = "dd/MM/yyyy HH:mm:ss";
5
6
  function formatDate(date, format = DATE_FORMAT) {
6
7
  return DateTime.fromJSDate(date).toFormat(format);
7
8
  }
8
9
  DateUtils2.formatDate = formatDate;
10
+ function formatRelativeTime(date, options) {
11
+ const dateTime = typeof date === "string" ? DateTime.fromISO(date) : DateTime.fromJSDate(date);
12
+ if (!dateTime.isValid) {
13
+ const dateObj = typeof date === "string" ? new Date(date) : date;
14
+ return formatDate(dateObj, DATETIME_FORMAT);
15
+ }
16
+ const relative = dateTime.toRelative(options);
17
+ return relative || formatDate(dateTime.toJSDate(), DATETIME_FORMAT);
18
+ }
19
+ DateUtils2.formatRelativeTime = formatRelativeTime;
9
20
  })(DateUtils || (DateUtils = {}));
10
21
  export {
11
22
  DateUtils
@@ -16,7 +16,7 @@ export declare namespace AuthContext {
16
16
  loadingState?: ReactNode;
17
17
  }
18
18
  type ProviderProps<TUser = unknown> = Type<TUser>;
19
- export const Provider: <TUser = unknown>({ isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState, children, }: PropsWithChildren<ProviderProps<TUser>>) => import("react/jsx-runtime").JSX.Element;
20
- export const useAuth: <TUser = unknown>() => Type<TUser>;
19
+ export const Provider: <TUser>({ isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState, children, }: PropsWithChildren<ProviderProps<TUser>>) => import("react/jsx-runtime").JSX.Element;
20
+ export const useAuth: <TUser>() => Type<TUser>;
21
21
  export {};
22
22
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { createContext, use } from "react";
2
+ import { createContext, useMemo, use } from "react";
3
3
  var AuthContext;
4
4
  ((AuthContext2) => {
5
5
  const Context = createContext({});
@@ -15,17 +15,20 @@ var AuthContext;
15
15
  loadingState,
16
16
  children
17
17
  }) => {
18
- const value = {
19
- isAuthenticated,
20
- isInitializing,
21
- logout,
22
- updateTokens,
23
- accessToken,
24
- user,
25
- userPromise,
26
- routes,
27
- loadingState
28
- };
18
+ const value = useMemo(
19
+ () => ({
20
+ isAuthenticated,
21
+ isInitializing,
22
+ logout,
23
+ updateTokens,
24
+ accessToken,
25
+ user,
26
+ userPromise,
27
+ routes,
28
+ loadingState
29
+ }),
30
+ [isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState]
31
+ );
29
32
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
30
33
  };
31
34
  AuthContext2.useAuth = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",