@povio/ui 0.0.7 → 0.0.9

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 (104) hide show
  1. package/dist/assets/icons/Calendar.js +1 -1
  2. package/dist/assets/icons/CheckCircle.js +3 -3
  3. package/dist/assets/icons/ChevronsLeft.js +11 -22
  4. package/dist/assets/icons/ChevronsRight.js +11 -22
  5. package/dist/assets/icons/DateTime.js +13 -6
  6. package/dist/assets/icons/Drag.js +1 -1
  7. package/dist/assets/icons/File.js +1 -1
  8. package/dist/assets/icons/Info.js +2 -4
  9. package/dist/assets/icons/Menu.js +1 -3
  10. package/dist/assets/icons/Send.js +1 -1
  11. package/dist/assets/icons/Upload.js +2 -2
  12. package/dist/assets/icons/{Warningfilled.js → WarningFilled.js} +1 -1
  13. package/dist/components/Menu/MenuPopover.js +1 -1
  14. package/dist/components/buttons/PillButton/pillButton.cva.js +1 -1
  15. package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -1
  16. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +7 -4
  17. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +10 -4
  18. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +7 -4
  19. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +16 -5
  20. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +3 -2
  21. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +30 -23
  22. package/dist/components/inputs/File/FileUpload.js +1 -1
  23. package/dist/components/inputs/File/InputUpload.js +1 -1
  24. package/dist/components/inputs/File/shared/FileUploadContentError.js +1 -1
  25. package/dist/components/inputs/File/shared/InputUploadContent.js +10 -4
  26. package/dist/components/inputs/File/shared/InputUploadFilled.js +36 -22
  27. package/dist/components/inputs/File/shared/fileUpload.cva.js +3 -2
  28. package/dist/components/inputs/File/shared/inputUploadButton.cva.js +6 -5
  29. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +3 -2
  30. package/dist/components/inputs/FormField/FormFieldLabel.js +8 -2
  31. package/dist/components/inputs/Input/TextArea/TextArea.js +6 -9
  32. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -0
  33. package/dist/components/inputs/Input/TextInput/TextInput.js +26 -3
  34. package/dist/components/inputs/Input/shared/InputContent.js +67 -59
  35. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +3 -2
  36. package/dist/components/inputs/Selection/shared/SelectBase.js +2 -1
  37. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  38. package/dist/components/inputs/Selection/shared/SelectInput.js +84 -90
  39. package/dist/components/inputs/Selection/shared/SelectInputTags.d.ts +11 -0
  40. package/dist/components/inputs/Selection/shared/SelectInputTags.js +22 -0
  41. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  42. package/dist/components/inputs/Selection/shared/SelectListBox.js +56 -45
  43. package/dist/components/inputs/Selection/shared/select.context.js +1 -0
  44. package/dist/components/inputs/Selection/shared/select.types.d.ts +8 -0
  45. package/dist/components/inputs/shared/InputClear.d.ts +3 -1
  46. package/dist/components/inputs/shared/InputClear.js +4 -3
  47. package/dist/components/inputs/shared/input.cva.js +18 -17
  48. package/dist/components/inputs/shared/label.cva.js +2 -2
  49. package/dist/components/overlays/BottomSheet/BottomSheet.js +17 -12
  50. package/dist/components/overlays/Tooltip/Tooltip.d.ts +4 -2
  51. package/dist/components/overlays/Tooltip/Tooltip.js +32 -6
  52. package/dist/components/overlays/Tooltip/tooltip.cva.d.ts +21 -0
  53. package/dist/components/overlays/Tooltip/tooltip.cva.js +60 -0
  54. package/dist/components/segment/Segment.js +8 -2
  55. package/dist/components/segment/SegmentItem.js +4 -2
  56. package/dist/components/table/CellText.js +2 -2
  57. package/dist/components/table/HeaderText.js +1 -1
  58. package/dist/components/table/Table.js +34 -16
  59. package/dist/components/table/table.cva.d.ts +7 -3
  60. package/dist/components/table/table.cva.js +37 -11
  61. package/dist/config/uiConfig.context.d.ts +3 -1
  62. package/dist/config/uiConfig.context.js +6 -1
  63. package/dist/config/uiStyle.context.d.ts +2 -1
  64. package/dist/helpers/dynamicColumns.js +2 -2
  65. package/dist/helpers/dynamicInputs.d.ts +2 -0
  66. package/dist/helpers/dynamicInputs.js +5 -3
  67. package/dist/hooks/useAutosave.js +4 -1
  68. package/dist/hooks/useTableColumnConfig.js +5 -1
  69. package/dist/index.d.ts +12 -6
  70. package/dist/index.js +15 -11
  71. package/dist/utils/date-time.utils.js +12 -12
  72. package/dist/utils/dom.utils.js +2 -2
  73. package/dist/utils/file.utils.js +1 -1
  74. package/dist/utils/isEqual.js +2 -1
  75. package/dist/utils/object.utils.js +2 -2
  76. package/dist/utils/{rest/rest.utils.js → rest.utils.js} +1 -1
  77. package/dist/utils/vendor/acl/AclGuard.d.ts +8 -0
  78. package/dist/utils/vendor/acl/AclGuard.js +15 -0
  79. package/dist/utils/vendor/acl/Can.d.ts +9 -0
  80. package/dist/utils/vendor/acl/Can.js +18 -0
  81. package/dist/utils/vendor/acl/ability.context.d.ts +15 -0
  82. package/dist/utils/vendor/acl/ability.context.js +37 -0
  83. package/dist/utils/vendor/acl/appAbility.types.d.ts +3 -0
  84. package/dist/utils/vendor/auth/AuthGuard.d.ts +6 -0
  85. package/dist/utils/vendor/auth/AuthGuard.js +26 -0
  86. package/dist/utils/vendor/auth/auth.context.d.ts +21 -0
  87. package/dist/utils/vendor/auth/auth.context.js +36 -0
  88. package/dist/utils/vendor/auth/withPrivateAuthGuard.d.ts +6 -0
  89. package/dist/utils/vendor/auth/withPrivateAuthGuard.js +17 -0
  90. package/dist/utils/vendor/error-handling.js +1 -1
  91. package/dist/utils/{rest/rest-client.d.ts → vendor/rest-client.types.d.ts} +8 -14
  92. package/dist/utils/zod.utils.d.ts +2 -1
  93. package/package.json +2 -2
  94. package/dist/hooks/useSingletonMutation.d.ts +0 -4
  95. package/dist/hooks/useSingletonMutation.js +0 -27
  96. package/dist/utils/rest/interceptors/logging.interceptor.d.ts +0 -2
  97. package/dist/utils/rest/interceptors/logging.interceptor.js +0 -17
  98. package/dist/utils/rest/interceptors/response.interceptor.d.ts +0 -2
  99. package/dist/utils/rest/interceptors/response.interceptor.js +0 -25
  100. package/dist/utils/rest/rest-client.js +0 -62
  101. /package/dist/assets/icons/{Warningfilled.d.ts → WarningFilled.d.ts} +0 -0
  102. /package/dist/utils/{rest/rest.utils.d.ts → rest.utils.d.ts} +0 -0
  103. /package/dist/utils/{rest/interceptors → vendor}/rest-interceptor.d.ts +0 -0
  104. /package/dist/utils/{rest/interceptors → vendor}/rest-interceptor.js +0 -0
@@ -1,9 +1,35 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Fragment, useRef } from "react";
3
+ import { useFocusable } from "react-aria";
2
4
  import { TooltipTrigger, Tooltip as Tooltip$1, OverlayArrow } from "react-aria-components";
3
5
  import { PointerHorizontalIcon } from "../../../assets/icons/PointerHorizontal.js";
4
6
  import { PointerVerticalIcon } from "../../../assets/icons/PointerVertical.js";
7
+ import { tooltipCva, tooltipPointerHorizontalCva, tooltipPointerVerticalCva, tooltipTextCva } from "./tooltip.cva.js";
5
8
  import { Typography } from "../../text/Typography/Typography.js";
6
- const Tooltip = ({ children, text, isDisabled, delay, closeDelay, ...tooltipProps }) => {
9
+ const CustomTrigger = ({ children }) => {
10
+ const ref = useRef(null);
11
+ const { focusableProps } = useFocusable({}, ref);
12
+ return /* @__PURE__ */ jsx(
13
+ "div",
14
+ {
15
+ ref,
16
+ ...focusableProps,
17
+ tabIndex: 0,
18
+ children
19
+ }
20
+ );
21
+ };
22
+ const Tooltip = ({
23
+ children,
24
+ text,
25
+ isDisabled,
26
+ delay,
27
+ closeDelay,
28
+ color,
29
+ isNonInteractiveTrigger,
30
+ ...tooltipProps
31
+ }) => {
32
+ const Trigger = isNonInteractiveTrigger ? CustomTrigger : Fragment;
7
33
  return /* @__PURE__ */ jsxs(
8
34
  TooltipTrigger,
9
35
  {
@@ -11,24 +37,24 @@ const Tooltip = ({ children, text, isDisabled, delay, closeDelay, ...tooltipProp
11
37
  closeDelay: closeDelay ?? 0,
12
38
  isDisabled,
13
39
  children: [
14
- children,
40
+ /* @__PURE__ */ jsx(Trigger, { children }),
15
41
  /* @__PURE__ */ jsxs(
16
42
  Tooltip$1,
17
43
  {
18
- className: "group max-w-64 rounded-tooltip-rounding-default bg-interactive-contained-secondary-idle px-tooltip-side-default py-tooltip-height-default shadow-2",
44
+ className: tooltipCva({ color }),
19
45
  ...tooltipProps,
20
46
  offset: 13,
21
47
  children: [
22
48
  /* @__PURE__ */ jsxs(OverlayArrow, { children: [
23
- /* @__PURE__ */ jsx(PointerHorizontalIcon, { className: "h-2-5 w-5 text-interactive-contained-secondary-idle group-placement-left:hidden group-placement-right:hidden group-placement-top:rotate-180" }),
24
- /* @__PURE__ */ jsx(PointerVerticalIcon, { className: "h-5 w-2-5 text-interactive-contained-secondary-idle group-placement-bottom:hidden group-placement-top:hidden group-placement-left:rotate-180" })
49
+ /* @__PURE__ */ jsx(PointerHorizontalIcon, { className: tooltipPointerHorizontalCva({ color }) }),
50
+ /* @__PURE__ */ jsx(PointerVerticalIcon, { className: tooltipPointerVerticalCva({ color }) })
25
51
  ] }),
26
52
  /* @__PURE__ */ jsx(
27
53
  Typography,
28
54
  {
29
55
  size: "body-4",
30
56
  variant: "prominent-1",
31
- className: "text-text-inverted-3",
57
+ className: tooltipTextCva({ color }),
32
58
  children: text
33
59
  }
34
60
  )
@@ -0,0 +1,21 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export declare const tooltipCva: (props?: ({
3
+ color?: "default" | "error" | null | undefined;
4
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
5
+ export interface TooltipVariantProps extends VariantProps<typeof tooltipCva> {
6
+ }
7
+ export declare const tooltipPointerHorizontalCva: (props?: ({
8
+ color?: "default" | "error" | null | undefined;
9
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
10
+ export interface TooltipPointerHorizontalVariantProps extends VariantProps<typeof tooltipPointerHorizontalCva> {
11
+ }
12
+ export declare const tooltipPointerVerticalCva: (props?: ({
13
+ color?: "default" | "error" | null | undefined;
14
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
15
+ export interface TooltipPointerVerticalVariantProps extends VariantProps<typeof tooltipPointerVerticalCva> {
16
+ }
17
+ export declare const tooltipTextCva: (props?: ({
18
+ color?: "default" | "error" | null | undefined;
19
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
20
+ export interface TooltipTextVariantProps extends VariantProps<typeof tooltipTextCva> {
21
+ }
@@ -0,0 +1,60 @@
1
+ import { cva } from "class-variance-authority";
2
+ const tooltipCva = cva(
3
+ ["group max-w-64 rounded-tooltip-rounding-default px-tooltip-side-default py-tooltip-height-default shadow-2"],
4
+ {
5
+ variants: {
6
+ color: {
7
+ default: ["bg-interactive-contained-secondary-idle"],
8
+ error: ["w-max bg-text-error-1"]
9
+ }
10
+ },
11
+ defaultVariants: {
12
+ color: "default"
13
+ }
14
+ }
15
+ );
16
+ const tooltipPointerHorizontalCva = cva(
17
+ ["h-2-5 w-5 group-placement-left:hidden group-placement-right:hidden group-placement-top:rotate-180"],
18
+ {
19
+ variants: {
20
+ color: {
21
+ default: ["text-interactive-contained-secondary-idle"],
22
+ error: ["text-text-error-1"]
23
+ }
24
+ },
25
+ defaultVariants: {
26
+ color: "default"
27
+ }
28
+ }
29
+ );
30
+ const tooltipPointerVerticalCva = cva(
31
+ ["h-5 w-2-5 group-placement-bottom:hidden group-placement-top:hidden group-placement-left:rotate-180"],
32
+ {
33
+ variants: {
34
+ color: {
35
+ default: ["text-interactive-contained-secondary-idle"],
36
+ error: ["text-text-error-1"]
37
+ }
38
+ },
39
+ defaultVariants: {
40
+ color: "default"
41
+ }
42
+ }
43
+ );
44
+ const tooltipTextCva = cva([], {
45
+ variants: {
46
+ color: {
47
+ default: ["text-text-inverted-3"],
48
+ error: ["text-interactive-text-secondary-idle-inverted"]
49
+ }
50
+ },
51
+ defaultVariants: {
52
+ color: "default"
53
+ }
54
+ });
55
+ export {
56
+ tooltipCva,
57
+ tooltipPointerHorizontalCva,
58
+ tooltipPointerVerticalCva,
59
+ tooltipTextCva
60
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { mergeRefs } from "@react-aria/utils";
3
3
  import { clsx } from "clsx";
4
- import { useRef, Fragment } from "react";
4
+ import { useRef, useMemo, Fragment } from "react";
5
5
  import { useToggleButtonGroup } from "react-aria";
6
6
  import { ToggleButtonGroup } from "react-aria-components";
7
7
  import { Controller } from "react-hook-form";
@@ -38,6 +38,9 @@ const SegmentBase = ({
38
38
  onChange?.(Array.from(keys.values())[0]);
39
39
  }
40
40
  };
41
+ const gridTemplateColumns = useMemo(() => {
42
+ return items.length > 2 ? Array.from({ length: items.length * 2 - 1 }, (_, i) => i % 2 === 0 ? "1fr" : "auto").join(" ") : `repeat(${items.length}, 1fr)`;
43
+ }, [items.length]);
41
44
  return /* @__PURE__ */ jsx(
42
45
  FormField,
43
46
  {
@@ -51,11 +54,14 @@ const SegmentBase = ({
51
54
  ref: buttonGroupRef,
52
55
  onSelectionChange,
53
56
  className: clsx(
54
- "group/segment flex w-fit items-center gap-segmented-control-side-segmented-control p-segmented-control-side-segmented-control",
57
+ "group/segment grid w-fit items-center gap-segmented-control-side-segmented-control p-segmented-control-side-segmented-control",
55
58
  "bg-elevation-fill-default-3",
56
59
  "rounded-segmented-control-rounding-segmented-control",
57
60
  className
58
61
  ),
62
+ style: {
63
+ gridTemplateColumns
64
+ },
59
65
  children: items.map((item, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
60
66
  /* @__PURE__ */ jsx(
61
67
  SegmentItem,
@@ -4,6 +4,7 @@ import { ToggleButton } from "react-aria-components";
4
4
  import { Typography } from "../text/Typography/Typography.js";
5
5
  const SegmentItem = ({ label, icon, id, isDisabled, ...props }) => {
6
6
  const IconComponent = icon;
7
+ const iconOnly = icon && !label;
7
8
  return /* @__PURE__ */ jsxs(
8
9
  ToggleButton,
9
10
  {
@@ -11,7 +12,9 @@ const SegmentItem = ({ label, icon, id, isDisabled, ...props }) => {
11
12
  id,
12
13
  className: clsx(
13
14
  "flex items-center justify-center gap-1 transition-all duration-200",
14
- "px-segmented-control-side-segment py-segmented-control-height-segment",
15
+ "border border-transparent",
16
+ "py-segmented-control-height-segment",
17
+ iconOnly ? "px-segmented-control-height-segment" : "px-segmented-control-side-segment py-segmented-control-height-segment",
15
18
  "rounded-segmented-control-rounding-segment",
16
19
  "hover:bg-interactive-subtle-secondary-hover",
17
20
  "pressed:bg-interactive-subtle-secondary-pressed",
@@ -25,7 +28,6 @@ const SegmentItem = ({ label, icon, id, isDisabled, ...props }) => {
25
28
  label && /* @__PURE__ */ jsx(
26
29
  Typography,
27
30
  {
28
- variant: props.isSelected ? "prominent-1" : "default",
29
31
  size: "label-2",
30
32
  as: "span",
31
33
  className: "overflow-hidden text-ellipsis text-center",
@@ -5,9 +5,9 @@ const CellText = ({ children, style, className }) => /* @__PURE__ */ jsx(
5
5
  Typography,
6
6
  {
7
7
  variant: "default",
8
- size: "label-2",
8
+ size: "label-1",
9
9
  as: "span",
10
- className: clsx("overflow-hidden text-ellipsis text-text-default-2", className),
10
+ className: clsx("block overflow-hidden text-ellipsis px-2 py-1-5 text-text-default-2", className),
11
11
  style,
12
12
  "data-rac": true,
13
13
  children
@@ -6,7 +6,7 @@ const HeaderText = ({ children }) => /* @__PURE__ */ jsx(
6
6
  variant: "default",
7
7
  size: "label-2",
8
8
  as: "span",
9
- className: "overflow-hidden text-ellipsis text-text-default-1",
9
+ className: "overflow-hidden text-ellipsis px-table-cell-content-side-m py-table-cell-content-height-m text-text-default-1",
10
10
  children
11
11
  }
12
12
  );
@@ -6,7 +6,7 @@ import { CSS } from "@dnd-kit/utilities";
6
6
  import { getCoreRowModel, getSortedRowModel, getPaginationRowModel, useReactTable, flexRender } from "@tanstack/react-table";
7
7
  import { clsx } from "clsx";
8
8
  import i18next from "i18next";
9
- import { useRef, useCallback, useMemo } from "react";
9
+ import { useRef, useCallback, useMemo, useState } from "react";
10
10
  import { ChevronDownIcon } from "../../assets/icons/ChevronDown.js";
11
11
  import { ChevronUpIcon } from "../../assets/icons/ChevronUp.js";
12
12
  import { DragIcon } from "../../assets/icons/Drag.js";
@@ -15,7 +15,7 @@ import { CellText } from "./CellText.js";
15
15
  import { HeaderText } from "./HeaderText.js";
16
16
  import { UIStyle } from "../../config/uiStyle.context.js";
17
17
  import { useTableNav } from "../../hooks/useTableNav.js";
18
- import { tableRow, tableHeadRow, tableData } from "./table.cva.js";
18
+ import { tableRow, tableHeadRow, tableHeadData, tableData } from "./table.cva.js";
19
19
  const CustomCellContext = (context) => {
20
20
  return { ...context, original: context.row.original, data: context.row.original, value: context.getValue() };
21
21
  };
@@ -69,16 +69,19 @@ const DraggableRow = ({
69
69
  "data-clickable": hasOnClick,
70
70
  "data-selected": row.getIsSelected() || void 0,
71
71
  className: clsx(tableRowCva(props)),
72
- onClick: () => onRowClick?.(row.original),
72
+ onClick: () => {
73
+ row.toggleSelected();
74
+ onRowClick?.(row.original);
75
+ },
73
76
  onDoubleClick: () => onDoubleClick?.(row.original),
74
- children: row.getVisibleCells().map((cell, cellIndex, array) => {
77
+ children: row.getVisibleCells().map((cell, cellIndex) => {
75
78
  const columnMeta = cell.column.columnDef.meta ?? {};
76
79
  return /* @__PURE__ */ jsx(
77
80
  "td",
78
81
  {
79
82
  tabIndex: -1,
80
83
  className: clsx(
81
- tableDataCva({ isLast: cellIndex === array.length - 1, hasBorder: cellIndex > 0 && showCellBorder }),
84
+ tableDataCva({ hasRightBorder: cellIndex > 0 && showCellBorder }),
82
85
  columnMeta.cellClass,
83
86
  columnMeta.width
84
87
  ),
@@ -110,7 +113,7 @@ const Table = ({
110
113
  onReorder,
111
114
  getRowId,
112
115
  enableRowSelection,
113
- enableMultiRowSelection,
116
+ enableMultiRowSelection = false,
114
117
  defaultSelectedRows,
115
118
  onRowSelectionChange,
116
119
  ...props
@@ -118,6 +121,7 @@ const Table = ({
118
121
  const uiStyle = UIStyle.useConfig();
119
122
  const tableRowCva = uiStyle?.table?.rowCva ?? tableRow;
120
123
  const tableHeadRowCva = uiStyle?.table?.headRowCva ?? tableHeadRow;
124
+ const tableHeadDataCva = uiStyle?.table?.headDataCva ?? tableHeadData;
121
125
  const tableDataCva = uiStyle?.table?.dataCva ?? tableData;
122
126
  const ref = useRef(null);
123
127
  const { listeners } = useTableNav();
@@ -125,6 +129,14 @@ const Table = ({
125
129
  const getSortedRowModelCallback = useCallback(getSortedRowModel, []);
126
130
  const getPaginationRowModelCallback = useCallback(getPaginationRowModel, []);
127
131
  const data = useMemo(() => items ?? [], [items]);
132
+ const [internalSelectedRows, setInternalSelectedRows] = useState({});
133
+ const { rowSelection, handleRowSelectionChange } = useMemo(() => {
134
+ const hasExternalRowSelection = defaultSelectedRows !== void 0 && onRowSelectionChange !== void 0;
135
+ return {
136
+ rowSelection: hasExternalRowSelection ? defaultSelectedRows : internalSelectedRows,
137
+ handleRowSelectionChange: hasExternalRowSelection ? onRowSelectionChange : setInternalSelectedRows
138
+ };
139
+ }, [defaultSelectedRows, onRowSelectionChange, internalSelectedRows]);
128
140
  const baseColumns = useMemo(() => typeof columns === "function" ? columns(i18next.t) : columns, [columns]);
129
141
  const tableColumns = useMemo(() => {
130
142
  if (enableDragDrop && getRowId) {
@@ -148,7 +160,7 @@ const Table = ({
148
160
  sorting,
149
161
  columnOrder,
150
162
  columnVisibility,
151
- rowSelection: defaultSelectedRows ?? {}
163
+ rowSelection
152
164
  },
153
165
  rowCount: items.length,
154
166
  getCoreRowModel: getCoreRowModelCallback(),
@@ -158,10 +170,13 @@ const Table = ({
158
170
  onColumnOrderChange: setColumnOrder,
159
171
  onColumnVisibilityChange: setColumnVisibility,
160
172
  onSortingChange: setSorting,
161
- onRowSelectionChange,
173
+ onRowSelectionChange: handleRowSelectionChange,
162
174
  manualSorting: true,
163
175
  autoResetPageIndex: false,
164
176
  autoResetExpanded: false,
177
+ defaultColumn: {
178
+ sortDescFirst: true
179
+ },
165
180
  enableRowSelection,
166
181
  enableMultiRowSelection,
167
182
  getRowId: getRowId ? (row) => String(getRowId(row)) : void 0
@@ -212,7 +227,7 @@ const Table = ({
212
227
  return false;
213
228
  }
214
229
  return header.column.getIsVisible();
215
- }).map((header, index, array) => {
230
+ }).map((header, index) => {
216
231
  const columnMeta = header.column.columnDef.meta ?? {};
217
232
  return /* @__PURE__ */ jsx(
218
233
  "th",
@@ -220,9 +235,9 @@ const Table = ({
220
235
  colSpan: isAnyRowSelected ? columnCount : header.colSpan,
221
236
  tabIndex: -1,
222
237
  className: clsx(
223
- "px-2 text-left",
224
- index > 0 && showCellBorder && "border-l border-l-elevation-outline-default-1 border-solid",
225
- index === array.length - 1 && "pr-4",
238
+ tableHeadDataCva({
239
+ hasRightBorder: index > 0 && showCellBorder
240
+ }),
226
241
  columnMeta.headerClass,
227
242
  columnMeta.width
228
243
  ),
@@ -285,6 +300,7 @@ const Table = ({
285
300
  onRowClick,
286
301
  onDoubleClick,
287
302
  tableRowCva,
303
+ tableHeadDataCva,
288
304
  tableDataCva,
289
305
  hasOnClick,
290
306
  ...props
@@ -299,11 +315,14 @@ const Table = ({
299
315
  "tr",
300
316
  {
301
317
  className: clsx(tableRowCva({ ...props })),
302
- onClick: () => onRowClick?.(row.original),
318
+ onClick: () => {
319
+ row.toggleSelected();
320
+ onRowClick?.(row.original);
321
+ },
303
322
  onDoubleClick: () => onDoubleClick?.(row.original),
304
323
  "data-clickable": hasOnClick,
305
324
  "data-selected": row.getIsSelected() || void 0,
306
- children: row.getVisibleCells().map((cell, cellIndex, array) => {
325
+ children: row.getVisibleCells().map((cell, cellIndex) => {
307
326
  const columnMeta = cell.column.columnDef.meta ?? {};
308
327
  return /* @__PURE__ */ jsx(
309
328
  "td",
@@ -311,8 +330,7 @@ const Table = ({
311
330
  tabIndex: -1,
312
331
  className: clsx(
313
332
  tableDataCva({
314
- isLast: cellIndex === array.length - 1,
315
- hasBorder: cellIndex > 0 && showCellBorder
333
+ hasRightBorder: cellIndex > 0 && showCellBorder
316
334
  }),
317
335
  columnMeta.cellClass,
318
336
  columnMeta.width
@@ -7,9 +7,13 @@ export interface TableRowVariantProps extends VariantProps<typeof tableRow> {
7
7
  export declare const tableHeadRow: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
8
8
  export interface TableHeadRowVariantProps extends VariantProps<typeof tableHeadRow> {
9
9
  }
10
+ export declare const tableHeadData: (props?: ({
11
+ hasRightBorder?: boolean | null | undefined;
12
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
13
+ export interface TableHeadDataVariantProps extends VariantProps<typeof tableHeadData> {
14
+ }
10
15
  export declare const tableData: (props?: ({
11
- isLast?: boolean | null | undefined;
12
- hasBorder?: boolean | null | undefined;
16
+ hasRightBorder?: boolean | null | undefined;
13
17
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
14
- export interface TableDataVariantProps extends VariantProps<typeof tableDataRow> {
18
+ export interface TableDataVariantProps extends VariantProps<typeof tableData> {
15
19
  }
@@ -1,12 +1,13 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  const tableRow = cva(
3
3
  [
4
- "h-9 max-h-12 border-b border-b-elevation-outline-default-1 border-solid",
4
+ "h-9 max-h-12",
5
5
  "hover:bg-elevation-fill-default-2",
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
+ "clickable:cursor-pointer",
10
+ "focus-within:bg-elevation-fill-default-2"
10
11
  ],
11
12
  {
12
13
  variants: {
@@ -18,20 +19,45 @@ const tableRow = cva(
18
19
  }
19
20
  );
20
21
  const tableHeadRow = cva(["h-8 w-full"]);
21
- const tableData = cva(["relative overflow-hidden text-ellipsis whitespace-nowrap px-2"], {
22
- variants: {
23
- isLast: {
24
- true: "pr-4",
25
- false: ""
22
+ const tableHeadData = cva(
23
+ ["border-b border-b-elevation-outline-default-1 border-solid px-table-header-cell-container-side-default text-left"],
24
+ {
25
+ variants: {
26
+ hasRightBorder: {
27
+ true: "border-l border-l-elevation-outline-default-1 border-solid",
28
+ false: ""
29
+ }
26
30
  },
27
- hasBorder: {
28
- true: "border-l border-l-elevation-outline-default-1",
29
- false: ""
31
+ defaultVariants: {
32
+ hasRightBorder: true
30
33
  }
31
34
  }
32
- });
35
+ );
36
+ const tableData = cva(
37
+ [
38
+ "relative h-0-5 overflow-hidden text-ellipsis whitespace-nowrap border-t border-t-transparent px-2 py-2",
39
+ "border-b border-b-elevation-outline-default-1",
40
+ "has-[input[data-invalid]]:border-b-input-outlined-outline-error!",
41
+ "has-[input]:hover:border-b-input-outlined-outline-hover",
42
+ "has-[input]:focus:border-b-input-outlined-outline-active",
43
+ "has-[input]:invalid:border-b-input-outlined-outline-error",
44
+ "has-[input]:disabled:hover:border-transparent"
45
+ ],
46
+ {
47
+ variants: {
48
+ hasRightBorder: {
49
+ true: "border-l border-l-elevation-outline-default-1",
50
+ false: ""
51
+ }
52
+ },
53
+ defaultVariants: {
54
+ hasRightBorder: true
55
+ }
56
+ }
57
+ );
33
58
  export {
34
59
  tableData,
60
+ tableHeadData,
35
61
  tableHeadRow,
36
62
  tableRow
37
63
  };
@@ -1,5 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { CheckboxProps } from '../components/inputs/Checkbox/Checkbox';
3
+ import { DatePickerProps } from '../components/inputs/DateTime/DatePicker/DatePicker';
3
4
  import { NumberInputProps } from '../components/inputs/Input/NumberInput/NumberInput';
4
5
  import { TextInputProps } from '../components/inputs/Input/TextInput/TextInput';
5
6
  import { RadioGroupProps } from '../components/inputs/RadioGroup/RadioGroup';
@@ -15,9 +16,10 @@ export declare namespace UIConfig {
15
16
  numberInput: Pick<NumberInputProps, "formatOptions">;
16
17
  radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel">;
17
18
  checkbox: Pick<CheckboxProps, "variant">;
18
- select: Pick<SelectBaseProps, "selectionMode" | "isSearchable">;
19
+ select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "selectedTagsType">;
19
20
  toggle: Pick<ToggleProps, "variant">;
20
21
  slider: Pick<SliderProps, "minValue" | "maxValue">;
22
+ dateInput: Pick<DatePickerProps, "todayIcon" | "shouldForceLeadingZeros">;
21
23
  }
22
24
  interface ProviderProps {
23
25
  config?: Partial<Options>;
@@ -27,7 +27,8 @@ var UIConfig;
27
27
  },
28
28
  select: {
29
29
  selectionMode: "single",
30
- isSearchable: false
30
+ isSearchable: false,
31
+ selectedTagsType: "list"
31
32
  },
32
33
  toggle: {
33
34
  variant: "default"
@@ -35,6 +36,10 @@ var UIConfig;
35
36
  slider: {
36
37
  minValue: 0,
37
38
  maxValue: 100
39
+ },
40
+ dateInput: {
41
+ todayIcon: false,
42
+ shouldForceLeadingZeros: false
38
43
  }
39
44
  };
40
45
  const Context = createContext(DEFAULT_CONFIG);
@@ -9,7 +9,7 @@ import { LabelBaseProps } from '../components/inputs/shared/label.cva';
9
9
  import { ToggleVariantProps } from '../components/inputs/Toggle/toggle.cva';
10
10
  import { AlertVariantProps } from '../components/status/Alert/alert.cva';
11
11
  import { ToastVariantProps } from '../components/status/Toast/toast.cva';
12
- import { TableDataVariantProps, TableHeadRowVariantProps, TableRowVariantProps } from '../components/table/table.cva';
12
+ import { TableDataVariantProps, TableHeadDataVariantProps, TableHeadRowVariantProps, TableRowVariantProps } from '../components/table/table.cva';
13
13
  import { LinkVariantProps } from '../components/text/Link/link.cva';
14
14
  import { TagVariantProps } from '../components/text/Tag/tag.cva';
15
15
  import { TypographyVariantProps } from '../components/text/Typography/typography.cva';
@@ -71,6 +71,7 @@ export declare namespace UIStyle {
71
71
  };
72
72
  table: {
73
73
  headRowCva?: Cva<TableHeadRowVariantProps>;
74
+ headDataCva?: Cva<TableHeadDataVariantProps>;
74
75
  rowCva?: Cva<TableRowVariantProps>;
75
76
  dataCva?: Cva<TableDataVariantProps>;
76
77
  };
@@ -261,12 +261,12 @@ const removeOverriddenPresetColumns = (presetColumns, options) => {
261
261
  const columnDef = value;
262
262
  return columnDef.id ?? key;
263
263
  });
264
- const usedIds = [...usedColumnsIds, ...usedCustomColumnsIds];
264
+ const usedIds = /* @__PURE__ */ new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
265
265
  return presetColumns.filter((column) => {
266
266
  if (!column.id) {
267
267
  return true;
268
268
  }
269
- return !usedIds.includes(column.id);
269
+ return !usedIds.has(column.id);
270
270
  });
271
271
  };
272
272
  const getAllSchemaKeys = (schema) => {
@@ -14,6 +14,7 @@ declare const defaultComponentTypes: {
14
14
  readonly email: "textInput";
15
15
  readonly object: "unknown";
16
16
  readonly array: "select";
17
+ readonly uuid: "select";
17
18
  readonly unknown: "unknown";
18
19
  };
19
20
  export type DefaultComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeSwitch<TZodType, typeof defaultComponentTypes>;
@@ -29,6 +30,7 @@ export type AllowedComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeS
29
30
  array: "select" | "autocomplete" | "queryAutocomplete" | "segment";
30
31
  object: InputComponentType;
31
32
  unknown: InputComponentType;
33
+ uuid: "select" | "autocomplete" | "queryAutocomplete" | "segment";
32
34
  }>;
33
35
  interface DynamicInputDefBase<TProps> {
34
36
  label?: string;
@@ -13,6 +13,7 @@ const defaultComponentTypes = {
13
13
  email: "textInput",
14
14
  object: "unknown",
15
15
  array: "select",
16
+ uuid: "select",
16
17
  unknown: "unknown"
17
18
  };
18
19
  const ZOD_TYPE_COMPONENT_TYPE = [
@@ -23,7 +24,8 @@ const ZOD_TYPE_COMPONENT_TYPE = [
23
24
  [z.ZodString, defaultComponentTypes.string],
24
25
  [z.ZodEmail, defaultComponentTypes.email],
25
26
  [z.ZodObject, defaultComponentTypes.object],
26
- [z.ZodArray, defaultComponentTypes.array]
27
+ [z.ZodArray, defaultComponentTypes.array],
28
+ [z.ZodUUID, defaultComponentTypes.uuid]
27
29
  ];
28
30
  const DEFAULT_NAMESPACE = "dynamicInputs";
29
31
  const sortInputDefs = (inputDefs, orderKeys) => {
@@ -134,8 +136,8 @@ const removeOverriddenPresetInputs = (presetInputs, options) => {
134
136
  if (presetInputs.length === 0) {
135
137
  return presetInputs;
136
138
  }
137
- const usedKeys = Object.entries(options.inputs ?? {}).map(([key]) => String(key));
138
- return presetInputs.filter((input) => !usedKeys.includes(String(input.name)));
139
+ const usedKeys = new Set(Object.keys(options.inputs ?? {}).map(String));
140
+ return presetInputs.filter((input) => !usedKeys.has(String(input.name)));
139
141
  };
140
142
  const validateParams = (schema, presetInputs, options) => {
141
143
  const { inputs, order, includeAll } = options;
@@ -51,7 +51,10 @@ function useAutosave({
51
51
  }
52
52
  timeoutRef.current = setTimeout(() => {
53
53
  handleSubmit(async (data) => {
54
- const dirtyData = Object.entries(dirtyFields).filter(([, value]) => value).reduce((acc, [key]) => ({ ...acc, [key]: data[key] }), {});
54
+ const dirtyData = Object.entries(dirtyFields).filter(([, value]) => value).reduce((acc, [key]) => {
55
+ acc[key] = data[key];
56
+ return acc;
57
+ }, {});
55
58
  const changedData = diffLeftOnly(dirtyData, defaultValues, dirtyFields) ?? {};
56
59
  if (Object.keys(changedData).length === 0) {
57
60
  return void 0;
@@ -6,7 +6,11 @@ function sortByKeyOrder(data, orderedKeys = []) {
6
6
  }
7
7
  function useTableColumnConfig(defaultColumns, options = {}) {
8
8
  const [internalVisibleColumns, setInternalVisibleColumns] = useState(
9
- () => defaultColumns.map((col) => ({ [col.id ?? col.accessorKey]: true })).reduce((acc, cur) => ({ ...cur, ...acc }), {})
9
+ () => defaultColumns.reduce((acc, col) => {
10
+ const key = col.id ?? col.accessorKey;
11
+ acc[key] = true;
12
+ return acc;
13
+ }, {})
10
14
  );
11
15
  const [internalColumnOrder, setInternalColumnOrder] = useState(
12
16
  () => defaultColumns.map((col) => col.id ?? col.accessorKey)
package/dist/index.d.ts CHANGED
@@ -176,7 +176,6 @@ export { useLocalStorage } from './hooks/useLocalStorage';
176
176
  export { useLongPressRepeat } from './hooks/useLongPressRepeat';
177
177
  export { usePagination } from './hooks/usePagination';
178
178
  export { useScrollableListBox } from './hooks/useScrollableListBox';
179
- export { useSingletonMutation } from './hooks/useSingletonMutation';
180
179
  export { useSorting } from './hooks/useSorting';
181
180
  export { useStateAndRef } from './hooks/useStateAndRef';
182
181
  export { useTableColumnConfig } from './hooks/useTableColumnConfig';
@@ -194,12 +193,19 @@ export { isEqual } from './utils/isEqual';
194
193
  export { logger } from './utils/logger';
195
194
  export { ObjectUtils } from './utils/object.utils';
196
195
  export { QueriesUtils } from './utils/queries.utils';
197
- export { LoggingInterceptor } from './utils/rest/interceptors/logging.interceptor';
198
- export { ResponseInterceptor } from './utils/rest/interceptors/response.interceptor';
199
- export { RestInterceptor } from './utils/rest/interceptors/rest-interceptor';
200
- export { RestUtils } from './utils/rest/rest.utils';
201
- export { RestClient } from './utils/rest/rest-client';
196
+ export { RestUtils } from './utils/rest.utils';
202
197
  export { RoutingUtils } from './utils/routing.utils';
203
198
  export { StringUtils } from './utils/string.utils';
199
+ export { createAclGuard } from './utils/vendor/acl/AclGuard';
200
+ export { AbilityContext } from './utils/vendor/acl/ability.context';
201
+ export type { AppAbilities, AppAbility } from './utils/vendor/acl/appAbility.types';
202
+ export { Can } from './utils/vendor/acl/Can';
203
+ export type { AuthGuardProps } from './utils/vendor/auth/AuthGuard';
204
+ export { AuthGuard } from './utils/vendor/auth/AuthGuard';
205
+ export { AuthContext } from './utils/vendor/auth/auth.context';
206
+ export type { WithPrivateAuthGuardProps } from './utils/vendor/auth/withPrivateAuthGuard';
207
+ export { withPrivateAuthGuard } from './utils/vendor/auth/withPrivateAuthGuard';
204
208
  export type { GeneralErrorCodes } from './utils/vendor/error-handling';
205
209
  export { ApplicationException, ErrorHandler, SharedErrorHandler } from './utils/vendor/error-handling';
210
+ export type { RequestConfig, RequestInfo, Response, RestClient as IRestClient, } from './utils/vendor/rest-client.types';
211
+ export { RestInterceptor } from './utils/vendor/rest-interceptor';