@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.
- package/dist/assets/icons/CheckboxCheckmark.js +1 -1
- package/dist/assets/icons/CheckboxIndeterminate.js +1 -1
- package/dist/assets/icons/Drag.js +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +5 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +1 -0
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +1 -1
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +7 -1
- package/dist/components/inputs/RadioGroup/radio.cva.js +5 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +2 -2
- package/dist/components/overlays/Tooltip/Tooltip.js +7 -3
- package/dist/components/table/CellText.js +1 -1
- package/dist/components/table/table.cva.js +2 -2
- package/dist/config/theme.context.js +4 -0
- package/dist/config/uiStyle.context.d.ts +5 -0
- package/dist/utils/date.utils.d.ts +2 -0
- package/dist/utils/date.utils.js +11 -0
- package/dist/utils/vendor/auth/auth.context.d.ts +2 -2
- package/dist/utils/vendor/auth/auth.context.js +15 -12
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ const DragIcon = (props) => /* @__PURE__ */ jsx(
|
|
|
10
10
|
children: /* @__PURE__ */ jsx(
|
|
11
11
|
"path",
|
|
12
12
|
{
|
|
13
|
-
fill: "
|
|
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-
|
|
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-
|
|
16
|
-
"group-hover:border-interactive-
|
|
17
|
-
"group-pressed:border-interactive-
|
|
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-
|
|
30
|
+
"group-invalid:border-interactive-outlined-error-on-idle",
|
|
31
31
|
"group-focus-visible:outline-interactive-contained-primary-focus"
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -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 = ({
|
|
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-
|
|
16
|
-
"group-disabled:border-interactive-
|
|
17
|
-
"group-hover:border-interactive-
|
|
18
|
-
"group-pressed:border-interactive-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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>;
|
package/dist/utils/date.utils.js
CHANGED
|
@@ -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
|
|
20
|
-
export const useAuth: <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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 = () => {
|