@sito/dashboard 0.0.68 → 0.0.70

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 (99) hide show
  1. package/README.md +7 -0
  2. package/dist/{Dropdown-CAxauIXt.cjs → Dropdown-CR8mco5s.cjs} +1 -1
  3. package/dist/{Dropdown-CbaxuMbk.js → Dropdown-D-fYEGo2.js} +13 -14
  4. package/dist/Dropdown.cjs +1 -1
  5. package/dist/Dropdown.css +1 -1
  6. package/dist/Dropdown.js +1 -1
  7. package/dist/FileInput-CqzVk1gQ.cjs +1 -0
  8. package/dist/FileInput-Cr4TxWUg.js +93 -0
  9. package/dist/FiltersProvider-BV023mmu.js +60 -0
  10. package/dist/FiltersProvider-DVMj0LV0.cjs +1 -0
  11. package/dist/FiltersProvider.cjs +1 -1
  12. package/dist/FiltersProvider.js +1 -1
  13. package/dist/Form.cjs +1 -1
  14. package/dist/Form.js +1 -1
  15. package/dist/SvgIcons.cjs +1 -1
  16. package/dist/SvgIcons.js +11 -9
  17. package/dist/Table-CWcHaZeQ.cjs +1 -0
  18. package/dist/Table-LcN-UV8f.js +1184 -0
  19. package/dist/Table.cjs +1 -1
  20. package/dist/Table.css +1 -1
  21. package/dist/Table.js +9 -8
  22. package/dist/TableColumns-BjTNomZf.cjs +1 -0
  23. package/dist/{Filters-DL5jd8ps.js → TableColumns-CIddkosX.js} +37 -9
  24. package/dist/TableOptions.cjs +1 -1
  25. package/dist/TableOptions.js +1 -1
  26. package/dist/TableOptionsProvider-BgnISoXx.js +120 -0
  27. package/dist/TableOptionsProvider-i4uVLLwH.cjs +1 -0
  28. package/dist/TextInput.css +1 -1
  29. package/dist/components/Dropdown/Dropdown.d.ts +1 -1
  30. package/dist/components/Form/CheckInput/types.d.ts +1 -1
  31. package/dist/components/Form/FileInput/types.d.ts +3 -3
  32. package/dist/components/Form/SelectInput/types.d.ts +1 -1
  33. package/dist/components/Form/TextInput/types.d.ts +1 -1
  34. package/dist/components/Form/types.d.ts +2 -1
  35. package/dist/components/SvgIcons/BarsStaggered.d.ts +7 -0
  36. package/dist/components/SvgIcons/ChevronDown.d.ts +1 -1
  37. package/dist/components/SvgIcons/ChevronLeft.d.ts +1 -1
  38. package/dist/components/SvgIcons/ChevronRight.d.ts +1 -1
  39. package/dist/components/SvgIcons/ChevronUp.d.ts +1 -1
  40. package/dist/components/SvgIcons/Close.d.ts +1 -1
  41. package/dist/components/SvgIcons/Ellipsis.d.ts +1 -1
  42. package/dist/components/SvgIcons/File.d.ts +1 -1
  43. package/dist/components/SvgIcons/Filters.d.ts +1 -1
  44. package/dist/components/SvgIcons/TableColumns.d.ts +7 -0
  45. package/dist/components/SvgIcons/index.d.ts +2 -0
  46. package/dist/components/Table/components/ColumnVisibilityMenu.d.ts +12 -0
  47. package/dist/components/Table/components/TableHeader/types.d.ts +2 -0
  48. package/dist/components/Table/components/index.d.ts +1 -0
  49. package/dist/components/Table/components/types.d.ts +3 -1
  50. package/dist/components/Table/types.d.ts +1 -1
  51. package/dist/components/Table/utils.d.ts +2 -1
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.css +1 -1
  54. package/dist/index.js +59 -56
  55. package/dist/providers/TableOptions/types.d.ts +5 -0
  56. package/package.json +1 -1
  57. package/dist/FileInput-DNoJELoS.js +0 -91
  58. package/dist/FileInput-YvKQ-wok.cjs +0 -1
  59. package/dist/Filters-Dyee8QYH.cjs +0 -1
  60. package/dist/FiltersProvider-BlHv12dU.cjs +0 -1
  61. package/dist/FiltersProvider-gfC9gS8u.js +0 -57
  62. package/dist/Table-B5vsXjAq.js +0 -1080
  63. package/dist/Table-DgFzKIJZ.cjs +0 -1
  64. package/dist/TableOptionsProvider-CDLZ4TXE.cjs +0 -1
  65. package/dist/TableOptionsProvider-HHCDcRbO.js +0 -55
  66. package/dist/components/Actions/Actions.stories.d.ts +0 -20
  67. package/dist/components/Actions/Actions.test.d.ts +0 -1
  68. package/dist/components/Actions/ActionsDropdown.stories.d.ts +0 -17
  69. package/dist/components/Actions/ActionsDropdown.test.d.ts +0 -1
  70. package/dist/components/Badge/Badge.stories.d.ts +0 -8
  71. package/dist/components/Button/Button.stories.d.ts +0 -29
  72. package/dist/components/Chip/Chip.stories.d.ts +0 -9
  73. package/dist/components/Dropdown/Dropdown.stories.d.ts +0 -8
  74. package/dist/components/Dropdown/Dropdown.test.d.ts +0 -1
  75. package/dist/components/Form/AutocompleteInput/AutocompleteInput.stories.d.ts +0 -8
  76. package/dist/components/Form/CheckInput/CheckInput.stories.d.ts +0 -8
  77. package/dist/components/Form/CheckInput/CheckInput.test.d.ts +0 -1
  78. package/dist/components/Form/FileInput/FileInput.stories.d.ts +0 -7
  79. package/dist/components/Form/FileInput/FileInput.test.d.ts +0 -1
  80. package/dist/components/Form/FileInput/utils.test.d.ts +0 -1
  81. package/dist/components/Form/SelectInput/SelectInput.stories.d.ts +0 -8
  82. package/dist/components/Form/TextInput/TextInput.stories.d.ts +0 -12
  83. package/dist/components/Form/TextInput/TextInput.test.d.ts +0 -1
  84. package/dist/components/Form/utils.test.d.ts +0 -1
  85. package/dist/components/IconButton/IconButton.stories.d.ts +0 -30
  86. package/dist/components/Loading/Loading.stories.d.ts +0 -7
  87. package/dist/components/Table/Table.expandable.test.d.ts +0 -1
  88. package/dist/components/Table/Table.selection.test.d.ts +0 -1
  89. package/dist/components/Table/Table.stories.d.ts +0 -20
  90. package/dist/components/Table/components/Filters/FilterDropdown/FilterDropdown.test.d.ts +0 -1
  91. package/dist/components/Table/components/Footer/Navigation.test.d.ts +0 -1
  92. package/dist/components/Table/components/TableHeader/TableHeader.test.d.ts +0 -1
  93. package/dist/components/Table/components/TableSelectionBar.test.d.ts +0 -1
  94. package/dist/components/Table/utils.test.d.ts +0 -1
  95. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -6
  96. package/dist/providers/FiltersProvider/FiltersProvider.test.d.ts +0 -1
  97. package/dist/providers/FiltersProvider/utils.test.d.ts +0 -1
  98. package/dist/providers/TableOptions/TableOptionsProvider.test.d.ts +0 -1
  99. package/dist/providers/Translation/TranslationProvider.test.d.ts +0 -1
package/README.md CHANGED
@@ -25,6 +25,7 @@ pnpm add @sito/dashboard
25
25
  ### Peer dependency
26
26
 
27
27
  - `react` (`>=18.2 <20`)
28
+ - `react-dom` (`>=18.2 <20`)
28
29
 
29
30
  ## Quick Usage
30
31
 
@@ -87,6 +88,12 @@ export function UsersTable() {
87
88
  }
88
89
  ```
89
90
 
91
+ ## Form Input Notes
92
+
93
+ - `SelectInput` expects `Option` items with an `id` (plus optional `value`/`name`).
94
+ - `CheckInput` is controlled with `checked` (not `value`).
95
+ - `FileInput` `onChange` receives the native input event; read files from `e.currentTarget.files`.
96
+
90
97
  ## Core `Table` Props
91
98
 
92
99
  | Prop | Type | Required | Description |
@@ -1 +1 @@
1
- var E=require("./Dropdown.css");const h=require("react/jsx-runtime"),u=require("react"),g=require("react-dom"),d=8;function w(s,l){const e=l.getBoundingClientRect(),c=window.innerWidth,o=window.innerHeight;let n=s.bottom+4,r=s.left;return r+e.width>c-d&&(r=s.right-e.width),r<d&&(r=d),n+e.height>o-d&&(n=s.top-e.height-4),n<d&&(n=d),{top:n,left:r}}const v=s=>{const{children:l,open:e,onClose:c,anchorEl:o}=s,n=u.useRef(null);u.useLayoutEffect(()=>{const t=n.current;if(!e||!o||!t)return;const i=o.getBoundingClientRect(),{top:a,left:p}=w(i,t);t.style.top=`${a}px`,t.style.left=`${p}px`},[e,o]),u.useEffect(()=>{if(!e||!o)return;const t=n.current;if(!t)return;const i=()=>{const a=o.getBoundingClientRect(),{top:p,left:m}=w(a,t);t.style.top=`${p}px`,t.style.left=`${m}px`};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[e,o]);const r=u.useCallback(t=>{const i=n.current;!e||!i||o?.contains(t.target)||i.contains(t.target)||c()},[e,c,o]),f=u.useCallback(t=>{e&&t.key==="Escape"&&c()},[e,c]);return u.useEffect(()=>{if(e)return setTimeout(()=>n.current?.focus(),0),document.addEventListener("mousedown",r),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",f)}},[e,r,f]),g.createPortal(h.jsx("div",{ref:n,role:"menu","aria-hidden":!e,tabIndex:-1,className:`dropdown-main ${e?"opened":"closed"}`,onClick:t=>t.stopPropagation(),children:l}),document.body)};exports.Dropdown=v;
1
+ var E=require("./Dropdown.css");const g=require("react/jsx-runtime"),u=require("react"),h=require("react-dom"),d=8;function w(s,l){const e=l.getBoundingClientRect(),c=window.innerWidth,o=window.innerHeight;let n=s.bottom+4,r=s.left;return r+e.width>c-d&&(r=s.right-e.width),r<d&&(r=d),n+e.height>o-d&&(n=s.top-e.height-4),n<d&&(n=d),{top:n,left:r}}const v=s=>{const{children:l,open:e,onClose:c,anchorEl:o}=s,n=u.useRef(null);u.useLayoutEffect(()=>{const t=n.current;if(!e||!o||!t)return;const i=o.getBoundingClientRect(),{top:a,left:p}=w(i,t);t.style.top=`${a}px`,t.style.left=`${p}px`},[e,o]),u.useEffect(()=>{if(!e||!o)return;const t=n.current;if(!t)return;const i=()=>{const a=o.getBoundingClientRect(),{top:p,left:m}=w(a,t);t.style.top=`${p}px`,t.style.left=`${m}px`};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[e,o]);const r=u.useCallback(t=>{const i=n.current;!e||!i||o?.contains(t.target)||i.contains(t.target)||c()},[e,c,o]),f=u.useCallback(t=>{e&&t.key==="Escape"&&c()},[e,c]);return u.useEffect(()=>{if(e)return setTimeout(()=>n.current?.focus(),0),document.addEventListener("mousedown",r),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",f)}},[e,r,f]),e?h.createPortal(g.jsx("div",{ref:n,role:"menu",tabIndex:-1,className:"dropdown-main opened",onClick:t=>t.stopPropagation(),children:l}),document.body):null};exports.Dropdown=v;
@@ -1,15 +1,15 @@
1
1
  import "./Dropdown.css";
2
- import { jsx as g } from "react/jsx-runtime";
2
+ import { jsx as h } from "react/jsx-runtime";
3
3
  import { useRef as v, useLayoutEffect as y, useEffect as m, useCallback as p } from "react";
4
4
  import { createPortal as E } from "react-dom";
5
- const d = 8;
6
- function w(s, u) {
7
- const e = u.getBoundingClientRect(), c = window.innerWidth, o = window.innerHeight;
5
+ const u = 8;
6
+ function w(s, d) {
7
+ const e = d.getBoundingClientRect(), c = window.innerWidth, o = window.innerHeight;
8
8
  let n = s.bottom + 4, r = s.left;
9
- return r + e.width > c - d && (r = s.right - e.width), r < d && (r = d), n + e.height > o - d && (n = s.top - e.height - 4), n < d && (n = d), { top: n, left: r };
9
+ return r + e.width > c - u && (r = s.right - e.width), r < u && (r = u), n + e.height > o - u && (n = s.top - e.height - 4), n < u && (n = u), { top: n, left: r };
10
10
  }
11
11
  const k = (s) => {
12
- const { children: u, open: e, onClose: c, anchorEl: o } = s, n = v(null);
12
+ const { children: d, open: e, onClose: c, anchorEl: o } = s, n = v(null);
13
13
  y(() => {
14
14
  const t = n.current;
15
15
  if (!e || !o || !t) return;
@@ -20,8 +20,8 @@ const k = (s) => {
20
20
  const t = n.current;
21
21
  if (!t) return;
22
22
  const i = () => {
23
- const f = o.getBoundingClientRect(), { top: a, left: h } = w(f, t);
24
- t.style.top = `${a}px`, t.style.left = `${h}px`;
23
+ const f = o.getBoundingClientRect(), { top: a, left: g } = w(f, t);
24
+ t.style.top = `${a}px`, t.style.left = `${g}px`;
25
25
  };
26
26
  return window.addEventListener("resize", i), () => window.removeEventListener("resize", i);
27
27
  }, [e, o]);
@@ -42,21 +42,20 @@ const k = (s) => {
42
42
  return setTimeout(() => n.current?.focus(), 0), document.addEventListener("mousedown", r), document.addEventListener("keydown", l), () => {
43
43
  document.removeEventListener("mousedown", r), document.removeEventListener("keydown", l);
44
44
  };
45
- }, [e, r, l]), E(
46
- /* @__PURE__ */ g(
45
+ }, [e, r, l]), e ? E(
46
+ /* @__PURE__ */ h(
47
47
  "div",
48
48
  {
49
49
  ref: n,
50
50
  role: "menu",
51
- "aria-hidden": !e,
52
51
  tabIndex: -1,
53
- className: `dropdown-main ${e ? "opened" : "closed"}`,
52
+ className: "dropdown-main opened",
54
53
  onClick: (t) => t.stopPropagation(),
55
- children: u
54
+ children: d
56
55
  }
57
56
  ),
58
57
  document.body
59
- );
58
+ ) : null;
60
59
  };
61
60
  export {
62
61
  k as D
package/dist/Dropdown.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Dropdown-CAxauIXt.cjs");exports.Dropdown=o.Dropdown;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Dropdown-CR8mco5s.cjs");exports.Dropdown=o.Dropdown;
package/dist/Dropdown.css CHANGED
@@ -1 +1 @@
1
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}.dropdown-main{border-radius:var(--radius-lg,.5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff);padding:calc(var(--spacing,.25rem) * 2);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);transition:opacity .3s ease-in-out;position:fixed}.dropdown-main.opened{z-index:50;opacity:1}.dropdown-main.closed{pointer-events:none;z-index:-10;opacity:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}.dropdown-main{border-radius:var(--radius-lg,.5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff);padding:calc(var(--spacing,.25rem) * 2);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);transition:opacity .3s ease-in-out;position:fixed}.dropdown-main.opened{z-index:50;opacity:1}.dropdown-main.closed{pointer-events:none;z-index:50;opacity:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
package/dist/Dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as p } from "./Dropdown-CbaxuMbk.js";
1
+ import { D as p } from "./Dropdown-D-fYEGo2.js";
2
2
  export {
3
3
  p as Dropdown
4
4
  };
@@ -0,0 +1 @@
1
+ var D=require("./FileInput.css");const e=require("react/jsx-runtime"),i=require("react"),j=require("./Tooltip-BSKAgRkc.cjs"),T=require("./File-_Hjw2d3F.cjs"),w=require("./Chip-D17UJHW6.cjs"),y=require("./IconButton-CVnmT2E9.cjs"),R=require("./Close-O9P7wJGf.cjs");function N(s,c=25){if(s.length<=c)return s;const a=s.lastIndexOf(".");if(a===-1)return s.slice(0,c-3)+"...";const h=s.slice(0,a),r=s.slice(a),d=c-r.length-3;return h.slice(0,d)+"..."+r}const B=i.forwardRef(function(s,c){const{children:a,label:h,containerClassName:r="",inputClassName:d="",labelClassName:g="",helperText:C="",helperTextClassName:b="",iconClassName:q="",multiple:p=!1,onChange:m,onClear:o,...f}=s,[t,x]=i.useState([]),k=i.useCallback(l=>{if(l.target.files){const n=Array.from(l.target.files);x(u=>p?[...u,...n]:n.slice(0,1))}m?.(l)},[p,m]),v=i.useCallback(l=>{x(n=>{const u=n.filter((A,$)=>$!==l);return u.length===0&&o?.(),u})},[o]),F=i.useCallback(()=>{x([]),o?.()},[o]),I=i.useCallback(l=>{l.currentTarget.value=""},[]);return e.jsxs("div",{className:`file-input-container ${r}`,children:[t.length===0&&e.jsxs("label",{htmlFor:f.id,className:`${g}`,children:[h,e.jsx("input",{type:"file",ref:c,multiple:p,onClick:I,onChange:k,className:`file-input ${d}`,...f}),f.required?" *":""]}),t.length>1&&e.jsx("ul",{className:"file-preview-list",children:t.map((l,n)=>e.jsx("li",{children:e.jsx(j.Tooltip,{content:l.name,children:e.jsx(w.Chip,{text:N(l.name,25),onDelete:()=>v(n)})})},`${l.name}-${l.lastModified}`))}),t.length===1&&e.jsxs("div",{className:"file-preview",children:[e.jsx(T.File,{className:`file-icon ${q}`}),e.jsx(j.Tooltip,{content:t[0]?.name??"",children:e.jsx("span",{className:"file-preview-name",children:N(t[0]?.name??"",25)})}),e.jsx(y.IconButton,{icon:e.jsx(R.Close,{}),onClick:F,type:"button"})]}),a,!!C&&e.jsx("p",{className:`file-input-helper-text ${b}`,children:C})]})});exports.FileInput=B;
@@ -0,0 +1,93 @@
1
+ import "./FileInput.css";
2
+ import { jsxs as C, jsx as l } from "react/jsx-runtime";
3
+ import { forwardRef as j, useState as R, useCallback as m } from "react";
4
+ import { T as x } from "./Tooltip-B4E-FRwY.js";
5
+ import { F as q } from "./File-BuJndWMv.js";
6
+ import { C as A } from "./Chip-C5ogKbFn.js";
7
+ import { I as B } from "./IconButton-BpsTEj0z.js";
8
+ import { C as D } from "./Close-rKC9AcNX.js";
9
+ function v(t, s = 25) {
10
+ if (t.length <= s) return t;
11
+ const a = t.lastIndexOf(".");
12
+ if (a === -1)
13
+ return t.slice(0, s - 3) + "...";
14
+ const p = t.slice(0, a), r = t.slice(a), f = s - r.length - 3;
15
+ return p.slice(0, f) + "..." + r;
16
+ }
17
+ const K = j(function(t, s) {
18
+ const {
19
+ children: a,
20
+ label: p,
21
+ containerClassName: r = "",
22
+ inputClassName: f = "",
23
+ labelClassName: F = "",
24
+ helperText: N = "",
25
+ helperTextClassName: $ = "",
26
+ iconClassName: b = "",
27
+ multiple: d = !1,
28
+ onChange: g,
29
+ onClear: o,
30
+ ...h
31
+ } = t, [n, u] = R([]), I = m(
32
+ (e) => {
33
+ if (e.target.files) {
34
+ const i = Array.from(e.target.files);
35
+ u(
36
+ (c) => d ? [...c, ...i] : i.slice(0, 1)
37
+ );
38
+ }
39
+ g?.(e);
40
+ },
41
+ [d, g]
42
+ ), w = m(
43
+ (e) => {
44
+ u((i) => {
45
+ const c = i.filter((M, y) => y !== e);
46
+ return c.length === 0 && o?.(), c;
47
+ });
48
+ },
49
+ [o]
50
+ ), T = m(() => {
51
+ u([]), o?.();
52
+ }, [o]), k = m(
53
+ (e) => {
54
+ e.currentTarget.value = "";
55
+ },
56
+ []
57
+ );
58
+ return /* @__PURE__ */ C("div", { className: `file-input-container ${r}`, children: [
59
+ n.length === 0 && /* @__PURE__ */ C("label", { htmlFor: h.id, className: `${F}`, children: [
60
+ p,
61
+ /* @__PURE__ */ l(
62
+ "input",
63
+ {
64
+ type: "file",
65
+ ref: s,
66
+ multiple: d,
67
+ onClick: k,
68
+ onChange: I,
69
+ className: `file-input ${f}`,
70
+ ...h
71
+ }
72
+ ),
73
+ h.required ? " *" : ""
74
+ ] }),
75
+ n.length > 1 && /* @__PURE__ */ l("ul", { className: "file-preview-list", children: n.map((e, i) => /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(x, { content: e.name, children: /* @__PURE__ */ l(
76
+ A,
77
+ {
78
+ text: v(e.name, 25),
79
+ onDelete: () => w(i)
80
+ }
81
+ ) }) }, `${e.name}-${e.lastModified}`)) }),
82
+ n.length === 1 && /* @__PURE__ */ C("div", { className: "file-preview", children: [
83
+ /* @__PURE__ */ l(q, { className: `file-icon ${b}` }),
84
+ /* @__PURE__ */ l(x, { content: n[0]?.name ?? "", children: /* @__PURE__ */ l("span", { className: "file-preview-name", children: v(n[0]?.name ?? "", 25) }) }),
85
+ /* @__PURE__ */ l(B, { icon: /* @__PURE__ */ l(D, {}), onClick: T, type: "button" })
86
+ ] }),
87
+ a,
88
+ !!N && /* @__PURE__ */ l("p", { className: `file-input-helper-text ${$}`, children: N })
89
+ ] });
90
+ });
91
+ export {
92
+ K as F
93
+ };
@@ -0,0 +1,60 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { useReducer as p, useEffect as f, useMemo as l, createContext as m, useContext as v } from "react";
3
+ import { u as x } from "./TableOptionsProvider-BgnISoXx.js";
4
+ var n = /* @__PURE__ */ ((e) => (e[e.update = 0] = "update", e[e.reset = 1] = "reset", e))(n || {});
5
+ const a = (e) => {
6
+ if (e) {
7
+ const t = {};
8
+ return Object.keys(e)?.forEach((r) => {
9
+ t[r] = { value: e[r] };
10
+ }), t;
11
+ }
12
+ return {};
13
+ };
14
+ function h(e, t) {
15
+ const { type: s } = t;
16
+ switch (s) {
17
+ case n.reset:
18
+ return {};
19
+ case n.update: {
20
+ const { toUpdate: r } = t;
21
+ return { ...e, ...r };
22
+ }
23
+ default:
24
+ return e;
25
+ }
26
+ }
27
+ const c = m(void 0), w = (e) => {
28
+ const { children: t } = e, { filters: s } = x(), [r, o] = p(
29
+ h,
30
+ a(s)
31
+ );
32
+ f(() => {
33
+ o({ type: n.reset });
34
+ const u = a(s);
35
+ Object.keys(u).length && o({
36
+ type: n.update,
37
+ toUpdate: u
38
+ });
39
+ }, [s]);
40
+ const i = l(
41
+ () => ({
42
+ currentFilters: r,
43
+ setCurrentFilters: o
44
+ }),
45
+ [r]
46
+ );
47
+ return /* @__PURE__ */ d(c.Provider, { value: i, children: t });
48
+ }, j = () => {
49
+ const e = v(c);
50
+ if (!e)
51
+ throw new Error("filtersContext must be used within a Provider");
52
+ return e;
53
+ };
54
+ export {
55
+ w as F,
56
+ n as a,
57
+ h as f,
58
+ a as i,
59
+ j as u
60
+ };
@@ -0,0 +1 @@
1
+ "use strict";const p=require("react/jsx-runtime"),i=require("react"),f=require("./TableOptionsProvider-i4uVLLwH.cjs");var n=(e=>(e[e.update=0]="update",e[e.reset=1]="reset",e))(n||{});const o=e=>{if(e){const t={};return Object.keys(e)?.forEach(r=>{t[r]={value:e[r]}}),t}return{}};function a(e,t){const{type:s}=t;switch(s){case n.reset:return{};case n.update:{const{toUpdate:r}=t;return{...e,...r}}default:return e}}const d=i.createContext(void 0),v=e=>{const{children:t}=e,{filters:s}=f.useTableOptions(),[r,u]=i.useReducer(a,o(s));i.useEffect(()=>{u({type:n.reset});const c=o(s);Object.keys(c).length&&u({type:n.update,toUpdate:c})},[s]);const l=i.useMemo(()=>({currentFilters:r,setCurrentFilters:u}),[r]);return p.jsx(d.Provider,{value:l,children:t})},x=()=>{const e=i.useContext(d);if(!e)throw new Error("filtersContext must be used within a Provider");return e};exports.FiltersActions=n;exports.FiltersProvider=v;exports.filtersReducer=a;exports.initializer=o;exports.useFilters=x;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./FiltersProvider-BlHv12dU.cjs");exports.FiltersActions=e.FiltersActions;exports.FiltersProvider=e.FiltersProvider;exports.filtersReducer=e.filtersReducer;exports.initializer=e.initializer;exports.useFilters=e.useFilters;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./FiltersProvider-DVMj0LV0.cjs");exports.FiltersActions=e.FiltersActions;exports.FiltersProvider=e.FiltersProvider;exports.filtersReducer=e.filtersReducer;exports.initializer=e.initializer;exports.useFilters=e.useFilters;
@@ -1,4 +1,4 @@
1
- import { a as e, F as r, f as a, i as t, u as l } from "./FiltersProvider-gfC9gS8u.js";
1
+ import { a as e, F as r, f as a, i as t, u as l } from "./FiltersProvider-BV023mmu.js";
2
2
  export {
3
3
  e as FiltersActions,
4
4
  r as FiltersProvider,
package/dist/Form.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TextInput-C27RFuya.cjs"),t=require("./FileInput-YvKQ-wok.cjs");exports.AutocompleteInput=e.AutocompleteInput;exports.CheckInput=e.CheckInput;exports.SelectInput=e.SelectInput;exports.State=e.State;exports.TextInput=e.TextInput;exports.helperTextStateClassName=e.helperTextStateClassName;exports.inputStateClassName=e.inputStateClassName;exports.labelStateClassName=e.labelStateClassName;exports.FileInput=t.FileInput;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TextInput-C27RFuya.cjs"),t=require("./FileInput-CqzVk1gQ.cjs");exports.AutocompleteInput=e.AutocompleteInput;exports.CheckInput=e.CheckInput;exports.SelectInput=e.SelectInput;exports.State=e.State;exports.TextInput=e.TextInput;exports.helperTextStateClassName=e.helperTextStateClassName;exports.inputStateClassName=e.inputStateClassName;exports.labelStateClassName=e.labelStateClassName;exports.FileInput=t.FileInput;
package/dist/Form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { A as e, C as s, S as l, a as p, T as u, h as m, i as n, l as o } from "./TextInput-DPYxzgm3.js";
2
- import { F as r } from "./FileInput-DNoJELoS.js";
2
+ import { F as r } from "./FileInput-Cr4TxWUg.js";
3
3
  export {
4
4
  e as AutocompleteInput,
5
5
  s as CheckInput,
package/dist/SvgIcons.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Filters-Dyee8QYH.cjs"),r=require("./Close-O9P7wJGf.cjs"),o=require("./File-_Hjw2d3F.cjs");exports.ChevronDown=e.ChevronDown;exports.ChevronLeft=e.ChevronLeft;exports.ChevronRight=e.ChevronRight;exports.ChevronUp=e.ChevronUp;exports.Ellipsis=e.Ellipsis;exports.Filters=e.Filters;exports.Close=r.Close;exports.File=o.File;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TableColumns-BjTNomZf.cjs"),r=require("./Close-O9P7wJGf.cjs"),o=require("./File-_Hjw2d3F.cjs");exports.BarsStaggered=e.BarsStaggered;exports.ChevronDown=e.ChevronDown;exports.ChevronLeft=e.ChevronLeft;exports.ChevronRight=e.ChevronRight;exports.ChevronUp=e.ChevronUp;exports.Ellipsis=e.Ellipsis;exports.Filters=e.Filters;exports.TableColumns=e.TableColumns;exports.Close=r.Close;exports.File=o.File;
package/dist/SvgIcons.js CHANGED
@@ -1,13 +1,15 @@
1
- import { C as e, a as r, b as a, c as C, E as t, F as h } from "./Filters-DL5jd8ps.js";
2
- import { C as l } from "./Close-rKC9AcNX.js";
3
- import { F as p } from "./File-BuJndWMv.js";
1
+ import { B as e, C as o, a as r, b as C, c as l, E as t, F as n, T as h } from "./TableColumns-CIddkosX.js";
2
+ import { C as p } from "./Close-rKC9AcNX.js";
3
+ import { F as m } from "./File-BuJndWMv.js";
4
4
  export {
5
- e as ChevronDown,
5
+ e as BarsStaggered,
6
+ o as ChevronDown,
6
7
  r as ChevronLeft,
7
- a as ChevronRight,
8
- C as ChevronUp,
9
- l as Close,
8
+ C as ChevronRight,
9
+ l as ChevronUp,
10
+ p as Close,
10
11
  t as Ellipsis,
11
- p as File,
12
- h as Filters
12
+ m as File,
13
+ n as Filters,
14
+ h as TableColumns
13
15
  };
@@ -0,0 +1 @@
1
+ var Oe=require("./Table.css");const e=require("react/jsx-runtime"),r=require("react"),k=require("./FiltersProvider-DVMj0LV0.cjs"),O=require("./TableColumns-BjTNomZf.cjs"),P=require("./TextInput-C27RFuya.cjs"),I=require("./TableOptionsProvider-i4uVLLwH.cjs"),A=require("./TranslationProvider-Czr0WIDH.cjs"),D=require("./IconButton-CVnmT2E9.cjs"),fe=require("./Badge-Z78MlGoQ.cjs"),z=require("./lib.cjs"),G=require("./Button-BlYa3uPc.cjs"),J=require("./Chip-D17UJHW6.cjs"),Y=require("./Tooltip-BSKAgRkc.cjs"),je=require("./query-81BrXp3i.cjs"),ge=require("./Dropdown-CR8mco5s.cjs"),Ce=require("./Loading-CNECRan-.cjs");function X(n){const{id:t,icon:a,tooltip:s,onClick:l,children:i,hidden:p=!1,disabled:c=!1,showText:u=!1,showTooltips:o=!0,className:m=""}=n;return p?null:e.jsxs("button",{type:"button",id:t,className:`action ${u?"text-action":"icon-action"} ${m}`,disabled:c,"aria-label":s,onClick:d=>{d.stopPropagation(),l?.()},"aria-disabled":c,"data-tooltip-id":"tooltip","data-tooltip-content":o?s:"",children:[a," ",u&&s,i]})}function Z(n){const{actions:t=[],className:a="",itemClassName:s="",actionClassName:l="",showTooltips:i=!0,showActionTexts:p=!1}=n;return e.jsx("ul",{className:`actions-container ${a}`,children:t.map(c=>e.jsx("li",{className:`actions-container-item ${s}`,children:e.jsx(X,{showTooltips:i,showText:p,className:l,...c})},c.id))})}const ee=n=>{const{actions:t=[],className:a=""}=n,{t:s}=A.useTranslation(),[l,i]=r.useState(!1),[p,c]=r.useState(null);return e.jsxs("div",{className:`actions-dropdown ${a}`,children:[e.jsx(D.IconButton,{icon:e.jsx(O.Ellipsis,{}),onClick:u=>{u.stopPropagation(),c(u.currentTarget),i(o=>!o)},onMouseDown:u=>u.stopPropagation(),className:"actions-dropdown-trigger","aria-label":s("_accessibility:buttons.openActions"),name:s("_accessibility:buttons.openActions"),"data-tooltip-id":"tooltip","data-tooltip-content":s("_accessibility:buttons.openActions")}),e.jsx(ge.Dropdown,{open:l,onClose:()=>i(!1),anchorEl:p,children:e.jsx(Z,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function K(n,t=[]){return[...n].sort((a,s)=>(s.pos??0)-(a.pos??0)).filter(a=>a.display!=="none"&&!t.includes(a.key))}function te(n){const{t}=A.useTranslation(),{entity:a="",columns:s=[],hasAction:l=!0,onSortCallback:i,selectionState:p,onToggleAllRows:c}=n,u=r.useRef(null);r.useEffect(()=>{u.current&&(u.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:o,sortingOrder:m,sortingBy:d,hiddenColumns:C}=I.useTableOptions(),x=r.useMemo(()=>K(s,C).map(b=>({id:b.key,label:b.label,renderHead:b.renderHead,className:b.className??"",sortable:b.sortable??!0,sortOptions:b.sortOptions})),[s,a,t,C]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"table-headers-column table-headers-checkbox",children:c?e.jsx("input",{type:"checkbox",ref:u,checked:p?.allSelected??!1,onChange:c,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{children:t("_accessibility:labels.actions")})}),x.map(b=>e.jsx("th",{scope:"col",className:`table-headers-column ${b.className}`,children:e.jsxs(G.Button,{disabled:!b.sortable,onClick:()=>o(b.id,i),className:"table-headers-cell",children:[b.renderHead?b.renderHead():e.jsx("span",{className:"table-headers-label",children:b.label}),b.sortable&&d===b.id&&e.jsx("span",{children:m===je.SortOrder.ASC?b.sortOptions?.icons?.asc??e.jsx(O.ChevronUp,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"}):b.sortOptions?.icons?.desc??e.jsx(O.ChevronDown,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},b.id))]})})}function ne(n){const{columns:t}=n,{hiddenColumns:a,toggleColumn:s}=I.useTableOptions(),{t:l}=A.useTranslation(),[i,p]=r.useState(!1),c=r.useRef(null),u=r.useMemo(()=>K(t.filter(d=>d.hideable!==!1&&d.display!=="none"),[]),[t]),o=r.useCallback(()=>{p(d=>!d)},[]),m=r.useCallback(d=>{s(d)},[s]);return u.length===0?null:e.jsxs("div",{className:"column-visibility-menu",ref:c,children:[e.jsx(D.IconButton,{icon:e.jsx(O.TableColumns,{className:"column-visibility-icon"}),className:"normal column-visibility-trigger","aria-haspopup":"true","aria-expanded":i,onClick:o,children:e.jsx("span",{className:"table-header-sr",children:l("_accessibility:buttons.columns")})}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"column-visibility-backdrop",onClick:()=>p(!1)}),e.jsx("div",{className:"column-visibility-dropdown",role:"menu",children:u.map(d=>e.jsx(P.CheckInput,{checked:!a.includes(d.key),onChange:()=>m(d.key),label:d.label??d.key,containerClassName:"column-visibility-item"},d.key))})]})]})}const se=n=>{const{items:t,text:a,id:s,onClearFilter:l}=n;return e.jsx(J.Chip,{text:`${a}: ${t.map(i=>i.value??i.name).join(", ")}`,onDelete:()=>l(s)})},le=n=>{const{end:t,start:a,text:s,id:l,onClearFilter:i}=n,p=c=>c!==null&&typeof c<"u"&&c!=="";return e.jsx(J.Chip,{text:`${s}: ${p(a)?a:"♾️"} - ${p(t)?t:"♾️"}`,onDelete:()=>i(l)})},Ne=n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&("start"in n||"end"in n),ae=n=>{const{filtersDefinition:t}=n,a=r.useMemo(()=>{const c={};return t.forEach(u=>{c[u.propertyName]=u.label??u.propertyName}),c},[t]),{filters:s,clearFilters:l}=I.useTableOptions(),i=r.useMemo(()=>Object.keys(s),[s]),p=r.useCallback(c=>{const u=s[c];return Ne(u)?e.jsx(le,{id:c,text:a[c],start:u.start,end:u.end,onClearFilter:l}):Array.isArray(u)?e.jsx(se,{id:c,text:a[c],items:u,onClearFilter:l}):e.jsx(J.Chip,{text:`${a[c]}: ${u?.value??u?.name??u}`,onDelete:()=>l(c)})},[s,a,l]);return e.jsx("ul",{className:"active-filters-main",children:i?.map(c=>e.jsx("li",{children:p(c)},c))})};function ye(n){const{propertyName:t,label:a,placeholder:s,options:l,multiple:i=!0}=n,{currentFilters:p,setCurrentFilters:c}=k.useFilters(),u=r.useMemo(()=>{const m=p[t]?.value;return typeof m>"u"?null:m},[p,t]),o=r.useCallback(m=>{c({type:k.FiltersActions.update,toUpdate:{[t]:{value:m}}})},[t,c]);return e.jsx(P.AutocompleteInput,{value:u,label:a,options:l,multiple:i,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:o,placeholder:s})}const ve=n=>{const{propertyName:t,label:a}=n,{currentFilters:s,setCurrentFilters:l}=k.useFilters(),i=r.useMemo(()=>s[t]?.value??"",[s]),p=r.useCallback(c=>{l({type:k.FiltersActions.update,toUpdate:{[t]:{value:c.target.checked}}})},[]);return e.jsx(P.CheckInput,{label:a,checked:i??!1,onChange:p})};function we(n){const{propertyName:t,options:a,label:s,placeholder:l}=n,{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useMemo(()=>{const o=i[t]?.value;if(o===null||typeof o>"u")return a[0]?.id??"";if(typeof o=="object"&&!Array.isArray(o)){const m=o;return m.id??m.value??""}return o},[i,a,t]),u=r.useCallback(o=>{const m=a.find(d=>String(d.id)===o.target.value);p({type:k.FiltersActions.update,toUpdate:{[t]:{value:m?.id??o.target.value}}})},[a,t,p]);return e.jsx(P.SelectInput,{value:c,label:s,options:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u,placeholder:l})}const Te=n=>{const{propertyName:t,label:a,placeholder:s}=n,{currentFilters:l,setCurrentFilters:i}=k.useFilters(),p=r.useMemo(()=>l[t]?.value??"",[l]),c=r.useCallback(u=>{i({type:k.FiltersActions.update,toUpdate:{[t]:{value:u.target.value}}})},[]);return e.jsx(P.TextInput,{value:p??"",label:a,onChange:c,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:s})},Q=n=>{const{propertyName:t,label:a,inputType:s}=n,{t:l}=A.useTranslation(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useRef(null),u=r.useRef(null),o=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{end:u?.current?.value??null,start:d.target.value}}}})},[]),m=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{start:c?.current?.value??null,end:d.target.value}}}})},[]);return e.jsxs("div",{className:"range-widget-container",children:[e.jsx("p",{className:"text-input-label input-widget-label input-label-normal",children:a}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx(P.TextInput,{value:i[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:s,ref:c,onChange:o,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(P.TextInput,{value:i[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:s,ref:u,onChange:m,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},ie=n=>{switch(n.type){case z.FilterTypes.text:return e.jsx(Te,{...n});case z.FilterTypes.number:return e.jsx(Q,{...n,inputType:"number"});case z.FilterTypes.date:return e.jsx(Q,{...n,inputType:"date"});case z.FilterTypes.select:return e.jsx(we,{...n});case z.FilterTypes.autocomplete:return e.jsx(ye,{...n});case z.FilterTypes.check:return e.jsx(ve,{...n})}return e.jsx(e.Fragment,{})},re=n=>{const{filters:t=[],show:a,handleShow:s}=n,{onFilterApply:l}=I.useTableOptions(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),{t:c}=A.useTranslation(),u=r.useRef(null);return r.useEffect(()=>{const o=({target:d})=>{u.current&&(d?.closest(".filter-dropdown-trigger")||!a||u.current.contains(d)||s(!1))},m=({code:d})=>{!a||d!=="Escape"||s(!1)};return document.addEventListener("click",o),document.addEventListener("keydown",m),()=>{document.removeEventListener("click",o),document.removeEventListener("keydown",m)}},[s,a]),e.jsx("div",{className:`filter-dropdown-backdrop ${a?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:u,children:[e.jsx("div",{className:"filter-title",children:c("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(o=>e.jsx("li",{className:"filter-container-item",children:ie(o)},o.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx(G.Button,{type:"button",variant:"submit",onClick:()=>p({type:k.FiltersActions.reset,filters:t}),className:"filter-dropdown-button filter-dropdown-cancel",children:c("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx(G.Button,{type:"button",variant:"submit",color:"primary",className:"filter-dropdown-button filter-dropdown-submit",onClick:()=>{s(!1),l(i)},children:c("_accessibility:buttons.applyFilters")})})]})})]})})},oe=()=>{const{t:n}=A.useTranslation(),{total:t,pageSize:a,pageSizes:s,currentPage:l}=I.useTableOptions(),i=(l+1)*a>t?t:(l+1)*a;return e.jsxs("div",{className:"table-navigation-sizes",children:[s[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*a+1," - ",i," ",n("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function Se(){const{t:n}=A.useTranslation(),{total:t,pageSize:a,currentPage:s,setCurrentPage:l}=I.useTableOptions(),i=r.useMemo(()=>{const p=Math.ceil(t/a);return Array.from({length:p},(c,u)=>({id:u,value:u+1}))},[t,a]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:n("_accessibility:components.table.jumpToPage")}),e.jsx(P.SelectInput,{value:s,options:i,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ce=()=>{const{t:n}=A.useTranslation(),{total:t,pageSize:a,currentPage:s,setCurrentPage:l}=I.useTableOptions(),i=Math.ceil(t/a),p=s<i-1;return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(D.IconButton,{icon:e.jsx(O.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:s===0,"aria-label":n("_accessibility:buttons.previous"),name:n("_accessibility:buttons.previous"),onClick:()=>l(s-1)}),e.jsx(D.IconButton,{icon:e.jsx(O.ChevronRight,{className:"table-navigation-icon"}),disabled:!p,className:"table-navigation-buttons",name:n("_accessibility:buttons.next"),"aria-label":n("_accessibility:buttons.next"),onClick:()=>{p&&l(s+1)}})]})};function ue(){const{t:n}=A.useTranslation(),{pageSizes:t,pageSize:a,setPageSize:s}=I.useTableOptions(),l=r.useMemo(()=>t?.map(i=>({id:i,value:i})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:n("_accessibility:components.table.pageSizes")}),e.jsx(P.SelectInput,{value:a,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:i=>s(Number(i.target.value))})]})}function de(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(Se,{}),e.jsx(ue,{}),e.jsx(oe,{}),e.jsx(ce,{})]})}const ke=n=>n,pe=n=>{const{t}=A.useTranslation(),{hiddenColumns:a}=I.useTableOptions(),{columns:s,softDeleteProperty:l="deletedAt",data:i,actions:p,selectedRows:c,expandedRows:u=[],onRowSelectionChange:o,onRowExpand:m}=n,d=r.useMemo(()=>K(s,a),[s,a]),C=r.useMemo(()=>new Map(u.map(x=>[x.rowId,x])),[u]);return i?.map(x=>{const b=c.has(x.id),y=C.get(x.id),R=!!y,_=d.length+1+(p?1:0);return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{className:`table-row ${m?"expandable":""} ${x[l]?"deleted-class":""} ${b?"selected":""} ${R?"expanded":""}`,onClick:()=>m?.(x),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:b,onClick:v=>v.stopPropagation(),onChange:()=>o(x),"aria-label":t("_accessibility:components.table.selectRow")})}),p?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const v=p(x).filter(g=>!g.hidden),j=v.filter(g=>g.sticky),w=v.filter(g=>!g.sticky);return e.jsxs(e.Fragment,{children:[j.map(g=>e.jsx(Y.Tooltip,{content:g.tooltip,children:e.jsx(X,{...g,onClick:()=>g.onClick(x),className:"row-table-action"})},g.id)),w.length>0&&e.jsx(ee,{actions:w})]})})()})}):null,d?.map((v,j)=>{const w=x[v.key],g=v.renderBody?v.renderBody(w,x):ke(w);return e.jsx("td",{className:`table-row-cell ${j===0?"basic":""} ${v.className??""}`,children:m&&j===0?e.jsxs("div",{className:"table-row-expand-content",children:[e.jsx("span",{className:"table-row-expand-indicator","aria-hidden":!0,"data-state":R?"expanded":"collapsed",children:R?e.jsx(O.ChevronUp,{className:"table-row-expand-chevron"}):e.jsx(O.ChevronDown,{className:"table-row-expand-chevron"})}),e.jsx("div",{className:"table-row-expand-value",children:g})]}):g},v.key)})]}),R&&y?.content!==null&&typeof y?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:_,children:e.jsx("div",{className:`table-row-expanded-content ${y.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:y.content})})})})]},x.id)})};function me(){const{t:n}=A.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:n("_accessibility:components.table.empty")})})}const he=n=>{const{columns:t,title:a,isLoading:s,toolbar:l,filterOptions:i,canHideColumns:p=!1,canReset:c=!1}=n,{countOfFilters:u,resetTableOptions:o}=I.useTableOptions(),{t:m}=A.useTranslation(),d=r.useMemo(()=>t?[...t].sort((j,w)=>(w.pos??0)-(j.pos??0)).filter(j=>!!j.filterOptions).map(j=>({...j.filterOptions,label:j.filterOptions?.label??j.label,propertyName:j.key})):[],[t]),[C,x]=r.useState(!1),b=r.useCallback(j=>{i?.dropdown?.setOpened?i.dropdown.setOpened(j??!1):x(j??!1)},[i]),y=r.useMemo(()=>i?.dropdown?.opened??C,[i,C]),R=d.length>0,_=R&&i?.button?.hide!==!0,v=R&&y;return e.jsxs("div",{className:`table-header ${v?"showing-filters":""}`,children:[e.jsxs("div",{children:[a&&e.jsx("h1",{className:"table-header-title",children:a}),s?null:e.jsxs("div",{className:"table-header-content",children:[l,p&&t&&e.jsx(ne,{columns:t}),c&&e.jsx(D.IconButton,{icon:e.jsx(O.BarsStaggered,{className:"reset-table-icon"}),className:"normal",onClick:o,children:e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.reset")})}),_&&e.jsxs(D.IconButton,{icon:i?.button?.icon??e.jsx(O.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>b(!y),"aria-expanded":y,children:[e.jsx(fe.Badge,{count:u,className:`${u>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),R&&e.jsx(re,{filters:d,show:v,handleShow:b,options:i}),e.jsx(ae,{filtersDefinition:d})]})};function be({count:n,multiActions:t,onActionClick:a}){const{t:s}=A.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:s("_accessibility:components.table.selectedCount",{count:n})}),t.length>0&&e.jsx("div",{className:"table-selection-bar-actions",children:t.map(l=>e.jsx(Y.Tooltip,{content:l.tooltip,children:e.jsx(D.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>a(l),disabled:l.disabled,"aria-label":l.tooltip})},l.id))})]})}const W=220;function Re({data:n,allowMultipleExpandedRows:t,controlledExpandedRowId:a,onExpandedRowChange:s,onRowExpand:l,findRowById:i}){const[p,c]=r.useState(null),[u,o]=r.useState(null),[m,d]=r.useState(null),[C,x]=r.useState(null),[b,y]=r.useState(!1),[R,_]=r.useState(new Set),[v,j]=r.useState([]),w=r.useRef(null),g=r.useRef(null),q=r.useRef(new Map),E=typeof a<"u",M=t&&!E,T=E?a??null:p,V=r.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),F=r.useCallback(h=>{if(typeof h<"u"){const f=q.current.get(h);if(!f)return;clearTimeout(f),q.current.delete(h);return}q.current.forEach(f=>clearTimeout(f)),q.current.clear()},[]),L=r.useCallback(h=>{F(h),j(f=>f.some(S=>S.rowId===h)?f.map(S=>S.rowId===h?{...S,isVisible:!1}:S):f),q.current.set(h,setTimeout(()=>{j(f=>f.filter(N=>N.rowId!==h)),q.current.delete(h)},W))},[F]),U=r.useCallback((h,f)=>{F(h),j(N=>N.some($=>$.rowId===h)?N.map($=>$.rowId===h?{...$,content:f,isVisible:!1}:$):[...N,{rowId:h,content:f,isVisible:!1}]),requestAnimationFrame(()=>{j(N=>N.map(S=>S.rowId===h?{...S,isVisible:!0}:S))})},[F]);r.useEffect(()=>{if(!M)return;const h=new Set(n.map(f=>f.id));_(f=>{const N=new Set;return f.forEach(S=>{if(h.has(S)){N.add(S);return}F(S)}),N}),j(f=>(f.forEach(N=>{h.has(N.rowId)||F(N.rowId)}),f.filter(N=>h.has(N.rowId))))},[n,M,F]),r.useEffect(()=>{if(M)return;if(T===null){o(null),E&&(w.current=null);return}i(T)||(E||c(null),o(null),E&&(w.current=null))},[n,T,i,E,M]),r.useEffect(()=>{if(!M){if(V(),T===null||u===null){if(m===null){y(!1),x(null);return}y(!1),g.current=setTimeout(()=>{d(null),x(null),g.current=null},W);return}if(m===null){d(T),x(u),requestAnimationFrame(()=>y(!0));return}if(m===T){x(u),requestAnimationFrame(()=>y(!0));return}y(!1),g.current=setTimeout(()=>{d(T),x(u),requestAnimationFrame(()=>y(!0)),g.current=null},W)}},[V,u,T,M,m]),r.useEffect(()=>()=>{V(),F()},[V,F]),r.useEffect(()=>{if(!E)return;if(T===null){o(null),w.current=null;return}const h=i(T);if(!h){o(null),w.current=null;return}const f=w.current;o(l?.(h,f)??null),w.current=h},[T,i,E,l]);const xe=r.useCallback(h=>{if(M){if(R.has(h.id)){_(H=>{const B=new Set(H);return B.delete(h.id),B}),L(h.id),s?.(null,h);return}_(H=>{const B=new Set(H);return B.add(h.id),B});const $=l?.(h,null)??null;$!==null&&typeof $<"u"?U(h.id,$):(F(h.id),j(H=>H.filter(B=>B.rowId!==h.id))),s?.(h,null);return}const f=T===h.id,N=f?h:i(T);if(E){s?.(f?null:h,N);return}if(f){c(null),o(null),s?.(null,h);return}c(h.id),o(l?.(h,N)??null),s?.(h,N)},[T,L,F,U,i,R,E,M,s,l]);return{expandedRowsToRender:r.useMemo(()=>M?v:m===null||C===null||typeof C>"u"?[]:[{rowId:m,content:C,isVisible:b}],[b,M,C,m,v]),onRowExpandChange:xe}}function Fe({actions:n,selectedRowsData:t}){const a=r.useMemo(()=>!n||!t.length?[]:t.reduce((l,i,p)=>{const c=n(i).filter(o=>o.multiple&&!o.hidden);if(p===0)return c;const u=new Map(l.map(o=>[o.id,o]));return c.reduce((o,m)=>{const d=u.get(m.id);return d&&o.push({...d,...m,disabled:m.disabled||d.disabled}),o},[])},[]),[n,t]),s=r.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(i=>l.onClick(i))}},[t]);return{multiActions:a,handleMultipleActionClick:s}}function Ae({data:n,onRowSelect:t,onSelectedRowsChange:a}){const[s,l]=r.useState(new Set),i=r.useMemo(()=>n?.filter(o=>s.has(o.id))??[],[n,s]);r.useEffect(()=>{if(!n?.length){l(new Set);return}l(o=>{const m=new Set,d=new Set(n.map(C=>C.id));return o.forEach(C=>{d.has(C)&&m.add(C)}),m})},[n]),r.useEffect(()=>{a&&a(i)},[i,a]);const p=r.useCallback(o=>{l(m=>{const d=new Set(m);return d.has(o.id)?(d.delete(o.id),t?.(o,!1)):(d.add(o.id),t?.(o,!0)),d})},[t]),c=r.useCallback(()=>{l(o=>{const m=new Set(o),d=n??[],C=d.every(x=>m.has(x.id));return d.forEach(x=>{const b=m.has(x.id);C?b&&(m.delete(x.id),t?.(x,!1)):b||(m.add(x.id),t?.(x,!0))}),m})},[n,t]),u=r.useMemo(()=>{if(!n?.length)return{allSelected:!1,hasSomeSelected:!1};const o=n.every(d=>s.has(d.id)),m=n.some(d=>s.has(d.id));return{allSelected:o,hasSomeSelected:m}},[n,s]);return{selectedRows:s,selectedRowsData:i,selectionState:u,onRowSelectionChange:p,onToggleAllRows:c}}function Ee(n){const{data:t,onSort:a,entity:s="",isLoading:l=!1,actions:i,columns:p=[],contentClassName:c="",className:u="",softDeleteProperty:o="deletedAt",onRowSelect:m,onSelectedRowsChange:d,allowMultipleExpandedRows:C=!1,expandedRowId:x,onExpandedRowChange:b,onRowExpand:y,...R}=n,_=r.useMemo(()=>!t?.length,[t]),v=r.useCallback(L=>L===null?null:t.find(U=>U.id===L)??null,[t]),{selectedRows:j,selectedRowsData:w,selectionState:g,onRowSelectionChange:q,onToggleAllRows:E}=Ae({data:t,onRowSelect:m,onSelectedRowsChange:d}),{expandedRowsToRender:M,onRowExpandChange:T}=Re({data:t,allowMultipleExpandedRows:C,controlledExpandedRowId:x,onExpandedRowChange:b,onRowExpand:y,findRowById:v}),{multiActions:V,handleMultipleActionClick:F}=Fe({actions:i,selectedRowsData:w});return e.jsx(k.FiltersProvider,{children:e.jsxs("div",{className:`${u} table-main`,children:[e.jsx(he,{columns:p,isLoading:l,...R}),l?e.jsx(Ce.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:_?e.jsx(me,{}):e.jsxs(e.Fragment,{children:[!!w.length&&e.jsx(be,{count:w.length,multiActions:V,onActionClick:F}),e.jsx("div",{className:`${c} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(te,{entity:s,columns:p,onSortCallback:a,hasAction:!!i,selectionState:g,onToggleAllRows:E}),e.jsx("tbody",{children:e.jsx(pe,{data:t,actions:i,columns:p,softDeleteProperty:o,selectedRows:j,expandedRows:M,onRowSelectionChange:q,onRowExpand:y?T:void 0})})]})}),e.jsx(de,{})]})})]})})}exports.Action=X;exports.Actions=Z;exports.ActionsDropdown=ee;exports.ActiveFilters=ae;exports.ArrayChip=se;exports.ColumnVisibilityMenu=ne;exports.Columns=te;exports.CountOfTotal=oe;exports.FilterDropdown=re;exports.Footer=de;exports.Navigation=ce;exports.PageSize=ue;exports.RangeChip=le;exports.Rows=pe;exports.Table=Ee;exports.TableEmpty=me;exports.TableHeader=he;exports.TableSelectionBar=be;exports.renderFilterComponent=ie;