@adam-milo/ui 1.0.129 → 1.0.131

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 (318) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +2 -2
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +1 -1
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +1 -1
  9. package/dist/index102.cjs +1 -1
  10. package/dist/index102.js +1 -1
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +1 -1
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +1 -1
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +1 -1
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +1 -1
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +1 -1
  21. package/dist/index108.cjs +1 -0
  22. package/dist/index108.js +1 -0
  23. package/dist/index109.cjs +1 -0
  24. package/dist/index109.js +1 -0
  25. package/dist/index11.cjs +1 -1
  26. package/dist/index11.js +1 -1
  27. package/dist/index110.cjs +1 -0
  28. package/dist/index110.js +1 -0
  29. package/dist/index111.cjs +1 -0
  30. package/dist/index111.js +1 -0
  31. package/dist/index112.cjs +1 -0
  32. package/dist/index112.js +1 -0
  33. package/dist/index113.cjs +1 -0
  34. package/dist/index113.js +1 -0
  35. package/dist/index114.cjs +1 -0
  36. package/dist/index114.js +1 -0
  37. package/dist/index115.cjs +1 -0
  38. package/dist/index115.js +1 -0
  39. package/dist/index116.cjs +1 -0
  40. package/dist/index116.js +1 -0
  41. package/dist/index117.cjs +1 -0
  42. package/dist/index117.js +1 -0
  43. package/dist/index118.cjs +1 -0
  44. package/dist/index118.js +1 -0
  45. package/dist/index119.cjs +1 -0
  46. package/dist/index119.js +1 -0
  47. package/dist/index12.cjs +1 -1
  48. package/dist/index12.js +1 -1
  49. package/dist/index120.cjs +1 -0
  50. package/dist/index120.js +1 -0
  51. package/dist/index121.cjs +1 -0
  52. package/dist/index121.js +1 -0
  53. package/dist/index122.cjs +1 -0
  54. package/dist/index122.js +1 -0
  55. package/dist/index123.cjs +1 -0
  56. package/dist/index123.js +1 -0
  57. package/dist/index124.cjs +1 -0
  58. package/dist/index124.js +1 -0
  59. package/dist/index125.cjs +1 -0
  60. package/dist/index125.js +1 -0
  61. package/dist/index126.cjs +1 -0
  62. package/dist/index126.js +1 -0
  63. package/dist/index13.cjs +1 -1
  64. package/dist/index13.js +1 -1
  65. package/dist/index14.cjs +1 -1
  66. package/dist/index14.js +1 -1
  67. package/dist/index15.cjs +1 -1
  68. package/dist/index15.js +1 -1
  69. package/dist/index16.cjs +1 -1
  70. package/dist/index16.js +1 -1
  71. package/dist/index17.cjs +1 -1
  72. package/dist/index17.js +1 -1
  73. package/dist/index18.cjs +1 -1
  74. package/dist/index18.js +8 -3
  75. package/dist/index19.cjs +1 -1
  76. package/dist/index19.js +3 -6
  77. package/dist/index20.cjs +1 -1
  78. package/dist/index20.js +6 -2
  79. package/dist/index21.cjs +1 -1
  80. package/dist/index21.js +2 -2
  81. package/dist/index22.cjs +1 -1
  82. package/dist/index22.js +2 -2
  83. package/dist/index23.cjs +1 -1
  84. package/dist/index23.js +2 -2
  85. package/dist/index24.cjs +1 -1
  86. package/dist/index24.js +2 -2
  87. package/dist/index25.cjs +1 -1
  88. package/dist/index25.js +2 -2
  89. package/dist/index26.cjs +1 -1
  90. package/dist/index26.js +2 -2
  91. package/dist/index27.cjs +1 -1
  92. package/dist/index27.js +2 -2
  93. package/dist/index28.cjs +1 -1
  94. package/dist/index28.js +2 -2
  95. package/dist/index29.cjs +1 -1
  96. package/dist/index29.js +2 -2
  97. package/dist/index3.cjs +1 -1
  98. package/dist/index3.js +1 -1
  99. package/dist/index30.cjs +1 -1
  100. package/dist/index30.js +2 -2
  101. package/dist/index31.cjs +1 -1
  102. package/dist/index31.js +2 -4
  103. package/dist/index32.cjs +1 -1
  104. package/dist/index32.js +4 -2
  105. package/dist/index33.cjs +1 -1
  106. package/dist/index33.js +2 -2
  107. package/dist/index34.cjs +1 -1
  108. package/dist/index34.js +2 -4
  109. package/dist/index35.cjs +1 -1
  110. package/dist/index35.js +4 -8
  111. package/dist/index36.cjs +1 -1
  112. package/dist/index36.js +8 -2
  113. package/dist/index37.cjs +1 -1
  114. package/dist/index37.js +2 -4
  115. package/dist/index38.cjs +1 -1
  116. package/dist/index38.js +4 -8
  117. package/dist/index39.cjs +1 -1
  118. package/dist/index39.js +8 -8
  119. package/dist/index4.cjs +1 -1
  120. package/dist/index4.js +1 -1
  121. package/dist/index40.cjs +1 -1
  122. package/dist/index40.js +8 -9
  123. package/dist/index41.cjs +1 -1
  124. package/dist/index41.js +11 -2
  125. package/dist/index42.cjs +1 -1
  126. package/dist/index42.js +2 -5
  127. package/dist/index43.cjs +1 -1
  128. package/dist/index43.js +5 -2
  129. package/dist/index44.cjs +1 -1
  130. package/dist/index44.js +2 -10
  131. package/dist/index45.cjs +1 -1
  132. package/dist/index45.js +2 -9
  133. package/dist/index46.cjs +1 -1
  134. package/dist/index46.js +3 -2
  135. package/dist/index47.cjs +1 -1
  136. package/dist/index47.js +3 -2
  137. package/dist/index48.cjs +1 -1
  138. package/dist/index48.js +24 -2
  139. package/dist/index49.cjs +1 -1
  140. package/dist/index49.js +10 -4
  141. package/dist/index5.cjs +1 -1
  142. package/dist/index5.js +1 -1
  143. package/dist/index50.cjs +1 -1
  144. package/dist/index50.js +13 -2
  145. package/dist/index51.cjs +1 -1
  146. package/dist/index51.js +38 -3
  147. package/dist/index52.cjs +1 -1
  148. package/dist/index52.js +10 -2
  149. package/dist/index53.cjs +1 -1
  150. package/dist/index53.js +1 -2
  151. package/dist/index54.cjs +1 -1
  152. package/dist/index54.js +9 -2
  153. package/dist/index55.cjs +1 -1
  154. package/dist/index55.js +2 -2
  155. package/dist/index56.cjs +1 -1
  156. package/dist/index56.js +2 -10
  157. package/dist/index57.cjs +1 -1
  158. package/dist/index57.js +2 -11
  159. package/dist/index58.cjs +1 -1
  160. package/dist/index58.js +4 -1
  161. package/dist/index59.cjs +1 -1
  162. package/dist/index59.js +2 -1
  163. package/dist/index6.cjs +1 -1
  164. package/dist/index6.js +1 -1
  165. package/dist/index60.cjs +1 -1
  166. package/dist/index60.js +3 -1
  167. package/dist/index61.cjs +1 -1
  168. package/dist/index61.js +2 -1
  169. package/dist/index62.cjs +1 -1
  170. package/dist/index62.js +2 -1
  171. package/dist/index63.cjs +1 -1
  172. package/dist/index63.js +2 -1
  173. package/dist/index64.cjs +1 -1
  174. package/dist/index64.js +2 -1
  175. package/dist/index65.cjs +1 -1
  176. package/dist/index65.js +10 -9
  177. package/dist/index66.cjs +1 -1
  178. package/dist/index66.js +11 -1
  179. package/dist/index67.cjs +1 -1
  180. package/dist/index67.js +1 -1
  181. package/dist/index68.cjs +1 -1
  182. package/dist/index68.js +1 -1
  183. package/dist/index69.cjs +1 -1
  184. package/dist/index69.js +1 -1
  185. package/dist/index7.cjs +1 -1
  186. package/dist/index7.js +1 -1
  187. package/dist/index70.cjs +1 -1
  188. package/dist/index70.js +1 -2
  189. package/dist/index71.cjs +1 -1
  190. package/dist/index71.js +1 -1
  191. package/dist/index72.cjs +1 -1
  192. package/dist/index72.js +1 -1
  193. package/dist/index73.cjs +1 -1
  194. package/dist/index73.js +1 -1
  195. package/dist/index74.cjs +1 -1
  196. package/dist/index74.js +9 -1
  197. package/dist/index75.cjs +1 -1
  198. package/dist/index75.js +1 -7
  199. package/dist/index76.cjs +1 -1
  200. package/dist/index76.js +1 -1
  201. package/dist/index77.cjs +1 -1
  202. package/dist/index77.js +1 -1
  203. package/dist/index78.cjs +1 -1
  204. package/dist/index78.js +1 -1
  205. package/dist/index79.cjs +1 -1
  206. package/dist/index79.js +2 -1
  207. package/dist/index8.cjs +1 -1
  208. package/dist/index8.js +1 -1
  209. package/dist/index80.cjs +1 -1
  210. package/dist/index80.js +1 -1
  211. package/dist/index81.cjs +1 -1
  212. package/dist/index81.js +1 -1
  213. package/dist/index82.cjs +1 -1
  214. package/dist/index82.js +1 -1
  215. package/dist/index83.cjs +1 -1
  216. package/dist/index83.js +1 -1
  217. package/dist/index84.cjs +1 -1
  218. package/dist/index84.js +1 -1
  219. package/dist/index85.cjs +1 -1
  220. package/dist/index85.js +7 -1
  221. package/dist/index86.cjs +1 -1
  222. package/dist/index86.js +1 -1
  223. package/dist/index87.cjs +1 -1
  224. package/dist/index87.js +1 -1
  225. package/dist/index88.cjs +1 -1
  226. package/dist/index88.js +1 -1
  227. package/dist/index89.cjs +1 -1
  228. package/dist/index89.js +1 -1
  229. package/dist/index9.cjs +1 -1
  230. package/dist/index9.js +1 -1
  231. package/dist/index90.cjs +1 -1
  232. package/dist/index90.js +1 -1
  233. package/dist/index91.cjs +1 -1
  234. package/dist/index91.js +1 -1
  235. package/dist/index92.cjs +1 -1
  236. package/dist/index92.js +1 -1
  237. package/dist/index93.cjs +1 -1
  238. package/dist/index93.js +1 -1
  239. package/dist/index94.cjs +1 -1
  240. package/dist/index94.js +1 -1
  241. package/dist/index95.cjs +1 -1
  242. package/dist/index95.js +1 -1
  243. package/dist/index96.cjs +1 -1
  244. package/dist/index96.js +1 -1
  245. package/dist/index97.cjs +1 -1
  246. package/dist/index97.js +1 -1
  247. package/dist/index98.cjs +1 -1
  248. package/dist/index98.js +1 -1
  249. package/dist/index99.cjs +1 -1
  250. package/dist/index99.js +1 -1
  251. package/dist/src/components/data-display/check-filter/CheckFilter.component.d.ts +8 -0
  252. package/dist/src/components/data-display/check-filter/CheckFilter.component.d.ts.map +1 -0
  253. package/dist/src/components/data-display/check-filter/CheckFilter.styles.d.ts +6 -0
  254. package/dist/src/components/data-display/check-filter/CheckFilter.styles.d.ts.map +1 -0
  255. package/dist/src/components/data-display/check-filter/CheckFilter.types.d.ts +68 -0
  256. package/dist/src/components/data-display/check-filter/CheckFilter.types.d.ts.map +1 -0
  257. package/dist/src/components/data-display/datatable/DataTable.component.d.ts.map +1 -1
  258. package/dist/src/components/data-display/datatable/DataTable.styles.d.ts +2 -0
  259. package/dist/src/components/data-display/datatable/DataTable.styles.d.ts.map +1 -1
  260. package/dist/src/components/data-display/datatable/DataTable.types.d.ts +50 -1
  261. package/dist/src/components/data-display/datatable/DataTable.types.d.ts.map +1 -1
  262. package/dist/src/components/data-display/date-filter/DateFilter.component.d.ts +9 -0
  263. package/dist/src/components/data-display/date-filter/DateFilter.component.d.ts.map +1 -0
  264. package/dist/src/components/data-display/date-filter/DateFilter.styles.d.ts +96 -0
  265. package/dist/src/components/data-display/date-filter/DateFilter.styles.d.ts.map +1 -0
  266. package/dist/src/components/data-display/date-filter/DateFilter.types.d.ts +102 -0
  267. package/dist/src/components/data-display/date-filter/DateFilter.types.d.ts.map +1 -0
  268. package/dist/src/components/data-display/date-filter/dateUtils.d.ts +100 -0
  269. package/dist/src/components/data-display/date-filter/dateUtils.d.ts.map +1 -0
  270. package/dist/src/components/data-display/filter/Filter.component.d.ts +21 -0
  271. package/dist/src/components/data-display/filter/Filter.component.d.ts.map +1 -0
  272. package/dist/src/components/data-display/filter/Filter.styles.d.ts +27 -0
  273. package/dist/src/components/data-display/filter/Filter.styles.d.ts.map +1 -0
  274. package/dist/src/components/data-display/filter/Filter.types.d.ts +141 -0
  275. package/dist/src/components/data-display/filter/Filter.types.d.ts.map +1 -0
  276. package/dist/src/components/data-display/filter-button/FilterButton.component.d.ts +5 -0
  277. package/dist/src/components/data-display/filter-button/FilterButton.component.d.ts.map +1 -0
  278. package/dist/src/components/data-display/filter-button/FilterButton.styles.d.ts +10 -0
  279. package/dist/src/components/data-display/filter-button/FilterButton.styles.d.ts.map +1 -0
  280. package/dist/src/components/data-display/filter-button/FilterButton.types.d.ts +18 -0
  281. package/dist/src/components/data-display/filter-button/FilterButton.types.d.ts.map +1 -0
  282. package/dist/src/components/data-display/numeric-filter/NumericFilter.component.d.ts +8 -0
  283. package/dist/src/components/data-display/numeric-filter/NumericFilter.component.d.ts.map +1 -0
  284. package/dist/src/components/data-display/numeric-filter/NumericFilter.styles.d.ts +14 -0
  285. package/dist/src/components/data-display/numeric-filter/NumericFilter.styles.d.ts.map +1 -0
  286. package/dist/src/components/data-display/numeric-filter/NumericFilter.types.d.ts +53 -0
  287. package/dist/src/components/data-display/numeric-filter/NumericFilter.types.d.ts.map +1 -0
  288. package/dist/src/components/data-display/range-filter/RangeFilter.component.d.ts +8 -0
  289. package/dist/src/components/data-display/range-filter/RangeFilter.component.d.ts.map +1 -0
  290. package/dist/src/components/data-display/range-filter/RangeFilter.styles.d.ts +18 -0
  291. package/dist/src/components/data-display/range-filter/RangeFilter.styles.d.ts.map +1 -0
  292. package/dist/src/components/data-display/range-filter/RangeFilter.types.d.ts +44 -0
  293. package/dist/src/components/data-display/range-filter/RangeFilter.types.d.ts.map +1 -0
  294. package/dist/src/components/data-display/sort-button/SortButton.component.d.ts +5 -0
  295. package/dist/src/components/data-display/sort-button/SortButton.component.d.ts.map +1 -0
  296. package/dist/src/components/data-display/sort-button/SortButton.styles.d.ts +5 -0
  297. package/dist/src/components/data-display/sort-button/SortButton.styles.d.ts.map +1 -0
  298. package/dist/src/components/data-display/sort-button/SortButton.types.d.ts +27 -0
  299. package/dist/src/components/data-display/sort-button/SortButton.types.d.ts.map +1 -0
  300. package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts.map +1 -1
  301. package/dist/src/components/forms/numeric-input/NumericInput.types.d.ts +14 -0
  302. package/dist/src/components/forms/numeric-input/NumericInput.types.d.ts.map +1 -1
  303. package/dist/src/components/forms/slider/Slider.component.d.ts +5 -0
  304. package/dist/src/components/forms/slider/Slider.component.d.ts.map +1 -0
  305. package/dist/src/components/forms/slider/Slider.styles.d.ts +21 -0
  306. package/dist/src/components/forms/slider/Slider.styles.d.ts.map +1 -0
  307. package/dist/src/components/forms/slider/Slider.types.d.ts +72 -0
  308. package/dist/src/components/forms/slider/Slider.types.d.ts.map +1 -0
  309. package/dist/src/components/overlays/popover/Popover.component.d.ts +27 -0
  310. package/dist/src/components/overlays/popover/Popover.component.d.ts.map +1 -0
  311. package/dist/src/components/overlays/popover/Popover.styles.d.ts +2 -0
  312. package/dist/src/components/overlays/popover/Popover.styles.d.ts.map +1 -0
  313. package/dist/src/components/overlays/popover/Popover.types.d.ts +18 -0
  314. package/dist/src/components/overlays/popover/Popover.types.d.ts.map +1 -0
  315. package/dist/src/index.d.ts +18 -0
  316. package/dist/src/index.d.ts.map +1 -1
  317. package/dist/styles.css +1 -1
  318. package/package.json +4 -2
package/dist/index40.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@adam-milo/icons"),r=require("./index58.cjs"),s=require("./index12.cjs"),l=require("./index86.cjs"),d=["60%","75%","45%","55%","70%","50%"],c=t.forwardRef(({columns:c,data:n,striped:o=!1,hoverable:i=!1,headerLeft:h,headerRight:y,borderBreak:u=!1,onLoadMore:m,isLoadingMore:x=!1,hasMore:S=!1,loadingIndicator:b,skeletonRows:p=3,maxHeight:$,emptyStateText:k,selectable:f=!1,rowKey:v="id",selectedRows:j,onSelectionChange:g,onRowClick:B,footerBar:w,className:N,"data-cy":C,"data-testid":E,...L},R)=>{const T=C||"datatable",I=E||"datatable",q=h||y,F=t.useRef(null),M=t.useRef(null),[A,D]=t.useState(!1);t.useEffect(()=>{const e=M.current;if(!e||!$)return;const t=()=>D(e.scrollTop>0);return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[$]);const H=t.useMemo(()=>j??new Set,[j]),K=n.map(e=>String(e[v]??"")),O=f&&n.length>0&&K.every(e=>H.has(e)),_=f&&n.length>0&&K.some(e=>H.has(e)),P=t.useCallback(()=>{if(g)if(O){const e=new Set(H);K.forEach(t=>e.delete(t)),g(e)}else{const e=new Set(H);K.forEach(t=>e.add(t)),g(e)}},[O,K,H,g]),W=t.useCallback(e=>{if(!g)return;const t=new Set(H);t.has(e)?t.delete(e):t.add(e),g(t)},[H,g]),z=f?c.length+1:c.length,G=t.useCallback(e=>{const[t]=e;t.isIntersecting&&S&&!x&&m&&m()},[S,x,m]);t.useEffect(()=>{const e=F.current;if(!e||!m)return;const t=new IntersectionObserver(G,{root:$?M.current:null,rootMargin:"0px",threshold:.1});return t.observe(e),()=>t.disconnect()},[G,m,$]);const J=e.jsxs(e.Fragment,{children:[e.jsxs("table",{ref:R,className:r.cn(l.tableBaseStyles,N),"aria-busy":x||void 0,"data-cy":T,"data-testid":I,...L,children:[e.jsx("thead",{className:r.cn(l.theadStyles,u&&l.theadBorderBreakStyles,$&&l.stickyTheadStyles,$&&A&&l.stickyTheadScrolledStyles),"data-cy":`${T}-head`,"data-testid":`${I}-head`,children:e.jsxs("tr",{children:[f&&e.jsx("th",{scope:"col",className:r.cn(l.checkboxCellStyles,u&&l.thBorderBreakStyles),"data-cy":`${T}-header-checkbox`,"data-testid":`${I}-header-checkbox`,children:e.jsx("label",{className:l.checkboxLabelStyles,children:e.jsx(s.Checkbox,{checked:O,indeterminate:_&&!O,onChange:P,"aria-label":"Select all rows","data-cy":`${T}-select-all`,"data-testid":`${I}-select-all`})})}),c.map(t=>e.jsx("th",{scope:"col",className:r.cn(l.thStyles,u&&l.thBorderBreakStyles),"data-cy":`${T}-header-${t.key}`,"data-testid":`${I}-header-${t.key}`,children:t.header},t.key))]})}),e.jsxs("tbody",{"data-cy":`${T}-body`,"data-testid":`${I}-body`,children:[0!==n.length||x?n.map((t,a)=>e.jsxs("tr",{className:r.cn(l.trStripedStyles,u&&l.trBorderBreakStyles,i&&l.trHoverableStyles,o&&!u&&l.trStripedEvenStyles,B&&l.trClickableStyles,B&&u&&l.trClickableBorderBreakFocusStyles),tabIndex:B?0:void 0,style:B?{outline:"none",boxShadow:"none"}:void 0,onFocus:e=>e.currentTarget.setAttribute("data-focused","true"),onBlur:e=>e.currentTarget.removeAttribute("data-focused"),onClick:B?e=>{e.target.closest('button, a, input, label, [role="checkbox"]')||B(t,a)}:void 0,onKeyDown:B?e=>{if("Enter"===e.key||" "===e.key){if(e.target.closest('button, a, input, label, [role="checkbox"]'))return;e.preventDefault(),B(t,a)}}:void 0,"data-cy":`${T}-row-${a}`,"data-testid":`${I}-row-${a}`,children:[f&&e.jsx("td",{className:r.cn(l.checkboxCellStyles,u&&l.tdBorderBreakStyles),"data-cy":`${T}-cell-${a}-checkbox`,"data-testid":`${I}-cell-${a}-checkbox`,children:e.jsx("label",{className:l.checkboxLabelStyles,children:e.jsx(s.Checkbox,{checked:H.has(String(t[v]??"")),onChange:()=>W(String(t[v]??"")),"aria-label":`Select row ${a+1}`,"data-cy":`${T}-select-${a}`,"data-testid":`${I}-select-${a}`})})}),c.map(s=>e.jsx("td",{className:r.cn(l.tdStyles,u&&l.tdBorderBreakStyles),"data-cy":`${T}-cell-${a}-${s.key}`,"data-testid":`${I}-cell-${a}-${s.key}`,children:s.render?s.render(t[s.key],t,a):String(t[s.key]??"")},s.key))]},a)):e.jsx("tr",{children:e.jsx("td",{colSpan:z,className:"p-0","data-cy":`${T}-empty`,"data-testid":`${I}-empty`,children:e.jsxs("div",{className:l.emptyStateWrapperStyles,children:[e.jsx("div",{className:l.emptyStateIconStyles,"aria-hidden":"true","data-cy":`${T}-empty-icon`,"data-testid":`${I}-empty-icon`,children:e.jsx(a.CustomEmptyBoxIcon,{width:"100%",height:"100%"})}),k&&e.jsx("p",{className:l.emptyStateTextStyles,"data-cy":`${T}-empty-text`,"data-testid":`${I}-empty-text`,children:k})]})})}),x&&(b?e.jsx("tr",{children:e.jsx("td",{colSpan:z,className:l.loadingRowStyles,"data-cy":`${T}-loading`,"data-testid":`${I}-loading`,children:b})}):Array.from({length:p}).map((t,a)=>e.jsxs("tr",{className:r.cn(l.trStripedStyles,u&&l.trBorderBreakStyles),"data-cy":`${T}-skeleton-${a}`,"data-testid":`${I}-skeleton-${a}`,children:[f&&e.jsx("td",{className:r.cn(l.checkboxCellStyles,u&&l.tdBorderBreakStyles),children:e.jsx("div",{className:l.checkboxLabelStyles,children:e.jsx("div",{className:"w-4 h-4 rounded-4 bg-[color-mix(in_srgb,var(--color-border)_40%,transparent)]"})})}),c.map((t,s)=>e.jsx("td",{className:r.cn(l.tdStyles,u&&l.tdBorderBreakStyles),children:e.jsx("div",{className:l.skeletonCellStyles,style:{width:d[(a+s)%d.length]}})},t.key))]},`skeleton-${a}`)))]})]}),m&&e.jsx("div",{ref:F,className:"h-4","data-cy":`${T}-sentinel`,"data-testid":`${I}-sentinel`,"aria-hidden":"true"})]}),Q=e.jsxs("div",{className:r.cn(l.wrapperStyles,u&&(S?"overflow-hidden rounded-t-2xl":"overflow-hidden rounded-2xl")),tabIndex:-1,style:{outline:"none"},"data-cy":`${T}-wrapper`,"data-testid":`${I}-wrapper`,children:[q&&e.jsxs("div",{className:l.headerBarStyles,"data-cy":`${T}-header-bar`,"data-testid":`${I}-header-bar`,children:[e.jsx("div",{"data-cy":`${T}-header-left`,"data-testid":`${I}-header-left`,children:h}),e.jsx("div",{"data-cy":`${T}-header-right`,"data-testid":`${I}-header-right`,children:y})]}),$?e.jsx("div",{ref:M,className:l.scrollContainerStyles,tabIndex:-1,style:{maxHeight:$,outline:"none"},children:J}):J]}),U=w?e.jsx("div",{className:l.footerBarStyles,"data-cy":`${T}-footer-bar`,"data-testid":`${I}-footer-bar`,children:w}):null;return u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:r.cn(l.wrapperBorderBreakStyles,S?l.wrapperBorderBreakFlatBottomStyles:l.wrapperBorderBreakRoundedStyles),children:Q}),U]}):e.jsxs(e.Fragment,{children:[Q,U]})});c.displayName="DataTable";const n=t.forwardRef(({children:a,className:s,style:l,...d},c)=>{const n=t.useRef(null),[o,i]=t.useState(!1);return t.useEffect(()=>{const e=n.current;if(!e)return;const t=e.closest("tr");if(!t)return;const a=()=>i(!0),r=()=>i(!1);return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",r),t.addEventListener("focusin",a),t.addEventListener("focusout",r),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",a),t.removeEventListener("focusout",r)}},[]),e.jsx("span",{ref:e=>{n.current=e,"function"==typeof c?c(e):c&&(c.current=e)},className:r.cn("transition-opacity duration-200",o?"opacity-100":"opacity-0",s),style:l,...d,children:a})});n.displayName="RowAction",exports.DataTable=c,exports.RowAction=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),e=require("./index67.cjs"),r=require("./index95.cjs"),d=t.forwardRef(({variant:t="default",className:d,children:s,"data-cy":c,"data-testid":o,...i},n)=>{const l=c||`card-${t}`,y=o||`card-${t}`;return a.jsx("div",{ref:n,className:e.cn(r.cardRootStyles,r.cardVariantMap[t],d),"data-cy":l,"data-testid":y,...i,children:s})});d.displayName="Card";const s=t.forwardRef(({className:t,"data-cy":d,"data-testid":s,...c},o)=>{const i=d||"card-header",n=s||"card-header";return a.jsx("div",{ref:o,className:e.cn(r.cardHeaderStyles,t),"data-cy":i,"data-testid":n,...c})});s.displayName="CardHeader";const c=t.forwardRef(({className:t,"data-cy":d,"data-testid":s,...c},o)=>{const i=d||"card-title",n=s||"card-title";return a.jsx("h3",{ref:o,className:e.cn(r.cardTitleStyles,t),"data-cy":i,"data-testid":n,...c})});c.displayName="CardTitle";const o=t.forwardRef(({className:t,"data-cy":d,"data-testid":s,...c},o)=>{const i=d||"card-description",n=s||"card-description";return a.jsx("p",{ref:o,className:e.cn(r.cardDescriptionStyles,t),"data-cy":i,"data-testid":n,...c})});o.displayName="CardDescription";const i=t.forwardRef(({className:t,"data-cy":d,"data-testid":s,...c},o)=>{const i=d||"card-content",n=s||"card-content";return a.jsx("div",{ref:o,className:e.cn(r.cardContentStyles,t),"data-cy":i,"data-testid":n,...c})});i.displayName="CardContent";const n=t.forwardRef(({className:t,align:d="start","data-cy":s,"data-testid":c,...o},i)=>{const n=s||"card-footer",l=c||"card-footer";return a.jsx("div",{ref:i,className:e.cn(r.cardFooterBaseStyles,r.cardFooterAlignMap[d],t),"data-cy":n,"data-testid":l,"data-footer-align":d,...o})});n.displayName="CardFooter",exports.Card=d,exports.CardContent=i,exports.CardDescription=o,exports.CardFooter=n,exports.CardHeader=s,exports.CardTitle=c;
package/dist/index40.js CHANGED
@@ -1,9 +1,8 @@
1
- import{jsxs as e,Fragment as t,jsx as a}from"react/jsx-runtime";import{forwardRef as r,useRef as d,useState as n,useEffect as s,useMemo as c,useCallback as l}from"react";import{CustomEmptyBoxIcon as i}from"@adam-milo/icons";import{cn as o}from"./index58.js";import{Checkbox as h}from"./index12.js";import{checkboxLabelStyles as m,emptyStateWrapperStyles as y,emptyStateIconStyles as u,emptyStateTextStyles as $,loadingRowStyles as p,skeletonCellStyles as v,headerBarStyles as b,scrollContainerStyles as f,thBorderBreakStyles as g,checkboxCellStyles as N,thStyles as k,stickyTheadScrolledStyles as x,stickyTheadStyles as w,theadBorderBreakStyles as S,theadStyles as E,tdBorderBreakStyles as L,tdStyles as I,trClickableBorderBreakFocusStyles as C,trClickableStyles as R,trStripedEvenStyles as T,trHoverableStyles as j,trBorderBreakStyles as A,trStripedStyles as M,tableBaseStyles as B,footerBarStyles as D,wrapperStyles as H,wrapperBorderBreakFlatBottomStyles as K,wrapperBorderBreakRoundedStyles as _,wrapperBorderBreakStyles as F}from"./index86.js";const O=["60%","75%","45%","55%","70%","50%"],q=r(({columns:r,data:q,striped:z=!1,hoverable:G=!1,headerLeft:J,headerRight:P,borderBreak:Q=!1,onLoadMore:U,isLoadingMore:V=!1,hasMore:W=!1,loadingIndicator:X,skeletonRows:Y=3,maxHeight:Z,emptyStateText:ee,selectable:te=!1,rowKey:ae="id",selectedRows:re,onSelectionChange:de,onRowClick:ne,footerBar:se,className:ce,"data-cy":le,"data-testid":ie,...oe},he)=>{const me=le||"datatable",ye=ie||"datatable",ue=J||P,$e=d(null),pe=d(null),[ve,be]=n(!1);s(()=>{const e=pe.current;if(!e||!Z)return;const t=()=>be(e.scrollTop>0);return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[Z]);const fe=c(()=>re??/* @__PURE__ */new Set,[re]),ge=q.map(e=>String(e[ae]??"")),Ne=te&&q.length>0&&ge.every(e=>fe.has(e)),ke=te&&q.length>0&&ge.some(e=>fe.has(e)),xe=l(()=>{if(de)if(Ne){const e=new Set(fe);ge.forEach(t=>e.delete(t)),de(e)}else{const e=new Set(fe);ge.forEach(t=>e.add(t)),de(e)}},[Ne,ge,fe,de]),we=l(e=>{if(!de)return;const t=new Set(fe);t.has(e)?t.delete(e):t.add(e),de(t)},[fe,de]),Se=te?r.length+1:r.length,Ee=l(e=>{const[t]=e;t.isIntersecting&&W&&!V&&U&&U()},[W,V,U]);s(()=>{const e=$e.current;if(!e||!U)return;const t=new IntersectionObserver(Ee,{root:Z?pe.current:null,rootMargin:"0px",threshold:.1});return t.observe(e),()=>t.disconnect()},[Ee,U,Z]);const Le=/* @__PURE__ */e(t,{children:[
2
- /* @__PURE__ */e("table",{ref:he,className:o(B,ce),"aria-busy":V||void 0,"data-cy":me,"data-testid":ye,...oe,children:[
3
- /* @__PURE__ */a("thead",{className:o(E,Q&&S,Z&&w,Z&&ve&&x),"data-cy":`${me}-head`,"data-testid":`${ye}-head`,children:/* @__PURE__ */e("tr",{children:[te&&/* @__PURE__ */a("th",{scope:"col",className:o(N,Q&&g),"data-cy":`${me}-header-checkbox`,"data-testid":`${ye}-header-checkbox`,children:/* @__PURE__ */a("label",{className:m,children:/* @__PURE__ */a(h,{checked:Ne,indeterminate:ke&&!Ne,onChange:xe,"aria-label":"Select all rows","data-cy":`${me}-select-all`,"data-testid":`${ye}-select-all`})})}),r.map(e=>/* @__PURE__ */a("th",{scope:"col",className:o(k,Q&&g),"data-cy":`${me}-header-${e.key}`,"data-testid":`${ye}-header-${e.key}`,children:e.header},e.key))]})}),
4
- /* @__PURE__ */e("tbody",{"data-cy":`${me}-body`,"data-testid":`${ye}-body`,children:[0!==q.length||V?q.map((t,d)=>/* @__PURE__ */e("tr",{className:o(M,Q&&A,G&&j,z&&!Q&&T,ne&&R,ne&&Q&&C),tabIndex:ne?0:void 0,style:ne?{outline:"none",boxShadow:"none"}:void 0,onFocus:e=>e.currentTarget.setAttribute("data-focused","true"),onBlur:e=>e.currentTarget.removeAttribute("data-focused"),onClick:ne?e=>{e.target.closest('button, a, input, label, [role="checkbox"]')||ne(t,d)}:void 0,onKeyDown:ne?e=>{if("Enter"===e.key||" "===e.key){if(e.target.closest('button, a, input, label, [role="checkbox"]'))return;e.preventDefault(),ne(t,d)}}:void 0,"data-cy":`${me}-row-${d}`,"data-testid":`${ye}-row-${d}`,children:[te&&/* @__PURE__ */a("td",{className:o(N,Q&&L),"data-cy":`${me}-cell-${d}-checkbox`,"data-testid":`${ye}-cell-${d}-checkbox`,children:/* @__PURE__ */a("label",{className:m,children:/* @__PURE__ */a(h,{checked:fe.has(String(t[ae]??"")),onChange:()=>we(String(t[ae]??"")),"aria-label":`Select row ${d+1}`,"data-cy":`${me}-select-${d}`,"data-testid":`${ye}-select-${d}`})})}),r.map(e=>/* @__PURE__ */a("td",{className:o(I,Q&&L),"data-cy":`${me}-cell-${d}-${e.key}`,"data-testid":`${ye}-cell-${d}-${e.key}`,children:e.render?e.render(t[e.key],t,d):String(t[e.key]??"")},e.key))]},d)):/* @__PURE__ */a("tr",{children:/* @__PURE__ */a("td",{colSpan:Se,className:"p-0","data-cy":`${me}-empty`,"data-testid":`${ye}-empty`,children:/* @__PURE__ */e("div",{className:y,children:[
5
- /* @__PURE__ */a("div",{className:u,"aria-hidden":"true","data-cy":`${me}-empty-icon`,"data-testid":`${ye}-empty-icon`,children:/* @__PURE__ */a(i,{width:"100%",height:"100%"})}),ee&&/* @__PURE__ */a("p",{className:$,"data-cy":`${me}-empty-text`,"data-testid":`${ye}-empty-text`,children:ee})]})})}),V&&(X?/* @__PURE__ */a("tr",{children:/* @__PURE__ */a("td",{colSpan:Se,className:p,"data-cy":`${me}-loading`,"data-testid":`${ye}-loading`,children:X})}):Array.from({length:Y}).map((t,d)=>/* @__PURE__ */e("tr",{className:o(M,Q&&A),"data-cy":`${me}-skeleton-${d}`,"data-testid":`${ye}-skeleton-${d}`,children:[te&&/* @__PURE__ */a("td",{className:o(N,Q&&L),children:/* @__PURE__ */a("div",{className:m,children:/* @__PURE__ */a("div",{className:"w-4 h-4 rounded-4 bg-[color-mix(in_srgb,var(--color-border)_40%,transparent)]"})})}),r.map((e,t)=>/* @__PURE__ */a("td",{className:o(I,Q&&L),children:/* @__PURE__ */a("div",{className:v,style:{width:O[(d+t)%O.length]}})},e.key))]},`skeleton-${d}`)))]})]}),U&&/* @__PURE__ */a("div",{ref:$e,className:"h-4","data-cy":`${me}-sentinel`,"data-testid":`${ye}-sentinel`,"aria-hidden":"true"})]}),Ie=/* @__PURE__ */e("div",{className:o(H,Q&&(W?"overflow-hidden rounded-t-2xl":"overflow-hidden rounded-2xl")),tabIndex:-1,style:{outline:"none"},"data-cy":`${me}-wrapper`,"data-testid":`${ye}-wrapper`,children:[ue&&/* @__PURE__ */e("div",{className:b,"data-cy":`${me}-header-bar`,"data-testid":`${ye}-header-bar`,children:[
6
- /* @__PURE__ */a("div",{"data-cy":`${me}-header-left`,"data-testid":`${ye}-header-left`,children:J}),
7
- /* @__PURE__ */a("div",{"data-cy":`${me}-header-right`,"data-testid":`${ye}-header-right`,children:P})]}),Z?/* @__PURE__ */a("div",{ref:pe,className:f,tabIndex:-1,style:{maxHeight:Z,outline:"none"},children:Le}):Le]}),Ce=se?/* @__PURE__ */a("div",{className:D,"data-cy":`${me}-footer-bar`,"data-testid":`${ye}-footer-bar`,children:se}):null;/* @__PURE__ */
8
- return e(t,Q?{children:[
9
- /* @__PURE__ */a("div",{className:o(F,W?K:_),children:Ie}),Ce]}:{children:[Ie,Ce]})});q.displayName="DataTable";const z=r(({children:e,className:t,style:r,...c},l)=>{const i=d(null),[h,m]=n(!1);return s(()=>{const e=i.current;if(!e)return;const t=e.closest("tr");if(!t)return;const a=()=>m(!0),r=()=>m(!1);return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",r),t.addEventListener("focusin",a),t.addEventListener("focusout",r),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",a),t.removeEventListener("focusout",r)}},[]),/* @__PURE__ */a("span",{ref:e=>{i.current=e,"function"==typeof l?l(e):l&&(l.current=e)},className:o("transition-opacity duration-200",h?"opacity-100":"opacity-0",t),style:r,...c,children:e})});z.displayName="RowAction";export{q as DataTable,z as RowAction};
1
+ import{jsx as a}from"react/jsx-runtime";import{forwardRef as t}from"react";import{cn as d}from"./index67.js";import{cardVariantMap as e,cardRootStyles as r,cardHeaderStyles as s,cardTitleStyles as c,cardDescriptionStyles as i,cardContentStyles as n,cardFooterAlignMap as o,cardFooterBaseStyles as m}from"./index95.js";const l=t(({variant:t="default",className:s,children:c,"data-cy":i,"data-testid":n,...o},m)=>{const l=i||`card-${t}`,y=n||`card-${t}`;/* @__PURE__ */
2
+ return a("div",{ref:m,className:d(r,e[t],s),"data-cy":l,"data-testid":y,...o,children:c})});l.displayName="Card";const y=t(({className:t,"data-cy":e,"data-testid":r,...c},i)=>{const n=e||"card-header",o=r||"card-header";/* @__PURE__ */
3
+ return a("div",{ref:i,className:d(s,t),"data-cy":n,"data-testid":o,...c})});y.displayName="CardHeader";const N=t(({className:t,"data-cy":e,"data-testid":r,...s},i)=>{const n=e||"card-title",o=r||"card-title";
4
+ /* @__PURE__ */
5
+ return a("h3",{ref:i,className:d(c,t),"data-cy":n,"data-testid":o,...s})});N.displayName="CardTitle";const p=t(({className:t,"data-cy":e,"data-testid":r,...s},c)=>{const n=e||"card-description",o=r||"card-description";/* @__PURE__ */
6
+ return a("p",{ref:c,className:d(i,t),"data-cy":n,"data-testid":o,...s})});p.displayName="CardDescription";const f=t(({className:t,"data-cy":e,"data-testid":r,...s},c)=>{const i=e||"card-content",o=r||"card-content";/* @__PURE__ */
7
+ return a("div",{ref:c,className:d(n,t),"data-cy":i,"data-testid":o,...s})});f.displayName="CardContent";const u=t(({className:t,align:e="start","data-cy":r,"data-testid":s,...c},i)=>{const n=r||"card-footer",l=s||"card-footer";/* @__PURE__ */
8
+ return a("div",{ref:i,className:d(m,o[e],t),"data-cy":n,"data-testid":l,"data-footer-align":e,...c})});u.displayName="CardFooter";export{l as Card,f as CardContent,p as CardDescription,u as CardFooter,y as CardHeader,N as CardTitle};
package/dist/index41.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),r=require("./index58.cjs"),i=require("./index87.cjs"),t=a.forwardRef(({variant:a="primary",selected:t=!1,disabled:s=!1,className:c,children:d,"data-testid":n,"data-cy":l,...o},p)=>{const h=i.chipVariantMap[a],u=r.cn(i.chipBaseStyles,t?h.selected:h.base,!t&&!s&&h.hover,s&&"opacity-40 cursor-not-allowed pointer-events-none",c);return e.jsx("div",{ref:p,className:u,"data-testid":n||`chip-${a}`,"data-cy":l||`chip-${a}`,"aria-selected":t,"aria-disabled":s,"aria-label":"string"==typeof d?d:void 0,...o,children:e.jsx("span",{children:d})})});t.displayName="Chip",exports.Chip=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@adam-milo/icons"),r=require("./index67.cjs"),s=require("./index12.cjs"),l=require("./index45.cjs"),d=require("./index48.cjs"),n=require("./index96.cjs"),c=["60%","75%","45%","55%","70%","50%"],o=t.forwardRef(({columns:o,data:i,striped:y=!1,hoverable:h=!1,headerLeft:u,headerRight:m,borderBreak:x=!1,onLoadMore:S,isLoadingMore:b=!1,hasMore:p=!1,loadingIndicator:$,skeletonRows:k=3,maxHeight:f,emptyStateText:j,selectable:v=!1,rowKey:g="id",selectedRows:B,onSelectionChange:N,onRowClick:w,footerBar:C,sortKey:E,sortDirection:L,onSortChange:R,filters:T,onFilterChange:F,className:q,"data-cy":I,"data-testid":A,...D},M)=>{const O=I||"datatable",H=A||"datatable",K=u||m,_=t.useRef(null),P=t.useRef(null),[W,z]=t.useState(!1);t.useEffect(()=>{const e=P.current;if(!e||!f)return;const t=()=>z(e.scrollTop>0);return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[f]);const G=t.useMemo(()=>B??new Set,[B]),J=i.map(e=>String(e[g]??"")),Q=v&&i.length>0&&J.every(e=>G.has(e)),U=v&&i.length>0&&J.some(e=>G.has(e)),V=t.useCallback(()=>{if(N)if(Q){const e=new Set(G);J.forEach(t=>e.delete(t)),N(e)}else{const e=new Set(G);J.forEach(t=>e.add(t)),N(e)}},[Q,J,G,N]),X=t.useCallback(e=>{if(!N)return;const t=new Set(G);t.has(e)?t.delete(e):t.add(e),N(t)},[G,N]),Y=v?o.length+1:o.length,Z=e=>{if(e.sortable)return E!==e.key?"none":"asc"===L?"ascending":"desc"===L?"descending":"none"},ee=t=>{const a="string"==typeof t.header?t.header:void 0;return e.jsxs("span",{className:n.headerCellContentStyles,children:[e.jsx("span",{className:n.headerLabelStyles,children:t.header}),t.sortable&&e.jsx(l.SortButton,{direction:E===t.key?L??"none":"none",onDirectionChange:e=>R?.(t.key,e),"aria-label":a?`Sort by ${a}`:"Sort column","data-cy":`${O}-sort-${t.key}`,"data-testid":`${H}-sort-${t.key}`}),t.filterable&&t.filterOptions&&e.jsx(d.CheckFilter,{mode:"multi",options:t.filterOptions,value:T?.[t.key],onApply:e=>F?.(t.key,e),title:t.filterTitle,searchable:t.filterSearchable,"aria-label":a?`Filter ${a}`:"Filter column","data-cy":`${O}-filter-${t.key}`,"data-testid":`${H}-filter-${t.key}`})]})},te=t.useCallback(e=>{const[t]=e;t.isIntersecting&&p&&!b&&S&&S()},[p,b,S]);t.useEffect(()=>{const e=_.current;if(!e||!S)return;const t=new IntersectionObserver(te,{root:f?P.current:null,rootMargin:"0px",threshold:.1});return t.observe(e),()=>t.disconnect()},[te,S,f]);const ae=e.jsxs(e.Fragment,{children:[e.jsxs("table",{ref:M,className:r.cn(n.tableBaseStyles,q),"aria-busy":b||void 0,"data-cy":O,"data-testid":H,...D,children:[e.jsx("thead",{className:r.cn(n.theadStyles,x&&n.theadBorderBreakStyles,f&&n.stickyTheadStyles,f&&W&&n.stickyTheadScrolledStyles),"data-cy":`${O}-head`,"data-testid":`${H}-head`,children:e.jsxs("tr",{children:[v&&e.jsx("th",{scope:"col",className:r.cn(n.checkboxCellStyles,x&&n.thBorderBreakStyles),"data-cy":`${O}-header-checkbox`,"data-testid":`${H}-header-checkbox`,children:e.jsx("label",{className:n.checkboxLabelStyles,children:e.jsx(s.Checkbox,{checked:Q,indeterminate:U&&!Q,onChange:V,"aria-label":"Select all rows","data-cy":`${O}-select-all`,"data-testid":`${H}-select-all`})})}),o.map(t=>e.jsx("th",{scope:"col","aria-sort":Z(t),className:r.cn(n.thStyles,x&&n.thBorderBreakStyles),"data-cy":`${O}-header-${t.key}`,"data-testid":`${H}-header-${t.key}`,children:ee(t)},t.key))]})}),e.jsxs("tbody",{"data-cy":`${O}-body`,"data-testid":`${H}-body`,children:[0!==i.length||b?i.map((t,a)=>e.jsxs("tr",{className:r.cn(n.trStripedStyles,x&&n.trBorderBreakStyles,h&&n.trHoverableStyles,y&&!x&&n.trStripedEvenStyles,w&&n.trClickableStyles,w&&x&&n.trClickableBorderBreakFocusStyles),tabIndex:w?0:void 0,style:w?{outline:"none",boxShadow:"none"}:void 0,onFocus:e=>e.currentTarget.setAttribute("data-focused","true"),onBlur:e=>e.currentTarget.removeAttribute("data-focused"),onClick:w?e=>{e.target.closest('button, a, input, label, [role="checkbox"]')||w(t,a)}:void 0,onKeyDown:w?e=>{if("Enter"===e.key||" "===e.key){if(e.target.closest('button, a, input, label, [role="checkbox"]'))return;e.preventDefault(),w(t,a)}}:void 0,"data-cy":`${O}-row-${a}`,"data-testid":`${H}-row-${a}`,children:[v&&e.jsx("td",{className:r.cn(n.checkboxCellStyles,x&&n.tdBorderBreakStyles),"data-cy":`${O}-cell-${a}-checkbox`,"data-testid":`${H}-cell-${a}-checkbox`,children:e.jsx("label",{className:n.checkboxLabelStyles,children:e.jsx(s.Checkbox,{checked:G.has(String(t[g]??"")),onChange:()=>X(String(t[g]??"")),"aria-label":`Select row ${a+1}`,"data-cy":`${O}-select-${a}`,"data-testid":`${H}-select-${a}`})})}),o.map(s=>e.jsx("td",{className:r.cn(n.tdStyles,x&&n.tdBorderBreakStyles),"data-cy":`${O}-cell-${a}-${s.key}`,"data-testid":`${H}-cell-${a}-${s.key}`,children:s.render?s.render(t[s.key],t,a):String(t[s.key]??"")},s.key))]},a)):e.jsx("tr",{children:e.jsx("td",{colSpan:Y,className:"p-0","data-cy":`${O}-empty`,"data-testid":`${H}-empty`,children:e.jsxs("div",{className:n.emptyStateWrapperStyles,children:[e.jsx("div",{className:n.emptyStateIconStyles,"aria-hidden":"true","data-cy":`${O}-empty-icon`,"data-testid":`${H}-empty-icon`,children:e.jsx(a.CustomEmptyBoxIcon,{width:"100%",height:"100%"})}),j&&e.jsx("p",{className:n.emptyStateTextStyles,"data-cy":`${O}-empty-text`,"data-testid":`${H}-empty-text`,children:j})]})})}),b&&($?e.jsx("tr",{children:e.jsx("td",{colSpan:Y,className:n.loadingRowStyles,"data-cy":`${O}-loading`,"data-testid":`${H}-loading`,children:$})}):Array.from({length:k}).map((t,a)=>e.jsxs("tr",{className:r.cn(n.trStripedStyles,x&&n.trBorderBreakStyles),"data-cy":`${O}-skeleton-${a}`,"data-testid":`${H}-skeleton-${a}`,children:[v&&e.jsx("td",{className:r.cn(n.checkboxCellStyles,x&&n.tdBorderBreakStyles),children:e.jsx("div",{className:n.checkboxLabelStyles,children:e.jsx("div",{className:"w-4 h-4 rounded-4 bg-[color-mix(in_srgb,var(--color-border)_40%,transparent)]"})})}),o.map((t,s)=>e.jsx("td",{className:r.cn(n.tdStyles,x&&n.tdBorderBreakStyles),children:e.jsx("div",{className:n.skeletonCellStyles,style:{width:c[(a+s)%c.length]}})},t.key))]},`skeleton-${a}`)))]})]}),S&&e.jsx("div",{ref:_,className:"h-4","data-cy":`${O}-sentinel`,"data-testid":`${H}-sentinel`,"aria-hidden":"true"})]}),re=e.jsxs("div",{className:r.cn(n.wrapperStyles,x&&(p?"overflow-hidden rounded-t-2xl":"overflow-hidden rounded-2xl")),tabIndex:-1,style:{outline:"none"},"data-cy":`${O}-wrapper`,"data-testid":`${H}-wrapper`,children:[K&&e.jsxs("div",{className:n.headerBarStyles,"data-cy":`${O}-header-bar`,"data-testid":`${H}-header-bar`,children:[e.jsx("div",{"data-cy":`${O}-header-left`,"data-testid":`${H}-header-left`,children:u}),e.jsx("div",{"data-cy":`${O}-header-right`,"data-testid":`${H}-header-right`,children:m})]}),f?e.jsx("div",{ref:P,className:n.scrollContainerStyles,tabIndex:-1,style:{maxHeight:f,outline:"none"},children:ae}):ae]}),se=C?e.jsx("div",{className:n.footerBarStyles,"data-cy":`${O}-footer-bar`,"data-testid":`${H}-footer-bar`,children:C}):null;return x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:r.cn(n.wrapperBorderBreakStyles,p?n.wrapperBorderBreakFlatBottomStyles:n.wrapperBorderBreakRoundedStyles),children:re}),se]}):e.jsxs(e.Fragment,{children:[re,se]})});o.displayName="DataTable";const i=t.forwardRef(({children:a,className:s,style:l,...d},n)=>{const c=t.useRef(null),[o,i]=t.useState(!1);return t.useEffect(()=>{const e=c.current;if(!e)return;const t=e.closest("tr");if(!t)return;const a=()=>i(!0),r=()=>i(!1);return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",r),t.addEventListener("focusin",a),t.addEventListener("focusout",r),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",a),t.removeEventListener("focusout",r)}},[]),e.jsx("span",{ref:e=>{c.current=e,"function"==typeof n?n(e):n&&(n.current=e)},className:r.cn("transition-opacity duration-200",o?"opacity-100":"opacity-0",s),style:l,...d,children:a})});i.displayName="RowAction",exports.DataTable=o,exports.RowAction=i;
package/dist/index41.js CHANGED
@@ -1,2 +1,11 @@
1
- import{jsx as e}from"react/jsx-runtime";import{forwardRef as a}from"react";import{cn as r}from"./index58.js";import{chipVariantMap as t,chipBaseStyles as i}from"./index87.js";const d=a(({variant:a="primary",selected:d=!1,disabled:s=!1,className:o,children:c,"data-testid":n,"data-cy":l,...p},m)=>{const h=t[a],f=r(i,d?h.selected:h.base,!d&&!s&&h.hover,s&&"opacity-40 cursor-not-allowed pointer-events-none",o);/* @__PURE__ */
2
- return e("div",{ref:m,className:f,"data-testid":n||`chip-${a}`,"data-cy":l||`chip-${a}`,"aria-selected":d,"aria-disabled":s,"aria-label":"string"==typeof c?c:void 0,...p,children:/* @__PURE__ */e("span",{children:c})})});d.displayName="Chip";export{d as Chip};
1
+ import{jsxs as e,Fragment as t,jsx as a}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as d,useEffect as s,useMemo as i,useCallback as l}from"react";import{CustomEmptyBoxIcon as o}from"@adam-milo/icons";import{cn as c}from"./index67.js";import{Checkbox as h}from"./index12.js";import{SortButton as m}from"./index45.js";import{CheckFilter as y}from"./index48.js";import{checkboxLabelStyles as $,emptyStateWrapperStyles as u,emptyStateIconStyles as p,emptyStateTextStyles as f,loadingRowStyles as b,skeletonCellStyles as v,headerBarStyles as g,scrollContainerStyles as k,headerCellContentStyles as N,headerLabelStyles as x,thBorderBreakStyles as w,checkboxCellStyles as S,thStyles as E,stickyTheadScrolledStyles as L,stickyTheadStyles as C,theadBorderBreakStyles as j,theadStyles as I,tdBorderBreakStyles as T,tdStyles as A,trClickableBorderBreakFocusStyles as D,trClickableStyles as R,trStripedEvenStyles as F,trHoverableStyles as M,trBorderBreakStyles as B,trStripedStyles as K,tableBaseStyles as O,footerBarStyles as H,wrapperStyles as _,wrapperBorderBreakFlatBottomStyles as q,wrapperBorderBreakRoundedStyles as z,wrapperBorderBreakStyles as G}from"./index96.js";const J=["60%","75%","45%","55%","70%","50%"],P=r(({columns:r,data:P,striped:Q=!1,hoverable:U=!1,headerLeft:V,headerRight:W,borderBreak:X=!1,onLoadMore:Y,isLoadingMore:Z=!1,hasMore:ee=!1,loadingIndicator:te,skeletonRows:ae=3,maxHeight:re,emptyStateText:ne,selectable:de=!1,rowKey:se="id",selectedRows:ie,onSelectionChange:le,onRowClick:oe,footerBar:ce,sortKey:he,sortDirection:me,onSortChange:ye,filters:$e,onFilterChange:ue,className:pe,"data-cy":fe,"data-testid":be,...ve},ge)=>{const ke=fe||"datatable",Ne=be||"datatable",xe=V||W,we=n(null),Se=n(null),[Ee,Le]=d(!1);s(()=>{const e=Se.current;if(!e||!re)return;const t=()=>Le(e.scrollTop>0);return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[re]);const Ce=i(()=>ie??/* @__PURE__ */new Set,[ie]),je=P.map(e=>String(e[se]??"")),Ie=de&&P.length>0&&je.every(e=>Ce.has(e)),Te=de&&P.length>0&&je.some(e=>Ce.has(e)),Ae=l(()=>{if(le)if(Ie){const e=new Set(Ce);je.forEach(t=>e.delete(t)),le(e)}else{const e=new Set(Ce);je.forEach(t=>e.add(t)),le(e)}},[Ie,je,Ce,le]),De=l(e=>{if(!le)return;const t=new Set(Ce);t.has(e)?t.delete(e):t.add(e),le(t)},[Ce,le]),Re=de?r.length+1:r.length,Fe=e=>{if(e.sortable)return he!==e.key?"none":"asc"===me?"ascending":"desc"===me?"descending":"none"},Me=t=>{const r="string"==typeof t.header?t.header:void 0;/* @__PURE__ */
2
+ return e("span",{className:N,children:[
3
+ /* @__PURE__ */a("span",{className:x,children:t.header}),t.sortable&&/* @__PURE__ */a(m,{direction:he===t.key?me??"none":"none",onDirectionChange:e=>ye?.(t.key,e),"aria-label":r?`Sort by ${r}`:"Sort column","data-cy":`${ke}-sort-${t.key}`,"data-testid":`${Ne}-sort-${t.key}`}),t.filterable&&t.filterOptions&&/* @__PURE__ */a(y,{mode:"multi",options:t.filterOptions,value:$e?.[t.key],onApply:e=>ue?.(t.key,e),title:t.filterTitle,searchable:t.filterSearchable,"aria-label":r?`Filter ${r}`:"Filter column","data-cy":`${ke}-filter-${t.key}`,"data-testid":`${Ne}-filter-${t.key}`})]})},Be=l(e=>{const[t]=e;t.isIntersecting&&ee&&!Z&&Y&&Y()},[ee,Z,Y]);s(()=>{const e=we.current;if(!e||!Y)return;const t=new IntersectionObserver(Be,{root:re?Se.current:null,rootMargin:"0px",threshold:.1});return t.observe(e),()=>t.disconnect()},[Be,Y,re]);const Ke=/* @__PURE__ */e(t,{children:[
4
+ /* @__PURE__ */e("table",{ref:ge,className:c(O,pe),"aria-busy":Z||void 0,"data-cy":ke,"data-testid":Ne,...ve,children:[
5
+ /* @__PURE__ */a("thead",{className:c(I,X&&j,re&&C,re&&Ee&&L),"data-cy":`${ke}-head`,"data-testid":`${Ne}-head`,children:/* @__PURE__ */e("tr",{children:[de&&/* @__PURE__ */a("th",{scope:"col",className:c(S,X&&w),"data-cy":`${ke}-header-checkbox`,"data-testid":`${Ne}-header-checkbox`,children:/* @__PURE__ */a("label",{className:$,children:/* @__PURE__ */a(h,{checked:Ie,indeterminate:Te&&!Ie,onChange:Ae,"aria-label":"Select all rows","data-cy":`${ke}-select-all`,"data-testid":`${Ne}-select-all`})})}),r.map(e=>/* @__PURE__ */a("th",{scope:"col","aria-sort":Fe(e),className:c(E,X&&w),"data-cy":`${ke}-header-${e.key}`,"data-testid":`${Ne}-header-${e.key}`,children:Me(e)},e.key))]})}),
6
+ /* @__PURE__ */e("tbody",{"data-cy":`${ke}-body`,"data-testid":`${Ne}-body`,children:[0!==P.length||Z?P.map((t,n)=>/* @__PURE__ */e("tr",{className:c(K,X&&B,U&&M,Q&&!X&&F,oe&&R,oe&&X&&D),tabIndex:oe?0:void 0,style:oe?{outline:"none",boxShadow:"none"}:void 0,onFocus:e=>e.currentTarget.setAttribute("data-focused","true"),onBlur:e=>e.currentTarget.removeAttribute("data-focused"),onClick:oe?e=>{e.target.closest('button, a, input, label, [role="checkbox"]')||oe(t,n)}:void 0,onKeyDown:oe?e=>{if("Enter"===e.key||" "===e.key){if(e.target.closest('button, a, input, label, [role="checkbox"]'))return;e.preventDefault(),oe(t,n)}}:void 0,"data-cy":`${ke}-row-${n}`,"data-testid":`${Ne}-row-${n}`,children:[de&&/* @__PURE__ */a("td",{className:c(S,X&&T),"data-cy":`${ke}-cell-${n}-checkbox`,"data-testid":`${Ne}-cell-${n}-checkbox`,children:/* @__PURE__ */a("label",{className:$,children:/* @__PURE__ */a(h,{checked:Ce.has(String(t[se]??"")),onChange:()=>De(String(t[se]??"")),"aria-label":`Select row ${n+1}`,"data-cy":`${ke}-select-${n}`,"data-testid":`${Ne}-select-${n}`})})}),r.map(e=>/* @__PURE__ */a("td",{className:c(A,X&&T),"data-cy":`${ke}-cell-${n}-${e.key}`,"data-testid":`${Ne}-cell-${n}-${e.key}`,children:e.render?e.render(t[e.key],t,n):String(t[e.key]??"")},e.key))]},n)):/* @__PURE__ */a("tr",{children:/* @__PURE__ */a("td",{colSpan:Re,className:"p-0","data-cy":`${ke}-empty`,"data-testid":`${Ne}-empty`,children:/* @__PURE__ */e("div",{className:u,children:[
7
+ /* @__PURE__ */a("div",{className:p,"aria-hidden":"true","data-cy":`${ke}-empty-icon`,"data-testid":`${Ne}-empty-icon`,children:/* @__PURE__ */a(o,{width:"100%",height:"100%"})}),ne&&/* @__PURE__ */a("p",{className:f,"data-cy":`${ke}-empty-text`,"data-testid":`${Ne}-empty-text`,children:ne})]})})}),Z&&(te?/* @__PURE__ */a("tr",{children:/* @__PURE__ */a("td",{colSpan:Re,className:b,"data-cy":`${ke}-loading`,"data-testid":`${Ne}-loading`,children:te})}):Array.from({length:ae}).map((t,n)=>/* @__PURE__ */e("tr",{className:c(K,X&&B),"data-cy":`${ke}-skeleton-${n}`,"data-testid":`${Ne}-skeleton-${n}`,children:[de&&/* @__PURE__ */a("td",{className:c(S,X&&T),children:/* @__PURE__ */a("div",{className:$,children:/* @__PURE__ */a("div",{className:"w-4 h-4 rounded-4 bg-[color-mix(in_srgb,var(--color-border)_40%,transparent)]"})})}),r.map((e,t)=>/* @__PURE__ */a("td",{className:c(A,X&&T),children:/* @__PURE__ */a("div",{className:v,style:{width:J[(n+t)%J.length]}})},e.key))]},`skeleton-${n}`)))]})]}),Y&&/* @__PURE__ */a("div",{ref:we,className:"h-4","data-cy":`${ke}-sentinel`,"data-testid":`${Ne}-sentinel`,"aria-hidden":"true"})]}),Oe=/* @__PURE__ */e("div",{className:c(_,X&&(ee?"overflow-hidden rounded-t-2xl":"overflow-hidden rounded-2xl")),tabIndex:-1,style:{outline:"none"},"data-cy":`${ke}-wrapper`,"data-testid":`${Ne}-wrapper`,children:[xe&&/* @__PURE__ */e("div",{className:g,"data-cy":`${ke}-header-bar`,"data-testid":`${Ne}-header-bar`,children:[
8
+ /* @__PURE__ */a("div",{"data-cy":`${ke}-header-left`,"data-testid":`${Ne}-header-left`,children:V}),
9
+ /* @__PURE__ */a("div",{"data-cy":`${ke}-header-right`,"data-testid":`${Ne}-header-right`,children:W})]}),re?/* @__PURE__ */a("div",{ref:Se,className:k,tabIndex:-1,style:{maxHeight:re,outline:"none"},children:Ke}):Ke]}),He=ce?/* @__PURE__ */a("div",{className:H,"data-cy":`${ke}-footer-bar`,"data-testid":`${Ne}-footer-bar`,children:ce}):null;/* @__PURE__ */
10
+ return e(t,X?{children:[
11
+ /* @__PURE__ */a("div",{className:c(G,ee?q:z),children:Oe}),He]}:{children:[Oe,He]})});P.displayName="DataTable";const Q=r(({children:e,className:t,style:r,...i},l)=>{const o=n(null),[h,m]=d(!1);return s(()=>{const e=o.current;if(!e)return;const t=e.closest("tr");if(!t)return;const a=()=>m(!0),r=()=>m(!1);return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",r),t.addEventListener("focusin",a),t.addEventListener("focusout",r),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",a),t.removeEventListener("focusout",r)}},[]),/* @__PURE__ */a("span",{ref:e=>{o.current=e,"function"==typeof l?l(e):l&&(l.current=e)},className:c("transition-opacity duration-200",h?"opacity-100":"opacity-0",t),style:r,...i,children:e})});Q.displayName="RowAction";export{P as DataTable,Q as RowAction};
package/dist/index42.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),t=require("./index58.cjs"),r=require("./index41.cjs"),i=require("./index88.cjs"),l=require("./index89.cjs"),o=require("./index90.cjs"),s=require("@adam-milo/icons"),n=a.forwardRef(({items:n,selectedValue:u,onSelectionChange:c,removable:d=!1,onRemove:p,variant:v="primary",disabled:h=!1,maxVisible:m,className:f,"data-testid":g,"data-cy":y,...b},w)=>{const x=(n&&Array.isArray(n)?n:[]).filter(e=>null!=e&&"object"==typeof e),j=a.useRef(null),k=a.useRef([]),C=a.useRef(new Map),E=a.useRef(null),[N,$]=a.useState(!1),[S,D]=a.useState(!1),R=a.useRef([]),{visibleItems:q,hiddenItems:I,hasOverflow:A}=i.useChipOverflow(x,j,k,C,m),P=a.useCallback((e,a,t)=>{if(!h&&!a&&c){c(u===e?null:e,t)}},[h,u,c]),L=a.useCallback((e,a)=>{e.stopPropagation(),h||p&&p(a,e)},[h,p]),M=a.useCallback((e,a,t)=>{h||t||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P(a,t,e))},[h,P]),O=a.useCallback(e=>{e.stopPropagation(),D(e=>!e),$(!1)},[]),B=a.useCallback((e,a)=>{switch(e.key){case"ArrowDown":e.preventDefault(),a<I.length-1&&R.current[a+1]?.focus();break;case"ArrowUp":e.preventDefault(),a>0&&R.current[a-1]?.focus();break;case"Home":e.preventDefault(),R.current[0]?.focus();break;case"End":e.preventDefault(),R.current[I.length-1]?.focus()}},[I.length]),G=a.useRef(null),K=a.useRef(null);return a.useEffect(()=>{G.current=e=>{E.current&&!E.current.contains(e.target)&&D(!1)},K.current=e=>{"Escape"===e.key&&D(!1)}}),a.useEffect(()=>{if(!S)return;const e=e=>G.current?.(e),a=e=>K.current?.(e);return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)}},[S]),a.useEffect(()=>{if("development"===process.env.NODE_ENV&&x.length>0){const e=x.map(e=>e.value),a=new Set(e);e.length!==a.size&&o.devWarn("[ChipGroup] Duplicate values detected in items array. Each item should have a unique value.")}},[x]),a.useEffect(()=>{R.current.length>I.length&&(R.current=R.current.slice(0,I.length))},[I]),n&&Array.isArray(n)?e.jsxs("div",{ref:w,className:t.cn(l.rootStyles,h&&"opacity-40 pointer-events-none",f),role:"group","aria-label":"Chip group","data-testid":g||"chip-group","data-cy":y||"chip-group",...b,children:[A&&e.jsxs("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"chip-group-live-region","data-cy":"chip-group-live-region",children:[I.length," additional ",1===I.length?"chip":"chips"," hidden"]}),e.jsxs("div",{ref:j,className:l.containerStyles,children:[q.map(a=>{const t=u===a.value,i=a.variant||v,o=h||a.disabled||!1,n=x.findIndex(e=>e.value===a.value);return e.jsx("div",{ref:e=>{k.current[n]=e||null},className:l.itemWrapperStyles,"data-cy":`chip-group-item-wrapper-${a.value}`,"data-testid":`chip-group-item-wrapper-${a.value}`,children:e.jsxs("div",{className:l.itemButtonStyles,onClick:e=>P(a.value,o,e),onKeyDown:e=>M(e,a.value,o),tabIndex:o?-1:0,role:"button","aria-pressed":t?"true":"false","aria-disabled":o?"true":"false","data-cy":`chip-group-item-${a.value}`,"data-testid":`chip-group-item-${a.value}`,children:[e.jsx(r.Chip,{variant:i,selected:t,disabled:o,className:!d||h||o?void 0:"pe-6","data-cy":`chip-${a.value}`,"data-testid":`chip-${a.value}`,children:a.label}),d&&!h&&!o&&e.jsx("button",{className:l.removeButtonStyles,onClick:e=>L(e,a.value),"aria-label":`Remove ${a.label}`,"data-cy":`chip-remove-${a.value}`,"data-testid":`chip-remove-${a.value}`,type:"button",children:e.jsx(s.Icon,{name:"Cross2Icon",size:"sm",decorative:!0})})]})},a.value)}),A&&e.jsxs("div",{ref:E,className:l.overflowButtonStyles,role:"button",tabIndex:0,"aria-expanded":S?"true":"false","aria-haspopup":"menu","aria-label":`Show ${I.length} more ${1===I.length?"chip":"chips"}`,onMouseEnter:()=>!S&&$(!0),onMouseLeave:()=>$(!1),onClick:O,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),D(!S),$(!1))},"data-cy":"chip-group-overflow","data-testid":"chip-group-overflow",children:[e.jsxs(r.Chip,{variant:v,className:l.overflowChipClassMap[v],"data-cy":"chip-overflow","data-testid":"chip-overflow",children:["+",I.length]}),N&&!S&&e.jsx("div",{className:"chip-group-tooltip",role:"tooltip","data-cy":"chip-group-tooltip","data-testid":"chip-group-tooltip",children:I.map(a=>e.jsx("div",{className:l.tooltipItemStyles,"data-cy":`chip-group-tooltip-item-${a.value}`,"data-testid":`chip-group-tooltip-item-${a.value}`,children:a.label},a.value))}),S&&e.jsx("div",{className:"chip-group-dropdown",role:"menu","data-cy":"chip-group-dropdown","data-testid":"chip-group-dropdown",children:I.map((a,r)=>e.jsx("div",{ref:e=>{R.current[r]=e||null},className:t.cn("chip-group-dropdown-item",a.disabled&&"chip-group-dropdown-item--disabled"),role:"menuitem",tabIndex:a.disabled?-1:0,"aria-disabled":a.disabled?"true":"false",onClick:e=>{e.stopPropagation(),a.disabled||(P(a.value,!1,e),D(!1))},onKeyDown:e=>{B(e,r),"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),a.disabled||(P(a.value,!1,e),D(!1)))},"data-cy":`chip-group-dropdown-item-${a.value}`,"data-testid":`chip-group-dropdown-item-${a.value}`,children:a.label},a.value))})]})]})]}):null});n.displayName="ChipGroup",exports.ChipGroup=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),r=require("./index67.cjs"),i=require("./index97.cjs"),t=a.forwardRef(({variant:a="primary",selected:t=!1,disabled:s=!1,className:c,children:d,"data-testid":n,"data-cy":l,...o},p)=>{const h=i.chipVariantMap[a],u=r.cn(i.chipBaseStyles,t?h.selected:h.base,!t&&!s&&h.hover,s&&"opacity-40 cursor-not-allowed pointer-events-none",c);return e.jsx("div",{ref:p,className:u,"data-testid":n||`chip-${a}`,"data-cy":l||`chip-${a}`,"aria-selected":t,"aria-disabled":s,"aria-label":"string"==typeof d?d:void 0,...o,children:e.jsx("span",{children:d})})});t.displayName="Chip",exports.Chip=t;
package/dist/index42.js CHANGED
@@ -1,5 +1,2 @@
1
- import{jsxs as e,jsx as a}from"react/jsx-runtime";import{forwardRef as t,useRef as r,useState as i,useCallback as o,useEffect as l}from"react";import{cn as n}from"./index58.js";import{Chip as d}from"./index41.js";import{useChipOverflow as c}from"./index88.js";import{containerStyles as p,itemWrapperStyles as s,itemButtonStyles as u,removeButtonStyles as m,overflowButtonStyles as v,overflowChipClassMap as h,tooltipItemStyles as g,rootStyles as f}from"./index89.js";import{devWarn as y}from"./index90.js";import{Icon as b}from"@adam-milo/icons";const w=t(({items:t,selectedValue:w,onSelectionChange:k,removable:N=!1,onRemove:$,variant:x="primary",disabled:D=!1,maxVisible:E,className:C,"data-testid":j,"data-cy":I,...A},L)=>{const P=(t&&Array.isArray(t)?t:[]).filter(e=>null!=e&&"object"==typeof e),K=r(null),M=r([]),S=r(/* @__PURE__ */new Map),V=r(null),[z,G]=i(!1),[O,R]=i(!1),q=r([]),{visibleItems:H,hiddenItems:U,hasOverflow:_}=c(P,K,M,S,E),B=o((e,a,t)=>{if(!D&&!a&&k){k(w===e?null:e,t)}},[D,w,k]),F=o((e,a)=>{e.stopPropagation(),D||$&&$(a,e)},[D,$]),J=o((e,a,t)=>{D||t||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),B(a,t,e))},[D,B]),Q=o(e=>{e.stopPropagation(),R(e=>!e),G(!1)},[]),T=o((e,a)=>{switch(e.key){case"ArrowDown":e.preventDefault(),a<U.length-1&&q.current[a+1]?.focus();break;case"ArrowUp":e.preventDefault(),a>0&&q.current[a-1]?.focus();break;case"Home":e.preventDefault(),q.current[0]?.focus();break;case"End":e.preventDefault(),q.current[U.length-1]?.focus()}},[U.length]),W=r(null),X=r(null);return l(()=>{W.current=e=>{V.current&&!V.current.contains(e.target)&&R(!1)},X.current=e=>{"Escape"===e.key&&R(!1)}}),l(()=>{if(!O)return;const e=e=>W.current?.(e),a=e=>X.current?.(e);return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)}},[O]),l(()=>{if("development"===process.env.NODE_ENV&&P.length>0){const e=P.map(e=>e.value),a=new Set(e);e.length!==a.size&&y("[ChipGroup] Duplicate values detected in items array. Each item should have a unique value.")}},[P]),l(()=>{q.current.length>U.length&&(q.current=q.current.slice(0,U.length))},[U]),t&&Array.isArray(t)?/* @__PURE__ */e("div",{ref:L,className:n(f,D&&"opacity-40 pointer-events-none",C),role:"group","aria-label":"Chip group","data-testid":j||"chip-group","data-cy":I||"chip-group",...A,children:[_&&/* @__PURE__ */e("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"chip-group-live-region","data-cy":"chip-group-live-region",children:[U.length," additional ",1===U.length?"chip":"chips"," hidden"]}),
2
- /* @__PURE__ */e("div",{ref:K,className:p,children:[H.map(t=>{const r=w===t.value,i=t.variant||x,o=D||t.disabled||!1,l=P.findIndex(e=>e.value===t.value);/* @__PURE__ */
3
- return a("div",{ref:e=>{M.current[l]=e||null},className:s,"data-cy":`chip-group-item-wrapper-${t.value}`,"data-testid":`chip-group-item-wrapper-${t.value}`,children:/* @__PURE__ */e("div",{className:u,onClick:e=>B(t.value,o,e),onKeyDown:e=>J(e,t.value,o),tabIndex:o?-1:0,role:"button","aria-pressed":r?"true":"false","aria-disabled":o?"true":"false","data-cy":`chip-group-item-${t.value}`,"data-testid":`chip-group-item-${t.value}`,children:[
4
- /* @__PURE__ */a(d,{variant:i,selected:r,disabled:o,className:!N||D||o?void 0:"pe-6","data-cy":`chip-${t.value}`,"data-testid":`chip-${t.value}`,children:t.label}),N&&!D&&!o&&/* @__PURE__ */a("button",{className:m,onClick:e=>F(e,t.value),"aria-label":`Remove ${t.label}`,"data-cy":`chip-remove-${t.value}`,"data-testid":`chip-remove-${t.value}`,type:"button",children:/* @__PURE__ */a(b,{name:"Cross2Icon",size:"sm",decorative:!0})})]})},t.value)}),_&&/* @__PURE__ */e("div",{ref:V,className:v,role:"button",tabIndex:0,"aria-expanded":O?"true":"false","aria-haspopup":"menu","aria-label":`Show ${U.length} more ${1===U.length?"chip":"chips"}`,onMouseEnter:()=>!O&&G(!0),onMouseLeave:()=>G(!1),onClick:Q,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),R(!O),G(!1))},"data-cy":"chip-group-overflow","data-testid":"chip-group-overflow",children:[
5
- /* @__PURE__ */e(d,{variant:x,className:h[x],"data-cy":"chip-overflow","data-testid":"chip-overflow",children:["+",U.length]}),z&&!O&&/* @__PURE__ */a("div",{className:"chip-group-tooltip",role:"tooltip","data-cy":"chip-group-tooltip","data-testid":"chip-group-tooltip",children:U.map(e=>/* @__PURE__ */a("div",{className:g,"data-cy":`chip-group-tooltip-item-${e.value}`,"data-testid":`chip-group-tooltip-item-${e.value}`,children:e.label},e.value))}),O&&/* @__PURE__ */a("div",{className:"chip-group-dropdown",role:"menu","data-cy":"chip-group-dropdown","data-testid":"chip-group-dropdown",children:U.map((e,t)=>/* @__PURE__ */a("div",{ref:e=>{q.current[t]=e||null},className:n("chip-group-dropdown-item",e.disabled&&"chip-group-dropdown-item--disabled"),role:"menuitem",tabIndex:e.disabled?-1:0,"aria-disabled":e.disabled?"true":"false",onClick:a=>{a.stopPropagation(),e.disabled||(B(e.value,!1,a),R(!1))},onKeyDown:a=>{T(a,t),"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),a.stopPropagation(),e.disabled||(B(e.value,!1,a),R(!1)))},"data-cy":`chip-group-dropdown-item-${e.value}`,"data-testid":`chip-group-dropdown-item-${e.value}`,children:e.label},e.value))})]})]})]}):null});w.displayName="ChipGroup";export{w as ChipGroup};
1
+ import{jsx as e}from"react/jsx-runtime";import{forwardRef as a}from"react";import{cn as r}from"./index67.js";import{chipVariantMap as t,chipBaseStyles as i}from"./index97.js";const d=a(({variant:a="primary",selected:d=!1,disabled:s=!1,className:o,children:c,"data-testid":n,"data-cy":l,...p},m)=>{const h=t[a],f=r(i,d?h.selected:h.base,!d&&!s&&h.hover,s&&"opacity-40 cursor-not-allowed pointer-events-none",o);/* @__PURE__ */
2
+ return e("div",{ref:m,className:f,"data-testid":n||`chip-${a}`,"data-cy":l||`chip-${a}`,"aria-selected":d,"aria-disabled":s,"aria-label":"string"==typeof c?c:void 0,...p,children:/* @__PURE__ */e("span",{children:c})})});d.displayName="Chip";export{d as Chip};
package/dist/index43.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("./index58.cjs"),r=require("./index91.cjs"),d=t.forwardRef(({selected:t=!1,onSelect:d,className:s,children:c,"data-cy":l,"data-testid":n,onClick:i,...o},u)=>{const y=l||"badge",b=n||"badge",g=()=>{d&&d()};return e.jsx("div",{ref:u,className:a.cn(r.badgeBaseStyles,t?r.badgeSelectedStyles:r.badgeDefaultStyles,s),"data-cy":y,"data-testid":b,"data-selected":t,onClick:e=>{g(),i&&i(e)},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g())},"aria-pressed":t,...o,children:c})});d.displayName="Badge",exports.Badge=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),t=require("./index67.cjs"),r=require("./index42.cjs"),i=require("./index98.cjs"),l=require("./index99.cjs"),o=require("./index100.cjs"),s=require("@adam-milo/icons"),n=a.forwardRef(({items:n,selectedValue:u,onSelectionChange:c,removable:d=!1,onRemove:p,variant:v="primary",disabled:h=!1,maxVisible:m,className:f,"data-testid":g,"data-cy":y,...b},w)=>{const x=(n&&Array.isArray(n)?n:[]).filter(e=>null!=e&&"object"==typeof e),j=a.useRef(null),k=a.useRef([]),C=a.useRef(new Map),E=a.useRef(null),[N,$]=a.useState(!1),[S,D]=a.useState(!1),R=a.useRef([]),{visibleItems:q,hiddenItems:I,hasOverflow:A}=i.useChipOverflow(x,j,k,C,m),P=a.useCallback((e,a,t)=>{if(!h&&!a&&c){c(u===e?null:e,t)}},[h,u,c]),L=a.useCallback((e,a)=>{e.stopPropagation(),h||p&&p(a,e)},[h,p]),M=a.useCallback((e,a,t)=>{h||t||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P(a,t,e))},[h,P]),O=a.useCallback(e=>{e.stopPropagation(),D(e=>!e),$(!1)},[]),B=a.useCallback((e,a)=>{switch(e.key){case"ArrowDown":e.preventDefault(),a<I.length-1&&R.current[a+1]?.focus();break;case"ArrowUp":e.preventDefault(),a>0&&R.current[a-1]?.focus();break;case"Home":e.preventDefault(),R.current[0]?.focus();break;case"End":e.preventDefault(),R.current[I.length-1]?.focus()}},[I.length]),G=a.useRef(null),K=a.useRef(null);return a.useEffect(()=>{G.current=e=>{E.current&&!E.current.contains(e.target)&&D(!1)},K.current=e=>{"Escape"===e.key&&D(!1)}}),a.useEffect(()=>{if(!S)return;const e=e=>G.current?.(e),a=e=>K.current?.(e);return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)}},[S]),a.useEffect(()=>{if("development"===process.env.NODE_ENV&&x.length>0){const e=x.map(e=>e.value),a=new Set(e);e.length!==a.size&&o.devWarn("[ChipGroup] Duplicate values detected in items array. Each item should have a unique value.")}},[x]),a.useEffect(()=>{R.current.length>I.length&&(R.current=R.current.slice(0,I.length))},[I]),n&&Array.isArray(n)?e.jsxs("div",{ref:w,className:t.cn(l.rootStyles,h&&"opacity-40 pointer-events-none",f),role:"group","aria-label":"Chip group","data-testid":g||"chip-group","data-cy":y||"chip-group",...b,children:[A&&e.jsxs("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"chip-group-live-region","data-cy":"chip-group-live-region",children:[I.length," additional ",1===I.length?"chip":"chips"," hidden"]}),e.jsxs("div",{ref:j,className:l.containerStyles,children:[q.map(a=>{const t=u===a.value,i=a.variant||v,o=h||a.disabled||!1,n=x.findIndex(e=>e.value===a.value);return e.jsx("div",{ref:e=>{k.current[n]=e||null},className:l.itemWrapperStyles,"data-cy":`chip-group-item-wrapper-${a.value}`,"data-testid":`chip-group-item-wrapper-${a.value}`,children:e.jsxs("div",{className:l.itemButtonStyles,onClick:e=>P(a.value,o,e),onKeyDown:e=>M(e,a.value,o),tabIndex:o?-1:0,role:"button","aria-pressed":t?"true":"false","aria-disabled":o?"true":"false","data-cy":`chip-group-item-${a.value}`,"data-testid":`chip-group-item-${a.value}`,children:[e.jsx(r.Chip,{variant:i,selected:t,disabled:o,className:!d||h||o?void 0:"pe-6","data-cy":`chip-${a.value}`,"data-testid":`chip-${a.value}`,children:a.label}),d&&!h&&!o&&e.jsx("button",{className:l.removeButtonStyles,onClick:e=>L(e,a.value),"aria-label":`Remove ${a.label}`,"data-cy":`chip-remove-${a.value}`,"data-testid":`chip-remove-${a.value}`,type:"button",children:e.jsx(s.Icon,{name:"Cross2Icon",size:"sm",decorative:!0})})]})},a.value)}),A&&e.jsxs("div",{ref:E,className:l.overflowButtonStyles,role:"button",tabIndex:0,"aria-expanded":S?"true":"false","aria-haspopup":"menu","aria-label":`Show ${I.length} more ${1===I.length?"chip":"chips"}`,onMouseEnter:()=>!S&&$(!0),onMouseLeave:()=>$(!1),onClick:O,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),D(!S),$(!1))},"data-cy":"chip-group-overflow","data-testid":"chip-group-overflow",children:[e.jsxs(r.Chip,{variant:v,className:l.overflowChipClassMap[v],"data-cy":"chip-overflow","data-testid":"chip-overflow",children:["+",I.length]}),N&&!S&&e.jsx("div",{className:"chip-group-tooltip",role:"tooltip","data-cy":"chip-group-tooltip","data-testid":"chip-group-tooltip",children:I.map(a=>e.jsx("div",{className:l.tooltipItemStyles,"data-cy":`chip-group-tooltip-item-${a.value}`,"data-testid":`chip-group-tooltip-item-${a.value}`,children:a.label},a.value))}),S&&e.jsx("div",{className:"chip-group-dropdown",role:"menu","data-cy":"chip-group-dropdown","data-testid":"chip-group-dropdown",children:I.map((a,r)=>e.jsx("div",{ref:e=>{R.current[r]=e||null},className:t.cn("chip-group-dropdown-item",a.disabled&&"chip-group-dropdown-item--disabled"),role:"menuitem",tabIndex:a.disabled?-1:0,"aria-disabled":a.disabled?"true":"false",onClick:e=>{e.stopPropagation(),a.disabled||(P(a.value,!1,e),D(!1))},onKeyDown:e=>{B(e,r),"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),a.disabled||(P(a.value,!1,e),D(!1)))},"data-cy":`chip-group-dropdown-item-${a.value}`,"data-testid":`chip-group-dropdown-item-${a.value}`,children:a.label},a.value))})]})]})]}):null});n.displayName="ChipGroup",exports.ChipGroup=n;
package/dist/index43.js CHANGED
@@ -1,2 +1,5 @@
1
- import{jsx as e}from"react/jsx-runtime";import{forwardRef as t}from"react";import{cn as a}from"./index58.js";import{badgeSelectedStyles as r,badgeDefaultStyles as d,badgeBaseStyles as o}from"./index91.js";const n=t(({selected:t=!1,onSelect:n,className:i,children:s,"data-cy":c,"data-testid":l,onClick:m,...p},f)=>{const y=c||"badge",x=l||"badge",b=()=>{n&&n()};/* @__PURE__ */
2
- return e("div",{ref:f,className:a(o,t?r:d,i),"data-cy":y,"data-testid":x,"data-selected":t,onClick:e=>{b(),m&&m(e)},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b())},"aria-pressed":t,...p,children:s})});n.displayName="Badge";export{n as Badge};
1
+ import{jsxs as e,jsx as a}from"react/jsx-runtime";import{forwardRef as t,useRef as r,useState as i,useCallback as o,useEffect as l}from"react";import{cn as n}from"./index67.js";import{Chip as d}from"./index42.js";import{useChipOverflow as c}from"./index98.js";import{containerStyles as p,itemWrapperStyles as s,itemButtonStyles as u,removeButtonStyles as m,overflowButtonStyles as v,overflowChipClassMap as h,tooltipItemStyles as g,rootStyles as f}from"./index99.js";import{devWarn as y}from"./index100.js";import{Icon as b}from"@adam-milo/icons";const w=t(({items:t,selectedValue:w,onSelectionChange:k,removable:N=!1,onRemove:$,variant:x="primary",disabled:D=!1,maxVisible:E,className:C,"data-testid":j,"data-cy":I,...A},L)=>{const P=(t&&Array.isArray(t)?t:[]).filter(e=>null!=e&&"object"==typeof e),K=r(null),M=r([]),S=r(/* @__PURE__ */new Map),V=r(null),[z,G]=i(!1),[O,R]=i(!1),q=r([]),{visibleItems:H,hiddenItems:U,hasOverflow:_}=c(P,K,M,S,E),B=o((e,a,t)=>{if(!D&&!a&&k){k(w===e?null:e,t)}},[D,w,k]),F=o((e,a)=>{e.stopPropagation(),D||$&&$(a,e)},[D,$]),J=o((e,a,t)=>{D||t||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),B(a,t,e))},[D,B]),Q=o(e=>{e.stopPropagation(),R(e=>!e),G(!1)},[]),T=o((e,a)=>{switch(e.key){case"ArrowDown":e.preventDefault(),a<U.length-1&&q.current[a+1]?.focus();break;case"ArrowUp":e.preventDefault(),a>0&&q.current[a-1]?.focus();break;case"Home":e.preventDefault(),q.current[0]?.focus();break;case"End":e.preventDefault(),q.current[U.length-1]?.focus()}},[U.length]),W=r(null),X=r(null);return l(()=>{W.current=e=>{V.current&&!V.current.contains(e.target)&&R(!1)},X.current=e=>{"Escape"===e.key&&R(!1)}}),l(()=>{if(!O)return;const e=e=>W.current?.(e),a=e=>X.current?.(e);return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)}},[O]),l(()=>{if("development"===process.env.NODE_ENV&&P.length>0){const e=P.map(e=>e.value),a=new Set(e);e.length!==a.size&&y("[ChipGroup] Duplicate values detected in items array. Each item should have a unique value.")}},[P]),l(()=>{q.current.length>U.length&&(q.current=q.current.slice(0,U.length))},[U]),t&&Array.isArray(t)?/* @__PURE__ */e("div",{ref:L,className:n(f,D&&"opacity-40 pointer-events-none",C),role:"group","aria-label":"Chip group","data-testid":j||"chip-group","data-cy":I||"chip-group",...A,children:[_&&/* @__PURE__ */e("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"chip-group-live-region","data-cy":"chip-group-live-region",children:[U.length," additional ",1===U.length?"chip":"chips"," hidden"]}),
2
+ /* @__PURE__ */e("div",{ref:K,className:p,children:[H.map(t=>{const r=w===t.value,i=t.variant||x,o=D||t.disabled||!1,l=P.findIndex(e=>e.value===t.value);/* @__PURE__ */
3
+ return a("div",{ref:e=>{M.current[l]=e||null},className:s,"data-cy":`chip-group-item-wrapper-${t.value}`,"data-testid":`chip-group-item-wrapper-${t.value}`,children:/* @__PURE__ */e("div",{className:u,onClick:e=>B(t.value,o,e),onKeyDown:e=>J(e,t.value,o),tabIndex:o?-1:0,role:"button","aria-pressed":r?"true":"false","aria-disabled":o?"true":"false","data-cy":`chip-group-item-${t.value}`,"data-testid":`chip-group-item-${t.value}`,children:[
4
+ /* @__PURE__ */a(d,{variant:i,selected:r,disabled:o,className:!N||D||o?void 0:"pe-6","data-cy":`chip-${t.value}`,"data-testid":`chip-${t.value}`,children:t.label}),N&&!D&&!o&&/* @__PURE__ */a("button",{className:m,onClick:e=>F(e,t.value),"aria-label":`Remove ${t.label}`,"data-cy":`chip-remove-${t.value}`,"data-testid":`chip-remove-${t.value}`,type:"button",children:/* @__PURE__ */a(b,{name:"Cross2Icon",size:"sm",decorative:!0})})]})},t.value)}),_&&/* @__PURE__ */e("div",{ref:V,className:v,role:"button",tabIndex:0,"aria-expanded":O?"true":"false","aria-haspopup":"menu","aria-label":`Show ${U.length} more ${1===U.length?"chip":"chips"}`,onMouseEnter:()=>!O&&G(!0),onMouseLeave:()=>G(!1),onClick:Q,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),R(!O),G(!1))},"data-cy":"chip-group-overflow","data-testid":"chip-group-overflow",children:[
5
+ /* @__PURE__ */e(d,{variant:x,className:h[x],"data-cy":"chip-overflow","data-testid":"chip-overflow",children:["+",U.length]}),z&&!O&&/* @__PURE__ */a("div",{className:"chip-group-tooltip",role:"tooltip","data-cy":"chip-group-tooltip","data-testid":"chip-group-tooltip",children:U.map(e=>/* @__PURE__ */a("div",{className:g,"data-cy":`chip-group-tooltip-item-${e.value}`,"data-testid":`chip-group-tooltip-item-${e.value}`,children:e.label},e.value))}),O&&/* @__PURE__ */a("div",{className:"chip-group-dropdown",role:"menu","data-cy":"chip-group-dropdown","data-testid":"chip-group-dropdown",children:U.map((e,t)=>/* @__PURE__ */a("div",{ref:e=>{q.current[t]=e||null},className:n("chip-group-dropdown-item",e.disabled&&"chip-group-dropdown-item--disabled"),role:"menuitem",tabIndex:e.disabled?-1:0,"aria-disabled":e.disabled?"true":"false",onClick:a=>{a.stopPropagation(),e.disabled||(B(e.value,!1,a),R(!1))},onKeyDown:a=>{T(a,t),"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),a.stopPropagation(),e.disabled||(B(e.value,!1,a),R(!1)))},"data-cy":`chip-group-dropdown-item-${e.value}`,"data-testid":`chip-group-dropdown-item-${e.value}`,children:e.label},e.value))})]})]})]}):null});w.displayName="ChipGroup";export{w as ChipGroup};
package/dist/index44.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@radix-ui/react-dialog"),o=require("./index58.cjs"),s=require("./index92.cjs"),i=require("@adam-milo/icons");function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const a in e)if("default"!==a){const o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:()=>e[a]})}return t.default=e,Object.freeze(t)}const l=r(a),d=l.Root,n=l.Trigger,c=l.Portal,y=l.Close,g=t.forwardRef(({className:t,"data-cy":a,"data-testid":r,...d},n)=>{const c=a||"dialog-close-button",y=r||"dialog-close-button";return e.jsx(l.Close,{ref:n,className:o.cn(s.closeButtonStyles,t),"data-cy":c,"data-testid":y,"aria-label":"Close dialog",...d,children:e.jsx(i.Icon,{name:"Cross2Icon",size:"sm",decorative:!0})})});g.displayName="DialogCloseButton";const p=({children:t,variant:a="default",className:i,"data-cy":r,"data-testid":l,...d})=>{const n=r||"dialog-icon",c=l||"dialog-icon";return e.jsx("div",{className:o.cn(s.iconRootStyles,s.iconVariantColor[a],i),"data-cy":n,"data-testid":c,"aria-hidden":"true",...d,children:t})};p.displayName="DialogIcon";const f=t.forwardRef(({className:t,variant:a="default","data-cy":i,"data-testid":r,...d},n)=>{const c=i||"dialog-overlay",y=r||"dialog-overlay";return e.jsx(l.Overlay,{ref:n,className:o.cn(s.overlayRootStyles,s.overlayBgStyles[a],t),"data-cy":c,"data-testid":y,...d})});f.displayName=l.Overlay.displayName;const u=t.forwardRef(({className:t,children:a,contentVariant:i="default",overlayVariant:r="default",fullWidthOnMobile:d=!1,topOffsetOnMobile:n=!1,contentPadding:y,disableOutsideClose:g=!1,style:p,"aria-describedby":u,"data-cy":m,"data-testid":x,...N},v)=>{const D=m||"dialog-content",b=x||"dialog-content",j=d||"verify"===i,S="verify"===i||d&&n,O=g?{onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}:{};return e.jsxs(c,{children:[!S&&e.jsx(f,{variant:r}),e.jsx("div",{className:o.cn(s.contentWrapperStyles,j&&s.contentWrapperVerifyMobileStyles,S&&s.contentWrapperTopOffsetMobileStyles),...S&&{"data-dialog-top-offset-mobile":""},children:e.jsx(l.Content,{ref:v,className:o.cn(s.contentStyles,"verify"===i&&s.contentVariantVerifyStyles,S&&s.contentTopOffsetMobileStyles,t),style:y||p?{...p,...y&&{padding:y}}:void 0,"aria-describedby":u??void 0,"data-cy":D,"data-testid":b,"data-content-variant":i,...O,...N,children:a})})]})});u.displayName=l.Content.displayName;const m=({centered:t=!1,className:a,"data-cy":i,"data-testid":r,...l})=>{const d=i||"dialog-header",n=r||"dialog-header";return e.jsx("div",{className:o.cn(s.headerStyles,t&&s.headerCenteredStyles,a),"data-cy":d,"data-testid":n,...l})};m.displayName="DialogHeader";const x=({className:t,"data-cy":a,"data-testid":i,...r})=>{const l=a||"dialog-footer",d=i||"dialog-footer";return e.jsx("div",{className:o.cn(s.footerStyles,t),"data-cy":l,"data-testid":d,...r})};x.displayName="DialogFooter";const N=t.forwardRef(({className:t,"data-cy":a,"data-testid":i,...r},d)=>{const n=a||"dialog-title",c=i||"dialog-title";return e.jsx(l.Title,{ref:d,className:o.cn(s.titleStyles,t),"data-cy":n,"data-testid":c,...r})});N.displayName=l.Title.displayName;const v=t.forwardRef(({className:t,"data-cy":a,"data-testid":i,...r},d)=>{const n=a||"dialog-description",c=i||"dialog-description";return e.jsx(l.Description,{ref:d,className:o.cn(s.descriptionStyles,t),"data-cy":n,"data-testid":c,...r})});v.displayName=l.Description.displayName,exports.Dialog=d,exports.DialogClose=y,exports.DialogCloseButton=g,exports.DialogContent=u,exports.DialogDescription=v,exports.DialogFooter=x,exports.DialogHeader=m,exports.DialogIcon=p,exports.DialogOverlay=f,exports.DialogPortal=c,exports.DialogTitle=N,exports.DialogTrigger=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("./index67.cjs"),r=require("./index101.cjs"),d=t.forwardRef(({selected:t=!1,onSelect:d,className:s,children:c,"data-cy":l,"data-testid":n,onClick:i,...o},u)=>{const y=l||"badge",b=n||"badge",g=()=>{d&&d()};return e.jsx("div",{ref:u,className:a.cn(r.badgeBaseStyles,t?r.badgeSelectedStyles:r.badgeDefaultStyles,s),"data-cy":y,"data-testid":b,"data-selected":t,onClick:e=>{g(),i&&i(e)},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g())},"aria-pressed":t,...o,children:c})});d.displayName="Badge",exports.Badge=d;
package/dist/index44.js CHANGED
@@ -1,10 +1,2 @@
1
- import{jsx as a,jsxs as t}from"react/jsx-runtime";import{forwardRef as e}from"react";import*as d from"@radix-ui/react-dialog";import{cn as i}from"./index58.js";import{closeButtonStyles as s,iconVariantColor as o,iconRootStyles as l,overlayBgStyles as r,overlayRootStyles as c,contentTopOffsetMobileStyles as n,contentVariantVerifyStyles as m,contentStyles as y,contentWrapperTopOffsetMobileStyles as N,contentWrapperVerifyMobileStyles as p,contentWrapperStyles as f,headerCenteredStyles as g,headerStyles as u,footerStyles as v,titleStyles as b,descriptionStyles as h}from"./index92.js";import{Icon as D}from"@adam-milo/icons";const C=d.Root,O=d.Trigger,x=d.Portal,j=d.Close,I=e(({className:t,"data-cy":e,"data-testid":o,...l},r)=>{const c=e||"dialog-close-button",n=o||"dialog-close-button";/* @__PURE__ */
2
- return a(d.Close,{ref:r,className:i(s,t),"data-cy":c,"data-testid":n,"aria-label":"Close dialog",...l,children:/* @__PURE__ */a(D,{name:"Cross2Icon",size:"sm",decorative:!0})})});I.displayName="DialogCloseButton";const P=({children:t,variant:e="default",className:d,"data-cy":s,"data-testid":r,...c})=>{const n=s||"dialog-icon",m=r||"dialog-icon";/* @__PURE__ */
3
- return a("div",{className:i(l,o[e],d),"data-cy":n,"data-testid":m,"aria-hidden":"true",...c,children:t})};P.displayName="DialogIcon";const T=e(({className:t,variant:e="default","data-cy":s,"data-testid":o,...l},n)=>{const m=s||"dialog-overlay",y=o||"dialog-overlay";/* @__PURE__ */
4
- return a(d.Overlay,{ref:n,className:i(c,r[e],t),"data-cy":m,"data-testid":y,...l})});T.displayName=d.Overlay.displayName;const M=e(({className:e,children:s,contentVariant:o="default",overlayVariant:l="default",fullWidthOnMobile:r=!1,topOffsetOnMobile:c=!1,contentPadding:g,disableOutsideClose:u=!1,style:v,"aria-describedby":b,"data-cy":h,"data-testid":D,...C},O)=>{const j=h||"dialog-content",I=D||"dialog-content",P=r||"verify"===o,M="verify"===o||r&&c,V=u?{onPointerDownOutside:a=>a.preventDefault(),onInteractOutside:a=>a.preventDefault()}:{};/* @__PURE__ */
5
- return t(x,{children:[!M&&/* @__PURE__ */a(T,{variant:l}),
6
- /* @__PURE__ */a("div",{className:i(f,P&&p,M&&N),...M&&{"data-dialog-top-offset-mobile":""},children:/* @__PURE__ */a(d.Content,{ref:O,className:i(y,"verify"===o&&m,M&&n,e),style:g||v?{...v,...g&&{padding:g}}:void 0,"aria-describedby":b??void 0,"data-cy":j,"data-testid":I,"data-content-variant":o,...V,...C,children:s})})]})});M.displayName=d.Content.displayName;const V=({centered:t=!1,className:e,"data-cy":d,"data-testid":s,...o})=>{const l=d||"dialog-header",r=s||"dialog-header";/* @__PURE__ */
7
- return a("div",{className:i(u,t&&g,e),"data-cy":l,"data-testid":r,...o})};V.displayName="DialogHeader";const w=({className:t,"data-cy":e,"data-testid":d,...s})=>{const o=e||"dialog-footer",l=d||"dialog-footer";/* @__PURE__ */
8
- return a("div",{className:i(v,t),"data-cy":o,"data-testid":l,...s})};w.displayName="DialogFooter";const z=e(({className:t,"data-cy":e,"data-testid":s,...o},l)=>{const r=e||"dialog-title",c=s||"dialog-title";/* @__PURE__ */
9
- return a(d.Title,{ref:l,className:i(b,t),"data-cy":r,"data-testid":c,...o})});z.displayName=d.Title.displayName;const B=e(({className:t,"data-cy":e,"data-testid":s,...o},l)=>{const r=e||"dialog-description",c=s||"dialog-description";/* @__PURE__ */
10
- return a(d.Description,{ref:l,className:i(h,t),"data-cy":r,"data-testid":c,...o})});B.displayName=d.Description.displayName;export{C as Dialog,j as DialogClose,I as DialogCloseButton,M as DialogContent,B as DialogDescription,w as DialogFooter,V as DialogHeader,P as DialogIcon,T as DialogOverlay,x as DialogPortal,z as DialogTitle,O as DialogTrigger};
1
+ import{jsx as e}from"react/jsx-runtime";import{forwardRef as t}from"react";import{cn as a}from"./index67.js";import{badgeSelectedStyles as r,badgeDefaultStyles as d,badgeBaseStyles as o}from"./index101.js";const n=t(({selected:t=!1,onSelect:n,className:i,children:s,"data-cy":c,"data-testid":l,onClick:m,...p},f)=>{const y=c||"badge",x=l||"badge",b=()=>{n&&n()};/* @__PURE__ */
2
+ return e("div",{ref:f,className:a(o,t?r:d,i),"data-cy":y,"data-testid":x,"data-selected":t,onClick:e=>{b(),m&&m(e)},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b())},"aria-pressed":t,...p,children:s})});n.displayName="Badge";export{n as Badge};
package/dist/index45.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),t=require("@radix-ui/react-dialog"),r=require("./index58.cjs"),s=require("./index93.cjs"),d=require("@adam-milo/icons");function o(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}return a.default=e,Object.freeze(a)}const c=o(t),n=a.forwardRef(({open:a,onOpenChange:t,side:d="right",width:o="28rem",padding:n,className:i,overlay:l=!0,closeOnOverlayClick:y=!0,closeOnEscape:w=!0,children:p,"data-cy":f,"data-testid":u},m)=>{const x=f||`drawer-${d}`,D=u||`drawer-${d}`;return e.jsx(c.Root,{open:a,onOpenChange:t,children:e.jsxs(c.Portal,{children:[l&&e.jsx(c.Overlay,{className:s.overlayStyles,"data-cy":`${x}-overlay`,"data-testid":`${D}-overlay`}),e.jsx(c.Content,{ref:m,className:r.cn(s.panelBaseStyles,s.panelSideStyles[d],i),style:{width:o,...n?{padding:n}:void 0},onEscapeKeyDown:w?void 0:e=>e.preventDefault(),onInteractOutside:y?void 0:e=>e.preventDefault(),"data-cy":x,"data-testid":D,"data-side":d,children:p})]})})});n.displayName="Drawer";const i=a.forwardRef(({className:a,"data-cy":t,"data-testid":o,...n},i)=>{const l=t||"drawer-close-button",y=o||"drawer-close-button";return e.jsx(c.Close,{ref:i,className:r.cn(s.closeButtonStyles,a),"data-cy":l,"data-testid":y,"aria-label":"Close drawer",...n,children:e.jsx(d.Icon,{name:"CustomCloseXIcon",size:"xs",decorative:!0})})});i.displayName="DrawerCloseButton";const l=a.forwardRef(({className:a,"data-cy":t,"data-testid":d,...o},c)=>{const n=t||"drawer-header",i=d||"drawer-header";return e.jsx("header",{ref:c,className:r.cn(s.headerStyles,a),"data-cy":n,"data-testid":i,...o})});l.displayName="DrawerHeader";const y=a.forwardRef(({className:a,"data-cy":t,"data-testid":d,...o},n)=>{const i=t||"drawer-title",l=d||"drawer-title";return e.jsx(c.Title,{ref:n,className:r.cn(s.titleStyles,a),"data-cy":i,"data-testid":l,...o})});y.displayName="DrawerTitle";const w=a.forwardRef(({className:a,"data-cy":t,"data-testid":d,...o},n)=>{const i=t||"drawer-description",l=d||"drawer-description";return e.jsx(c.Description,{ref:n,className:r.cn(s.descriptionStyles,a),"data-cy":i,"data-testid":l,...o})});w.displayName="DrawerDescription";const p=a.forwardRef(({className:a,"data-cy":t,"data-testid":d,...o},c)=>{const n=t||"drawer-body",i=d||"drawer-body";return e.jsx("div",{ref:c,role:"region","aria-label":"Drawer content",className:r.cn(s.bodyStyles,a),"data-cy":n,"data-testid":i,...o})});p.displayName="DrawerBody";const f=a.forwardRef(({className:a,"data-cy":t,"data-testid":d,...o},c)=>{const n=t||"drawer-footer",i=d||"drawer-footer";return e.jsx("footer",{ref:c,className:r.cn(s.footerStyles,a),"data-cy":n,"data-testid":i,...o})});f.displayName="DrawerFooter",exports.Drawer=n,exports.DrawerBody=p,exports.DrawerCloseButton=i,exports.DrawerDescription=w,exports.DrawerFooter=f,exports.DrawerHeader=l,exports.DrawerTitle=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),o=require("@adam-milo/icons"),r=require("./index67.cjs"),a=require("./index102.cjs"),n=["none","asc","desc"],s={none:"Not sorted",asc:"Sorted A to Z",desc:"Sorted Z to A"},i=t.forwardRef(({direction:i,defaultDirection:c="none",onDirectionChange:d,cycle:l=n,onClick:u,disabled:b,className:m,"aria-label":y,"data-testid":f,"data-cy":x,...S},j)=>{const p=void 0!==i,[g,h]=t.useState(c),q=p?i:g,v=f||`sort-button-${q}`,C=x||`sort-button-${q}`,N=t.useCallback(e=>{if(u?.(e),e.defaultPrevented)return;const t=l.length>0?l:n,o=t.indexOf(q),r=t[(o+1)%t.length];p||h(r),r!==q&&d?.(r)},[l,q,p,u,d]),k="desc"===q?"[transform:scaleY(-1)]":void 0;return e.jsx("button",{ref:j,type:"button",disabled:b,className:r.cn(a.baseStyles,a.directionStyles[q],m),onClick:N,"aria-label":y||s[q],"aria-pressed":"none"!==q,"data-direction":q,"data-testid":v,"data-cy":C,...S,children:e.jsx(o.Icon,{name:"CustomDownArrowIcon",size:"xs",color:"inherit",decorative:!0,className:k,"data-cy":`${C}-icon`})})});i.displayName="SortButton",exports.SortButton=i;
package/dist/index45.js CHANGED
@@ -1,9 +1,2 @@
1
- import{jsx as a,jsxs as e}from"react/jsx-runtime";import{forwardRef as t}from"react";import*as r from"@radix-ui/react-dialog";import{cn as d}from"./index58.js";import{overlayStyles as s,panelSideStyles as o,panelBaseStyles as i,closeButtonStyles as c,headerStyles as n,titleStyles as l,descriptionStyles as m,bodyStyles as y,footerStyles as p}from"./index93.js";import{Icon as w}from"@adam-milo/icons";const N=t(({open:t,onOpenChange:c,side:n="right",width:l="28rem",padding:m,className:y,overlay:p=!0,closeOnOverlayClick:w=!0,closeOnEscape:N=!0,children:f,"data-cy":u,"data-testid":h},D)=>{const v=u||`drawer-${n}`,C=h||`drawer-${n}`;/* @__PURE__ */
2
- return a(r.Root,{open:t,onOpenChange:c,children:/* @__PURE__ */e(r.Portal,{children:[p&&/* @__PURE__ */a(r.Overlay,{className:s,"data-cy":`${v}-overlay`,"data-testid":`${C}-overlay`}),
3
- /* @__PURE__ */a(r.Content,{ref:D,className:d(i,o[n],y),style:{width:l,...m?{padding:m}:void 0},onEscapeKeyDown:N?void 0:a=>a.preventDefault(),onInteractOutside:w?void 0:a=>a.preventDefault(),"data-cy":v,"data-testid":C,"data-side":n,children:f})]})})});N.displayName="Drawer";const f=t(({className:e,"data-cy":t,"data-testid":s,...o},i)=>{const n=t||"drawer-close-button",l=s||"drawer-close-button";/* @__PURE__ */
4
- return a(r.Close,{ref:i,className:d(c,e),"data-cy":n,"data-testid":l,"aria-label":"Close drawer",...o,children:/* @__PURE__ */a(w,{name:"CustomCloseXIcon",size:"xs",decorative:!0})})});f.displayName="DrawerCloseButton";const u=t(({className:e,"data-cy":t,"data-testid":r,...s},o)=>{const i=t||"drawer-header",c=r||"drawer-header";/* @__PURE__ */
5
- return a("header",{ref:o,className:d(n,e),"data-cy":i,"data-testid":c,...s})});u.displayName="DrawerHeader";const h=t(({className:e,"data-cy":t,"data-testid":s,...o},i)=>{const c=t||"drawer-title",n=s||"drawer-title";/* @__PURE__ */
6
- return a(r.Title,{ref:i,className:d(l,e),"data-cy":c,"data-testid":n,...o})});h.displayName="DrawerTitle";const D=t(({className:e,"data-cy":t,"data-testid":s,...o},i)=>{const c=t||"drawer-description",n=s||"drawer-description";/* @__PURE__ */
7
- return a(r.Description,{ref:i,className:d(m,e),"data-cy":c,"data-testid":n,...o})});D.displayName="DrawerDescription";const v=t(({className:e,"data-cy":t,"data-testid":r,...s},o)=>{const i=t||"drawer-body",c=r||"drawer-body";/* @__PURE__ */
8
- return a("div",{ref:o,role:"region","aria-label":"Drawer content",className:d(y,e),"data-cy":i,"data-testid":c,...s})});v.displayName="DrawerBody";const C=t(({className:e,"data-cy":t,"data-testid":r,...s},o)=>{const i=t||"drawer-footer",c=r||"drawer-footer";/* @__PURE__ */
9
- return a("footer",{ref:o,className:d(p,e),"data-cy":i,"data-testid":c,...s})});C.displayName="DrawerFooter";export{N as Drawer,v as DrawerBody,f as DrawerCloseButton,D as DrawerDescription,C as DrawerFooter,u as DrawerHeader,h as DrawerTitle};
1
+ import{jsx as t}from"react/jsx-runtime";import{forwardRef as e,useState as o,useCallback as a}from"react";import{Icon as r}from"@adam-milo/icons";import{cn as n}from"./index67.js";import{directionStyles as i,baseStyles as d}from"./index102.js";const s=["none","asc","desc"],c={none:"Not sorted",asc:"Sorted A to Z",desc:"Sorted Z to A"},l=e(({direction:e,defaultDirection:l="none",onDirectionChange:m,cycle:f=s,onClick:u,disabled:p,className:b,"aria-label":x,"data-testid":y,"data-cy":h,...N},v)=>{const C=void 0!==e,[g,j]=o(l),A=C?e:g,D=y||`sort-button-${A}`,S=h||`sort-button-${A}`,$=a(t=>{if(u?.(t),t.defaultPrevented)return;const e=f.length>0?f:s,o=e.indexOf(A),a=e[(o+1)%e.length];C||j(a),a!==A&&m?.(a)},[f,A,C,u,m]),k="desc"===A?"[transform:scaleY(-1)]":void 0;/* @__PURE__ */
2
+ return t("button",{ref:v,type:"button",disabled:p,className:n(d,i[A],b),onClick:$,"aria-label":x||c[A],"aria-pressed":"none"!==A,"data-direction":A,"data-testid":D,"data-cy":S,...N,children:/* @__PURE__ */t(r,{name:"CustomDownArrowIcon",size:"xs",color:"inherit",decorative:!0,className:k,"data-cy":`${S}-icon`})})});l.displayName="SortButton";export{l as SortButton};
package/dist/index46.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),i=require("./index58.cjs"),t=require("./index94.cjs"),n=require("./index61.cjs"),a=s.forwardRef(({direction:a,spacing:o,align:d,justify:l,wrap:g=!1,m:p,mt:r,mb:m,ms:v,me:c,mx:R,my:S,p:C,pt:h,pb:y,ps:u,pe:x,px:k,py:b,width:j,minWidth:f,maxWidth:w,height:B,minHeight:M,maxHeight:E,className:I,style:P,children:z,"data-cy":H,"data-testid":W,...q},O)=>{const N=n.getResponsiveBase(a)??"vertical",T=H||`stack-${N}`,$=W||`stack-${N}`,A=s.useMemo(()=>n.getResponsiveClasses(a,t.directionStyles),[a]),D=s.useMemo(()=>n.getResponsiveClasses(o,t.spacingStyles),[o]),F=s.useMemo(()=>n.getResponsiveClasses(d,t.alignStyles),[d]),G=s.useMemo(()=>n.getResponsiveClasses(l,t.justifyStyles),[l]),J=s.useMemo(()=>{const e=t.marginStyles;return[...n.getResponsiveClasses(p,e.m),...n.getResponsiveClasses(r,e.mt),...n.getResponsiveClasses(m,e.mb),...n.getResponsiveClasses(v,e.ms),...n.getResponsiveClasses(c,e.me),...n.getResponsiveClasses(R,e.ms),...n.getResponsiveClasses(R,e.me),...n.getResponsiveClasses(S,e.mt),...n.getResponsiveClasses(S,e.mb)]},[p,r,m,v,c,R,S]),K=s.useMemo(()=>{const e=t.paddingStyles;return[...n.getResponsiveClasses(C,e.p),...n.getResponsiveClasses(h,e.pt),...n.getResponsiveClasses(y,e.pb),...n.getResponsiveClasses(u,e.ps),...n.getResponsiveClasses(x,e.pe),...n.getResponsiveClasses(k,e.ps),...n.getResponsiveClasses(k,e.pe),...n.getResponsiveClasses(b,e.pt),...n.getResponsiveClasses(b,e.pb)]},[C,h,y,u,x,k,b]),L=s.useMemo(()=>{const e=t.widthPresetStyles,s=t.minWidthPresetStyles,i=t.maxWidthPresetStyles,a=t.heightPresetStyles,o=t.minHeightPresetStyles,d=t.maxHeightPresetStyles;return[...n.getResponsiveSizeClasses(j,e,"w-"),...n.getResponsiveSizeClasses(f,s,"min-w-"),...n.getResponsiveSizeClasses(w,i,"max-w-"),...n.getResponsiveSizeClasses(B,a,"h-"),...n.getResponsiveSizeClasses(M,o,"min-h-"),...n.getResponsiveSizeClasses(E,d,"max-h-")]},[j,f,w,B,M,E]),Q=s.useMemo(()=>{const e=e=>"string"==typeof e&&!t.isSpacingToken(e)&&!n.isResponsiveObject(e),s={};void 0!==p&&e(p)&&(s.margin=p),void 0!==r&&e(r)&&(s.marginBlockStart=r),void 0!==m&&e(m)&&(s.marginBlockEnd=m),void 0!==v&&e(v)&&(s.marginInlineStart=v),void 0!==c&&e(c)&&(s.marginInlineEnd=c),void 0!==R&&e(R)&&(s.marginInlineStart=R,s.marginInlineEnd=R),void 0!==S&&e(S)&&(s.marginBlockStart=S,s.marginBlockEnd=S),void 0!==C&&e(C)&&(s.padding=C),void 0!==h&&e(h)&&(s.paddingBlockStart=h),void 0!==y&&e(y)&&(s.paddingBlockEnd=y),void 0!==u&&e(u)&&(s.paddingInlineStart=u),void 0!==x&&e(x)&&(s.paddingInlineEnd=x),void 0!==k&&e(k)&&(s.paddingInlineStart=k,s.paddingInlineEnd=k),void 0!==b&&e(b)&&(s.paddingBlockStart=b,s.paddingBlockEnd=b);const i=e=>"string"==typeof e&&!t.isSizePreset(e)&&!n.isResponsiveObject(e);return void 0!==j&&i(j)&&(s.width=j),void 0!==f&&i(f)&&(s.minWidth=f),void 0!==w&&i(w)&&(s.maxWidth=w),void 0!==B&&i(B)&&(s.height=B),void 0!==M&&i(M)&&(s.minHeight=M),void 0!==E&&i(E)&&(s.maxHeight=E),Object.keys(s).length?s:void 0},[p,r,m,v,c,R,S,C,h,y,u,x,k,b,j,f,w,B,M,E]),U=a??o??d??l??g?"flex min-w-0":void 0;return e.jsx("div",{ref:O,className:i.cn(U,A,D,F,G,g&&"flex-wrap",J,K,L,I),style:Q?{...Q,...P}:P,"data-cy":T,"data-testid":$,...q,children:z})});a.displayName="Stack",exports.Stack=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@adam-milo/icons"),i=require("./index67.cjs"),r=require("./index103.cjs"),s=t.forwardRef(({active:t=!1,className:s,disabled:d,"aria-label":o,"aria-pressed":c,"data-testid":l,"data-cy":n,type:u="button",...b},y)=>{const m=l||(t?"filter-button-active":"filter-button"),p=n||(t?"filter-button-active":"filter-button");return e.jsxs("button",{ref:y,type:u,disabled:d,className:i.cn(r.baseStyles,t&&r.activeStyles,s),"aria-label":o||"Filter","aria-pressed":c??t,"data-active":t,"data-testid":m,"data-cy":p,...b,children:[e.jsx(a.Icon,{name:"CustomFilterIcon",size:"xs",color:"inherit",decorative:!0,"data-cy":`${p}-icon`}),t&&e.jsx("span",{className:r.dotStyles,"aria-hidden":"true","data-cy":`${p}-dot`,"data-testid":`${m}-dot`})]})});s.displayName="FilterButton",exports.FilterButton=s;
package/dist/index46.js CHANGED
@@ -1,2 +1,3 @@
1
- import{jsx as i}from"react/jsx-runtime";import{forwardRef as t,useMemo as n}from"react";import{cn as d}from"./index58.js";import{isSpacingToken as a,isSizePreset as m,directionStyles as e,spacingStyles as o,alignStyles as r,justifyStyles as p,marginStyles as s,paddingStyles as c,widthPresetStyles as g,minWidthPresetStyles as l,maxWidthPresetStyles as v,heightPresetStyles as h,minHeightPresetStyles as x,maxHeightPresetStyles as k}from"./index94.js";import{getResponsiveBase as f,getResponsiveClasses as y,getResponsiveSizeClasses as S,isResponsiveObject as w}from"./index61.js";const B=t(({direction:t,spacing:B,align:E,justify:I,wrap:b=!1,m:u,mt:j,mb:H,ms:W,me:N,mx:$,my:O,p:q,pt:z,pb:A,ps:C,pe:D,px:F,py:G,width:J,minWidth:K,maxWidth:L,height:M,minHeight:P,maxHeight:Q,className:R,style:T,children:U,"data-cy":V,"data-testid":X,...Y},Z)=>{const _=f(t)??"vertical",ii=V||`stack-${_}`,ti=X||`stack-${_}`,ni=n(()=>y(t,e),[t]),di=n(()=>y(B,o),[B]),ai=n(()=>y(E,r),[E]),mi=n(()=>y(I,p),[I]),ei=n(()=>{const i=s;return[...y(u,i.m),...y(j,i.mt),...y(H,i.mb),...y(W,i.ms),...y(N,i.me),...y($,i.ms),...y($,i.me),...y(O,i.mt),...y(O,i.mb)]},[u,j,H,W,N,$,O]),oi=n(()=>{const i=c;return[...y(q,i.p),...y(z,i.pt),...y(A,i.pb),...y(C,i.ps),...y(D,i.pe),...y(F,i.ps),...y(F,i.pe),...y(G,i.pt),...y(G,i.pb)]},[q,z,A,C,D,F,G]),ri=n(()=>{const i=l,t=v,n=h,d=x,a=k;return[...S(J,g,"w-"),...S(K,i,"min-w-"),...S(L,t,"max-w-"),...S(M,n,"h-"),...S(P,d,"min-h-"),...S(Q,a,"max-h-")]},[J,K,L,M,P,Q]),pi=n(()=>{const i=i=>"string"==typeof i&&!a(i)&&!w(i),t={};void 0!==u&&i(u)&&(t.margin=u),void 0!==j&&i(j)&&(t.marginBlockStart=j),void 0!==H&&i(H)&&(t.marginBlockEnd=H),void 0!==W&&i(W)&&(t.marginInlineStart=W),void 0!==N&&i(N)&&(t.marginInlineEnd=N),void 0!==$&&i($)&&(t.marginInlineStart=$,t.marginInlineEnd=$),void 0!==O&&i(O)&&(t.marginBlockStart=O,t.marginBlockEnd=O),void 0!==q&&i(q)&&(t.padding=q),void 0!==z&&i(z)&&(t.paddingBlockStart=z),void 0!==A&&i(A)&&(t.paddingBlockEnd=A),void 0!==C&&i(C)&&(t.paddingInlineStart=C),void 0!==D&&i(D)&&(t.paddingInlineEnd=D),void 0!==F&&i(F)&&(t.paddingInlineStart=F,t.paddingInlineEnd=F),void 0!==G&&i(G)&&(t.paddingBlockStart=G,t.paddingBlockEnd=G);const n=i=>"string"==typeof i&&!m(i)&&!w(i);return void 0!==J&&n(J)&&(t.width=J),void 0!==K&&n(K)&&(t.minWidth=K),void 0!==L&&n(L)&&(t.maxWidth=L),void 0!==M&&n(M)&&(t.height=M),void 0!==P&&n(P)&&(t.minHeight=P),void 0!==Q&&n(Q)&&(t.maxHeight=Q),Object.keys(t).length?t:void 0},[u,j,H,W,N,$,O,q,z,A,C,D,F,G,J,K,L,M,P,Q]);/* @__PURE__ */
2
- return i("div",{ref:Z,className:d(t??B??E??I??b?"flex min-w-0":void 0,ni,di,ai,mi,b&&"flex-wrap",ei,oi,ri,R),style:pi?{...pi,...T}:T,"data-cy":ii,"data-testid":ti,...Y,children:U})});B.displayName="Stack";export{B as Stack};
1
+ import{jsxs as t,jsx as a}from"react/jsx-runtime";import{forwardRef as e}from"react";import{Icon as i}from"@adam-milo/icons";import{cn as r}from"./index67.js";import{dotStyles as o,activeStyles as d,baseStyles as s}from"./index103.js";const c=e(({active:e=!1,className:c,disabled:n,"aria-label":l,"aria-pressed":m,"data-testid":p,"data-cy":u,type:b="button",...f},y)=>{const v=p||(e?"filter-button-active":"filter-button"),x=u||(e?"filter-button-active":"filter-button");/* @__PURE__ */
2
+ return t("button",{ref:y,type:b,disabled:n,className:r(s,e&&d,c),"aria-label":l||"Filter","aria-pressed":m??e,"data-active":e,"data-testid":v,"data-cy":x,...f,children:[
3
+ /* @__PURE__ */a(i,{name:"CustomFilterIcon",size:"xs",color:"inherit",decorative:!0,"data-cy":`${x}-icon`}),e&&/* @__PURE__ */a("span",{className:o,"aria-hidden":"true","data-cy":`${x}-dot`,"data-testid":`${v}-dot`})]})});c.displayName="FilterButton";export{c as FilterButton};
package/dist/index47.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),r=require("./index58.cjs"),t=require("./index95.cjs"),s=require("./index61.cjs"),i=a.forwardRef(({className:i,center:n=!0,maxWidth:d="lg",padding:c="md","data-cy":o,"data-testid":u,children:l,...m},x)=>{const p=o||"container",g=u||"container",j=a.useMemo(()=>s.getResponsiveClasses(d,t.maxWidthMap),[d]),f=a.useMemo(()=>s.getResponsiveClasses(c,t.paddingMap),[c]);return e.jsx("div",{ref:x,className:r.cn("w-full box-border",n&&"mx-auto",...j,...f,i),"data-cy":p,"data-testid":g,"data-center":n,...m,children:l})});i.displayName="Container",exports.Container=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("@adam-milo/icons"),a=require("./index67.cjs"),i=require("./index53.cjs"),s=require("./index3.cjs"),l=require("./index46.cjs"),n=require("./index104.cjs"),o=t.createContext(null);function d(){const e=t.useContext(o);if(!e)throw new Error("useFilter() must be used inside a <Filter> component.");return e}const c=t.forwardRef(({asChild:r,active:a,children:s,...n},o)=>{const{isActive:c}=d();return r&&t.isValidElement(s)?e.jsx(i.PopoverTrigger,{asChild:!0,ref:o,...n,children:s}):e.jsx(i.PopoverTrigger,{asChild:!0,ref:o,children:e.jsx(l.FilterButton,{active:a??c,...n})})});c.displayName="FilterTrigger";const u=t.forwardRef(({className:t,children:r,"data-cy":s,"data-testid":l,...o},d)=>e.jsx(i.PopoverContent,{ref:d,className:a.cn(n.contentStyles,t),"data-cy":s||"filter-content","data-testid":l||"filter-content",...o,children:r}));u.displayName="FilterContent";const f=t.forwardRef(({className:t,"data-cy":r,"data-testid":i,...s},l)=>e.jsx("div",{ref:l,className:a.cn(n.titleStyles,t),"data-cy":r||"filter-title","data-testid":i||"filter-title",...s}));f.displayName="FilterTitle";const p=t.forwardRef(({className:t,"data-cy":r,"data-testid":i,...s},l)=>e.jsx("div",{ref:l,className:a.cn(n.bodyStyles,t),"data-cy":r||"filter-body","data-testid":i||"filter-body",...s}));p.displayName="FilterBody";const y=t.forwardRef(({className:t,"data-cy":r,"data-testid":i,...s},l)=>e.jsx("div",{ref:l,className:a.cn(n.footerStyles,t),"data-cy":r||"filter-footer","data-testid":i||"filter-footer",...s}));y.displayName="FilterFooter";const m=t.forwardRef(({children:t="Apply",onClick:r,disabledWhenUnchanged:a=!0,disabled:i,...l},n)=>{const{apply:o,draftValue:c,committedValue:u,areEqual:f}=d(),p=a&&f(c,u);return e.jsx(s.Button,{ref:n,type:"button",variant:"main-orange",disabled:i||p,onClick:e=>{r?.(e),e.defaultPrevented||o()},"data-cy":"filter-apply","data-testid":"filter-apply",...l,children:t})});m.displayName="FilterApply";const x=t.forwardRef(({children:t,onClick:i,autoHide:l=!0,"aria-label":o,className:c,...u},f)=>{const{reset:p,isActive:y}=d();if(l&&!y)return null;const m=e=>{i?.(e),e.defaultPrevented||p()};return t?e.jsx(s.Button,{ref:f,type:"button",variant:"link",onClick:m,className:c,"data-cy":"filter-reset","data-testid":"filter-reset",...u,children:t}):e.jsx("button",{ref:f,type:"button",onClick:m,"aria-label":o||"Reset filter",className:a.cn(n.resetButtonStyles,c),"data-cy":"filter-reset","data-testid":"filter-reset",...u,children:e.jsx(r.Icon,{name:"CustomResetIcon",size:"md",color:"system-text",decorative:!0})})});x.displayName="FilterReset",exports.Filter=function({value:r,defaultValue:a,emptyValue:s,onApply:l,open:n,defaultOpen:d=!1,onOpenChange:c,isActive:u,compareValues:f,normalizeValue:p,children:y}){const m=void 0!==r,[x,v]=t.useState(a??s),h=m?r:x,C=void 0!==n,[F,b]=t.useState(d),j=C?n:F,[N,g]=t.useState(h);t.useEffect(()=>{j&&g(h)},[j,h]);const S=t.useCallback(e=>{C||b(e),c?.(e)},[C,c]),k=t.useCallback(()=>{const e=p?p(N):N;m||v(e),l?.(e),S(!1)},[N,m,p,l,S]),R=t.useCallback(()=>{m||v(s),g(s),l?.(s),S(!1)},[s,m,l,S]),V=t.useCallback(()=>{S(!1)},[S]),q=t.useCallback((e,t)=>f?f(e,t):((e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}})(e,t),[f]),w=t.useMemo(()=>u?u(h):!q(h,s),[h,s,u,q]),A=t.useMemo(()=>({draftValue:N,setDraftValue:g,committedValue:h,emptyValue:s,isActive:w,open:j,setOpen:S,apply:k,reset:R,cancel:V,areEqual:q}),[N,h,s,w,j,S,k,R,V,q]);return e.jsx(o.Provider,{value:A,children:e.jsx(i.Popover,{open:j,onOpenChange:S,children:y})})},exports.FilterApply=m,exports.FilterBody=p,exports.FilterContent=u,exports.FilterFooter=y,exports.FilterReset=x,exports.FilterTitle=f,exports.FilterTrigger=c,exports.useFilter=d;
package/dist/index47.js CHANGED
@@ -1,2 +1,3 @@
1
- import{jsx as t}from"react/jsx-runtime";import{forwardRef as r,useMemo as a}from"react";import{cn as e}from"./index58.js";import{maxWidthMap as i,paddingMap as d}from"./index95.js";import{getResponsiveClasses as o}from"./index61.js";const n=r(({className:r,center:n=!0,maxWidth:m="lg",padding:c="md","data-cy":s,"data-testid":l,children:p,...x},f)=>{const j=s||"container",u=l||"container",h=a(()=>o(m,i),[m]),y=a(()=>o(c,d),[c]);/* @__PURE__ */
2
- return t("div",{ref:f,className:e("w-full box-border",n&&"mx-auto",...h,...y,r),"data-cy":j,"data-testid":u,"data-center":n,...x,children:p})});n.displayName="Container";export{n as Container};
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as t,useEffect as a,useCallback as i,useMemo as r,forwardRef as l,isValidElement as n,useContext as s,createContext as d}from"react";import{Icon as o}from"@adam-milo/icons";import{cn as c}from"./index67.js";import{Popover as m,PopoverContent as f,PopoverTrigger as p}from"./index53.js";import{Button as u}from"./index3.js";import{FilterButton as y}from"./index46.js";import{contentStyles as h,titleStyles as N,bodyStyles as v,footerStyles as b,resetButtonStyles as C}from"./index104.js";const F=d(null);function V(){const e=s(F);if(!e)throw new Error("useFilter() must be used inside a <Filter> component.");return e}function g({value:l,defaultValue:n,emptyValue:s,onApply:d,open:o,defaultOpen:c=!1,onOpenChange:f,isActive:p,compareValues:u,normalizeValue:y,children:h}){const N=void 0!==l,[v,b]=t(n??s),C=N?l:v,V=void 0!==o,[g,x]=t(c),A=V?o:g,[j,k]=t(C);a(()=>{A&&k(C)},[A,C]);const O=i(e=>{V||x(e),f?.(e)},[V,f]),E=i(()=>{const e=y?y(j):j;N||b(e),d?.(e),O(!1)},[j,N,y,d,O]),P=i(()=>{N||b(s),k(s),d?.(s),O(!1)},[s,N,d,O]),R=i(()=>{O(!1)},[O]),q=i((e,t)=>u?u(e,t):((e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}})(e,t),[u]),w=r(()=>p?p(C):!q(C,s),[C,s,p,q]),z=r(()=>({draftValue:j,setDraftValue:k,committedValue:C,emptyValue:s,isActive:w,open:A,setOpen:O,apply:E,reset:P,cancel:R,areEqual:q}),[j,C,s,w,A,O,E,P,R,q]);/* @__PURE__ */
2
+ return e(F.Provider,{value:z,children:/* @__PURE__ */e(m,{open:A,onOpenChange:O,children:h})})}const x=l(({asChild:t,active:a,children:i,...r},l)=>{const{isActive:s}=V();return t&&n(i)?/* @__PURE__ */e(p,{asChild:!0,ref:l,...r,children:i}):/* @__PURE__ */e(p,{asChild:!0,ref:l,children:/* @__PURE__ */e(y,{active:a??s,...r})})});x.displayName="FilterTrigger";const A=l(({className:t,children:a,"data-cy":i,"data-testid":r,...l},n)=>/* @__PURE__ */e(f,{ref:n,className:c(h,t),"data-cy":i||"filter-content","data-testid":r||"filter-content",...l,children:a}));A.displayName="FilterContent";const j=l(({className:t,"data-cy":a,"data-testid":i,...r},l)=>/* @__PURE__ */e("div",{ref:l,className:c(N,t),"data-cy":a||"filter-title","data-testid":i||"filter-title",...r}));j.displayName="FilterTitle";const k=l(({className:t,"data-cy":a,"data-testid":i,...r},l)=>/* @__PURE__ */e("div",{ref:l,className:c(v,t),"data-cy":a||"filter-body","data-testid":i||"filter-body",...r}));k.displayName="FilterBody";const O=l(({className:t,"data-cy":a,"data-testid":i,...r},l)=>/* @__PURE__ */e("div",{ref:l,className:c(b,t),"data-cy":a||"filter-footer","data-testid":i||"filter-footer",...r}));O.displayName="FilterFooter";const E=l(({children:t="Apply",onClick:a,disabledWhenUnchanged:i=!0,disabled:r,...l},n)=>{const{apply:s,draftValue:d,committedValue:o,areEqual:c}=V(),m=i&&c(d,o);/* @__PURE__ */
3
+ return e(u,{ref:n,type:"button",variant:"main-orange",disabled:r||m,onClick:e=>{a?.(e),e.defaultPrevented||s()},"data-cy":"filter-apply","data-testid":"filter-apply",...l,children:t})});E.displayName="FilterApply";const P=l(({children:t,onClick:a,autoHide:i=!0,"aria-label":r,className:l,...n},s)=>{const{reset:d,isActive:m}=V();if(i&&!m)return null;const f=e=>{a?.(e),e.defaultPrevented||d()};return t?/* @__PURE__ */e(u,{ref:s,type:"button",variant:"link",onClick:f,className:l,"data-cy":"filter-reset","data-testid":"filter-reset",...n,children:t}):/* @__PURE__ */e("button",{ref:s,type:"button",onClick:f,"aria-label":r||"Reset filter",className:c(C,l),"data-cy":"filter-reset","data-testid":"filter-reset",...n,children:/* @__PURE__ */e(o,{name:"CustomResetIcon",size:"md",color:"system-text",decorative:!0})})});P.displayName="FilterReset";export{g as Filter,E as FilterApply,k as FilterBody,A as FilterContent,O as FilterFooter,P as FilterReset,j as FilterTitle,x as FilterTrigger,V as useFilter};
package/dist/index48.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("@radix-ui/react-separator"),i=require("./index58.cjs"),a=require("./index96.cjs"),o=require("./index61.cjs");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const s=n(r),c=t.forwardRef(({orientation:r="horizontal",decorative:n=!0,spacing:c="0",color:d,className:l,style:u,"data-cy":p,"data-testid":f,...g},y)=>{const b=p||`divider-${r}`,j=f||`divider-${r}`,v=t.useMemo(()=>{const e="horizontal"===r?a.spacingHorizontalMap:a.spacingVerticalMap;return o.getResponsiveClasses(c,e)},[c,r]);return e.jsx(s.Root,{ref:y,decorative:n,orientation:r,className:i.cn(a.baseStyles,a.orientationStyles[r],...v,l),style:{...d&&{backgroundColor:d},...u},"data-cy":b,"data-testid":j,...g})});c.displayName="Divider",exports.Divider=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@adam-milo/icons"),i=require("./index67.cjs"),l=require("./index12.cjs"),r=require("./index13.cjs"),s=require("./index74.cjs"),n=require("./index47.cjs"),d=require("./index105.cjs"),o=[];function c({options:i,mode:l,cyPrefix:r,testIdPrefix:o,searchable:c,searchPlaceholder:h,radioGroupName:x}){const[y,f]=t.useState(""),j=t.useMemo(()=>{if(!c||!y.trim())return i;const e=y.trim().toLowerCase();return i.filter(t=>t.label.toLowerCase().includes(e))},[i,c,y]);return e.jsxs(e.Fragment,{children:[c&&e.jsx(s.Input,{type:"text",placeholder:h||"Search",leftIcon:e.jsx(a.Icon,{name:"MagnifyingGlassIcon",size:"sm",color:"icon-secondary"}),value:y,onChange:e=>f(e.currentTarget.value),"aria-label":h||"Search options","data-cy":`${r}-search`,"data-testid":`${o}-search`}),e.jsx(n.FilterBody,{"data-cy":`${r}-body`,"data-testid":`${o}-body`,children:e.jsx("div",{className:d.listStyles,children:0===j.length?e.jsx("span",{className:d.emptyStateStyles,"data-cy":`${r}-empty`,"data-testid":`${o}-empty`,children:"No matches"}):"single"===l?e.jsx(p,{options:j,cyPrefix:r,testIdPrefix:o,radioGroupName:x}):e.jsx(u,{options:j,cyPrefix:r,testIdPrefix:o})})})]})}function u({options:t,cyPrefix:a,testIdPrefix:r}){const{draftValue:s,setDraftValue:o}=n.useFilter(),c=Array.isArray(s)?s:[];return e.jsx(e.Fragment,{children:t.map(t=>{const s=`${r}-option-${t.value}-input`;return e.jsxs("label",{htmlFor:s,className:i.cn(d.optionRowStyles,t.disabled&&d.optionRowDisabledStyles),"data-cy":`${a}-row-${t.value}`,"data-testid":`${r}-row-${t.value}`,children:[e.jsx(l.Checkbox,{id:s,checked:c.includes(t.value),disabled:t.disabled,onChange:e=>{return a=t.value,void(e.currentTarget.checked?c.includes(a)||o([...c,a]):o(c.filter(e=>e!==a)));var a},"data-cy":`${a}-option-${t.value}`,"data-testid":`${r}-option-${t.value}`}),e.jsx("span",{className:d.optionLabelStyles,children:t.label})]},t.value)})})}function p({options:t,cyPrefix:a,testIdPrefix:l,radioGroupName:s}){const{draftValue:o,setDraftValue:c}=n.useFilter();return e.jsx(e.Fragment,{children:t.map(t=>{const n=`${l}-option-${t.value}-input`;return e.jsxs("label",{htmlFor:n,className:i.cn(d.optionRowStyles,t.disabled&&d.optionRowDisabledStyles),"data-cy":`${a}-row-${t.value}`,"data-testid":`${l}-row-${t.value}`,children:[e.jsx(r.Radio,{id:n,name:s,value:t.value,checked:o===t.value,disabled:t.disabled,onChange:()=>c(t.value),"data-cy":`${a}-option-${t.value}`,"data-testid":`${l}-option-${t.value}`}),e.jsx("span",{className:d.optionLabelStyles,children:t.label})]},t.value)})})}function h(t){const{options:a,value:i,defaultValue:l,onApply:r,title:s,searchable:d=!1,searchPlaceholder:u,open:p,defaultOpen:h,onOpenChange:x,disabled:y,hideReset:f=!1,"aria-label":j,"data-cy":m,"data-testid":$}=t,b=m||"check-filter",v=$||"check-filter";return e.jsxs(n.Filter,{emptyValue:o,value:i,defaultValue:l,onApply:r,open:p,defaultOpen:h,onOpenChange:x,isActive:e=>Array.isArray(e)&&e.length>0,children:[e.jsx(n.FilterTrigger,{"aria-label":j||"Filter",disabled:y,"data-cy":b,"data-testid":v}),e.jsxs(n.FilterContent,{"data-cy":`${b}-content`,"data-testid":`${v}-content`,children:[void 0!==s&&e.jsx(n.FilterTitle,{"data-cy":`${b}-title`,"data-testid":`${v}-title`,children:s}),e.jsx(c,{options:a,mode:"multi",cyPrefix:b,testIdPrefix:v,searchable:d,searchPlaceholder:u,radioGroupName:""}),e.jsxs(n.FilterFooter,{"data-cy":`${b}-footer`,"data-testid":`${v}-footer`,children:[!f&&e.jsx(n.FilterReset,{}),e.jsx(n.FilterApply,{})]})]})]})}function x(a){const{options:i,value:l,defaultValue:r,onApply:s,title:d,searchable:o=!1,searchPlaceholder:u,open:p,defaultOpen:h,onOpenChange:x,disabled:y,hideReset:f=!1,"aria-label":j,"data-cy":m,"data-testid":$}=a,b=m||"check-filter",v=$||"check-filter",F=t.useId();return e.jsxs(n.Filter,{emptyValue:null,value:l,defaultValue:r,onApply:s,open:p,defaultOpen:h,onOpenChange:x,isActive:e=>null!==e,children:[e.jsx(n.FilterTrigger,{"aria-label":j||"Filter",disabled:y,"data-cy":b,"data-testid":v}),e.jsxs(n.FilterContent,{"data-cy":`${b}-content`,"data-testid":`${v}-content`,children:[void 0!==d&&e.jsx(n.FilterTitle,{"data-cy":`${b}-title`,"data-testid":`${v}-title`,children:d}),e.jsx(c,{options:i,mode:"single",cyPrefix:b,testIdPrefix:v,searchable:o,searchPlaceholder:u,radioGroupName:F}),e.jsxs(n.FilterFooter,{"data-cy":`${b}-footer`,"data-testid":`${v}-footer`,children:[!f&&e.jsx(n.FilterReset,{}),e.jsx(n.FilterApply,{})]})]})]})}function y(t){return"single"===t.mode?e.jsx(x,{...t}):e.jsx(h,{...t})}y.displayName="CheckFilter",exports.CheckFilter=y;
package/dist/index48.js CHANGED
@@ -1,2 +1,24 @@
1
- import{jsx as r}from"react/jsx-runtime";import{forwardRef as t,useMemo as o}from"react";import*as i from"@radix-ui/react-separator";import{cn as a}from"./index58.js";import{orientationStyles as e,baseStyles as d,spacingHorizontalMap as s,spacingVerticalMap as m}from"./index96.js";import{getResponsiveClasses as n}from"./index61.js";const c=t(({orientation:t="horizontal",decorative:c=!0,spacing:p="0",color:l,className:f,style:x,"data-cy":v,"data-testid":y,...j},u)=>{const N=v||`divider-${t}`,g=y||`divider-${t}`,h=o(()=>n(p,"horizontal"===t?s:m),[p,t]);/* @__PURE__ */
2
- return r(i.Root,{ref:u,decorative:c,orientation:t,className:a(d,e[t],...h,f),style:{...l&&{backgroundColor:l},...x},"data-cy":N,"data-testid":g,...j})});c.displayName="Divider";export{c as Divider};
1
+ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{useId as i,useState as r,useMemo as l}from"react";import{Icon as d}from"@adam-milo/icons";import{cn as n}from"./index67.js";import{Checkbox as o}from"./index12.js";import{Radio as c}from"./index13.js";import{Input as s}from"./index74.js";import{Filter as u,FilterTrigger as p,FilterContent as h,FilterTitle as f,FilterFooter as m,FilterReset as y,FilterApply as $,FilterBody as v,useFilter as b}from"./index47.js";import{listStyles as x,emptyStateStyles as P,optionLabelStyles as g,optionRowDisabledStyles as N,optionRowStyles as A}from"./index105.js";const C=[];function V({options:i,mode:n,cyPrefix:o,testIdPrefix:c,searchable:u,searchPlaceholder:p,radioGroupName:h}){const[f,m]=r(""),y=l(()=>{if(!u||!f.trim())return i;const e=f.trim().toLowerCase();return i.filter(a=>a.label.toLowerCase().includes(e))},[i,u,f]);/* @__PURE__ */
2
+ return a(t,{children:[u&&
3
+ /* @__PURE__ */e(s,{type:"text",placeholder:p||"Search",leftIcon:/* @__PURE__ */e(d,{name:"MagnifyingGlassIcon",size:"sm",color:"icon-secondary"}),value:f,onChange:e=>m(e.currentTarget.value),"aria-label":p||"Search options","data-cy":`${o}-search`,"data-testid":`${c}-search`}),
4
+ /* @__PURE__ */e(v,{"data-cy":`${o}-body`,"data-testid":`${c}-body`,children:/* @__PURE__ */e("div",{className:x,children:0===y.length?/* @__PURE__ */e("span",{className:P,"data-cy":`${o}-empty`,"data-testid":`${c}-empty`,children:"No matches"}):"single"===n?/* @__PURE__ */e(k,{options:y,cyPrefix:o,testIdPrefix:c,radioGroupName:h}):/* @__PURE__ */e(I,{options:y,cyPrefix:o,testIdPrefix:c})})})]})}function I({options:i,cyPrefix:r,testIdPrefix:l}){const{draftValue:d,setDraftValue:c}=b(),s=Array.isArray(d)?d:[];/* @__PURE__ */
5
+ return e(t,{children:i.map(t=>{const i=`${l}-option-${t.value}-input`;/* @__PURE__ */
6
+ return a("label",{htmlFor:i,className:n(A,t.disabled&&N),"data-cy":`${r}-row-${t.value}`,"data-testid":`${l}-row-${t.value}`,children:[
7
+ /* @__PURE__ */e(o,{id:i,checked:s.includes(t.value),disabled:t.disabled,onChange:e=>{return a=t.value,void(e.currentTarget.checked?s.includes(a)||c([...s,a]):c(s.filter(e=>e!==a)));var a},"data-cy":`${r}-option-${t.value}`,"data-testid":`${l}-option-${t.value}`}),
8
+ /* @__PURE__ */e("span",{className:g,children:t.label})]},t.value)})})}function k({options:i,cyPrefix:r,testIdPrefix:l,radioGroupName:d}){const{draftValue:o,setDraftValue:s}=b();/* @__PURE__ */
9
+ return e(t,{children:i.map(t=>{const i=`${l}-option-${t.value}-input`;/* @__PURE__ */
10
+ return a("label",{htmlFor:i,className:n(A,t.disabled&&N),"data-cy":`${r}-row-${t.value}`,"data-testid":`${l}-row-${t.value}`,children:[
11
+ /* @__PURE__ */e(c,{id:i,name:d,value:t.value,checked:o===t.value,disabled:t.disabled,onChange:()=>s(t.value),"data-cy":`${r}-option-${t.value}`,"data-testid":`${l}-option-${t.value}`}),
12
+ /* @__PURE__ */e("span",{className:g,children:t.label})]},t.value)})})}function O(t){const{options:i,value:r,defaultValue:l,onApply:d,title:n,searchable:o=!1,searchPlaceholder:c,open:s,defaultOpen:v,onOpenChange:b,disabled:x,hideReset:P=!1,"aria-label":g,"data-cy":N,"data-testid":A}=t,I=N||"check-filter",k=A||"check-filter";/* @__PURE__ */
13
+ return a(u,{emptyValue:C,value:r,defaultValue:l,onApply:d,open:s,defaultOpen:v,onOpenChange:b,isActive:e=>Array.isArray(e)&&e.length>0,children:[
14
+ /* @__PURE__ */e(p,{"aria-label":g||"Filter",disabled:x,"data-cy":I,"data-testid":k}),
15
+ /* @__PURE__ */a(h,{"data-cy":`${I}-content`,"data-testid":`${k}-content`,children:[void 0!==n&&/* @__PURE__ */e(f,{"data-cy":`${I}-title`,"data-testid":`${k}-title`,children:n}),
16
+ /* @__PURE__ */e(V,{options:i,mode:"multi",cyPrefix:I,testIdPrefix:k,searchable:o,searchPlaceholder:c,radioGroupName:""}),
17
+ /* @__PURE__ */a(m,{"data-cy":`${I}-footer`,"data-testid":`${k}-footer`,children:[!P&&/* @__PURE__ */e(y,{}),
18
+ /* @__PURE__ */e($,{})]})]})]})}function j(t){const{options:r,value:l,defaultValue:d,onApply:n,title:o,searchable:c=!1,searchPlaceholder:s,open:v,defaultOpen:b,onOpenChange:x,disabled:P,hideReset:g=!1,"aria-label":N,"data-cy":A,"data-testid":C}=t,I=A||"check-filter",k=C||"check-filter",O=i();/* @__PURE__ */
19
+ return a(u,{emptyValue:null,value:l,defaultValue:d,onApply:n,open:v,defaultOpen:b,onOpenChange:x,isActive:e=>null!==e,children:[
20
+ /* @__PURE__ */e(p,{"aria-label":N||"Filter",disabled:P,"data-cy":I,"data-testid":k}),
21
+ /* @__PURE__ */a(h,{"data-cy":`${I}-content`,"data-testid":`${k}-content`,children:[void 0!==o&&/* @__PURE__ */e(f,{"data-cy":`${I}-title`,"data-testid":`${k}-title`,children:o}),
22
+ /* @__PURE__ */e(V,{options:r,mode:"single",cyPrefix:I,testIdPrefix:k,searchable:c,searchPlaceholder:s,radioGroupName:O}),
23
+ /* @__PURE__ */a(m,{"data-cy":`${I}-footer`,"data-testid":`${k}-footer`,children:[!g&&/* @__PURE__ */e(y,{}),
24
+ /* @__PURE__ */e($,{})]})]})]})}function w(a){return"single"===a.mode?/* @__PURE__ */e(j,{...a}):/* @__PURE__ */e(O,{...a})}w.displayName="CheckFilter";export{w as CheckFilter};
package/dist/index49.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),t=require("./index58.cjs"),s=require("@adam-milo/icons"),n=require("./index5.cjs"),l=require("./index97.cjs"),r=a.forwardRef(({children:a,logoCenterOnMobile:r=!1,logo:o,nav:i,onHamburgerClick:d,onLogoClick:c,logoAriaLabel:u="Go to home",showSettings:y=!0,showUserMenu:g=!0,userInitials:m,onSettingsClick:b,onUserMenuClick:h,activeMenu:p=null,scrollMode:x="auto",className:S,headerClassName:$,"data-testid":j,"data-cy":v,...C},k)=>{const N=v||"auth-layout",M=j||"auth-layout",W="contained"===x?l.rootContainedStyles:l.rootAutoStyles;return e.jsxs("div",{ref:k,className:t.cn(W,S),"data-testid":M,"data-cy":N,"data-scroll-mode":x,...C,children:[e.jsx("div",{className:t.cn(l.backgroundStyles),"data-testid":`${M}-background`,"data-cy":`${N}-background`,"aria-hidden":"true"}),e.jsxs("header",{className:t.cn(l.headerBaseStyles,(y||g||null!=i)&&l.headerDesktopLayoutAlwaysStyles,r&&!(y||g||null!=i)&&l.headerMobileLogoCenterStyles,null!=i&&l.headerWithNavStyles,$),"data-testid":`${M}-header`,"data-cy":`${N}-header`,children:[c?e.jsx("button",{type:"button",onClick:c,className:t.cn(l.logoWrapperBaseStyles,l.logoButtonStyles,r&&!(y||g||null!=i)&&l.logoWrapperMobileCenterStyles),"data-testid":`${M}-logo`,"data-cy":`${N}-logo`,"aria-label":u,children:o}):e.jsx("div",{className:t.cn(l.logoWrapperBaseStyles,r&&!(y||g||null!=i)&&l.logoWrapperMobileCenterStyles),"data-testid":`${M}-logo`,"data-cy":`${N}-logo`,children:o}),null!=i&&e.jsx("nav",{className:l.navWrapperStyles,"data-testid":`${M}-nav`,"data-cy":`${N}-nav`,children:i}),(y||g||null!=i)&&e.jsxs("nav",{className:t.cn(l.menuWrapperStyles),"aria-label":"Header menu","data-testid":`${M}-menu`,"data-cy":`${N}-menu`,children:[y&&e.jsx(n.MenuIconButton,{variant:"settings",selected:"settings"===p,onClick:b,"aria-label":"Settings","data-testid":`${M}-settings-btn`,"data-cy":`${N}-settings-btn`}),g&&e.jsx(n.MenuIconButton,{variant:"user",initials:m,selected:"user"===p,onClick:h,"aria-label":m?`User menu - ${m}`:"User menu","data-testid":`${M}-user-btn`,"data-cy":`${N}-user-btn`}),null!=i&&e.jsx("button",{type:"button",onClick:d,className:"hidden max-lg:flex items-center justify-center p-2 bg-transparent border-none cursor-pointer","aria-label":"Open menu","data-testid":`${M}-hamburger`,"data-cy":`${N}-hamburger`,children:e.jsx(s.Icon,{name:"CustomHamburgerIcon",size:"lg",color:"text",decorative:!0})})]})]}),a]})});r.displayName="AuthLayout",exports.AuthLayout=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),i=require("./index10.cjs"),l=require("./index18.cjs"),a=require("./index47.cjs"),r=require("./index106.cjs");function n({min:n,max:s,step:d,inputPlaceholder:u,allowMin:c,cyPrefix:o}){const{draftValue:m,setDraftValue:p}=a.useFilter(),x=m??n,y=t.useCallback(e=>{p(c||e!==n?e:null)},[p,c,n]),f=t.useCallback(e=>{const t=e.currentTarget.value;if(""===t||"-"===t)return void p(null);const i=parseInt(t,10);if(Number.isNaN(i))return;const l=Math.max(n,Math.min(s,i));p(l)},[s,n,p]);return e.jsxs("div",{className:r.rowStyles,children:[e.jsx("div",{className:r.sliderColumnStyles,children:e.jsx(l.Slider,{mode:"single",value:x,onChange:y,min:n,max:s,step:d,showScaleLabels:!0,"aria-label":"Numeric filter slider","data-cy":`${o}-slider`,"data-testid":`${o}-slider`})}),e.jsx("div",{className:r.inputColumnStyles,children:e.jsx(i.NumericInput,{value:null===m?"":String(m),onChange:f,min:n,max:s,step:d,integerOnly:!0,placeholder:u,"aria-label":"Numeric filter value","data-cy":`${o}-input`,"data-testid":`${o}-input`})})]})}function s({value:t,defaultValue:i,onApply:l,min:r=0,max:s=100,step:d=1,title:u,inputPlaceholder:c,open:o,defaultOpen:m,onOpenChange:p,disabled:x,hideReset:y=!1,allowMin:f=!1,"aria-label":h,"data-cy":j,"data-testid":b}){const g=j||"numeric-filter",v=b||"numeric-filter",N=c??String(r);return e.jsxs(a.Filter,{emptyValue:null,value:t,defaultValue:i,onApply:l,open:o,defaultOpen:m,onOpenChange:p,isActive:e=>null!==e,children:[e.jsx(a.FilterTrigger,{"aria-label":h||"Numeric filter",disabled:x,"data-cy":g,"data-testid":v}),e.jsxs(a.FilterContent,{"data-cy":`${g}-content`,"data-testid":`${v}-content`,children:[void 0!==u&&e.jsx(a.FilterTitle,{"data-cy":`${g}-title`,"data-testid":`${v}-title`,children:u}),e.jsx(a.FilterBody,{"data-cy":`${g}-body`,"data-testid":`${v}-body`,children:e.jsx(n,{min:r,max:s,step:d,inputPlaceholder:N,allowMin:f,cyPrefix:g})}),e.jsxs(a.FilterFooter,{"data-cy":`${g}-footer`,"data-testid":`${v}-footer`,children:[!y&&e.jsx(a.FilterReset,{}),e.jsx(a.FilterApply,{})]})]})]})}s.displayName="NumericFilter",exports.NumericFilter=s;
package/dist/index49.js CHANGED
@@ -1,4 +1,10 @@
1
- import{jsxs as a,jsx as e}from"react/jsx-runtime";import{forwardRef as t}from"react";import{cn as n}from"./index58.js";import{Icon as l}from"@adam-milo/icons";import{MenuIconButton as r}from"./index5.js";import{navWrapperStyles as i,backgroundStyles as s,logoWrapperMobileCenterStyles as o,logoButtonStyles as d,logoWrapperBaseStyles as c,menuWrapperStyles as u,headerWithNavStyles as m,headerMobileLogoCenterStyles as g,headerDesktopLayoutAlwaysStyles as b,headerBaseStyles as h,rootContainedStyles as $,rootAutoStyles as y}from"./index97.js";const p=t(({children:t,logoCenterOnMobile:p=!1,logo:v,nav:C,onHamburgerClick:N,onLogoClick:k,logoAriaLabel:f="Go to home",showSettings:x=!0,showUserMenu:j=!0,userInitials:M,onSettingsClick:U,onUserMenuClick:H,activeMenu:L=null,scrollMode:S="auto",className:w,headerClassName:A,"data-testid":I,"data-cy":O,...z},G)=>{const q=O||"auth-layout",B=I||"auth-layout";/* @__PURE__ */
2
- return a("div",{ref:G,className:n("contained"===S?$:y,w),"data-testid":B,"data-cy":q,"data-scroll-mode":S,...z,children:[
3
- /* @__PURE__ */e("div",{className:n(s),"data-testid":`${B}-background`,"data-cy":`${q}-background`,"aria-hidden":"true"}),
4
- /* @__PURE__ */a("header",{className:n(h,(x||j||null!=C)&&b,p&&!(x||j||null!=C)&&g,null!=C&&m,A),"data-testid":`${B}-header`,"data-cy":`${q}-header`,children:[k?/* @__PURE__ */e("button",{type:"button",onClick:k,className:n(c,d,p&&!(x||j||null!=C)&&o),"data-testid":`${B}-logo`,"data-cy":`${q}-logo`,"aria-label":f,children:v}):/* @__PURE__ */e("div",{className:n(c,p&&!(x||j||null!=C)&&o),"data-testid":`${B}-logo`,"data-cy":`${q}-logo`,children:v}),null!=C&&/* @__PURE__ */e("nav",{className:i,"data-testid":`${B}-nav`,"data-cy":`${q}-nav`,children:C}),(x||j||null!=C)&&/* @__PURE__ */a("nav",{className:n(u),"aria-label":"Header menu","data-testid":`${B}-menu`,"data-cy":`${q}-menu`,children:[x&&/* @__PURE__ */e(r,{variant:"settings",selected:"settings"===L,onClick:U,"aria-label":"Settings","data-testid":`${B}-settings-btn`,"data-cy":`${q}-settings-btn`}),j&&/* @__PURE__ */e(r,{variant:"user",initials:M,selected:"user"===L,onClick:H,"aria-label":M?`User menu - ${M}`:"User menu","data-testid":`${B}-user-btn`,"data-cy":`${q}-user-btn`}),null!=C&&/* @__PURE__ */e("button",{type:"button",onClick:N,className:"hidden max-lg:flex items-center justify-center p-2 bg-transparent border-none cursor-pointer","aria-label":"Open menu","data-testid":`${B}-hamburger`,"data-cy":`${q}-hamburger`,children:/* @__PURE__ */e(l,{name:"CustomHamburgerIcon",size:"lg",color:"text",decorative:!0})})]})]}),t]})});p.displayName="AuthLayout";export{p as AuthLayout};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useCallback as a}from"react";import{NumericInput as i}from"./index10.js";import{Slider as l}from"./index18.js";import{Filter as n,FilterTrigger as r,FilterContent as d,FilterTitle as o,FilterBody as c,FilterFooter as s,FilterReset as u,FilterApply as m,useFilter as p}from"./index47.js";import{rowStyles as f,sliderColumnStyles as h,inputColumnStyles as y}from"./index106.js";function x({min:n,max:r,step:d,inputPlaceholder:o,allowMin:c,cyPrefix:s}){const{draftValue:u,setDraftValue:m}=p(),x=u??n,v=a(e=>{m(c||e!==n?e:null)},[m,c,n]),$=a(e=>{const t=e.currentTarget.value;if(""===t||"-"===t)return void m(null);const a=parseInt(t,10);if(Number.isNaN(a))return;const i=Math.max(n,Math.min(r,a));m(i)},[r,n,m]);/* @__PURE__ */
2
+ return e("div",{className:f,children:[
3
+ /* @__PURE__ */t("div",{className:h,children:/* @__PURE__ */t(l,{mode:"single",value:x,onChange:v,min:n,max:r,step:d,showScaleLabels:!0,"aria-label":"Numeric filter slider","data-cy":`${s}-slider`,"data-testid":`${s}-slider`})}),
4
+ /* @__PURE__ */t("div",{className:y,children:/* @__PURE__ */t(i,{value:null===u?"":String(u),onChange:$,min:n,max:r,step:d,integerOnly:!0,placeholder:o,"aria-label":"Numeric filter value","data-cy":`${s}-input`,"data-testid":`${s}-input`})})]})}function v({value:a,defaultValue:i,onApply:l,min:p=0,max:f=100,step:h=1,title:y,inputPlaceholder:v,open:$,defaultOpen:N,onOpenChange:b,disabled:g,hideReset:j=!1,allowMin:M=!1,"aria-label":O,"data-cy":P,"data-testid":V}){const w=P||"numeric-filter",C=V||"numeric-filter",A=v??String(p);/* @__PURE__ */
5
+ return e(n,{emptyValue:null,value:a,defaultValue:i,onApply:l,open:$,defaultOpen:N,onOpenChange:b,isActive:e=>null!==e,children:[
6
+ /* @__PURE__ */t(r,{"aria-label":O||"Numeric filter",disabled:g,"data-cy":w,"data-testid":C}),
7
+ /* @__PURE__ */e(d,{"data-cy":`${w}-content`,"data-testid":`${C}-content`,children:[void 0!==y&&/* @__PURE__ */t(o,{"data-cy":`${w}-title`,"data-testid":`${C}-title`,children:y}),
8
+ /* @__PURE__ */t(c,{"data-cy":`${w}-body`,"data-testid":`${C}-body`,children:/* @__PURE__ */t(x,{min:p,max:f,step:h,inputPlaceholder:A,allowMin:M,cyPrefix:w})}),
9
+ /* @__PURE__ */e(s,{"data-cy":`${w}-footer`,"data-testid":`${C}-footer`,children:[!j&&/* @__PURE__ */t(u,{}),
10
+ /* @__PURE__ */t(m,{})]})]})]})}v.displayName="NumericFilter";export{v as NumericFilter};