@adam-milo/ui 1.0.129 → 1.0.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +2 -2
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +1 -1
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +1 -1
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +1 -1
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +1 -1
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +1 -1
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +1 -1
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +1 -1
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +1 -1
- package/dist/index108.cjs +1 -0
- package/dist/index108.js +1 -0
- package/dist/index109.cjs +1 -0
- package/dist/index109.js +1 -0
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index110.cjs +1 -0
- package/dist/index110.js +1 -0
- package/dist/index111.cjs +1 -0
- package/dist/index111.js +1 -0
- package/dist/index112.cjs +1 -0
- package/dist/index112.js +1 -0
- package/dist/index113.cjs +1 -0
- package/dist/index113.js +1 -0
- package/dist/index114.cjs +1 -0
- package/dist/index114.js +1 -0
- package/dist/index115.cjs +1 -0
- package/dist/index115.js +1 -0
- package/dist/index116.cjs +1 -0
- package/dist/index116.js +1 -0
- package/dist/index117.cjs +1 -0
- package/dist/index117.js +1 -0
- package/dist/index118.cjs +1 -0
- package/dist/index118.js +1 -0
- package/dist/index119.cjs +1 -0
- package/dist/index119.js +1 -0
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index120.cjs +1 -0
- package/dist/index120.js +1 -0
- package/dist/index121.cjs +1 -0
- package/dist/index121.js +1 -0
- package/dist/index122.cjs +1 -0
- package/dist/index122.js +1 -0
- package/dist/index123.cjs +1 -0
- package/dist/index123.js +1 -0
- package/dist/index124.cjs +1 -0
- package/dist/index124.js +1 -0
- package/dist/index125.cjs +1 -0
- package/dist/index125.js +1 -0
- package/dist/index126.cjs +1 -0
- package/dist/index126.js +1 -0
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +1 -1
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +8 -3
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +3 -6
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +6 -2
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +2 -2
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +2 -2
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +2 -2
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +2 -2
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +2 -2
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +2 -2
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +2 -2
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +2 -2
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +2 -2
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +2 -2
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +2 -4
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +4 -2
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +2 -2
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +2 -4
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +4 -8
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +8 -2
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +2 -4
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +4 -8
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +8 -8
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +1 -1
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +8 -9
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +9 -2
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +2 -5
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +5 -2
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +2 -10
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +2 -9
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +3 -2
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +3 -2
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +24 -2
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +10 -4
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +1 -1
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +13 -2
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +38 -3
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +10 -2
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +1 -2
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +9 -2
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +2 -2
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +2 -10
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -11
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +4 -1
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +2 -1
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +1 -1
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +3 -1
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +2 -1
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +2 -1
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +2 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +2 -1
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +10 -9
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +11 -1
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +1 -1
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +1 -1
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +1 -1
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +1 -1
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +1 -2
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +1 -1
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +1 -1
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +1 -1
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +9 -1
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +1 -7
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +1 -1
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +1 -1
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +1 -1
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +2 -1
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +1 -1
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +1 -1
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +1 -1
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +1 -1
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +1 -1
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +1 -1
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +7 -1
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +1 -1
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +1 -1
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +1 -1
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +1 -1
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +1 -1
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +1 -1
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +1 -1
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +1 -1
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +1 -1
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +1 -1
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +1 -1
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +1 -1
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +1 -1
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +1 -1
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +1 -1
- package/dist/src/components/data-display/check-filter/CheckFilter.component.d.ts +8 -0
- package/dist/src/components/data-display/check-filter/CheckFilter.component.d.ts.map +1 -0
- package/dist/src/components/data-display/check-filter/CheckFilter.styles.d.ts +6 -0
- package/dist/src/components/data-display/check-filter/CheckFilter.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/check-filter/CheckFilter.types.d.ts +68 -0
- package/dist/src/components/data-display/check-filter/CheckFilter.types.d.ts.map +1 -0
- package/dist/src/components/data-display/date-filter/DateFilter.component.d.ts +9 -0
- package/dist/src/components/data-display/date-filter/DateFilter.component.d.ts.map +1 -0
- package/dist/src/components/data-display/date-filter/DateFilter.styles.d.ts +96 -0
- package/dist/src/components/data-display/date-filter/DateFilter.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/date-filter/DateFilter.types.d.ts +102 -0
- package/dist/src/components/data-display/date-filter/DateFilter.types.d.ts.map +1 -0
- package/dist/src/components/data-display/date-filter/dateUtils.d.ts +100 -0
- package/dist/src/components/data-display/date-filter/dateUtils.d.ts.map +1 -0
- package/dist/src/components/data-display/filter/Filter.component.d.ts +21 -0
- package/dist/src/components/data-display/filter/Filter.component.d.ts.map +1 -0
- package/dist/src/components/data-display/filter/Filter.styles.d.ts +27 -0
- package/dist/src/components/data-display/filter/Filter.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/filter/Filter.types.d.ts +141 -0
- package/dist/src/components/data-display/filter/Filter.types.d.ts.map +1 -0
- package/dist/src/components/data-display/filter-button/FilterButton.component.d.ts +5 -0
- package/dist/src/components/data-display/filter-button/FilterButton.component.d.ts.map +1 -0
- package/dist/src/components/data-display/filter-button/FilterButton.styles.d.ts +10 -0
- package/dist/src/components/data-display/filter-button/FilterButton.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/filter-button/FilterButton.types.d.ts +18 -0
- package/dist/src/components/data-display/filter-button/FilterButton.types.d.ts.map +1 -0
- package/dist/src/components/data-display/numeric-filter/NumericFilter.component.d.ts +8 -0
- package/dist/src/components/data-display/numeric-filter/NumericFilter.component.d.ts.map +1 -0
- package/dist/src/components/data-display/numeric-filter/NumericFilter.styles.d.ts +14 -0
- package/dist/src/components/data-display/numeric-filter/NumericFilter.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/numeric-filter/NumericFilter.types.d.ts +53 -0
- package/dist/src/components/data-display/numeric-filter/NumericFilter.types.d.ts.map +1 -0
- package/dist/src/components/data-display/range-filter/RangeFilter.component.d.ts +8 -0
- package/dist/src/components/data-display/range-filter/RangeFilter.component.d.ts.map +1 -0
- package/dist/src/components/data-display/range-filter/RangeFilter.styles.d.ts +18 -0
- package/dist/src/components/data-display/range-filter/RangeFilter.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/range-filter/RangeFilter.types.d.ts +44 -0
- package/dist/src/components/data-display/range-filter/RangeFilter.types.d.ts.map +1 -0
- package/dist/src/components/data-display/sort-button/SortButton.component.d.ts +5 -0
- package/dist/src/components/data-display/sort-button/SortButton.component.d.ts.map +1 -0
- package/dist/src/components/data-display/sort-button/SortButton.styles.d.ts +5 -0
- package/dist/src/components/data-display/sort-button/SortButton.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/sort-button/SortButton.types.d.ts +27 -0
- package/dist/src/components/data-display/sort-button/SortButton.types.d.ts.map +1 -0
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/numeric-input/NumericInput.types.d.ts +14 -0
- package/dist/src/components/forms/numeric-input/NumericInput.types.d.ts.map +1 -1
- package/dist/src/components/forms/slider/Slider.component.d.ts +5 -0
- package/dist/src/components/forms/slider/Slider.component.d.ts.map +1 -0
- package/dist/src/components/forms/slider/Slider.styles.d.ts +21 -0
- package/dist/src/components/forms/slider/Slider.styles.d.ts.map +1 -0
- package/dist/src/components/forms/slider/Slider.types.d.ts +72 -0
- package/dist/src/components/forms/slider/Slider.types.d.ts.map +1 -0
- package/dist/src/components/overlays/popover/Popover.component.d.ts +27 -0
- package/dist/src/components/overlays/popover/Popover.component.d.ts.map +1 -0
- package/dist/src/components/overlays/popover/Popover.styles.d.ts +2 -0
- package/dist/src/components/overlays/popover/Popover.styles.d.ts.map +1 -0
- package/dist/src/components/overlays/popover/Popover.types.d.ts +18 -0
- package/dist/src/components/overlays/popover/Popover.types.d.ts.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -2
package/dist/index40.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return
|
|
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"),
|
|
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("./index96.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;
|
package/dist/index41.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
|
|
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"./index67.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"./index96.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};
|
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"),
|
|
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{
|
|
2
|
-
|
|
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"),
|
|
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
|
|
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"./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("
|
|
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
|
|
2
|
-
return
|
|
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"),
|
|
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
|
|
2
|
-
return
|
|
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"),
|
|
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
|
|
2
|
-
return
|
|
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"),
|
|
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
|
|
2
|
-
return t("
|
|
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"),
|
|
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
|
|
2
|
-
return
|
|
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"),
|
|
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
|
|
2
|
-
return
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
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};
|