@povio/ui 2.1.1 → 2.1.3

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/auth.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export { createAclGuard } from './utils/vendor/acl/AclGuard';
2
+ export { AbilityContext } from './utils/vendor/acl/ability.context';
3
+ export type { AppAbilities, AppAbility } from './utils/vendor/acl/appAbility.types';
4
+ export { Can } from './utils/vendor/acl/Can';
5
+ export { AuthGuard } from './utils/vendor/auth/AuthGuard';
6
+ export { AuthContext } from './utils/vendor/auth/auth.context';
package/dist/auth.js ADDED
@@ -0,0 +1,12 @@
1
+ import { createAclGuard } from "./utils/vendor/acl/AclGuard.js";
2
+ import { AbilityContext } from "./utils/vendor/acl/ability.context.js";
3
+ import { Can } from "./utils/vendor/acl/Can.js";
4
+ import { AuthGuard } from "./utils/vendor/auth/AuthGuard.js";
5
+ import { AuthContext } from "./utils/vendor/auth/auth.context.js";
6
+ export {
7
+ AbilityContext,
8
+ AuthContext,
9
+ AuthGuard,
10
+ Can,
11
+ createAclGuard
12
+ };
@@ -28,7 +28,6 @@ declare const componentRegistry: {
28
28
  readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
29
29
  readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
30
30
  readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
31
- readonly textEditor: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../TextEditor/TextEditor').ControlledTextEditorProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
32
31
  readonly unknown: null;
33
32
  };
34
33
  export type InputComponentRegistry = typeof componentRegistry;
@@ -12,7 +12,6 @@ import { Autocomplete } from "../Selection/Autocomplete/Autocomplete.js";
12
12
  import { QueryAutocomplete } from "../Selection/Autocomplete/QueryAutocomplete.js";
13
13
  import { Select } from "../Selection/Select/Select.js";
14
14
  import { Slider } from "../Slider/Slider.js";
15
- import { TextEditor } from "../TextEditor/TextEditor.js";
16
15
  import { Toggle } from "../Toggle/Toggle.js";
17
16
  import { Segment } from "../../segment/Segment.js";
18
17
  const componentRegistry = {
@@ -31,7 +30,6 @@ const componentRegistry = {
31
30
  dateTimePicker: DateTimePicker,
32
31
  timePicker: TimePicker,
33
32
  dateRangePicker: DateRangePicker,
34
- textEditor: TextEditor,
35
33
  unknown: null
36
34
  };
37
35
  function InputItem({ form, inputDef }) {
@@ -1,12 +1,12 @@
1
- import { ToastPosition } from 'react-toastify';
1
+ import { ToastPosition, ToastOptions as ToastifyToastOptions } from 'react-toastify';
2
2
  import { ToastProps } from './Toast';
3
- type IShowToast = Omit<ToastProps, "color"> & {
3
+ export interface ToastParams extends Omit<ToastProps, "color"> {
4
4
  position?: ToastPosition;
5
- };
5
+ }
6
+ export type ToastOptions = Omit<ToastifyToastOptions, "position" | "data">;
6
7
  export declare const useToast: () => {
7
- successToast: (params: IShowToast) => void;
8
- errorToast: (params: IShowToast) => void;
9
- warningToast: (params: IShowToast) => void;
10
- neutralToast: (params: IShowToast) => void;
8
+ successToast: (params: ToastParams, options?: ToastOptions) => void;
9
+ errorToast: (params: ToastParams, options?: ToastOptions) => void;
10
+ warningToast: (params: ToastParams, options?: ToastOptions) => void;
11
+ neutralToast: (params: ToastParams, options?: ToastOptions) => void;
11
12
  };
12
- export {};
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useCallback } from "react";
2
+ import { useCallback, useMemo } from "react";
3
3
  import { toast } from "react-toastify";
4
4
  import { Toast } from "./Toast.js";
5
5
  const useToast = () => {
6
- const successToast = useCallback((params) => {
6
+ const successToast = useCallback((params, options) => {
7
7
  toast.success(
8
8
  /* @__PURE__ */ jsx(
9
9
  Toast,
@@ -13,6 +13,7 @@ const useToast = () => {
13
13
  }
14
14
  ),
15
15
  {
16
+ ...options,
16
17
  position: params.position,
17
18
  data: {
18
19
  variant: params.variant
@@ -20,7 +21,7 @@ const useToast = () => {
20
21
  }
21
22
  );
22
23
  }, []);
23
- const errorToast = useCallback((params) => {
24
+ const errorToast = useCallback((params, options) => {
24
25
  toast.error(
25
26
  /* @__PURE__ */ jsx(
26
27
  Toast,
@@ -30,6 +31,7 @@ const useToast = () => {
30
31
  }
31
32
  ),
32
33
  {
34
+ ...options,
33
35
  position: params.position,
34
36
  data: {
35
37
  variant: params.variant
@@ -37,7 +39,7 @@ const useToast = () => {
37
39
  }
38
40
  );
39
41
  }, []);
40
- const warningToast = useCallback((params) => {
42
+ const warningToast = useCallback((params, options) => {
41
43
  toast.warning(
42
44
  /* @__PURE__ */ jsx(
43
45
  Toast,
@@ -47,6 +49,7 @@ const useToast = () => {
47
49
  }
48
50
  ),
49
51
  {
52
+ ...options,
50
53
  position: params.position,
51
54
  data: {
52
55
  variant: params.variant
@@ -54,7 +57,7 @@ const useToast = () => {
54
57
  }
55
58
  );
56
59
  }, []);
57
- const neutralToast = useCallback((params) => {
60
+ const neutralToast = useCallback((params, options) => {
58
61
  toast.info(
59
62
  /* @__PURE__ */ jsx(
60
63
  Toast,
@@ -64,6 +67,7 @@ const useToast = () => {
64
67
  }
65
68
  ),
66
69
  {
70
+ ...options,
67
71
  position: params.position,
68
72
  data: {
69
73
  variant: params.variant
@@ -71,12 +75,15 @@ const useToast = () => {
71
75
  }
72
76
  );
73
77
  }, []);
74
- return {
75
- successToast,
76
- errorToast,
77
- warningToast,
78
- neutralToast
79
- };
78
+ return useMemo(
79
+ () => ({
80
+ successToast,
81
+ errorToast,
82
+ warningToast,
83
+ neutralToast
84
+ }),
85
+ [successToast, errorToast, warningToast, neutralToast]
86
+ );
80
87
  };
81
88
  export {
82
89
  useToast
@@ -1,20 +1,15 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { UrlObject } from 'url';
3
2
  interface UIRouterProviderProps {
4
- push: (url: UrlObject | string) => Promise<boolean>;
5
- replace: (url: UrlObject | string) => Promise<boolean>;
6
- query: NodeJS.Dict<string | string[]>;
3
+ push: (url: string) => Promise<boolean>;
4
+ replace: (url: string) => Promise<boolean>;
7
5
  pathname: string;
6
+ searchString: string;
8
7
  }
9
- interface UIRouterContextValue {
10
- push: (url: UrlObject | string) => Promise<boolean>;
11
- replace: (url: UrlObject | string) => Promise<boolean>;
12
- pathname: string;
13
- query: NodeJS.Dict<string | string[]>;
8
+ interface UIRouterContextValue extends UIRouterProviderProps {
14
9
  searchParams: URLSearchParams;
15
10
  }
16
11
  export declare namespace UIRouter {
17
- const UIRouterProvider: ({ children, pathname, push, query, replace, }: PropsWithChildren<UIRouterProviderProps>) => import("react/jsx-runtime").JSX.Element;
12
+ const UIRouterProvider: ({ children, pathname, push, replace, searchString, }: PropsWithChildren<UIRouterProviderProps>) => import("react/jsx-runtime").JSX.Element;
18
13
  const useUIRouter: () => UIRouterContextValue;
19
14
  }
20
15
  export {};
@@ -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
  import { RouterProvider } from "react-aria";
4
4
  var UIRouter;
5
5
  ((UIRouter2) => {
@@ -8,27 +8,23 @@ var UIRouter;
8
8
  children,
9
9
  pathname,
10
10
  push,
11
- query,
12
- replace
11
+ replace,
12
+ searchString
13
13
  }) => {
14
- const searchParams = new URLSearchParams();
15
- for (const [k, v] of Object.entries(query)) {
16
- if (Array.isArray(v)) {
17
- for (const item of v) {
18
- searchParams.append(k, item);
19
- }
20
- } else {
21
- searchParams.set(k, v);
22
- }
23
- }
24
- const value = {
25
- searchParams,
26
- pathname,
27
- push,
28
- query,
29
- replace
30
- };
31
- return /* @__PURE__ */ jsx(UIRouterContext, { value, children: /* @__PURE__ */ jsx(RouterProvider, { navigate: (href) => push(href), children }) });
14
+ const searchParams = useMemo(() => {
15
+ return new URLSearchParams(searchString);
16
+ }, [searchString]);
17
+ const value = useMemo(
18
+ () => ({
19
+ searchParams,
20
+ pathname,
21
+ push,
22
+ searchString,
23
+ replace
24
+ }),
25
+ [searchParams, pathname, push, searchString, replace]
26
+ );
27
+ return /* @__PURE__ */ jsx(UIRouterContext, { value, children: /* @__PURE__ */ jsx(RouterProvider, { navigate: push, children }) });
32
28
  };
33
29
  UIRouter2.useUIRouter = () => {
34
30
  const context = use(UIRouterContext);
@@ -6,7 +6,6 @@ import { ZodUtils } from '../utils/zod.utils';
6
6
  declare const defaultComponentTypes: {
7
7
  readonly datetime: "datePicker";
8
8
  readonly dateRange: "dateRangePicker";
9
- readonly textEditor: "textEditor";
10
9
  readonly boolean: "toggle";
11
10
  readonly number: "numberInput";
12
11
  readonly enum: "select";
@@ -21,7 +20,6 @@ export type DefaultComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeS
21
20
  export type AllowedComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeSwitch<TZodType, {
22
21
  datetime: "datePicker" | "dateTimePicker" | "timePicker";
23
22
  dateRange: "dateRangePicker";
24
- textEditor: "textEditor";
25
23
  boolean: "toggle" | "checkbox";
26
24
  number: "numberInput" | "slider" | "select" | "autocomplete" | "queryAutocomplete" | "segment";
27
25
  enum: "select" | "autocomplete" | "segment";
@@ -5,7 +5,6 @@ import { ZodUtils } from "../utils/zod.utils.js";
5
5
  const defaultComponentTypes = {
6
6
  datetime: "datePicker",
7
7
  dateRange: "dateRangePicker",
8
- textEditor: "textEditor",
9
8
  boolean: "toggle",
10
9
  number: "numberInput",
11
10
  enum: "select",
@@ -70,9 +69,6 @@ const getDefaultInputComponentType = (schemaType) => {
70
69
  if (ZodUtils.isDateRange(schemaType)) {
71
70
  return defaultComponentTypes.dateRange;
72
71
  }
73
- if (ZodUtils.isTextEditor(schemaType)) {
74
- return defaultComponentTypes.textEditor;
75
- }
76
72
  const unwrappedType = ZodUtils.unwrapZodType(schemaType);
77
73
  const componentType = ZOD_TYPE_COMPONENT_TYPE.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
78
74
  if (componentType) {
@@ -1,7 +1,8 @@
1
+ import { z } from 'zod';
1
2
  export interface FilterStore<TFilterData> {
2
3
  filterData: TFilterData;
3
4
  setFilterValue: (data: Partial<TFilterData>) => void;
4
5
  getFilterValue: (keys: (keyof TFilterData)[]) => Partial<TFilterData>;
5
6
  clearAllFilters: () => void;
6
7
  }
7
- export declare const useFilters: <TFilterData>(defaultFilterValues?: TFilterData, prefix?: string) => FilterStore<TFilterData>;
8
+ export declare const useFilters: <TFilterData>(defaultFilterValues?: TFilterData, prefix?: string, schema?: z.ZodObject<any>) => FilterStore<TFilterData>;
@@ -1,5 +1,32 @@
1
- import { useState, useEffect } from "react";
1
+ import { useState, useEffect, useCallback, useMemo } from "react";
2
+ import { z } from "zod";
2
3
  import { UIRouter } from "../config/router.context.js";
4
+ function getFieldType(schema, fieldKey) {
5
+ if (!schema || !schema.shape) {
6
+ return "unknown";
7
+ }
8
+ let fieldSchema = schema.shape[fieldKey];
9
+ while (fieldSchema) {
10
+ if (fieldSchema instanceof z.ZodOptional || fieldSchema instanceof z.ZodNullable) {
11
+ fieldSchema = fieldSchema.unwrap();
12
+ } else {
13
+ break;
14
+ }
15
+ }
16
+ if (!fieldSchema) {
17
+ return "unknown";
18
+ }
19
+ if (fieldSchema instanceof z.ZodNumber) {
20
+ return "number";
21
+ }
22
+ if (fieldSchema instanceof z.ZodBoolean) {
23
+ return "boolean";
24
+ }
25
+ if (fieldSchema instanceof z.ZodString) {
26
+ return "string";
27
+ }
28
+ return "unknown";
29
+ }
3
30
  const serializeFiltersToQuery = (filterData, prefix) => {
4
31
  const query = {};
5
32
  for (const [key, value] of Object.entries(filterData)) {
@@ -12,14 +39,14 @@ const serializeFiltersToQuery = (filterData, prefix) => {
12
39
  } else if (typeof value === "boolean") {
13
40
  query[filterKey] = value ? "true" : "false";
14
41
  } else {
15
- query[filterKey] = value;
42
+ query[filterKey] = value.toString();
16
43
  }
17
44
  }
18
45
  return query;
19
46
  };
20
- const parseFilterFromQuery = (query) => {
47
+ const parseFilterFromQuery = (searchParams, schema) => {
21
48
  const filter = {};
22
- for (const [key, value] of Object.entries(query)) {
49
+ for (const [key, value] of searchParams.entries()) {
23
50
  const match = /^filter\[(.+?)\]$/.exec(key);
24
51
  if (!match) {
25
52
  continue;
@@ -34,86 +61,99 @@ const parseFilterFromQuery = (query) => {
34
61
  } else if (isBoolean) {
35
62
  filter[filterKey] = value === "true";
36
63
  } else {
37
- filter[filterKey] = value;
64
+ const expectedType = getFieldType(schema, filterKey);
65
+ if (expectedType === "number" && !Number.isNaN(Number(value)) && value !== "" && value !== null) {
66
+ filter[filterKey] = Number(value);
67
+ } else if (expectedType === "boolean" && ["true", "false"].includes(value)) {
68
+ filter[filterKey] = value === "true";
69
+ } else {
70
+ filter[filterKey] = value;
71
+ }
38
72
  }
39
73
  }
40
74
  return filter;
41
75
  };
42
- const useFilters = (defaultFilterValues, prefix = "") => {
43
- const { query, pathname, replace } = UIRouter.useUIRouter();
44
- const queryFilters = parseFilterFromQuery(query);
45
- const [filterData, setFilterData] = useState(queryFilters);
76
+ const useFilters = (defaultFilterValues, prefix = "", schema) => {
77
+ const { searchParams, pathname, replace } = UIRouter.useUIRouter();
78
+ const [filterData, setFilterData] = useState(
79
+ () => parseFilterFromQuery(searchParams, schema)
80
+ );
46
81
  useEffect(() => {
47
82
  const setUrlToDefaultFilters = () => {
48
83
  const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
49
- replace({
50
- pathname,
51
- query: {
52
- ...query,
53
- ...flatFilterQuery
54
- }
55
- });
84
+ const url = `${pathname}?${new URLSearchParams({
85
+ ...Object.fromEntries(searchParams.entries()),
86
+ ...flatFilterQuery
87
+ }).toString()}`;
88
+ replace(url);
56
89
  };
57
- const currentFilters = parseFilterFromQuery(query);
90
+ const currentFilters = parseFilterFromQuery(searchParams, schema);
58
91
  const hasFiltersSet = Object.keys(currentFilters).length > 0;
59
92
  if (defaultFilterValues && !hasFiltersSet) {
60
93
  setUrlToDefaultFilters();
61
94
  }
62
- }, [defaultFilterValues, prefix]);
95
+ }, [defaultFilterValues, prefix, schema]);
63
96
  useEffect(() => {
64
- const newQueryFilters = parseFilterFromQuery(query);
97
+ const newQueryFilters = parseFilterFromQuery(searchParams, schema);
65
98
  setFilterData(newQueryFilters);
66
- }, [query]);
67
- const setFilterValue = (data) => {
68
- let newFilters = { ...filterData };
69
- const isReset = Object.keys(data).length === 0;
70
- const isResetToDefault = data === defaultFilterValues;
71
- if (isResetToDefault) {
72
- newFilters = {
73
- ...defaultFilterValues
74
- };
75
- } else if (isReset) {
76
- newFilters = {};
77
- } else {
78
- Object.entries(data).forEach(([key, value]) => {
79
- if (value === void 0) {
80
- delete newFilters[key];
81
- } else {
82
- newFilters[key] = value;
83
- }
84
- });
85
- }
86
- const prefixPart = prefix ? `${prefix}-` : "";
87
- const cleanedQuery = Object.keys(query).reduce(
88
- (acc, k) => {
89
- if (!k.startsWith(`filter[${prefixPart}`)) {
90
- acc[k] = query[k];
91
- }
92
- return acc;
93
- },
94
- {}
95
- );
96
- const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
97
- replace({
98
- pathname,
99
- query: {
99
+ }, [searchParams, schema]);
100
+ const setFilterValue = useCallback(
101
+ (data2) => {
102
+ let newFilters = { ...filterData };
103
+ const isReset = Object.keys(data2).length === 0;
104
+ const isResetToDefault = data2 === defaultFilterValues;
105
+ if (isResetToDefault) {
106
+ newFilters = {
107
+ ...defaultFilterValues
108
+ };
109
+ } else if (isReset) {
110
+ newFilters = {};
111
+ } else {
112
+ Object.entries(data2).forEach(([key, value]) => {
113
+ if (value === void 0) {
114
+ delete newFilters[key];
115
+ } else {
116
+ newFilters[key] = value;
117
+ }
118
+ });
119
+ }
120
+ const prefixPart = prefix ? `${prefix}-` : "";
121
+ const cleanedQuery = searchParams.keys().reduce(
122
+ (acc, k) => {
123
+ if (!k.startsWith(`filter[${prefixPart}`)) {
124
+ acc[k] = searchParams.get(k) ?? "";
125
+ }
126
+ return acc;
127
+ },
128
+ {}
129
+ );
130
+ const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
131
+ const url = `${pathname}?${new URLSearchParams({
100
132
  ...cleanedQuery,
101
133
  ...flatFilterQuery
102
- }
103
- });
104
- setFilterData(newFilters);
105
- };
106
- const getFilterValue = (keys) => {
107
- const result = {};
108
- keys.forEach((key) => {
109
- result[key] = filterData[key];
110
- });
111
- return result;
112
- };
113
- const clearAllFilters = () => {
134
+ }).toString()}`;
135
+ replace(url);
136
+ setFilterData(newFilters);
137
+ },
138
+ [filterData, prefix, pathname, replace, defaultFilterValues, searchParams]
139
+ );
140
+ const getFilterValue = useCallback(
141
+ (keys) => {
142
+ const result = {};
143
+ keys.forEach((key) => {
144
+ result[key] = filterData[key];
145
+ });
146
+ return result;
147
+ },
148
+ [filterData]
149
+ );
150
+ const clearAllFilters = useCallback(() => {
114
151
  setFilterValue(defaultFilterValues ?? {});
115
- };
116
- return { filterData, setFilterValue, getFilterValue, clearAllFilters };
152
+ }, [defaultFilterValues, setFilterValue]);
153
+ const data = useMemo(() => {
154
+ return { filterData, setFilterValue, getFilterValue, clearAllFilters };
155
+ }, [filterData, setFilterValue, getFilterValue, clearAllFilters]);
156
+ return data;
117
157
  };
118
158
  export {
119
159
  useFilters
@@ -5,7 +5,7 @@ const DEFAULT_STATE = {
5
5
  pageSize: 20
6
6
  };
7
7
  function usePagination(defaultPagination) {
8
- const { pathname, query, replace, searchParams } = UIRouter.useUIRouter();
8
+ const { pathname, replace, searchParams } = UIRouter.useUIRouter();
9
9
  const [pagination, setPagination] = useState(
10
10
  defaultPagination ?? {
11
11
  pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
@@ -13,15 +13,15 @@ function usePagination(defaultPagination) {
13
13
  }
14
14
  );
15
15
  useEffect(() => {
16
- const { page: _page, size: _size, ...queryParms } = query;
17
- replace({
18
- pathname,
19
- query: {
20
- ...queryParms,
21
- ...pagination.pageSize !== DEFAULT_STATE.pageSize ? { size: pagination.pageSize } : {},
22
- ...pagination.pageIndex !== DEFAULT_STATE.pageIndex ? { page: pagination.pageIndex } : {}
23
- }
24
- });
16
+ const params = new URLSearchParams(searchParams);
17
+ if (pagination.pageSize !== DEFAULT_STATE.pageSize) {
18
+ params.append("size", pagination.pageSize.toString());
19
+ }
20
+ if (pagination.pageIndex !== DEFAULT_STATE.pageIndex) {
21
+ params.append("page", pagination.pageIndex.toString());
22
+ }
23
+ const url = `${pathname}${params.size > 0 ? `?${params.toString()}` : ""}`;
24
+ replace(url);
25
25
  }, [pagination]);
26
26
  return {
27
27
  pagination,
@@ -1,7 +1,7 @@
1
1
  import { useState, useMemo, useEffect } from "react";
2
2
  import { UIRouter } from "../config/router.context.js";
3
3
  function useSorting(defaultSorting, prefix = "") {
4
- const { pathname, replace, searchParams, query } = UIRouter.useUIRouter();
4
+ const { pathname, replace, searchParams } = UIRouter.useUIRouter();
5
5
  const [sorting, setSorting] = useState(
6
6
  defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map((item) => {
7
7
  if (item.startsWith("-")) {
@@ -17,11 +17,13 @@ function useSorting(defaultSorting, prefix = "") {
17
17
  return sorting.map((field) => `${field.desc ? "-" : "+"}${field.id}`).join(",");
18
18
  }, [sorting]);
19
19
  useEffect(() => {
20
- const { sort: _sort, ...queryParms } = query;
21
- replace({
22
- pathname,
23
- query: { ...queryParms, ...order ? { [`order${prefix && `-${prefix}`}`]: order } : {} }
24
- });
20
+ const params = new URLSearchParams(searchParams);
21
+ params.delete("order");
22
+ if (order) {
23
+ params.append(`order${prefix && `-${prefix}`}`, order);
24
+ }
25
+ const url = `${pathname}${params.size > 0 ? `?${params.toString()}` : ""}`;
26
+ replace(url);
25
27
  }, [order]);
26
28
  return { sorting, setSorting, order };
27
29
  }
package/dist/index.d.ts CHANGED
@@ -95,8 +95,6 @@ export { Select } from './components/inputs/Selection/Select/Select';
95
95
  export type { ControlledSliderProps, SliderProps } from './components/inputs/Slider/Slider';
96
96
  export { Slider } from './components/inputs/Slider/Slider';
97
97
  export type { InputVariantProps } from './components/inputs/shared/input.cva';
98
- export type { ControlledTextEditorProps, TextEditorProps, TextEditorValue, } from './components/inputs/TextEditor/TextEditor';
99
- export { TextEditor } from './components/inputs/TextEditor/TextEditor';
100
98
  export type { ControlledToggleProps, ToggleProps } from './components/inputs/Toggle/Toggle';
101
99
  export { Toggle } from './components/inputs/Toggle/Toggle';
102
100
  export type { MenuProps } from './components/Menu/Menu';
@@ -130,6 +128,7 @@ export { Loader } from './components/status/Loader/Loader';
130
128
  export type { ToastAction, ToastProps } from './components/status/Toast/Toast';
131
129
  export { Toast, ToastContainer } from './components/status/Toast/Toast';
132
130
  export type { ToastVariantProps } from './components/status/Toast/toast.cva';
131
+ export type { ToastOptions, ToastParams } from './components/status/Toast/useToast';
133
132
  export { useToast } from './components/status/Toast/useToast';
134
133
  export type { CellTextProps } from './components/table/CellText';
135
134
  export { CellText } from './components/table/CellText';
@@ -199,12 +198,6 @@ export { QueriesUtils } from './utils/queries.utils';
199
198
  export { RestUtils } from './utils/rest.utils';
200
199
  export { RoutingUtils } from './utils/routing.utils';
201
200
  export { StringUtils } from './utils/string.utils';
202
- export { createAclGuard } from './utils/vendor/acl/AclGuard';
203
- export { AbilityContext } from './utils/vendor/acl/ability.context';
204
- export type { AppAbilities, AppAbility } from './utils/vendor/acl/appAbility.types';
205
- export { Can } from './utils/vendor/acl/Can';
206
- export { AuthGuard } from './utils/vendor/auth/AuthGuard';
207
- export { AuthContext } from './utils/vendor/auth/auth.context';
208
201
  export type { GeneralErrorCodes } from './utils/vendor/error-handling';
209
202
  export { ApplicationException, ErrorHandler, SharedErrorHandler } from './utils/vendor/error-handling';
210
203
  export type { RequestConfig, RequestInfo, Response, RestClient as IRestClient, } from './utils/vendor/rest-client.types';
package/dist/index.js CHANGED
@@ -64,7 +64,6 @@ import { Autocomplete } from "./components/inputs/Selection/Autocomplete/Autocom
64
64
  import { QueryAutocomplete } from "./components/inputs/Selection/Autocomplete/QueryAutocomplete.js";
65
65
  import { Select } from "./components/inputs/Selection/Select/Select.js";
66
66
  import { Slider } from "./components/inputs/Slider/Slider.js";
67
- import { TextEditor } from "./components/inputs/TextEditor/TextEditor.js";
68
67
  import { Toggle } from "./components/inputs/Toggle/Toggle.js";
69
68
  import { Menu } from "./components/Menu/Menu.js";
70
69
  import { MenuPopover } from "./components/Menu/MenuPopover.js";
@@ -131,15 +130,9 @@ import { QueriesUtils } from "./utils/queries.utils.js";
131
130
  import { RestUtils } from "./utils/rest.utils.js";
132
131
  import { RoutingUtils } from "./utils/routing.utils.js";
133
132
  import { StringUtils } from "./utils/string.utils.js";
134
- import { createAclGuard } from "./utils/vendor/acl/AclGuard.js";
135
- import { AbilityContext } from "./utils/vendor/acl/ability.context.js";
136
- import { Can } from "./utils/vendor/acl/Can.js";
137
- import { AuthGuard } from "./utils/vendor/auth/AuthGuard.js";
138
- import { AuthContext } from "./utils/vendor/auth/auth.context.js";
139
133
  import { ApplicationException, ErrorHandler, SharedErrorHandler } from "./utils/vendor/error-handling.js";
140
134
  import { RestInterceptor } from "./utils/vendor/rest-interceptor.js";
141
135
  export {
142
- AbilityContext,
143
136
  ActionModal,
144
137
  Alert,
145
138
  AlignCenterIcon,
@@ -152,15 +145,12 @@ export {
152
145
  ArrowDropUpIcon,
153
146
  ArrowLeftIcon,
154
147
  ArrowRightIcon,
155
- AuthContext,
156
- AuthGuard,
157
148
  Autocomplete,
158
149
  BoldIcon,
159
150
  BottomSheet,
160
151
  BulletedListIcon,
161
152
  Button,
162
153
  CalendarIcon,
163
- Can,
164
154
  CellText,
165
155
  CheckIcon,
166
156
  Checkbox,
@@ -239,7 +229,6 @@ export {
239
229
  TextArea,
240
230
  TextButton,
241
231
  TextColorIcon,
242
- TextEditor,
243
232
  TextInput,
244
233
  ThemeContext,
245
234
  TimePicker,
@@ -257,7 +246,6 @@ export {
257
246
  ViewIcon,
258
247
  ViewOffIcon,
259
248
  compoundMapper,
260
- createAclGuard,
261
249
  dynamicColumns,
262
250
  dynamicInputs,
263
251
  isEqual,
@@ -0,0 +1,2 @@
1
+ export type { ControlledTextEditorProps, TextEditorProps, TextEditorValue, } from './components/inputs/TextEditor/TextEditor';
2
+ export { TextEditor } from './components/inputs/TextEditor/TextEditor';
@@ -0,0 +1,4 @@
1
+ import { TextEditor } from "./components/inputs/TextEditor/TextEditor.js";
2
+ export {
3
+ TextEditor
4
+ };
@@ -9,12 +9,10 @@ export declare namespace ZodUtils {
9
9
  type IsZodString<T> = IsZodType<T, z.ZodString>;
10
10
  type IsZodEmail<T> = IsZodType<T, z.ZodEmail>;
11
11
  type IsZodDateRange<T> = UnwrapZod<T> extends z.ZodObject ? UnwrapZod<UnwrapZod<T>["shape"]["start"]> extends z.ZodISODateTime ? UnwrapZod<UnwrapZod<T>["shape"]["end"]> extends z.ZodISODateTime ? true : false : false : false;
12
- type IsZodTextEditor<T> = UnwrapZod<T> extends z.ZodObject ? UnwrapZod<UnwrapZod<T>["shape"]["html"]> extends z.ZodString ? UnwrapZod<UnwrapZod<T>["shape"]["json"]> extends z.ZodObject<any> ? true : false : false : false;
13
12
  type IsZodObject<T> = IsZodType<T, z.ZodObject<any>>;
14
13
  type IsZodArray<T> = IsZodType<T, z.ZodArray<any>>;
15
- type ZodType<T> = IsZodType<T, z.ZodBoolean> extends true ? "boolean" : IsZodNumber<T> extends true ? "number" : IsZodEnum<T> extends true ? "enum" : IsZodDateTime<T> extends true ? "datetime" : IsZodUUID<T> extends true ? "uuid" : IsZodString<T> extends true ? "string" : IsZodEmail<T> extends true ? "email" : IsZodDateRange<T> extends true ? "dateRange" : IsZodTextEditor<T> extends true ? "textEditor" : IsZodObject<T> extends true ? "object" : IsZodArray<T> extends true ? "array" : never;
14
+ type ZodType<T> = IsZodType<T, z.ZodBoolean> extends true ? "boolean" : IsZodNumber<T> extends true ? "number" : IsZodEnum<T> extends true ? "enum" : IsZodDateTime<T> extends true ? "datetime" : IsZodUUID<T> extends true ? "uuid" : IsZodString<T> extends true ? "string" : IsZodEmail<T> extends true ? "email" : IsZodDateRange<T> extends true ? "dateRange" : IsZodObject<T> extends true ? "object" : IsZodArray<T> extends true ? "array" : never;
16
15
  type ZodTypeSwitch<TZodType extends z.ZodType, T extends Record<ZodType<TZodType> | "unknown", unknown>> = ZodType<TZodType> extends never ? never : T[ZodType<TZodType>];
17
16
  const unwrapZodType: (schemaType: z.core.$ZodType) => z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
18
17
  const isDateRange: (schemaType: z.core.$ZodType) => boolean;
19
- const isTextEditor: (schemaType: z.core.$ZodType) => boolean;
20
18
  }
@@ -15,10 +15,6 @@ var ZodUtils;
15
15
  const unwrappedType = (0, ZodUtils2.unwrapZodType)(schemaType);
16
16
  return unwrappedType instanceof z.ZodObject && hasZodObjectProperty(unwrappedType, "start", z.ZodISODateTime) && hasZodObjectProperty(unwrappedType, "end", z.ZodISODateTime);
17
17
  };
18
- ZodUtils2.isTextEditor = (schemaType) => {
19
- const unwrappedType = (0, ZodUtils2.unwrapZodType)(schemaType);
20
- return unwrappedType instanceof z.ZodObject && hasZodObjectProperty(unwrappedType, "html", z.ZodString) && hasZodObjectProperty(unwrappedType, "json", z.ZodObject);
21
- };
22
18
  })(ZodUtils || (ZodUtils = {}));
23
19
  export {
24
20
  ZodUtils
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
8
8
  ".": "./dist/index.js",
9
- "./styles": "./dist/styles/index.css"
9
+ "./auth": "./dist/auth.js",
10
+ "./text-editor": "./dist/text-editor.js",
11
+ "./text-editor/styles": "./dist/styles/editor.css"
10
12
  },
11
13
  "files": [
12
14
  "dist"
@@ -14,6 +16,20 @@
14
16
  "homepage": "https://povio.com",
15
17
  "license": "UNLICENSED",
16
18
  "peerDependencies": {
19
+ "@casl/ability": "^6.7.3",
20
+ "@casl/react": "^5.0.0",
21
+ "@tiptap/core": "^2.26.3",
22
+ "@tiptap/extension-color": "^2.26.3",
23
+ "@tiptap/extension-heading": "^2.26.3",
24
+ "@tiptap/extension-highlight": "^2.26.3",
25
+ "@tiptap/extension-link": "^2.26.3",
26
+ "@tiptap/extension-placeholder": "^2.26.3",
27
+ "@tiptap/extension-text-align": "^2.26.3",
28
+ "@tiptap/extension-text-style": "^2.26.3",
29
+ "@tiptap/extension-underline": "^2.26.3",
30
+ "@tiptap/pm": "^2.26.3",
31
+ "@tiptap/react": "^2.26.3",
32
+ "@tiptap/starter-kit": "^2.26.3",
17
33
  "react": "^19.1.0",
18
34
  "react-dom": "^19.1.0"
19
35
  },
@@ -34,18 +50,6 @@
34
50
  "@react-types/shared": "^3.32.1",
35
51
  "@tanstack/react-query": "~5.85.9",
36
52
  "@tanstack/react-table": "^8.21.3",
37
- "@tiptap/core": "^2.26.3",
38
- "@tiptap/extension-color": "^2.26.3",
39
- "@tiptap/extension-heading": "^2.26.3",
40
- "@tiptap/extension-highlight": "^2.26.3",
41
- "@tiptap/extension-link": "^2.26.3",
42
- "@tiptap/extension-placeholder": "^2.26.3",
43
- "@tiptap/extension-text-align": "^2.26.3",
44
- "@tiptap/extension-text-style": "^2.26.3",
45
- "@tiptap/extension-underline": "^2.26.3",
46
- "@tiptap/pm": "^2.26.3",
47
- "@tiptap/react": "^2.26.3",
48
- "@tiptap/starter-kit": "^2.26.3",
49
53
  "axios": "^1.13.1",
50
54
  "class-variance-authority": "^0.7.1",
51
55
  "clsx": "^2.1.1",
@@ -1 +0,0 @@
1
- @import "./editor.css";